E185 PowerDesigner for Java - PowerPoint PPT Presentation

1 / 56
About This Presentation
Title:

E185 PowerDesigner for Java

Description:

Visually define and communicate the structure and behavior of ... Navigability: Is there a reference variable? Visibility: Visibility of the reference variable ... – PowerPoint PPT presentation

Number of Views:144
Avg rating:3.0/5.0
Slides: 57
Provided by: sybas
Category:

less

Transcript and Presenter's Notes

Title: E185 PowerDesigner for Java


1
E185PowerDesigner for Java
  • Xiao Wang
  • PowerDesigner Chief Architect
  • EBD
  • xwang_at_sybase.com

2
PowerDesigner for Java Overview
  • PowerDesigner for Java
  • Brief Overview of the UML
  • Overview of the PowerDesigner Object-Oriented
    Model
  • Building an OOM for Java
  • Creating Servlets and JSPs
  • Defining O/R Mapping and Creating EJBs
  • Creating Web Service Components
  • Reporting and Repository
  • Conclusion

3
Brief Overview of UML
  • Why Use Object-Oriented Modeling?
  • Visually define and communicate the structure and
    behavior of a software system
  • Represent systems using OO concepts
  • Abstraction Describe using relevant
    characteristics
  • Encapsulation Combine Data and Methods
  • Inheritance Supertype/Subtype
  • Polymorphism Overloading and Overriding
  • Link concepts to executable code

4
Brief Overview of UML
  • The UML consists of 9 diagrams
  • Static
  • Class and Object diagrams
  • Dynamic
  • Use Case, Sequence, Statechart, Collaboration and
    Activity diagrams
  • Implementation
  • Component and Deployment diagrams

5
Class Diagram in UML
  • Classes and Interfaces
  • attributes, operations, constructors, accessors
  • Relationships
  • Generalizations (Inheritances), realizations,
    associations and dependencies

6
Example of a Class Diagram in PowerDesigner
7
Component Diagram in UML
  • Components
  • Classes, Interfaces, Operations
  • Component type (Standard, Servlet, EJBs, Web
    Service)
  • Dependencies, Generalizations

8
Example of Component Diagram in PowerDesigner
9
The PowerDesigner Object-Oriented Model
  • PowerDesigner V9.5 OOM supports all the 9 UML
    diagrams.
  • PowerDesigner OOM supports the following
    languages
  • Java, C, VB .NET, C, PowerBuilder, IDL, VB6,
    XML and WSDL
  • For Java, PowerDesigner V9.5 supports
  • Round-trip Java generation/reverse engineering
  • Servlet, JSP, EJB including O/R mapping
  • Web Services

10
The PowerDesigner OOM User-Interface
11
Building an OOM for Java
  • Create a Class Diagram
  • Design packages, classes, interfaces, attributes,
    operations,
  • Preview the Java code
  • Implement the Java methods using an IDE
  • Generate the Java code
  • Reverse engineer Java classes
  • Iterative round-trip engineering

12
Defining Packages
  • Packages in UML
  • A logical container for objects that belong
    together
  • Provides a way to partition and manage work
  • Provides namespace scope for objects
  • Packages in Java
  • Directory structure containing objects
  • Classes are known by their Package (path) and
    class name
  • Packages in PowerDesigner
  • Add model management capabilities
  • Ideally a container for related objects

13
Defining Classes
  • Generated Code

/
Module Item.java Author xwang
Modified Friday, June 28, 2002 113900 AM
Purpose Defines the Class Item
/
package Product import java.util. public
class Item public int itemNumber public
java.lang.String itemName public double
itemPrice public int getItemNumber()
return itemNumber public
java.lang.String getItemName() return
itemName public double
getItemPrice() return itemPrice
The Item Class
14
Defining Generalizations
  • Generated Code

/
Module Product.java Author xwang
Modified Friday, June 28, 2002 113900 AM
Purpose Defines the Class Product
/
package Product import java.util. public
class Product extends Item public
java.lang.String category public
java.lang.String getCategory() return
category / _at_param newCategory /
public void setCategory(java.lang.String
newCategory) category newCategory

Generalization (Inheritance)
15
Defining Attributes
16
Defining Operations
  • Create operations
  • Generate default constructor, static initializer
  • Generate default getters and setters
  • Add operations defined in a parent classes or
    interfaces

17
Implementing an Operation
18
Defining Associations
  • Associations are the relationships between
    classes
  • Implementation depends on the definition of
  • Multiplicity Is this a single reference or
    array?
  • Navigability Is there a reference variable?
  • Visibility Visibility of the reference variable
  • Role Names Name given to the reference variable

19
Defining Interfaces
  • Generated Code

package Product import java.util. public
interface IItem int getItemNumber()
java.lang.String getItemName() double
getItemPrice()
The IItem Interface
package Product import java.util. public
class Item implements IItem public int
itemNumber public java.lang.String itemName
public double itemPrice public int
getItemNumber() return itemNumber

The Item Class
20
Object Reuse in PowerDesigner
  • Shortcuts
  • PowerDesigner allows classes defined in one
    package or model to be reused in other packages
    and models via Shortcuts.
  • Shortcuts define an object that is outside the
    model or package in question. It acts like a
    pointer to the original object.
  • Replication Objects (new in V9.5)
  • It is a copy of the original object. Users can
    modify the original objects and the replicated
    objects.

21
Preview the Java Code of a Class
22
Editing the Java Code in an IDE
  • PowerDesigner does not generate complete code for
    all methods.
  • Users need to implement the methods using
    PowerDesigner or an IDE (JBuilder, Visual Café,
    )
  • You can use the Edit With feature to launch an
    IDE. PowerDesigner will automatically copy the
    modified Java code back in the model and
    synchronize the model with the code.

23
Generating the Java Code
  • You can select the objects you want to generate,
    the location and the generation options.

24
Generating the Java Code
  • You could compile the Java code, generate Java
    doc and deploy components in an Application
    Server.

25
Reverse Engineering Java Code
  • Recover Java code
  • Reverse engineer from a .java or .class file
  • Select from individual files, a directory or an
    archive
  • PowerDesigner can create a new OOM or extend an
    existing one
  • Understand existing Java applications
  • Capture a library for reference in other models
  • Synchronize a model with externally edited code

26
Iterative Round-Trip Engineering
  • Build and test as the Design matures
  • Create an OOM
  • Generate Java code and edit in an IDE
  • Reverse engineer the edited code to synchronize
    the Model
  • Modify the Model
  • Generate new code from the updated Model

27
Creating Servlets and JSPs
  • Creating Servlets
  • Use Component and Class to represent a Servlet
  • Creating JSPs
  • Use File object to represent a JSP

28
Creating Servlets
  • Use the Create Servlet wizard to create a Servlet
  • Implement the Servlet code
  • Compile and deploy

Servlet component
Servlet class
29
Creating Servlets
  • Implementing the Servlet methods

30
Creating Servlets
  • Generate Servlet code and Web Deployment
    Descriptor
  • Compile and create the .WAR file
  • Deploy the .WAR file

31
Creating JSPs
  • Use the Create JSP wizard to create a JSP
  • Implement the JSP code
  • Generate and deploy the .WAR file

32
Creating JSPs
  • Implementing the JSP code using the internal
    editor or an external editor (DreamWaver, )

33
Defining O/R Mapping and Creating EJBs
  • Designing the objects
  • Designing the database for objects persistence
  • Defining the O/R mapping
  • Creating EJBs (Enterprise Java Beans)
  • Generating EJBs and O/R mapping descriptor
  • Deploy EJBs

34
Designing the Database
  • PowerDesigner is also a very powerful Database
    Design tool
  • Bi-level Database Design
  • Conceptual Data Model (CDM)
  • Normalized, Implementation (RDBMS) independent
  • Physical Data Model (PDM)
  • Database Specific Generates DDL to a script or
    to database live via an ODBC connection

35
Example of a PDM for Sybase SQL Anywhere
/
/ / Table customer
/ /
/ create table
DBA.customer ( id integer not
null default autoincrement, fname
char(15) not null, lname char(20)
not null, address char(35) not null,
city char(20) not null, state
char(2) not null, zip char(10)
not null, phone char(12) not
null, company_name char(35), primary key
(id) ) /
/ / Index ix_cust_name
/ /
/ create index
ix_cust_name on DBA.customer ( lname ASC,
fname ASC ) with hash size 10
36
Objects from Legacy Systems
  • PowerDesigner captures existing database
    structures and translates them to Java
  • Reverse engineer the Database to a PDM
  • Generate an OOM (Java) from the PDM
  • Gives Object Designers a view of existing
    database objects
  • Jump-start to building Business Logic (new
    applications) around legacy data stores
  • Generate the O/R mapping
  • Iterative
  • Build, generate and synchronize models as the
    application takes shape

37
Defining the Object/Relational Mapping
  • Generate O/R mapping when generating a PDM from
    an OOM
  • Generate O/R mapping when generating an OOM from
    a PDM
  • Customize the O/R mapping to support complex
    mappings
  • Customize the O/R mapping syntax for each
    application server
  • Support EJB-QL and stored-procedures

38
Example of the O/R Mapping
  • O/R mapping syntax for Sybase EAServer

39
Java in the Database (RDBMS)
  • Use PowerDesigner to model Java in the Database
  • Create OOM for Java Stored Procedures and Java
    Data Types
  • Create a PDM for the Database (Target your RDBMS)
  • Reuse objects from the OOM in the PDM as Data
    Types
  • Generate .java from the OOM to import to server
    to support Data Types and add Stored Procedures

40
Creating Enterprise Java Beans (EJBs)
  • PowerDesigner supports CMP Entity Beans, BMP
    Entity Beans, Stateless Session Beans, Statefull
    Session Beans and Message Driven Beans.
  • PowerDesigner generates the source code, the
    deployment descriptor and the O/R mapping
    descriptor.
  • PowerDesigner could compile the code, create the
    JAR file, run J2EE verifier and deploy the JAR
    file.
  • PowerDesigner supports Sybase EAServer, BEA
    WebLogic and Cocobase today. Support of other
    servers could be added by creating a profile.

41
Creating a Container Managed Persistence (CMP) EJB
  • Create a package
  • Create a class inside the package
  • Generate or define the O/R mapping
  • Use the Create Enterprise JavaBean wizard to
    create a CMP EJB
  • Set properties (transaction, )
  • Implement additional business methods
  • Verify the source code and the deployment
    descriptor
  • Generate the code, compile, verify and deploy

42
Example of a CMP EJB
  • Example of the EJB wizard

The EJB component
The Bean class
43
Generating EJBs
  • Use ToolsgtGenerate Java Code to generate EJBs
  • Select the tasks to perform after the code
    generation

44
Creating Web Services
  • PowerDesigner V9.5 supports
  • Creating Web Services components for Java and
    .NET
  • Generating server side code for Java and .NET
  • Generating client proxy code for Java and .NET
  • Browsing UDDI to find Web Services (WSDL)
  • Importig and generating WSDL

45
Creating Web Services for Java
  • For Java, PowerDesigner V9.5 supports
  • Servlet Web Service using JAXM
  • Java Web Service using JAXRPC
  • Generating server side code and client proxy
    using JAXRPC tool
  • Deploying EJBs as Web Services when the  Web
    Services for J2EE  (JSR109) specification will
    be finalized

46
Creating a Servlet Web Service
  • Use the Create Web Service wizard to create a
    Servlet Web Service
  • Select Java Servlet as the Component type
  • Implement the onMessage() method
  • Compile and deploy

47
Create a Web Service Component Using JAXRPC
  • Use the Create Web Service wizard to create a Web
    Service
  • Select Standard as the Component type
  • In the Java class, create one or several methods
  • Indicate these methods as Web Method
  • Implement these methods
  • Generate the Java code
  • In the generation window, select the XRPCC
    commands to generate server side and/or client
    side code

48
Example of the Generated WSDL
49
Deploy EJBs as Web Service Components
  • PowerDesigner will use the  J2EE for Web
    Services  (JSR109) specification to generate
    deployment descriptor and .EAR file to deploy
    Stateless Session Beans as Web Services.
  • The specification is not finalized yet.
  • EAServer 5.0 will support JSR109.

50
Browse UDDI to Search Web Services
  • PowerDesigner V9.5 provides a UDDI browser to
    allow users to search Web Services (search WSDL)

51
Import WSDL
  • PowerDesigner V9.5 imports WSDL files or URLs
    (found in UDDI)
  • PowerDesigner creates Web Service component from
    the WSDL

52
Extending PowerDesigners Java Support
  • Users could extend PowerDesigners Java support
  • Use the template based generic generator (GTL) to
    generate other Java components (JDO, Ant build
    script, unit test programs, )
  • Use VB Script or VBA to work directly with the
    PowerDesigner models (import, export, generate
    more complex code, )
  • Use XMI import/export to integrate with other
    code generators

53
Documentation and Reporting
  • PowerDesigner provides comprehensive reporting
    capabilities
  • Print Graphics to see model diagrams
  • Create Report to include objects metadata
  • Multi-model report to span all models in a
    workspace
  • Report Print Preview
  • Generate HTML or RTF reports
  • Multi-language support

54
Repository
  • PowerDesigner has an enterprise repository for
    model sharing and management
  • Consolidation/Extraction of Models and other
    non-PowerDesigner files
  • Object level versioning
  • Branching, Configurations
  • Security
  • Open Database (RDBMS vs. flat-file system)
  • Write your own reports using SQL or other
    reporting tools (InfoMaker, Crystal Reports, etc)

55
Conclusion
  • PowerDesigner for Java
  • OO Analysis and Design for Java targets
  • Support all UML diagrams
  • Java code generation (Front End, Middle Tier,
    Database)
  • Persistence modeling with RDBMS specific PDM
  • Full Round-Trip Iterative Development of
    Applications (including persistence)
  • Documentation and Reporting for metadata analysis
  • Enterprise repository for team work
  • Scalable to the Enterprise

56
More information!
  • Other sources of PowerDesigner Information
  • Best Practices in Object-Oriented Modeling Using
    PowerDesigner (E188)
  • Web Services in PowerDesigner (E187)
  • PowerDesigner Business and Object Modeling (E182)
  • CocoBase, EAServer and PowerDesigner (E141)
  • PowerDesigner Supporting the Enterprise (E183)
  • Enterprise Modeling Overview for IT Managers
    (E186)
  • Database Modeling Tips Tricks (E185)
  • Exhibit Hall Booth
  • http//www.sybase.com/powerdesigner/
  • Whitepapers, Newsgroup, knowledgebase, and
    evaluation copies of the tool available for
    download
Write a Comment
User Comments (0)
About PowerShow.com