public class MultiResource extends AbstractResource
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
DESCRIPTION |
static java.lang.String |
TYPE_NAME |
lock, multiResourcelock| Constructor and Description |
|---|
MultiResource(MultiResourceParameters parameters)
Creates a new
MultiResource from the given parameters. |
| Modifier and Type | Method and Description |
|---|---|
void |
addMultiResourceConsumer(ResourceConsumer consumer) |
void |
addResource(ResourceParameters parameters,
boolean defaultResource)
Adds a new
ResourceProvider to the list of Resources managed by
this group. |
void |
addResource(java.lang.String name,
java.lang.Object[] params,
boolean defaultResource)
Adds a new
ResourceProvider to the list of Resources managed by
this group. |
void |
closeRequest()
If the resource is not in use, calling this method will send a close request
to all consumers referencing this resource.
|
java.lang.Object |
execute(ResourceAction action)
Locks the multiresource components to avoid another concurrent modification
|
void |
frozen()
Blocks the adding methods.
|
java.lang.Object |
get()
Returns the real resource represented by this object.
|
java.lang.Object |
getData()
Returns a custom object containing extended data relative to
this resource.
|
java.lang.String |
getName()
Returns the name of the
Resource. |
boolean |
isThis(ResourceParameters parameters) |
void |
notifyChanges() |
void |
notifyClose() |
void |
notifyDispose() |
void |
notifyOpen() |
void |
prepare() |
void |
setData(java.lang.Object data)
Sets a custom object as this resource's extended data.
|
java.lang.String |
toString() |
addConsumer, addObserver, addObservers, deleteObserver, deleteObservers, executeBegins, executeEnds, getConsumerAt, getConsumersCount, getLastTimeOpen, getLastTimeUsed, getParameters, inUse, isOpen, notifyObserver, openCount, performExecution, prepare, removeConsumer, updateLastTimeOpen, updateLastTimeUsedpublic static final java.lang.String TYPE_NAME
public static final java.lang.String DESCRIPTION
public MultiResource(MultiResourceParameters parameters) throws InitializeException
MultiResource from the given parameters.parameters - to create the resource fromInitializeException - if there is an error creating the resourcepublic void addResource(ResourceParameters parameters, boolean defaultResource) throws InitializeException
ResourceProvider to the list of Resources managed by
this group.parameters - to create the resource fromdefaultResource - if the added resource is to be used as the multi resource
default oneInitializeException - if there is an error adding the resourcepublic void addResource(java.lang.String name,
java.lang.Object[] params,
boolean defaultResource)
throws InitializeException
ResourceProvider to the list of Resources managed by
this group.name - of the resource to addparams - parameters to create the resource withdefaultResource - if the added resource is to be used as the multi resource
default oneInitializeException - if there is an error adding the resourcepublic boolean isThis(ResourceParameters parameters) throws ResourceException
ResourceExceptionpublic void notifyChanges()
throws ResourceNotifyChangesException
notifyChanges in interface ResourceProvidernotifyChanges in class AbstractResourceResourceNotifyChangesExceptionpublic void notifyClose()
throws ResourceNotifyCloseException
notifyClose in interface ResourceProvidernotifyClose in class AbstractResourceResourceNotifyCloseExceptionpublic void notifyDispose()
throws ResourceNotifyDisposeException
notifyDispose in interface ResourceProvidernotifyDispose in class AbstractResourceResourceNotifyDisposeExceptionpublic void notifyOpen()
throws ResourceNotifyOpenException
notifyOpen in interface ResourceProvidernotifyOpen in class AbstractResourceResourceNotifyOpenExceptionpublic void prepare()
throws PrepareResourceException
prepare in interface ResourceProviderprepare in class AbstractResourcePrepareResourceExceptionpublic void closeRequest()
throws ResourceException
ResourcecloseRequest in interface ResourcecloseRequest in class AbstractResourceResourceExceptionpublic java.lang.Object get()
throws AccessResourceException
AbstractResourceget in interface Resourceget in class AbstractResourceAccessResourceException - if there is an error while accessing the resourcepublic java.lang.Object getData()
ResourcegetData in interface ResourcegetData in class AbstractResourcepublic java.lang.String getName()
throws AccessResourceException
AbstractResourceResource.getName in interface ResourcegetName in class AbstractResourceAccessResourceException - if there is an error while accessing the resourcepublic java.lang.String toString()
toString in class java.lang.Objectpublic void setData(java.lang.Object data)
ResourcesetData in interface ResourcesetData in class AbstractResourcedata - a custom object containing data related to this resource.public void frozen()
public java.lang.Object execute(ResourceAction action) throws ResourceExecuteException
execute in interface Resourceexecute in class AbstractResourceResourceExecuteExceptionpublic void addMultiResourceConsumer(ResourceConsumer consumer)