Groovy Connector Toolkit

OpenICF provides a generic Groovy Connector Toolkit that enables you to run a Groovy script for any OpenICF operation, such as search, update, create, and others, on any external resource.

The Groovy Connector Toolkit is not a complete connector in the traditional sense. Rather, it is a framework within which you must write your own Groovy scripts to address the requirements of your implementation. Specific scripts are provided within these samples, which demonstrate how the Groovy Connector Toolkit can be used. These scripts cannot be used as is in your deployment, but are a good starting point on which to base your customization.

Groovy Connector Toolkit

The Groovy Connector Toolkit is bundled with OpenIDM 4.5, in the JAR openidm/connectors/groovy-connector-1.4.2.1.jar.

Sample implementations are provided in "Samples That Use the Groovy Connector Toolkit to Create Scripted Connectors" in the Samples Guide.

OpenICF Interfaces Implemented by the Scripted Groovy Connector

The Scripted Groovy Connector implements the following OpenICF interfaces.

Authenticate

Provides simple authentication with two parameters, presumed to be a user name and password.

Create

Creates an object and its uid.

Delete

Deletes an object, referenced by its uid.

Resolve Username

Resolves an object by its username and returns the uid of the object.

Schema

Describes the object types, operations, and options that the connector supports.

Script on Connector

Enables an application to run a script in the context of the connector. Any script that runs on the connector has the following characteristics:

  • The script runs in the same execution environment as the connector and has access to all the classes to which the connector has access.

  • The script has access to a connector variable that is equivalent to an initialized instance of the connector. At a minimum, the script can access the connector configuration.

  • The script has access to any script-arguments passed in by the application.

Script on Resource

Runs a script on the target resource that is managed by this connector.

Search

Searches the target resource for all objects that match the specified object class and filter.

Sync

Polls the target resource for synchronization events, that is, native changes to objects on the target resource.

Test

Tests the connector configuration. Testing a configuration checks all elements of the environment that are referred to by the configuration are available. For example, the connector might make a physical connection to a host that is specified in the configuration to verify that it exists and that the credentials that are specified in the configuration are valid.

This operation might need to connect to a resource, and, as such, might take some time. Do not invoke this operation too often, such as before every provisioning operation. The test operation is not intended to check that the connector is alive (that is, that its physical connection to the resource has not timed out).

You can invoke the test operation before a connector configuration has been validated.

Update

Updates (modifies or replaces) objects on a target resource.

Scripted Groovy Connector Configuration

The Scripted Groovy Connector has the following configurable properties.

Operation Script Files Properties

Property Type Default Encrypted Required

authenticateScriptFileName

String

null

The name of the file used to perform the AUTHENTICATE operation.

deleteScriptFileName

String

null

The name of the file used to perform the DELETE operation.

schemaScriptFileName

String

null

The name of the file used to perform the SCHEMA operation.

customizerScriptFileName

String

null

No

The script used to customize some function of the connector. Read the documentation for more details.

resolveUsernameScriptFileName

String

null

The name of the file used to perform the RESOLVE_USERNAME operation.

testScriptFileName

String

null

The name of the file used to perform the TEST operation.

updateScriptFileName

String

null

The name of the file used to perform the UPDATE operation.

searchScriptFileName

String

null

The name of the file used to perform the SEARCH operation.

scriptOnResourceScriptFileName

String

null

The name of the file used to perform the RUNSCRIPTONRESOURCE operation.

createScriptFileName

String

null

The name of the file used to perform the CREATE operation.

syncScriptFileName

String

null

The name of the file used to perform the SYNC operation

Groovy Engine configuration Properties

Property Type Default Encrypted Required

warningLevel

int

1

No

Warning Level of the compiler

minimumRecompilationInterval

int

100

No

Sets the minimum of time after a script can be recompiled.

scriptRoots

String[]

null

Yes

The root folder to load the scripts from. If the value is null or empty the classpath value is used.

debug

boolean

false

No

If true, debugging code should be activated

targetDirectory

File

null

No

Directory into which to write classes.

disabledGlobalASTTransformations

String[]

null

No

Sets a list of global AST transformations which should not be loaded even if they are defined in META-INF/org.codehaus.groovy.transform.ASTTransformation files. By default, none is disabled.

classpath

String[]

[]

No

Classpath for use during compilation.

scriptExtensions

String[]

['groovy']

No

Script extensions

sourceEncoding

String

UTF-8

No

Encoding for source files

scriptBaseClass

String

null

No

Base class name for scripts (must derive from Script)

verbose

boolean

false

No

If true, the compiler should produce action information

recompileGroovySource

boolean

false

No

If set to true recompilation is enabled

tolerance

int

10

No

The error tolerance, which is the number of non-fatal errors (per unit) that should be tolerated before compilation is aborted

Configuration Properties

Property Type Default Encrypted Required

customConfiguration

String

null

No

Custom Configuration script for Groovy ConfigSlurper

customSensitiveConfiguration

GuardedString

null

Yes

No

Custom Sensitive Configuration script for Groovy ConfigSlurper