[smartweb-devel] Issue 1833662 - Incorrect configuration file retrieving
Brought to you by:
rlogiacco
From: Roberto Lo G. <rlo...@sm...> - 2007-11-17 19:54:11
|
Hi all, today Stefano opened an issue, correctly in my opinion, regarding the configuration files retrieve algorithm. Since we started to use the Maven suggested notation for jar files (smartweb-auth-1.0.0.jar for example) the file retrieve algorithm has exposed his flaws. Assume you want to have some classes persisted on a PostgreSQL server and some else persisted on MySQL: to accomplish this objective you should have those classes jarred into two different archives. Speaking in terms of modules we want the smartweb-registry classes on PostgreSQL and the smartweb-auth classes on MySQL. Into your EAR or WAR you should have 2 different .hcf files: one can be named smartweb.jar.hcf (not the best choice, but possible) and the other should be named smartweb-auth-<version>.jar.hcf!!! In practice you have your configuration file stuck to the FULL filename of the JAR. The same issue regards Domain wide configuration files added in the 1.2 release of the core: the smartweb-auth configuration file (the place where you configure what you want to protect and how it should be protected) should be named, for the next release, smartweb-auth-0.8.0.jar.xml !!!! The problem here is when you want to upgrade the library...you must rename the files! In my opinion this can be a small advantage in terms of attention during upgrade process, but it introduces a lot of work and confusion too with errors arising even on a simple bugfixing patch. We thought about the possibility to strip out the version part from the name during searches with the following statement: name = name.substring(0, name.lastIndexOf('-')) + name.substring(name.lastIndexOf('.')); But this approach doesn't work with filenames like smartweb-auth-1.0.0-beta.jar or smartweb-auth-1.0.0-SNAPSHOT.jar which are standard for Maven. We could fix the striping algorithm trying to check if the hyphen is followed by a digit (may be using a regexp pattern) but we found another filename which can break the algorithm: smartweb-auth-1.0.0-beta-4.jar ! I'm opening the discussion to the forum contributions as we are actually stuck into a definitive solution or a shared compromise. Roberto |