JR Utily

Merge branch 'infra' into historiqueEditeur

......@@ -17,7 +17,7 @@
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<!-- dependencies version -->
<spring.platform-bom.version>2.0.7.RELEASE</spring.platform-bom.version>
<omnifaces.version>2.5.1</omnifaces.version>
<primefaces.version>6.0</primefaces.version>
......@@ -28,8 +28,40 @@
<rewrite.version>3.4.1.Final</rewrite.version>
<hibernate-commons-annotations.version>5.0.1.Final</hibernate-commons-annotations.version>
<hibernate-jpa-2.1-api.version>1.0.0.Final</hibernate-jpa-2.1-api.version>
<!-- paths -->
<custom.web.dir>src/main/java/org/legrog/web</custom.web.dir>
<!-- misc -->
<debug.jvm.args />
<tomee.autoreload />
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<profiles>
<profile>
<id>debug</id>
<!--
activate this one to be able to attach a remote debbuger on tomee
-->
<properties>
<debug.jvm.args>-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005</debug.jvm.args>
</properties>
</profile>
<profile>
<id>autoreload</id>
<!--
activate this one for tomee to reload (takes times) every times it detect a synchro
reminder : you can always force a reload by typing reload in the console while tomee:run is active
-->
<properties>
<tomee.autoreload>true</tomee.autoreload>
</properties>
</profile>
</profiles>
<dependencyManagement>
<dependencies>
<dependency>
......@@ -81,18 +113,40 @@
</dependency>
<!-- Rewriting tool -->
<dependency>
<groupId>org.ocpsoft.rewrite</groupId>
<artifactId>rewrite-servlet</artifactId>
<version>${rewrite.version}</version>
</dependency>
<!-- Rewriting tool -->
<dependency>
<groupId>org.ocpsoft.rewrite</groupId>
<artifactId>rewrite-integration-faces</artifactId>
<version>${rewrite.version}</version>
</dependency>
<dependency>
<groupId>org.ocpsoft.rewrite</groupId>
<artifactId>rewrite-integration-cdi</artifactId>
<version>${rewrite.version}</version>
</dependency>
<!--<dependency>-->
<!--<groupId>com.ocpsoft</groupId>-->
<!--<artifactId>prettyfaces-jsf2</artifactId>-->
<!--<version>3.3.3</version>-->
<!--<groupId>com.ocpsoft</groupId>-->
<!--<artifactId>prettyfaces-jsf2</artifactId>-->
<!--<version>3.3.3</version>-->
<!--</dependency>-->
<!-- -->
<!--<dependency>-->
<!--<groupId>org.ocpsoft.rewrite</groupId>-->
<!--<artifactId>rewrite-config-prettyfaces</artifactId>-->
<!--<version>${rewrite.version}</version>-->
<!--</dependency> -->
<!-- **** TOOLS : LOGS + UTILS **** -->
<!-- **** TOOLS : LOGS + UTILS **** -->
<dependency>
<groupId>org.slf4j</groupId>
......@@ -117,9 +171,54 @@
<artifactId>spring-data-jpa</artifactId>
</dependency>
<!-- ** Hibernate deps ** -->
<dependency>
<groupId>antlr</groupId>
<artifactId>antlr</artifactId>
</dependency>
<dependency>
<groupId>dom4j</groupId>
<artifactId>dom4j</artifactId>
</dependency>
<dependency>
<groupId>org.hibernate.common</groupId>
<artifactId>hibernate-commons-annotations</artifactId>
<version>${hibernate-commons-annotations.version}</version>
</dependency>
<dependency>
<groupId>org.hibernate.javax.persistence</groupId>
<artifactId>hibernate-jpa-2.1-api</artifactId>
<version>${hibernate-jpa-2.1-api.version}</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-ehcache</artifactId>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-entitymanager</artifactId>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-validator</artifactId>
</dependency>
<dependency>
<groupId>org.jboss.logging</groupId>
<artifactId>jboss-logging</artifactId>
</dependency>
<dependency>
<groupId>org.javassist</groupId>
<artifactId>javassist</artifactId>
</dependency>
<!-- ** Hibernate deps ** -->
<!-- **** TEST SCOPE **** -->
<!-- **** TEST SCOPE **** -->
<dependency>
<groupId>junit</groupId>
......@@ -188,49 +287,7 @@
<scope>test</scope>
</dependency>
-->
<!-- Hibernate -->
<dependency>
<groupId>antlr</groupId>
<artifactId>antlr</artifactId>
</dependency>
<dependency>
<groupId>dom4j</groupId>
<artifactId>dom4j</artifactId>
</dependency>
<dependency>
<groupId>org.hibernate.common</groupId>
<artifactId>hibernate-commons-annotations</artifactId>
<version>${hibernate-commons-annotations.version}</version>
</dependency>
<dependency>
<groupId>org.hibernate.javax.persistence</groupId>
<artifactId>hibernate-jpa-2.1-api</artifactId>
<version>${hibernate-jpa-2.1-api.version}</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-ehcache</artifactId>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-entitymanager</artifactId>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-validator</artifactId>
</dependency>
<dependency>
<groupId>org.jboss.logging</groupId>
<artifactId>jboss-logging</artifactId>
</dependency>
<dependency>
<groupId>org.javassist</groupId>
<artifactId>javassist</artifactId>
</dependency>
</dependencies>
<build>
......@@ -254,7 +311,7 @@
<webResources>
<resource>
<!-- this is relative to the pom.xml directory -->
<directory>src/main/java/org/legrog/web</directory>
<directory>${custom.web.dir}</directory>
<excludes>
<exclude>**/*.java</exclude>
</excludes>
......@@ -264,6 +321,16 @@
</configuration>
</plugin>
<!-- **** TOMEE **** -->
<!-- For now we just get a generic one from the repo and put it in target dir -->
<!-- For production release, we will need another pom doing a real provisionning and build it with grog-cubi already inside -->
<!--
see http://tomee.apache.org/ng/developer/tools/maven/tomee.html
and http://tomee.apache.org/maven/index.html
for conf references (I love when a new reference page doesn't get the same info as the former one)
-->
<plugin>
<groupId>org.apache.tomee.maven</groupId>
<artifactId>tomee-maven-plugin</artifactId>
......@@ -271,9 +338,32 @@
<configuration>
<context>ROOT</context>
<!-- debug agent to attach a remote debbuger, activate profile for that -->
<args>${debug.jvm.args}</args>
<systemVariables>
<!--
taken from http://tomee-openejb.979440.n4.nabble.com/7-0-0-M3-synchronization-td4677806.html for synchro to work
-->
<openejb.system.apps>true</openejb.system.apps>
<tomee.serialization.class.blacklist>-</tomee.serialization.class.blacklist>
</systemVariables>
<synchronization>
<resourcesDir>${custom.web.dir}</resourcesDir>
<extensions>
<extension>.class</extension> <!-- update each time you build with mvn compile -->
<extension>.xhtml</extension> <!-- update each time you save an xhtml in custom web dir -->
</extensions>
</synchronization>
<reloadOnUpdate>${tomee.autoreload}</reloadOnUpdate>
</configuration>
</plugin>
<!--
<plugin>
<groupId>org.apache.openjpa</groupId>
......
package org.legrog.web.xyz;
import javax.inject.Named;
import java.io.Serializable;
@Named
@javax.enterprise.context.RequestScoped
//@URLMapping(id = "testroot", pattern = "/testRoot/#{bar : testRootView.bar}", viewId = "xyz/TestRoot.jsf")
public class TestRootView implements Serializable {
String foo = "my first String";
String bar ="";
//
// public void init() {
// if (number == null) {
// foo = "my second String";
// } else {
// foo = "my string #"+number;
// }
//
// }
public String getFoo() {
return foo;
}
public void setFoo(String foo) {
this.foo = foo;
}
public String getBar() {
return bar;
}
public void setBar(String bar) {
this.bar = bar;
}
}
......@@ -10,12 +10,12 @@
</p>
<p>
And this is my string : #{testRootView.foo}
And this is my string : #{testRouteView.foo}
</p>
<p>
And this is another string : #{testRootView.bar}
And this is another string : #{testRouteView.bar}
</p>
</body>
......
package org.legrog.web.xyz;
import org.ocpsoft.rewrite.annotation.Join;
import org.ocpsoft.rewrite.annotation.Parameter;
import org.ocpsoft.rewrite.annotation.RequestAction;
import org.ocpsoft.rewrite.annotation.RewriteConfiguration;
import org.ocpsoft.rewrite.config.Configuration;
import org.ocpsoft.rewrite.config.ConfigurationBuilder;
import org.ocpsoft.rewrite.el.El;
import org.ocpsoft.rewrite.servlet.config.HttpConfigurationProvider;
import javax.enterprise.context.RequestScoped;
import javax.inject.Named;
import javax.servlet.ServletContext;
import java.io.Serializable;
@Named
@RequestScoped
@Join(path = "/TestRoute/{bar}", to = "/xyz/TestRoute.jsf")
public class TestRouteView implements Serializable {
String foo = "my first String";
@Parameter
String bar;
@RequestAction
public void init() {
if (bar == null) {
foo = "my modified string without bar";
} else {
foo = "my string modified with "+ bar;
}
}
public String getFoo() {
return foo;
}
public void setFoo(String foo) {
this.foo = foo;
}
public String getBar() {
return bar;
}
public void setBar(String bar) {
this.bar = bar;
}
@RewriteConfiguration
public static class RewriteConfig extends HttpConfigurationProvider {
public Configuration getConfiguration(ServletContext context) {
return ConfigurationBuilder.begin()
.addRule(org.ocpsoft.rewrite.servlet.config.rule.Join.path("/TestRoute2/{bar}").to("/xyz/TestRoute.jsf"))
.where("bar").bindsTo(El.property("testRouteView.bar"))
;
}
public int priority() {
return 0;
}
}
}