Questions on creating a Method and a Job using Composer

athati
athati Member
edited April 20, 2012 in Documentum #1

Hi,

Using Composer I created a Java class with a method to run as a job on schedule. As per the Composer User guide, I see one can create both method (method object) and a job too. My Java method name is "sendEmail". I have a couple of questions while creating a method and Job using Composer.

I think we can use only Composer to create both and deploy them as a project and I need need not do anything in DA? Am I right? If not, please let me know how I need to use the instructions in DA?

While Creating a Method using Composer

What exactly goes in "Command"?

Where does exactly my Java method name sendEmail go in?

For "Run as the server": What is best option?

For "Use method server": What is best option?

While Creating a Job using Composer

For "Method Data": What is best option?

For "Standard Arguments": My method does not have any arguments or parameters to pass on. Shall I keep it blank? What exactly goes here?

For "Custom Arguments": Shall I keep it blank? What exactly goes here?

Please share your knowledge and experiences for figuring this out.

Thanks.

ta

Tagged:

Best Answer

  • astone
    astone Member
    edited April 20, 2012 #2 Answer ✓

    Hi athati,

    "I think we can use only Composer to create both and deploy them as a project and I need need not do anything in DA? Am I right? If not, please let me know how I need to use the instructions in DA?"

    yes, you don´t have anything in DA

    While Creating a Method using Composer

    What exactly goes in "Command"?

    is the name of your java class, for example: com.example.methods.Expirated

    Where does exactly my Java method name sendEmail go in?

    com.example.methods[your package].sendEmai [your class]

    For "Run as the server": What is best option?

    always leave true

    For "Use method server": What is best option?

    if you go to work with Workflows, for example with Process Builder check this.

    While Creating a Job using Composer

    For "Method Data": What is best option?

    leave it empty.

    For "Standard Arguments": My method does not have any arguments or parameters to pass on. Shall I keep it blank? What exactly goes here?

    check true, if you want access to documentum, for example use sessions for access to repository.

    For "Custom Arguments": Shall I keep it blank? What exactly goes here?

    yes. Here goes your custom arguments use in your class, if you need.

    I hope that the answers help you.

    Regards



Answers

  • astone
    astone Member
    edited April 20, 2012 #3 Answer ✓

    Hi athati,

    "I think we can use only Composer to create both and deploy them as a project and I need need not do anything in DA? Am I right? If not, please let me know how I need to use the instructions in DA?"

    yes, you don´t have anything in DA

    While Creating a Method using Composer

    What exactly goes in "Command"?

    is the name of your java class, for example: com.example.methods.Expirated

    Where does exactly my Java method name sendEmail go in?

    com.example.methods[your package].sendEmai [your class]

    For "Run as the server": What is best option?

    always leave true

    For "Use method server": What is best option?

    if you go to work with Workflows, for example with Process Builder check this.

    While Creating a Job using Composer

    For "Method Data": What is best option?

    leave it empty.

    For "Standard Arguments": My method does not have any arguments or parameters to pass on. Shall I keep it blank? What exactly goes here?

    check true, if you want access to documentum, for example use sessions for access to repository.

    For "Custom Arguments": Shall I keep it blank? What exactly goes here?

    yes. Here goes your custom arguments use in your class, if you need.

    I hope that the answers help you.

    Regards



  • sandeep.sonkarambale
    edited April 20, 2012 #4

    Hi,

    Follow the following steps-

    1. you should extend your class by com.documentum.mthdservlet.IDmMethod.And override execute() method.

        In this execute method you can write your code.

    2.Copy this compiled class file in "Documentum/dba/javamethods" folder where content server is installed.

    3.Restart the JMS server.

    4.Create a method in DA

    5.Optionally you can create a job by using DA.And select the method while creating a job.

  • pettitk
    pettitk Member
    edited April 20, 2012 #5

    The easy way to be sure of the settings you should have is to query on dm_method and make sure you mimic a similar java method. -Kyle

  • athati
    athati Member
    edited April 20, 2012 #6

    Thanks Sandeep, Aston and Kyle.

    I already created a Java class (without extending any other class...) with a method in it. So as per your post, that method will not work...RIght? For this to get it to work all my "sendEnail" method clode must go into overriden execute() method and my class must extend  com.documentum.mthdservlet.IDmMethod...Right?

    I used Composer for this so far. As Aston mentioned, can I continue using Composer to create method (object) and Job?

    Please advise me.

    Thanks.

    ta

  • athati
    athati Member
    edited April 20, 2012 #7

    Thanks Kyle.

    How can I get code for dm_method?

    Please let me know.

    Thanks.

    ta

  • sandeep.sonkarambale
    edited April 20, 2012 #8

    Yes you have to write your code in this overriden execute() method.Otherwise it will not work.

    And you can create a job/method in composer as well as in DA.

  • pettitk
    pettitk Member
    edited April 20, 2012 #9

    Old, but good post: http://developer.emc.com/developer/devcenters/ContentManagement/devsupp/MethodServer_DevTools_Whitepaper.pdf <http://developer.emc.com/developer/devcenters/ContentManagement/devsupp/MethodServer_DevTools_Whitepaper.pdf&gt;

    I attached the sample.java that comes with content server. Not sure if it will get filtered out since I am replying via email.

    Jobs (dm_job) refer to a method (dm_method). Methods can refer to java or docbasic or other programs. Most recently, you should not develop with docbasic. Many OOTB methods are still there and are done in docbasic. For those, you can get the code just by following the method_verb.

    Example method_verb : .\dmbasic -f..\install\admin\mthd1.ebs -eContentWarning

    The code is in $DOCUMENTUM_HOME\..\install\admin\mthd1.ebs, the entry subroutine is ContentWarning. This is useful to reverse engineer EMC’s jobs/methods.

    When the code is in java, of course, you can’t get at it without decompiling, or if it was custom, then hopefully you have the originally source code.

  • athati
    athati Member
    edited April 20, 2012 #10

    Thanks Kyle.

    I think I need to add a JAR for the following import:

     

    import com.documentum.mthdservlet.IDmMethod;

    Composer says "cannot be resolved".

    What JAR I need? Is it mthdservlet.jar ? Where can I get it? From Content Server?

    Please let me know.

    Thanks.

    ta

  • pettitk
    pettitk Member
    edited April 20, 2012 #11

    Its on the content server. Search for: mthdservlet.jar, add it to your path in composer project. Mine was on: D:\Documentum\jboss4.2.0\server\DctmServer_MethodServer\deploy\ServerApps.ear\DmMethods.war\WEB-INF\lib\ mthdservlet.jar

    Btw, put your resulting jar in documentum/dba/java_methods

  • athati
    athati Member
    edited April 20, 2012 #12

    Thanks Kyle.

    I found the JAR (mthdservlet.jar) on Content Server. I need to FTP to my computer to pull into my Composer project. I did not find 'dba' folder under either "C:\Program Files\Documentum" or "C:\Documentum".

    Please advise me where can I pull it.

    Thanks.

    ta

  • pettitk
    pettitk Member
    edited April 20, 2012 #13

    When you are done, all custom dm_method programs that are to be run from a job or a workflow auto activity, go into Documentum/dba/java_methods on the content server, NOT your local pc. During development, you use your local PC/composer. You simply put the jar in that directory on the content server, toggle the method server and if your program was written correctly, its accessible by the calling dm_method in the repository. To setup the dm_method and dm_job objects, just mimic other dm_method/dm_job objects (query for them).

  • athati
    athati Member
    edited April 20, 2012 #14

    Thanks Kyle.

    During development I need to pull the JAR into my Composer project. Shall I place any where on my PC? I am thinking of placing it under "C:\Program Files\Documentum\Shared", then pull it into my Composer project.

    Thabk you for your help.

    ta

  • pettitk
    pettitk Member
    edited April 20, 2012 #15

    It doesn’t matter… I personally created a c:\documentum\DCTM_JARS directory, and I place all my 3rd party jars in that location. It doesn’t matter where they are on your composer PC during development, as long as you add the external jar into composer.

  • athati
    athati Member
    edited April 20, 2012 #16

    Thanks Kyle.

    Can I keep both the execute method parameters null like execute (null, null)? My method does not pass any parameters. Please let me know.

    Thank you very much.

    Note: I am opening a new post with this question.

    ta

  • pettitk
    pettitk Member
    edited April 20, 2012 #17

    Correct, parameters are optional. Null is fine.