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, updateLastTimeUsed
public 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
ResourceException
public void notifyChanges() throws ResourceNotifyChangesException
notifyChanges
in interface ResourceProvider
notifyChanges
in class AbstractResource
ResourceNotifyChangesException
public void notifyClose() throws ResourceNotifyCloseException
notifyClose
in interface ResourceProvider
notifyClose
in class AbstractResource
ResourceNotifyCloseException
public void notifyDispose() throws ResourceNotifyDisposeException
notifyDispose
in interface ResourceProvider
notifyDispose
in class AbstractResource
ResourceNotifyDisposeException
public void notifyOpen() throws ResourceNotifyOpenException
notifyOpen
in interface ResourceProvider
notifyOpen
in class AbstractResource
ResourceNotifyOpenException
public void prepare() throws PrepareResourceException
prepare
in interface ResourceProvider
prepare
in class AbstractResource
PrepareResourceException
public void closeRequest() throws ResourceException
Resource
closeRequest
in interface Resource
closeRequest
in class AbstractResource
ResourceException
public java.lang.Object get() throws AccessResourceException
AbstractResource
get
in interface Resource
get
in class AbstractResource
AccessResourceException
- if there is an error while accessing the resourcepublic java.lang.Object getData()
Resource
getData
in interface Resource
getData
in class AbstractResource
public java.lang.String getName() throws AccessResourceException
AbstractResource
Resource
.getName
in interface Resource
getName
in class AbstractResource
AccessResourceException
- if there is an error while accessing the resourcepublic java.lang.String toString()
toString
in class java.lang.Object
public void setData(java.lang.Object data)
Resource
setData
in interface Resource
setData
in class AbstractResource
data
- a custom object containing data related to this resource.public void frozen()
public java.lang.Object execute(ResourceAction action) throws ResourceExecuteException
execute
in interface Resource
execute
in class AbstractResource
ResourceExecuteException
public void addMultiResourceConsumer(ResourceConsumer consumer)