com.sun.jini.start
Class SharedActivationGroupDescriptor

java.lang.Object
  extended by com.sun.jini.start.SharedActivationGroupDescriptor
All Implemented Interfaces:
ServiceDescriptor, Serializable

public class SharedActivationGroupDescriptor
extends Object
implements ServiceDescriptor, Serializable

Class used to create a shared activation group. Clients construct this object with the details of the activation group to be launched, then call create to register the activation system group with the activation system

This class, in conjunction with the ActivateWrapper class, creates an activation group suitable for hosting multiple service objects, with each object maintaining a distinct codebase and policy.

Since:
2.0
Author:
Sun Microsystems, Inc.
See Also:
Serialized Form

Field Summary
private  String classpath
           
private static String GROUP_COOKIE_FILE
           
private  String host
           
private  String log
           
private static Logger logger
           
private  String policy
           
private  int port
           
private static long serialVersionUID
           
private  String serverCommand
           
private  String[] serverOptions
           
private  Properties serverProperties
           
 
Constructor Summary
SharedActivationGroupDescriptor(String policy, String classpath, String log, String serverCommand, String[] serverOptions, String[] serverProperties)
          Trivial constructor.
SharedActivationGroupDescriptor(String policy, String classpath, String log, String serverCommand, String[] serverOptions, String[] serverProperties, String host, int port)
          Trivial constructor.
 
Method Summary
private static Properties convertToProperties(String[] propertyValues)
           
 Object create(Configuration config)
          Method that attempts to create a shared activation system group from the description information provided via constructor parameters.
private static String[] customizeSharedGroupOptions(String classpath, String[] userOptions)
           
private static Properties customizeSharedGroupProperties(String policy, Properties userProperties)
           
 String getActivationSystemHost()
          Activation system host accessor method.
 int getActivationSystemPort()
          Activation system port accessor method.
 String getClasspath()
          Classpath accessor method.
 String getLog()
          Shared group log accessor method.
 String getPolicy()
          Policy accessor method.
 String getServerCommand()
          Command accessor method.
 String[] getServerOptions()
          Command options accessor method.
 Properties getServerProperties()
          Properties accessor method.
private  void readObject(ObjectInputStream in)
          Reads the default serializable field values for this object.
private  void readObjectNoData()
          Throws InvalidObjectException, since data for this class is required.
(package private) static ActivationGroupID restoreGroupID(String dir)
          Utility method that restores the object stored in a well known file under the provided dir path.
private static void storeGroupID(String dir, ActivationGroupID obj)
          Stores the created object to a well known file under the provided dir path.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

serialVersionUID

private static final long serialVersionUID
See Also:
Constant Field Values

policy

private final String policy

classpath

private final String classpath

log

private final String log

serverCommand

private final String serverCommand

serverOptions

private final String[] serverOptions

serverProperties

private final Properties serverProperties

host

private final String host

port

private final int port

GROUP_COOKIE_FILE

private static final String GROUP_COOKIE_FILE
See Also:
Constant Field Values

logger

private static final Logger logger
Constructor Detail

SharedActivationGroupDescriptor

public SharedActivationGroupDescriptor(String policy,
                                       String classpath,
                                       String log,
                                       String serverCommand,
                                       String[] serverOptions,
                                       String[] serverProperties)
Trivial constructor. Simply calls the other overloaded constructor with the host and port parameters set to null and 0, respectively.


SharedActivationGroupDescriptor

public SharedActivationGroupDescriptor(String policy,
                                       String classpath,
                                       String log,
                                       String serverCommand,
                                       String[] serverOptions,
                                       String[] serverProperties,
                                       String host,
                                       int port)
Trivial constructor. Simply assigns given parameters to their associated, internal fields.

Parameters:
policy - location of VM policy filename or URL
classpath - location where shared VM classes can be found. Classpath components must be separated by path separators.
log - location where group identifier information will be persisted
serverCommand - VM command to use
serverOptions - array of command line options to pass on the VM's command line
serverProperties - array of property/value string pairs to pass on the VMs command line (as in -D<property>=value). This array must have an even number of elements.
host - hostname of desired activation system. If null, defaults to the localhost.
port - port of desired activation system. If value is <= 0, then defaults to ActivationSystem.SYSTEM_PORT.
Method Detail

getPolicy

public final String getPolicy()
Policy accessor method.

Returns:
the policy location associated with this service descriptor.

getClasspath

public final String getClasspath()
Classpath accessor method.

Returns:
classpath associated with this service descriptor.

getLog

public final String getLog()
Shared group log accessor method.

Returns:
the shared group log associated with this service descriptor.

getServerCommand

public final String getServerCommand()
Command accessor method.

Returns:
the path-qualified java command name associated with this service descriptor.

getServerOptions

public final String[] getServerOptions()
Command options accessor method.

Returns:
the command options associated with this service descriptor.

getServerProperties

public final Properties getServerProperties()
Properties accessor method.

Returns:
the VM properties associated with this service descriptor.

getActivationSystemHost

public final String getActivationSystemHost()
Activation system host accessor method.

Returns:
the activation system host associated with this service descriptor.

getActivationSystemPort

public final int getActivationSystemPort()
Activation system port accessor method.

Returns:
the activation system port associated with this service descriptor.

customizeSharedGroupOptions

private static String[] customizeSharedGroupOptions(String classpath,
                                                    String[] userOptions)

convertToProperties

private static Properties convertToProperties(String[] propertyValues)

customizeSharedGroupProperties

private static Properties customizeSharedGroupProperties(String policy,
                                                         Properties userProperties)

create

public Object create(Configuration config)
              throws Exception
Method that attempts to create a shared activation system group from the description information provided via constructor parameters.

This method:

Notes:
  1. Prepends invoking VM's classpath to the server command options. This allows subsequent classpath settings to override.
  2. Adds a "java.security.policy" property with the provided policy setting to server properties.

Specified by:
create in interface ServiceDescriptor
Parameters:
config - The Configuration object used to configure the creation of the returned object.
Returns:
the ActivationGroupID for the newly created activation system group instance.
Throws:
Exception - Thrown if there was any problem creating the object.

storeGroupID

private static void storeGroupID(String dir,
                                 ActivationGroupID obj)
                          throws IOException
Stores the created object to a well known file under the provided dir path.

Throws:
IOException

restoreGroupID

static ActivationGroupID restoreGroupID(String dir)
                                 throws IOException,
                                        ClassNotFoundException
Utility method that restores the object stored in a well known file under the provided dir path.

Throws:
IOException
ClassNotFoundException

toString

public String toString()
Overrides:
toString in class Object

readObject

private void readObject(ObjectInputStream in)
                 throws IOException,
                        ClassNotFoundException
Reads the default serializable field values for this object. Also, verifies that the deserialized values are legal.

Throws:
IOException
ClassNotFoundException

readObjectNoData

private void readObjectNoData()
                       throws ObjectStreamException
Throws InvalidObjectException, since data for this class is required.

Throws:
ObjectStreamException


Copyright 2007-2010, multiple authors.
Licensed under the Apache License, Version 2.0, see the NOTICE file for attributions.