PCTRun using fileset as input - Forum - OpenEdge General - Progress Community

PCTRun using fileset as input

 Forum

PCTRun using fileset as input

This question is not answered

Hi,

I have a utility program that takes filenames as arguments via -param . I'd like to start at a root directory, select all files matching a pattern and pass them one-by-one into a PCTRun task. Something along the lines of

find /path/to/instance/webapps -type f -name web.xml -print -exec _pro -p convert_spring_properties.p -param XML-CFG={} \;




Is this possible? I could change my .P to take a delimited list or an input file, but am interested in this question for now.

TIA

All Replies
  • my dir-tools.p program can do a directory tree scan for wildcard matching like you're describing:

    community.progress.com/.../1615.directory-tools

  • Thanks Tim,
     
    I’d like to be able to call this from Ant; do your tools plug into that?
  • Its all ABL code - so the usual caveats would apply.

  • Since patience got the better of me, I changed the .P to accept a delimited list. This works quite nicely.

    <target name="convert" description="Extracts Spring security values into properties oeablSecurity.* files">		
      <fileset id="webapp_config" dir="${instance.root}" includes="**/web.xml"/>
    		
      <!-- Turns the fileset into a ;-delimited list. Files are fully-qualified with paths -->
      <pathconvert property="webxml.list" refid="webapp_config" pathsep=";" />
    		
      <PCTRun
        graphicalMode="false"
        cpStream="UTF-8" 
        procedure="convert_spring_properties.p"
        parameter="${webxml.list}"
      />
    </target>
    
  • Hi Peter,

    You can use foreach (ant contrib) or subant.

    Envoyé de mon téléphone


  • If the path list is large it might be better to save the list to a temp-file and pass the name of the temp-file as a parameter

    just my 0,02€

  •  
     
  • You can also use the <Parameter> node, which let you pass as many parameters as you want. Size of each parameter is limited to the size of the CHAR variables.

    github.com/.../PCTRun

  • I saw that too …
     
    Trying to have a single .P be callable with and without PCT and so don’t want to add PCT-dependent code. I went with the ;-delimited list and it works fine.
     
    Thanks for the input.
  • Then I'd have a single procedure (or class) which doesn't depend on session:parameter or the PCT getParameter function, accept a meaningful set of parameters, then add wrappers for a direct command line call or PCT call where gory details will happen.

    Oh by the way, you can upgrade PCT to the latest version, v207 has just been released :-)

    My 2¢

  • What you say is the correct thing to do :)