Figure 5-1 demonstrates one scenario in which a PowerDynamo client connects to EAServer to process a PowerDynamo script, which contains a Methods As Stored Procedures (MASP) call to an EAServer component.
Figure 5-1: EAServer and PowerDynamo
These steps correspond to the numbers in Figure 5-1:
A browser requests a Web page. The Web page is a PowerDynamo script that contains HTML, SQL queries, and a MASP call to an EAServer component in that order.
The Web server passes the request to PowerDynamo.
The script is retrieved from the Web site (not shown in Figure 5-1). Processing of the script begins. The HTML and SQL queries within the PowerDynamo script are processed.
An ODBC or Open Client connection is made to a database to retrieve the necessary information for the SQL query.
The data is returned to PowerDynamo. Processing of the script continues until the EAServer component call is encountered.
Because a MASP call is being made, an ODBC or Open Client connection is made to access the EAServer component and the called method.
The component method is executed. If the method requires database access, a connection is made to a database to retrieve the appropriate data.
The data is returned to EAServer through an ODBC, Open Client, or JDBC connection.
The results from the EAServer function are returned to PowerDynamo through an ODBC or Open Client connection.
PowerDynamo passes the results, in HTML format, back to the Web server.
The results are passed back to the client through an HTTP connection.
EAServer and PowerDynamo can access several different databases; this diagram displays only one database.
EAServer components can access data from many different types of databases; you do not need a Sybase database to store data.
The client, PowerDynamo, and EAServer can all reside on either one machine or on separate machines.
A Web author can embed calls to EAServer components within a PowerDynamo script or template. The PowerDynamo script executes in the regular manner until it encounters the call to the EAServer component. At this point, a connection (through PowerDynamo) is made to EAServer, the appropriate method is executed, and the results are returned to PowerDynamo. PowerDynamo processes the information and returns HTML to the client.
You can call EAServer components from within a PowerDynamo script by using:
The PowerDynamo SQL tag (must return a result set)
The PowerDynamo COMPONENT tag (may return a result set)
The connection.CreateQuery method (must return a result set)
The connection.CreateComponent method (must return a result set)
The java.CreateComponent method (no restriction on the return)
An ActiveX object through the PowerDynamo CreateObject method (no restriction on the return)
The SQL tag, COMPONENT tag, and the connection.CreateQuery and connection.CreateComponent methods allow PowerDynamo to call EAServer components as though they were MASP. Each MASP invocation creates an instance of the component, invokes the method and then destroys the component instance. You can also use the COMPONENT tag to access ActiveX and Java objects—however, just as with MASP, each invocation creates an instance of the component, invokes the method, and then destroys the component instance. The PowerDynamo CreateObject method allows you to create an instance of an ActiveX object and access its methods and properties from within a script. The ActiveX object exists until it goes out of scope or until the ActiveX variable is assigned a new value. The PowerDynamo java.CreateComponent method allows you to create an instance of a Java object and access its methods and properties from within a script. The Java object exists until it goes out of scope.
Within an application, there are a few benefits to creating an instance of an ActiveX (using the CreateObject method) or Java object (using the java.CreateComponent method) against an EAServer component instead of making a MASP method call:
ActiveX or Java objects exist until they go out of scope, whereas MASP calls create an instance of the component, execute it, and destroy it immediately.
ActiveX or Java objects can give any type of return. MASP calls from PowerDynamo can return only a result set.
Once ActiveX or Java objects are created, they are treated like normal DynaScript objects. MASP calls (except the connection.CreateComponent method) require that you enter a full string each time a call is made. For more information about DynaScript objects, see “Writing DynaScripts” in the PowerDynamo User’s Guide.
If a script requires repeated use of an EAServer component, the creation of an ActiveX object or Java stub is the preferred method of working with an EAServer component and its methods. ActiveX, however, is a Microsoft technology, which means that it is available only on Microsoft operating systems. Java, on the other hand, is platform-independent, which means that Java objects can run anywhere. For a detailed explanation of MASP, see the EAServer Programmer's Guide.
Copyright © 2005. Sybase Inc. All rights reserved. |