11.07.2015 Views

WEB-ENABLE POWERBUILDER APPS WITH SYBASE EASERVER ...

WEB-ENABLE POWERBUILDER APPS WITH SYBASE EASERVER ...

WEB-ENABLE POWERBUILDER APPS WITH SYBASE EASERVER ...

SHOW MORE
SHOW LESS
  • No tags were found...

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

D I S T R I B U T E D A P P L I C A T I O N SEAServer Component Development ProcessPART 3A tutorialWRITTEN BYTIMOTHY BECKIn Part I of this series (PBDJ,Vol. 9, issue 2), I provided the necessary backgroundinformation for building EAServer components. I also introducedthe development workflow – a set of steps for building an applicationusing EAServer components. Using the workflow, you can create a Webbasedor a client/server application.Part 2 (PBDJ, Vol. 9, issue 3) focusedon developing EAServer components.Using the workflow from Part I as aguide, I showed you how to build objectsthat would become components, fromcreating a directory structure that supportsyour development to writing thecode. Finally, there was a developmentchecklist to ensure the objects werecomplete.Part 3 completes the componentdevelopment process. Here you’ll takethe final step in developing an EAServercomponent: deploying the component.Once again, pull out the developmentworkflow and keep it handy.Deploying Components to EAServerWhen a completed object is deployedit becomes a component. When developinga window or a Web page, severalcomponents may be involved, either bybeing called directly or through intercomponentcalls. Once the object isready to be deployed, start by deployingthe component to EAServer on the localmachine.In PowerBuilder, deployment occursusing a project. This project containsseveral important pieces of informationthat EAServer uses to manage the componentand handle its interaction withother components. It’s important tounderstand each property and itspotential impact on a component.PACKAGE NAMEA package is a collection of similarcomponents. Since EAServer is casesensitiveand you access components bypackage name, it’s important that thisname is spelled correctly and in theproper case.COMPONENT NAMEThis is the visible name of your component.In PowerBuilder, your objectname may be “n_cst_vendor”, but to therest of the world this component shouldbe called “Vendor”. Again, you’ll accesscomponents by name so it’s importantthat they’re spelled correctly and in theproper case.COMPONENT TYPE (STANDARD, SHARED, SERVICE)The overwhelming majority of yourcomponents will be standard, that is,they have no special attributes. The restwill be shared or service components.• Standard components are the workerbees of EAServer. They can be writtenin any language, they may supporttransaction management, and multipleinstances may be in memory at anygiven time. They can be pooled, i.e., aninstance, once created, is kept in memoryso other clients can reuse it.• Shared components are those sharedby all clients. There’s never more thana single instance of a shared component.It’s not thread-safe, so multipleinstances can’t run concurrently.Shared components are used forcaching relatively static data or makinginformation available that allclients can use.• Service components perform backgroundprocessing. EAServer runsthem when the server first starts up.They may run “forever,” or performsome task and stop. Service componentsare standard components with aspecial purpose. They’re referenced inthe EAServer server property“com.sybase.jaguar.server.services”, soEAServer knows to run them at startup.They contain three extra methods(subroutines – functions with noreturn value) that EAServer calls:–Start: Initializes the service component.Typically, you’ll set a Booleaninstance variable to “true” here.–Run: Does the actual work. Typically,this function is in a perpetual loopwhile the instance variable set inStart is true. You can use the“JagSleep” external function to putyour service component to sleep fora short time before processingagain.–Stop: Stops the component fromrunning. This method typically setsthe Boolean instance variable tofalse, causing the Run method tocomplete execution.TRANSACTION SUPPORT (NOT SUPPORTED, SUPPORTS,REQUIRES, REQUIRES NEW)Transaction support, along with stateprimitives, controls how EAServer handlesdatabase transactions. For transactionsupport to work, there are tworequirements:1. You must use a connection cache.2. You must set the “UseContextObject”dbparm value to true (UseContextObject=’Yes’).For several components to participatein a transaction, you must use a “transactioncoordinator” – a component that,through intercomponent calls (Create-Instance), calls the other componentsinvolved in a transaction. In addition,you must set the Transaction Supportproperty to one of the following:• Not Supported: The component won’tparticipate in a transaction. It’ll commitor roll back its changes independentof any other component.• Supports: Participates in the callers’transaction only if a transaction isrunning. If not, this component willact as if transaction support is set to“not supported.”• Requires: Creates a new transaction ifone isn’t already running. If there isone, it will participate in the callers’transaction.• Requires New: Always creates a newtransaction regardless of any currenttransactions. In effect, it allows you tonest transactions.20 PBDJ volume9 issue4www.SYS-CON.COM/pbdj/

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!