PDR602: Programming PowerDesigner with Java - PowerPoint PPT Presentation

1 / 28
About This Presentation
Title:

PDR602: Programming PowerDesigner with Java

Description:

COLLECTION. To get a collection, you need to use a GetXxx() method. ... Volker Saggau. Saggau_at_sybase.com. Please check TW download for updated version/code ... – PowerPoint PPT presentation

Number of Views:480
Avg rating:3.0/5.0
Slides: 29
Provided by: sybas
Category:

less

Transcript and Presenter's Notes

Title: PDR602: Programming PowerDesigner with Java


1
PDR602 Programming PowerDesigner with Java
Volker Saggau sen. Business Consultant Saggau_at_syba
se.com August 15-19, 2004
2
The Enterprise. Unwired.
3
The Enterprise. Unwired.
Industry and Cross Platform Solutions
Unwire People
Unwire Information
Manage Information
  • 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
4
AGENDA
  • Prerequisits
  • Why programming PowerDesigner?
  • How does PowerDesigner support programming
  • PowerDesigner in eclipse
  • Java access to PowerDesigner
  • Differences to VBA
  • Help

5
PREREQUISITS
  • eclipse with Java development
  • www.eclipse.org
  • PowerDesigner 10.1
  • PowerDesigner Plug-In
  • Knowledge of the PD internal object model

6
WHY PROGRAMMING POWERDESIGNER?
  • Getting data into PowerDesigner
  • Import from other sources as
  • Excel, Access, XML
  • Getting data out of PowerDesigner
  • Export to other sources as
  • Excel, Access, XML
  • Generation of code that is not (yet) supported by
    PowerDesigner
  • Special ASIQ code, eclipse, RepServer, Hybernate

7
HOW PD SUPPORTS PROGRAMMING
  • Within PowerDesigner
  • GTL ( Generation Template Language )
  • VBA ( Visual Basic for Applications )
  • OLE Interface
  • PowerBuilder
  • VB, C, et.al.
  • New PD offers Java access via the Java Proxy

8
POWERDESIGNER IN eclipse
  • PD PLUG-IN for eclipse

9
POWERDESIGNER PLUG-IN FOR eclipse
  • eclipse Plug-Ins for PowerDesign

10
AGENDA
  • Prerequisits
  • Why programming PowerDesigner?
  • How does PowerDesigner support programming
  • PowerDesigner in eclipse
  • Java access to PowerDesigner
  • Compare with VBA
  • Help

11
INSTALLATION
  • Error
  • java.lang.UnsatisfiedLinkError no swt-win32-2135
    in java.library.path
  • at java.lang.ClassLoader.loadLibrary(ClassLoader.
    java1491)
  • at java.lang.Runtime.loadLibrary0(Runtime.java78
    8)
  • at java.lang.System.loadLibrary(System.java834)
  • Correction
  • In directory
  • eclipsehome\plugins\org.eclipse.swt.win32_2.1.2\
    os\win32\x86
  • find the file
  • swt-win32-2135.dll
  • Copy into JRE_HOME/bin

12
SETTING JAVA ENVIRONMENT
  • If you want to edit, compile and run your Java
    programs without Eclipse, you will need to
    include the following JAR files in your
    classpath
  • ltECLIPSE_HOMEgt/plugins/org.eclipse.ui_2.1.2/workbe
    nch.jar
  • ltECLIPSE_HOMEgt/plugins/org.eclipse.core.resources_
    2.1.2/resources.jar
  • ltECLIPSE_HOMEgt/plugins/org.eclipse.swt.win32_2.1.2
    /ws/win32/swt.jar
  • ltECLIPSE_HOMEgt/plugins/org.eclipse.core.runtime_2.
    1.2/runtime.jar
  • ltECLIPSE_HOMEgt/plugins/org.eclipse.core.boot_2.1.2
    /boot.jar
  • pdj2com.jar

13
THE JAVA PROXY
  • The PowerDesigner Java proxies are in the
    pdj2com.jar file.
  • This JAR file is generated from PowerDesigner COM
    objects typelibs. It is dependent to a specific
    version of PowerDesigner.
  • For each PowerDesigner COM object, there is a
    corresponding Java proxy object.
  • For example, for PdOOM.Class, there is a
  • com.sybase.powerdesigner.PdOOM.Class Java proxy.
  • For PdCommon.Application, there is a
  • com.sybase.powerdesigner.PdCommon.Application
    Java proxy.

14
PD APPLICATION OBJECT PROXY
  • To get the PowerDesigner application object
    proxy, you should write code like
  •  
  • import com.sybase.powerdesigner.PdCommon.
  •  
  • public Application pdApp
  • pdApp Application.getInstance()
  •  
  • To release the PowerDesigner application object,
    you should write
  • pdApp.Release()

15
IMPORTING PD MODULES
  • Each PowerDesigner module has a specific package.
    You can use import to import the modules you
    want to use. If simplifies the Java proxy class
    names if there is no conflict with Java.
  • Example
  • import com.sybase.powerdesigner.PdCommon.
  • import com.sybase.powerdesigner.PdOOM.

16
JAVA PROXY TYPE CONVERSION
  • There is no automatic type conversion between
    Java proxies. For example, if a FindObject()
    function returns the
  • com.sybase.powerdesigner.PdCommon.BaseObject
  • Java proxy and you want to assign it to a
  • com.sybase.powerdesigner.PdOOM.Class
  • Java proxy object, you need to explicitly convert
    it into the right type. Example
  • com.sybase.powerdesigner.PdOOM.Class aClass
  • aClass new com.sybase.powerdesigner.PdOOM.Class(
    FindObject())

17
CONSTANTS
  • You can use the class type constant like for
    other languages. For example
  • if (!pdApp.GetActiveModel().isNull()
  • (pdApp.GetActiveModel().IsKindOf(
    PdOOM_Classes.cls_Model))
  • PdOOM_Classes is defined in the
  • com.sybase.powerdesigner.PdOOM package.

18
PROPERTIES AND METHODS
  • When you use VBScript or OLE automation, the COM
    objects have constants, properties and methods.
  • When you use Java proxies, the properties should
    be replaced by Get and Set functions.
  • VB example
  • PdCommon.BaseModel model application.ActiveModel
  • Java Proxy example
  • com.sybase.powerdesigner.PdCommon.BaseModel
    aModel
  • aModel application.GetActiveModel()
  • Some languages accept optional parameters for
    methods. The PowerDesigner Java proxies generate
    several Java methods with different signatures.

19
COLLECTION
  • To get a collection, you need to use a GetXxx()
    method.
  • For example, if you have an OOM model Java proxy
    and you need to get the number of classes in the
    classes collection, you can write
  • int nbClasses oomModel.GetClasses().GetCount()
  • To get an element of a collection, you can use
    the Item(index) method of the collection. The
    Item() method returns a BaseObject Java proxy,
    you need to convert it to the right type. The
    index starts from 0. Example
  • com.sybase.powerdesigner.PdOOM.Class firstClass
  • firstClass new com.sybase.powerdesigner.PdOOM.Cl
    ass(aPackage.GetClasses().Item(0))

20
SAMPLE - GetXxxx() FUNCTIONS OF PACKAGE
21
ObjectBag
22
ObjectCol
23
NAMING CONFLICT
  • Some PowerDesigner Java proxy objects have a
    naming conflict with Java objects. For example
  • Class
  • Package
  • Process
  • In this case, you need to use the fully qualified
    name.
  • For example
  • import com.sybase.powerdesigner.PdOOM.
  •  
  • public class test
  • public Model oomModel
  • public com.sybase.powerdesigner.PdOOM.Class
    aClass // Use qualified name

24
OUTPUT PARAMETER
  • In some PowerDesigner functions, some parameters
    could be of the type output (can be modified).
  • Java does not support output parameters.
  • The workaround is creating a Java array with
    dimension 1 of the parameter type and use it to
    call the method.

25
LIVE DEMO
26
QUESTIONS
27
SUMMARY
  • A new powerfull way for creative users to access
    PowerDesigner
  • Is used by Sybase itself
  • Give it a try

28
THANK YOU
  • Volker Saggau
  • Saggau_at_sybase.com
  • Please check TW download for updated version/code
Write a Comment
User Comments (0)
About PowerShow.com