Package net.aifusion.metamodel
Class InMemoryCache
java.lang.Object
net.aifusion.metamodel.InMemoryCache
- All Implemented Interfaces:
Repository
- Direct Known Subclasses:
BufferedCache,PersistentCache
In-memory repository supporting multiple namespaces, but no persistence
- Author:
- Sharad Singhal
-
Constructor Summary
ConstructorsConstructorDescriptionCreate an in-memory CIM repository that supports multiple namespaces, but no persistence -
Method Summary
Modifier and TypeMethodDescriptionbooleancontains(ObjectPath path) Check if a named element exists in the repositorybooleandelete(ObjectPath path) Delete a named element from the repositoryfilter(ObjectPath path, CimFilter filter) Find all structure value instances based on some filter criteriaget(ObjectPath path) Get a named element from the repositorygetElements(String elementTypes, String localNameSpaces, String elementNames, boolean locateSubTypes) Get elements from this repository.Get a list of all name spaces known to this repository.booleanput(NamedElement element) Put a named element into the repositoryvoidshutdown()Shut down the repository.
-
Constructor Details
-
InMemoryCache
public InMemoryCache()Create an in-memory CIM repository that supports multiple namespaces, but no persistence- See Also:
-
-
Method Details
-
put
Description copied from interface:RepositoryPut a named element into the repository- Specified by:
putin interfaceRepository- Parameters:
element- - element to be added- Returns:
- - true if successfully added, false otherwise
-
get
Description copied from interface:RepositoryGet a named element from the repository- Specified by:
getin interfaceRepository- Parameters:
path- - object path corresponding to the named element- Returns:
- - Named Element corresponding to the element. Null returned if no such element exists in the repository
-
contains
Description copied from interface:RepositoryCheck if a named element exists in the repository- Specified by:
containsin interfaceRepository- Parameters:
path- - object path corresponding to the named element- Returns:
- - true if the path exists in the repository, false otherwise
-
delete
Description copied from interface:RepositoryDelete a named element from the repository- Specified by:
deletein interfaceRepository- Parameters:
path- - object path corresponding to the named element- Returns:
- - true if deletion succeeded, false otherwise
-
shutdown
public void shutdown()Description copied from interface:RepositoryShut down the repository. This method MUST be called before exiting to cleanly finish all pending tasks and release resources in the repository- Specified by:
shutdownin interfaceRepository
-
getNameSpaces
Description copied from interface:RepositoryGet a list of all name spaces known to this repository. Note that because implementations can add or remove name spaces as elements are added or deleted, this list may not be complete, and depends on the repository implementation- Specified by:
getNameSpacesin interfaceRepository- Returns:
- - list of name spaces
-
getElements
public List<NamedElement> getElements(String elementTypes, String localNameSpaces, String elementNames, boolean locateSubTypes) Description copied from interface:RepositoryGet elements from this repository. Depending on the size of the repository, this method can be very expensive in time and/or memory- Specified by:
getElementsin interfaceRepository- Parameters:
elementTypes- - Optional comma separated list of element types to retrieve. Must be a NamedElement type (QualifierType, Enumeration, Interface, Structure, Class, StructureValue or Instance). A null will retrieve all types. Note that standard qualifier types are "built in" and are not returned by this method.localNameSpaces- - Optional comma separated list of local name spaces to search. A null will retrieve elements from all name spaceselementNames- - Optional comma-separated list of element names to retrieve. A null will retrieve all elements of the given type. For instances, all instances corresponding to the class name are returnedlocateSubTypes- - if true, locate all subtypes of the given element types (e.g., all subclasses of the requested class).- Returns:
- - list of elements that match the given criteria. An empty list is returned if no matching elements are found
- See Also:
-
filter
Description copied from interface:RepositoryFind all structure value instances based on some filter criteria- Specified by:
filterin interfaceRepository- Parameters:
path- - object path to the structure to usefilter- - filter to apply- Returns:
- - list of structureValues that pass the given filter. Empty list if none available
-