com.evolveum.midpoint.provisioning.ucf.impl
Class ConnectorInstanceIcfImpl

java.lang.Object
  extended by com.evolveum.midpoint.provisioning.ucf.impl.ConnectorInstanceIcfImpl
All Implemented Interfaces:
ConnectorInstance

public class ConnectorInstanceIcfImpl
extends Object
implements ConnectorInstance

Implementation of ConnectorInstance for ICF connectors.

This class implements the ConnectorInstance interface. The methods are converting the data from the "midPoint semantics" as seen by the ConnectorInstance interface to the "ICF semantics" as seen by the ICF framework.

Author:
Radovan Semancik

Constructor Summary
ConnectorInstanceIcfImpl(org.identityconnectors.framework.api.ConnectorInfo connectorInfo, ConnectorType connectorType, String schemaNamespace, PrismSchema connectorSchema, Protector protector, PrismContext prismContext)
           
 
Method Summary
 Collection<ResourceAttribute<?>> addObject(PrismObject<? extends ResourceObjectShadowType> object, Collection<Operation> additionalOperations, OperationResult parentResult)
          TODO: This should return indication how the operation went, e.g.
 void configure(PrismContainerValue configuration, OperationResult parentResult)
          The connector instance will be configured to the state that it can immediately access the resource.
 void deleteObject(ObjectClassComplexTypeDefinition objectClass, Collection<Operation> additionalOperations, Collection<? extends ResourceAttribute> identifiers, OperationResult parentResult)
           
 PrismProperty<?> deserializeToken(Object serializedToken)
          Creates a live Java object from a token previously serialized to string.
 List<Change> fetchChanges(ObjectClassComplexTypeDefinition objectClass, PrismProperty<?> lastToken, OperationResult parentResult)
          Token may be null.
 PrismProperty<?> fetchCurrentToken(ObjectClassComplexTypeDefinition objectClass, OperationResult parentResult)
          Returns the latest token.
<T extends ResourceObjectShadowType>
PrismObject<T>
fetchObject(Class<T> type, ObjectClassComplexTypeDefinition objectClassDefinition, Collection<? extends ResourceAttribute> identifiers, boolean returnDefaultAttributes, Collection<? extends ResourceAttributeDefinition> attributesToReturn, OperationResult parentResult)
          Retrieves a specific object from the resource.
 PrismSchema generateConnectorSchema()
           
 Set<Object> getCapabilities(OperationResult parentResult)
          Retrieves native connector capabilities.
 ResourceSchema getResourceSchema(OperationResult parentResult)
          Retrieves the schema from the resource.
 String getSchemaNamespace()
           
 void initialize(OperationResult parentResult)
          Retrieves schema from the resource.
 Set<PropertyModificationOperation> modifyObject(ObjectClassComplexTypeDefinition objectClass, Collection<? extends ResourceAttribute> identifiers, Collection<Operation> changes, OperationResult parentResult)
          TODO: This should return indication how the operation went, e.g.
<T extends ResourceObjectShadowType>
void
search(ObjectClassComplexTypeDefinition objectClassDefinition, ObjectQuery query, ResultHandler<T> handler, OperationResult parentResult)
          Execute iterative search operation.
 void test(OperationResult parentResult)
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ConnectorInstanceIcfImpl

public ConnectorInstanceIcfImpl(org.identityconnectors.framework.api.ConnectorInfo connectorInfo,
                                ConnectorType connectorType,
                                String schemaNamespace,
                                PrismSchema connectorSchema,
                                Protector protector,
                                PrismContext prismContext)
Method Detail

getSchemaNamespace

public String getSchemaNamespace()

configure

public void configure(PrismContainerValue configuration,
                      OperationResult parentResult)
               throws CommunicationException,
                      GenericFrameworkException,
                      SchemaException,
                      ConfigurationException
Description copied from interface: ConnectorInstance
The connector instance will be configured to the state that it can immediately access the resource. The resource configuration is provided as a parameter to this method.

Specified by:
configure in interface ConnectorInstance
Throws:
ConfigurationException
CommunicationException
GenericFrameworkException
SchemaException

generateConnectorSchema

public PrismSchema generateConnectorSchema()
Specified by:
generateConnectorSchema in interface ConnectorInstance
Parameters:
cinfo -
connectorType -

initialize

public void initialize(OperationResult parentResult)
                throws CommunicationException,
                       GenericFrameworkException,
                       ConfigurationException
Retrieves schema from the resource.

Transforms native ICF schema to the midPoint representation.

Specified by:
initialize in interface ConnectorInstance
Throws:
CommunicationException
GenericFrameworkException
ConfigurationException
See Also:
ConnectorInstance.initialize(com.evolveum.midpoint.schema.result.OperationResult)

getResourceSchema

public ResourceSchema getResourceSchema(OperationResult parentResult)
                                 throws CommunicationException,
                                        GenericFrameworkException,
                                        ConfigurationException
Description copied from interface: ConnectorInstance
Retrieves the schema from the resource. The schema may be considered to be an XSD schema, but it is returned in a "parsed" format and it is in fact a bit stricter and richer midPoint schema. It may return null. Such case means that the schema cannot be determined.

Specified by:
getResourceSchema in interface ConnectorInstance
Returns:
Up-to-date resource schema.
Throws:
CommunicationException - error in communication to the resource - nothing was fetched.
ConfigurationException
GenericFrameworkException
See Also:
PrismSchema

getCapabilities

public Set<Object> getCapabilities(OperationResult parentResult)
                            throws CommunicationException,
                                   GenericFrameworkException,
                                   ConfigurationException
Description copied from interface: ConnectorInstance
Retrieves native connector capabilities. The capabilities specify what the connector can do without any kind of simulation or other workarounds. The set of capabilities may depend on the connector configuration (e.g. if a "disable" or password attribute was specified in the configuration or not). It may return null. Such case means that the capabilities cannot be determined.

Specified by:
getCapabilities in interface ConnectorInstance
Returns:
Throws:
CommunicationException
GenericFrameworkException
ConfigurationException

fetchObject

public <T extends ResourceObjectShadowType> PrismObject<T> fetchObject(Class<T> type,
                                                                       ObjectClassComplexTypeDefinition objectClassDefinition,
                                                                       Collection<? extends ResourceAttribute> identifiers,
                                                                       boolean returnDefaultAttributes,
                                                                       Collection<? extends ResourceAttributeDefinition> attributesToReturn,
                                                                       OperationResult parentResult)
                                                            throws ObjectNotFoundException,
                                                                   CommunicationException,
                                                                   GenericFrameworkException,
                                                                   SchemaException,
                                                                   SecurityViolationException
Description copied from interface: ConnectorInstance
Retrieves a specific object from the resource. This method is fetching an object from the resource that is identified by its primary identifier. It is a "targeted" method in this aspect and it will fail if the object is not found. The objectClass provided as a parameter to this method must correspond to one of the object classes in the schema. The object class must match the object. If it does not, the behavior of this operation is undefined. The returned ResourceObject is "disconnected" from schema. It means that any call to the getDefinition() method of the returned object will return null. TODO: object not found error

Specified by:
fetchObject in interface ConnectorInstance
identifiers - primary identifiers of the object.
Returns:
object fetched from the resource (no schema)
Throws:
CommunicationException - error in communication to the resource - nothing was fetched.
SchemaException - error converting object from native (connector) format
ObjectNotFoundException
GenericFrameworkException
SecurityViolationException

addObject

public Collection<ResourceAttribute<?>> addObject(PrismObject<? extends ResourceObjectShadowType> object,
                                                  Collection<Operation> additionalOperations,
                                                  OperationResult parentResult)
                                           throws CommunicationException,
                                                  GenericFrameworkException,
                                                  SchemaException,
                                                  ObjectAlreadyExistsException
Description copied from interface: ConnectorInstance
TODO: This should return indication how the operation went, e.g. what changes were applied, what were not and what were not determined. The exception should be thrown only if the connector is sure that nothing was done on the resource. E.g. in case of connect timeout or connection refused. Timeout during operation should not cause the exception as something might have been done already. The connector may return some (or all) of the attributes of created object. The connector should do this only such operation is efficient, e.g. in case that the created object is normal return value from the create operation. The connector must not execute additional operation to fetch the state of created resource. In case that the new state is not such a normal result, the connector must return null. Returning empty set means that the connector supports returning of new state, but nothing was returned (e.g. due to a limiting configuration). Returning null means that connector does not support returning of new object state and the caller should explicitly invoke fetchObject() in case that the information is needed.

Specified by:
addObject in interface ConnectorInstance
Returns:
created object attributes. May be null.
Throws:
CommunicationException
SchemaException - resource schema violation
ObjectAlreadyExistsException - object already exists on the resource
GenericFrameworkException

modifyObject

public Set<PropertyModificationOperation> modifyObject(ObjectClassComplexTypeDefinition objectClass,
                                                       Collection<? extends ResourceAttribute> identifiers,
                                                       Collection<Operation> changes,
                                                       OperationResult parentResult)
                                                throws ObjectNotFoundException,
                                                       CommunicationException,
                                                       GenericFrameworkException,
                                                       SchemaException,
                                                       SecurityViolationException
Description copied from interface: ConnectorInstance
TODO: This should return indication how the operation went, e.g. what changes were applied, what were not and what results are we not sure about. Returns a set of attributes that were changed as a result of the operation. This may include attributes that were changed as a side effect of the operations, e.g. attributes that were not originally specified in the "changes" parameter. The exception should be thrown only if the connector is sure that nothing was done on the resource. E.g. in case of connect timeout or connection refused. Timeout during operation should not cause the exception as something might have been done already.

Specified by:
modifyObject in interface ConnectorInstance
Throws:
CommunicationException
SchemaException
ObjectNotFoundException
GenericFrameworkException
SecurityViolationException

deleteObject

public void deleteObject(ObjectClassComplexTypeDefinition objectClass,
                         Collection<Operation> additionalOperations,
                         Collection<? extends ResourceAttribute> identifiers,
                         OperationResult parentResult)
                  throws ObjectNotFoundException,
                         CommunicationException,
                         GenericFrameworkException
Specified by:
deleteObject in interface ConnectorInstance
Throws:
ObjectNotFoundException
CommunicationException
GenericFrameworkException

deserializeToken

public PrismProperty<?> deserializeToken(Object serializedToken)
Description copied from interface: ConnectorInstance
Creates a live Java object from a token previously serialized to string. Serialized token is not portable to other connectors or other resources. However, newer versions of the connector should understand tokens generated by previous connector version.

Specified by:
deserializeToken in interface ConnectorInstance
Returns:

fetchCurrentToken

public PrismProperty<?> fetchCurrentToken(ObjectClassComplexTypeDefinition objectClass,
                                          OperationResult parentResult)
                                   throws CommunicationException,
                                          GenericFrameworkException
Description copied from interface: ConnectorInstance
Returns the latest token. In other words, returns a token that corresponds to a current state of the resource. If fetchChanges is immediately called with this token, nothing should be returned (Figuratively speaking, neglecting concurrent resource modifications).

Specified by:
fetchCurrentToken in interface ConnectorInstance
Returns:
Throws:
CommunicationException
GenericFrameworkException

fetchChanges

public List<Change> fetchChanges(ObjectClassComplexTypeDefinition objectClass,
                                 PrismProperty<?> lastToken,
                                 OperationResult parentResult)
                          throws CommunicationException,
                                 GenericFrameworkException,
                                 SchemaException,
                                 ConfigurationException
Description copied from interface: ConnectorInstance
Token may be null. That means "from the beginning of history".

Specified by:
fetchChanges in interface ConnectorInstance
Returns:
Throws:
CommunicationException
GenericFrameworkException
SchemaException
ConfigurationException

test

public void test(OperationResult parentResult)
Specified by:
test in interface ConnectorInstance

search

public <T extends ResourceObjectShadowType> void search(ObjectClassComplexTypeDefinition objectClassDefinition,
                                                        ObjectQuery query,
                                                        ResultHandler<T> handler,
                                                        OperationResult parentResult)
            throws CommunicationException,
                   GenericFrameworkException,
                   SchemaException
Description copied from interface: ConnectorInstance
Execute iterative search operation. This method will execute search operation on the resource and will pass any objects that are found. A "handler" callback will be called for each of the objects found. The call to this method will return only after all the callbacks were called, therefore it is not asynchronous in a strict sense. TODO: filter

Specified by:
search in interface ConnectorInstance
Throws:
CommunicationException
SchemaException - error converting object from the native (connector) format
GenericFrameworkException

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2013 evolveum. All Rights Reserved.