Package net.aifusion.metamodel
Class PersistentCache
java.lang.Object
net.aifusion.metamodel.InMemoryCache
net.aifusion.metamodel.PersistentCache
- All Implemented Interfaces:
Repository
Class to implement a persistent repository that supports multiple name spaces
- Author:
- Sharad Singhal
-
Constructor Summary
ConstructorsConstructorDescriptionPersistentCache(String repositoryLocation) Create a persistent repository using the file system -
Method Summary
Modifier and TypeMethodDescriptionbooleancontains(ObjectPath path) Check if a named element exists in the repositorybooleandelete(ObjectPath path) Delete a named element from the repositoryget(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 repositoryMethods inherited from class net.aifusion.metamodel.InMemoryCache
filter, shutdown
-
Constructor Details
-
PersistentCache
Create a persistent repository using the file system- Parameters:
repositoryLocation- - file system root of the repository i.e., /user/repository
-
-
Method Details
-
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- Overrides:
getNameSpacesin classInMemoryCache- Returns:
- - list of name spaces
-
put
Description copied from interface:RepositoryPut a named element into the repository- Specified by:
putin interfaceRepository- Overrides:
putin classInMemoryCache- 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- Overrides:
getin classInMemoryCache- 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- Overrides:
containsin classInMemoryCache- 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- Overrides:
deletein classInMemoryCache- Parameters:
path- - object path corresponding to the named element- Returns:
- - true if deletion succeeded, false otherwise
-
getElements
public List<NamedElement> getElements(String elementTypes, String localNameSpaces, String elementNames, boolean locateSubTypes) Get elements from this repository. Note that depending on the size of the repository, this method can be very expensive in time and/or memory. This method directly accesses the persistent store, and does not cache the results in the in-memory cache- Specified by:
getElementsin interfaceRepository- Overrides:
getElementsin classInMemoryCache- Parameters:
elementTypes- - Optional comma separated list of element types to retrieve. Must be a NamedElement (Instance, Class, QualifierType, Structure, structurevalue, Interface or enumeration). Null will select all element types.localNameSpaces- - Optional comma separated list of local namespaces to search. A null will retrieve elements from all namespaceselementNames- - Optional comma-separated list of element names to retrieve. A null will retrieve all elements of the given typelocateSubTypes- - if true, also retrieve subtypes of the requested element types- Returns:
- list of elements that match the given criteria. An empty list is returned if no matching elements are found
- See Also:
-