r3885 - in trunk: pollen-rest-api pollen-rest-api/src/main/resources pollen-services pollen-services/src/main/java/org/chorem/pollen/services/config pollen-services/src/main/resources pollen-services/src/main/resources/i18n pollen-ui-angular
Author: tchemit Date: 2014-04-29 11:33:33 +0200 (Tue, 29 Apr 2014) New Revision: 3885 Url: http://forge.chorem.org/projects/pollen/repository/revisions/3885 Log: simplify rest-api starting + add some conf Added: trunk/pollen-rest-api/src/main/resources/log4j.properties trunk/pollen-rest-api/src/main/resources/pollen-rest-api.properties trunk/pollen-services/src/main/resources/i18n/ trunk/pollen-services/src/main/resources/i18n/pollen-services_en_GB.properties trunk/pollen-services/src/main/resources/i18n/pollen-services_fr_FR.properties Modified: trunk/pollen-rest-api/README.txt trunk/pollen-rest-api/pom.xml trunk/pollen-services/pom.xml trunk/pollen-services/src/main/java/org/chorem/pollen/services/config/PollenServiceConfig.java trunk/pollen-services/src/main/java/org/chorem/pollen/services/config/PollenServiceConfigOption.java trunk/pollen-ui-angular/pom.xml Modified: trunk/pollen-rest-api/README.txt =================================================================== --- trunk/pollen-rest-api/README.txt 2014-04-29 08:47:41 UTC (rev 3884) +++ trunk/pollen-rest-api/README.txt 2014-04-29 09:33:33 UTC (rev 3885) @@ -1,8 +1,15 @@ -Pour tester les services, lancer mvn tomcat7:run -Ptest +Pour lancer les services, lancer -Une base vierge sera alors créée dans target/pollen +mvn tomcat7:run -Les services seront appelables sur http://localhost:8080/pollen/v1 +ou -Exemple : http://localhost:8080/pollen/v1/polls retourne la liste des -sondages. \ No newline at end of file +mvn jetty:run + +Une base vierge sera alors créée dans target/dd + +Les services seront appelables sur http://localhost:8080/pollen-rest-api/v1 + +Exemple : + +http://localhost:8080/pollen-rest-api/v1/users retourne la liste des utilisateurs. \ No newline at end of file Modified: trunk/pollen-rest-api/pom.xml =================================================================== --- trunk/pollen-rest-api/pom.xml 2014-04-29 08:47:41 UTC (rev 3884) +++ trunk/pollen-rest-api/pom.xml 2014-04-29 09:33:33 UTC (rev 3885) @@ -133,9 +133,11 @@ <i18n.silent>true</i18n.silent> <i18n.bundleOutputName>${pollenI18nBundle}</i18n.bundleOutputName> - <defaultWebContextPath>pollen</defaultWebContextPath> + <defaultWebContextPath>pollen-rest-api</defaultWebContextPath> <defaultLogDir>${basedir}/target</defaultLogDir> <defaultDbDir>${basedir}/target</defaultDbDir> + + <deployFiles>target/${project.build.finalName}.war</deployFiles> </properties> <build> <resources> @@ -143,6 +145,7 @@ <directory>src/main/resources</directory> <includes> <include>**/mapping</include> + <include>**/*.properties</include> </includes> <filtering>true</filtering> </resource> @@ -166,7 +169,7 @@ <value>${defaultLogDir}</value> </systemProperty> <systemProperty> - <name>testDirectory</name> + <name>pollen.data.directory</name> <value>${defaultDbDir}</value> </systemProperty> </systemProperties> @@ -179,7 +182,7 @@ <configuration> <path>/${defaultWebContextPath}</path> <systemProperties> - <testDirectory>${defaultDbDir}</testDirectory> + <pollen.data.directory>${defaultDbDir}</pollen.data.directory> <pollen.log.dir>${defaultLogDir}</pollen.log.dir> </systemProperties> <uriEncoding>UTF-8</uriEncoding> @@ -204,21 +207,15 @@ </build> <profiles> - <profile> - <id>test</id> - <build> - <resources> - <resource> - <directory>src/test/resources</directory> - <includes> - <include>**/*</include> - </includes> - <filtering>true</filtering> - </resource> - </resources> - </build> + <profile> + <!--To deploy the rest-api module (for demo instance)--> + <id>deploy-rest-api</id> + <properties> + <deployFiles>target/${project.build.finalName}.war</deployFiles> + </properties> </profile> + </profiles> </project> Copied: trunk/pollen-rest-api/src/main/resources/log4j.properties (from rev 3879, trunk/pollen-rest-api/src/test/resources/log4j.properties) =================================================================== --- trunk/pollen-rest-api/src/main/resources/log4j.properties (rev 0) +++ trunk/pollen-rest-api/src/main/resources/log4j.properties 2014-04-29 09:33:33 UTC (rev 3885) @@ -0,0 +1,30 @@ +### +# #%L +# Pollen :: Rest Api +# $Id$ +# $HeadURL$ +# %% +# Copyright (C) 2009 - 2013 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% +### +log4j.rootCategory=WARN, console + +log4j.appender.console=org.apache.log4j.ConsoleAppender +log4j.appender.console.layout=org.apache.log4j.PatternLayout +log4j.appender.console.layout.ConversionPattern=%d{hh:mm:ss} %5p (%F:%L) %m%n + +log4j.logger.org.chorem.pollen=INFO +log4j.logger.org.debux=INFO Added: trunk/pollen-rest-api/src/main/resources/pollen-rest-api.properties =================================================================== --- trunk/pollen-rest-api/src/main/resources/pollen-rest-api.properties (rev 0) +++ trunk/pollen-rest-api/src/main/resources/pollen-rest-api.properties 2014-04-29 09:33:33 UTC (rev 3885) @@ -0,0 +1,6 @@ +hibernate.dialect=org.hibernate.dialect.H2Dialect +hibernate.connection.url=jdbc:h2:file:${pollen.data.directory}/db/pollen-rest-api +hibernate.connection.username=sa +hibernate.connection.password=sa +hibernate.connection.driver_class=org.h2.Driver +hibernate.hbm2ddl.auto=update Property changes on: trunk/pollen-rest-api/src/main/resources/pollen-rest-api.properties ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision Added: svn:eol-style + native Modified: trunk/pollen-services/pom.xml =================================================================== --- trunk/pollen-services/pom.xml 2014-04-29 08:47:41 UTC (rev 3884) +++ trunk/pollen-services/pom.xml 2014-04-29 09:33:33 UTC (rev 3885) @@ -130,4 +130,21 @@ </dependencies> + <build> + <plugins> + <plugin> + <groupId>org.nuiton.i18n</groupId> + <artifactId>i18n-maven-plugin</artifactId> + <executions> + <execution> + <goals> + <goal>parserJava</goal> + <goal>gen</goal> + </goals> + </execution> + </executions> + </plugin> + </plugins> + </build> + </project> Modified: trunk/pollen-services/src/main/java/org/chorem/pollen/services/config/PollenServiceConfig.java =================================================================== --- trunk/pollen-services/src/main/java/org/chorem/pollen/services/config/PollenServiceConfig.java 2014-04-29 08:47:41 UTC (rev 3884) +++ trunk/pollen-services/src/main/java/org/chorem/pollen/services/config/PollenServiceConfig.java 2014-04-29 09:33:33 UTC (rev 3885) @@ -66,24 +66,29 @@ throw new PollenTechnicalException(e); } if (log.isInfoEnabled()) { - StringBuilder builder = new StringBuilder("Filename: "+filename); + StringBuilder builder = new StringBuilder("Pollen configuration:"); + builder.append("\nFilename: ").append(filename); List<PollenServiceConfigOption> options = Lists.newArrayList(PollenServiceConfigOption.values()); for (PollenServiceConfigOption option : options) { builder.append(String.format("\n%1$-40s = %2$s", option.getKey(), applicationConfig.getOption(option))); } - log.info("Pollen configuration:" + builder.toString()); + log.info( builder.toString()); } } public Map<String, String> getTopiaProperties() { - Map<String, String> jpaParameters = Maps.newHashMap(); - Properties hibernateProperties = applicationConfig.getOptionStartsWith("hibernate"); - jpaParameters.putAll((Map) hibernateProperties); - Properties topiaProperties = applicationConfig.getOptionStartsWith("topia"); - jpaParameters.putAll((Map) topiaProperties); - return jpaParameters; + Map<String, String> topiaParameters = Maps.newHashMap(); + Properties properties = applicationConfig.getOptionStartsWith("hibernate"); + properties.putAll(applicationConfig.getOptionStartsWith("topia")); + + for (Object o : properties.keySet()) { + String key = String.valueOf(o); + String value = applicationConfig.getOption(String.class, key); + topiaParameters.put(key, value); + } + return topiaParameters; } public boolean isLogConfigurationProvided() { @@ -92,6 +97,10 @@ return logConfigurationProvided; } + public File getDataDirectory() { + return applicationConfig.getOptionAsFile(PollenServiceConfigOption.DATA_DIRECTORY.key); + } + public File getLogConfigurationFile() { return applicationConfig.getOptionAsFile(PollenServiceConfigOption.LOG_CONFIGURATION_FILE.key); } Modified: trunk/pollen-services/src/main/java/org/chorem/pollen/services/config/PollenServiceConfigOption.java =================================================================== --- trunk/pollen-services/src/main/java/org/chorem/pollen/services/config/PollenServiceConfigOption.java 2014-04-29 08:47:41 UTC (rev 3884) +++ trunk/pollen-services/src/main/java/org/chorem/pollen/services/config/PollenServiceConfigOption.java 2014-04-29 09:33:33 UTC (rev 3885) @@ -28,6 +28,8 @@ import org.chorem.pollen.persistence.entity.VoteVisibility; import org.nuiton.config.ConfigOptionDef; +import java.io.File; + import static org.nuiton.i18n.I18n.n; @@ -40,6 +42,16 @@ public enum PollenServiceConfigOption implements ConfigOptionDef { /** + * Where to stroe any data for pollen application. + * + * @since 2.0 + */ + DATA_DIRECTORY( + "pollen.data.directory", + n("pollen.configuration.data.directory"), + "${java.io.tmpdir}/pollen", + File.class), + /** * Default poll type to use at a new poll creation. * * @since 2.0 Added: trunk/pollen-services/src/main/resources/i18n/pollen-services_en_GB.properties =================================================================== --- trunk/pollen-services/src/main/resources/i18n/pollen-services_en_GB.properties (rev 0) +++ trunk/pollen-services/src/main/resources/i18n/pollen-services_en_GB.properties 2014-04-29 09:33:33 UTC (rev 3885) @@ -0,0 +1,11 @@ +pollen.configuration.data.directory= +pollen.configuration.defaultPollCommentVisibility= +pollen.configuration.defaultPollType= +pollen.configuration.defaultPollVoteVisibility= +pollen.configuration.defaultVoteCountingType= +pollen.error.favoriteList.import.csv.already.used.email= +pollen.error.favoriteList.import.csv.already.used.name= +pollen.error.favoriteList.import.csv.invalid.email= +pollen.error.favoriteList.import.ldap.already.used.email= +pollen.error.favoriteList.import.ldap.already.used.name= +pollen.error.favoriteList.import.ldap.invalid.email= Property changes on: trunk/pollen-services/src/main/resources/i18n/pollen-services_en_GB.properties ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision Added: svn:eol-style + native Added: trunk/pollen-services/src/main/resources/i18n/pollen-services_fr_FR.properties =================================================================== --- trunk/pollen-services/src/main/resources/i18n/pollen-services_fr_FR.properties (rev 0) +++ trunk/pollen-services/src/main/resources/i18n/pollen-services_fr_FR.properties 2014-04-29 09:33:33 UTC (rev 3885) @@ -0,0 +1,11 @@ +pollen.configuration.data.directory= +pollen.configuration.defaultPollCommentVisibility= +pollen.configuration.defaultPollType= +pollen.configuration.defaultPollVoteVisibility= +pollen.configuration.defaultVoteCountingType= +pollen.error.favoriteList.import.csv.already.used.email= +pollen.error.favoriteList.import.csv.already.used.name= +pollen.error.favoriteList.import.csv.invalid.email= +pollen.error.favoriteList.import.ldap.already.used.email= +pollen.error.favoriteList.import.ldap.already.used.name= +pollen.error.favoriteList.import.ldap.invalid.email= Property changes on: trunk/pollen-services/src/main/resources/i18n/pollen-services_fr_FR.properties ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision Added: svn:eol-style + native Modified: trunk/pollen-ui-angular/pom.xml =================================================================== --- trunk/pollen-ui-angular/pom.xml 2014-04-29 08:47:41 UTC (rev 3884) +++ trunk/pollen-ui-angular/pom.xml 2014-04-29 09:33:33 UTC (rev 3885) @@ -14,7 +14,7 @@ <groupId>org.chorem.pollen</groupId> <artifactId>pollen-ui-angular</artifactId> - <packaging>pom</packaging> + <packaging>war</packaging> <properties> @@ -86,4 +86,15 @@ </plugins> </build> + <profiles> + + <profile> + <!--To deploy the ui-angular module (for demo instance)--> + <id>deploy-ui-angular</id> + <properties> + <deployFiles>target/${project.build.finalName}.war</deployFiles> + </properties> + </profile> + + </profiles> </project>
participants (1)
-
tchemit@users.chorem.org