Is it possible to retrieve the value from sever.properties inside dataSource field attribute ? if Yes then how it can be achieved?
Announcement
Collapse
No announcement yet.
X
-
Hi xdebugger,
it is, see here.
Code:public static Long getBuildDate() { Config.getGlobal(); String buildDate = (String) Config.getProperty("buildDate"); SimpleDateFormat parseFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm"); Date buildDateAsDate = null; try { buildDateAsDate = parseFormat.parse(buildDate); ... ...
Best regards
Blama
-
Hi xdebugger,
a lot of work for a single thing like this. Can't you store the regexp in the DB and do a normal serverCustom Java validator that does the validation with asking the DB first?
If not, DynamicDSGenerator is what you need. See also here.
To start it add in web.xml:
Code:<servlet> <servlet-name>RegisterDS</servlet-name> <servlet-class>com.mycompany.server.RegisterDS</servlet-class> <load-on-startup>1</load-on-startup> </servlet>
This would be the right way and is a great feature in general (you can basically build DataSources based solely on configuration data, without a .ds.xml file), but it might be a bit overkill if it is really only about the one validator.
Best regards
Blama
Comment
-
Hi xdebugger,
haha, did you see my question? I had the same idea because of this thread.
Otherwise the serverCustom validator is a very easy way to solve your problem with the only downside that is does not run in the browser. But perhaps this is not a problem?
The serverCustom validator would also work with server.properties instead of DB.
Best regards
Blama
Comment
Comment