Writing Custom method program(实现自定义的Documentum方法)
Hi All,
First time I am writing my own custom method program in java.
My simple custom method java program is Test_Method.java , as follow.
package com.sunita;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.Map;
import com.documentum.fc.methodserver.IDfMethod;
/**
* @author Administrator
*
*/
public class Test_Method implements IDfMethod {
/**
* @param args
*/
public void execute(Map parameters, OutputStream output) throws Exception {
System.out.println("hi i have run successfully ");
}
public int execute(Map arg0, PrintWriter arg1) throws Exception {
// TODO Auto-generated method stub
return 0;
}
}
After that i have kept the Test_Method.class file inside the $Documentum\dba\java_methods, as shown in the following screenshot (Test_Method.PNG)
-------> Now I have created my custom method in DA, name as test_method, as shown in the following screenshot (cutom_method.PNG)
Now I have restarted the java method server. But after restarting java method server, this Test_Method class is not calling, as shown in the server log (server log path is E:\Documentum6.5\jboss4.2.0\server\DctmServer_MethodServer\log)
2010-07-19 15:49:50,312 INFO [org.jboss.web.tomcat.service.TomcatDeployer] deploy, ctxPath=/bpm, warUrl=.../deploy/bpm.ear/bpm.war/
2010-07-19 15:49:51,078 INFO [STDOUT] <DCTM>
2010-07-19 15:49:51,078 INFO [STDOUT] <
2010-07-19 15:49:51,078 INFO [STDOUT] INFO
2010-07-19 15:49:51,078 INFO [STDOUT] >
2010-07-19 15:49:51,078 INFO [STDOUT] Documentum Java Method Server
2010-07-19 15:49:56,937 INFO [STDOUT] <DCTM>
2010-07-19 15:49:56,937 INFO [STDOUT] <
2010-07-19 15:49:56,937 INFO [STDOUT] INFO
2010-07-19 15:49:56,937 INFO [STDOUT] >
2010-07-19 15:49:56,937 INFO [STDOUT] Docbase Names = DCTM_Repository
2010-07-19 15:49:56,937 INFO [STDOUT] <DCTM>
2010-07-19 15:49:56,937 INFO [STDOUT] <
2010-07-19 15:49:56,937 INFO [STDOUT] INFO
2010-07-19 15:49:56,937 INFO [STDOUT] >
2010-07-19 15:49:56,937 INFO [STDOUT] Host Names = svctag-bpmbp51
2010-07-19 15:49:56,937 INFO [STDOUT] <DCTM>
2010-07-19 15:49:56,937 INFO [STDOUT] <
2010-07-19 15:49:56,937 INFO [STDOUT] INFO
2010-07-19 15:49:56,937 INFO [STDOUT] >
2010-07-19 15:49:56,937 INFO [STDOUT] IP Addresses = 10.26.116.26, 127.0.0.1, 0:0:0:0:0:0:0:1
2010-07-19 15:49:56,937 INFO [STDOUT] <DCTM>
2010-07-19 15:49:56,937 INFO [STDOUT] <
2010-07-19 15:49:56,937 INFO [STDOUT] INFO
2010-07-19 15:49:56,937 INFO [STDOUT] >
2010-07-19 15:49:56,937 INFO [STDOUT] Java Method Dir = E:\Documentum6.5\dba\java_methods
2010-07-19 15:49:56,937 INFO [STDOUT] <DCTM>
2010-07-19 15:49:56,937 INFO [STDOUT] <
2010-07-19 15:49:56,937 INFO [STDOUT] INFO
2010-07-19 15:49:56,937 INFO [STDOUT] >
2010-07-19 15:49:56,937 INFO [STDOUT] DoMethod CLASSPATH=%CLASSPATH%;E:\Documentum6.5\dba\java_methods\
2010-07-19 15:49:56,968 INFO [org.jboss.deployment.EARDeployer] Started J2EE application: file:/E:/Documentum6.5/jboss4.2.0/server/DctmServer_MethodServer/deploy/bpm.ear/
2010-07-19 15:49:56,968 INFO [org.jboss.deployment.EARDeployer] Init J2EE application:
Kindly help me on this.
Thanks in advance.
- Test_Method.PNG (20.7 K)
- custom_method.PNG (34.8 K)
You have to deploy your java class to a folderstructure matching your java package:
$DOCUMENTUM\dba\java_methods\com\sunita
Also, how are you calling method? Normally, a job is configured to call the method and the job passes arguments (required by method) in order for the method to create the repository session.
Hi Johnny/All,
Now mt Test_Method class is coming in server.log file.
I am doing this custom method first time.
I want to run my custom method manually from DA and
also want to see the output of System.Out.Println() statement
But I am not able to see any SOP results.
I have run the method like following, then also I am not able to see the output of my custom method.
custom method --> Right Click --> Run --> check the checkbox Save Results
Thanks & Regards,
DipuSonu
Try deploying your class in the $DM_HOME/lib.
Hi Johnny,
Here $DM_HOME means E:\Documntum6.5\dba directory?
Which directory $DM_HOME is?
Oops, maybe its $DOCUMENTUM. Nonetheless, the directory should be E:\Documntum6.5\product\6.5\lib
Please be careful when creating methods.
There's a difference between IDfMethod and IDmMethod.
If you use the IDfMethod interface, you should create a module for your method and deploy the method using Composer/DAB.
No changes needed at the methodserver because evrything is handled by BOF.
If you use IDmMethod, you should place the method + required jars in $DOCUMENTUM/dba/java_methods.
I don't know if mixing these 2 approaches is good practice.
Using the IDmMethod approach is possibly the easiest way to create a method, unless your method is using custom TBOs/SBOs (or other custom modules).
It does require an extra jar to be referenced to develop it (mthdservlet.jar, can be found at $DOCUMENTUM/dfc/jboss4.2.0/server/DctmServer_MethodServer/deploy/ServerApps.ear/DmMethods.war/WEB-INF/lib at the Content Server).
Hi All,
Thanks a lot for all of your help.
I have sucessfully ru my first custom method testmethod.
for this I did the following steps.
1. Create a java class named Test_Method as in composer, as in below. (NOTE: make sure that you must use IDmMethod interface and this interface is inside the mthdservlet.jar file and you need to add the mthdservlet.jar file in the composer project from the path E:\Documentum6.5\jboss4.2.0\server\DctmServer_MethodServer\deploy\ServerApps.ear\DmMethods.war\WEB-INF\lib\mthdservlet.jar )
package com.sunita;
import java.io.OutputStream;
import java.util.Map;
import com.documentum.mthdservlet.IDmMethod;
public class Test_Method implements IDmMethod {
public void execute(Map parameters, OutputStream output) throws Exception {
System.out.println("hi i have run successfully 1.5");
}
}
2. Make the jar file named as testmethod.jar for the Test_Method class, as shown attached document (Creating_Jar_Composer.doc).
3. Copy the testmethod.jar into the E:\Documentum6.5\dba\java_methods path and restart the Documentum Java method server.
4. After restarting Documentum Java method server open the method server log file (Path: E:\Documentum6.5\jboss4.2.0\server\DctmServer_MethodServer\log\server.log) and check that DoMethod CLASSPATH=%CLASSPATH%;E:\Documentum6.5\dba\java_methods\;E:\Documentum6.5\dba\java_methods\testmethod.jar
5. Now open the DA and create a new custom method, as shown below test_method_DA.PNG image file. (NOTE: If testmethod.jar file contains the class name with package then in method Verb you can give the class name with full package while creating custom method. If If testmethod.jar file contains the class name without any package then in method Verb you can only give the class name without any package while creating custom method.)
6. Now run the custom method in DA and you can see your output in the method server log file (server.log).
Thanks,
Sunita
- Creating_Jar_Composer.doc (125.0 K)
- test_method_DA.PNG (22.0 K)
Thanks for posting your results Sunita. This will help other beginners as well.