com.evolveum.midpoint.model.api
Interface ModelService

All Known Implementing Classes:
ModelController

public interface ModelService

IDM Model Interface

IDM Model Interface provides access unified to the identity objects stored in the repository and on the resources. It abstracts away the details about where and how are the data stored, it hides all the low-level system components.

Implementation of this interface are expected to enforce a consistency of access control decisions and model, e.g. to enforce Role-Based Access Control (RBAC). RBAC is only one of many possibly models and this interface may have many implementations.

Implementations of this interface may automatically derive properties and attributes for objects. E.g. RBAC models may automatically derive resource accounts attributes based on user role membership.

Author:
lazyman, Radovan Semancik

Field Summary
static java.lang.String ADD_OBJECT
           
static java.lang.String ADD_USER
           
static java.lang.String CLASS_NAME_WITH_DOT
           
static java.lang.String DELETE_OBJECT
           
static java.lang.String DISCOVER_CONNECTORS
           
static java.lang.String GET_OBJECT
           
static java.lang.String GET_PROPERTY_AVAILABLE_VALUES
           
static java.lang.String IMPORT_ACCOUNTS_FROM_RESOURCE
           
static java.lang.String IMPORT_OBJECTS_FROM_FILE
           
static java.lang.String IMPORT_OBJECTS_FROM_STREAM
           
static java.lang.String LIST_ACCOUNT_SHADOW_OWNER
           
static java.lang.String LIST_OBJECTS
           
static java.lang.String LIST_RESOURCE_OBJECT_SHADOWS
           
static java.lang.String LIST_RESOURCE_OBJECTS
           
static java.lang.String MODIFY_OBJECT
           
static java.lang.String POST_INIT
           
static java.lang.String TEST_RESOURCE
           
 
Method Summary
<T extends ObjectType>
java.lang.String
addObject(T object, Task task, OperationResult parentResult)
           Add new object.
<T extends ObjectType>
void
deleteObject(java.lang.Class<T> type, java.lang.String oid, Task task, OperationResult parentResult)
           Deletes object with specified OID.
 java.util.Set<ConnectorType> discoverConnectors(ConnectorHostType hostType, OperationResult parentResult)
          Discovers local or remote connectors.
<T extends ObjectType>
T
getObject(java.lang.Class<T> type, java.lang.String oid, PropertyReferenceListType resolve, OperationResult result)
           Returns object for provided OID.
 PropertyAvailableValuesListType getPropertyAvailableValues(java.lang.String oid, PropertyReferenceListType properties, OperationResult result)
           Returns list of available values for specified properties.
 void importAccountsFromResource(java.lang.String resourceOid, javax.xml.namespace.QName objectClass, Task task, OperationResult parentResult)
           Import accounts from resource.
 void importObjectsFromFile(java.io.File input, ImportOptionsType options, Task task, OperationResult parentResult)
          Import objects from file.
 void importObjectsFromStream(java.io.InputStream input, ImportOptionsType options, Task task, OperationResult parentResult)
          Import objects from stream.
 UserType listAccountShadowOwner(java.lang.String accountOid, OperationResult parentResult)
           Returns the User object representing owner of specified account (account shadow).
<T extends ObjectType>
ResultList<T>
listObjects(java.lang.Class<T> objectType, PagingType paging, OperationResult result)
           Returns all objects of specified type that are available to the implementation.
 ResultList<? extends ResourceObjectShadowType> listResourceObjects(java.lang.String resourceOid, javax.xml.namespace.QName objectClass, PagingType paging, OperationResult result)
           Returns all resource objects of specified type that are currently available to the system.
<T extends ResourceObjectShadowType>
ResultList<T>
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.
<T extends ObjectType>
void
modifyObject(java.lang.Class<T> type, ObjectModificationType change, Task task, OperationResult parentResult)
           Modifies object using relative change description.
 void postInit(OperationResult parentResult)
          Finish initialization of the model and lower system components (provisioning, repository, etc).
<T extends ObjectType>
ResultList<T>
searchObjects(java.lang.Class<T> type, QueryType query, PagingType paging, OperationResult parentResult)
           Search for objects.
 OperationResult testResource(java.lang.String resourceOid)
           Test the resource connection and basic resource connector functionality.
 

Field Detail

CLASS_NAME_WITH_DOT

static final java.lang.String CLASS_NAME_WITH_DOT

ADD_OBJECT

static final java.lang.String ADD_OBJECT

ADD_USER

static final java.lang.String ADD_USER

GET_OBJECT

static final java.lang.String GET_OBJECT

GET_PROPERTY_AVAILABLE_VALUES

static final java.lang.String GET_PROPERTY_AVAILABLE_VALUES

LIST_OBJECTS

static final java.lang.String LIST_OBJECTS

MODIFY_OBJECT

static final java.lang.String MODIFY_OBJECT

DELETE_OBJECT

static final java.lang.String DELETE_OBJECT

LIST_ACCOUNT_SHADOW_OWNER

static final java.lang.String LIST_ACCOUNT_SHADOW_OWNER

LIST_RESOURCE_OBJECT_SHADOWS

static final java.lang.String LIST_RESOURCE_OBJECT_SHADOWS

LIST_RESOURCE_OBJECTS

static final java.lang.String LIST_RESOURCE_OBJECTS

TEST_RESOURCE

static final java.lang.String TEST_RESOURCE

IMPORT_ACCOUNTS_FROM_RESOURCE

static final java.lang.String IMPORT_ACCOUNTS_FROM_RESOURCE

IMPORT_OBJECTS_FROM_FILE

static final java.lang.String IMPORT_OBJECTS_FROM_FILE

IMPORT_OBJECTS_FROM_STREAM

static final java.lang.String IMPORT_OBJECTS_FROM_STREAM

POST_INIT

static final java.lang.String POST_INIT

DISCOVER_CONNECTORS

static final java.lang.String DISCOVER_CONNECTORS
Method Detail

getObject

<T extends ObjectType> T getObject(java.lang.Class<T> type,
                                   java.lang.String oid,
                                   PropertyReferenceListType resolve,
                                   OperationResult result)
                               throws ObjectNotFoundException,
                                      SchemaException

Returns object for provided OID.

Must fail if object with the OID does not exists.

Type Parameters:
T -
Parameters:
oid - OID of the object to get
resolve - list of properties to resolve in the fetched object
type - (class) of an object to get
result - parent OperationResult (in/out)
Returns:
Retrieved object
Throws:
ObjectNotFoundException - requested object does not exist
SchemaException - the object is not schema compliant
java.lang.IllegalArgumentException - missing required parameter, wrong OID format, etc.
java.lang.ClassCastException - OID represents object of a type incompatible with requested type
SystemException - unknown error from underlying layers or other unexpected state

addObject

<T extends ObjectType> java.lang.String addObject(T object,
                                                  Task task,
                                                  OperationResult parentResult)
                           throws ObjectAlreadyExistsException,
                                  ObjectNotFoundException,
                                  SchemaException,
                                  ExpressionEvaluationException,
                                  CommunicationException

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.

Parameters:
object - object to create
parentResult - parent OperationResult (in/out)
Returns:
OID assigned to the created object
Throws:
ObjectAlreadyExistsException - object with specified identifiers already exists, cannot add
ObjectNotFoundException - object required to complete the operation was not found (e.g. appropriate connector or resource definition)
SchemaException - error dealing with resource schema, e.g. created object does not conform to schema
ExpressionEvaluationException - evaluation of expression associated with the object has failed
CommunicationException
java.lang.IllegalArgumentException - wrong OID format, etc.
SystemException - unknown error from underlying layers or other unexpected state

modifyObject

<T extends ObjectType> void modifyObject(java.lang.Class<T> type,
                                         ObjectModificationType change,
                                         Task task,
                                         OperationResult parentResult)
                  throws ObjectNotFoundException,
                         SchemaException,
                         ExpressionEvaluationException,
                         CommunicationException

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.

Parameters:
change - specification of object changes
parentResult - parent OperationResult (in/out)
Throws:
ObjectNotFoundException - specified object does not exist
SchemaException - resulting object would violate the schema
ExpressionEvaluationException - evaluation of expression associated with the object has failed
CommunicationException
java.lang.IllegalArgumentException - wrong OID format, described change is not applicable
SystemException - unknown error from underlying layers or other unexpected state

deleteObject

<T extends ObjectType> void deleteObject(java.lang.Class<T> type,
                                         java.lang.String oid,
                                         Task task,
                                         OperationResult parentResult)
                  throws ObjectNotFoundException,
                         ConsistencyViolationException,
                         CommunicationException,
                         SchemaException

Deletes object with specified OID.

Must fail if object with specified OID does not exists. Should be atomic.

Parameters:
oid - OID of object to delete
parentResult - parent OperationResult (in/out)
Throws:
ObjectNotFoundException - specified object does not exist
java.lang.IllegalArgumentException - wrong OID format, described change is not applicable
ConsistencyViolationException - sub-operation failed, cannot delete objects as its deletion would lead to inconsistent state
CommunicationException
SystemException - unknown error from underlying layers or other unexpected state
SchemaException

listAccountShadowOwner

UserType listAccountShadowOwner(java.lang.String accountOid,
                                OperationResult parentResult)
                                throws ObjectNotFoundException

Returns the User object representing owner of specified account (account shadow).

May return null if there is no owner specified for the account.

Implements the backward "owns" association between account shadow and user. Forward association is implemented by property "account" of user object.

Parameters:
accountOid - OID of the account to look for an owner
parentResult - parent OperationResult (in/out)
Returns:
owner of the account or null
Throws:
ObjectNotFoundException - specified account was not found
java.lang.IllegalArgumentException - wrong OID format, described change is not applicable
SystemException - unknown error from underlying layers or other unexpected state

listResourceObjectShadows

<T extends ResourceObjectShadowType> ResultList<T> listResourceObjectShadows(java.lang.String resourceOid,
                                                                             java.lang.Class<T> resourceObjectShadowType,
                                                                             OperationResult parentResult)
                                                                         throws ObjectNotFoundException

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.

Returned shadows are "attached", that means they have OID and at they are stored in the repository.

Implements the backward "has" association between resource and resource object shadows. Forward association is implemented by property "resource" of resource object shadow.

TODO: add objectClass to be really usable ?

Type Parameters:
T - specific shadow type (class) to return
Parameters:
resourceOid - OID of the resource that the shadows reside
resourceObjectShadowType - specific shadow type (class) to return
parentResult - parent OperationResult (in/out)
Returns:
list of found shadows
Throws:
ObjectNotFoundException

listResourceObjects

ResultList<? extends ResourceObjectShadowType> listResourceObjects(java.lang.String resourceOid,
                                                                   javax.xml.namespace.QName objectClass,
                                                                   PagingType paging,
                                                                   OperationResult result)
                                                                   throws SchemaException,
                                                                          ObjectNotFoundException,
                                                                          CommunicationException

Returns all resource objects of specified type that are currently available to the system.

Returns empty list if object type is correct but there are no objects of that type. The operation should fail if object type is wrong (e.g. specified type is not part of resource schema).

This method does NOT use any repository shadow objects for reference or any other business objects in the local repository. It goes directly to the resource. The returned objects (indirectly) comply with the resource schema, but it is returned re-formated in a form of detached shadow object. Although the form is the same as shadow object, this is NOT really a shadow object because it is not stored in the repository (it is detached). It does NOT have OID.

The objects are identified by whatever identification properties/attributes are defined by the resource schema.

The purpose of this operation is diagnostics. It works directly with the resource without the potential problems of underlying implementation. E.g. it may be used to test resource connectivity or correctness of resource setup. It may also be used to reach object types that are not directly supported as "shadows" by the implementation. Therefore this method is not required to implement any form of caching, queuing, reference resolution or any other "smart" algorithm.

Parameters:
resourceOid - OID of the resource to fetch objects from
objectClass - Object class of the objects to fetch
paging - paging specification to limit operation result (optional)
parentResult - parent OperationResult (in/out)
Returns:
resource objects in a form of "detached shadows"
Throws:
ObjectNotFoundException - specified resource object does not exist
SchemaException - error handling resource schema
CommunicationException - error communicating with the resource

listObjects

<T extends ObjectType> ResultList<T> listObjects(java.lang.Class<T> objectType,
                                                 PagingType paging,
                                                 OperationResult result)

Returns all objects of specified type that are available to the implementation.

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.

Should fail if object type is wrong.

Parameters:
objectType -
paging - paging specification to limit operation result (optional)
parentResult - parent OperationResult (in/out)
Returns:
all objects of specified type (subject to paging)
Throws:
java.lang.IllegalArgumentException - wrong object type

searchObjects

<T extends ObjectType> ResultList<T> searchObjects(java.lang.Class<T> type,
                                                   QueryType query,
                                                   PagingType paging,
                                                   OperationResult parentResult)
                                               throws SchemaException,
                                                      ObjectNotFoundException

Search for objects.

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.

Should fail if object type is wrong. Should fail if unknown property is specified in the query.

Parameters:
query - search query
paging - paging specification to limit operation result (optional)
parentResult - parent OperationResult (in/out)
Returns:
all objects of specified type that match search criteria (subject to paging)
Throws:
SchemaException - unknown property used in search query
ObjectNotFoundException - object required for a search was not found (e.g. resource definition)
java.lang.IllegalArgumentException - wrong query format

testResource

OperationResult testResource(java.lang.String resourceOid)
                             throws ObjectNotFoundException

Test the resource connection and basic resource connector functionality.

This operation will NOT throw exception in case the resource connection fails. It such case it will indicate the failure in the return message, but the operation itself succeeds. The operations fails only if the provided arguments are wrong, in case of system error, system misconfiguration, etc.

This returns OperationResult instead of taking it as in/out argument. This is different from the other methods. The testResource method is not using OperationResult to track its own execution but rather to track the execution of resource tests (that in fact happen in provisioning).

Parameters:
resourceOid - OID of resource to test
Returns:
results of executed tests
Throws:
ObjectNotFoundException - specified object does not exist
java.lang.IllegalArgumentException - wrong OID format

importAccountsFromResource

void importAccountsFromResource(java.lang.String resourceOid,
                                javax.xml.namespace.QName objectClass,
                                Task task,
                                OperationResult parentResult)
                                throws ObjectNotFoundException,
                                       SchemaException

Import accounts from resource.

Invocation of this method may be switched to background.

TODO: OperationResult

Throws:
SchemaException
ObjectNotFoundException

importObjectsFromFile

void importObjectsFromFile(java.io.File input,
                           ImportOptionsType options,
                           Task task,
                           OperationResult parentResult)
Import objects from file. Invocation of this method may be switched to background.

Parameters:
input -
task -

importObjectsFromStream

void importObjectsFromStream(java.io.InputStream input,
                             ImportOptionsType options,
                             Task task,
                             OperationResult parentResult)
Import objects from stream. Invocation of this method will happen in foreground, as the stream cannot be serialized. The results will be provided in the task.

Parameters:
input -
task -

discoverConnectors

java.util.Set<ConnectorType> discoverConnectors(ConnectorHostType hostType,
                                                OperationResult parentResult)
                                                throws CommunicationException
Discovers local or remote connectors. The operation will try to search for new connectors. It works either on local host (hostType is null) or on a remote host (hostType is not null). All discovered connectors are stored in the repository. It returns connectors that were discovered: those that were not in the repository before invocation of this operation.

Parameters:
hostType - definition of a connector host or null
parentResult - parentResult parent OperationResult (in/out)
Returns:
discovered connectors
Throws:
CommunicationException - error communicating with the connector host

getPropertyAvailableValues

PropertyAvailableValuesListType getPropertyAvailableValues(java.lang.String oid,
                                                           PropertyReferenceListType properties,
                                                           OperationResult result)

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.

NOT YET IMPLEMETED

Parameters:
oid -
properties -
result -
Returns:

postInit

void postInit(OperationResult parentResult)
Finish initialization of the model and lower system components (provisioning, repository, etc). The implementation may execute resource-intensive tasks in this method. All the dependencies should be already constructed, properly wired and initialized. Also logging and other infrastructure should be already set up.



Copyright © 2012 evolveum. All Rights Reserved.