public abstract class AbstractConnectorFacade extends Object implements ConnectorFacade
NO_TIMEOUT
Constructor and Description |
---|
AbstractConnectorFacade(APIConfigurationImpl configuration)
Builds up the maps of supported operations and calls.
|
AbstractConnectorFacade(String configuration,
AbstractConnectorInfo connectorInfo)
Builds up the maps of supported operations and calls.
|
Modifier and Type | Method and Description |
---|---|
Uid |
addAttributeValues(ObjectClass objclass,
Uid uid,
Set<Attribute> attrs,
OperationOptions options)
Update the object specified by the
ObjectClass and Uid ,
adding to the current values of each attribute the values provided. |
Uid |
authenticate(ObjectClass objectClass,
String username,
GuardedString password,
OperationOptions options)
Most basic authentication available.
|
Uid |
create(ObjectClass objectClass,
Set<Attribute> createAttributes,
OperationOptions options)
Create a target object based on the specified attributes.
|
protected APIOperation |
createLoggingProxy(Class<? extends APIOperation> api,
APIOperation target)
Creates a logging proxy.
|
protected APIOperation |
createTimeoutProxy(Class<? extends APIOperation> api,
APIOperation target)
Creates the timeout proxy for the given operation.
|
void |
delete(ObjectClass objectClass,
Uid uid,
OperationOptions options)
Delete the object that the specified Uid identifies (if any).
|
protected APIConfigurationImpl |
getAPIConfiguration() |
String |
getConnectorFacadeKey()
Gets the unique generated identifier of this ConnectorFacade.
|
SyncToken |
getLatestSyncToken(ObjectClass objectClass)
Returns the token corresponding to the most recent synchronization event
for any instance of the specified object class.
|
ConnectorObject |
getObject(ObjectClass objectClass,
Uid uid,
OperationOptions options)
Get a particular
ConnectorObject based on the Uid . |
APIOperation |
getOperation(Class<? extends APIOperation> api)
Return an instance of an API operation.
|
protected abstract APIOperation |
getOperationImplementation(Class<? extends APIOperation> api)
Gets the implementation of the given operation.
|
Set<Class<? extends APIOperation>> |
getSupportedOperations()
Get the set of operations that this
ConnectorFacade will support. |
protected APIOperation |
newAPIOperationProxy(Class<? extends APIOperation> api,
InvocationHandler handler)
Creates a new
APIOperation proxy given a handler. |
Uid |
removeAttributeValues(ObjectClass objclass,
Uid uid,
Set<Attribute> attrs,
OperationOptions options)
Update the object specified by the
ObjectClass and Uid ,
removing from the current values of each attribute the values provided. |
Uid |
resolveUsername(ObjectClass objectClass,
String username,
OperationOptions options)
Resolve the given
authentication username to
the corresponding Uid . |
Object |
runScriptOnConnector(ScriptContext request,
OperationOptions options)
Runs the script.
|
Object |
runScriptOnResource(ScriptContext request,
OperationOptions options)
Runs a script on a specific target resource.
|
Schema |
schema()
Retrieve the basic schema of this
Connector . |
SearchResult |
search(ObjectClass objectClass,
Filter filter,
ResultsHandler handler,
OperationOptions options)
Search the resource for all objects that match the object class and
filter.
|
SyncToken |
sync(ObjectClass objectClass,
SyncToken token,
SyncResultsHandler handler,
OperationOptions options)
Request synchronization events--i.e., native changes to target objects.
|
void |
test()
Tests the
Configuration with the connector. |
Uid |
update(ObjectClass objectClass,
Uid uid,
Set<Attribute> attrs,
OperationOptions options)
Update the object specified by the
ObjectClass and Uid ,
replacing the current values of each attribute with the values provided. |
Set<AttributeDelta> |
updateDelta(ObjectClass objectClass,
Uid uid,
Set<AttributeDelta> attrsDelta,
OperationOptions options) |
void |
validate()
Validates the
configuration . |
public AbstractConnectorFacade(APIConfigurationImpl configuration)
public AbstractConnectorFacade(String configuration, AbstractConnectorInfo connectorInfo)
public final APIOperation getOperation(Class<? extends APIOperation> api)
getOperation
in interface ConnectorFacade
null
if the operation is not support otherwise return an instance of the operation.ConnectorFacade.getOperation(java.lang.Class)
public final String getConnectorFacadeKey()
getConnectorFacadeKey
in interface ConnectorFacade
public final Set<Class<? extends APIOperation>> getSupportedOperations()
ConnectorFacade
will support.getSupportedOperations
in interface ConnectorFacade
public final Schema schema()
Connector
.schema
in interface SchemaApiOp
public final Uid create(ObjectClass objectClass, Set<Attribute> createAttributes, OperationOptions options)
ObjectClass
. The Connector
itself may require
additional attributes. The API will confirm that the set contains the
ObjectClass
attribute and that no two attributes in the set
have the same name
.create
in interface CreateApiOp
objectClass
- the type of object to create. Must not be null.createAttributes
- includes all the attributes necessary to create the target
object (including the ObjectClass
attribute).options
- additional options that impact the way this operation is run.
May be null.public final void delete(ObjectClass objectClass, Uid uid, OperationOptions options)
delete
in interface DeleteApiOp
objectClass
- type of object to delete.uid
- The unique id that specifies the object to delete.options
- additional options that impact the way this operation is run.
May be null.public final SearchResult search(ObjectClass objectClass, Filter filter, ResultsHandler handler, OperationOptions options)
search
in interface SearchApiOp
objectClass
- reduces the number of entries to only those that match the
ObjectClass
provided.filter
- Reduces the number of entries to only those that match the
Filter
provided, if any. May be null.handler
- class responsible for working with the objects returned from
the search.options
- additional options that impact the way this operation is run.
May be null.null
.public final Uid update(ObjectClass objectClass, Uid uid, Set<Attribute> attrs, OperationOptions options)
ObjectClass
and Uid
,
replacing the current values of each attribute with the values provided.
For each input attribute, replace all of the current values of that attribute in the target object with the values of that attribute.
If the target object does not currently contain an attribute that the input set contains, then add this attribute (along with the provided values) to the target object.
If the value of an attribute in the input set is null
, then do
one of the following, depending on which is most appropriate for the
target:
null
.update
in interface UpdateApiOp
objectClass
- the type of object to modify. Must not be null.uid
- the uid of the object to modify. Must not be null.attrs
- set of new Attribute
. the values in this set represent
the new, merged values to be applied to the object. This set
may also include operational
attributes
. Must not be null.options
- additional options that impact the way this operation is run.
May be null.Uid
of the updated object in case the update changes
the formation of the unique identifier.public final Set<AttributeDelta> updateDelta(ObjectClass objectClass, Uid uid, Set<AttributeDelta> attrsDelta, OperationOptions options)
updateDelta
in interface UpdateDeltaApiOp
public final Uid addAttributeValues(ObjectClass objclass, Uid uid, Set<Attribute> attrs, OperationOptions options)
ObjectClass
and Uid
,
adding to the current values of each attribute the values provided.
For each attribute that the input set contains, add to the current values of that attribute in the target object all of the values of that attribute in the input set.
NOTE that this does not specify how to handle duplicate values. The
general assumption for an attribute of a ConnectorObject
is that
the values for an attribute may contain duplicates. Therefore, in general
simply append the provided values to the current value for each
attribute.
IMPLEMENTATION NOTE: for connectors that merely implement
UpdateOp
and not UpdateAttributeValuesOp
this method will
be simulated by fetching, merging, and calling
UpdateOp.update(ObjectClass, Uid, Set, OperationOptions)
.
Therefore, connector implementations are encourage to implement
UpdateAttributeValuesOp
from a performance and atomicity
standpoint.
addAttributeValues
in interface UpdateApiOp
objclass
- the type of object to modify. Must not be null.uid
- the uid of the object to modify. Must not be null.attrs
- set of Attribute
deltas. The values for the attributes
in this set represent the values to add to attributes in the
object. merged. This set must not include
operational attributes
. Must not
be null.options
- additional options that impact the way this operation is run.
May be null.Uid
of the updated object in case the update changes
the formation of the unique identifier.public final Uid removeAttributeValues(ObjectClass objclass, Uid uid, Set<Attribute> attrs, OperationOptions options)
ObjectClass
and Uid
,
removing from the current values of each attribute the values provided.
For each attribute that the input set contains, remove from the current values of that attribute in the target object any value that matches one of the values of the attribute from the input set.
NOTE that this does not specify how to handle unmatched values. The
general assumption for an attribute of a ConnectorObject
is that
the values for an attribute are merely representational state.
Therefore, the implementer should simply ignore any provided value that
does not match a current value of that attribute in the target object.
Deleting an unmatched value should always succeed.
IMPLEMENTATION NOTE: for connectors that merely implement
UpdateOp
and not UpdateAttributeValuesOp
this method will
be simulated by fetching, merging, and calling
UpdateOp.update(ObjectClass, Uid, Set, OperationOptions)
.
Therefore, connector implementations are encourage to implement
UpdateAttributeValuesOp
from a performance and atomicity
standpoint.
removeAttributeValues
in interface UpdateApiOp
objclass
- the type of object to modify. Must not be null.uid
- the uid of the object to modify. Must not be null.attrs
- set of Attribute
deltas. The values for the attributes
in this set represent the values to remove from attributes in
the object. merged. This set must not include
operational attributes
. Must not
be null.options
- additional options that impact the way this operation is run.
May be null.Uid
of the updated object in case the update changes
the formation of the unique identifier.public final Uid authenticate(ObjectClass objectClass, String username, GuardedString password, OperationOptions options)
authenticate
in interface AuthenticationApiOp
objectClass
- The object class to use for authenticate. Will typically be an
account. Must not be null.username
- string that represents the account or user id.password
- string that represents the password for the account or user.options
- additional options that impact the way this operation is run.
May be null.public final Uid resolveUsername(ObjectClass objectClass, String username, OperationOptions options)
authentication
username to
the corresponding Uid
.
The Uid
is the one that
AuthenticationApiOp.authenticate(org.identityconnectors.framework.common.objects.ObjectClass, java.lang.String, org.identityconnectors.common.security.GuardedString, org.identityconnectors.framework.common.objects.OperationOptions)
would return in case of a
successful authentication.resolveUsername
in interface ResolveUsernameApiOp
objectClass
- The object class to use for authenticate. Will typically be an
account. Must not be null.username
- string that represents the account or user id.options
- additional options that impact the way this operation is run.
May be null.public final Object runScriptOnConnector(ScriptContext request, OperationOptions options)
runScriptOnConnector
in interface ScriptOnConnectorApiOp
request
- The script and arguments to run.options
- Additional options that control how the script is run. The
framework does not currently recognize any options but
specific connectors might. Consult the documentation for each
connector to identify supported options.for a list of supported return types.
public final Object runScriptOnResource(ScriptContext request, OperationOptions options)
runScriptOnResource
in interface ScriptOnResourceApiOp
request
- The script and arguments to run.options
- Additional options which control how the script is run. Please
refer to the connector documentation for supported options.ObjectSerializerFactory
for a list of supported return
types.public final ConnectorObject getObject(ObjectClass objectClass, Uid uid, OperationOptions options)
ConnectorObject
based on the Uid
.getObject
in interface GetApiOp
objectClass
- type of object to get.uid
- the unique id of the object that to get.options
- additional options that impact the way this operation is run.
May be null.ConnectorObject
based on the Uid
provided or
null
if no such object could be found.public final void test()
Configuration
with the connector.public final void validate()
configuration
.validate
in interface ValidateApiOp
public final SyncToken sync(ObjectClass objectClass, SyncToken token, SyncResultsHandler handler, OperationOptions options)
This method will call the specified handler once to pass back each matching synchronization event. Once this method returns, this method will no longer invoke the specified handler.
Each synchronization event contains a
token that can be used to resume reading events starting from that
point in the event stream. In typical usage, a client will save the
token from the final synchronization event that was received from one
invocation of this sync()
method and then pass that token into
that client's next call to this sync()
method. This allows a
client to "pick up where he left off" in receiving synchronization
events. However, a client can pass the token from any
synchronization event into a subsequent invocation of this sync()
method. This will return synchronization events (that represent native
changes that occurred) immediately subsequent to the event from which the
client obtained the token.
A client that wants to read synchronization events "starting now" can
call SyncApiOp.getLatestSyncToken(org.identityconnectors.framework.common.objects.ObjectClass)
and then pass that token into this
sync()
method.
sync
in interface SyncApiOp
objectClass
- The class of object for which to return synchronization
events. Must not be null.token
- The token representing the last token from the previous sync.
The SyncResultsHandler
will return any number of
SyncDelta objects, each of which contains a
token. Should be null
if this is the client's first
call to the sync()
method for this connector.handler
- The result handler. Must not be null.options
- Options that affect the way this operation is run. May be
null.null
.public final SyncToken getLatestSyncToken(ObjectClass objectClass)
An application that wants to receive synchronization events "starting now" --i.e., wants to receive only native changes that occur after this method is called-- should call this method and then pass the resulting token into the sync() method.
getLatestSyncToken
in interface SyncApiOp
objectClass
- the class of object for which to find the most recent
synchronization event (if any).null
.protected APIOperation newAPIOperationProxy(Class<? extends APIOperation> api, InvocationHandler handler)
APIOperation
proxy given a handler.protected abstract APIOperation getOperationImplementation(Class<? extends APIOperation> api)
api
- The operation to implement.protected final APIConfigurationImpl getAPIConfiguration()
protected final APIOperation createTimeoutProxy(Class<? extends APIOperation> api, APIOperation target)
api
- The operationtarget
- The underlying objectprotected final APIOperation createLoggingProxy(Class<? extends APIOperation> api, APIOperation target)
api
- The operationtarget
- The underlying objectCopyright © 2019. All rights reserved.