public class AtomicILFactory extends BasicILFactory
An atomic serialization implementation of an InvocationLayerFactory
.
This factory is used to create a Proxy
instance with a AtomicInvocationHandler
and to create a AtomicInvocationDispatcher
for a remote object being exported. This
factory is used in conjunction with the BasicJeriExporter
class.
Serialization is performed with atomic input validation. Class codebase
annotations are not appended in the stream by default, each endpoint
must have class visibility determined a default ClassLoader. The
proxy's AtomicInvocationHandler ClassLoader will be that of the codebase
determined by CodebaseAccessor
, proxy's
are serialized independently and do not share state.
Refer to org.apache.river.api.io
for Atomic
Serialization, any service or object exported using this factory must
implement AtomicSerial
.
If a service or object exported by this service uses a smart proxy,
that smart proxy must implement ProxyAccessor
and
the service or exported object must implement CodebaseAccessor
,
allowing a client de-serializing the service proxy, to authenticate
the service, provision its codebase and apply any constraints.
If a service or object exported by this service doesn't utilise a smart proxy,
but still needs to a codebase to resolve certain interface classes, then
that service or object must implement DynamicProxyCodebaseAccessor
.
Codebases are provisioned using ProxyCodebaseSpi
InvocationLayerFactory.Instances
Constructor and Description |
---|
AtomicILFactory(MethodConstraints serverConstraints,
Class proxyOrServiceImplClass)
Creates a
AtomicILFactory with the specified server
constraints, and proxy or service implementation class. |
AtomicILFactory(MethodConstraints serverConstraints,
Class permissionClass,
Class proxyOrServiceImplClass)
Creates a
AtomicILFactory with the specified server
constraints, permission class, and proxy or service implementation class. |
AtomicILFactory(MethodConstraints serverConstraints,
Class permissionClass,
Class proxyOrServiceImplClass,
boolean useAnnotations)
Creates a
AtomicILFactory with the specified server
constraints, permission class, and proxy or service implementation class. |
AtomicILFactory(MethodConstraints serverConstraints,
Class permissionClass,
ClassLoader loader)
Creates a
AtomicILFactory with the specified server
constraints, permission class, and class loader. |
Modifier and Type | Method and Description |
---|---|
protected InvocationDispatcher |
createInvocationDispatcher(Collection methods,
Remote impl,
ServerCapabilities caps)
Returns an invocation dispatcher to receive incoming remote calls
for the specified methods to the specified remote object, for a
server and transport with the specified capabilities.
|
protected InvocationHandler |
createInvocationHandler(Class[] interfaces,
Remote impl,
ObjectEndpoint oe)
Returns an invocation handler to use with a
Proxy instance
implementing the specified interfaces, communicating with the
specified remote object using the specified object endpoint. |
boolean |
equals(Object o)
Compares the specified object with this invocation layer factory for
equality.
|
int |
hashCode()
Returns a hash code value for this factory.
|
getExtraProxyInterfaces, getPermissionClass, getServerConstraints, toString
createInstances, getClassLoader, getInvocationDispatcherMethods, getProxyInterfaces, getRemoteInterfaces
public AtomicILFactory(MethodConstraints serverConstraints, Class permissionClass, ClassLoader loader)
AtomicILFactory
with the specified server
constraints, permission class, and class loader. The server
constraints, if not null
, are used to enforce minimum
constraints for remote calls. The permission class, if not
null
, is used to perform server-side access control on
incoming remote calls. The class loader, which may be
null
, is passed to the superclass constructor and is
used by the createInstances
method.serverConstraints
- the server constraints, or null
permissionClass
- the permission class, or null
loader
- the class loaderIllegalArgumentException
- if the permission class is
abstract, is not a subclass of Permission
, or does
not have a public constructor that has either one
String
parameter or one Method
parameter and has no declared exceptionsNullPointerException
- if loader is null.public AtomicILFactory(MethodConstraints serverConstraints, Class proxyOrServiceImplClass)
AtomicILFactory
with the specified server
constraints, and proxy or service implementation class.
The server constraints, if not null
, are used to enforce
minimum constraints for remote calls. The proxy or service implementation class,
which cannot be null
, is used to obtain the ClassLoader
to be passed to the superclass constructor and is used by the
createInstances
method.serverConstraints
- the server constraints, or null
proxyOrServiceImplClass
- the class of the smart proxy
implementation or the class of the service interface
for dynamic proxy's.IllegalArgumentException
- if the permission class is
abstract, is not a subclass of Permission
, or does
not have a public constructor that has either one
String
parameter or one Method
parameter and has no declared exceptionsSecurityException
- if caller doesn't have RuntimePermission
"getClassLoader".NullPointerException
- if proxyorServiceImplClass is null.public AtomicILFactory(MethodConstraints serverConstraints, Class permissionClass, Class proxyOrServiceImplClass)
AtomicILFactory
with the specified server
constraints, permission class, and proxy or service implementation class.
The server constraints, if not null
, are used to enforce
minimum constraints for remote calls. The permission class, if not
null
, is used to perform server-side access control on
incoming remote calls. The proxy or service implementation class,
which cannot be null
, is used to obtain the ClassLoader
to be passed to the superclass constructor and is used by the
createInstances
method.serverConstraints
- the server constraints, or null
permissionClass
- the permission class, or null
proxyOrServiceImplClass
- the class of the smart proxy
implementation or the class of the service interface
for dynamic proxy's.IllegalArgumentException
- if the permission class is
abstract, is not a subclass of Permission
, or does
not have a public constructor that has either one
String
parameter or one Method
parameter and has no declared exceptionsSecurityException
- if caller doesn't have RuntimePermission
"getClassLoader".NullPointerException
- if proxyorServiceImplClass is null.public AtomicILFactory(MethodConstraints serverConstraints, Class permissionClass, Class proxyOrServiceImplClass, boolean useAnnotations)
AtomicILFactory
with the specified server
constraints, permission class, and proxy or service implementation class.
The server constraints, if not null
, are used to enforce
minimum constraints for remote calls. The permission class, if not
null
, is used to perform server-side access control on
incoming remote calls. The proxy or service implementation class,
which cannot be null
, is used to obtain the ClassLoader
to be passed to the superclass constructor and is used by the
createInstances
method.serverConstraints
- the server constraints, or null
permissionClass
- the permission class, or null
proxyOrServiceImplClass
- the class of the smart proxy
implementation or the class of the service interface
for dynamic proxy's, the ClassLoader of this class determines
class visibility and resolution for deserialized objects.useAnnotations
- if true, write codebase annotations to
the stream. If the service or remote object, accepts parameter
classes that are not part of the Service API and not resolved
by the smart proxy or Remote Object stub's ClassLoader, then if
useAnnotations is true the stream will be annotated with a
codebase, from which additional classes can be resolved.
If useAnnotations is true, care should be taken to ensure
downloaded codebases are trusted, such as by utilizing
net.jini.loader.pref.RequireDlPermProvider.
See ClassLoading
for details.
It is advisable to sign the codebase or utilize
Integrrity
constraints.IllegalArgumentException
- if the permission class is
abstract, is not a subclass of Permission
, or does
not have a public constructor that has either one
String
parameter or one Method
parameter and has no declared exceptionsSecurityException
- if caller doesn't have RuntimePermission
"getClassLoader".NullPointerException
- if proxyorServiceImplClass is null.protected InvocationHandler createInvocationHandler(Class[] interfaces, Remote impl, ObjectEndpoint oe) throws ExportException
Proxy
instance
implementing the specified interfaces, communicating with the
specified remote object using the specified object endpoint.
AtomicILFactory
implements this method to
return a BasicInvocationHandler
constructed with the
specified object endpoint and this factory's server constraints.
createInvocationHandler
in class BasicILFactory
interfaces
- an array of proxy interfacesimpl
- a remote object this invocation handler
is being created foroe
- an object endpoint used to communicate with
the remote objectExportException
- if there is a problem creating the
invocation handlerNullPointerException
- if any argument is null
,
or if interfaces
contains a null
elementprotected InvocationDispatcher createInvocationDispatcher(Collection methods, Remote impl, ServerCapabilities caps) throws ExportException
AtomicILFactory
implements this method to return a
BasicInvocationDispatcher
instance constructed with the
specified methods, server capabilities, and this factory's
server constraints, permission class, and class loader specified
at construction.
createInvocationDispatcher
in class BasicILFactory
methods
- a collection of Method
instances for the
remote methodsimpl
- a remote object that the dispatcher is being created forcaps
- the transport capabilities of the serverExportException
- if there is a problem creating the
invocation dispatcher.NullPointerException
- if any argument is null
,
or if methods
contains a null
elementIllegalArgumentException
- if methods
contains
an element that is not a Method
instancepublic boolean equals(Object o)
BasicILFactory
BasicILFactory
implements this method to return
true
if and only if invoking the superclass's
equals
method passing the specified object returns
true
, the specified object has the same class as this
object, and the server constraints and permission class are equal to
the ones in this object.
equals
in class BasicILFactory
public int hashCode()
BasicILFactory
hashCode
in class BasicILFactory
Copyright © 2016–2018. All rights reserved.