1 / 56

E185 PowerDesigner for Java

E185 PowerDesigner for Java. Xiao Wang PowerDesigner Chief Architect EBD xwang@sybase.com. 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

hop
Télécharger la présentation

E185 PowerDesigner for Java

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. E185PowerDesigner for Java • Xiao Wang • PowerDesigner Chief Architect • EBD • xwang@sybase.com

  2. 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 PowerDesigner for Java Overview

  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 andDeployment 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. 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 The PowerDesigner Object-Oriented Model

  10. The PowerDesigner OOM User-Interface

  11. 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 Building an OOM for Java

  12. 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 Defining Packages

  13. Generated Code: Defining Classes /************************************************* * Module: Item.java * Author: xwang * Modified: Friday, June 28, 2002 11:39:00 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 11:39:00 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; } /** @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. 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 Defining Associations

  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. 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. Object Reuse in PowerDesigner

  21. Preview the Java Code of a Class

  22. 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. Editing the Java Code in an IDE

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

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

  25. 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 Reverse Engineering Java Code

  26. 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 Iterative Round-Trip Engineering

  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. 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 Designing the Database

  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. 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 Objects from Legacy Systems

  37. 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 Defining the Object/Relational Mapping

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

  39. 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 Java in the Database (RDBMS)

  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 Tools>Generate 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)

More Related