Property File

Hi,

I am not familiar working with the Properties file but trying to develop some stuff based on PS Utilities in the forum and have a basic question on this.

I am defining four fields in the Property file as below:
#Property File
Name1=wM1
Name2=wM2
Name3=wM3
Name4=wM4

When i’m reading the Property file using a Java Service(fileName as Input and Property as Output field); the result is displayed as follows:
Property (Name) and
{Name1=wM1, Name2=wM2, Name3=wM3, Name4=wM4} (value)

I think the returned output “Property” is a string but when i try to tokenise the string, its throwing a “NullPointer Exception”. I wish to return the fields as a String List.

Could someone tell me how to get the Property fields as a String List. In other words, how to define the Property File in the config folder that will return the output as a String List as wM1,wM2,wM3,wM4?

Thanks for your help.

Raj,

Here is the codesnippet of the JavaService this gives output as StringList,(see the attachment) and read the comments above the java code.
Compile the java code and invoke this java service in a flow that reads the properties by specifying the inputs (propertyfilename,packagename,properties list that you want to retrieve) this gives the output Values(stringlist),so you can tokenize it as required wM1,wM2,wM3,wM4 etc…

PS:Customize the service as per your requirement…

HTH,
RMG

getProperties
getPropFromConfigFile_JavaService.TXT (1.7 k)

Thanks alot RMG. but wondering what difference does that make placing the Properties file under config folder and pub folder (Just curious to know).

If you are putting the file inside package,then use pub folder,but i feel no diff as long as you are reading the properties from a certain location folder…In generanl config folder location is used by IS internally…

HTH,
RMG

If your properties have some environment dependent values like server names etc which differ as you migrate from test to production environments etc, I think its better to have them in config directory. By this way, the file in each of the config directories will have their own environment related values and can avoid possible migration mistakes.

Aneel,

i agree with you…but some times we use property file specific to project (package)and this is not used globally,anyways when we move package no probs in missing.

HTH,
RMG

raj_preet,
i rather would be extremely cautious in putting any config related file to the “pub” directory.

If you want to put the config files within the package, create a new directory “config” under the package and use that dir.

any files in the pub directory needs to be secured via the .access file. Putting the config files under the pub directory might result in security breach. Be CAUTIOUS and understand the implications before doing so.

HTH,
Saurabh

Good idea though.