|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.rmi.server.RemoteObject
java.rmi.server.RemoteServer
java.rmi.server.UnicastRemoteObject
simple.http.load.LoaderEngine
simple.http.load.MapperEngine
public class MapperEngine
The MapperEngine
provides an implementation of the
LoaderEngine
that does not require administration.
It enables Service
objects to be loaded and then
executed without the need to use manual load
invocations. This ability means that byte codes are taken from
the class path once they have been referenced.
The MapperEngine
makes use of a system wide
Mapper
to determine what references, that is, what
URI references, map to a Service
implementation.
If a URI maps to a service then this will check to determine
if it has been previously loaded, if so then it will simply
return that instance. However if it has not been loaded then
it will load the object and return a reference to it.
The loaded Service
objects have an instance name
that is used to reference a specific object, this name is taken
from the Mapper.getName
method. The service name
can also be used to acquire the fully qualified class name of
the service, this is useful when a service needs to be loaded.
This capability allows multiple instances of the same type to
be loaded and referenced individually using the service name.
MapperFactory
,
Mapper
,
Serialized FormField Summary | |
---|---|
protected java.lang.Object |
data
Contains the object that is passed to each service object. |
protected Mapper |
mapper
This is the mapper used by this engine to resolve URIs. |
Fields inherited from class simple.http.load.LoaderEngine |
---|
context, delegate, profile, registry, resolver |
Fields inherited from class java.rmi.server.RemoteObject |
---|
ref |
Constructor Summary | |
---|---|
MapperEngine()
Constructor for the MapperEngine . |
|
MapperEngine(Context context)
Constructor for the MapperEngine . |
|
MapperEngine(Context context,
java.io.File path)
Constructor for the MapperEngine . |
|
MapperEngine(Context context,
java.io.File path,
java.lang.Object data)
Constructor for the MapperEngine . |
|
MapperEngine(Context context,
java.lang.Object data)
Constructor for the MapperEngine . |
|
MapperEngine(Context context,
java.lang.String path)
Constructor for the MapperEngine . |
|
MapperEngine(Context context,
java.lang.String path,
java.lang.Object data)
Constructor for the MapperEngine . |
Method Summary | |
---|---|
Resource |
lookup(java.lang.String name)
This will look for and retrieve the requested resource. |
Resource |
resolve(java.lang.String target)
This will detetmine whether the URI string issued contains a reference to a service object. |
Methods inherited from class simple.http.load.LoaderEngine |
---|
link, link, load, load, load, remove, unlink, unlink, unload, update |
Methods inherited from class java.rmi.server.UnicastRemoteObject |
---|
clone, exportObject, exportObject, exportObject, unexportObject |
Methods inherited from class java.rmi.server.RemoteServer |
---|
getClientHost, getLog, setLog |
Methods inherited from class java.rmi.server.RemoteObject |
---|
equals, getRef, hashCode, toString, toStub |
Methods inherited from class java.lang.Object |
---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected Mapper mapper
protected java.lang.Object data
Constructor Detail |
---|
public MapperEngine() throws java.io.IOException
MapperEngine
. This creates
an implementation of the LoaderEngine
that does
not require manual loading of service instances. This allows
URI references that contain a service implementation name
to load the byte codes. This constructor uses a context for
the current working directory as a CacheContext
.
java.io.IOException
public MapperEngine(Context context) throws java.io.IOException
MapperEngine
. This creates
an implementation of the LoaderEngine
that does
not require manual loading of service instances. This allows
URI references that contain a service implementation name
to load the byte codes.
This will load the class byte codes from the base path of
the supplied Context
object. If the byte codes
cannot be found using the inherited or system class loader
the base path is checked, failing that this will return a
service object that can supply an HTTP 404 Not Found.
context
- the Context
for this instance
java.io.IOException
public MapperEngine(Context context, java.lang.Object data) throws java.io.IOException
MapperEngine
. This creates
an implementation of the LoaderEngine
that does
not require manual loading of service instances. This allows
URI references that contain a service implementation name
to load the byte codes.
This will load the class byte codes from the base path of
the supplied Context
object. If the byte codes
cannot be found using the inherided or system class loader
the base path is checked, failing that this will return a
service object that can supply an HTTP 404 Not Found.
This enables an arbitrary object to be issused, which is
what is used by this LoaderEngine
to load the
Service
objects. Each instance that is loaded
is given this object via its prepare
method.
context
- the Context
for this instancedata
- this is the data that is given to each service
java.io.IOException
public MapperEngine(Context context, java.lang.String path) throws java.io.IOException
MapperEngine
. This creates
an implementation of the LoaderEngine
that does
not require manual loading of service instances. This allows
URI references that contain a service implementation name
to load the byte codes.
This will load the class byte codes from the supplied path,
if they cannot be found within the inherited or system class
path. Providing a path other than the Context
base path can be useful in seperating services from content.
If a service cannot be found an HTTP 404 Not Found is used.
context
- the Context
for this instancepath
- this is added to the classpath of the engine
java.io.IOException
public MapperEngine(Context context, java.lang.String path, java.lang.Object data) throws java.io.IOException
MapperEngine
. This creates
an implementation of the LoaderEngine
that does
not require manual loading of service instances. This allows
URI references that contain a service implementation name
to load the byte codes.
This will load the class byte codes from the supplied path,
if they cannot be found within the inherited or system class
path. Providing a path other than the Context
base path can be useful in seperating services from content.
If a service cannot be found an HTTP 404 Not Found is used.
This enables an arbitrary object to be issused, which is
what is used by this LoaderEngine
to load the
Service
objects. Each instance that is loaded
is given this object via its prepare
method.
context
- the Context
for this instancepath
- this is added to the classpath of the enginedata
- this is the data that is given to each service
java.io.IOException
public MapperEngine(Context context, java.io.File path) throws java.io.IOException
MapperEngine
. This creates
an implementation of the LoaderEngine
that does
not require manual loading of service instances. This allows
URI references that contain a service implementation name
to load the byte codes.
This will load the class byte codes from the supplied path,
if they cannot be found within the inherited or system class
path. Providing a path other than the Context
base path can be useful in seperating services from content.
If a service cannot be found an HTTP 404 Not Found is used.
context
- the Context
for this instancepath
- this is added to the classpath of the engine
java.io.IOException
public MapperEngine(Context context, java.io.File path, java.lang.Object data) throws java.io.IOException
MapperEngine
. This creates
an implementation of the LoaderEngine
that does
not require manual loading of service instances. This allows
URI references that contain a service implementation name
to load the byte codes.
This will load the class byte codes from the supplied path,
if they cannot be found within the inherited or system class
path. Providing a path other than the Context
base path can be useful in seperating services from content.
If a service cannot be found an HTTP 404 Not Found is used.
This enables an arbitrary object to be issused, which is
what is used by this LoaderEngine
to load the
Service
objects. Each instance that is loaded
is given this object via its prepare
method.
context
- the Context
for this instancepath
- this is added to the classpath of the enginedata
- this is the data that is given to each service
java.io.IOException
Method Detail |
---|
public Resource lookup(java.lang.String name)
Resource
implementation that will handle the target.
This attempts to retrieve a service that has been previously
loaded using the load
method. If the named
service has been previously loaded then the loaded instance
is returned from this method. However, if the service name
does not corrospond to any previously loaded service then
this will attempt to use the given name to acquire a fully
qualified class name to load a service implementation. If
this does not result in sucess, then a report resource that
can display the cause and status of the error is returned.
lookup
in class LoaderEngine
name
- this is than name of the service to retrieve
public Resource resolve(java.lang.String target)
Mapper
object to check
whether a mapping exists. If a service name can be retrieved
from the URI then it is used to load the service. If there
is a failure loading the service then a report is returned.
Service objects are loaded the first time they are mapped. The instance name of a loaded object is used to acquire an implementation class name. This enables multiple service types to be loaded and referenced individually.
resolve
in interface ResourceEngine
resolve
in class LoaderEngine
target
- this is the request URI to be resolved
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |