README.md revision b6eaeeb18d05d59ddbea3483332a41d96735d9b3
3a92e4ba470611ceec6693640b05eb248d62e32dGoffredo Baroncelli * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3a92e4ba470611ceec6693640b05eb248d62e32dGoffredo Baroncelli * Copyright (c) 2014-2015 ForgeRock AS. All rights reserved.
3a92e4ba470611ceec6693640b05eb248d62e32dGoffredo Baroncelli * The contents of this file are subject to the terms
3a92e4ba470611ceec6693640b05eb248d62e32dGoffredo Baroncelli * of the Common Development and Distribution License
3a92e4ba470611ceec6693640b05eb248d62e32dGoffredo Baroncelli * (the License). You may not use this file except in
3a92e4ba470611ceec6693640b05eb248d62e32dGoffredo Baroncelli * compliance with the License.
3a92e4ba470611ceec6693640b05eb248d62e32dGoffredo Baroncelli * You can obtain a copy of the License at
3a92e4ba470611ceec6693640b05eb248d62e32dGoffredo Baroncelli * http://forgerock.org/license/CDDLv1.0.html
3a92e4ba470611ceec6693640b05eb248d62e32dGoffredo Baroncelli * See the License for the specific language governing
3a92e4ba470611ceec6693640b05eb248d62e32dGoffredo Baroncelli * permission and limitations under the License.
3a92e4ba470611ceec6693640b05eb248d62e32dGoffredo Baroncelli * When distributing Covered Code, include this CDDL
3a92e4ba470611ceec6693640b05eb248d62e32dGoffredo Baroncelli * Header Notice in each file and include the License file
3a92e4ba470611ceec6693640b05eb248d62e32dGoffredo Baroncelli * at http://forgerock.org/license/CDDLv1.0.html
3a92e4ba470611ceec6693640b05eb248d62e32dGoffredo Baroncelli * If applicable, add the following below the CDDL Header,
3a92e4ba470611ceec6693640b05eb248d62e32dGoffredo Baroncelli * with the fields enclosed by brackets [] replaced by
3a92e4ba470611ceec6693640b05eb248d62e32dGoffredo Baroncelli * your own identifying information:
3a92e4ba470611ceec6693640b05eb248d62e32dGoffredo Baroncelli * "Portions Copyrighted [year] [name of copyright owner]"
3a92e4ba470611ceec6693640b05eb248d62e32dGoffredo BaroncelliSample 3 - Scripted SQL
3a92e4ba470611ceec6693640b05eb248d62e32dGoffredo Baroncelli=======================
custom-scripted-connector-bundler-3.2.0-SNAPSHOT.jar that is included in the tools
The sync.json script demonstrates the use of event hooks to perform an action. In
explicitly included in the sync.json file but could just as easily have referenced
Description: Generate classes and files necessary to build a custom connector. Using those generated files we will build
1. From sample3/create-connector directory, run the following command using the custom config
provided in the sample3/data directory.
$ java -jar ../../../tools/custom-scripted-connector-bundler-3.2.0-SNAPSHOT.jar -c ../data/scriptedsql.json
2. Copy the provided sample scripts into connector src directory; these will become part of the custom connector.
$ cp ../tools/* src/main/resources/script/hrdb/
3. Build the custom connector. You should be in the sample3/create-connector directory
4. Change directory up one directory to the sample's main directory, /path/to/openidm/samples/sample3.
5. Copy the connector you just created from the create-connector directory to the connectors directory of OpenIDM. If
$ cp create-connector/target/hrdb-connector-1.4.1.0.jar ../../connectors/
At this point we now have a connector that is ready to go in OpenIDM. This connector has all the necessary files you will
need to have it displayed in the UI. It has also both the scripts and provisioner config ready to go.
inflated: conf/provisioner.openicf-hrdb.json
7. Replace the "systemActions" value inside the sample3/conf/provisioner.openicf-hrdb.json
"actionFile" : "tools/ResetDatabaseScript.groovy"
8. For demonstration purposes we are going to also copy the generated html template file associated with this connector
Search for the file inside the connector jar we just created for a file containing "1.4.html".
Extract the file you found above into the /path/to/openidm/ui directory.
$ jar -xvf connectors/hrdb-connector-1.4.1.0.jar ui/org.forgerock.openicf.connectors.hrdb.HRDBConnector_1.4.html
$ mkdir -p ui/extension/templates/admin/connector; mv ui/org.forgerock.openicf.connectors.hrdb.HRDBConnector_1.4.html ui/extension/templates/admin/connector
$ curl -k --header "X-OpenIDM-Username: openidm-admin" --header "X-OpenIDM-Password: openidm-admin" --header "Content-Type: application/json" --request POST "https://localhost:8443/openidm/system/hrdb?_action=script&scriptId=ResetDatabase"
+----+--------+------------------------------------------+-----------+----------+---------------+---------------------------+--------------+---------------------+
+----+--------+------------------------------------------+-----------+----------+---------------+---------------------------+--------------+---------------------+
| 1 | bob | e38ad214943daad1d64c102faec29de4afe9da3d | Bob | Fleming | Bob Fleming | Bob.Fleming@example.com | HR | 2014-10-30 08:55:41 |
| 2 | rowley | 2aa60a8ff7fcd473d321e0146afd9e26df395147 | Rowley | Birkin | Rowley Birkin | Rowley.Birkin@example.com | SALES | 2014-10-30 08:55:41 |
| 3 | louis | 1119cfd37ee247357e034a08d844eea25f6fd20f | Louis | Balfour | Louis Balfour | Louis.Balfor@example.com | SALES | 2014-10-30 08:55:41 |
| 4 | john | a1d7584daaca4738d499ad7082886b01117275d8 | John | Smith | John Smith | John.Smith@example.com | SUPPORT | 2014-10-30 08:55:41 |
| 5 | jdoe | edba955d0ea15fdef4f61726ef97e5af507430c0 | John | Doe | John Doe | John.Doe@example.com | ENG | 2014-10-30 08:55:41 |
+----+--------+------------------------------------------+-----------+----------+---------------+---------------------------+--------------+---------------------+
$ curl -k -H "Content-type: application/json" -u "openidm-admin:openidm-admin" -X POST "https://localhost:8443/openidm/recon?_action=recon&mapping=systemHrdb_managedUser"
$ curl -k -u "openidm-admin:openidm-admin" --request GET "https://localhost:8443/openidm/managed/user/?_queryId=query-all-ids&_prettyPrint=true"
$ curl -k -u "openidm-admin:openidm-admin" --request GET "https://localhost:8443/openidm/managed/user?_queryId=for-userName&uid=rowley&_prettyPrint=true"
by OpenIDM/OpenICF in the Groovy scripts.
cars.users_id column. The Groovy scripts are responsible for reading this
$ curl -k -u "openidm-admin:openidm-admin" --request GET 'https://localhost:8443/openidm/system/hrdb/account?_queryFilter=uid+sw+""&_pageSize=2&_sortKeys=timestamp,id'
$ curl -k -u "openidm-admin:openidm-admin" --request GET 'https://localhost:8443/openidm/system/hrdb/account?_queryFilter=uid+sw+""&_pageSize=2&_sortKeys=timestamp,id&_pagedResultsCookie=2014-09-11%2010:07:57.0,2'
You can log in to the OpenIDM UI (https://localhost:8443/openidmui) with any of
Consult the values from the sample3/tools/ResetDatabaseScript.groovy script to