|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectorg.apache.muse.core.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(java.util.Collection definitions)
|
Resource |
createResource(java.lang.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 java.util.List |
getListeners()
|
int |
getNumberOfResources()
|
Resource |
getResource(EndpointReference epr)
|
java.lang.String |
getResourceContextPath(java.lang.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. |
java.util.Collection |
getResourceContextPaths()
|
java.util.Collection |
getResourceContextPaths(java.lang.Class capabilityClass)
This method is just like getResourceContextPath(Class) except that it returns multiple endpoints that use the capability. |
protected ResourceDefinition |
getResourceDefinition(java.lang.String contextPath)
|
java.util.Iterator |
getResourceEPRs()
|
java.util.Iterator |
getResourceEPRs(java.lang.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). This implementation may be fairly slow depending on how many resource types are in the application. |
boolean |
hasBeenInitialized()
|
boolean |
hasBeenShutdown()
|
void |
initialize()
|
boolean |
isUsingPersistence(java.lang.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(java.util.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 ResourceManagerlistener - 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 ResourceManagerepr - The unique EPR identifying the resource instance.resource -
SoapFault - ResourceManager.getResource(EndpointReference)public void addResourceDefinitions(java.util.Collection definitions)
addResourceDefinitions in interface ResourceManagerdefinitions - The ResourceDefinition objects that will be used to generate new
resource instances.
public Resource createResource(java.lang.String contextPath)
throws SoapFault
ResourceManager
createResource in interface ResourceManagercontextPath - The context path for the resource type that is to be instantiated.
This value is specified with the context-path element in
muse.xml.
SoapFaultpublic Environment getEnvironment()
getEnvironment in interface ResourceManagerprotected java.util.List getListeners()
public int getNumberOfResources()
getNumberOfResources in interface ResourceManagerpublic Resource getResource(EndpointReference epr)
getResource in interface ResourceManagerepr - The unique EPR that is associated with the desired resource.
public java.lang.String getResourceContextPath(java.lang.Class capabilityClass)
ResourceManager
getResourceContextPath in interface ResourceManagercapabilityClass - 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 java.util.Collection getResourceContextPaths()
getResourceContextPaths in interface ResourceManagerpublic java.util.Collection getResourceContextPaths(java.lang.Class capabilityClass)
ResourceManager
getResourceContextPaths in interface ResourceManagerprotected ResourceDefinition getResourceDefinition(java.lang.String contextPath)
contextPath - The URL targeted by an incoming request - this should map to
a context-path value in muse.xml.
public java.util.Iterator getResourceEPRs()
getResourceEPRs in interface ResourceManagerpublic java.util.Iterator getResourceEPRs(java.lang.String contextPath)
getResourceEPRs in interface ResourceManagercontextPath -
public boolean hasBeenInitialized()
hasBeenInitialized in interface Initializationpublic boolean hasBeenShutdown()
hasBeenShutdown in interface Shutdown
public void initialize()
throws SoapFault
initialize in interface InitializationSoapFaultpublic boolean isUsingPersistence(java.lang.String contextPath)
isUsingPersistence in interface ResourceManagercontextPath -
public void removeListener(ResourceManagerListener listener)
ResourceManager
removeListener in interface ResourceManagerlistener -
public void removeResource(EndpointReference epr)
throws SoapFault
ResourceManager
removeResource in interface ResourceManagerepr - The unique EPR that maps to the resource being removed.
SoapFault - public void removeResourceDefinitions(java.util.Collection definitions)
ResourceManager
removeResourceDefinitions in interface ResourceManagerdefinitions - public void setEnvironment(Environment environment)
setEnvironment in interface ResourceManager
public void shutdown()
throws SoapFault
shutdown in interface ShutdownSoapFault
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||