home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World Komputer 1997 May
/
Pcwk0597.iso
/
sybase
/
starbuck
/
template.z
/
DOC.TXT
< prev
next >
Wrap
Text File
|
1996-12-04
|
4KB
|
95 lines
NetImpact Dynamo Java Servelet Applications
Starbuck provides a custom Target Template which can be used
to easily create Java applications for NetImpact Dynamo.
A Java application can replace or augment a DynamoScript program.
The Java application is executed on the server, as a plugin to Dynamo.
The Microsoft Java Virtual Machine is used to execute Java programs
under NetImpact Dynamo. This means that your application can even
access and use non-visual ActiveX components.
** Loading your DLL into Dynamo
To load Java support into Dynamo, you must execute a script to load
JavaDynamo.dll into Dynamo. This is done with the (undocumented) AddExtension
method on the site object:
site.AddExtension ("java", "/path_to_Starbuck/system/javadynamo.dll");
NOTE: use forward slashes, or double each backslash, in the DLL pathname.
You can execute this statement in a new script (.ssc) or by adding the
above line to your autoexec.ssc script and restarting Dynamo.
For example, if you have installed Starbuck to
c:/program files/powersoft/optima
then the command will be:
site.AddExtension ("java", "c:/program files/powersoft/optima/system/javadynamo.dll");
*** Defining an extension
A Dynamo template can contain HTML and Script tags. Executing the
site.AddExtension() command defines a new tag called 'java'.
A script of the form
<!--java classname
arg1
arg2
...
-->
will be passed to the javadynamo dll. The first name (classname) specifies
the class that you have defined in Starbuck. The remaining arguments are
made available in a list of Strings passed to main:
public void main(String args[]) {
}
*** Install support for Microsoft Java
This is for you when you install Starbuck onto your machine.
If NetImpact Dynamo is running on a different computer, you will have to
install the Microsoft Java VM on that machine as well. See the
Microsoft WWW home page for a copy.
*** Install support for DynamoConnect
When your Java application is executed, it needs to communicate back
to the specific requestor in NetImpact Dynamo. This is done by loading
Java native methods from DynamoConnect.dll, from within Java.
These native methods use an internal memory handle to access Dynamo.
If you examine the initialization code in the WebConnection class provided
in the target template, you will see a call to
System.loadLibrary("dynamoconnect");
If DynamoConnect.dll is not somewhere on your PATH, this statement will
fail and your Java Application will be terminated. Be sure this DLL is copied
from the Starbuck System directory, to a place on your PATH. For example,
on Windows 95, you could copy this file to
c:/windows/dynamoconnect.dll
*** Using your Java Application
Base your Java application on the Starbuck target template called
NetImpact Dynamo Java Servelet
When you compile your Starbuck project, you will have a number of
.class files in your project's debug directory. To execute these files,
you must copy them to on the machine running NetImpact Dynamo, in a
directory that will be searched automatically by the Microsoft Java VM.
If you run the regedit (on NT, regedt32) program, you can examine the
system registry. The registry key
HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Java VM
has a setting for Classpath. This is a semicolon (;) seperated list of
directories that will be searched by the Java VM for undefined classes.
You can add a new directory to the Classpath key setting, and
copy the .class files produced by Starbuck to that directory.
Alternatively, you could simply copy your .class files to one of the
directories specified in Classpath. Be careful not to overwrite a
.class file needed for another application.