I've had a search and while a few have asked something similar I've not seen a working answer as of yet. In short I'm using java to query a properties file and run a password encryption app against all DB connections. In real world terms the process is:
read property->Identify DB connections->prompt user for password to DB user->Run encrypter against password entry -> write encrypted value back out to property file.
My properties look similar to the below but also contain information on applications, urls etc :
My property file will no doubt have a few connections. I've used pro.keyset which reads all of the file. Essentially what I need is a bit of code that does:
I've done similar in jython before as you can probably see with my logic above, however with jython using weblogic's WLST it is impossible to mask password inputs so I'm having to add a small java applet to my build.xml to handle this for me.
Any help greatly appreciated.
(ps. my middle name is Charles, I'm not taking the mick with my display name - thanks Mum n Dad!)
It looks like you have a hierarchy in your properties file based on the key string. For example:
xadtasource. represents a 'list' of data sources. Inside the list you might have multiple sources named, for example:
... Then in each data source definition you have 'properties' which store the information you want to get to. In Java, Properties files don't have hierarchies like that, each key is unique and independent. You would have to build something that iterates all of the keys, parses them to their parts, and then builds a structure you can iterate over the way you want. I would imagine the need for a 'DataSource' class to hold the properties (jndi, user, password, etc...) then a Collection of some sort to hold the DataSource objects.
I never thought there was anything suspicious about your displayed name.
Joined: Oct 13, 2005
I think this thread is too difficult for "beginning Java", so I shall move it.
David C Shaw
Joined: Nov 05, 2010
Thankyou sir! I am a beginner so I guess that's why I put the question in that section. Fingers crossed someone can give me a couple of pointers to set me on my way!
Steve, you are indeed correct. My build scripts basically have unique configuration code that looks at the props files, each individual resource (whether thats xa, an ear etc) has its own section and the scripts know the .'s separate different configurable values.