Skip to Content.
Sympa Menu

perfsonar-dev - Re: [pS-dev] Field order in properties files

Subject: perfsonar development work

List archive

Re: [pS-dev] Field order in properties files


Chronological Thread 
  • From: Roman Lapacz <>
  • To: Gijs Molenaar <>
  • Cc: "" <>
  • Subject: Re: [pS-dev] Field order in properties files
  • Date: Fri, 30 Mar 2007 12:55:32 +0200

Gijs Molenaar wrote:
Roman Łapacz wrote:
Gijs Molenaar napisał(a):
Hi,

During development of our service, we discovered a problem with ant. When ant changes some variables in the components.properties file, the order of the lines are changed. Given the fact that the components (config, logger, etc.) are loaded in the exact order in which they appear in the components.properties file, this causes a problem.

For example in our case the logger is loaded before config now, so the logger misses some config values.

Does anyone know how to solve this problem? Are we doing something wrong?

Take RRD MA as an example:

you can find copy-components-properties target in rrdma/rrdma-configure-targets.xml file. This target changes the name of conf/components.properties.rrdma file to conf/components.properties. In the former you can see the list of components in order which is needed and renaming does not change it. copy-components-properties target is executed in configure target.


I'm not really sure if you understand my question. You are right that copying a file doesn't change the order. The problem occurs when the ant script is trying to enable ls registration functionality:

<replace file="conf/components.properties" token="#registrator=org.perfsonar.service.measurementArchive.register.LSRegistrationComponent" value="registrator=org.perfsonar.service.measurementArchive.register.LSRegistrationComponent"/>

When the ant script regenerates the components.properties file, the order is pretty much different:
before:

------
# File contains components to load
# Config and logger MUST be load as first!
#Configuration component - must be the first one!
config=org.perfsonar.commons.auxiliary.components.configuration.properties.PropertiesConfigurationComponent
#Logger component - must be the second one!
logger=org.perfsonar.commons.auxiliary.components.logger.log4j.Log4jLoggerComponent

# Simple scheduler
#mp_scheduler=org.perfsonar.commons.auxiliary.components.simplescheduler.Scheduler

# Registration in LS
#registrator=org.perfsonar.service.measurementPoint.register.LSRegistrationComponent

#Service specific components

#...
------

after:

------
#This file was created by the Ant configuration script.
#Fri Mar 16 15:14:35 CET 2007
mp_scheduler=org.perfsonar.commons.auxiliary.components.simplescheduler.Scheduler
logger=org.perfsonar.commons.auxiliary.components.logger.log4j.Log4jLoggerComponent
config=org.perfsonar.commons.auxiliary.components.configuration.properties.PropertiesConfigurationComponent
registrator=org.perfsonar.service.measurementPoint.register.LSRegistrationComponent
------

This is the same for service.properties, which can be quite frustrating.

Hi Gijs

in short the question is; is it possible to tell ant not to randomly shuffle the order of the lines of the files it processes?

No, it's not possible to instruct Ant to keep the right order. That is why components.properties is not generated by Ant using propertyfile task. Instead, the file is created from components.properties.xxx template file (copy operation) and if you want to have ls register functionality then the commented lines (examples for RRD MA)

#ma_scheduler=org.perfsonar.commons.auxiliary.components.simplescheduler.Scheduler
#registrator=org.perfsonar.service.measurementArchive.register.LSRegistrationComponent

are replaced with uncommented lines

ma_scheduler=org.perfsonar.commons.auxiliary.components.simplescheduler.Scheduler
registrator=org.perfsonar.service.measurementArchive.register.LSRegistrationComponent


Such replace operation does not change the order in the configuration file.


I took a look at your script flowmp/flowmp-configure-targets.xml and I see that the problem is in register-fuctionality-for-flowmp target. Remove these lines:


<propertyfile file="conf/components.properties"
comment="This file was created by the Ant configuration script.">
<entry key="mp_scheduler" value="org.perfsonar.commons.auxiliary.components.simplescheduler.Scheduler"/>
<entry key="registrator" value="org.perfsonar.service.measurementPoint.register.LSRegistrationComponent"/>
</propertyfile>

because:

- you don't need them (you aalready have replacing)
- propertyfile task changes the order in components.properties file (use of this task also generates following lines at the beginning of components.properites file

#This file was created by the Ant configuration script.
#Fri Mar 16 15:14:35 CET 2007

)


(sorry for late response)

Roman



When I look at the ant code of other MA/MP's I can't find a solution.


thanks,

- gijs




Archive powered by MHonArc 2.6.16.

Top of Page