OimTool

oimtool is a command-line utility written in Java which helps OIM developer to deploy and debug OIM applications. It is based on OIM API and requires a running OIM server to work. It was developed as a convenient swiss-knife replacement for many trivial command-line utilities provided by Oracle.

Features

  1. Import/export/query OIM artifacts (a command-line analog of Deployment Manager)
  2. Import/export/query data stored in MDS (Oracle Metadata Store)
  3. Upload JAR files to OIM repository (see also OIMHOME_JARS table)

Compatibility

The tool is compatible with OIM 11.1.1.5.x.

Note for BP06 users: according to user reports, the BP06 package does not include the required jar file ucp.jar, so you shall copy the file from previous releases.

Start

Setting up the CLASSPATH

The oimtool uses a number of Java libraries. So in order to start
oimtool you shall locate this libraries and include them in Java
CLASSPATH.

The following OIM libraries:

  1. $MIDDLEWARE_HOME/oracle_common/inventory/Scripts/ext/jlib/handlers/wlclient.jar
  2. $MIDDLEWARE_HOME/oracle_common/inventory/Scripts/ext/jlib/ojdbc6.jar
  3. $MIDDLEWARE_HOME/oracle_common/modules/oracle.adf.share_11.1.1/adflogginghandler.jar
  4. $MIDDLEWARE_HOME/oracle_common/modules/oracle.adf.share.ca_11.1.1/adf-share-base.jar
  5. $MIDDLEWARE_HOME/oracle_common/modules/oracle.dms_11.1.1/dms.jar
  6. $MIDDLEWARE_HOME/oracle_common/modules/oracle.mds_11.1.1/mdsrt.jar
  7. $MIDDLEWARE_HOME/oracle_common/modules/oracle.odl_11.1.1/ojdl.jar
  8. $MIDDLEWARE_HOME/oracle_common/modules/oracle.xmlef_11.1.1/xmlef.jar
  9. $OIM_ORACLE_HOME/jlib/share.jar
  10. $OIM_ORACLE_HOME/oam/server/rreg/lib/xmlparserv2.jar
  11. $OIM_ORACLE_HOME/server/apps/oim.ear/APP-INF/lib/commons-logging.jar
  12. $OIM_ORACLE_HOME/server/client/oimclient.jar
  13. $OIM_ORACLE_HOME/server/ext/spring.jar
  14. $OIM_ORACLE_HOME/server/ext/ucp.jar
  15. $OIM_ORACLE_HOME/server/lib/xlDDM.jar
  16. $OIM_ORACLE_HOME/server/setup/lib/iam-platform-deploymentframework.jar

Open-source libraries

  1. guava
  2. log4j-1.2.15.jar

Running the program

The main class is tools.Main

java  -Dfile.encoding=UTF-8 -classpath=$CLASSPATH idm4j.oim.tool.OimTool ...

Usage info

If you run the tool with no argument, the usage info is printed:

Usage: oimtool [options and commands]

where commands are:

  Import/export
  --export file category mask ... categoryN maskN
                        export configration to a given XML file
  --exportall localFile -- export all configration to a LOCALFILE
  --import localFile    -- import configration from a LOCALFILE
  --print-export-categories -- list export/import categories

  Metadata import/export
  --md-list packageName fileNamePattern searchRecursive
                        query MDS and print paths to stdout
  --md-print docpath    -- print contents of document at DOCPATH to stdout
  --md-export root localDir -- export branch at ROOT to files at LOCALDIR
  --md-import localFile docpath
                        import a document from a LOCALFILE to DOCPATH
  --md-delete docpath   delete a document at DOCPATH

  Config import/export
  --custom-export file category mask ... categoryN maskN
                        export custom configration to a given XML file
  --custom-import localFile
                        import document from a LOCALFILE to DOCPATH

  Lookup management
  --lookup-list type code-wc
                        print lookup codes matching lookup TYPE and CODE-WC wildcard
  --lookup-create code
                        create a new lookup definition identified by CODE
  --lookup-delete code
                        delete the lookup identified by CODE
  --lookup-update code type required field group lookup-key
                        change attributes of the lookup identified by CODE to TYPE REQUIRED FIELD GROUP LOOKUP-KEY
  --lookup-print type-wc code-wc
                        print keys for all lookups whose types match TYPE-WC and codes match CODE-WC
  --lookup-entry-list-keys code
                        print keys for the lookup identified by CODE
  --lookup-entry-add code key value
                        add an entry identified by KEY with the value VALUE to the lookup identified by CODE
  --lookup-entry-delete code key
                        delete an entry with the KEY from the lookup identified by CODE
  --lookup-entry-update code current-key new-key new-value
                        update an entry identified by CURRENT-KEY in the lookup identified by CODE.
                        Change the entry key to NEW-KEY and entry value to NEW-VALUE.
  --lookup-entry-print code key-wc
                        print keys and values for the the lookup identified by CODE, tab-separated.
                        Select keys matching the KEY-WC wildcard

  Platform services
  --register-plugin zipfile
                        upload plugin from ZIPFILE
  --unregister-plugin pluginID version
                        unregister plugin with specified PLUGINID and VERSION
  --upload-jar type fileName
                        upload a JAR file FILENAME of type TYPE to OIM repo under the NAME.
                        TYPE must be on of ICFBundle, JavaTasks, ScheduleTask, or ThirdParty
                        FILENAME must be the absolute path to the JAR file accessible from the OIM server JVM
                        the file name (FILENAME without directory prefux) must be unique
  --delete-jar type name
                        delete a JAR named NAME of type TYPE from OIM repo.
                        TYPE must be on of ICFBundle, JavaTasks, ScheduleTask, or ThirdParty
                        NAME must be file name (without directory prefux, under which the JAR was uploaded)
  --purge-cache cacheCategory
                        purge server cache

  Miscellanea
  --generate-ejb featuresDir artifactsMetadataFile templatesdir outputdir
                        generate EJB services interfaces from velocity templates
                        featuresDir: location of ZIP dile with with EJB interface classes (relative to CVD)
                        artifactsMetadataFile: path to artifacts metadata XML file (in classpath)
                        templatesdir: path to velocity template files (in classpath)
                        outputdir: where to put output files

and options are:

  for import/export
  --withdependencies    add dependencies to the set of exported objects
  --categories          print list of available categories
  --host hostname       OIM server hostname, default 'localhost'
  --port number         OIM server port number, default 14000
  --user username       OIM server user name, default 'xelsysadm'
  --password password   OIM server password, default 'Abcd1234'

  for metadata import/export
  --oracle-hostname     Oracle repo hostname, default 'localhost'
  --oracle-service      Oracle service name to connect to MDS database, default 'orcl'
  --oracle-port         Oracle service name to connect to MDS database, default 'orcl'
  --md-user             user name to connect to MDS database, default 'dev_mds'
  --md-password         password to connect to MDS database, default 'oracle'

  for logging
  --loglevel            set logging level: OFF, SEVERE, WARNING, INFO, CONFIG, FINE,
                        FINER, FINEST or ALL. Default is INFO.

Lookup management examples

Print lookup codes

Print all OIM lookup codes (i.e. dictionary IDs) of all types, sorted alphabetically:

oimtool --lookup-print-codes % %

prints:

Access Policies.By Request
Access Policies.Created By
Access Policies.Creation Date
...
usr_policy_update
usr_pwd_min_age_date
usr_timezone

Print all OIM lookup codes of 'l' type:

oimtool --lookup-print-codes l %

Print lookup codes of all types containing the word "Policies":

oimtool --lookup-print-codes % %Policies%

prints:

Access Policies.By Request
Access Policies.Created By
Access Policies.Creation Date
...
Password Policies.Updated By
Password Policies.Warn After(Days)
Policies.PolicyDefinitions.FieldName

Print lookup definition

Print all "l"-type lookup definitions for all codes matching the "Lookup.%" wildcard.

oimtool --lookup-print-defs "l" "Lookup.%"

prints:

LKU_TYPE_STRING_KEY    Lookup.ACT_PROCESS_TRIGGERS
LKU_FIELD    ACT_CUST_TYPE
LKU_TYPE    l

LKU_TYPE_STRING_KEY    Lookup.Adapter Factory.Adapter Type
LKU_TYPE    l
...

LKU_TYPE_STRING_KEY    Lookup.WebClient.ViewITResources.Additional Details
LKU_GROUP    IT Resource
LKU_TYPE    l

Add lookup

Create a new "l"-type lookup definition type lookup definition identified by "Lookup.MyTest".

oimtool --lookup-create "Lookup.MyTest"

Delete lookup

Delete a lookup definition with the code "Lookup.MyTest".

oimtool --lookup-delete "Lookup.MyTest"

Add lookup entry

Add a new entry to the lookup identified by the code "Lookup.MyTest".

oimtool --lookup-entry-add "Lookup.MyTest" "Encoded value" "Decoded value"

Print lookup keys

Print keys for the lookup identified by "Lookup.ACT_PROCESS_TRIGGERS":

oimtool --lookup-entry-list-keys "Lookup.ACT_PROCESS_TRIGGERS"

prints:

ACT_CUST_TYPE
ACT_NAME
PARENT_KEY

Print lookup data

Print lookup keys and values for the "Lookup.ACT_PROCESS_TRIGGERS" lookup for keys matching the "ACT_*" wildcard, tab-separated:

oimtool --lookup-entry-print "Lookup.ACT_PROCESS_TRIGGERS" "ACT_*"

prints:

ACT_NAME    Change Organization Name
ACT_CUST_TYPE    Change Organization Type

Update lookup entry

Update an existing lookup entry identified by the lookup code "Lookup.MyTest" and entry key "Encoded value". Set the entry key to "New Encoded value" and entry value to "New Decoded value".

oimtool --lookup-entry-update "Lookup.MyTest" "Encoded value" "New Encoded value" "New Decoded value"

Delete lookup entry

Delete an existing lookup entry identified by the lookup code "Lookup.MyTest" and entry key "Encoded value".

oimtool --lookup-entry-delete "Lookup.MyTest" "Encoded value"

JAR files manipulation examples

Upload a JAR file

Upload a file /some/path/to/myjar.jar as JavaTasks type JAR. Note: the file local name (myjar.jar) is used to register the JAR in OIM repository and hence must be unique in the scope of OIM instance.

oimtool --upload-jar JavaTasks /some/path/to/myjar.jar

Delete a JAR file

Delete a JAR named myjar.jar of JavaTasks type, which was previously uploaded with —upload-jar.

oimtool --delete-jar JavaTasks myjar.jar

MDS examples

Print MDS document

Print the "/db/FLAT FILE_GTC.xml" document to terminal

oimtool --md-print "/db/FLAT FILE_GTC.xml"

List document paths in MDS

Recursively list all MDS documents with "/db" prefix.

oimtool --md-list /db % true

prints
/db/oim-config.xml
/db/RA_ADGROUP23.xml
/db/RA_ADUSERTRUSTED21.xml
/db/RA_ADUSER22.xml
/db/AD Group Recon.xml
/db/AD Organization Lookup Recon.xml
...

No-recursively list all MDS documents with "/db" prefix those names starts with "AD"

oimtool --md-list /db %AD false

prints
/db/AD Group
/db/AD Group Delete Recon.xml
/db/AD Group Lookup Recon.xml
/db/AD Group Recon.xml
/db/AD Group_backup
...

Create/update document in MDS

Create/update an MDS document "/db/FLAT FILE_GTC.xml" from a file at "FLAT FILE_GTC.xml"

oimtool --md-import "FLAT FILE_GTC.xml" "/db/FLAT FILE_GTC.xml"

See also

  1. Metadata store
  2. Register/unregister plugin
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License