Generate artifacts from velocity templates

This page explains how to generate somer OIM artifacts, like EJB classes, from velocity templates

Common requirements

  1. You have to include to Java classpath the following files from your OIM installation:
  1. $OIM_ORACLE_HOME/server/setup/lib/iam-platform-deploymentframework.jar
  2. $OIM_ORACLE_HOME/server/apps/oim.ear/APP-INF/lib/iam-platform-utils.jar
  3. $MIDDLEWARE_HOME/oracle_common/modules/oracle.mds_11.1.1/mdsrt.jar
  4. $OIM_ORACLE_HOME/server/apps/oim.ear/APP-INF/lib/velocity-dep-1.4.jar
  5. $OIM_ORACLE_HOME/inventory/Scripts/ext/jlib/handlers/wlclient.jar
  6. $OIM_ORACLE_HOME/oui/jlib/xmlparserv2.jar

EJB generation

Interface classes

Create all interface classes. Each class must

  1. be annotaded with oracle.iam.platform.annotations.Service.
  2. belong to packages with names starting from either "oracle", on "com", or "Thor"

Package them to a ZIP file (file must have the .zip extension).

Add this zip to Java classpath.

Add all libraries interface classes interface classes depend on to classpath too.

Create artifacts.xml file

<?xml version="1.0" encoding="UTF-8"?>
<Artifacts>
  <TransformArtifacts>
    <TransformArtifact name="EJBClass" suffix="EJB" baseDir="app" template="EJBClass.vm"/>
    <TransformArtifact name="EJBLocalInterface" suffix="Local" baseDir="app" template="ServiceEJBLocal.vm"/>
    <TransformArtifact name="EJBRemoteInterface" suffix="Remote" baseDir="app" template="ServiceEJBRemote.vm"/>
    <TransformArtifact name="EJBExtendedInterface" suffix="Extended" baseDir="app" template="ServiceEJBInterfaceExtended.vm"/>
    <TransformArtifact name="EJBDelegate" suffix="Delegate" baseDir="app" template="Service-EJBDelegate.vm"/>
  </TransformArtifacts>
</Artifacts>

Get templates

Find where all the necessary templates are (for example, in $OIM_ORACLE_HOME/server/setup/templates/wls directory). Use them as-is or copy and modify them if necessary.

Run the tool

System.setProperty("featuresDir", <artifacts.xml location>);
System.setProperty("appServer", <template files location>);
new ArtifactsGenerator(<output directory>).generate();

After you run the code, you will find all generated Java code in the <output directory>/app/ directory, where app is the value of the baseDir attribute in the artifacts.xml file.

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License