PCTRun using fileset as input

Posted by Peter Judge on 20-Dec-2016 09:20

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

Posted by Tim Kuehn on 20-Dec-2016 09:23

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

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

Posted by Peter Judge on 20-Dec-2016 09:34

Thanks Tim,
 
I’d like to be able to call this from Ant; do your tools plug into that?

Posted by Tim Kuehn on 20-Dec-2016 09:37

Its all ABL code - so the usual caveats would apply.

Posted by Peter Judge on 20-Dec-2016 09:44

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>

Posted by riverside on 20-Dec-2016 09:46

Hi Peter,

You can use foreach (ant contrib) or subant.

Envoyé de mon téléphone


Posted by cverbiest on 21-Dec-2016 02:27

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€

Posted by James Palmer on 21-Dec-2016 03:30

 
 

Posted by Riverside Software on 21-Dec-2016 03:40

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

Posted by Peter Judge on 21-Dec-2016 08:10

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.

Posted by Riverside Software on 21-Dec-2016 11:23

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¢

Posted by Peter Judge on 22-Dec-2016 07:34

What you say is the correct thing to do :)

This thread is closed