Ajith Prabhakar’s Weblog

A beginner’s guide to Documentum

Java Code Generator (New)


What is this Java Code Generator?

Java Code Generator is a command line tool that can be used to generate Java Beans from Documentum Object types. This is a DFS based tool. This tool generates java classes for that object type including all of its custom attributes with getter and setter methods.

Why this tool?

In any java application that interacts with Documentum repositories that’s not leveraging WDK might have to pass the Object information from one layer to another, also adding XML annotation to the Java source is erroneous and tedious job. This tool can be a one stop solution for Generation of Java beans and annotate them to use as a DFS object types and reduces the development type for bean creation into few minutes.

What JCG does?

Java Code Generator generates Java classes from Documentum Object types.

All Attributes of the Documentum Object type (non-inherited) will be added as protected attribute to the Generated Java class. JCG also adds public Getter and setter methods for those attributes. The repeated attributes in the Object type will have the Attribute as an Array of the specific data type. The Generated Java file will by default have the capitalized name of the Documentum Object type and can be configured to prefix or suffix to any String.

Find the table below for the Attribute information

Data type of Documentum Object attribute Attribute type in generated java file
String String
Date String
ID String
Integer Int
Boolean boolean
Double double

Besides this, GCG can be configured to generate XML annotations for DFS support. Read more about the XML Annotations at Annotation support of JCG

images Introducing JCG DFC Version  

This Java Code Generator has the same capabilities of the DFS version. Only difference between this and DFS version is this does not need DFS. All it needs is a 5.3 or above DFC in installed in the system.  All the configurations remains the same. 


How to Configure JCG

JCG has 2 levels of configuration, one is the basic DFC related ones that is mandatory for all DFC based applications and the next one is used for Configuring the JCG. All these configurations are located in the config folder.

This folder has three files, in which dfc.properties and JCGConfig.properties should be edited before running JCG

1) Dfc.properties (Skip this step if you are using DFC version and Installed DFC is not 6.0 or above)

Dfc.properties is the standard dfc.properties file that’s needed for DFC 6 or higher. Edit the dfc.properties to add Docbroker name, Docbroker port, Repository name, and global registry information

(Look at DFC guide to know more about how to edit this file)

For versions below 6.0 configure connection broker information on dmcl.ini

2) Log4.j.properties.

You don’t need to edit this file to run JCG. This is used for JCG logging and trouble shooting purpose.

3) JCGConfig.properties

All configurations of JCG‘s code generation capabilities can be done on JCGConfig.properties.

See all the configuration parameters in the following table

Property More information
JCG.repository Name of the repository against JCG is running
JCG.user.name A Valid user id who can access the above mentioned repository
JCG.user.password Password of the above mentioned user
JCG.object.type The object type/ base object type for which Java beans needs to be generated
JCG.include.subtypes Yes if need to generate java beans for the subtypes for the type specified for JCG.object.type
JCG.package.info Complete package name for the java beans generated
JCG.genarate.file.path The absolute path of the location where the generated java files will be saved
JCG.add.dfs.annotation Yes if needed XML annotation for DFS, No if not needed
JCG.file.name.prefix Prefix to the Object type name in the generated java file. Leave it Blank if no prefix needed
JCG.file.name.suffix Suffix to the Object type name in the generated java file. Leave this blank if no suffix is needed

Annotation support of JCG

JCG will support XML annotation and can be configured to add DFS specific XML Annotations on generated java beans.

JCG.add.dfs.annotation if set to yes

The following will be added just above the class declaration

@XmlType(name = "Object_type_name", namespace = "http://<reversed.package.name>/&quot;)

@XmlRootElement(name = " Object_type_name")

@XmlAccessorType(XmlAccessType.FIELD)

Here the Object_type_name is the name of underlying Documentum object type and reversed.package.name is the package name specified at JCG.package.info

Also the following will be added to each attribute declaration in the Generated java

@XmlAttribute

Prefix and Suffix

Prefix and suffix configuration can be used to Customize the Name of the Java Classes that are generated.

The JCG uses the Capitalized object name for the Generated class name by default. If you provide value for JCG.file.name.prefix or JCG.file.name.suffix JCG adds those as prefix and suffix to the generated java class names respectively

Example : If the Object type name is mycustomtype and JCG.file.name.prefix has value Business, and JCG.file.name.suffix has value VO the Generated class name will be BusinessMyCustomtypeVO


How to use this tool (DFS Version)

Edit the properties files

  • Edit DFC.properties
  • Edit JCGConfig.properties

See How to Configure JCG to know more about the configuration options

Set the Environment Variables

Set Java Home to point a valid Java home or make sure that java is in the system path

Edit jcg.bat

Set DFS_HOME variable to point to local DFS location

Example: C:\DFS\emc-dfs-sdk-6.5

Execute jcg.bat

Check the location specified at JCG.genarate.file.path to get the generated java files

System Requirements for DFS version

JRE 1.5 must be installed, and DFS 6, 5 extracted and configured in the system from where this tool is running.


How to use this tool (DFC Version)

Edit the properties files

  • Edit DFC.properties /dmcl.ini
  • Edit JCGConfig.properties

Note : You need to add docbroker information on dmcl.ini for DFC versions prior to 6.0

See How to Configure JCG to know more about the configuration options

Set the Environment Variables

Set Java Home to point a valid Java home or make sure that java is in the system path

Edit jcg.bat

Set DFC_HOME variable to point to local DFC location

Example: “C:\Program Files\Documentum\Shared”

Execute jcg.bat

Check the location specified at JCG.genarate.file.path to get the generated java files

System Requirements DFC Version

JRE 1.5 must be installed, and DFC 5.3 or above installed or configured in the system from where this tool is running.


More information

Please send your suggestions, comments and bugs to ajith @ ajithp.com

Important Legal information

Java is the registered trade mark of Sun Microsystems; Documentum is a registered trade mark of EMC Corporation. JCG does not distribute any of the third party jar files, JCG is distributed as it is and does not come with any implicit or explicit warranty.

Click here to go to the Download page
Advertisements

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: