All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class com.sun.jaw.impl.agent.services.bootstrap.BootstrapSrv

java.lang.Object
   |
   +----com.sun.jaw.impl.agent.services.bootstrap.BootstrapSrv

public class BootstrapSrv
extends Object
implements Serializable
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.

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 classfile
This attribute specifies the full Java class name, including package name, of the agent/manager to be instantiated. The compiled .class file of the agent/manager must be contained in one of the .jar files specified by the ARCHIVE attribute.
ARCHIVE = "archivelist"
This mandatory attribute specifies one or more .jar files containing the agent/manager itself and m-beans or other Java classes to be used by the agent/manager to be instantiated. One of the .jar files must contain the file specified by the CODE parameter. If archivelist contains more than one file: All .jar files in archivelist must be stored in the directory specified by the code base URL.
CODEBASE = codebaseURL
This optional attribute specifies the code base URL of the agent/manager to be instantiated. It is the directory that contains the .jar files specified by the ARCHIVE attribute. Specify this attribute only if the .jar files are not in the same directory as the m-let document file. If this attribute is not specified, the base URL of the m-let document file is used.

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.

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()); ...

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:

if we want to use the bootstrap's built-in library loader mechanism the files contained in the following packages are also required:

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 bootstart service.

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.

If this service runs in secure mode, then only signed JAR files coming from trusted sources will be loaded. If this service runs in unsecure mode, then any JAR file signed/not-signed by a trusted/not-trusted signer will be loaded.


Constructor Index

 o BootstrapSrv(Boolean)
Create a BootstrapSrv object

Method Index

 o getClassVersion()
Returns the version of this class.
 o getLibraryDirectory()
Returns the current directory used by the library loader for storing native libraries before they are loaded into memory.
 o main(String[])
 o performLoadURL(String)
Load 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.
 o setLibraryDirectory(String)
Sets the current directory used by the library loader for storing native libraries before they are loaded into memory.

Constructors

 o BootstrapSrv
 public BootstrapSrv(Boolean secure)
Create a BootstrapSrv object

Parameters:
secure - Specifies if this service is to be run in secure (true) or unsecure (false) mode.

Methods

 o main
 public static void main(String args[])
 o performLoadURL
 public void performLoadURL(String url)
Load 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.

Parameters:
url - A string representation of the URL of the text file to be loaded.
 o getClassVersion
 public static String getClassVersion()
Returns the version of this class.

 o getLibraryDirectory
 public String getLibraryDirectory()
Returns the current directory used by the library loader for storing native libraries before they are loaded into memory.

The value of the directory defaults to /tmp (Solaris) or <installDir>\SUNWconn\jaw\tmp (Windows NT).

 o setLibraryDirectory
 public void setLibraryDirectory(String libdir)
Sets the current directory used by the library loader for storing native libraries before they are loaded into memory.

The value of the directory defaults to /tmp (Solaris) or <installDir>\SUNWconn\jaw\tmp (Windows NT).


All Packages  Class Hierarchy  This Package  Previous  Next  Index