|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.muse.core.SimpleResourceManager
public class SimpleResourceManager
SimpleResourceManager is Muse's default implementation of resource lifecycle management and the implied resource pattern. It maintains a simple table that maps EPRs to Resource objects. Each EPR that is added to the manager must be unique, but multiple EPRs may be mapped to the same Resource object.
Constructor Summary | |
---|---|
SimpleResourceManager()
|
Method Summary | |
---|---|
void |
addListener(ResourceManagerListener listener)
|
void |
addResource(EndpointReference epr,
Resource resource)
Add a resource to the manager, associated with the given EPR. |
void |
addResourceDefinitions(Collection definitions)
|
Resource |
createResource(String contextPath)
Finds the resource type definition associated with the given context path (defined in muse.xml), instantiates an instance of the resource class, and sets the basic values (EPR, initialization parameters, etc.) and Muse components (Environment, log file, etc.) that it needs to operate. |
Environment |
getEnvironment()
|
protected List |
getListeners()
|
int |
getNumberOfResources()
|
Resource |
getResource(EndpointReference epr)
|
String |
getResourceContextPath(Class capabilityClass)
This method allows you to find a resource type's endpoint URI given the Java interface or concrete class of one of its capabilities. |
Collection |
getResourceContextPaths()
|
Collection |
getResourceContextPaths(Class capabilityClass)
This method is just like getResourceContextPath(Class) except that it returns multiple endpoints that use the capability. |
protected ResourceDefinition |
getResourceDefinition(String contextPath)
|
Iterator |
getResourceEPRs()
|
Iterator |
getResourceEPRs(String contextPath)
This method allows you to search for the EPRs for all instances of a given resource type (where each resource type has a unique context path). |
boolean |
hasBeenInitialized()
|
boolean |
hasBeenShutdown()
|
void |
initialize()
|
boolean |
isUsingPersistence(String contextPath)
|
void |
removeListener(ResourceManagerListener listener)
Stops the given listener from receiving notifications about the addition and removal of resource instances. |
void |
removeResource(EndpointReference epr)
Removes the EPR-resource pair from the manager. |
void |
removeResourceDefinitions(Collection definitions)
Removes each ResourceDefinition in the given Collection. |
void |
setEnvironment(Environment environment)
|
void |
shutdown()
This implementation loops through all existing resource instances and tells them to shutdown(). |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public SimpleResourceManager()
Method Detail |
---|
public void addListener(ResourceManagerListener listener)
addListener
in interface ResourceManager
listener
- A listener that will be fired whenever a resource is added
or removed from the resource.public void addResource(EndpointReference epr, Resource resource) throws SoapFault
ResourceManager
addResource
in interface ResourceManager
epr
- The unique EPR identifying the resource instance.
SoapFault
- ResourceManager.getResource(EndpointReference)
public void addResourceDefinitions(Collection definitions)
addResourceDefinitions
in interface ResourceManager
definitions
- The ResourceDefinition objects that will be used to generate new
resource instances.public Resource createResource(String contextPath) throws SoapFault
ResourceManager
createResource
in interface ResourceManager
contextPath
- The context path for the resource type that is to be instantiated.
This value is specified with the context-path element in
muse.xml.
SoapFault
public Environment getEnvironment()
getEnvironment
in interface ResourceManager
protected List getListeners()
public int getNumberOfResources()
getNumberOfResources
in interface ResourceManager
public Resource getResource(EndpointReference epr)
getResource
in interface ResourceManager
epr
- The unique EPR that is associated with the desired resource.
public String getResourceContextPath(Class capabilityClass)
ResourceManager
getResourceContextPath
in interface ResourceManager
capabilityClass
- An interface or concrete class for one of the capabilities in
the application's resource types. This value may be defined in
resource-type/capability/java-capability-class in muse.xml.
public Collection getResourceContextPaths()
getResourceContextPaths
in interface ResourceManager
public Collection getResourceContextPaths(Class capabilityClass)
ResourceManager
getResourceContextPaths
in interface ResourceManager
protected ResourceDefinition getResourceDefinition(String contextPath)
contextPath
- The URL targeted by an incoming request - this should map to
a context-path value in muse.xml.
public Iterator getResourceEPRs()
getResourceEPRs
in interface ResourceManager
public Iterator getResourceEPRs(String contextPath)
getResourceEPRs
in interface ResourceManager
public boolean hasBeenInitialized()
hasBeenInitialized
in interface Initialization
public boolean hasBeenShutdown()
hasBeenShutdown
in interface Shutdown
public void initialize() throws SoapFault
initialize
in interface Initialization
SoapFault
public boolean isUsingPersistence(String contextPath)
isUsingPersistence
in interface ResourceManager
public void removeListener(ResourceManagerListener listener)
ResourceManager
removeListener
in interface ResourceManager
public void removeResource(EndpointReference epr) throws SoapFault
ResourceManager
removeResource
in interface ResourceManager
epr
- The unique EPR that maps to the resource being removed.
SoapFault
- public void removeResourceDefinitions(Collection definitions)
ResourceManager
removeResourceDefinitions
in interface ResourceManager
public void setEnvironment(Environment environment)
setEnvironment
in interface ResourceManager
public void shutdown() throws SoapFault
shutdown
in interface Shutdown
SoapFault
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |