Search code examples
groovyopenidm

OpenIDM - Scripted Groovy connector provider


I am trying to generate the provider configuration for a scripted groovy connector (not a REST/CREST connector) using the Groovy ScriptedConnector connector.

When I send the following configuration to the CreateFullConfig REST service (/openidm/system?_action=createFullConfig), I issue an 500 internal server error.

{ "name" : "scriptedGroovy", "connectorRef": { "bundleName": "org.forgerock.openicf.connectors.groovy-connector", "bundleVersion": "1.4.1.0", "connectorName": "org.forgerock.openicf.connectors.groovy.ScriptedConnector" }, "configurationProperties": { "authenticateScriptFileName": "AuthenticateScript.groovy", "warningLevel": 1, "minimumRecompilationInterval": 100, "deleteScriptFileName": "DeleteScript.groovy", "schemaScriptFileName": "SchemaScript.groovy", "scriptRoots": null, "customizerScriptFileName": null, "resolveUsernameScriptFileName": null, "customConfiguration": null, "debug": false, "targetDirectory": null, "disabledGlobalASTTransformations": null, "classpath": ["path/connector/tools"], "scriptExtensions": [ "groovy" ], "testScriptFileName": "TestScript.groovy", "customSensitiveConfiguration": null, "updateScriptFileName": "UpdateScript.groovy", "sourceEncoding": "UTF-8", "searchScriptFileName": "SearchScript.groovy", "scriptOnResourceScriptFileName": null, "scriptBaseClass": null, "verbose": false, "createScriptFileName": "CreateScript.groovy", "recompileGroovySource": false, "tolerance": 10, "syncScriptFileName": "SyncScript.groovy" }, "operationTimeout": { "CREATE": -1, "UPDATE": -1, "DELETE": -1, "TEST": -1, "SCRIPT_ON_CONNECTOR": -1, "SCRIPT_ON_RESOURCE": -1, "GET": -1, "RESOLVEUSERNAME": -1, "AUTHENTICATE": -1, "SEARCH": -1, "VALIDATE": -1, "SYNC": -1, "SCHEMA": -1 }, "resultsHandlerConfig": { "enableNormalizingResultsHandler": true, "enableFilteredResultsHandler": true, "enableCaseInsensitiveFilter": false, "enableAttributesToGetSearchResultsHandler": true }, "poolConfigOption": { "maxObjects": 10, "maxIdle": 10, "maxWait": 150000, "minEvictableIdleTimeMillis": 120000, "minIdle": 1 }, "configurationProperties": { "xsdIcfFilePath" : "samples/sample1/data/resource-schema-1.xsd", "xsdFilePath" : "samples/sample1/data/resource-schema-extension.xsd", "xmlFilePath" : "samples/sample1/data/xmlConnectorData.xml", "createFileIfNotExists": false } }

It result on the following stacktrace :

WARNING: Resource exception: 500 Internal Server Error: "Internal Server Error" org.forgerock.json.resource.InternalServerErrorException: Internal Server Error at org.forgerock.openidm.provisioner.impl.SystemObjectSetService.actionInstance(SystemObjectSetService.java:340) at org.forgerock.json.resource.Resources$SingletonHandler.handleAction(Resources.java:513) at org.forgerock.json.resource.Router.handleAction(Router.java:208) at org.forgerock.json.resource.FilterChain$Cursor.handleAction(FilterChain.java:57) at org.forgerock.json.resource.Filters$ConditionalFilter.filterAction(Filters.java:52)

Caused by: java.lang.UnsupportedOperationException at sun.reflect.GeneratedConstructorAccessor131.newInstance(Unknown Source) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:526)

I think that the configuration is not fully proper but I don't know where...


Solution

  • I just generated the proper configuration using this file :

        {
        "enabled" : true,
        "syncFailureHandler" : {
            "postRetryAction" : "logged-ignore",
            "maxRetries" : 5
        },
        "configurationProperties" : {
            "minimumRecompilationInterval" : 100,
            "scriptRoots" : [
                "tbd/tbd/tools"
            ],
            "customizerScriptFileName" : "CustomizerScript.groovy",
            "resolveUsernameScriptFileName" : "ResolveUsernameScript.groovy",
            "debug" : false,
            "disabledGlobalASTTransformations" : [
                null
            ],
            "scriptExtensions" : [
                "groovy"
            ],
            "updateScriptFileName" : "UpdateScript.groovy",
            "sourceEncoding" : "UTF-8",
            "searchScriptFileName" : "SearchScript.groovy",
            "scriptOnResourceScriptFileName" : "ScriptOnResourceScript.groovy",
            "scriptBaseClass" : null,
            "verbose" : false,
            "createScriptFileName" : "CreateScript.groovy",
            "tolerance" : 10,
            "readSchema" : false,
            "authenticateScriptFileName" : "AuthenticateScript.groovy",
            "warningLevel" : 1,
            "deleteScriptFileName" : "DeleteScript.groovy",
            "schemaScriptFileName" : "SchemaScript.groovy",
            "customConfiguration" : null,
            "targetDirectory" : null,
            "classpath" : "tbd/tbd/tools",
            "customSensitiveConfiguration" : null,
            "testScriptFileName" : "TestScript.groovy",
            "recompileGroovySource" : false,
            "syncScriptFileName" : "SyncScript.groovy"
        },
        "_id" : "provisioner.openicf/MYCONNECTOR",
        "objectTypes" : {
            "__ACCOUNT__" : {
                "id" : "__ACCOUNT__",
                "properties" : {
                    "lastModified" : {
                        "nativeName" : "lastModified",
                        "flags" : [
                            "NOT_CREATABLE",
                            "NOT_UPDATEABLE"
                        ],
                        "type" : "string",
                        "nativeType" : "string"
                    },
                    "created" : {
                        "nativeName" : "created",
                        "flags" : [
                            "NOT_CREATABLE",
                            "NOT_UPDATEABLE"
                        ],
                        "type" : "string",
                        "nativeType" : "string"
                    },
                    "telephoneNumber" : {
                        "type" : "string",
                        "nativeName" : "telephoneNumber",
                        "nativeType" : "string"
                    },
                    "familyName" : {
                        "type" : "string",
                        "required" : true,
                        "nativeName" : "familyName",
                        "nativeType" : "string"
                    },
                    "__NAME__" : {
                        "nativeName" : "__NAME__",
                        "flags" : [
                            "NOT_UPDATEABLE"
                        ],
                        "type" : "string",
                        "required" : true,
                        "nativeType" : "string"
                    },
                    "userName" : {
                        "nativeName" : "userName",
                        "flags" : [
                            "NOT_CREATABLE",
                            "NOT_UPDATEABLE"
                        ],
                        "type" : "string",
                        "nativeType" : "string"
                    },
                    "emailAddress" : {
                        "type" : "string",
                        "nativeName" : "emailAddress",
                        "nativeType" : "string"
                    },
                    "givenName" : {
                        "type" : "string",
                        "nativeName" : "givenName",
                        "nativeType" : "string"
                    },
                    "displayName" : {
                        "type" : "string",
                        "required" : true,
                        "nativeName" : "displayName",
                        "nativeType" : "string"
                    },
                    "password" : {
                        "nativeName" : "password",
                        "flags" : [
                            "NOT_UPDATEABLE",
                            "NOT_READABLE",
                            "NOT_RETURNED_BY_DEFAULT"
                        ],
                        "type" : "string",
                        "nativeType" : "string"
                    },
                    "groups" : {
                        "type" : "array",
                        "nativeName" : "groups",
                        "items" : {
                            "type" : "string",
                            "nativeType" : "string"
                        },
                        "nativeType" : "string"
                    }
                },
                "type" : "object",
                "$schema" : "http://json-schema.org/draft-03/schema",
                "nativeType" : "__ACCOUNT__"
            }
        },
        "poolConfigOption" : {
            "maxWait" : 150000,
            "minIdle" : 1,
            "maxIdle" : 10,
            "minEvictableIdleTimeMillis" : 120000,
            "maxObjects" : 10
        },
        "name" : "TBD",
        "connectorRef" : {
            "connectorHostRef" : "#LOCAL",
            "connectorName" : "org.forgerock.openicf.connectors.groovy.ScriptedConnector",
            "bundleName" : "org.forgerock.openicf.connectors.groovy-connector",
            "displayName" : "Groovy Connector",
            "bundleVersion" : "1.4.1.0"
        },
        "operationTimeout" : {
            "TEST" : -1,
            "UPDATE" : -1,
            "CREATE" : -1,
            "SCRIPT_ON_RESOURCE" : -1,
            "GET" : -1,
            "AUTHENTICATE" : -1,
            "SEARCH" : -1,
            "SCHEMA" : -1,
            "DELETE" : -1,
            "SYNC" : -1,
            "RESOLVEUSERNAME" : -1,
            "VALIDATE" : -1,
            "SCRIPT_ON_CONNECTOR" : -1
        },
        "resultsHandlerConfig" : {
            "enableAttributesToGetSearchResultsHandler" : true,
            "enableCaseInsensitiveFilter" : false,
            "enableFilteredResultsHandler" : true,
            "enableNormalizingResultsHandler" : true
        }
    }