public final class SimpleTypeImpl extends java.lang.Object implements SimpleType
Modifier and Type | Field and Description |
---|---|
protected ConfigContextImpl |
configContext
The config context
|
protected DataCache<java.lang.Object> |
dataCache
data cache
|
protected java.util.Map<java.lang.String,ResourceIndex<java.lang.Object>> |
indices
Indices
|
protected DataCache<Metadata> |
metadataCache
Metadata cache
|
Constructor and Description |
---|
SimpleTypeImpl(ConfigContext cc, SimpleTypeDef typedef)
Constructor
|
Modifier and Type | Method and Description |
---|---|
void |
create(Ref instanceId, java.lang.Object data)
Creates a new Component with the given instance id and data
|
void |
delete(Ref instanceId)
Deletes the instance with the given instance id.
|
boolean |
exists(Ref instanceId)
Returns whether the instance with the given instance id exists.
|
java.util.Set<Ref> |
getInstanceIds()
Returns a list of instance ids of all the components.
|
Metadata |
getMetadata(Ref instanceId)
Returns the metadata for a given instance
|
int |
getNumInstances()
Returns the number of instances of this type
|
SimpleTypeDef |
getTypeDef()
Returns the definition for this component type
|
java.lang.String |
getTypeId()
Returns the id of this type
|
<T> T |
getValue(Ref instanceId)
Returns the data value for the given instance
|
void |
init()
Initializes the Component type for use.
|
boolean |
isInitialized()
Returns true if this component type is initialized
|
java.util.Set<Ref> |
searchInstanceIds(java.lang.String keyName, java.lang.Object keyValue)
Returns a list of components that has the given keyValue for the given key.
|
void |
shutdown()
Shutsdown this component.
|
void |
update(Ref instanceId, java.lang.Object newData)
Updates a component with a new value.
|
void |
validateForDelete(Ref instanceid)
Validates that the given component can be deleted.
|
void |
validateForUpdate(Ref instanceId, java.lang.Object newData)
Validates that the component with the given reference can be updated with the new data.
|
protected final java.util.Map<java.lang.String,ResourceIndex<java.lang.Object>> indices
protected final DataCache<java.lang.Object> dataCache
protected final ConfigContextImpl configContext
public SimpleTypeImpl(ConfigContext cc, SimpleTypeDef typedef) throws java.lang.Exception
typedef
- definition for this typejava.lang.Exception
public final void init() throws java.lang.Exception
public final void shutdown()
public void validateForUpdate(Ref instanceId, java.lang.Object newData) throws NotFoundException
NotFoundException
public void validateForDelete(Ref instanceid) throws NotFoundException
NotFoundException
public final java.lang.String getTypeId()
public final SimpleTypeDef getTypeDef()
getTypeDef
in interface BaseType
getTypeDef
in interface SimpleType
public final int getNumInstances()
getNumInstances
in interface BaseType
public final boolean isInitialized()
isInitialized
in interface BaseType
public final java.util.Set<Ref> getInstanceIds()
getInstanceIds
in interface BaseType
public final java.util.Set<Ref> searchInstanceIds(java.lang.String keyName, java.lang.Object keyValue)
searchInstanceIds
in interface BaseType
keyName
-keyValue
-java.lang.IllegalArgumentException
- if key does not existpublic final void create(Ref instanceId, java.lang.Object data) throws ValidationException, CreateException
create
in interface BaseType
instanceId
- the id of this instance.data
- the data used to initialize the component.ValidationException
CreateException
public final void delete(Ref instanceId) throws NotFoundException, DeleteException
delete
in interface BaseType
instanceId
- Id of the instance to be deleted.ValidationException
DeleteException
NotFoundException
- if the instance does not exist.public final void update(Ref instanceId, java.lang.Object newData) throws UpdateException, NotFoundException
update
in interface BaseType
instanceId
- Id of the instance to be deleted.newData
-UpdateException
NotFoundException
ValidationException
public final boolean exists(Ref instanceId)
public final <T> T getValue(Ref instanceId) throws NotFoundException
getValue
in interface BaseType
instanceId
-NotFoundException
- if the instance does not existpublic final Metadata getMetadata(Ref instanceId) throws NotFoundException
BaseType
getMetadata
in interface BaseType
NotFoundException