500 likes | 950 Views
PDR604: Extending and Customizing PowerDesigner. David Dichman Sr. Product Manager, PowerDesigner dichman@sybase.com August 15-19, 2004. The Enterprise. Unwired. The Enterprise. Unwired. Industry and Cross Platform Solutions. Manage Information. Unwire Information. Unwire People.
E N D
PDR604: Extending and Customizing PowerDesigner David Dichman Sr. Product Manager, PowerDesigner dichman@sybase.com August 15-19, 2004
The Enterprise. Unwired. Industry and Cross Platform Solutions Manage Information Unwire Information Unwire People • Adaptive Server Enterprise • Sybase IQ • Dynamic Archive • Dynamic ODS • Real Time Data Services • Replication Server • OpenSwitch • Mirror Activator • PowerDesigner • Connectivity Options • EAServer • PowerBuilder Family • Unwired Accelerator • Unwired Orchestrator • Unwired Toolkit • SQL Anywhere Studio • Mobile Email & Applications • Enterprise Portal • XcelleNet Frontline Solutions • PocketBuilder • AvantGo Sybase Workspace
Topics • PowerDesigner Options • PowerDesigner Metamodel • Definition Files • Object Language Definition (XOL) • DBMS Definition (XDB) • Process Language Definition (XPL) • XML Language Definition (XSL) • Extended Model Definitions (XEM) • Free Model • Definition Files (Applies to all Definition files) • Generation • Transformation Profiles • Generation Template Language • VB Script
PowerDesigner Options • What • Method for controlling PowerDesigner behavior. • Display Preferences – controls visual aspects of PowerDesigner • Model Options – controls model specific aspects of PowerDesigner • General Options – options not specific to any particular model • Why • Alter PowerDesigner behavior to best suit your needs • Changes can either be model specific or set as defaults for new models created • How • General Features Guide – Chapter 3 - Using the PowerDesigner Interface – Defining Global Options • General Features Guide – Chapter 7 – Managing Models – sections dealing with Naming Conventions and Conversion • General Features Guide – Chapter 14 – Model Graphics – Model Display Preferences
PowerDesigner Metamodel • What • A description of PowerDesigner objects, properties and methods • Why • Learn how to access PowerDesigner objects • Using VBScript • Using Generation Template Language • Using other languages that support COM • Understand PowerDesigner XML formatted models • How • PowerDesigner home directory\Examples\Metamodel.oom • Set of UML class diagrams graphically representing the metamodel • PowerDesigner home directory\pdvbs9.chm • Hyperlinked reference document of the PowerDesigner Metamodel
PowerDesigner Metamodel – Concepts • Inheritance • Metamodel uses inheritance extensively • Allows access to properties and methods of parents • Allows assignment of behavior to parent, which gets inherited by children • Collection Types • Read-only – only allow browsing • Unordered – order of objects is not important (Relationships of an Entity) • Ordered – order of objects in the collection is controlled by the user (Columns) • Composition – collection which is owned by a parent (Columns of a Table)
PowerDesigner Metamodel – Organization • PdCommon • All object shared by two or more models • Abstract classes • Features shared by all models, i.e. Reporting • PdCDM - Conceptual Data Model • PdPDM - Physical Data Model • PdOOM - Object Oriented Model • PdBPM - Business Process Model • PdXSM -XML Model • PdFRM - Free Model • PdRMG - Repository • PdWSP - Workspace
Object Language Definition File (XOL) • What • Method used by PowerDesigner that contains specifications for a particular object language. It contains the syntax templates for generation, stereotypes, data types and constants for a supported language. • Why • Used by PowerDesigner engineering to support all the languages • Used by users to alter standard languages to better suit their needs • Used by users to add new languages that are not shipped with PowerDesigner • How • Advanced User Documentation – Chapter 2 – Using Profiles • Advanced User Documentation – Chapter 3 – Object Languages Reference Guide • Review included XOL files for understanding and ideas
Object Language Definition File (XOL) • Settings • Namings – naming conventions used for PowerDesigner generated objects • Getter and Setter operations • Invalid characters • Special objects – vary by language • Datatypes – lists of valid data types including conversions to PowerDesigner internal data types • BasicDatatypes – contains the languages supplied data types • AdditionalDataTypes – contains additional data types allowed or developed • ConceptualDataTypes – complete list of PowerDesigner internal data types and how to convert them to the target language. Used for inter model generation • Special conversions – language specific conversions i.e. Java to SOAP
Object Language Definition File (XOL) • Settings (Continued) • Constants – list of language supplied constants and their values • Events – language specific events specified as parameters of an operation • Used extensively by PowerBuilder • Generation - see Extended Model Definition section • Profile - see Extended Model Definition section • Transformation Profiles - see Extended Model Definition section • Most of the smarts of an XOL are in the Generation and Profile section. This will be covered in upcoming sections.
DBMS Definition File (XDB) • What • Method used by PowerDesigner that contains specifications for a particular Database Management System (DBMS). It contains the syntax templates for generation, reverse engineering, data types and constants for a supported DBMS. • Why • Used by PowerDesigner engineering to support all the DBMS • Used by users to alter standard DBMS to better suit their needs • Used by users to add new DBMS that are not shipped with PowerDesigner • How • Advanced User Documentation – Chapter 1 – DBMS Reference Guide • Advanced User Documentation – Chapter 2 – Managing Profiles • Physical Data Model User’s Guide – Chapter 13 – Variables in PowerDesigner– Chapter 14 – DBMS-Specific Features • Review included XDB files for understanding and ideas
DBMS Definition File (XDB) • General – DBMS Identification and general flags that apply for all objects • Script - DBMS characteristics, command definition, and data type translations for script generation and reverse engineering • SQL – contains values that define the general syntax for the database • Syntax - Contains general parameters for SQL syntax • Format - Contains entries that define script formatting • File - Text entries used during the database generation • Keywords - List of reserved words and functions available in SQL • Objects – details for each type of object available for generation to and reverse engineering from the database
DBMS Definition File (XDB) • Script (cont) • DataType – lists of valid data types including conversions to PowerDesigner internal data types • AmcdDataType – list of PowerDesigner internal data types mapped to DBMS data types • OdbcPhysDataType - translation table from ODBC data types to target DBMS data types • PhysDataType – contains the translation table from target database data types to internal data types • PhysDttpSize - table of storage sizes of target DBMS data type • PhysOdbcDataType – contains data type translations from target DBMS to ODBC • HostDataType – translation from database data type to procedure data type • Abstract translation files – several files for abstraction data type translation • Customize – homeless information imported from PowerDesigner 6 DEF files
DBMS Definition File (XDB) • ODBC – same structure as Script category. Used for ODBC generation when DBMS Script category does not suffice • Profile – see Extended Model Definition section • Transformation Profiles - see Extended Model Definition section • Trigger templates – list of pre-defined trigger templates indicating referential integrity • Trigger type – insert, update, delete • Trigger template items – list of pre-defined trigger template items to support the PowerDesigner trigger templates
Process Language Definition (XPL) • What • Method used by PowerDesigner that contains specifications for a particular business process language or methodology. It contains the syntax templates for generation, stereotypes, and settings to control the behavior of a business process model. • Why • Used by PowerDesigner engineering to support all the process languages • Used by users to alter standard languages to better suit their needs • Used by users to add new languages that are not shipped with PowerDesigner • How • Advanced User Documentation – Chapter 2 – Using Profiles • Advanced User Documentation – Chapter 4 – Process Languages Reference Guide • Review included XPL files for understanding and ideas
Process Language Definition (XPL) • Settings • Implementation – control the process implementation • Loop Types • Operation Types • Messaging • … • DataHandling – constants which control how data and flows are handled • Choreography – controls which types of objects can be placed where • Allow multiple starts • Top level objects
Process Language Definition (XPL) • Generation - see Extended Model Definition section • Profile - see Extended Model Definition section • Transformation Profiles - see Extended Model Definition section • Most of the smarts of an XPL are in the Generation and Profile section. This will be covered in upcoming sections.
XML Language Definition (XSL) • What • Method used by PowerDesigner that contains specifications for a particular XML Definition language. It contains the syntax templates for generation and valid datatypes. • Why • Used by PowerDesigner engineering to support all the XML Definition languages • Used by users to alter standard languages to better suit their needs • Used by users to add new languages that are not shipped with PowerDesigner • How • Advanced User Documentation – Chapter 2 – Using Profiles • Advanced User Documentation – Chapter 5 – XML Languages Reference Guide • Review included XSL files for understanding and ideas
XML Language Definition (XSL) • Settings • DataTypes – control the mapping of PowerDesigner internal datatypes to the valid XML definition datatypes • Generation - see Extended Model Definition section • Profile - see Extended Model Definition section • Transformation Profiles - see Extended Model Definition section • Most of the smarts of an XSL are in the Generation and Profile section. This will be covered in upcoming sections.
Extended Model Definitions (XEM) • What • Mechanism for extending PowerDesigner behavior outside of the context of a target definition file • Contains graphical, functional and generation parameters • Why • Used by PowerDesigner engineering to support various functions • Can be used to complement object language generation – Application servers support • Can be used to generate totally new text files – Robustness report • Users can customize included behavior to better suit their needs • Users can add totally new functionality • How • Advanced User Documentation – Chapter 2 – Using Profiles • Advanced User Documentation – Chapter 4 – Extended Model Definitions Reference Guide • Review included XEM files for understanding and ideas
Extended Model Definitions (XEM) • XEM can be created for each of PowerDesigner’s model types • Business Process Model • Object Oriented Model • Physical Data Model • Free Model • Conceptual Data Model • XML Model • XEM’s are specific to each model type, • i.e. can not be shared between model types.
Extended Model Definitions (XEM) • Extended Model Definition properties • Name and Code – uniquely identify this definition • File Name – where XEM is saved, blank if internal to the model • Family – Classify an XEM, usually to associate it with an Object Language • Sub Family – further classification of and XEM within the selected family • Auto attach – determines whether the default is to include this XEM in new models created targeting the family specified above • Category – used to control generation options • Enable Trace Mode – debugging/learning tool that lets you preview the templates used • Complement Language generation – determines whether this XEM definition will be used in the language generation process
Definition Files (Free Models) • Generic model which can be customized to create any kind of diagram • Can generate text files based on objects in the Free Model • Can generate reports on object in the Free Model • Uses XEM for customizing it’s behavior • Only contains two graphical objects • ExtendedObject • ExtendedLink • All customization done via Stereotypes and Criterion
Definition Files (All Definition Files) • Generation section – define optional tasks to be processed after generation and options used during generation • Commands – actual commands which will be executed post generation • Written in the Generation Template Language • Just writing the command does nothing, must be linked to a task and selected at the time of generation • Tasks – actual list presented during generation, these reference one or more commands defined above • Options – options user can specify as part of the generation process • Variables which are displayed and set at generation • Options values can be referenced in all templates • Option types allowed – boolean, String or List
Definition Files (All Definition Files) • Generation section
Definition Files (All Definition Files) • Transformation Profiles – Group of transformations used during model generation • Can target to model type, Family and Subfamily • Pre-generation – transformations executed before generation in the source model • Post-generation – transformation executed after generation in the target model • PowerDesigner’s beginning stages of supporting Model Driven Architecture(MDA) • Design Patterns could be built using the transformation logic
Definition Files (All Definition Files) • Transformation Profiles Section
Definition Files (All Definition Files) – Profiles • What • Extension mechanism for customizing the PowerDesigner Metamodel. • Categorizing objects, customizing graphics, adding metadata, adding object specific generation options and more • Why • Used by PowerDesigner engineering in all definition files • Allows the implementation of stereotypes for categorizing most types of objects. • Allows customizing graphics based on object type and category • Customize context menus based on object type • Add additional metadata to specific object or categories of objects • And much much more! • How • Advanced User Documentation – Chapter 2 – Managing Profiles • Review supplied definition files for examples of usage
Definition Files (All Definition Files) – Profiles • Shared – contains extended attribute types or templates which can be used by any object • Metaclass level extensions • Determines the level at which the extension applies • Extensions apply to all instances of the metaclass • The PowerDesigner metamodel is object oriented and thus supports inheritance • Tip – When adding metaclasses, change the filter to show abstract classes • Example – Extended attributes applied to the following levels would apply to • NamedObject - applies to all objects • Classifier - applies to Classes and Interfaces • Class - applies to Classes only
Definition Files (All Definition Files) – Profiles • Instance level extensions • Stereotype – extension applies to instances of the object which have had the stereotype set to match • Example Java Classes – EJBEntity, EJBSession, WebAppListener • Criterion – extension applies to instances of the object which match the Criterion’s condition • Example Java Classes – Bean Class, Servlet Class, WebServices Class
Definition Files (All Definition Files) – Profiles • For Metaclass level extensions the following can be added • Stereotypes – sub-classification on instances of the metaclass • Custom Tool – allows the creation of a tool pallete object to ease the creation of objects • Criteria – sub-classification on instances of the metaclass based on a condition • Extended Attributes – additional metadata which can be controlled by instance and used to control generation • Custom Checks – enhance the validation of instances when check model is performed • Custom Symbol – customize the visual display of objects to better identify the instances
Definition Files (All Definition Files) – Profiles • For Metaclass level extensions the following can be added • Templates and Generated files – used to generate text files based on the model • Methods and Menus – These two are used to add entries to context menus. Methods hold the vbscript to execute, menus are the text that show in the menu • Event Handler - Definition of a script to catch the occurrence of an event on an object • Extended Collection - Definition of an additional link between a selected metaclass or stereotype, and another metaclass or stereotyped metaclass • Transformations - Definition of a transformation script that defines a set of actions to be executed during generation or upon request
Definition Files (All Definition Files) – Profiles • For Instance level extensions the following can be added • Extended Attributes – additional metadata which can be controlled by instance and used to control generation • Custom Checks – enhance the validation of instances when check model is performed • Custom Symbol – customize the visual display of objects to better identify the instances • Templates and Generated files – used to generate text files based on the model • Methods and Menus – These two are used to add entries to context menus. Methods hold the vbscript to execute, menus are the text that show in the menu • Event Handler - Definition of a script to catch the occurrence of an event on an object • Extended Collection - Definition of an additional link between a selected metaclass or stereotype, and another metaclass or stereotyped metaclass • Transformations - Definition of a transformation script that defines a set of actions to be executed during generation or upon request
Generation Template Language • What • PowerDesigner internal template based language used for text generation • Used in Definition files (XOL, XDB and XEM) to generate files based on a model • Why • Allows for all PowerDesigner generation to be flexible • Used by PowerDesigner engineering to generate text files • Can be used by users to alter files generated by PowerDesigner to suit your individual needs • Can be used to generate entirely new files. • How • Review supplied object language definitions and extended model definitions • Advanced User Documentation – Chapter 5 – Generation Reference Guide
VB Script • What • Microsoft scripting language • Why • Automate repetitive tasks • Import / Export information • Extend PowerDesigner via additional model checks • Access PowerDesigner information from other applications • Used by PowerDesigner engineering to implement certain functionality • How • Review supplied sample scripts • PowerDesigner home directory\VBScripts • PowerDesigner home directory\OLE Automation • Get familiar with the PowerDesigner Metamodel • Experiment - *Backup your models first*
VB Script • What is supported • Object manipulation – Full Create, Update or Delete control on all PowerDesigner objects including graphical objects • Repository access – connect, extract, consolidate and manage versions • Invoke reports • Generation • Generate new model • Regenerate into existing model • Generate files • What is not supported • Reverse engineering • Algorithms like • Rebuild indexes • Rebuild triggers
VB Script – Within PowerDesigner • Develop • Code editor within PowerDesigner • Tools > Execute Commands > Edit/Run Script • Your favorite Text Editor or IDE • Execute • Tools > Execute Commands > Edit/Run Script • Add to menus • Tools > Execute Commands > Customize Commands • Can add entries to Tools > Execute Commands menu • Can add entries to File > Import menu • Can be setup to be specific to • certain model types • Certain diagrams • Certain target Extended Model Definitions • Definition Files/Profiles/Object/Menu • Add entries to specific objects context sensitive menu • XML Add-ins – method for automatically attaching VB Script to menus at startup • Requires registry entry
VB Script – Within PowerDesigner – Walk Thru • VB Script Walkthru
VB Script – Outside of PowerDesigner • PowerDesigner metamodel is published and available to COM compliant applications and languages • Visual Basic for Applications • Word and Excel • Visual Basic • C# • And more • Required method if you need any sort of user interface
Conclusion QUESTIONS ???