JR Utily

Merge branch 'infra' into historiqueEditeur

...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
17 17
18 18
19 <properties> 19 <properties>
20 - <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> 20 + <!-- dependencies version -->
21 <spring.platform-bom.version>2.0.7.RELEASE</spring.platform-bom.version> 21 <spring.platform-bom.version>2.0.7.RELEASE</spring.platform-bom.version>
22 <omnifaces.version>2.5.1</omnifaces.version> 22 <omnifaces.version>2.5.1</omnifaces.version>
23 <primefaces.version>6.0</primefaces.version> 23 <primefaces.version>6.0</primefaces.version>
...@@ -28,8 +28,40 @@ ...@@ -28,8 +28,40 @@
28 <rewrite.version>3.4.1.Final</rewrite.version> 28 <rewrite.version>3.4.1.Final</rewrite.version>
29 <hibernate-commons-annotations.version>5.0.1.Final</hibernate-commons-annotations.version> 29 <hibernate-commons-annotations.version>5.0.1.Final</hibernate-commons-annotations.version>
30 <hibernate-jpa-2.1-api.version>1.0.0.Final</hibernate-jpa-2.1-api.version> 30 <hibernate-jpa-2.1-api.version>1.0.0.Final</hibernate-jpa-2.1-api.version>
31 +
32 + <!-- paths -->
33 + <custom.web.dir>src/main/java/org/legrog/web</custom.web.dir>
34 +
35 + <!-- misc -->
36 + <debug.jvm.args />
37 + <tomee.autoreload />
38 + <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
39 +
31 </properties> 40 </properties>
32 41
42 + <profiles>
43 + <profile>
44 + <id>debug</id>
45 + <!--
46 + activate this one to be able to attach a remote debbuger on tomee
47 + -->
48 + <properties>
49 + <debug.jvm.args>-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005</debug.jvm.args>
50 + </properties>
51 + </profile>
52 +
53 + <profile>
54 + <id>autoreload</id>
55 + <!--
56 + activate this one for tomee to reload (takes times) every times it detect a synchro
57 + reminder : you can always force a reload by typing reload in the console while tomee:run is active
58 + -->
59 + <properties>
60 + <tomee.autoreload>true</tomee.autoreload>
61 + </properties>
62 + </profile>
63 + </profiles>
64 +
33 <dependencyManagement> 65 <dependencyManagement>
34 <dependencies> 66 <dependencies>
35 <dependency> 67 <dependency>
...@@ -81,18 +113,40 @@ ...@@ -81,18 +113,40 @@
81 </dependency> 113 </dependency>
82 114
83 115
116 + <!-- Rewriting tool -->
84 117
118 + <dependency>
119 + <groupId>org.ocpsoft.rewrite</groupId>
120 + <artifactId>rewrite-servlet</artifactId>
121 + <version>${rewrite.version}</version>
122 + </dependency>
85 123
86 - <!-- Rewriting tool --> 124 + <dependency>
125 + <groupId>org.ocpsoft.rewrite</groupId>
126 + <artifactId>rewrite-integration-faces</artifactId>
127 + <version>${rewrite.version}</version>
128 + </dependency>
129 +
130 + <dependency>
131 + <groupId>org.ocpsoft.rewrite</groupId>
132 + <artifactId>rewrite-integration-cdi</artifactId>
133 + <version>${rewrite.version}</version>
134 + </dependency>
87 135
88 <!--<dependency>--> 136 <!--<dependency>-->
89 - <!--<groupId>com.ocpsoft</groupId>--> 137 + <!--<groupId>com.ocpsoft</groupId>-->
90 - <!--<artifactId>prettyfaces-jsf2</artifactId>--> 138 + <!--<artifactId>prettyfaces-jsf2</artifactId>-->
91 - <!--<version>3.3.3</version>--> 139 + <!--<version>3.3.3</version>-->
92 <!--</dependency>--> 140 <!--</dependency>-->
93 - <!-- --> 141 + <!--<dependency>-->
142 + <!--<groupId>org.ocpsoft.rewrite</groupId>-->
143 + <!--<artifactId>rewrite-config-prettyfaces</artifactId>-->
144 + <!--<version>${rewrite.version}</version>-->
145 + <!--</dependency> -->
146 +
94 147
95 -<!-- **** TOOLS : LOGS + UTILS **** --> 148 +
149 + <!-- **** TOOLS : LOGS + UTILS **** -->
96 150
97 <dependency> 151 <dependency>
98 <groupId>org.slf4j</groupId> 152 <groupId>org.slf4j</groupId>
...@@ -117,9 +171,54 @@ ...@@ -117,9 +171,54 @@
117 <artifactId>spring-data-jpa</artifactId> 171 <artifactId>spring-data-jpa</artifactId>
118 </dependency> 172 </dependency>
119 173
174 + <!-- ** Hibernate deps ** -->
175 + <dependency>
176 + <groupId>antlr</groupId>
177 + <artifactId>antlr</artifactId>
178 + </dependency>
179 + <dependency>
180 + <groupId>dom4j</groupId>
181 + <artifactId>dom4j</artifactId>
182 + </dependency>
183 + <dependency>
184 + <groupId>org.hibernate.common</groupId>
185 + <artifactId>hibernate-commons-annotations</artifactId>
186 + <version>${hibernate-commons-annotations.version}</version>
187 + </dependency>
188 + <dependency>
189 + <groupId>org.hibernate.javax.persistence</groupId>
190 + <artifactId>hibernate-jpa-2.1-api</artifactId>
191 + <version>${hibernate-jpa-2.1-api.version}</version>
192 + </dependency>
193 + <dependency>
194 + <groupId>org.hibernate</groupId>
195 + <artifactId>hibernate-core</artifactId>
196 + </dependency>
197 + <dependency>
198 + <groupId>org.hibernate</groupId>
199 + <artifactId>hibernate-ehcache</artifactId>
200 + </dependency>
201 + <dependency>
202 + <groupId>org.hibernate</groupId>
203 + <artifactId>hibernate-entitymanager</artifactId>
204 + </dependency>
205 + <dependency>
206 + <groupId>org.hibernate</groupId>
207 + <artifactId>hibernate-validator</artifactId>
208 + </dependency>
209 + <dependency>
210 + <groupId>org.jboss.logging</groupId>
211 + <artifactId>jboss-logging</artifactId>
212 + </dependency>
213 + <dependency>
214 + <groupId>org.javassist</groupId>
215 + <artifactId>javassist</artifactId>
216 + </dependency>
217 + <!-- ** Hibernate deps ** -->
218 +
120 219
121 - <!-- **** TEST SCOPE **** -->
122 220
221 + <!-- **** TEST SCOPE **** -->
123 222
124 <dependency> 223 <dependency>
125 <groupId>junit</groupId> 224 <groupId>junit</groupId>
...@@ -188,49 +287,7 @@ ...@@ -188,49 +287,7 @@
188 <scope>test</scope> 287 <scope>test</scope>
189 </dependency> 288 </dependency>
190 --> 289 -->
191 - <!-- Hibernate --> 290 +
192 - <dependency>
193 - <groupId>antlr</groupId>
194 - <artifactId>antlr</artifactId>
195 - </dependency>
196 - <dependency>
197 - <groupId>dom4j</groupId>
198 - <artifactId>dom4j</artifactId>
199 - </dependency>
200 - <dependency>
201 - <groupId>org.hibernate.common</groupId>
202 - <artifactId>hibernate-commons-annotations</artifactId>
203 - <version>${hibernate-commons-annotations.version}</version>
204 - </dependency>
205 - <dependency>
206 - <groupId>org.hibernate.javax.persistence</groupId>
207 - <artifactId>hibernate-jpa-2.1-api</artifactId>
208 - <version>${hibernate-jpa-2.1-api.version}</version>
209 - </dependency>
210 - <dependency>
211 - <groupId>org.hibernate</groupId>
212 - <artifactId>hibernate-core</artifactId>
213 - </dependency>
214 - <dependency>
215 - <groupId>org.hibernate</groupId>
216 - <artifactId>hibernate-ehcache</artifactId>
217 - </dependency>
218 - <dependency>
219 - <groupId>org.hibernate</groupId>
220 - <artifactId>hibernate-entitymanager</artifactId>
221 - </dependency>
222 - <dependency>
223 - <groupId>org.hibernate</groupId>
224 - <artifactId>hibernate-validator</artifactId>
225 - </dependency>
226 - <dependency>
227 - <groupId>org.jboss.logging</groupId>
228 - <artifactId>jboss-logging</artifactId>
229 - </dependency>
230 - <dependency>
231 - <groupId>org.javassist</groupId>
232 - <artifactId>javassist</artifactId>
233 - </dependency>
234 </dependencies> 291 </dependencies>
235 292
236 <build> 293 <build>
...@@ -254,7 +311,7 @@ ...@@ -254,7 +311,7 @@
254 <webResources> 311 <webResources>
255 <resource> 312 <resource>
256 <!-- this is relative to the pom.xml directory --> 313 <!-- this is relative to the pom.xml directory -->
257 - <directory>src/main/java/org/legrog/web</directory> 314 + <directory>${custom.web.dir}</directory>
258 <excludes> 315 <excludes>
259 <exclude>**/*.java</exclude> 316 <exclude>**/*.java</exclude>
260 </excludes> 317 </excludes>
...@@ -264,6 +321,16 @@ ...@@ -264,6 +321,16 @@
264 321
265 </configuration> 322 </configuration>
266 </plugin> 323 </plugin>
324 +
325 +
326 + <!-- **** TOMEE **** -->
327 + <!-- For now we just get a generic one from the repo and put it in target dir -->
328 + <!-- For production release, we will need another pom doing a real provisionning and build it with grog-cubi already inside -->
329 + <!--
330 + see http://tomee.apache.org/ng/developer/tools/maven/tomee.html
331 + and http://tomee.apache.org/maven/index.html
332 + for conf references (I love when a new reference page doesn't get the same info as the former one)
333 + -->
267 <plugin> 334 <plugin>
268 <groupId>org.apache.tomee.maven</groupId> 335 <groupId>org.apache.tomee.maven</groupId>
269 <artifactId>tomee-maven-plugin</artifactId> 336 <artifactId>tomee-maven-plugin</artifactId>
...@@ -271,9 +338,32 @@ ...@@ -271,9 +338,32 @@
271 <configuration> 338 <configuration>
272 <context>ROOT</context> 339 <context>ROOT</context>
273 340
341 + <!-- debug agent to attach a remote debbuger, activate profile for that -->
342 + <args>${debug.jvm.args}</args>
343 +
344 + <systemVariables>
345 + <!--
346 + taken from http://tomee-openejb.979440.n4.nabble.com/7-0-0-M3-synchronization-td4677806.html for synchro to work
347 + -->
348 + <openejb.system.apps>true</openejb.system.apps>
349 + <tomee.serialization.class.blacklist>-</tomee.serialization.class.blacklist>
350 + </systemVariables>
351 +
352 +
353 + <synchronization>
354 + <resourcesDir>${custom.web.dir}</resourcesDir>
355 + <extensions>
356 + <extension>.class</extension> <!-- update each time you build with mvn compile -->
357 + <extension>.xhtml</extension> <!-- update each time you save an xhtml in custom web dir -->
358 + </extensions>
359 + </synchronization>
360 + <reloadOnUpdate>${tomee.autoreload}</reloadOnUpdate>
274 361
275 </configuration> 362 </configuration>
276 </plugin> 363 </plugin>
364 +
365 +
366 +
277 <!-- 367 <!--
278 <plugin> 368 <plugin>
279 <groupId>org.apache.openjpa</groupId> 369 <groupId>org.apache.openjpa</groupId>
......
1 -package org.legrog.web.xyz;
2 -
3 -import javax.inject.Named;
4 -import java.io.Serializable;
5 -
6 -@Named
7 -@javax.enterprise.context.RequestScoped
8 -//@URLMapping(id = "testroot", pattern = "/testRoot/#{bar : testRootView.bar}", viewId = "xyz/TestRoot.jsf")
9 -public class TestRootView implements Serializable {
10 -
11 - String foo = "my first String";
12 -
13 - String bar ="";
14 -
15 -//
16 -// public void init() {
17 -// if (number == null) {
18 -// foo = "my second String";
19 -// } else {
20 -// foo = "my string #"+number;
21 -// }
22 -//
23 -// }
24 -
25 - public String getFoo() {
26 - return foo;
27 - }
28 -
29 - public void setFoo(String foo) {
30 - this.foo = foo;
31 - }
32 -
33 - public String getBar() {
34 - return bar;
35 - }
36 -
37 - public void setBar(String bar) {
38 - this.bar = bar;
39 - }
40 -}
...@@ -10,12 +10,12 @@ ...@@ -10,12 +10,12 @@
10 </p> 10 </p>
11 11
12 <p> 12 <p>
13 -And this is my string : #{testRootView.foo} 13 +And this is my string : #{testRouteView.foo}
14 </p> 14 </p>
15 15
16 16
17 <p> 17 <p>
18 - And this is another string : #{testRootView.bar} 18 + And this is another string : #{testRouteView.bar}
19 </p> 19 </p>
20 20
21 </body> 21 </body>
......
1 +package org.legrog.web.xyz;
2 +
3 +import org.ocpsoft.rewrite.annotation.Join;
4 +import org.ocpsoft.rewrite.annotation.Parameter;
5 +import org.ocpsoft.rewrite.annotation.RequestAction;
6 +import org.ocpsoft.rewrite.annotation.RewriteConfiguration;
7 +import org.ocpsoft.rewrite.config.Configuration;
8 +import org.ocpsoft.rewrite.config.ConfigurationBuilder;
9 +import org.ocpsoft.rewrite.el.El;
10 +import org.ocpsoft.rewrite.servlet.config.HttpConfigurationProvider;
11 +
12 +import javax.enterprise.context.RequestScoped;
13 +import javax.inject.Named;
14 +import javax.servlet.ServletContext;
15 +import java.io.Serializable;
16 +
17 +@Named
18 +@RequestScoped
19 +@Join(path = "/TestRoute/{bar}", to = "/xyz/TestRoute.jsf")
20 +public class TestRouteView implements Serializable {
21 +
22 + String foo = "my first String";
23 +
24 + @Parameter
25 + String bar;
26 +
27 + @RequestAction
28 + public void init() {
29 + if (bar == null) {
30 + foo = "my modified string without bar";
31 + } else {
32 + foo = "my string modified with "+ bar;
33 + }
34 +
35 + }
36 +
37 + public String getFoo() {
38 + return foo;
39 + }
40 +
41 + public void setFoo(String foo) {
42 + this.foo = foo;
43 + }
44 +
45 + public String getBar() {
46 + return bar;
47 + }
48 +
49 + public void setBar(String bar) {
50 + this.bar = bar;
51 + }
52 +
53 + @RewriteConfiguration
54 + public static class RewriteConfig extends HttpConfigurationProvider {
55 +
56 + public Configuration getConfiguration(ServletContext context) {
57 + return ConfigurationBuilder.begin()
58 + .addRule(org.ocpsoft.rewrite.servlet.config.rule.Join.path("/TestRoute2/{bar}").to("/xyz/TestRoute.jsf"))
59 + .where("bar").bindsTo(El.property("testRouteView.bar"))
60 + ;
61 + }
62 +
63 + public int priority() {
64 + return 0;
65 + }
66 + }
67 +}