|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.util.TimerTask
org.glite.ce.monitorapij.resource.ResourceHolder
A class used to handle a list of Resource
s placed in a specified directory as plugins.
An XML config file is used to store and retrieve information about these resources.
The task of checking if resources are added or removed or modified can be scheduled for repeated executions.
Constructor Summary | |
ResourceHolder(org.apache.axis.MessageContext context,
java.net.URI resourcePath)
Creates a new ResourceHolder object specifying the current MessageContext and the resource path. |
|
ResourceHolder(org.apache.axis.MessageContext context,
java.net.URI resourcePath,
java.net.URI configFilePath)
Creates a new ResourceHolder object specifying the current MessageContext , the resource path
and the config file path. |
Method Summary | |
void |
addResource(Resource resource)
Add a Resource to the list of handled resources. |
void |
addResourceListener(ResourceListener l)
Adds a ResourceListener to the holder. |
protected boolean |
checkNewResources()
Check if any resources has been added or modified by checking last modification time of the dir containing the resources. |
void |
clear()
Clear the list of handled resources. |
protected void |
fireResourceEvent(ResourceEvent event)
Notifies all listeners that have registered interest for notification on this event type. |
java.net.URI |
getConfigFileURI()
Get the URI specifying the config file path. |
Resource |
getResource(int id)
Get the Resource specified by its ID. |
Resource[] |
getResourceByJARPath(org.apache.axis.types.URI path)
Get the CEMonResource s with the specified jar path. |
Resource[] |
getResourceByName(java.lang.String name)
Get the CEMonResource s with the specified name. |
Resource[] |
getResourceByType(java.lang.String type)
Get the all Resource of the specified type. |
protected java.io.File[] |
getResourceFileList()
Get the list of jar files contained in the resource directory. |
Resource[] |
getResources()
Get all the handled resources. |
java.net.URI |
getResourceURI()
Get the URI specifying the resource path. |
ResourceListener[] |
getSensorListeners()
Returns an array of all the SensorListener s added to this
holder with addSensorListener(). |
protected java.lang.Class |
makeResourceClass(java.io.File resourceJarFile)
Get an instance of the Resource class packed in the jar file. |
protected Resource |
makeResourceInstance(java.io.File resourceJarFile)
DOCUMENT ME! |
void |
removeResource(Resource resource)
Remove the specified Resource . |
void |
removeResourceListener(ResourceListener l)
Removes a ResourceListener from the holder. |
void |
run()
This is the scheduled method checking if new resources are added or if already present resources has been updated. |
void |
setResources(Resource[] resources)
Add an array of Resource s to the list of handled resources. |
Methods inherited from class java.util.TimerTask |
cancel, scheduledExecutionTime |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public ResourceHolder(org.apache.axis.MessageContext context, java.net.URI resourcePath)
MessageContext
and the resource path.
The path of the config file is considered null; this means that no xml describing the present resources
has been created yet.
context
- The current MessageContext
.resourcePath
- The path where new resources are placed.public ResourceHolder(org.apache.axis.MessageContext context, java.net.URI resourcePath, java.net.URI configFilePath)
MessageContext
, the resource path
and the config file path.
context
- The current MessageContext
.resourcePath
- The path where new resources are placed.configFilePath
- The path of the config file.Method Detail |
public java.net.URI getResourceURI()
public java.net.URI getConfigFileURI()
public void addResource(Resource resource)
Resource
to the list of handled resources.
resource
- The Resource
to add. This must have a defined ID.public void removeResource(Resource resource)
Resource
.
resource
- The resource to be removed.public Resource getResource(int id)
Resource
specified by its ID.
id
- The ID int of the Resource
searched.
public Resource[] getResources()
public Resource[] getResourceByType(java.lang.String type)
Resource
of the specified type.
public Resource[] getResourceByJARPath(org.apache.axis.types.URI path)
CEMonResource
s with the specified jar path.
path
- The path of the jar of the resource.
public Resource[] getResourceByName(java.lang.String name)
CEMonResource
s with the specified name.
name
- The name of the searched resource.
public void setResources(Resource[] resources)
Resource
s to the list of handled resources.
resources
- An array containing the resources to add.public void clear()
protected boolean checkNewResources()
protected java.io.File[] getResourceFileList() throws java.lang.Exception
java.lang.Exception
protected Resource makeResourceInstance(java.io.File resourceJarFile) throws java.lang.Exception
resourceJarFile
- DOCUMENT ME!
java.lang.Exception
- DOCUMENT ME!protected java.lang.Class makeResourceClass(java.io.File resourceJarFile) throws java.lang.Exception
Resource
class packed in the jar file.
resourceJarFile
- The jar file containing the class of a Resource
.
It must contain the "Main-Class" attribute
into its MANIFEST.MF specifying the name of the Resource class.
java.lang.Exception
- If the jar file does not contain a main class the "Main-Class" attribute
into its MANIFEST.MF or if the instance cannot be created.public void run()
public ResourceListener[] getSensorListeners()
SensorListener
s added to this
holder with addSensorListener().
SensorListener
s added or an empty array
if no listeners have been addedpublic void addResourceListener(ResourceListener l)
ResourceListener
to the holder.
l
- the ResourceListener
to be addedpublic void removeResourceListener(ResourceListener l)
ResourceListener
from the holder.
l
- the listener to be removedprotected void fireResourceEvent(ResourceEvent event)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |