r53 - in trunk/echobase-entities/src/main: java/fr/ifremer/echobase resources
Author: tchemit Date: 2011-11-13 23:18:21 +0100 (Sun, 13 Nov 2011) New Revision: 53 Url: http://forge.codelutin.com/repositories/revision/echobase/53 Log: - fix version loading (remove snapshot if any) - add a default h2 configuration (when loading a embedded db) - improve TopiaRootContextSupplierFactory (should remove the supplier this does nothing interesting for us) - fix war location (reuse the data.directory) Added: trunk/echobase-entities/src/main/resources/topia-h2.properties Modified: trunk/echobase-entities/src/main/java/fr/ifremer/echobase/EchoBaseConfiguration.java trunk/echobase-entities/src/main/java/fr/ifremer/echobase/EchoBaseConfigurationOption.java trunk/echobase-entities/src/main/java/fr/ifremer/echobase/EchoBaseTopiaRootContextSupplierFactory.java Modified: trunk/echobase-entities/src/main/java/fr/ifremer/echobase/EchoBaseConfiguration.java =================================================================== --- trunk/echobase-entities/src/main/java/fr/ifremer/echobase/EchoBaseConfiguration.java 2011-11-13 16:37:52 UTC (rev 52) +++ trunk/echobase-entities/src/main/java/fr/ifremer/echobase/EchoBaseConfiguration.java 2011-11-13 22:18:21 UTC (rev 53) @@ -24,7 +24,7 @@ package fr.ifremer.echobase; import com.google.common.base.Preconditions; -import org.apache.commons.lang.builder.ReflectionToStringBuilder; +import org.apache.commons.lang3.builder.ReflectionToStringBuilder; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.nuiton.topia.TopiaContextFactory; @@ -32,6 +32,7 @@ import org.nuiton.util.ArgumentsParserException; import org.nuiton.util.FileUtil; import org.nuiton.util.Version; +import org.nuiton.util.VersionUtil; import java.io.File; import java.io.IOException; @@ -107,7 +108,10 @@ } public Version getApplicationVersion() { - Version v = applicationConfig.getOptionAsVersion(EchoBaseConfigurationOption.VERSION.key); + String versionStr = + applicationConfig.getOption(EchoBaseConfigurationOption.VERSION.key); + String s = VersionUtil.removeSnapshot(versionStr); + Version v = VersionUtil.valueOf(s); Preconditions.checkNotNull(v); return v; } Modified: trunk/echobase-entities/src/main/java/fr/ifremer/echobase/EchoBaseConfigurationOption.java =================================================================== --- trunk/echobase-entities/src/main/java/fr/ifremer/echobase/EchoBaseConfigurationOption.java 2011-11-13 16:37:52 UTC (rev 52) +++ trunk/echobase-entities/src/main/java/fr/ifremer/echobase/EchoBaseConfigurationOption.java 2011-11-13 22:18:21 UTC (rev 53) @@ -52,10 +52,10 @@ "", URL.class), WAR_DIRECTORY("war.directory", "Répertoire où est stoqué le war", - "/var/local/echobase/war", File.class), + "${data.directory}/war", File.class), WAR_LOCATION("war.location", "Chemin complêt d'accès au war", - "${war.directory}/echobase-${project.version}.war", + "${war.directory}/echobase-ui-${project.version}.war", File.class); Modified: trunk/echobase-entities/src/main/java/fr/ifremer/echobase/EchoBaseTopiaRootContextSupplierFactory.java =================================================================== --- trunk/echobase-entities/src/main/java/fr/ifremer/echobase/EchoBaseTopiaRootContextSupplierFactory.java 2011-11-13 16:37:52 UTC (rev 52) +++ trunk/echobase-entities/src/main/java/fr/ifremer/echobase/EchoBaseTopiaRootContextSupplierFactory.java 2011-11-13 22:18:21 UTC (rev 53) @@ -29,7 +29,6 @@ import fr.ifremer.echobase.entities.EchoBaseDAOHelper; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.hibernate.cfg.Environment; import org.nuiton.topia.TopiaContext; import org.nuiton.topia.TopiaContextFactory; import org.nuiton.topia.TopiaNotFoundException; @@ -67,7 +66,7 @@ public Supplier<TopiaContext> newEmbeddedDatabase(File dir) { - File databaseFile = new File(dir, "h2-db"); + File databaseFile = new File(dir, "db"); String databaseAbsolutePath = databaseFile.getAbsolutePath(); @@ -82,8 +81,9 @@ } finally { Closeables.closeQuietly(input); } - properties.setProperty(Environment.URL, - "jdbc:h2:file:" + databaseAbsolutePath); + properties.setProperty( + TopiaContextFactory.CONFIG_URL, + "jdbc:h2:file:" + databaseAbsolutePath + "/echobase"); // add entities to the context properties.setProperty( Added: trunk/echobase-entities/src/main/resources/topia-h2.properties =================================================================== --- trunk/echobase-entities/src/main/resources/topia-h2.properties (rev 0) +++ trunk/echobase-entities/src/main/resources/topia-h2.properties 2011-11-13 22:18:21 UTC (rev 53) @@ -0,0 +1,30 @@ +### +# #%L +# EchoBase :: Entities +# +# $Id$ +# $HeadURL$ +# %% +# Copyright (C) 2011 Ifremer, Codelutin +# %% +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. +# #L% +### +hibernate.hbm2ddl.auto=update +hibernate.show_sql=false + +hibernate.dialect=org.hibernate.dialect.H2Dialect +hibernate.connection.username=sa +hibernate.connection.password=sa +hibernate.connection.driver_class=org.h2.Driver \ No newline at end of file Property changes on: trunk/echobase-entities/src/main/resources/topia-h2.properties ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native
participants (1)
-
tchemit@users.forge.codelutin.com