Download Building Distributed Applications

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts
no text concepts found
Transcript
Developing and Deploying Business
Components using PowerJ
Developing and Deploying Business
components 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
[email protected]
2
Build 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
3
eMusic Application Preview
4
E-Business
Sybase Solution
DataWindow
Java
DataWindow
HTML
Enterprise
Application Server
COM
CGI PowerDynamo
ISAPI
NSAPI
HTTPS
DataWindow
IIOP
PowerBuilder
CORBA
Datastore
Jaguar CTS
JDBC
ODBC
Native
5
Why use Java on the Server for business
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
6
Role of the Application Server

To efficiently manage

Component instantiation and lifecycle
7
Role of the Application Server

To efficiently manage



Component instantiation and lifecycle
Database connections
Transactions
8
Role of the Application Server

To efficiently manage




Component instantiation and lifecycle
Database connections
Transactions
Threads
9
Role of the Application Server

To efficiently manage





Component instantiation and lifecycle
Database connections
Transactions
Threads
Security
10
Creating a Java EA Server
Component with PowerJ

Steps
1. Create a Jaguar Server Bean Java class
2. Code the Bean using Drag and Drop techniques
3. Deploy the component to Jaguar CTS
11
Jaguar Component Wizard
Highlights

Set the Target , Jar ,Package and Bean Name

Specify any Interfaces to implement
12
Jaguar Deployment Wizard
Highlights

Specify Jaguar CTS package and component names

Specify the deployment classes

Define component life cycle characteristics

Define component transaction support characteristics
13
Component Life Cycle Characteristics
14
Instance Pooling

Allows a single component instance to service multiple
clients

Benefits


Greatest scalability
Many clients share limited
number of instances
Instance Pool
15
Supporting Instance Pooling
EJB 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
16
Instance Pooling

Goal

Minimize amount of time an instance remains bound
to a client (early deactivation)
Design strategies



Stateful components
Stateless components
17
Stateful Components

Maintain a state between method invocations

Store properties as instance variables

Expose methods to manipulate properties
18
Stateful Components
setAmount(15000)
Instance Pool
19
Stateful Components
24
return 725
15000
setAmount(15000)
setMonths(24)
calculate( )
Instance Pool
20
Stateful Components
Instance Pool
21
Disadvantages of Stateful Components
in 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
22
Stateless 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
23
Stateless Components
calculate(15000,24)
Instance Pool
24
Stateless Components
return 725
calculate(15000,24)
Instance Pool
25
Stateless Components
Instance Pool
26
Advantages of Stateless Components
in 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
27
Defining a Stateless Component
Automatically

Deployment-time attribute

Instance automatically deactivated on method return
28
Defining a Stateless Component
Programmatically

InstanceContext functions


completeWork( )
rollbackWork( )
29
Define Component Transaction Support
30
Define 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
31
Example
Transfer
Teller
Account 1
1. Withdraw
Account 2
2. Deposit
Log
3. Write
32
What is the Scope of the Transaction?
Option 1

Withdraw

Deposit

Write to log
33
What is the Scope of the Transaction?
Option 2

Transaction 1

Withdraw
 Deposit
Transaction 2


Write to log
34
Option 1
Transfer
Teller
Account 1
1. Withdraw
Account 2
2. Deposit
Log
3. Write
35
Option 2
Transfer
Teller
Account 1
1. Withdraw
Account 2
2. Deposit
Log
3. Write
36
Starting to create an EAServer component
in PowerJ

Bean Wizard

Jaguar server component
37
Jaguar Component Wizard
Outcome

Java Classes




eMusicJ.CartJ.java
eMusicJ.CartJInterface.java
ServerBean interface implementation code
Form for design time coding of Non Visual objects
38
Step 2: Coding the Component

activate()

deactivate()

retrieve( )

update( )
39
Activate
transaction_1.connect();
state = parm0;
40
Connection Caching

Components share pools of preallocated connections to
remote database servers
IIOP
Connection
Cache
Connection
Cache
41
Deactivate
transaction_1.disconnect();
42
Retrieve( )
byte [ ][ ] state = new byte [1][ ];
ds_1.retrieve();
ds_1.getFullState(state);
return state[0];
43
Update( byte[ ] state )
ds_1.setFullState( state );
44
Step 3: Deploy the Component

Configure PowerJ deployment options

EAServer deployment wizard
45
Creating a Client Application
Java
COM
Enterprise
Application Server
HTML
PowerBuilder
CORBA
46
Creating 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
47
Step 1: Target Wizard

Creates new Client main form
48
Step 2: Create PowerJ Proxies

Proxies for any kind of component can be created




PowerBuilder
Java
COM
C/C++
49
Step 3: Add InitialContext component and
proxy then code the application
1. Initialize Connection and Proxies
2. Invoke Server Component's Methods
50
1. Initialize Connection and Proxies
51
2. 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)
52
Summary
53