|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.sun.jaw.impl.agent.services.bootstrap.BootstrapSrv
This class implements the Bootstrap Service.
The Bootstrap Service must be run as a standalone application and enables the loading and instantiation of an agent/manager located in a remote server by specifying a URL that contains an m-let document file.
Use of the MLet tag
This service makes a restricted use of the MLET tag, the parameters used by this service are the following:
<MLET
CODE =
agent/manager classfile
ARCHIVE =
archiveList
[CODEBASE =
codebaseURL]
>
</MLET
>
where:
CODE =
agent/manager classfileARCHIVE =
"archivelist"CODEBASE =
codebaseURL
Implementing the java.lang.Runnable
interface
In order to be able to run the agent/manager after loading it from the remote server, the agent/manager
itself needs to implement the java.lang.Runnable
interface, therefore, the Bootstrap Service
can load the class, create one instance of the class and invoke the run()
method provided by
the interface. The method run()
will be responsible for instantiating the framework and adding
the adaptor servers and services required by the agent being loaded or instantiating the adaptor clients
required by the manager being loaded.
Setting the class loader
Besides implementing the java.lang.Runnable
interface, other thing required by a bootstrapped agent
is setting the Core Management Framework classloader to the classloader that has loaded the agent, i.e.
... // Create an instance of Framework Framework cmf = new Framework((MoRepSrvIf)rep, null);// Set classloader for Framework cmf.setClassLoader(this.getClass().getClassLoader()); ...
Besides implementing the java.lang.Runnable
interface, other thing required by a bootstrapped manager
is setting the adaptor client classloader to the classloader that has loaded the manager, i.e.
... // Create an instance of AdaptorClient AdaptorClient adaptor = new AdaptorClient();// Set classloader for AdaptorClient adaptor.setClassLoader(this.getClass().getClassLoader()); ...
Bootstrapping an Agent and Java DMK
Another interesting feature of this service is that it is possible to load Java DMK, contained in a jar file, at the same time that we load and run an agent. In order to do that specify the jar file containing Java DMK as one of the jar files in the MLet tag. If we want to do this the only files needed in the machine that invokes this service are the ones contained in these packages:
and if we want to use the RMI adaptor the files contained in the following packages are also required:
NOTE: None of the files specified above can be part of the jar file containing Java Dynamic Management Kit. Remove all of them before creating the corresponding jar file for Java Dynamic Management Kit. Also note that we cannot use the persistent repository with the bootstrap service.
Running the application
To invoke this standalone application enter the following command in your command-line:
java com.sun.jaw.impl.agent.services.bootstrap.BootstrapSrv secure agent-URL [local-libdir]
where secure is a flag that specifies if this service is to be run in secure (true
) or
unsecure (false
) mode, agent-URL specifies the URL location of the m-let document file
containing the information for loading the agent and local-libdir specifies the local directory for
storing native libraries before they are loaded into memory.
Security Mode
The security mode is not taken into account if the agent/application is run with JDK 1.2, this is due to the fact that when using JDK 1.2 the way security is specified is different according to the new JDK 1.2 Security Model and the tools provided with it.
This has been kept here just for source code backwards compatibility issues.
Remote Library Loading
The library loader uses the local file system to copy the libraries coming from the remote server before they are loaded into memory.
The default value for the library directory is specified in the following order:
jaw.bootstrap.library.dir
property.
getTmpDir()
in class DefaultPaths.
Constructor Summary | |
BootstrapSrv(java.lang.Boolean secure)
Creates a BootstrapSrv object. |
Method Summary | |
static java.lang.String |
getClassVersion()
Gets the version of this class. |
java.lang.String |
getLibraryDirectory()
Gets the current directory used by the library loader for storing native libraries before they are loaded into memory. |
static void |
main(java.lang.String[] args)
|
void |
performLoadURL(java.lang.String url)
Loads all the classes contained in the jar files and instantiate and run the agent/manager identified by the class specified in the CODE parameter of the MLet tag. |
void |
setLibraryDirectory(java.lang.String libdir)
Sets the current directory used by the library loader for storing native libraries before they are loaded into memory. |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Constructor Detail |
public BootstrapSrv(java.lang.Boolean secure)
secure
- Specifies if this service is to be run in
secure (true
) or unsecure (false
) mode.Method Detail |
public static void main(java.lang.String[] args)
public void performLoadURL(java.lang.String url)
url
- A string representation of the URL of
the text file to be loaded.public static java.lang.String getClassVersion()
public java.lang.String getLibraryDirectory()
public void setLibraryDirectory(java.lang.String libdir)
libdir
- The directory to use.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |