Generating service/catalog files with Ant - Forum - OpenEdge Development - Progress Community

Generating service/catalog files with Ant

 Forum

Generating service/catalog files with Ant

This question is answered

Does PDSOE have any Ant tasks for generating the service/catalog files for defined services? Specifically the .pidl files in .services/AppServer and the .json files in PASOEContent/static ? I am able to successfully generate the .war file using the ABLWebAppPackage Ant task. However, the .war file generation relies on the existence of the .pidl and .json files - which themselves are generated based upon the contents of the ABL classes. Currently, I have to manually generate these by right clicking a service -> Edit -> Finish to trigger this generation. How can I perform this task via Ant?

- Jon Hutchens

Verified Answer
  • Per the discussion at PUG Challenge Americas, I have submitted a case to Progress requesting a command line utility for PIDL file generation. The suggested workaround is to use Web Handler Data Object services instead of REST, as they do not require PIDL files.

    Vote for the idea here.

    - Jon Hutchens

All Replies
  • If you look on the right of docs.progress.com/.../Using-Apache-Ant-tasks.html  , the Related Links   list has a "Packaging REST services" which is, I think, what you're after.
     
     
     
  • Hi Peter,

    I was able to generate the .paar files, but this process does not create the .pidl and .json (catalog) files required by the .war file process. I was able to generate the catalog .json files via the CatalogGeneration Ant task (see "Generating a Data Object Service Catalog File" from the link you sent), but it requires you to manually input the names of all the class files. The article states that a fileset task can be used to dynamically configure the resources element, but I receive the following error when attempting to do this:

    CatalogGeneration doesn't support the nested "fileset" element.

    Also - I wasn't able to find any way to generate the .pidl files in these articles. Can I do this from the .paar files? I'm not familiar with a .paar file.

    - Jon Hutchens

  • OpenEdge version 11.7.5

    Ant version 1.9.8

    Here's my build.xml

    <?xml version="1.0" encoding="UTF-8"?>

    <project name="Apps" default="build" basedir=".">

     <property environment="env" />

     <property name="DLC" value="${env.DLC}" />

     <property name="JAVA" value="${DLC}/java" />

     <property name="SRC" value="${basedir}" />

     <property name="DEST" value="${SRC}\build" />

     <property name="RCODE" value="${basedir}/rcode" />

     <property name="DB_LOCAL" value="${env.USERPROFILE}\db-local" />

     <property name="APP" value="api" />

       <!-- Target for defining 'taskdef' -->

     <target name="taskdef">

       <echo>Task Definitions</echo>

         <!-- Standard Libraries -->

       <taskdef resource="com/progress/openedge/pdt/ant/ablwebapp/ablwebapps.properties">

         <classpath>

           <pathelement location="${JAVA}/ant-ablwebapp.jar" />

             <!-- ABLWebApp Dependencies -->

           <pathelement location="${JAVA}/ant-libs/ablwebapp.jar" />

           <pathelement location="${JAVA}/ant-libs/ablwebapp-dependencies.jar" />

             <!-- CodeModel Dependencies -->

           <pathelement location="${JAVA}/ant-libs/codemodel-dependencies.jar" />

             <!-- AST and its Dependencies -->

           <pathelement location="${JAVA}/ant-libs/ast.jar" />

           <pathelement location="${JAVA}/ant-libs/ast-dependencies.jar" />

             <!-- Additional deps -->

           <pathelement location="${JAVA}/ant-libs/velocity-1.7.jar" />

           <pathelement location="${JAVA}/ant-libs/velocity-1.7-dep.jar" />

           <pathelement location="${JAVA}/ant-libs/1padapters-restExpose.jar" />

           <pathelement location="${JAVA}/1padapters-idl.jar" />

           <pathelement location="${JAVA}/ext/jettison-1.2.jar" />

             <!-- For OpenEdge 12.0 -->

           <!--<pathelement location="${dlc.java.dir}/ext/commons-logging-1.2.jar"/>

           <pathelement location="${dlc.java.dir}/ext/xmlschema-core-2.2.1.jar"/>-->

         </classpath>

       </taskdef>

         <!-- PCT Libraries -->

       <taskdef resource="PCT.properties" />

       <typedef resource="types.properties" />

         <!-- Next line only for tasks using OpenEdge parser, see ClassDocumentation task -->

       <!--<typedef resource="extras.properties" />-->

     </target>

       <!-- Main task -->

     <target name="build" depends="taskdef,clean,compile,war">

     </target>

       <!-- Clean build, rcode directories -->

     <target name="clean" description="clean output for sample web application">

       <delete dir="${DEST}" />

       <mkdir dir="${DEST}" />

       <delete dir="${RCODE}" />

       <mkdir dir="${RCODE}" />

     </target>

     <target name="war" description="generate .war file">

       <ABLWebAppPackage

         srcdir="${SRC}"

         dlc="${DLC}"

         destdir="${DEST}"

       />

     </target>

     <target name="compile" description="generate r-code">

       <echo>Generate r-code</echo>

       <PCTCompile destDir="${basedir}/rcode" dlcHome="${DLC}" >

         <fileset dir="${SRC}/AppServer">

           <exclude name="*.i" />

         </fileset>

         <propath>

           <pathelement location="${SRC}/AppServer" />

         </propath>

         <DBConnection dbName="coinsf1" dbDir="${DB_LOCAL}\coinsf1" readOnly="true" singleUser="false">

           <PCTAlias name="acctmas" />

         </DBConnection>

         <DBConnection dbName="favmas" dbDir="${DB_LOCAL}\favmas" readOnly="true" singleUser="false" />

         <DBConnection dbName="coinsadm" dbDir="${DB_LOCAL}\coinsadm" readOnly="true" singleUser="false" />

         <DBConnection dbName="favadm" dbDir="${DB_LOCAL}\favadm" readOnly="true" singleUser="false" />

       </PCTCompile>

     </target>

    </project>

    - Jon Hutchens

  • Also, I double checked the paar file generation process. It also fails if the .pidl and .json files are not already present. So, essentially what I'm looking for is the step in between compiling ABL code and generating .paar/.war files.

    - Jon Hutchens

  • build.xml
    Hi,
     
    ANT task is not provided for pidl file generation. If you extract the paar there will be <servicename.restoe> file (this content is populated by pidl file in the background). I have tried with the attached build.xml , the generation of war, paar  and catalog file is proper. Can you please try the attached build.xml file by customizing with your locations and see if it works or not?
     
    Thanks,
    Keerthy.
     
  • Hi Keerthy,

    I have attempted usage of the CatalogGeneration task as advised. While I was able to successfully generate .json catalog files for each service, it required manually listing out each class file in the build.xml that was to be associated with a given service. Can this not be done automatically by referencing the .services/Expose/rest/<servicename>/*.xml files? All of this information is contained in there, and PDSOE uses it to create the .pidl and .json files when editing a service.

    Also, I am confused as to how to generate .war/.paar files if there is no available task to create the .pidl files. Yes, I can successfully generate the correct .war and .paar files, but if and only if the .pidl files are present and up to date with the source code (the contents of the .pidl files are subject to change based upon annotations in the class files, and compiling the code does not update the .pidl files). If I cannot generate the .pidl files, how then can I generate the .war or .paar files?

    To clarify, my understanding of the relationship between .paar and .war files is as follows (correct me if I am wrong):

    A .war file is an archive much like a .zip file that contains all the .paar files for deployment of all services, in addition to other resources.

    Individual .paar files can be generated for incremental deployment of specific services.

    - Jon Hutchens

  • To clarify, my understanding of the relationship between .paar and .war files is as follows (correct me if I am wrong):

    A .war file is an archive much like a .zip file that contains all the .paar files for deployment of all services, in addition to other resources.

    Individual .paar files can be generated for incremental deployment of specific services.

     
    Basically, yes. WAR files are a standard Tomcat artifact. PAAR files are OpenEdge-specific.
     
    If you look at the PASOE URL below, basically the war file (the ABL webapp) contains
    - a named context (URL path)
    - a set of ABL services, grouped by transport
    - security (authentication and authorisation) for those services
    - a way to run ABL code (to the ABL application below)
     
    PAAR files are service descriptors for rest-transport-based services.  So in the URL below, you'd have a CustomerBE.paar which would describe which resources are available, and what the ABL code is behind them. You can have multiple PAAR files for different services. If you had an OrderBE service defined like the CustomerBE service, you'd have an OrderBE.paar file too, in the ABL webapp's WEB-INF/adapters/rest/OrderBE/ folder.
     
    Services that use other transports have different service descriptors (WSM files, WebHandlers etc) and don't always follow the pattern on disk that the rest transport does.
     
     
     
     
     
  • Hi,
     
    You no need to specify each and every class file name in build.xml. Instead the root folder name can be specified to the fileset dir.
     
    From PDS OE, .pidl files will be generated in the following scenarios:
     
    1. "REST Resource URI Editor" for verb associations .
    2. When associating the Data Object service with business entity files.
    3. We have option associated with build action. In the project properties pages, under Progress OpenEdge -> Build -> ‘Generate REST invocation files' check box will be there. Check this option and then Clean build the project (if we don't want to build the entire project , the respective ABL file can be compiled). This build action can regenerate the .pidl files along with the Rcode from PDS OE.
    As I said earlier, there is no ANT task provided for to generate only .pidl files.
     
    While generating the mappings, the required artifacts(along with .pidl) will be generated from PDSOE. With these artifacts only, proper war/paar can be generated. So we have to do mappings from PDSOE, then can use the required ANT tasks.
     
    Thanks,
    Keerthy.
     
  • Peter - thank you for the explanation. This gives me a better understanding of the software architecture.

    Keerthy - The reason I said I had to specify all the files individually is because we have multiple services that have some resources in common. So, while I am sure using the fileset directive would work for a single service, I don't think it would work here.

    For example, consider I have 3 resources ClassA.cls, ClassB.cls, and ClassC.cls and 2 services Service1 and Service2. Service1 contains ClassA and ClassB. Service2 contains ClassB and ClassC. How can fileset be used to find the correct class files? If resources were always unique to a service, a folder hierarchy could easily be used, but since the resources are shared, I don't think they can.

    I understand that .pidl files can be generated with PDSOE, and there are no Ant tasks available to perform such function. Is there no other utility or PRO* tool that accomplishes this? What I'm really getting to is that using Ant as a build/deploy automation tool is only useful if the whole process is automated. "A chain is only as strong as its weakest link" sort of thing. Do you know if Progress plans to create an Ant task in the future for this?

    So, if there is no other way to generate these files other than PDSOE, I have one last follow-up question. We use git as our version control system, and I had initially listed .pidl files in the .gitignore to be untracked since I found out they were generated files. Should I instead continue to track the .pidl files and put the responsibility on each developer to ensure their .services/ folder content (.pidl, .xml, etc.) is up to date with their source code?

    - Jon Hutchens

  • Trying to catch up, is there a way to generate the PIDL files from command line ? And then to automate that in Ant / PCT ?

  • Do you want the PIDL or the PAAR?
     
  • Hello,
     
    AFAIK, there is no utility to generate .PIDL files. We have ANT task to generate .PAAR files though.
     
    Thanks,
    Sanjeev
     
  • We don't "want" the PIDL files per se; they are just a required intermediary that we must use because WAR / PAAR file generation relies on them. We want to write the ABL code, define the services, and then use Ant / PCT / command line to generate the artifacts required for deployment to a PASOE server. We know the PASOE server requires a WAR or PAAR file to deploy services. We know how to create WAR and PAAR files using the Ant utilities. However, since creating WAR / PAAR requires up to date PIDL files, we need to know how to generate them as well.

    How is PDSOE able to generate PIDL files but there is no command line utility or Ant process for us to run the process automatically? Without full automation, we cannot perform CI / CD.

    - Jon Hutchens

  • Per the discussion at PUG Challenge Americas, I have submitted a case to Progress requesting a command line utility for PIDL file generation. The suggested workaround is to use Web Handler Data Object services instead of REST, as they do not require PIDL files.

    Vote for the idea here.

    - Jon Hutchens