public class NonActivatableServiceDescriptor extends Object implements ServiceDescriptor, Serializable
create(Configuration config)
to launch the service in the invoking object's VM.
This class provides separation of the import codebase (where the service implementation classes are loaded from) from the export codebase (where service clients should load classes from, for example stubs). 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 VM, with each object maintaining distinct export codebase and security policy settings.
Services need to implement the following "non-activatable constructor":
where,<impl>(String[] args,LifeCycle
lc)
LifeCycle
reference.
proxy
field of the
Created
object returned by
create
)
in the following order of precedence:
ServiceProxyAccessor
then return value of
getServiceProxy
will be used as the service proxy.
ProxyAccessor
then the return value of
getProxy
will be used
as the service proxy.
null
will be returned as the service proxy.
NonActivatableServiceDescriptor
depends on ActivateWrapper
, which can itself be configured. See
ActivateWrapper's
configuration
information for details.
This implementation obtains its configuration entries from the
Configuration
object passed into
the create
method.
The following configuration entries use the
component prefix "org.apache.river.start
":
• |
servicePreparer
| |
---|---|---|
Type: | ProxyPreparer
| |
Default: |
new
| |
Description: | The default proxy preparer used to prepare
the service proxy.
This value should not be null . This entry is
obtained during the invocation of
create and is used
to prepare the service proxy returned by
the service implementation
(see service proxy section for details).
This entry is superseded by explicitly passing a
ProxyPreparer to one of the constructors that
accept a proxy preparer argument.
|
This implementation uses the Logger
, named
org.apache.river.start.service.starter
.
The following table describes the
type of information logged as well as the levels of information logged.
Level | Description |
---|---|
SEVERE | for significant service creation problems |
FINER | for high level service operation tracing |
FINEST | for low level service operation tracing |
Modifier and Type | Class and Description |
---|---|
static class |
NonActivatableServiceDescriptor.Created
Object returned by
NonActivatableServiceDescriptor.create()
method that returns the proxy and implementation references
for the created service. |
Modifier and Type | Field and Description |
---|---|
protected boolean |
descCreated
Flag indicating when create() has been called
|
protected Object |
descCreatedLock
Lock object for
descCreated flag |
Constructor and Description |
---|
NonActivatableServiceDescriptor(AtomicSerial.GetArg arg) |
NonActivatableServiceDescriptor(String exportCodebase,
String policy,
String importCodebase,
String implClassName,
Configuration config,
LifeCycle lifeCycle,
ProxyPreparer preparer) |
NonActivatableServiceDescriptor(String exportCodebase,
String policy,
String importCodebase,
String implClassName,
String[] serverConfigArgs)
Convenience constructor.
|
NonActivatableServiceDescriptor(String exportCodebase,
String policy,
String importCodebase,
String implClassName,
String[] serverConfigArgs,
LifeCycle lifeCycle)
Convenience constructor.
|
NonActivatableServiceDescriptor(String exportCodebase,
String policy,
String importCodebase,
String implClassName,
String[] serverConfigArgs,
LifeCycle lifeCycle,
ProxyPreparer preparer)
Main constructor.
|
NonActivatableServiceDescriptor(String exportCodebase,
String policy,
String importCodebase,
String implClassName,
String[] serverConfigArgs,
ProxyPreparer preparer)
Convenience constructor.
|
Modifier and Type | Method and Description |
---|---|
Object |
create(Configuration config)
Attempts to create a service instance based on the service
description information provided via constructor parameters.
|
String |
getExportCodebase()
Codebase accessor method.
|
String |
getImplClassName()
Implementation class accessor method.
|
String |
getImportCodebase()
Classpath accessor method.
|
LifeCycle |
getLifeCycle()
LifeCycle accessor method. |
String |
getPolicy()
Policy accessor method.
|
String[] |
getServerConfigArgs()
Service configuration arguments accessor method.
|
ProxyPreparer |
getServicePreparer()
ProxyPreparer accessor method. |
void |
setLifeCycle(LifeCycle lc)
Sets the
LifeCycle object for this
descriptor. |
void |
setServicePreparer(ProxyPreparer serviceProxyPreparer)
Sets the
ProxyPreparer for this descriptor. |
String |
toString()
Prints out a field summary
|
protected transient boolean descCreated
protected final Object descCreatedLock
descCreated
flagpublic NonActivatableServiceDescriptor(String exportCodebase, String policy, String importCodebase, String implClassName, String[] serverConfigArgs, LifeCycle lifeCycle, ProxyPreparer preparer)
exportCodebase
- 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 URLimportCodebase
- location where server implementation
classes can be found.
This String
assumed (in order) to be either
1) a space delimited set of URL
(s)
representing a codebase or
2) a File.pathSeparator
delimited set
of class paths.implClassName
- name of server implementation classserverConfigArgs
- service configuration arguments. This parameter
is passed as the String[]
argument to the
implementation's
constructor.lifeCycle
- LifeCycle
reference
for hosting environment. This parameter
is passed as the LifeCycle
argument to the
implementation's
constructor. If this argument
is null, then a default, no-op LifeCycle
object will
be assigned.preparer
- ProxyPreparer
reference. This object
will be used to prepare the service's proxy object, if any
(see service proxy section for details).
If this argument is null, then the default
service preparer will be used.public NonActivatableServiceDescriptor(AtomicSerial.GetArg arg) throws IOException
IOException
public NonActivatableServiceDescriptor(String exportCodebase, String policy, String importCodebase, String implClassName, Configuration config, LifeCycle lifeCycle, ProxyPreparer preparer)
public NonActivatableServiceDescriptor(String exportCodebase, String policy, String importCodebase, String implClassName, String[] serverConfigArgs, LifeCycle lifeCycle)
contructor
with null
for the preparer
reference.public NonActivatableServiceDescriptor(String exportCodebase, String policy, String importCodebase, String implClassName, String[] serverConfigArgs)
contructor
with null
for the lifeCycle
and preparer
references.public NonActivatableServiceDescriptor(String exportCodebase, String policy, String importCodebase, String implClassName, String[] serverConfigArgs, ProxyPreparer preparer)
contructor
with null
for the lifeCycle
reference.public final String getExportCodebase()
public final String getPolicy()
public final String getImportCodebase()
public final String getImplClassName()
public final String[] getServerConfigArgs()
public final LifeCycle getLifeCycle()
LifeCycle
accessor method.LifeCycle
object associated with
this service descriptor.public final void setLifeCycle(LifeCycle lc)
LifeCycle
object for this
descriptor. This needs to
be called on the service descriptor prior to calling
create()
. Useful for (re-)setting the
the associated LifeCycle
upon deserialization
of this descriptor.lc
- The LifeCycle
object to be
associated with this service descriptor.IllegalStateException
- if called after create()
is invokedpublic final ProxyPreparer getServicePreparer()
ProxyPreparer
accessor method.ProxyPreparer
object associated with
this service descriptor.public final void setServicePreparer(ProxyPreparer serviceProxyPreparer)
ProxyPreparer
for this descriptor.
This needs to
be called on the service descriptor prior to calling
create()
. Useful for (re-)setting the
the associated ProxyPreparer
upon deserialization
of this descriptor.serviceProxyPreparer
- The ProxyPreparer
object to be
associated with this service descriptor.IllegalStateException
- if called after create()
is invokedpublic Object create(Configuration config) throws Exception
This method:
RMISecurityManager
if no security manager is already in place
AggregatePolicyProvider
as the VM-global policy object
(upon the first invocation of this method)
ActivateWrapper.ExportClassLoader
with
the associated service's import codebase, export codebase and
the current thread's context class loader as its arguments
ExportClassLoader
and the associated service's
policy file with the
AggregatePolicyProvider
ExportClassLoader
as
the current thread's context class loader
<impl>(String[], LifeCycle)
ServiceProxyAccessor.getServiceProxy()
or
ProxyAccessor.getProxy()
,
respectively, on the implementation instance.
If neither interface is supported, the
proxy reference is set to null
create
in interface ServiceDescriptor
config
- The Configuration
object
used to configure the creation of the returned object.Created
instance with the service's proxy and implementation
references.Exception
- Thrown if there was any problem
creating the object.Copyright © 2016–2018. All rights reserved.