Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.sun.jini.start
Class SharedActivatableServiceDescriptor

    java.lang.Object
      com.sun.jini.start.NonActivatableServiceDescriptor
          com.sun.jini.start.SharedActivatableServiceDescriptor

All Implemented Interfaces:
  ServiceDescriptor

public class SharedActivatableServiceDescriptor
extends NonActivatableServiceDescriptor

Class used to launch shared, activatable services. Clients construct this object with the details of the service to be launched, then call `create` to launch the service in the activation system group identified by the `sharedGroupLog` constructor parameter.

This class depends on `ActivateWrapper` to provide separation of the import codebase (where the server classes are loaded from) from the export codebase (where clients should load classes from for stubs,etc.) as well as providing an independent security policy file for each service object. This functionality allows multiple service objects to be placed in the same activation system group, with each object maintaining a distinct codebase and policy.

Services need to implement the constructor required by `ActivateWrapper`. The following items are discussed below:

- Configuring SharedActivatableServiceDescriptor
- Logging

### Configuring SharedActivatableServiceDescriptor

This implementation of `SharedActivatableServiceDescriptor` supports the following configuration entries, with component `com.sun.jini.start`:

• | `activationIdPreparer`
--- | ---
| Type: | `ProxyPreparer`
| Default: | `new `BasicProxyPreparer`()`
| Description: | The proxy preparer for the service's activation ID. The value should not be `null`. This class calls the `activate` method on instances of `ActivationID` when they need to re/activate the service.

• | `activationSystemPreparer`
--- | ---
| Type: | `ProxyPreparer`
| Default: | `new `BasicProxyPreparer`()`
| Description: | The proxy preparer for the proxy for the activation system. The value should not be `null`. The service starter calls the `unregisterObject` method on the `ActivationSystem` when there is a problem creating a service.

### Loggers and Logging Levels

The implementation uses the `Logger`, named `com.sun.jini.start.service.starter`. The following table describes the type of information logged as well as the levels of information logged.

`com.sun.jini.start.service.starter`
Level | Description
--- | ---
`FINER` | for high level service operation tracing
`FINEST` | for low level service operation tracing

Since:
  2.0

Nested Class Summary
`static class` | `SharedActivatableServiceDescriptor.Created` Object returned by `SharedActivatableServiceDescriptor.create()` method that returns the proxy, group identifier, and activation identifier for the created service.

Constructor Summary
`SharedActivatableServiceDescriptor(String codebase, String policy, String classpath, String implClassName, String sharedGroupLog, String[] serverConfigArgs, boolean restart)` Trivial constructor.
`SharedActivatableServiceDescriptor(String codebase, String policy, String classpath, String implClassName, String sharedGroupLog, String[] serverConfigArgs, boolean restart, String host, int port)` Trivial constructor.

Method Summary
`Object` | `create(Configuration config)` Method that attempts to create a service based on the service description information provided via constructor parameters.
`String` | `getActivationSystemHost()` Activation system host accessor method.
`int` | `getActivationSystemPort()` Activation system port accessor method.
`boolean` | `getRestart()` Restart accessor method.
`String` | `getSharedGroupLog()` Shared group log accessor method.
`String` | `toString()`

Methods inherited from class com.sun.jini.start.NonActivatableServiceDescriptor
`getClasspath, getCodebase, getImplClassName, getLifeCycle, getPolicy, getServerConfigArgs`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Constructor Detail

### SharedActivatableServiceDescriptor

    public SharedActivatableServiceDescriptor(String codebase,
                                              String policy,
                                              String classpath,
                                              String implClassName,
                                              String sharedGroupLog,
                                              String[] serverConfigArgs,
                                              boolean restart)

  Trivial constructor. Simply calls the other overloaded constructor with the `host` and `port` parameters set to `null` and 0, respectively.

### SharedActivatableServiceDescriptor

    public SharedActivatableServiceDescriptor(String codebase,
                                              String policy,
                                              String classpath,
                                              String implClassName,
                                              String sharedGroupLog,
                                              String[] serverConfigArgs,
                                              boolean restart,
                                              String host,
                                              int port)

  Trivial constructor. Simply assigns given parameters to their associated, internal fields.

Parameters:
  `codebase` - location where clients can download required service-related classes (for example, stubs, proxies, etc.). Codebase components must be separated by spaces in which each component is in `URL` format.
  `policy` - server policy filename or URL
  `classpath` - location where server implementation classes can be found. Classpath components must be separated by path separators.
  `implClassName` - name of server implementation class
  `serverConfigArgs` - service configuration arguments
  `restart` - boolean flag passed through as the `restart` parameter to the ActivationDesc constructor used to register the service with the activation system.
  `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

### getSharedGroupLog

    public final String getSharedGroupLog()

  Shared group log accessor method.

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

### getRestart

    public final boolean getRestart()

  Restart accessor method.

  Returns:
    the restart mode 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.

### create

    public Object create(Configuration config)
                  throws Exception

  Method that attempts to create a service based on the service description information provided via constructor parameters.

  This method:

  - creates an `ActivateWrapper.ActivateDesc` with the provided constructor parameter information
  - retrieves the group identifier associated with the provided shared group log.
  - invokes `ActivateWrapper.register()` with the provided information.
  - obtains an "inner" proxy by calling `ActivationID#activate(true)` on the object returned from `ActivateWrapper.register()`, which also activates the service instance.
  - The service proxy is obtained by calling `ServiceProxyAccessor.getServiceProxy()` on the "inner" proxy instance. Otherwise, the "inner" proxy reference is used in the return value.

  Specified by:
    `create` in interface `ServiceDescriptor`
  Overrides:
    `create` in class `NonActivatableServiceDescriptor`
  Returns:
    a `Created` object that contains the group identifier, activation ID, and proxy associated with the newly created service instance.
  Throws:
    `Exception`

### toString

    public String toString()

  Overrides:
    `toString` in class `NonActivatableServiceDescriptor`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2004 Sun Microsystems, Inc. All rights reserved