1 / 75

IA358 PowerBuilder Components in Enterprise Application Server

IA358 PowerBuilder Components in Enterprise Application Server. Jim O’Neil Principal Technical Support Engineer Enterprise Solutions Division joneil@sybase.com. Discuss various ‘beyond the basic’ topics of interest to PowerBuilder developers deploying to EAServer

fisseha
Télécharger la présentation

IA358 PowerBuilder Components in Enterprise Application Server

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. IA358PowerBuilder Components in Enterprise Application Server • Jim O’Neil • Principal Technical Support Engineer • Enterprise Solutions Division • joneil@sybase.com

  2. Discuss various ‘beyond the basic’ topics of interest to PowerBuilder developers deploying to EAServer PowerBuilder component deployment Component types and threading issues EJB 1.x support Database and transaction support Handling exceptions Accessing EAServer properties Agenda

  3. What happens when you deploy a PowerBuilder component to EAServer? Interfaces Property files PBD deployment Stubs and skeletons PowerBuilder Component Deployment

  4. What are Interfaces? Specification of capabilities (methods and attributes) that a component implements and publicizes to clients Expressed in Interface Definition Language (IDL) and stored within Jaguar Repository as .idl files Deployment of component from PowerBuilder causes the creation of a new interface (and module) with the same name as the component (and package) Support for specifying interfaces when deploying PowerBuilder components is slated for version 8. PowerBuilder Component Deployment

  5. PowerBuilder Component Deployment IDL File Location:%Jaguar%/Repository/Modules/<module>/<interface>.idl package/component module::interface

  6. What are interfaces... Up to 16 interfaces can be retrofitted, but your component must fulfill the ‘contract’ All method names deploy in lowercase - watch out in case sensitive clients (C, Java) Names may be mangled to overcome CORBA restrictions, namely lack of support for Function overloading Handling NULL arguments and return types PowerBuilder Component Deployment

  7. What’s up with this name mangling? Names are mangled by appending __ (two underscores) and some ‘random’ characters, so avoid creating methods with two underscores in their names __XX... indicates an overloaded function, characters give some indication of data types A terminating sequence of __N additionally indicates that developer specified, at deployment time, that nulls may be passed in or out PowerBuilder Component Deployment

  8. What’s the name mangling ‘code?’ __<return_type>[<arg_type>]0..n[__N]0..1 PowerBuilder Component Deployment Return/Argument Type Indicators* * as of PB 7.0.2 (undocumented and subject to change)

  9. How does name mangling affect clients? Client should not use the mangled name if it is a Java client using EAServer’s Java ORB C++ client using EAServer’s C++ ORB PowerBuilder client (using EAServer’s C++ ORB) Client must use the mangled name if it Uses a different vendor’s client ORB to communicate with EAServer Uses EAServer’s Active-X Proxy PowerBuilder Component Deployment

  10. What’s this about no NULLs? Since NULLs cannot be marshalled, a new argument is optionally added at end of the function: CTS:NullValues nullflags (a boolean sequence) First value is T/F for null of return value Other values are T/F for null of arguments Cannot null out elements of structure or array arguments Non-PowerBuilder clients MUST include this additional parameter if it exists PowerBuilder Component Deployment

  11. What are component property files? Each component deployed to EAServer has its own property file called <component>.props located in %JAGUAR%\Repository\<package>\ A value of pb for the property com.sybase.jaguar.component.typeidentifies a PowerBuilder component (vs. Java, etc.) Seven properties are unique to PowerBuilder components (each property is prefaced by com.sybase.jaguar.component.pb) PowerBuilder Component Deployment

  12. Which properties are PowerBuilder-specific? .appname - PowerBuilder application object to be ‘started’ for the virtual machine (VM) session that is hosting the component’s execution .class - name of custom-class user object (CCUO) that implements the component .librarylist - PowerBuilder library list for component libraries prefaced by $ are sought in Repository other libraries are sought on the PATH PowerBuilder Component Deployment

  13. Which properties are PowerBuilder-specific... .cookie Specifies a numeric ‘version’ of the PBDs to be used Each build of a Jaguar component project causes a new version, n, of the PBDs to be built and stored in the Jaguar Repository at %JAGUAR%\Repository\Component\<package>\<component>\Cn where Cn is a directory containing the PBDs from that build of the component Meaningful only for libraries in library list prefaced by $ PowerBuilder Component Deployment

  14. Which properties are PowerBuilder-specific... .trace - a no-op (reserved for future use?) .debug- enables remote debugging In EAServer 3.0.x the property com.sybase.jaguar.component.debug was erroneously used to enable remote debugging For backward compatibility either setting will enable remote debugging, but since .component.debug has additional meaning in EAServer 3.5, the server trace will grow substantially to include debug diagnostics PowerBuilder Component Deployment

  15. Which properties are PowerBuilder-specific... .live_edit - enables live editing Causes the component to ‘deployed’ immediately when saving the component in User Object Painter When enabled, .librarylist contains server-resolved paths to PBLs specified in Deployment Project To set or clear, specify Jaguar project name in the General tab within the User Object painter PowerBuilder Component Deployment

  16. PBD Deployment - where’s it all go? Every build of a component (from project painter) causes a new directory to be created in the Repository at %JAGUAR%\Repository\Component\<package>\ <component>\Cn where n is the value of the.pb.cookie property + 1 All PBDs in .pb.librarylist prefaced by $ will be sought in the Cn directory PBDs not prefaced by $ are sought in the PATH PowerBuilder Component Deployment

  17. ... and how do I get rid of it? You can whittle the number of Cn directories down Manually Delete all the obsolete directories (e.g., C1 thru Cn-1) Rename Cn to C1 Set .pb.cookie property to 1 Restart EAServer (.pb.cookie is cached!) Automatically See, for example, the PowerBuilder CookieMonster at sdn.sybase.com/sdn/appdev/get_doc.stm? loc=1001841 PowerBuilder Component Deployment

  18. Stubs and Skeletons PowerBuilder components do not require skeletons They really don’t require stubs to other components either (regardless of component implementation) Proxies are merely there to validate PowerScript syntax Implementation (i.e., the user object itself) can serve the same purpose N.B., Having a proxy and implementation in the same library list has caused problems in the past and is best to avoid PowerBuilder Component Deployment

  19. What types of components can I deploy from PowerBuilder and how are they handled? Standard vs. shared vs. service Thread-related properties Concurrency Sharing BindThread BindObject Component Types and Threading Issues

  20. Component types - are there 3? or 2? or.. PowerBuilder’s Jaguar Component wizards expose three component types... Standard Shared Service and incorrectly imply that these are mutually exclusive! So how many component types are there??? Component Types and Threading Issues

  21. Component types - How many are there? Two… when you consider that a ‘shared’ component is nothing more than a property setting for either a service or a standard component One… when you consider that a service component is just a standard component that has two additional requirements Implements CTSServices::GenericService Included in server property com.sybase.jaguar.server.services Component Types and Threading Issues

  22. So, what’s a Standard Component? Well, they’re ‘standard’... Component Types and Threading Issues

  23. …and a Service Component? Just standard components with two twists: Implement CtsServices:GenericService Installed as a ‘service’ component on EAServer by adding it to the comma-delimited list of components in the server property com.sybase.jaguar.server.services in the format package/component[# of threads] (where [# of threads] is optional and defaults to 1) Component Types and Threading Issues

  24. What is required when using the CtsServices:GenericServiceinterface? start(): executed when server starts or component is refreshed and typically used for initialization code run(): called immediately after start() and typically used to perform iterative processing, periodically yielding execution on the thread by calling JagSleep (located in libjdispatch.dll) stop(): called when server shuts down or component is refreshed (well, it’s supposed to be called…) Component Types and Threading Issues

  25. Now, what’s a Shared Component again? Not so much a component type as it is a property (com.sybase.jaguar.component.sharing) Both ‘standard’ and ‘service’ components can be shared There can only be one instance of a shared component in existence at any given time Constructor fires once Activate fires for each client accessing the component Sharing has tremendous threading implications… Component Types and Threading Issues

  26. Are PowerBuilder components thread-safe? Fact: The PowerBuilder Virtual Machine (VM) is thread-safe to the session level. Translation: Each component instance runs in its own session Each session can only support one thread of execution THEREFORE A PowerBuilder component instance cannot simultaneously execute multiple client requests (i.e., methods) Component Types and Threading Issues

  27. What do I need to watch out for? The threading limitation typically is an issue only with PowerBuilder shared and service components. Must ensure that access to component is serialized For service components with a repeating loop in run(), this prevents any client access to that component! Use Java to implement the component instead, or Delegate work and data caching from the service component to other components Component Types and Threading Issues

  28. How does this translate to EAServer? com.sybase.jaguar.component.thread.safe When TRUE and it’s a shared component, multiple simultaneous threads through a single component instance are allowed (a BIG no-no for PowerBuilder!) When FALSE, only one component instance of a given component type can be in a method at any instant in time, so if it is a: Shared component - only one thread active Standard component - only one instance is executing a method, although many instances may be ‘active’ Component Types and Threading Issues

  29. What other properties affect threading? com.sybase.jaguar.component.bind.thread When TRUE, a method on a component instance must execute on same thread that created that instance Required for implementations that use thread-local storage Active-X component PowerBuilder components on NT that use a datastore which persists over method calls (.bind.thread.sharing)  (.thread.safe) (in other words, a shared component with a bound thread cannot support concurrent method execution) Component Types and Threading Issues

  30. Concurrency True False True Sharing False Component Types and Threading Issues Active thread Blocked thread Activated component instance

  31. Component Types and Threading Issues • NOT supported in PowerBuilder VM • Setting .bind.thread to TRUE overrides this combination, effectively turning off Concurrency and forcing serialization of requests to the shared component Concurrency = TRUE and Sharing = TRUE

  32. What’s up with this new BindObject property? Allows multiple client threads to execute in one instance (like a shared component) but also supports creation of multiple instances Due to PowerBuilder thread-safety issuesnot a viable property for a componentimplemented in PowerBuilder Component Types and Threading Issues

  33. Can I or can’t I talk to EJBs using PowerBuilder? Invoking an EJB from PowerBuilder client or a PowerBuilder component in EAServer Having PowerBuilder components pretend to be EJBs EJB 1.x Support

  34. Invoking an EJB from PowerBuilder Cannot be done via the PowerBuilder connection object ‘Bug’ in current implementation Fix due in PowerBuilder 8.0 Use the JaguarORB object in PowerBuilder Perform the CORBA calls individually Same processing as the PowerBuilder connection object, only we can work around the bug here EJB 1.x Support (as a client)

  35. EJBHome create method (home interface) Bean name for lookup(...bind.naming) business method (remote interface) Home interface class EJB 1.x Support (as a client)

  36. Show me Code! Variable declarations PowerBuilder system variables JaguarORB my_orb CORBAObject my_corbaobj Component proxies (EJB home and remote interfaces) JaguarLoan my_loan JaguarLoanHome my_loanhome SessionManager proxies (Jaguar SessionManager IDL) Session my_session Manager my_manager EJB 1.x Support (as a client)

  37. Show me Code!... Obtain an EAServer session EJB 1.x Support (as a client) my_orb = CREATE JaguarORB my_orb.init("") my_orb.String_to_Object( & "iiop://localhost:9000", my_corbaObj) my_corbaObj._narrow(my_manager, & "SessionManager/Manager" ) my_Session = my_manager.createSession( & "jagadmin","")

  38. Show me Code!... Instantiate component and invoke method Bean name for lookup Home interface class EJB 1.x Support (as a client) // obtain stub for home interface my_corbaObj = my_session.lookup("Loan") my_corbaObj._narrow(my_JaguarLoanHome, & "EJB/JaguarLoanHome") // obtain reference to EJBObject my_JaguarLoan = my_JaguarLoanHome.create() // invoke business methodamt = my_loan.calculate(125000, 360)

  39. Cool, now what about calling PowerBuilder components from EJB clients, namely PowerJ? Call using CORBA stubs Call using EJB stubs EJB 1.x Support (as a component)

  40. So how do I set PowerJ up to use CORBA stubs? In Jaguar Manager, generate CORBA 2.2 stubs from your PowerBuilder component Compile the stubs Use the Jaguar.InitialContext object Choose “Use Jaguar CORBA Initial Context Factory” from the Naming/SSL tab on the property sheet Lookup and instantiate component Invoke method as you would for any other component EJB 1.x Support (as a component)

  41. What Naming/SSL tab? EJB 1.x Support (as a component)

  42. How would I use EJB stubs? Create a home interface for the PowerBuilder component Generate and compile EJB 1.0 stubs for the component Leave Jaguar.InitialContext naming setting at the default of “Use Jaguar EJB Initial Context Factory” Lookup ‘EJB’ and instantiate home interface Call create() on home interface to get remote reference Call method on remote interface EJB 1.x Support (as a component)

  43. How do I create the home interface? Use Jaguar Manager (right mouse click on Interfaces) Choose “SetHome Interface…” Provide a name(for example,<compname>Home) EJB 1.x Support (as a component)

  44. How do I add the create method? Right mouse click on new home interface and select “New method…” Specify exception Specify return value EJB 1.x Support (as a component) Jaguar Programmers’ Guide says create() method is automatically created when you Set Home Interface.

  45. How do I create the PowerBuilder component? EAServer binds components to the name server using the name specified in the component property com.sybase.jaguar.component.bind.naming Defaults to <package>/<component> if not present Use Jaguar Manager to give the component an “EJB-friendly” name Use value of above property to perform the lookup on Jaguar.InitialContext and obtain home interface Call <home interface>.create() EJB 1.x Support (as a component)

  46. How do I call the PowerBuilder component? The return from the home interface’s create() method is a remote reference to the PowerBuilder component Call methods on this remote reference as you would for any other component type N.B., just because the component is masquerading as an EJB does not make it an EJB… it will follow the same component lifecycle it always has EJB 1.x Support (as a component)

  47. Ok, so what’s the tradeoff? Using CORBA stubs for PowerBuilder components Requires that Java client ‘know’ that it’s talking CORBA sometimes and EJB other times Requires no interaction with Jaguar Manager to deploy Using EJB stubs for PowerBuilder components Java client can be pure EJB client Redeployment of PowerBuilder component to Jaguar wipes out the home interface! - must be recreated manually each time EJB 1.x Support (as a component)

  48. What features of Jaguar connection caching and transaction coordination are supported? Mapping PowerBuilder database drivers to Jaguar connection caches Using XA/OTS transaction coordinator Support (limited) for proxy connections Database and Transaction Support

  49. What do I do to talk to Oracle? Oracle Use DBMS=O73 or O84 for OCI 7.x and OCI 8.x caches, respectively Recent fixes CR212564 - EAServer not engaging thread-safe Oracle libraries (SWR9110 / SWR8854) CR217809 - Cannot create cache with 8.1.x client (SWR9110) Database and Transaction Support

  50. … and to Sybase Adaptive Server? Sybase ASE Use DBMS=SYJ for Client Library 11.0 cache Use DBMS=SYC in development No property exists to specify database name, so be certain to set Database property on transaction object after connecting This interface is not supported when targeting other OpenServers (e.g., DirectConnect) Database and Transaction Support

More Related