Developing and Deploying Business Components using PowerJ.
-
Upload
jemimah-stevenson -
Category
Documents
-
view
228 -
download
3
Transcript of Developing and Deploying Business Components using PowerJ.
Developing and Deploying BusinessDeveloping and Deploying BusinessComponents using PowerJComponents using PowerJ
2
Developing and Deploying BusinessDeveloping and Deploying Businesscomponents using PowerJcomponents using PowerJ
Powerpoint presentation: http://www.sybase.com/products/eastudio/seminar
_info.html
under “Presentations” see “Phase II” and download:
EAServer 3.0 Overview and Building Components in PowerJ 3.0 (zip file)
Greg Burns - Technical Evangelist
Sybase Internet Applications Division
3
Build the Future - SyberSeminar SeriesBuild the Future - SyberSeminar Series
1. Building a shopping cart application with the Web DataWindow
2. Developing Business Components with PB
3. Developing Business Components in Java with PowerJ
4. Load Balancing Failover and High Availability
5. Implementing Web Security
4
eMusic Application PrevieweMusic Application Preview
5
Jaguar CTS
JDBCODBCNative
E-BusinessE-BusinessSybase SolutionSybase Solution
HTML
COM
PowerBuilderCORBA
Java PowerDynamo
HTTPS
IIOPIIOP
Enterprise Application Server
CGIISAPINSAPI
DataWindow
DataWindow
DataWindow
Datastore
6
Why use Java on the Server for businessWhy use Java on the Server for businesslogic components?logic components?
Multi-platform source code for business logic Java is a productive language for software development Commitment to developing in Java on all tiers On the server high-powered hardware and non-visual
programs combine to minimize any performance limitations of Java programs
Many corporations see Java programming as a way to attract and keep talented employees
7
To efficiently manage
Role of the Application ServerRole of the Application Server
Component instantiation and lifecycle
Server
8
To efficiently manage
Database connections
Role of the Application ServerRole of the Application Server
Component instantiation and lifecycle
Transactions
Server
9
To efficiently manage
Database connections
Role of the Application ServerRole of the Application Server
Component instantiation and lifecycle
Transactions Threads
Server
10
To efficiently manage
Database connections
Role of the Application ServerRole of the Application Server
Component instantiation and lifecycle
Transactions Threads Security Server
11
Creating a Java EA ServerCreating a Java EA ServerComponent with PowerJComponent with PowerJ
Steps
1. Create a Jaguar Server Bean Java class2. Code the Bean using Drag and Drop techniques3. Deploy the component to Jaguar CTS
12
Jaguar Component WizardJaguar Component WizardHighlightsHighlights
Set the TargetTarget , JarJar ,PackagePackage and Bean NameBean Name
Specify any InterfacesInterfaces to implement
13
Jaguar Deployment WizardJaguar Deployment WizardHighlightsHighlights
Specify Jaguar CTS packagepackage and componentcomponent names Specify the deployment classesdeployment classes
Define component life cyclelife cycle characteristics Define component transaction supporttransaction support characteristics
14
Component Life Cycle CharacteristicsComponent Life Cycle Characteristics
15
Instance PoolingInstance Pooling
Allows a single component instance to service multiple clients
Benefits Greatest scalability Many clients share limited
number of instances
Instance Pool
16
Supporting Instance Pooling Supporting Instance Pooling EJB Server Bean MethodsEJB Server Bean Methods
Activate Triggered when component is bound to client Used to (re)initialize instance-specific data
Deactivate Triggered when component is unbound from client Used for clean-up code
17
Instance PoolingInstance Pooling
Goal Minimize amount of time an instance remains bound
to a client (early deactivation) Design strategies
Stateful components Stateless components
18
Stateful ComponentsStateful Components
Maintain a state between method invocations Store properties as instance variables Expose methods to manipulate properties
19
Stateful ComponentsStateful Components
setAmount(15000)
Instance Pool
20
Stateful ComponentsStateful Components
setAmount(15000)setMonths(24)
calculate( )
return 725
Instance Pool
15000
24
21
Stateful ComponentsStateful Components
Instance Pool
22
Disadvantages of Stateful ComponentsDisadvantages of Stateful Componentsin Large-Scale Systemsin Large-Scale Systems
Lifetime Components have longer life (require resources)
Ownership Cannot be shared More instances must be created
Performance Larger number of RPCs across the network
23
Stateless ComponentsStateless Components
Stateless components cannot use instance-specific data to accumulate data between method invocations Do not retain information from one method
invocation to the next Client passes needed information as parameters
to the method
24
Stateless ComponentsStateless Components
calculate(15000,24)
Instance Pool
25
Stateless ComponentsStateless Components
calculate(15000,24)
return 725
Instance Pool
26
Stateless ComponentsStateless Components
Instance Pool
27
Advantages of Stateless ComponentsAdvantages of Stateless Componentsin Large-Scale Systemsin Large-Scale Systems
Lifetime Shorter life optimizes resource usage
Ownership Can be recycled Number of instances to create is minimized
Performance Improved due to fewer RPCs across the network
28
Defining a Stateless ComponentDefining a Stateless ComponentAutomaticallyAutomatically
Deployment-time attribute Instance automatically deactivated on method return
29
Defining a Stateless ComponentDefining a Stateless ComponentProgrammaticallyProgrammatically
InstanceContext functions completeWork( ) rollbackWork( )
30
Define Component Transaction SupportDefine Component Transaction Support
31
Define Component Transaction SupportDefine Component Transaction Support
Multiple components can participate in a single transaction
Each component performs part of the overall task
Jaguar transaction management lets you group database updates performed by multiple components into a single atomic unit of work
32
Account 1Account 1
ExampleExample
TellerTeller
Account 2Account 2
Transfer
1. Withdraw
2. Deposit
LogLog3. Write
33
What is the Scope of the Transaction?What is the Scope of the Transaction?Option 1Option 1
Withdraw Deposit Write to log
34
What is the Scope of the Transaction?What is the Scope of the Transaction?Option 2Option 2
Transaction 1 Withdraw Deposit
Transaction 2 Write to log
35
Account 1Account 1
Option 1Option 1
TellerTeller
Account 2Account 2
Transfer
1. Withdraw
2. Deposit
LogLog3. Write
36
Account 1Account 1
Option 2Option 2
TellerTeller
Account 2Account 2
Transfer
1. Withdraw
2. Deposit
LogLog3. Write
37
Starting to create an EAServer componentStarting to create an EAServer component in PowerJ in PowerJ
Bean Wizard Jaguar server component
38
Jaguar Component WizardJaguar Component WizardOutcomeOutcome
Java Classes eMusicJ.CartJ.java eMusicJ.CartJInterface.java ServerBean interface implementation code Form for design time coding of Non Visual objects
39
Step 2: Coding the ComponentStep 2: Coding the Component
activate() deactivate() retrieve( ) update( )
40
ActivateActivate
transaction_1.connect();
state = parm0;
41
Connection CachingConnection Caching
Components share pools of preallocated connections to remote database servers
Connection Cache
Connection Cache
IIOP
42
DeactivateDeactivate
transaction_1.disconnect();
43
Retrieve( )Retrieve( )
byte [ ][ ] state = new byte [1][ ];
ds_1.retrieve();
ds_1.getFullState(state);
return state[0];
44
Update( byte[ ] state )Update( byte[ ] state )
ds_1.setFullState( state );
45
Step 3: Deploy the ComponentStep 3: Deploy the Component
Configure PowerJ deployment options EAServer deployment wizard
46
HTML
Creating a Client Application Creating a Client Application
COM
PowerBuilderCORBA
Java
Enterprise Application Server
47
Creating a PowerJ Client ApplicationCreating a PowerJ Client Application
Step 1: Create a new Application using the new Target Wizard
Step 2: Create PowerJ Proxies
Step 3: Drag and Drop InitialContext component and proxy then code the Application
48
Step 1: Target WizardStep 1: Target Wizard
Creates new Client main form
49
Step 2: Create PowerJ ProxiesStep 2: Create PowerJ Proxies
Proxies for any kind of component can be created PowerBuilder Java COM C/C++
50
Step 3: Add InitialContext component and Step 3: Add InitialContext component and proxy then code the applicationproxy then code the application
1. Initialize Connection and Proxies
2. Invoke Server Component's Methods
51
1. Initialize Connection and Proxies1. Initialize Connection and Proxies
52
2. Invoke Server Component's Methods2. Invoke Server Component's Methods
Retrieving data
byte [ ] state;
state = cartj_1.retrieve( );
dw_customer.setFullState(state)
Updating data
dw_customer.getFullState(state)
cartj_1.update(state)
53
SummarySummary