|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.gcube.common.core.resources.GCUBEResource
public abstract class GCUBEResource
Specifies the behaviour common to all gCUBE resources.
| Nested Class Summary | |
|---|---|
class |
GCUBEResource.AddScopeEvent
Generic GCUBEEvent for the addition of a scope to the resource. |
static class |
GCUBEResource.InvalidScopeException
NoValidScopeFoundException exception |
class |
GCUBEResource.RemoveScopeEvent
Generic GCUBEEvent for the removal of a scope from the resource. |
static class |
GCUBEResource.ResourceConsumer
Base implementation of a GCUBEConsumer of ResourceEvents. |
class |
GCUBEResource.ResourceEvent<PAYLOAD>
Single GCUBEEvent type for GHNTopics. |
static class |
GCUBEResource.ResourceTopic
A GCUBETopic for lifetime events . |
| Field Summary | |
|---|---|
protected GCUBEProducer<GCUBEResource.ResourceTopic,Object> |
eventProducer
Internal GCUBEProducer for ResourceEvents. |
protected GCUBELog |
logger
The object logger; |
protected String |
resourceVersion
The version of the Profile to which this resource is compliant to. |
protected String |
type
The resource type. |
| Constructor Summary | |
|---|---|
GCUBEResource()
|
|
| Method Summary | |
|---|---|
Set<GCUBEScope> |
addScope(GCUBEScope... scopes)
Adds one or more scopes from the resource. |
boolean |
equals(Object obj)
|
String |
getID()
Returns the resource identifier. |
String |
getLastResourceVersion()
|
String |
getResourceVersion()
|
Map<String,GCUBEScope> |
getScopes()
Returns a read-only map of the scopes associated with the resource index by scope expression. |
String |
getType()
Returns the type of the resource. |
boolean |
inScope(GCUBEScope... scopes)
Indicates whether the resource is in one or more given scopes. |
abstract void |
load(Reader reader)
Deserialise the state of the resource from an existing serialisation. |
Set<GCUBEScope> |
removeScope(GCUBEScope... scopes)
Removes one or more scopes from the resource. |
boolean |
setID(String id)
Sets the resource identifier. |
void |
setLogger(GCUBELog logger)
Sets the resource's logger. |
void |
setResourceVersion(String version)
|
abstract void |
store(Writer writer)
Serialise the current state of the resource. |
void |
subscribeResourceEvents(GCUBEResource.ResourceConsumer consumer,
GCUBEResource.ResourceTopic... topics)
Subscribes a consumer to one or more ResourceEvents. |
Set<GCUBEScope> |
validateAddScopes(GCUBEScope... scopes)
Invoked by addScope(GCUBEScope...), to filter scopes as per
resource-specific scoping rules.By default, it returns its input. |
Set<GCUBEScope> |
validateRemoveScopes(GCUBEScope... scopes)
Invoked by removeScope(GCUBEScope...), to filter scopes as per
resource-specific scoping rules.By default, it returns its input. |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected GCUBELog logger
protected String type
protected String resourceVersion
protected GCUBEProducer<GCUBEResource.ResourceTopic,Object> eventProducer
GCUBEProducer for ResourceEvents.
| Constructor Detail |
|---|
public GCUBEResource()
| Method Detail |
|---|
public void setLogger(GCUBELog logger)
logger - the logger.public String getType()
public String getID()
public boolean setID(String id)
id - the identifier
true if the identifier was set, false otherwise.public Map<String,GCUBEScope> getScopes()
public Set<GCUBEScope> addScope(GCUBEScope... scopes)
scopes - the scopes.public Set<GCUBEScope> validateAddScopes(GCUBEScope... scopes)
addScope(GCUBEScope...), to filter scopes as per
resource-specific scoping rules.By default, it returns its input.
scopes - the scopes.
public Set<GCUBEScope> removeScope(GCUBEScope... scopes)
scopes - the scopes.
public Set<GCUBEScope> validateRemoveScopes(GCUBEScope... scopes)
removeScope(GCUBEScope...), to filter scopes as per
resource-specific scoping rules.By default, it returns its input.
scopes - the scopes.
public boolean inScope(GCUBEScope... scopes)
scopes - the scopes.
true if it is in all the input scopes, false otherwise.public boolean equals(Object obj)
equals in class Object
public abstract void load(Reader reader)
throws Exception
reader - the Reader which exposes the serialisation.
UnsupportedOperationException - if this operation is not supported by implementation.
Exception - if the operation is supported but could not complete successfully.
public abstract void store(Writer writer)
throws Exception
writer - the Writer which exposes the serialisation.
UnsupportedOperationException
UnsupportedOperationException - if this operation is not supported by implementation.
Exception - if the operation is supported but could not complete successfully.
public void subscribeResourceEvents(GCUBEResource.ResourceConsumer consumer,
GCUBEResource.ResourceTopic... topics)
throws Exception
ResourceEvents.
consumer - the consumer.topics - the topics of interest.
Exception - if the subscription could not be completed.public String getResourceVersion()
public void setResourceVersion(String version)
version - the resource version to setpublic String getLastResourceVersion()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||