de.cesr.lara.components.container.storage
Interface LaraOverwriteStorage<PropertyType extends LaraProperty<PropertyType,?>>

Type Parameters:
PropertyType -
All Superinterfaces:
Iterable<PropertyType>, LaraCapacityManageableContainer<PropertyType>, LaraContainer<PropertyType>
All Known Implementing Classes:
LDefaultSimpleStorage

public interface LaraOverwriteStorage<PropertyType extends LaraProperty<PropertyType,?>>
extends LaraContainer<PropertyType>, LaraCapacityManageableContainer<PropertyType>

The interface is intended for simple storages that do not care about time steps (i.e. store only the latest entry for a specific key).


Field Summary
 
Fields inherited from interface de.cesr.lara.components.container.LaraContainer
UNLIMITED_CAPACITY
 
Method Summary
 void addStoragePropertyObserver(LaraStorageListener.StorageEvent eventType, LaraStorageListener listener)
          Adds a given LaraStorageListener for the specified LaraStorageListener.StorageEvent
 void clear()
          Clears the storage, i.e. removes all properties.
 boolean contains(Class<?> propertyType, String key)
          Checks whether the storage contains a property of the given type with the given key.
 boolean contains(PropertyType property)
          Returns true, if, and only if, this storage contains the given property.
 boolean contains(PropertyType property, String key)
          Checks whether the memory contains the given LaraProperty with the given key.
 boolean contains(String key)
          Returns true, if, and only if, this storage contains a property for the specified key.
<RequestPropertyType extends PropertyType>
RequestPropertyType
fetch(Class<RequestPropertyType> propertyType, String key)
          Generic method that returns the most recently stored property that is of the specified type and identified with key.
 PropertyType fetch(String key)
          Generic method that returns the most recently stored property that is identified with key.
<RequestPropertyType extends PropertyType>
Collection<RequestPropertyType>
fetchAll(Class<RequestPropertyType> propertyType)
          Generic method that returns a collection of all properties found.
 Set<String> getAllPropertyKeys()
          Returns a set of Strings that represent the keys of properties stored in the storage such that any property in the storage is represented.
 PropertyType remove(PropertyType propertyToRemove)
          Removes the specified property from this storage.
 PropertyType remove(String key)
          Removes the specified property from this storage.
 Collection<PropertyType> removeAll(Collection<PropertyType> propertiesToBeRemoved)
          Removes all properties in the specified collection from this storage.
 void removeStoragePropertyObserver(LaraStorageListener.StorageEvent eventType, LaraStorageListener listener)
           
 void store(PropertyType propertyToStore)
          Tries to add the specified property to this storage.
 
Methods inherited from interface de.cesr.lara.components.container.LaraCapacityManageableContainer
getCapacityManagementView, getCapacityManager, setCapacity, setCapacityManager
 
Methods inherited from interface de.cesr.lara.components.container.LaraContainer
getCapacity, getSize, isEmpty, isFull
 
Methods inherited from interface java.lang.Iterable
iterator
 

Method Detail

addStoragePropertyObserver

void addStoragePropertyObserver(LaraStorageListener.StorageEvent eventType,
                                LaraStorageListener listener)
Adds a given LaraStorageListener for the specified LaraStorageListener.StorageEvent

Parameters:
eventType - the category of storage property events the listeners shall be registered for
listener - the listener to be registered

clear

void clear()
           throws LRemoveException
Clears the storage, i.e. removes all properties.

Throws:
LRemoveException

contains

boolean contains(Class<?> propertyType,
                 String key)
Checks whether the storage contains a property of the given type with the given key.

Parameters:
key -
Returns:
true if such a property is contained

contains

boolean contains(PropertyType property)
Returns true, if, and only if, this storage contains the given property.

Parameters:
property -
Returns:
true, if, and only if, this storage contains the given property.

contains

boolean contains(PropertyType property,
                 String key)
Checks whether the memory contains the given LaraProperty with the given key.

Parameters:
key -
Returns:
true if such a property is contained

contains

boolean contains(String key)
Returns true, if, and only if, this storage contains a property for the specified key.

Parameters:
key -
Returns:
true, if, and only if, this storage contains a property for the specified key.

fetch

<RequestPropertyType extends PropertyType> RequestPropertyType fetch(Class<RequestPropertyType> propertyType,
                                                                     String key)
                                               throws LRetrieveException
Generic method that returns the most recently stored property that is of the specified type and identified with key.

Parameters:
propertyType -
key - identifier for the property to be retrieved.
Returns:
the most recently stored property that is of the specified type and identified with key.
Throws:
LRetrieveException

fetch

PropertyType fetch(String key)
                                                        throws LRetrieveException
Generic method that returns the most recently stored property that is identified with key.

Parameters:
key - identifier for the property to be retrieved.
Returns:
the most recently stored property that is identified with key.
Throws:
LRetrieveException

fetchAll

<RequestPropertyType extends PropertyType> Collection<RequestPropertyType> fetchAll(Class<RequestPropertyType> propertyType)
                                                              throws LRetrieveException
Generic method that returns a collection of all properties found.

Parameters:
propertyType - identifier for the properties to be retrieved.
Returns:
the properties of the specified type that were stored in step and identified with key.
Throws:
LRetrieveException

getAllPropertyKeys

Set<String> getAllPropertyKeys()
Returns a set of Strings that represent the keys of properties stored in the storage such that any property in the storage is represented.

Returns:
set of keys that represent a property stored in the storage

remove

PropertyType remove(PropertyType propertyToRemove)
                                                         throws LRemoveException
Removes the specified property from this storage.

Parameters:
propertyToRemove - the property to be removed.
Returns:
the property that was removed
Throws:
LRemoveException

remove

PropertyType remove(String key)
                                                         throws LRemoveException
Removes the specified property from this storage.

Parameters:
key - Key of property that shall be removed the property to be removed. Created by Michael Elbers on 22.02.2010
Returns:
the property that was removed
Throws:
LRemoveException

removeAll

Collection<PropertyType> removeAll(Collection<PropertyType> propertiesToBeRemoved)
                                                                        throws LRemoveException
Removes all properties in the specified collection from this storage.

Parameters:
propertiesToBeRemoved - the properties to be removed
Returns:
the properties that were removed
Throws:
LRemoveException

removeStoragePropertyObserver

void removeStoragePropertyObserver(LaraStorageListener.StorageEvent eventType,
                                   LaraStorageListener listener)
Parameters:
eventType - the category of storage property events the listeners shall be removed from
listener - the listener to be removed

store

void store(PropertyType propertyToStore)
           throws LContainerFullException,
                  LInvalidTimestampException
Tries to add the specified property to this storage.

Parameters:
propertyToStore - the property to be stored.
Throws:
LContainerFullException
LInvalidTimestampException