|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.evolveum.midpoint.repo.cache.RepositoryCache
public class RepositoryCache
Read-through write-through per-session repository cache. TODO
Field Summary |
---|
Fields inherited from interface com.evolveum.midpoint.repo.api.RepositoryService |
---|
ADD_OBJECT, CLAIM_TASK, CLASS_NAME_WITH_DOT, DELETE_OBJECT, GET_OBJECT, LIST_ACCOUNT_SHADOW, LIST_OBJECTS, LIST_RESOURCE_OBJECT_SHADOWS, MODIFY_OBJECT, RELEASE_TASK, SEARCH_OBJECTS |
Constructor Summary | |
---|---|
RepositoryCache(RepositoryService repository)
|
Method Summary | ||
---|---|---|
|
addObject(T object,
OperationResult parentResult)
Add new object. |
|
void |
claimTask(java.lang.String oid,
OperationResult parentResult)
Claim a task. |
|
|
deleteObject(java.lang.Class<T> type,
java.lang.String oid,
OperationResult parentResult)
Deletes object with specified OID. |
|
static void |
destroy()
|
|
static java.lang.String |
dump()
|
|
static void |
enter()
|
|
static boolean |
exists()
|
|
static void |
exit()
|
|
|
getObject(java.lang.Class<T> type,
java.lang.String oid,
PropertyReferenceListType resolve,
OperationResult parentResult)
Returns object for provided OID. |
|
|
getPropertyAvailableValues(java.lang.Class<T> type,
java.lang.String oid,
PropertyReferenceListType properties,
OperationResult parentResult)
Returns list of available values for specified properties. |
|
static void |
init()
|
|
UserType |
listAccountShadowOwner(java.lang.String accountOid,
OperationResult parentResult)
Returns the User object representing owner of specified account (account shadow). |
|
|
listObjects(java.lang.Class<T> type,
PagingType paging,
OperationResult parentResult)
Returns all objects of specified type in the repository. |
|
|
listResourceObjectShadows(java.lang.String resourceOid,
java.lang.Class<T> resourceObjectShadowType,
OperationResult parentResult)
Search for resource object shadows of a specified type that belong to the specified resource. |
|
|
modifyObject(java.lang.Class<T> type,
ObjectModificationType objectChange,
OperationResult parentResult)
Modifies object using relative change description. |
|
void |
releaseTask(java.lang.String oid,
OperationResult parentResult)
Release a claimed task. |
|
|
searchObjects(java.lang.Class<T> type,
QueryType query,
PagingType paging,
OperationResult parentResult)
Search for objects in the repository. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public RepositoryCache(RepositoryService repository)
Method Detail |
---|
public static void init()
public static boolean exists()
public static void destroy()
public static void enter()
public static void exit()
public static java.lang.String dump()
public <T extends ObjectType> T getObject(java.lang.Class<T> type, java.lang.String oid, PropertyReferenceListType resolve, OperationResult parentResult) throws ObjectNotFoundException, SchemaException
RepositoryService
getObject
in interface RepositoryService
oid
- OID of the object to getresolve
- list of properties to resolve in the fetched object
ObjectNotFoundException
- requested object does not exist
SchemaException
- error dealing with storage schemapublic <T extends ObjectType> java.lang.String addObject(T object, OperationResult parentResult) throws ObjectAlreadyExistsException, SchemaException
RepositoryService
Add new object.
The OID provided in the input message may be empty. In that case the OID will be assigned by the implementation of this method and it will be provided as return value.
This operation should fail if such object already exists (if object with the provided OID already exists).
The operation may fail if provided OID is in an unusable format for the storage. Generating own OIDs and providing them to this method is not recommended for normal operation.
Should be atomic. Should not allow creation of two objects with the same OID (even if created in parallel).
The operation may fail if the object to be created does not conform to the underlying schema of the storage system or the schema enforced by the implementation.
Note: no need for explicit type parameter here. The object parameter contains the information.
addObject
in interface RepositoryService
object
- object to createparentResult
- parent OperationResult (in/out)
ObjectAlreadyExistsException
- object with specified identifiers already exists, cannot add
SchemaException
- error dealing with storage schema, e.g. schema violationpublic <T extends ObjectType> ResultList<T> listObjects(java.lang.Class<T> type, PagingType paging, OperationResult parentResult)
RepositoryService
Returns all objects of specified type in the repository.
This can be considered as a simplified search operation.
Returns empty list if object type is correct but there are no objects of that type. The ordering of the results is not significant and may be arbitrary unless sorting in the paging is used.
Should fail if object type is wrong.
listObjects
in interface RepositoryService
paging
- paging specification to limit operation result (optional)parentResult
- parent OperationResult (in/out)
public <T extends ObjectType> ResultList<T> searchObjects(java.lang.Class<T> type, QueryType query, PagingType paging, OperationResult parentResult) throws SchemaException
RepositoryService
Search for objects in the repository.
Searches through all object types. Returns a list of objects that match search criteria.
Returns empty list if object type is correct but there are no objects of that type. The ordering of the results is not significant and may be arbitrary unless sorting in the paging is used.
Should fail if object type is wrong. Should fail if unknown property is specified in the query.
searchObjects
in interface RepositoryService
query
- search querypaging
- paging specification to limit operation result (optional)parentResult
- parent OperationResult (in/out)
SchemaException
- unknown property used in search querypublic <T extends ObjectType> void modifyObject(java.lang.Class<T> type, ObjectModificationType objectChange, OperationResult parentResult) throws ObjectNotFoundException, SchemaException
RepositoryService
Modifies object using relative change description.
Must fail if user with provided OID does not exists. Must fail if any of the described changes cannot be applied. Should be atomic.If two or more modify operations are executed in parallel, the operations should be merged. In case that the operations are in conflict (e.g. one operation adding a value and the other removing the same value), the result is not deterministic.
The operation may fail if the modified object does not conform to the underlying schema of the storage system or the schema enforced by the implementation.
TODO: optimistic locking
modifyObject
in interface RepositoryService
objectChange
- specification of object changesparentResult
- parent OperationResult (in/out)
ObjectNotFoundException
- specified object does not exist
SchemaException
- resulting object would violate the schemapublic <T extends ObjectType> void deleteObject(java.lang.Class<T> type, java.lang.String oid, OperationResult parentResult) throws ObjectNotFoundException
RepositoryService
Deletes object with specified OID.
Must fail if object with specified OID does not exists. Should be atomic.
deleteObject
in interface RepositoryService
oid
- OID of object to deleteparentResult
- parent OperationResult (in/out)
ObjectNotFoundException
- specified object does not existpublic <T extends ObjectType> PropertyAvailableValuesListType getPropertyAvailableValues(java.lang.Class<T> type, java.lang.String oid, PropertyReferenceListType properties, OperationResult parentResult) throws ObjectNotFoundException
RepositoryService
Returns list of available values for specified properties.
The returned values can be used as valid values for properties of the specific object. The provided values can be used e.g. for listing them in GUI list boxes, for early validation (pre-validation), displaying help messages, auto-complete, etc.
In case the list of available values is too big or it is not available, the empty list should be returned, setting the "closed" flag to false.
getPropertyAvailableValues
in interface RepositoryService
oid
- OID of the object for which to determine valuesproperties
- list of properties for which to determine valuesparentResult
- parentResult parent OperationResult (in/out)
ObjectNotFoundException
- specified object does not existpublic UserType listAccountShadowOwner(java.lang.String accountOid, OperationResult parentResult) throws ObjectNotFoundException
RepositoryService
Returns the User object representing owner of specified account (account shadow).
May return null if there is no owner specified for the account.
May only be called with OID of AccountShadow object.
Implements the backward "owns" association between account shadow and user. Forward association is implemented by property "account" of user object.
This is a "list" operation even though it may return at most one owner. However the operation implies searching the repository for an owner, which may be less efficient that following a direct association. Hence it is called "list" to indicate that there may be non-negligible overhead.
listAccountShadowOwner
in interface RepositoryService
accountOid
- OID of account shadowparentResult
- parentResult parent OperationResult (in/out)
ObjectNotFoundException
- specified object does not existpublic <T extends ResourceObjectShadowType> ResultList<T> listResourceObjectShadows(java.lang.String resourceOid, java.lang.Class<T> resourceObjectShadowType, OperationResult parentResult) throws ObjectNotFoundException
RepositoryService
Search for resource object shadows of a specified type that belong to the specified resource.
Returns a list of such object shadows or empty list if nothing was found.
Implements the backward "has" association between resource and resource object shadows. Forward association is implemented by property "resource" of resource object shadow.
May only be called with OID of Resource object.
listResourceObjectShadows
in interface RepositoryService
resourceOid
- OID of resource definition (ResourceType)parentResult
- parentResult parent OperationResult (in/out)
ObjectNotFoundException
- specified object does not existpublic void claimTask(java.lang.String oid, OperationResult parentResult) throws ObjectNotFoundException, ConcurrencyException, SchemaException
RepositoryService
Claim a task.
The task can be claimed only by a single node in the cluster. Attempt to claim an already claimed task results in an exception. The claim must be atomic. It is kind of a lock for the system.
TODO: better description
claimTask
in interface RepositoryService
oid
- task OIDparentResult
- parentResult parent OperationResult (in/out)
ObjectNotFoundException
- the task with specified OID was not found
ConcurrencyException
- attempt to claim already claimed task
SchemaException
- error dealing with storage schemapublic void releaseTask(java.lang.String oid, OperationResult parentResult) throws ObjectNotFoundException, SchemaException
RepositoryService
Release a claimed task.
TODO: better description
Note: Releasing a task that is not claimed is not an error. Warning should be logged, but this should not throw any exception.
releaseTask
in interface RepositoryService
oid
- task OIDparentResult
- parentResult parent OperationResult (in/out)
ObjectNotFoundException
- the task with specified OID was not found
SchemaException
- error dealing with storage schema
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |