Skip to Content
Author's profile photo Former Member

Java program for adding a java program object to CMS using plateform SDK

public void addProgramObjectToCms(IEnterpriseSession enterpriseSession,

            String jarPath, int parentFolderId, String programName)

            throws SDKException {

       

      IInfoStore infoStore = (IInfoStore) enterpriseSession

                .getService(“InfoStore”);

        IPluginMgr pluginMgr = infoStore.getPluginMgr();

        IPluginInfo pluginInfo = pluginMgr

                .getPluginInfo(“CrystalEnterprise.Program”);

        IInfoObjects newInfoObjects = infoStore.newInfoObjectCollection();

        IInfoObject newProgram = newInfoObjects.add(pluginInfo);

//folder in which you want to add the program

        newProgram.properties().setProperty(“SI_PARENTID”, parentFolderId);

        newProgram.properties().setProperty(“SI_NAME”, programName);

        File programFile = new File(jarPath);

        newProgram.getFiles().addFile(programFile);

        IProgram program = (IProgram) newProgram;

        IJavaProgram javaProgram = (IJavaProgram) program.getProgramInterface();

        javaProgram.setUserName(“administrator”);

        javaProgram.setPassword(“password”);

      // Give main class

        javaProgram.setMainClass(“com.JavaProgram”);

     //add arguments

        javaProgram.setArgs(“abc”);

     //commit the changes

        infoStore.commit(newInfoObjects);

    }

Assigned Tags

      Be the first to leave a comment
      You must be Logged on to comment or reply to a post.