Writing Your Java Classes

Write your custom Java classes needed to implement the custom DRM system in 3DOrchestrate. This code should interface your DRM system to 3DOrchestrate.

The Javadoc reference documentation for this API is provided in a set of HTML files available from the Program Directory starting in R2017x FP.1729 (FD04). See the following Program Directory page for 3DOrchestrate:

Products > Shared Content > 3DOrchestrate

  1. To get started, create a Java project in your development environment (such as Eclipse).
  2. Add the following JAR files in the class path:

    <server_install_dir>/<os>/docs/java/SMAExeCore.jar
    <server_install_dir>/<os>/docs/java/SMAExeFiperCore.jar

  3. Create a DRM job ID class in the appropriate package and implement the interface DRMJobID. See the Javadoc page for this interface for API details.

    Every DRM system provides a means of identifying the current set of jobs being managed. This interface is used to encapsulate all job identifiers so that 3DOrchestrate can run workitems as DRM-managed jobs. Your custom Java DRM system must provide a class that implements this interface to identify its own jobs.

    Implement the two methods described below in your DRM job ID class:

    /**
      * The 3DOrchestrate job database requires that each workitem DB record
      * identify the DRM job, if any, which is managing that workitem.
      * The workitem DB table records the DRM system's job ID in a
      * string column; therefore DRM job IDs must be strings, or at
      * least must be interconvertible with a string format. This
      * method converts a job ID to a string for the workitem record.
      * @return String
      */
    public String getDRMJobIDAsString();
    
    /**
      * 3DOrchestrate is required to let users query the statuses of, or
      * cancel, any selected jobs currently being managed by the
      * DRM systems that it is configured to use. Therefore each
      * job ID must identify which DRM system is managing the ID's
      * job so that 3DOrchestrate can direct the right job ID objects to
      * the right systems in order to perform these actions.
      * @return String
      */
    public String getDRMSystemType();

    Example code for the DRM job ID class is shown below.

    package com.dassault_systemes.smaexe.drm.custom.plugin;
    
    import com.engineous.sdk.pse.DRMJobID;
    
    /**
     * Since any DRM operates in a networked environment, classes which implement 
       this interface must be serializable.
     */
    public class DemoDrmJObID implements DRMJobID{
    	
    	String drmjobID="";
    	
    	/**
    	 * Base constructor for a DRM job ID object, which
    	 * can be used by any DRM system which creates job
    	 * IDs directly as strings [most, if not all, do].
    	 */
    	public DemoDrmJObID(String drmjobID) {
    		super();
    		this.drmjobID = drmjobID;
    	}
    
    	/**
    	 * 3DOrchestrate server is required to let users query the statuses of, or
    	 * cancel, any selected jobs currently being managed by the
    	 * DRM systems that it is configured to use.  Therefore each
    	 * job ID must identify which DRM system is managing the ID's
    	 * job so that the 3DOrchestrate server can direct the right job ID objects to
    	 * the right systems in order to perform these actions.  This
    	 * method identifies this as an drm job ID.
    	 * @returns String
    	 */
    	@Override
    	public String getDRMJobIDAsString() {
    		// TODO Auto-generated method stub
    		return drmjobID;
    	}
    
    	@Override
    	public String getDRMSystemType() {
    		// TODO Auto-generated method stub
    		return "demoDRM"; //return your drm name/type
    	}
    }

  4. Create a DRM enabler class and implement the interface DRMEnabler. See the Javadoc page for this interface for API details.

    This interface defines the protocol for allowing the 3DOrchestrate Distribution Server to use your DRM system to evaluate activities as part of the simulation process to be executed.

    Implement the following methods in your DRM enabler class:

    makeDRMJobIDFromString
    audit
    cancel
    submit
    cosubmit
    getGroupsMap
    getQueuesList
    release
    query

    See the API Javadocs and Example Code for DRMEnabler Methods for details about these methods.

  5. Create a metamodel XML file that specifies the DRM system name and its enabler class that you have written.

    The file should contain the exact XML contents shown below, except for the Java-drm-name and Fully_qualified_enabler_class_name that you must replace.

    <?xml version="1.0" encoding="UTF-8"?>
    <MetaModel name="com.dassault_systemes.smaexe.drm.Java-drm-name"
        version="6.216.0"
        supername="com.dassault_systemes.sma.system.extension.Extension"
        superversion="6.*.*">
        <Requires>
            <SystemRelease>6.215+</SystemRelease>
        </Requires>
        <Runtime type="com.engineous.sdk.pse.DRMEnabler">
            Fully_qualified_enabler_class_name
        </Runtime>
    </MetaModel>

    Replace Java-drm-name with the <Java-drm-name> that you defined in the SMAExeServer.properties file. See Setting Server Properties for Java DRM Customization.

    Replace Fully_qualified_enabler_class_name with the fully qualified class name of your custom DRM enabler class. For example, if your class name is MyDRMEnabler and it is in the package com.mycompany.drm.enabler, then the fully qualified name is:

    com.mycompany.drm.enabler.MyDRMEnabler

    Name your metamodel file <Java-drm-name>.xml.

    Note: Do not change the version number or superversion number.

  6. Put a copy of your <Java-drm-name>.xml metamodel file in the following directory of the 3DOrchestrate Distribution Server installation:

    <server_install_dir>/<os>/reffiles/SMAExeExtensionDescriptors/plugin/

  7. Create a text file named MANIFEST.MF with the following contents:

    Manifest-Version: 1.0
    Name: package_name/<Java-drm-name>.xml
    Meta-Model: true

    For example:

    Manifest-Version: 1.0
    Name: com/mycompany/demodrm/plugin/MyCustomDRM.xml
    Meta-Model: true 

    Place this file in your Java project (usually working in your development environment), in the following subdirectory:

    /src/META-INF/MANIFEST.MF

  8. Create a JAR archive file of your Java project and put a copy in the following directory of the 3DOrchestrate Distribution Server installation:

    <server_install_dir>/<os>/docs/java/

  9. Create a library XML file that specifies the name and JAR file of your DRM plug-in.

    The file should contain the exact XML contents shown below, except for Java-drm-name and DRM_plugin_JAR which you must replace.

    <?xml version="1.0" encoding="UTF-8"?>
    <library>
       <librec bf="@/docs/java/DRM_plugin_JAR.jar" descriptorfile="@/reffiles/SMAExeExtensionDescriptors/plugin/Java-drm-name.xml" server="true">
           <nv n="com.dassault_systemes.smaexe.drm.Java-drm-name" v="6.216.0"/>
           <ts s="" t="2"/>
           <desc>OpenDRM Plugin</desc>
       </librec>
    </library>

    Replace Java-drm-name with the <Java-drm-name> that you defined in the SMAExeServer.properties file.

    Replace DRM_plugin_JAR with the name of your JAR file.

    Name your library file SMAExeDrmCustomJava-drm-name_LibRecs.xml and put a copy in the following directory:

    <server_install_dir>/<os>/reffiles/SMAExeLibrary/