Vradi-commits
Threads by month
- ----- 2026 -----
- June
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
May 2011
- 4 participants
- 74 discussions
Author: echatellier
Date: 2011-05-27 14:18:54 +0200 (Fri, 27 May 2011)
New Revision: 62
Url: http://chorem.org/repositories/revision/vradi/62
Log:
Update struts2 jquery plugin
Modified:
trunk/pom.xml
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2011-05-27 12:18:15 UTC (rev 61)
+++ trunk/pom.xml 2011-05-27 12:18:54 UTC (rev 62)
@@ -120,7 +120,7 @@
<javamailVersion>1.4.3</javamailVersion>
<slf4jVersion>1.6.1</slf4jVersion>
<struts2Version>2.2.3</struts2Version>
- <struts2jqueryVersion>3.0.1</struts2jqueryVersion>
+ <struts2jqueryVersion>3.0.2</struts2jqueryVersion>
<servletApiVersion>2.5</servletApiVersion>
<jspApiVersion>2.0</jspApiVersion>
1
0
r61 - in trunk: vradi-entities vradi-services vradi-services-web vradi-swing vradi-web
by echatellier@users.chorem.org 27 May '11
by echatellier@users.chorem.org 27 May '11
27 May '11
Author: echatellier
Date: 2011-05-27 14:18:15 +0200 (Fri, 27 May 2011)
New Revision: 61
Url: http://chorem.org/repositories/revision/vradi/61
Log:
svn:ignore
Modified:
trunk/vradi-entities/
trunk/vradi-services-web/
trunk/vradi-services/
trunk/vradi-swing/
trunk/vradi-web/
Property changes on: trunk/vradi-entities
___________________________________________________________________
Modified: svn:ignore
- *.ipr
*.iws
*.iml
target
solr
*.log
*.log.*
nbactions.xml
.settings
PutObjectStoreDirHere
.project
+ *.ipr
*.iws
*.iml
target
solr
*.log
*.log.*
nbactions.xml
.settings
PutObjectStoreDirHere
.project
.classpath
Property changes on: trunk/vradi-services
___________________________________________________________________
Modified: svn:ignore
- *.ipr
*.iws
*.iml
target
solr
*.log
*.log.*
nbactions.xml
.settings
PutObjectStoreDirHere
.project
+ *.ipr
*.iws
*.iml
target
solr
*.log
*.log.*
nbactions.xml
.settings
PutObjectStoreDirHere
.project
.classpath
Property changes on: trunk/vradi-services-web
___________________________________________________________________
Modified: svn:ignore
- *.ipr
*.iws
*.iml
target
solr
*.log
*.log.*
nbactions.xml
.settings
PutObjectStoreDirHere
.project
+ *.ipr
*.iws
*.iml
target
solr
*.log
*.log.*
nbactions.xml
.settings
PutObjectStoreDirHere
.project
.classpath
Property changes on: trunk/vradi-swing
___________________________________________________________________
Modified: svn:ignore
- *.ipr
*.iws
*.iml
target
solr
*.log
*.log.*
nbactions.xml
.settings
PutObjectStoreDirHere
.project
+ *.ipr
*.iws
*.iml
target
solr
*.log
*.log.*
nbactions.xml
.settings
PutObjectStoreDirHere
.project
.classpath
Property changes on: trunk/vradi-web
___________________________________________________________________
Modified: svn:ignore
- *.ipr
*.iws
*.iml
target
solr
*.log
*.log.*
nbactions.xml
.settings
PutObjectStoreDirHere
.project
+ *.ipr
*.iws
*.iml
target
solr
*.log
*.log.*
nbactions.xml
.settings
PutObjectStoreDirHere
.project
.classpath
1
0
Author: echatellier
Date: 2011-05-27 14:09:21 +0200 (Fri, 27 May 2011)
New Revision: 60
Url: http://chorem.org/repositories/revision/vradi/60
Log:
Fix sitemesh configuration
Removed:
trunk/vradi-web/src/main/webapp/WEB-INF/sitemesh.xml
Modified:
trunk/vradi-web/src/main/webapp/WEB-INF/decorators.xml
trunk/vradi-web/src/main/webapp/WEB-INF/web.xml
Modified: trunk/vradi-web/src/main/webapp/WEB-INF/decorators.xml
===================================================================
--- trunk/vradi-web/src/main/webapp/WEB-INF/decorators.xml 2011-05-27 09:38:29 UTC (rev 59)
+++ trunk/vradi-web/src/main/webapp/WEB-INF/decorators.xml 2011-05-27 12:09:21 UTC (rev 60)
@@ -6,7 +6,7 @@
<pattern>/img/*</pattern>
<pattern>/css/*</pattern>
<pattern>/WEB-INF/jsp/inc/*</pattern>
- <pattern>index.html</pattern>
+ <pattern>/index.html</pattern>
</excludes>
<!-- Any urls that are excluded will never be decorated by Sitemesh -->
Deleted: trunk/vradi-web/src/main/webapp/WEB-INF/sitemesh.xml
===================================================================
--- trunk/vradi-web/src/main/webapp/WEB-INF/sitemesh.xml 2011-05-27 09:38:29 UTC (rev 59)
+++ trunk/vradi-web/src/main/webapp/WEB-INF/sitemesh.xml 2011-05-27 12:09:21 UTC (rev 60)
@@ -1,55 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-
-<sitemesh>
- <property name="decorators-file" value="/WEB-INF/decorators.xml"/>
- <excludes file="${decorators-file}"/>
-
- <page-parsers>
- <parser content-type="text/html"
- class="com.opensymphony.module.sitemesh.parser.HTMLPageParser"/>
- <parser content-type="text/html;charset=ISO-8859-1"
- class="com.opensymphony.module.sitemesh.parser.HTMLPageParser" />
- <parser content-type="text/html; charset=UTF-8"
- class="com.opensymphony.module.sitemesh.parser.HTMLPageParser" />
- </page-parsers>
-
- <decorator-mappers>
-
- <mapper class="com.opensymphony.module.sitemesh.mapper.PageDecoratorMapper">
- <param name="property.1" value="meta.decorator"/>
- <param name="property.2" value="decorator"/>
- </mapper>
-
- <mapper class="com.opensymphony.module.sitemesh.mapper.FrameSetDecoratorMapper">
- </mapper>
-
- <mapper class="com.opensymphony.module.sitemesh.mapper.AgentDecoratorMapper">
- <param name="match.MSIE" value="ie"/>
- <param name="match.Mozilla [" value="ns"/>
- <param name="match.Opera" value="opera"/>
- <param name="match.Lynx" value="lynx"/>
- </mapper>
-
- <mapper class="com.opensymphony.module.sitemesh.mapper.PrintableDecoratorMapper">
- <param name="decorator" value="printable"/>
- <param name="parameter.name" value="printable"/>
- <param name="parameter.value" value="true"/>
- </mapper>
-
- <mapper class="com.opensymphony.module.sitemesh.mapper.RobotDecoratorMapper">
- <param name="decorator" value="robot"/>
- </mapper>
-
- <mapper class="com.opensymphony.module.sitemesh.mapper.ParameterDecoratorMapper">
- <param name="decorator.parameter" value="decorator"/>
- <param name="parameter.name" value="confirm"/>
- <param name="parameter.value" value="true"/>
- </mapper>
-
- <mapper class="com.opensymphony.module.sitemesh.mapper.ConfigDecoratorMapper">
- <param name="config" value="${decorators-file}"/>
- </mapper>
-
- </decorator-mappers>
-
-</sitemesh>
Modified: trunk/vradi-web/src/main/webapp/WEB-INF/web.xml
===================================================================
--- trunk/vradi-web/src/main/webapp/WEB-INF/web.xml 2011-05-27 09:38:29 UTC (rev 59)
+++ trunk/vradi-web/src/main/webapp/WEB-INF/web.xml 2011-05-27 12:09:21 UTC (rev 60)
@@ -1,24 +1,46 @@
<?xml version="1.0" encoding="UTF-8"?>
-<web-app id="vradi" version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
+<web-app version="2.5"
+ xmlns="http://java.sun.com/xml/ns/javaee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
+
<display-name>Vradi</display-name>
- <!-- Filters -->
- <!--filter>
- <filter-name>sitemesh</filter-name>
- <filter-class>com.opensymphony.sitemesh.webapp.SiteMeshFilter</filter-class>
- </filter-->
+
<filter>
- <filter-name>struts2</filter-name>
- <filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
+ <filter-name>struts-prepare</filter-name>
+ <filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareFilter</filter-class>
</filter>
- <!--filter-mapping>
- <filter-name>sitemesh</filter-name>
- <url-pattern>/*</url-pattern>
- </filter-mapping-->
+
+ <filter>
+ <filter-name>struts-execute</filter-name>
+ <filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsExecuteFilter</filter-class>
+ </filter>
+
+ <filter>
+ <filter-name>sitemesh</filter-name>
+ <filter-class>com.opensymphony.sitemesh.webapp.SiteMeshFilter</filter-class>
+ </filter>
+
<filter-mapping>
- <filter-name>struts2</filter-name>
+ <filter-name>struts-prepare</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
+
+ <filter-mapping>
+ <filter-name>sitemesh</filter-name>
+ <url-pattern>/*</url-pattern>
+ </filter-mapping>
+
+ <filter-mapping>
+ <filter-name>struts-execute</filter-name>
+ <url-pattern>/*</url-pattern>
+ </filter-mapping>
+
+ <listener>
+ <listener-class>org.apache.struts2.dispatcher.ng.listener.StrutsListener</listener-class>
+ </listener>
+
<!-- Welcome file lists -->
<welcome-file-list>
<welcome-file>index.html</welcome-file>
1
0
r59 - in trunk: . vradi-web vradi-web/src/main/java/org/chorem/vradi vradi-web/src/main/java/org/chorem/vradi/actions vradi-web/src/main/resources vradi-web/src/main/resources/i18n vradi-web/src/main/webapp/WEB-INF vradi-web/src/main/webapp/WEB-INF/jsp vradi-web/src/main/webapp/WEB-INF/jsp/decorators vradi-web/src/main/webapp/WEB-INF/jsp/inc vradi-web/src/main/webapp/css
by sletellier@users.chorem.org 27 May '11
by sletellier@users.chorem.org 27 May '11
27 May '11
Author: sletellier
Date: 2011-05-27 11:38:29 +0200 (Fri, 27 May 2011)
New Revision: 59
Url: http://chorem.org/repositories/revision/vradi/59
Log:
Failed to use sitemesh :(
Added:
trunk/vradi-web/src/main/java/org/chorem/vradi/actions/LocaleAction.java
trunk/vradi-web/src/main/webapp/WEB-INF/decorators.xml
trunk/vradi-web/src/main/webapp/WEB-INF/jsp/decorators/
trunk/vradi-web/src/main/webapp/WEB-INF/jsp/decorators/main.jsp
trunk/vradi-web/src/main/webapp/WEB-INF/jsp/inc/
trunk/vradi-web/src/main/webapp/WEB-INF/jsp/inc/errorFrame.jsp
trunk/vradi-web/src/main/webapp/WEB-INF/jsp/inc/footer.jsp
trunk/vradi-web/src/main/webapp/WEB-INF/jsp/inc/header.jsp
trunk/vradi-web/src/main/webapp/WEB-INF/sitemesh.xml
trunk/vradi-web/src/main/webapp/css/global.css
Modified:
trunk/pom.xml
trunk/vradi-web/pom.xml
trunk/vradi-web/src/main/java/org/chorem/vradi/VradiSession.java
trunk/vradi-web/src/main/resources/i18n/vradi-web_en_GB.properties
trunk/vradi-web/src/main/resources/i18n/vradi-web_fr_FR.properties
trunk/vradi-web/src/main/resources/log4j.properties
trunk/vradi-web/src/main/resources/struts.xml
trunk/vradi-web/src/main/webapp/WEB-INF/jsp/login.jsp
trunk/vradi-web/src/main/webapp/WEB-INF/jsp/search.jsp
trunk/vradi-web/src/main/webapp/WEB-INF/web.xml
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2011-05-27 09:22:54 UTC (rev 58)
+++ trunk/pom.xml 2011-05-27 09:38:29 UTC (rev 59)
@@ -465,6 +465,12 @@
<version>${struts2Version}</version>
</dependency>
+ <dependency>
+ <groupId>org.apache.struts</groupId>
+ <artifactId>struts2-sitemesh-plugin</artifactId>
+ <version>${struts2Version}</version>
+ </dependency>
+
<!-- Displaytag -->
<dependency>
<groupId>displaytag</groupId>
Modified: trunk/vradi-web/pom.xml
===================================================================
--- trunk/vradi-web/pom.xml 2011-05-27 09:22:54 UTC (rev 58)
+++ trunk/vradi-web/pom.xml 2011-05-27 09:38:29 UTC (rev 59)
@@ -123,6 +123,12 @@
<artifactId>xwork-core</artifactId>
</dependency>
+ <dependency>
+ <groupId>org.apache.struts</groupId>
+ <artifactId>struts2-sitemesh-plugin</artifactId>
+ <scope>runtime</scope>
+ </dependency>
+
<!-- Displaytag -->
<dependency>
<groupId>displaytag</groupId>
@@ -260,6 +266,9 @@
<sj>http://java.sun.com/xml/ns/j2ee/web-jsptaglibrary_2_0.xsd</sj>
<displaytag>http://displaytag.sourceforge.net/1.2/#displaytag.tld</displaytag>
<jsp>http://java.sun.com/JSP/Page</jsp>
+ <decorator>
+ http://www.opensymphony.com/sitemesh/decorator
+ </decorator>
</namespaces>
</configuration>
</execution>
Modified: trunk/vradi-web/src/main/java/org/chorem/vradi/VradiSession.java
===================================================================
--- trunk/vradi-web/src/main/java/org/chorem/vradi/VradiSession.java 2011-05-27 09:22:54 UTC (rev 58)
+++ trunk/vradi-web/src/main/java/org/chorem/vradi/VradiSession.java 2011-05-27 09:38:29 UTC (rev 59)
@@ -1,6 +1,5 @@
package org.chorem.vradi;
-import java.util.Locale;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
@@ -8,16 +7,8 @@
import org.apache.commons.logging.LogFactory;
import org.chorem.vradi.entities.VradiUser;
import org.chorem.vradi.services.VradiDataService;
-import org.chorem.vradi.services.VradiDataServiceImpl;
import org.chorem.vradi.services.VradiServiceFactory;
-import org.nuiton.i18n.I18n;
-import org.nuiton.i18n.init.DefaultI18nInitializer;
import org.nuiton.util.ApplicationConfig;
-import org.nuiton.wikitty.WikittyConfigOption;
-import org.nuiton.wikitty.WikittyProxy;
-import org.nuiton.wikitty.WikittyService;
-import org.nuiton.wikitty.WikittyServiceFactory;
-import org.nuiton.wikitty.entities.WikittyUser;
/**
* Classe utilisee pour stocker les objets utils en session utilisateur
@@ -47,7 +38,7 @@
// on refait l'init :( ? et surtout il faut que
// chaque user est sa propre langue.
// init I18n
- I18n.init(new DefaultI18nInitializer("vradi-i18n", getClass().getClassLoader(), "/"), null);
+// I18n.init(new DefaultI18nInitializer("vradi-i18n", getClass().getClassLoader(), "/"), null);
}
/**
Added: trunk/vradi-web/src/main/java/org/chorem/vradi/actions/LocaleAction.java
===================================================================
--- trunk/vradi-web/src/main/java/org/chorem/vradi/actions/LocaleAction.java (rev 0)
+++ trunk/vradi-web/src/main/java/org/chorem/vradi/actions/LocaleAction.java 2011-05-27 09:38:29 UTC (rev 59)
@@ -0,0 +1,12 @@
+package org.chorem.vradi.actions;
+
+/**
+ * @author sletellier
+ */
+public class LocaleAction extends VradiBaseAction {
+ private static final long serialVersionUID = 9124549040894568467L;
+
+ public String execute() {
+ return SUCCESS;
+ }
+}
Modified: trunk/vradi-web/src/main/resources/i18n/vradi-web_en_GB.properties
===================================================================
--- trunk/vradi-web/src/main/resources/i18n/vradi-web_en_GB.properties 2011-05-27 09:22:54 UTC (rev 58)
+++ trunk/vradi-web/src/main/resources/i18n/vradi-web_en_GB.properties 2011-05-27 09:38:29 UTC (rev 59)
@@ -14,7 +14,7 @@
vradi.login.email=Email
vradi.login.password=Password
vradi.login.repeatPassword=Confirm
-vradi.login.submit=Please retape your password
+vradi.login.submit=Connection
vradi.login.title=Connection
vradi.register.mailEmail=Your email
vradi.register.mailHi=Hello
@@ -26,4 +26,10 @@
vradi.search.title=Search
vradi.form.object=Object
vradi.form.creationDate=Creation date
-vradi.search.formNoteEdit=Notes edition
\ No newline at end of file
+vradi.search.formNoteEdit=Notes edition
+vradi.title=Vradi Web
+vradi.footer.license=Licence AGPL
+vradi.footer.bugreport=Bug report
+vradi.footer.userSupport=User support
+vradi.action.locale.english=English
+vradi.action.locale.french=French
\ No newline at end of file
Modified: trunk/vradi-web/src/main/resources/i18n/vradi-web_fr_FR.properties
===================================================================
--- trunk/vradi-web/src/main/resources/i18n/vradi-web_fr_FR.properties 2011-05-27 09:22:54 UTC (rev 58)
+++ trunk/vradi-web/src/main/resources/i18n/vradi-web_fr_FR.properties 2011-05-27 09:38:29 UTC (rev 59)
@@ -1,3 +1,5 @@
+vradi.action.locale.english=Anglais
+vradi.action.locale.french=Français
vradi.authentification.error=Erreur lors de l'authentification
vradi.config.configFileName.description=Fichier de configuration de Vradi web
vradi.config.database.version.description=Version de la base de donnée
@@ -6,6 +8,9 @@
vradi.config.ui.locale=Locale de l'instance de Vradi web
vradi.config.version.description=Version de Vradi web
vradi.error.internal=Une erreur interne est survenue, merci de contacter un administrateur si cette erreur persiste
+vradi.footer.bugreport=Rapport de bug
+vradi.footer.license=Licence AGPL
+vradi.footer.userSupport=Support utilisateur
vradi.forgotPassword.emailDoesntExist=Cette adresse email n'existe pas
vradi.forgotpwd.submit=Envoyer
vradi.forgotpwd.title=Vous avez oublié votre mot de passe ?
@@ -14,7 +19,7 @@
vradi.login.email=Email
vradi.login.password=Mot de passe
vradi.login.repeatPassword=Confiramtion
-vradi.login.submit=Veuillez retaper votre mot de passe
+vradi.login.submit=Connection
vradi.login.title=Connection
vradi.register.emailAldyUsed=Cette adresse email est déjà utilisée
vradi.register.invalidLogin=Une erreur s'est produite pendant l'enregistrement de vos informations, merci d'essayer à nouveau
@@ -28,3 +33,4 @@
vradi.search.formNoteEdit=Edition des notes
vradi.search.submit=Rechercher
vradi.search.title=Recherche
+vradi.title=Vradi Web
Modified: trunk/vradi-web/src/main/resources/log4j.properties
===================================================================
--- trunk/vradi-web/src/main/resources/log4j.properties 2011-05-27 09:22:54 UTC (rev 58)
+++ trunk/vradi-web/src/main/resources/log4j.properties 2011-05-27 09:38:29 UTC (rev 59)
@@ -10,3 +10,5 @@
log4j.logger.org.chorem.vradi=DEBUG
#log4j.logger.org.nuiton.util.TimeLog=WARN
log4j.logger.org.apache.struts2.dispatcher.mapper=DEBUG
+log4j.logger.com.opensymphony.sitemesh=DEBUG
+
Modified: trunk/vradi-web/src/main/resources/struts.xml
===================================================================
--- trunk/vradi-web/src/main/resources/struts.xml 2011-05-27 09:22:54 UTC (rev 58)
+++ trunk/vradi-web/src/main/resources/struts.xml 2011-05-27 09:38:29 UTC (rev 59)
@@ -90,6 +90,17 @@
</package>
<package name="misc" extends="restrictedArea">
+
+ <!--
+ | Change local
+ +-->
+ <action name="locale" class="org.chorem.vradi.actions.LocaleAction">
+ <result type="redirect">search.action</result>
+ </action>
+
+ <!--
+ | Search
+ +-->
<action name="search" class="org.chorem.vradi.actions.SearchAction">
<result>/WEB-INF/jsp/search.jsp</result>
<result name="input" type="redirectAction">search</result>
Added: trunk/vradi-web/src/main/webapp/WEB-INF/decorators.xml
===================================================================
--- trunk/vradi-web/src/main/webapp/WEB-INF/decorators.xml (rev 0)
+++ trunk/vradi-web/src/main/webapp/WEB-INF/decorators.xml 2011-05-27 09:38:29 UTC (rev 59)
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<decorators defaultdir="/WEB-INF/jsp/decorators">
+ <!-- Any urls that are excluded will never be decorated by Sitemesh -->
+ <excludes>
+ <pattern>/img/*</pattern>
+ <pattern>/css/*</pattern>
+ <pattern>/WEB-INF/jsp/inc/*</pattern>
+ <pattern>index.html</pattern>
+ </excludes>
+
+ <!-- Any urls that are excluded will never be decorated by Sitemesh -->
+ <decorator name="main" page="main.jsp">
+ <pattern>/*</pattern>
+ </decorator>
+
+</decorators>
Added: trunk/vradi-web/src/main/webapp/WEB-INF/jsp/decorators/main.jsp
===================================================================
--- trunk/vradi-web/src/main/webapp/WEB-INF/jsp/decorators/main.jsp (rev 0)
+++ trunk/vradi-web/src/main/webapp/WEB-INF/jsp/decorators/main.jsp 2011-05-27 09:38:29 UTC (rev 59)
@@ -0,0 +1,29 @@
+<%@page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
+<%@taglib prefix="decorator" uri="http://www.opensymphony.com/sitemesh/decorator" %>
+<%@taglib prefix="page" uri="http://www.opensymphony.com/sitemesh/page" %>
+<%@taglib prefix="s" uri="/struts-tags" %>
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:s="http://java.sun.com/xml/ns/j2ee/web-jsptaglibrary_2_0.xsd"
+ xmlns:jsp="http://java.sun.com/JSP/Page"
+ xmlns:decorator="http://www.opensymphony.com/sitemesh/decorator">
+ <head>
+ <title>Vradi web : <decorator:title default="Vradi web" /></title>
+ <decorator:head />
+ <meta http-equiv="content-type" content="text/html; charset=UTF-8" />
+ <s:url var="globalCSS" value="/css/global.css" />
+ <link href="${globalCSS}" rel="stylesheet" type="text/css" media="all" />
+ </head>
+ <body id="page-home">
+ <script type="text/javascript">window.status = "Loading: <decorator:title default="Vradi web" />...";</script>
+ <div id="wrap">
+ <div id="page">
+ <%@include file="/WEB-INF/jsp/inc/header.jsp" %>
+ <div id="main">
+ <%@include file="/WEB-INF/jsp/inc/errorFrame.jsp" %>
+ <decorator:body />
+ </div>
+ </div>
+ </div>
+ <%@include file="/WEB-INF/jsp/inc/footer.jsp" %>
+ </body>
+</html>
\ No newline at end of file
Added: trunk/vradi-web/src/main/webapp/WEB-INF/jsp/inc/errorFrame.jsp
===================================================================
--- trunk/vradi-web/src/main/webapp/WEB-INF/jsp/inc/errorFrame.jsp (rev 0)
+++ trunk/vradi-web/src/main/webapp/WEB-INF/jsp/inc/errorFrame.jsp 2011-05-27 09:38:29 UTC (rev 59)
@@ -0,0 +1,13 @@
+<%@page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
+
+ <%
+ String userError = (String)request.getAttribute("errorMsgUser");
+ String techError = (String)request.getAttribute("errorMsgTech");
+
+ if (userError != null) {
+ %>
+ <div class="menu clearfix">
+ <h2>Error</h2>
+ </div>
+ <pre class="error"><%=userError%><% if (techError != null) { %><br /><br />Detailed error :<br /><%=techError%><% } %></pre>
+ <% } %>
Added: trunk/vradi-web/src/main/webapp/WEB-INF/jsp/inc/footer.jsp
===================================================================
--- trunk/vradi-web/src/main/webapp/WEB-INF/jsp/inc/footer.jsp (rev 0)
+++ trunk/vradi-web/src/main/webapp/WEB-INF/jsp/inc/footer.jsp 2011-05-27 09:38:29 UTC (rev 59)
@@ -0,0 +1,24 @@
+<%@page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
+<%@taglib prefix="s" uri="/struts-tags" %>
+
+<div id="footer"
+ xmlns:s="http://java.sun.com/xml/ns/j2ee/web-jsptaglibrary_2_0.xsd"
+ xmlns:jsp="http://java.sun.com/JSP/Page">
+ <p>
+ <a shape="rect" href="http://www.chorem.org/projects/show/vradi">Vradi</a>
+ <a shape="rect" href="http://www.chorem.org/projects/list_files/vradi"></a> -
+ <a shape="rect" href="http://www.gnu.org/licenses/agpl.html"><s:text name="vradi.footer.license" /></a> -
+ <span title="Copyright">©2011</span>
+ <a shape="rect" href="http://www.codelutin.com">Code Lutin</a> -
+ <a shape="rect" href="http://www.chorem.org/projects/vradi/issues"><s:text name="vradi.footer.bugreport" /></a> -
+ <a shape="rect" href="http://list.chorem.org/cgi-bin/mailman/listinfo/vradi-users"><s:text name="vradi.footer.userSupport" /></a> -
+ <s:url var="localeEN">
+ <s:param name="request_locale">en_GB</s:param>
+ </s:url>
+ <s:url var="localeFR">
+ <s:param name="request_locale">fr_FR</s:param>
+ </s:url>
+ <s:a href="%{localeEN}"><s:text name="vradi.action.locale.english" /></s:a> -
+ <s:a href="%{localeFR}"><s:text name="vradi.action.locale.french" /></s:a>
+ </p>
+</div>
\ No newline at end of file
Added: trunk/vradi-web/src/main/webapp/WEB-INF/jsp/inc/header.jsp
===================================================================
--- trunk/vradi-web/src/main/webapp/WEB-INF/jsp/inc/header.jsp (rev 0)
+++ trunk/vradi-web/src/main/webapp/WEB-INF/jsp/inc/header.jsp 2011-05-27 09:38:29 UTC (rev 59)
@@ -0,0 +1,17 @@
+<%@page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
+<%@taglib prefix="s" uri="/struts-tags" %>
+<div id="header"
+ xmlns:s="http://java.sun.com/xml/ns/j2ee/web-jsptaglibrary_2_0.xsd"
+ xmlns:jsp="http://java.sun.com/JSP/Page">
+ <div>
+ <title><s:text name="vradi.title" /></title>
+ </div>
+ <div id="msg">
+ <span id="actionmessageHeader">
+ <s:actionmessage />
+ </span>
+ <span id="actionerrorHeader">
+ <s:actionerror />
+ </span>
+ </div>
+</div>
Modified: trunk/vradi-web/src/main/webapp/WEB-INF/jsp/login.jsp
===================================================================
--- trunk/vradi-web/src/main/webapp/WEB-INF/jsp/login.jsp 2011-05-27 09:22:54 UTC (rev 58)
+++ trunk/vradi-web/src/main/webapp/WEB-INF/jsp/login.jsp 2011-05-27 09:38:29 UTC (rev 59)
@@ -12,14 +12,15 @@
<div id="formFrame" class="fond">
<h1><s:text name="vradi.login.title" /></h1>
<br/>
- <br/>
<s:actionerror />
- <s:form action="login">
- <s:textfield key="vradi.login.email" name="email" labelposition="top" labelSeparator=" :" />
- <s:password key="vradi.login.password" name="password" labelposition="top" labelSeparator=" :" />
+ <s:form action="login" theme="simple">
+ <s:text name="vradi.login.email"/><br/>
+ <s:textfield name="email" labelposition="top" labelSeparator=" :" /><br/>
+ <s:text name="vradi.login.password"/><br/>
+ <s:password name="password" labelposition="top" labelSeparator=" :" /><br/>
<s:submit key="vradi.login.submit" name="submit" />
</s:form>
- <s:a action="register_input" id="registerLink"><s:text name="vradi.register.title" /></s:a><br />
+ <s:a action="register_input" id="registerLink"><s:text name="vradi.register.title" /></s:a><br/>
<s:a action="forgotPassword_input" id="forgotPwd"><s:text name="vradi.forgotpwd.title" /></s:a>
</div>
</div>
Modified: trunk/vradi-web/src/main/webapp/WEB-INF/jsp/search.jsp
===================================================================
--- trunk/vradi-web/src/main/webapp/WEB-INF/jsp/search.jsp 2011-05-27 09:22:54 UTC (rev 58)
+++ trunk/vradi-web/src/main/webapp/WEB-INF/jsp/search.jsp 2011-05-27 09:38:29 UTC (rev 59)
@@ -14,8 +14,8 @@
<s:head />
</head>
<body>
- <s:form id="searchForm" action="search" method="post">
- <s:textarea id="searchArea" name="query"/>
+ <s:form id="searchForm" action="search" method="post" theme="simple">
+ <s:textarea id="searchArea" name="query"/><br/>
<s:submit key="vradi.search.submit" name="submit"/>
</s:form>
<displaytag:table name="forms"
Added: trunk/vradi-web/src/main/webapp/WEB-INF/sitemesh.xml
===================================================================
--- trunk/vradi-web/src/main/webapp/WEB-INF/sitemesh.xml (rev 0)
+++ trunk/vradi-web/src/main/webapp/WEB-INF/sitemesh.xml 2011-05-27 09:38:29 UTC (rev 59)
@@ -0,0 +1,55 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+
+<sitemesh>
+ <property name="decorators-file" value="/WEB-INF/decorators.xml"/>
+ <excludes file="${decorators-file}"/>
+
+ <page-parsers>
+ <parser content-type="text/html"
+ class="com.opensymphony.module.sitemesh.parser.HTMLPageParser"/>
+ <parser content-type="text/html;charset=ISO-8859-1"
+ class="com.opensymphony.module.sitemesh.parser.HTMLPageParser" />
+ <parser content-type="text/html; charset=UTF-8"
+ class="com.opensymphony.module.sitemesh.parser.HTMLPageParser" />
+ </page-parsers>
+
+ <decorator-mappers>
+
+ <mapper class="com.opensymphony.module.sitemesh.mapper.PageDecoratorMapper">
+ <param name="property.1" value="meta.decorator"/>
+ <param name="property.2" value="decorator"/>
+ </mapper>
+
+ <mapper class="com.opensymphony.module.sitemesh.mapper.FrameSetDecoratorMapper">
+ </mapper>
+
+ <mapper class="com.opensymphony.module.sitemesh.mapper.AgentDecoratorMapper">
+ <param name="match.MSIE" value="ie"/>
+ <param name="match.Mozilla [" value="ns"/>
+ <param name="match.Opera" value="opera"/>
+ <param name="match.Lynx" value="lynx"/>
+ </mapper>
+
+ <mapper class="com.opensymphony.module.sitemesh.mapper.PrintableDecoratorMapper">
+ <param name="decorator" value="printable"/>
+ <param name="parameter.name" value="printable"/>
+ <param name="parameter.value" value="true"/>
+ </mapper>
+
+ <mapper class="com.opensymphony.module.sitemesh.mapper.RobotDecoratorMapper">
+ <param name="decorator" value="robot"/>
+ </mapper>
+
+ <mapper class="com.opensymphony.module.sitemesh.mapper.ParameterDecoratorMapper">
+ <param name="decorator.parameter" value="decorator"/>
+ <param name="parameter.name" value="confirm"/>
+ <param name="parameter.value" value="true"/>
+ </mapper>
+
+ <mapper class="com.opensymphony.module.sitemesh.mapper.ConfigDecoratorMapper">
+ <param name="config" value="${decorators-file}"/>
+ </mapper>
+
+ </decorator-mappers>
+
+</sitemesh>
Modified: trunk/vradi-web/src/main/webapp/WEB-INF/web.xml
===================================================================
--- trunk/vradi-web/src/main/webapp/WEB-INF/web.xml 2011-05-27 09:22:54 UTC (rev 58)
+++ trunk/vradi-web/src/main/webapp/WEB-INF/web.xml 2011-05-27 09:38:29 UTC (rev 59)
@@ -1,34 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
-<!--
- #%L
- bow
- $Id: web.xml 280 2011-05-05 09:32:39Z echatellier $
- $HeadURL: http://svn.chorem.org/svn/bow/trunk/bow-ui/src/main/webapp/WEB-INF/web.xml $
- %%
- Copyright (C) 2010 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%
- -->
-<web-app id="bow" version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
- <display-name>Bow</display-name>
+<web-app id="vradi" version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
+ <display-name>Vradi</display-name>
<!-- Filters -->
+ <!--filter>
+ <filter-name>sitemesh</filter-name>
+ <filter-class>com.opensymphony.sitemesh.webapp.SiteMeshFilter</filter-class>
+ </filter-->
<filter>
<filter-name>struts2</filter-name>
<filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
</filter>
+ <!--filter-mapping>
+ <filter-name>sitemesh</filter-name>
+ <url-pattern>/*</url-pattern>
+ </filter-mapping-->
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/*</url-pattern>
1
0
Author: sletellier
Date: 2011-05-27 11:22:54 +0200 (Fri, 27 May 2011)
New Revision: 58
Url: http://chorem.org/repositories/revision/vradi/58
Log:
Delete unused dir
Removed:
trunk/vradi-web/src/main/webapp/jsp/
1
0
27 May '11
Author: sletellier
Date: 2011-05-27 09:44:09 +0200 (Fri, 27 May 2011)
New Revision: 57
Url: http://chorem.org/repositories/revision/vradi/57
Log:
Retrieve index.html
Added:
trunk/vradi-web/src/main/webapp/index.html
Modified:
trunk/vradi-web/src/main/webapp/WEB-INF/web.xml
Modified: trunk/vradi-web/src/main/webapp/WEB-INF/web.xml
===================================================================
--- trunk/vradi-web/src/main/webapp/WEB-INF/web.xml 2011-05-26 15:11:59 UTC (rev 56)
+++ trunk/vradi-web/src/main/webapp/WEB-INF/web.xml 2011-05-27 07:44:09 UTC (rev 57)
@@ -35,6 +35,6 @@
</filter-mapping>
<!-- Welcome file lists -->
<welcome-file-list>
- <welcome-file>search.action</welcome-file>
+ <welcome-file>index.html</welcome-file>
</welcome-file-list>
</web-app>
Added: trunk/vradi-web/src/main/webapp/index.html
===================================================================
--- trunk/vradi-web/src/main/webapp/index.html (rev 0)
+++ trunk/vradi-web/src/main/webapp/index.html 2011-05-27 07:44:09 UTC (rev 57)
@@ -0,0 +1,9 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+ <head>
+ <meta http-equiv="refresh" content="0;URL=search.action"/>
+ <title>Vradi web</title>
+ </head>
+ <body onload="">
+ </body>
+</html>
1
0
r56 - in trunk: vradi-services/src/main/java/org/chorem/vradi vradi-services/src/main/java/org/chorem/vradi/services vradi-swing/src/main/resources
by sletellier@users.chorem.org 26 May '11
by sletellier@users.chorem.org 26 May '11
26 May '11
Author: sletellier
Date: 2011-05-26 17:11:59 +0200 (Thu, 26 May 2011)
New Revision: 56
Url: http://chorem.org/repositories/revision/vradi/56
Log:
- Fix using on remote
Modified:
trunk/vradi-services/src/main/java/org/chorem/vradi/VradiServiceConfigurationHelper.java
trunk/vradi-services/src/main/java/org/chorem/vradi/services/VradiServiceFactory.java
trunk/vradi-swing/src/main/resources/vradi.properties
Modified: trunk/vradi-services/src/main/java/org/chorem/vradi/VradiServiceConfigurationHelper.java
===================================================================
--- trunk/vradi-services/src/main/java/org/chorem/vradi/VradiServiceConfigurationHelper.java 2011-05-26 14:55:23 UTC (rev 55)
+++ trunk/vradi-services/src/main/java/org/chorem/vradi/VradiServiceConfigurationHelper.java 2011-05-26 15:11:59 UTC (rev 56)
@@ -277,6 +277,7 @@
/**
* Get remote service port.
+ * (was for cajo use)
*
* @param config vradi swing configuration
* @return remote service port
Modified: trunk/vradi-services/src/main/java/org/chorem/vradi/services/VradiServiceFactory.java
===================================================================
--- trunk/vradi-services/src/main/java/org/chorem/vradi/services/VradiServiceFactory.java 2011-05-26 14:55:23 UTC (rev 55)
+++ trunk/vradi-services/src/main/java/org/chorem/vradi/services/VradiServiceFactory.java 2011-05-26 15:11:59 UTC (rev 56)
@@ -92,10 +92,9 @@
factory.setOverloadEnabled(true);
// vradi service
- int servicePort = VradiServiceConfigurationHelper.getServicePort(VradiServiceConfiguration.getConfig());
result = (VradiStorageService) factory.
create(VradiStorageService.class,
- getServiceURL(serviceEndpoint, servicePort, VradiStorageService.VRADI_SERVICE));
+ getServiceURL(serviceEndpoint, VradiStorageService.VRADI_SERVICE));
} catch (Exception eee) {
if (log.isErrorEnabled()) {
@@ -142,9 +141,8 @@
FileService fileService;
String serviceEndpoint = VradiServiceConfigurationHelper.getRemoteEndpoint(config);
if (isValidUrl(serviceEndpoint)) {
- int servletPort = VradiServiceConfigurationHelper.getServletPort(config);
// file service
- String fileServiceUrl = getServiceURL(serviceEndpoint, servletPort, "file");
+ String fileServiceUrl = getServiceURL(serviceEndpoint, "file");
log.info("File service url : " + fileServiceUrl);
fileService = new FileServiceProxy(fileServiceUrl);
} else {
@@ -164,14 +162,9 @@
* @param serviceEndUrl service small name
* @return service full url
*/
- protected static String getServiceURL(String serviceEndpoint, int port, String serviceEndUrl) {
+ protected static String getServiceURL(String serviceEndpoint, String serviceEndUrl) {
String fullUrl = serviceEndpoint;
- // Add port if != 0
- if (port != 0) {
- fullUrl += ":" + port;
- }
-
// Warn hessian won't work with double /
if (!fullUrl.endsWith("/")) {
fullUrl += "/";
Modified: trunk/vradi-swing/src/main/resources/vradi.properties
===================================================================
--- trunk/vradi-swing/src/main/resources/vradi.properties 2011-05-26 14:55:23 UTC (rev 55)
+++ trunk/vradi-swing/src/main/resources/vradi.properties 2011-05-26 15:11:59 UTC (rev 56)
@@ -40,7 +40,7 @@
wikitty.service.event.listen=true
wikitty.service.event.propagate.transporter=org.nuiton.wikitty.services.XMPPNotifierTransporter
wikitty.WikittyServiceCached.components=org.nuiton.wikitty.services.WikittyCacheJCS
-wikitty.service.server.url=${vradi.remote.endpoint}:${vradi.remote.service.port}/wikittyservice
+wikitty.service.server.url=${vradi.remote.endpoint}/wikittyservice
wikitty.service.cache.priority.extensions=Thesaurus, User, Status, XmlStream
jcs.default=
jcs.default.cacheattributes.MaxObjects=1000
1
0
Author: sletellier
Date: 2011-05-26 16:55:23 +0200 (Thu, 26 May 2011)
New Revision: 55
Url: http://chorem.org/repositories/revision/vradi/55
Log:
Revert to hessian
Added:
trunk/vradi-services-web/src/main/java/org/chorem/vradi/services/VradiWikittyServiceDelegator.java
trunk/vradi-services-web/src/test/java/org/chorem/vradi/services/VradiHessianStorageTest.java
trunk/vradi-services-web/src/test/java/org/chorem/vradi/services/util/
trunk/vradi-services-web/src/test/java/org/chorem/vradi/services/util/ReindexService.java
Modified:
trunk/pom.xml
trunk/vradi-services-web/pom.xml
trunk/vradi-services-web/src/main/webapp/WEB-INF/web.xml
trunk/vradi-services-web/src/test/java/org/chorem/vradi/services/ClearService.java
trunk/vradi-services-web/src/test/java/org/chorem/vradi/services/ClearServiceImpl.java
trunk/vradi-services-web/src/test/resources/log4j.properties
trunk/vradi-services/pom.xml
trunk/vradi-services/src/main/java/org/chorem/vradi/services/VradiServiceFactory.java
trunk/vradi-services/src/main/java/org/chorem/vradi/services/VradiStorageServiceImpl.java
trunk/vradi-services/src/main/resources/vradi-services.properties
trunk/vradi-swing/pom.xml
trunk/vradi-swing/src/main/java/org/chorem/vradi/services/VradiService.java
trunk/vradi-swing/src/main/resources/vradi.properties
trunk/vradi-web/pom.xml
trunk/vradi-web/src/main/java/org/chorem/vradi/VradiProxy.java
trunk/vradi-web/src/main/java/org/chorem/vradi/VradiSession.java
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2011-05-26 13:39:50 UTC (rev 54)
+++ trunk/pom.xml 2011-05-26 14:55:23 UTC (rev 55)
@@ -277,6 +277,12 @@
</dependency>
<dependency>
+ <groupId>org.nuiton.wikitty</groupId>
+ <artifactId>wikitty-hessian-client</artifactId>
+ <version>${wikittyVersion}</version>
+ </dependency>
+
+ <dependency>
<groupId>org.apache.tika</groupId>
<artifactId>tika-core</artifactId>
<version>0.8</version>
@@ -348,6 +354,13 @@
</dependency>
<dependency>
+ <groupId>com.caucho</groupId>
+ <artifactId>hessian</artifactId>
+ <version>4.0.6</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
<groupId>commons-fileupload</groupId>
<artifactId>commons-fileupload</artifactId>
<version>1.2.2</version>
Modified: trunk/vradi-services/pom.xml
===================================================================
--- trunk/vradi-services/pom.xml 2011-05-26 13:39:50 UTC (rev 54)
+++ trunk/vradi-services/pom.xml 2011-05-26 14:55:23 UTC (rev 55)
@@ -161,6 +161,10 @@
<artifactId>lucene-core</artifactId>
</dependency>
+ <dependency>
+ <groupId>com.caucho</groupId>
+ <artifactId>hessian</artifactId>
+ </dependency>
</dependencies>
Modified: trunk/vradi-services/src/main/java/org/chorem/vradi/services/VradiServiceFactory.java
===================================================================
--- trunk/vradi-services/src/main/java/org/chorem/vradi/services/VradiServiceFactory.java 2011-05-26 13:39:50 UTC (rev 54)
+++ trunk/vradi-services/src/main/java/org/chorem/vradi/services/VradiServiceFactory.java 2011-05-26 14:55:23 UTC (rev 55)
@@ -23,13 +23,15 @@
*/
package org.chorem.vradi.services;
-import gnu.cajo.utils.extra.TransparentItemProxy;
+import com.caucho.hessian.client.HessianProxyFactory;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.chorem.vradi.VradiServiceConfiguration;
import org.chorem.vradi.VradiServiceConfigurationHelper;
import org.nuiton.util.ApplicationConfig;
import org.nuiton.wikitty.WikittyProxy;
import org.nuiton.wikitty.WikittyService;
+import org.nuiton.wikitty.WikittyServiceFactory;
/**
* VradiServiceFactory.
@@ -61,24 +63,40 @@
if (isValidUrl(serviceEndpoint)) {
try {
+// Cajo impl
+// String cajoEndPoint = serviceEndpoint;
+// // cajo url is not http or other protocol, url must start with //
+// // example: //localhost:1198/ws
+// // remove protocol
+// int i = cajoEndPoint.indexOf("://");
+// if (i >= 0) {
+// cajoEndPoint = serviceEndpoint.substring(i+1);
+// }
+// int servicePort = VradiServiceConfigurationHelper.getServicePort(config);
+// serviceEndpoint = getServiceURL(cajoEndPoint, servicePort, VradiStorageService.VRADI_SERVICE);
+//
+// if (log.isInfoEnabled()) {
+// log.info("Use remote mode with url : " + serviceEndpoint);
+// }
+// result = (VradiStorageService) TransparentItemProxy.getItem(
+// serviceEndpoint, new Class[]{VradiStorageService.class});
- String cajoEndPoint = serviceEndpoint;
- // cajo url is not http or other protocol, url must start with //
- // example: //localhost:1198/ws
- // remove protocol
- int i = cajoEndPoint.indexOf("://");
- if (i >= 0) {
- cajoEndPoint = serviceEndpoint.substring(i+1);
- }
- int servicePort = VradiServiceConfigurationHelper.getServicePort(config);
- serviceEndpoint = getServiceURL(cajoEndPoint, servicePort, VradiStorageService.VRADI_SERVICE);
-
if (log.isInfoEnabled()) {
log.info("Use remote mode with url : " + serviceEndpoint);
}
- result = (VradiStorageService) TransparentItemProxy.getItem(
- serviceEndpoint, new Class[]{VradiStorageService.class});
+ HessianProxyFactory factory = new HessianProxyFactory();
+ // Fix : com.caucho.hessian.io.HessianProtocolException: '���' is an unknown code
+ factory.setHessian2Request(true);
+ // pour que les méthodes aux noms dupliquées fonctionnent (arguments different)
+ factory.setOverloadEnabled(true);
+
+ // vradi service
+ int servicePort = VradiServiceConfigurationHelper.getServicePort(VradiServiceConfiguration.getConfig());
+ result = (VradiStorageService) factory.
+ create(VradiStorageService.class,
+ getServiceURL(serviceEndpoint, servicePort, VradiStorageService.VRADI_SERVICE));
+
} catch (Exception eee) {
if (log.isErrorEnabled()) {
log.error("Can't init remote proxy", eee);
@@ -103,11 +121,10 @@
/**
* Get wikittyService instanciate by vradiService
*
- * @param vradiService of application
* @return wikittyService instanciate
*/
- public static WikittyService getWikittyService(VradiStorageService vradiService) {
- return vradiService.getWikittyService();
+ public static WikittyService getWikittyService(ApplicationConfig config) {
+ return WikittyServiceFactory.buildWikittyService(config);
}
/**
Modified: trunk/vradi-services/src/main/java/org/chorem/vradi/services/VradiStorageServiceImpl.java
===================================================================
--- trunk/vradi-services/src/main/java/org/chorem/vradi/services/VradiStorageServiceImpl.java 2011-05-26 13:39:50 UTC (rev 54)
+++ trunk/vradi-services/src/main/java/org/chorem/vradi/services/VradiStorageServiceImpl.java 2011-05-26 14:55:23 UTC (rev 55)
@@ -102,10 +102,8 @@
protected FileService fileService;
- /**
- * Must be instanciate using {@link VradiServiceFactory}
- */
- protected VradiStorageServiceImpl() {
+ /** Remote instantiation and empty constructor for hessian. */
+ public VradiStorageServiceImpl() {
this(VradiServiceConfiguration.getConfig(), VradiServiceContext.getWikittyProxy());
}
Modified: trunk/vradi-services/src/main/resources/vradi-services.properties
===================================================================
--- trunk/vradi-services/src/main/resources/vradi-services.properties 2011-05-26 13:39:50 UTC (rev 54)
+++ trunk/vradi-services/src/main/resources/vradi-services.properties 2011-05-26 14:55:23 UTC (rev 55)
@@ -68,4 +68,4 @@
#wikitty.service.cache.priority.extensions=Thesaurus
jcs.default=
jcs.default.cacheattributes.MaxObjects=10000
-#jcs.priority.cacheattributes.MaxObjects=10000
\ No newline at end of file
+#jcs.priority.cacheattributes.MaxObjects=10000
Modified: trunk/vradi-services-web/pom.xml
===================================================================
--- trunk/vradi-services-web/pom.xml 2011-05-26 13:39:50 UTC (rev 54)
+++ trunk/vradi-services-web/pom.xml 2011-05-26 14:55:23 UTC (rev 55)
@@ -47,6 +47,11 @@
</dependency>
<dependency>
+ <groupId>com.caucho</groupId>
+ <artifactId>hessian</artifactId>
+ </dependency>
+
+ <dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<scope>provided</scope>
Added: trunk/vradi-services-web/src/main/java/org/chorem/vradi/services/VradiWikittyServiceDelegator.java
===================================================================
--- trunk/vradi-services-web/src/main/java/org/chorem/vradi/services/VradiWikittyServiceDelegator.java (rev 0)
+++ trunk/vradi-services-web/src/main/java/org/chorem/vradi/services/VradiWikittyServiceDelegator.java 2011-05-26 14:55:23 UTC (rev 55)
@@ -0,0 +1,48 @@
+/*
+ * #%L
+ * Vradi :: Services Web
+ *
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2009 - 2010 Codelutin, Chatellier Eric
+ * %%
+ * 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%
+ */
+
+package org.chorem.vradi.services;
+
+import org.chorem.vradi.VradiServiceConfiguration;
+import org.nuiton.wikitty.services.WikittyServiceDelegator;
+
+/**
+ * Wikitty proxy delegator.
+ * <p/>
+ * This delegator exist only because we cannot put instance as hessian service.
+ * <p/>
+ * This delegator just delegate everything to a static real wikitty service.
+ *
+ * @author chatellier
+ * @version $Revision$
+ * <p/>
+ * Last update : $Date$
+ * By : $Author$
+ */
+public class VradiWikittyServiceDelegator extends WikittyServiceDelegator {
+
+ public VradiWikittyServiceDelegator() {
+ super(VradiServiceFactory.getWikittyService(VradiServiceConfiguration.getConfig()));
+ }
+}
Modified: trunk/vradi-services-web/src/main/webapp/WEB-INF/web.xml
===================================================================
--- trunk/vradi-services-web/src/main/webapp/WEB-INF/web.xml 2011-05-26 13:39:50 UTC (rev 54)
+++ trunk/vradi-services-web/src/main/webapp/WEB-INF/web.xml 2011-05-26 14:55:23 UTC (rev 55)
@@ -29,52 +29,54 @@
<display-name>Vradi</display-name>
- <!--<servlet>-->
- <!--<servlet-name>vradiStorageServlet</servlet-name>-->
- <!--<servlet-class>com.caucho.hessian.server.HessianServlet</servlet-class>-->
- <!--<init-param>-->
- <!--<param-name>home-api</param-name>-->
- <!--<param-value>org.chorem.vradi.services.VradiStorageService</param-value>-->
- <!--</init-param>-->
- <!--<init-param>-->
- <!--<param-name>home-class</param-name>-->
- <!--<param-value>org.chorem.vradi.services.VradiStorageServiceImpl-->
- <!--</param-value>-->
- <!--</init-param>-->
- <!--<load-on-startup>1</load-on-startup>-->
- <!--</servlet>-->
- <!--<servlet>-->
- <!--<servlet-name>wikittyServiceServlet</servlet-name>-->
- <!--<servlet-class>com.caucho.hessian.server.HessianServlet</servlet-class>-->
- <!--<init-param>-->
- <!--<param-name>home-api</param-name>-->
- <!--<param-value>org.nuiton.wikitty.WikittyService</param-value>-->
- <!--</init-param>-->
- <!--<init-param>-->
- <!--<param-name>home-class</param-name>-->
- <!--<param-value>org.chorem.vradi.services.VradiWikittyServiceDelegator-->
- <!--</param-value>-->
- <!--</init-param>-->
- <!--<load-on-startup>2</load-on-startup>-->
- <!--</servlet>-->
<servlet>
+ <servlet-name>vradiStorageServlet</servlet-name>
+ <servlet-class>com.caucho.hessian.server.HessianServlet</servlet-class>
+ <init-param>
+ <param-name>home-api</param-name>
+ <param-value>org.chorem.vradi.services.VradiStorageService</param-value>
+ </init-param>
+ <init-param>
+ <param-name>home-class</param-name>
+ <param-value>org.chorem.vradi.services.VradiStorageServiceImpl
+ </param-value>
+ </init-param>
+ <load-on-startup>1</load-on-startup>
+ </servlet>
+ <servlet>
+ <servlet-name>wikittyServiceServlet</servlet-name>
+ <servlet-class>com.caucho.hessian.server.HessianServlet</servlet-class>
+ <init-param>
+ <param-name>home-api</param-name>
+ <param-value>org.nuiton.wikitty.WikittyService</param-value>
+ </init-param>
+ <init-param>
+ <param-name>home-class</param-name>
+ <param-value>org.chorem.vradi.services.VradiWikittyServiceDelegator
+ </param-value>
+ </init-param>
+ <load-on-startup>2</load-on-startup>
+ </servlet>
+ <servlet>
<servlet-name>fileServlet</servlet-name>
<servlet-class>org.chorem.vradi.services.FileServlet</servlet-class>
</servlet>
- <!--<servlet-mapping>-->
- <!--<servlet-name>vradiStorageServlet</servlet-name>-->
- <!--<url-pattern>/vradiservice</url-pattern>-->
- <!--</servlet-mapping>-->
- <!--<servlet-mapping>-->
- <!--<servlet-name>wikittyServiceServlet</servlet-name>-->
- <!--<url-pattern>/wikittyservice</url-pattern>-->
- <!--</servlet-mapping>-->
- <listener>
- <description>Init</description>
- <listener-class>org.chorem.vradi.ApplicationListener</listener-class>
- </listener>
+ <servlet-mapping>
+ <servlet-name>vradiStorageServlet</servlet-name>
+ <url-pattern>/vradiservice</url-pattern>
+ </servlet-mapping>
+ <servlet-mapping>
+ <servlet-name>wikittyServiceServlet</servlet-name>
+ <url-pattern>/wikittyservice</url-pattern>
+ </servlet-mapping>
+ <!-- Used for cajo -->
+ <!--<listener>-->
+ <!--<description>Init</description>-->
+ <!--<listener-class>org.chorem.vradi.ApplicationListener</listener-class>-->
+ <!--</listener>-->
+
<servlet-mapping>
<servlet-name>fileServlet</servlet-name>
<url-pattern>/file/*</url-pattern>
Modified: trunk/vradi-services-web/src/test/java/org/chorem/vradi/services/ClearService.java
===================================================================
--- trunk/vradi-services-web/src/test/java/org/chorem/vradi/services/ClearService.java 2011-05-26 13:39:50 UTC (rev 54)
+++ trunk/vradi-services-web/src/test/java/org/chorem/vradi/services/ClearService.java 2011-05-26 14:55:23 UTC (rev 55)
@@ -8,17 +8,18 @@
* Copyright (C) 2009 - 2010 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.
+ * it under the terms of the GNU 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/>.
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
* #L%
*/
package org.chorem.vradi.services;
Modified: trunk/vradi-services-web/src/test/java/org/chorem/vradi/services/ClearServiceImpl.java
===================================================================
--- trunk/vradi-services-web/src/test/java/org/chorem/vradi/services/ClearServiceImpl.java 2011-05-26 13:39:50 UTC (rev 54)
+++ trunk/vradi-services-web/src/test/java/org/chorem/vradi/services/ClearServiceImpl.java 2011-05-26 14:55:23 UTC (rev 55)
@@ -8,17 +8,18 @@
* Copyright (C) 2009 - 2010 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.
+ * it under the terms of the GNU 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/>.
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
* #L%
*/
package org.chorem.vradi.services;
Added: trunk/vradi-services-web/src/test/java/org/chorem/vradi/services/VradiHessianStorageTest.java
===================================================================
--- trunk/vradi-services-web/src/test/java/org/chorem/vradi/services/VradiHessianStorageTest.java (rev 0)
+++ trunk/vradi-services-web/src/test/java/org/chorem/vradi/services/VradiHessianStorageTest.java 2011-05-26 14:55:23 UTC (rev 55)
@@ -0,0 +1,199 @@
+/*
+ * #%L
+ * Vradi :: Services Web
+ *
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2009 - 2010 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%
+ */
+package org.chorem.vradi.services;
+
+import com.caucho.hessian.client.HessianProxyFactory;
+import org.apache.commons.lang.time.DateUtils;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.chorem.vradi.VradiConstants;
+import org.chorem.vradi.beans.XmlStreamImportResult;
+import org.chorem.vradi.entities.Session;
+import org.chorem.vradi.entities.SessionImpl;
+import org.chorem.vradi.entities.XmlFieldBinding;
+import org.chorem.vradi.entities.XmlStream;
+import org.junit.AfterClass;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.mortbay.jetty.runner.Runner;
+import org.nuiton.util.Resource;
+import org.nuiton.util.converter.ConverterUtil;
+import org.nuiton.wikitty.WikittyProxy;
+import org.nuiton.wikitty.WikittyService;
+import org.nuiton.wikitty.WikittyUtil;
+import org.nuiton.wikitty.entities.WikittyExtension;
+
+import java.net.URL;
+import java.util.Date;
+import java.util.List;
+
+/**
+ * VradiHessianStorageTest.
+ *
+ * @author $Author$
+ * @version $Revision$ $Date$
+ * @since 21 févr. 2010 02:13:16
+ */
+public class VradiHessianStorageTest extends VradiStorageServiceTest {
+ static final Log log = LogFactory.getLog(VradiHessianStorageTest.class);
+
+ static final String port = "9000";
+
+ static final String clearUrl = "http://localhost:" + port + "/clearservice";
+
+ static final String storageUrl = "http://localhost:" + port + "/vradiservice";
+
+ static final String wikittyUrl = "http://localhost:" + port + "/wikittyservice";
+
+ static final String fileUrl = "http://localhost:" + port + "/file";
+
+ static VradiJettyRunner runner;
+
+ public static class VradiJettyRunner extends Runner {
+ @Override
+ public void run() throws Exception {
+ _server.start();
+ // Skip join
+ }
+
+ public void stop() throws Exception {
+ _server.stop();
+ }
+ }
+
+ @BeforeClass
+ public static void startServer() throws Exception {
+ runner = new VradiJettyRunner();
+
+ // This is the file to find to get the path of vradi-services-web module
+ String placeHolder = "/vradi_services_web.place_holder";
+
+ // Find the file
+ URL url = Resource.getURL(placeHolder);
+
+ // Remove the file name and folder 'target/test-classes'
+ String contextPath = url.toString();
+ String target = "/target/test-classes";
+ contextPath = contextPath.substring(0, contextPath.length() - (placeHolder.length() + target.length()));
+
+ // Add webapp context
+ contextPath += "/src/test/webapp";
+ String[] args = {"--port", port, contextPath};
+ runner.configure(args);
+
+ runner.run();
+ }
+
+ @AfterClass
+ public static void stopServer() throws Exception {
+ runner.stop();
+ }
+
+ @Override
+ @Before
+ public void clear() throws Exception {
+ ConverterUtil.initConverters();
+
+ HessianProxyFactory factory = new HessianProxyFactory();
+ factory.setHessian2Request(true);
+ factory.setOverloadEnabled(true);
+
+ log.debug("--clear-----------------------------------------");
+ ClearService clearService = (ClearService) factory.create(ClearService.class, clearUrl);
+ clearService.clear();
+ storageService = (VradiStorageService) factory.create(VradiStorageService.class, storageUrl);
+ WikittyService wikittyService = (WikittyService) factory.create(WikittyService.class, wikittyUrl);
+ wikittyProxy = new WikittyProxy(wikittyService);
+ dataService = new VradiDataServiceImpl(config, wikittyProxy);
+
+ // fait avec le proxy > servlet pour tester
+ fileService = new FileServiceProxy(fileUrl);
+ }
+
+ @Override
+ protected XmlStreamImportResult initData(WikittyExtension extension)
+ throws Exception {
+ List<XmlFieldBinding> bindings = createXmlBindings(extension);
+ XmlStream xmlStream = createXmlStream(extension, bindings);
+ return storageService.importFormsFromXmlStream(xmlStream);
+ }
+
+ /*
+ * TODO add doc about this test !!!
+ *
+ */
+ @Test
+ public void testPropagation() throws Exception {
+
+ Session session = new SessionImpl();
+
+ session.setNum(7);
+ wikittyProxy.getWikitty(session).addExtension(
+ new WikittyExtension("ouaf", "2.0", null,
+ WikittyUtil.buildFieldMapExtension(
+ "Numeric a",
+ "Numeric b",
+ "String c")));
+ session.setSessionDate(new Date());
+
+ session.setStatus(VradiConstants.SessionStatus.ACTIVE.getValue());
+
+ session = wikittyProxy.store(session);
+
+ session.setField("ouaf", "a", 1);
+ session.setField("ouaf", "b", 1.0);
+ session.setField("ouaf", "c", "Ouaf");
+ session.setNum(1);
+ session.setSessionDate(DateUtils.addMinutes(new Date(), 15));
+ Session sessionService = wikittyProxy.store(session);
+
+ if (session.getWikittyId().equals(sessionService.getWikittyId())) {
+ int scInt = wikittyProxy.getWikitty(sessionService).getFieldAsInt("ouaf", "a");
+ int lcInt = wikittyProxy.getWikitty(session).getFieldAsInt("ouaf", "a");
+
+ Float scFloat = wikittyProxy.getWikitty(sessionService).getFieldAsFloat("ouaf", "b");
+ Float lcFloat = wikittyProxy.getWikitty(session).getFieldAsFloat("ouaf", "b");
+
+ String scString = wikittyProxy.getWikitty(sessionService).getFieldAsString("ouaf", "c");
+ String lcString = wikittyProxy.getWikitty(session).getFieldAsString("ouaf", "c");
+
+ log.info("testPropagation result, local : " + session.getNum() + " serveur : " + sessionService.getNum());
+ log.info("testPropagation result as int, local : " + lcInt + " serveur : " + scInt);
+ log.info("testPropagation result as float, local : " + lcFloat + " serveur : " + scFloat);
+ log.info("testPropagation result as String, local : " + lcString + " serveur : " + scString);
+ log.info("testPropagation result, local : " + session.getSessionDate() + " serveur : " + sessionService.getSessionDate());
+
+ Assert.assertEquals(session.getNum(), sessionService.getNum());
+ Assert.assertEquals(lcInt, scInt);
+ Assert.assertEquals(lcFloat, scFloat);
+ Assert.assertEquals(lcString, scString);
+ Assert.assertEquals(session.getSessionDate(), sessionService.getSessionDate());
+ }
+
+ wikittyProxy.delete(session.getWikittyId());
+ }
+
+}
Added: trunk/vradi-services-web/src/test/java/org/chorem/vradi/services/util/ReindexService.java
===================================================================
--- trunk/vradi-services-web/src/test/java/org/chorem/vradi/services/util/ReindexService.java (rev 0)
+++ trunk/vradi-services-web/src/test/java/org/chorem/vradi/services/util/ReindexService.java 2011-05-26 14:55:23 UTC (rev 55)
@@ -0,0 +1,104 @@
+/*
+ * #%L
+ * Vradi :: Services Web
+ *
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2009 - 2010 Codelutin, Chatellier Eric
+ * %%
+ * 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%
+ */
+
+package org.chorem.vradi.services.util;
+
+import com.caucho.hessian.client.HessianProxyFactory;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.chorem.vradi.entities.Thesaurus;
+import org.nuiton.util.StringUtil;
+import org.nuiton.wikitty.WikittyProxy;
+import org.nuiton.wikitty.WikittyService;
+import org.nuiton.wikitty.search.Criteria;
+import org.nuiton.wikitty.search.Search;
+import org.nuiton.wikitty.search.operators.Element;
+
+import java.net.MalformedURLException;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Attention, cette class n'est pas un test, elle est utilisée
+ * pour faire une reindexation d'un service distant facilement.
+ *
+ * @author chatellier
+ * @version $Revision$
+ * <p/>
+ * Last update : $Date$
+ * By : $Author$
+ */
+public class ReindexService {
+
+ static final String wikittyUrl = "http://dbdev/vradi/wikittyservice";
+
+ static final Log log = LogFactory.getLog(ReindexService.class);
+
+ public static void main(String... args) throws MalformedURLException {
+
+ HessianProxyFactory factory = new HessianProxyFactory();
+ factory.setHessian2Request(true);
+ factory.setOverloadEnabled(true);
+
+ WikittyService wikittyService = (WikittyService) factory.create(WikittyService.class, wikittyUrl);
+ WikittyProxy wikittyProxy = new WikittyProxy(wikittyService);
+
+ //synEngin(wikittyProxy);
+ //deleteObseleteThesaurus(wikittyProxy);
+ }
+
+ public static void syncSearchEngine(WikittyProxy wikittyProxy) throws MalformedURLException {
+ wikittyProxy.syncSearchEngine();
+ System.out.println("syncEngin complete !");
+ }
+
+ public static void deleteObseleteThesaurus(WikittyProxy wikittyProxy) {
+ log.info("Starting deleting obselete thesaurus");
+
+ long startingTime = System.nanoTime();
+
+ Criteria criteria = Search.query().eq(Element.ELT_EXTENSION, Thesaurus.EXT_THESAURUS).criteria();
+ List<Thesaurus> thesauruses = wikittyProxy.findAllByCriteria(Thesaurus.class, criteria).getAll();
+
+ List<String> thesaurusToDelete = new ArrayList<String>();
+ for (Thesaurus thesaurus : thesauruses) {
+ String parentId = thesaurus.getParent();
+ if (parentId == null) {
+ thesaurusToDelete.add(thesaurus.getWikittyId());
+
+ log.info("Found thesaurus '" + thesaurus.getName() + "' has no parentId, deleting this");
+ } else {
+ Thesaurus parent = wikittyProxy.restore(Thesaurus.class, parentId);
+ if (parent == null) {
+ thesaurusToDelete.add(thesaurus.getWikittyId());
+ log.info("Found thesaurus '" + thesaurus.getName() + "' has no parent with id '" + parentId + ", deleting this");
+ }
+ }
+ }
+
+ //wikittyProxy.delete(thesaurusToDelete);
+
+ log.info("Deleting obselete thesaurus is finished in " + StringUtil.convertTime(startingTime, System.nanoTime()));
+ }
+}
Modified: trunk/vradi-services-web/src/test/resources/log4j.properties
===================================================================
--- trunk/vradi-services-web/src/test/resources/log4j.properties 2011-05-26 13:39:50 UTC (rev 54)
+++ trunk/vradi-services-web/src/test/resources/log4j.properties 2011-05-26 14:55:23 UTC (rev 55)
@@ -8,17 +8,18 @@
# Copyright (C) 2009 - 2010 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.
+# it under the terms of the GNU 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/>.
+# You should have received a copy of the GNU General Public
+# License along with this program. If not, see
+# <http://www.gnu.org/licenses/gpl-3.0.html>.
# #L%
###
Modified: trunk/vradi-swing/pom.xml
===================================================================
--- trunk/vradi-swing/pom.xml 2011-05-26 13:39:50 UTC (rev 54)
+++ trunk/vradi-swing/pom.xml 2011-05-26 14:55:23 UTC (rev 55)
@@ -86,6 +86,12 @@
</dependency>
<dependency>
+ <groupId>org.nuiton.wikitty</groupId>
+ <artifactId>wikitty-hessian-client</artifactId>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</dependency>
@@ -106,6 +112,11 @@
</dependency>
<dependency>
+ <groupId>com.caucho</groupId>
+ <artifactId>hessian</artifactId>
+ </dependency>
+
+ <dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-webapp</artifactId>
<scope>runtime</scope>
Modified: trunk/vradi-swing/src/main/java/org/chorem/vradi/services/VradiService.java
===================================================================
--- trunk/vradi-swing/src/main/java/org/chorem/vradi/services/VradiService.java 2011-05-26 13:39:50 UTC (rev 54)
+++ trunk/vradi-swing/src/main/java/org/chorem/vradi/services/VradiService.java 2011-05-26 14:55:23 UTC (rev 55)
@@ -65,7 +65,7 @@
vradiStorageService = VradiServiceFactory.getVradiServiceStorage(configuration);
- wikittyService = VradiServiceFactory.getWikittyService(vradiStorageService);
+ wikittyService = VradiServiceFactory.getWikittyService(configuration);
fileService = VradiServiceFactory.getFileService(configuration);
Modified: trunk/vradi-swing/src/main/resources/vradi.properties
===================================================================
--- trunk/vradi-swing/src/main/resources/vradi.properties 2011-05-26 13:39:50 UTC (rev 54)
+++ trunk/vradi-swing/src/main/resources/vradi.properties 2011-05-26 14:55:23 UTC (rev 55)
@@ -31,7 +31,8 @@
application.organisation.url=${project.organization.url}
# Wikitty
-wikitty.WikittyService.components=org.nuiton.wikitty.services.WikittyServiceNotifier,\
+wikitty.WikittyService.components=org.nuiton.wikitty.services.WikittyServiceHessianClient,\
+org.nuiton.wikitty.services.WikittyServiceNotifier,\
org.nuiton.wikitty.services.WikittyServiceCached,\
org.nuiton.wikitty.services.WikittyServiceSecurity
wikitty.service.cache.allwaysRestoreCopies=false
@@ -39,7 +40,7 @@
wikitty.service.event.listen=true
wikitty.service.event.propagate.transporter=org.nuiton.wikitty.services.XMPPNotifierTransporter
wikitty.WikittyServiceCached.components=org.nuiton.wikitty.services.WikittyCacheJCS
-wikitty.service.server.url=${vradi.remote.endpoint}/wikittyservice
+wikitty.service.server.url=${vradi.remote.endpoint}:${vradi.remote.service.port}/wikittyservice
wikitty.service.cache.priority.extensions=Thesaurus, User, Status, XmlStream
jcs.default=
jcs.default.cacheattributes.MaxObjects=1000
Modified: trunk/vradi-web/pom.xml
===================================================================
--- trunk/vradi-web/pom.xml 2011-05-26 13:39:50 UTC (rev 54)
+++ trunk/vradi-web/pom.xml 2011-05-26 14:55:23 UTC (rev 55)
@@ -186,6 +186,12 @@
</dependency>
<dependency>
+ <groupId>org.nuiton.wikitty</groupId>
+ <artifactId>wikitty-hessian-client</artifactId>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<scope>runtime</scope>
Modified: trunk/vradi-web/src/main/java/org/chorem/vradi/VradiProxy.java
===================================================================
--- trunk/vradi-web/src/main/java/org/chorem/vradi/VradiProxy.java 2011-05-26 13:39:50 UTC (rev 54)
+++ trunk/vradi-web/src/main/java/org/chorem/vradi/VradiProxy.java 2011-05-26 14:55:23 UTC (rev 55)
@@ -4,11 +4,10 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.chorem.vradi.entities.Attachment;
-import org.chorem.vradi.services.VradiServiceFactory;
-import org.chorem.vradi.services.VradiStorageService;
import org.nuiton.util.ApplicationConfig;
import org.nuiton.wikitty.WikittyProxy;
import org.nuiton.wikitty.WikittyService;
+import org.nuiton.wikitty.WikittyServiceFactory;
import org.nuiton.wikitty.search.Criteria;
import org.nuiton.wikitty.search.PagedResult;
import org.nuiton.wikitty.search.Search;
@@ -38,11 +37,9 @@
* @param token
* @return
*/
- static public VradiProxy getInstance(VradiStorageService vradiStorageService, String token) {
+ static public VradiProxy getInstance(String token) {
ApplicationConfig config = VradiWebConfig.getConfig();
- if (ws == null) {
- ws = VradiServiceFactory.getWikittyService(vradiStorageService);
- }
+ WikittyService ws = getWikittyService(config);
VradiProxy result = new VradiProxy(config, ws);
result.setSecurityToken(token);
@@ -50,17 +47,35 @@
}
/**
+ * Returns WikittyService to use. This WikittyService is singleton.
+ *
+ * @param config
+ * @return WikittyService instance
+ */
+ static protected WikittyService getWikittyService(ApplicationConfig config) {
+ if (ws == null) {
+ synchronized(VradiProxy.class) {
+ if (ws == null) {
+ ws = WikittyServiceFactory.buildWikittyService(config);
+ }
+ }
+ }
+ return ws;
+ }
+
+ /**
* Returns the attachments linked with a wikitty id ordered descending
* by date
*
* @param formNoteId
* @return the list of attachments
*/
- public List<Attachment> getAttachments(String formNoteId) {
+ static public List<Attachment> getAttachments(String formNoteId) {
Criteria criteria = Search.query().
eq(Attachment.FQ_FIELD_ATTACHMENT_FORMNOTE, formNoteId)
.criteria().addSortDescending(Attachment.FQ_FIELD_ATTACHMENT_DATE);
- PagedResult<Attachment> result = findAllByCriteria(Attachment.class, criteria);
+ PagedResult<Attachment> result = getInstance(null).
+ findAllByCriteria(Attachment.class, criteria);
List<Attachment> attachments = result.getAll();
return attachments;
}
Modified: trunk/vradi-web/src/main/java/org/chorem/vradi/VradiSession.java
===================================================================
--- trunk/vradi-web/src/main/java/org/chorem/vradi/VradiSession.java 2011-05-26 13:39:50 UTC (rev 54)
+++ trunk/vradi-web/src/main/java/org/chorem/vradi/VradiSession.java 2011-05-26 14:55:23 UTC (rev 55)
@@ -1,5 +1,6 @@
package org.chorem.vradi;
+import java.util.Locale;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
@@ -7,11 +8,16 @@
import org.apache.commons.logging.LogFactory;
import org.chorem.vradi.entities.VradiUser;
import org.chorem.vradi.services.VradiDataService;
+import org.chorem.vradi.services.VradiDataServiceImpl;
import org.chorem.vradi.services.VradiServiceFactory;
-import org.chorem.vradi.services.VradiStorageService;
import org.nuiton.i18n.I18n;
import org.nuiton.i18n.init.DefaultI18nInitializer;
import org.nuiton.util.ApplicationConfig;
+import org.nuiton.wikitty.WikittyConfigOption;
+import org.nuiton.wikitty.WikittyProxy;
+import org.nuiton.wikitty.WikittyService;
+import org.nuiton.wikitty.WikittyServiceFactory;
+import org.nuiton.wikitty.entities.WikittyUser;
/**
* Classe utilisee pour stocker les objets utils en session utilisateur
@@ -34,7 +40,6 @@
transient protected VradiProxy proxy = null;
transient protected VradiDataService dataService;
- transient protected VradiStorageService vradiServiceStorage;
public VradiSession() {
// FIXME poussin 20110521 ?
@@ -60,7 +65,7 @@
public VradiProxy getProxy() {
if (proxy == null) {
- proxy = VradiProxy.getInstance(getVradiStorageService(), securityToken);
+ proxy = VradiProxy.getInstance(securityToken);
}
return proxy;
}
@@ -97,18 +102,6 @@
return result;
}
- public VradiStorageService getVradiStorageService() {
- if (vradiServiceStorage == null) {
- synchronized(VradiSession.class) {
- if (vradiServiceStorage == null) {
- ApplicationConfig config = VradiWebConfig.getConfig();
- vradiServiceStorage = VradiServiceFactory.getVradiServiceStorage(config);
- }
- }
- }
- return vradiServiceStorage;
- }
-
public VradiDataService getDataService() {
if (dataService == null) {
synchronized(VradiSession.class) {
1
0
Author: sletellier
Date: 2011-05-26 15:39:50 +0200 (Thu, 26 May 2011)
New Revision: 54
Url: http://chorem.org/repositories/revision/vradi/54
Log:
#397 Up to cajo
Added:
trunk/vradi-services-web/src/main/java/org/chorem/vradi/ApplicationListener.java
trunk/vradi-services/src/main/java/org/chorem/vradi/services/VradiServiceContext.java
trunk/vradi-services/src/main/java/org/chorem/vradi/services/VradiServiceFactory.java
Removed:
trunk/vradi-services-web/src/main/java/org/chorem/vradi/services/VradiWikittyServiceDelegator.java
trunk/vradi-services-web/src/test/java/org/chorem/vradi/services/VradiHessianStorageTest.java
trunk/vradi-services-web/src/test/java/org/chorem/vradi/services/util/
trunk/vradi-services/src/main/java/org/chorem/vradi/services/ServiceFactory.java
Modified:
trunk/pom.xml
trunk/vradi-services-web/pom.xml
trunk/vradi-services-web/src/main/webapp/WEB-INF/web.xml
trunk/vradi-services-web/src/test/java/org/chorem/vradi/services/ClearServiceImpl.java
trunk/vradi-services/src/main/java/org/chorem/vradi/VradiServiceAction.java
trunk/vradi-services/src/main/java/org/chorem/vradi/VradiServiceConfiguration.java
trunk/vradi-services/src/main/java/org/chorem/vradi/VradiServiceConfigurationHelper.java
trunk/vradi-services/src/main/java/org/chorem/vradi/services/ServiceMigration.java
trunk/vradi-services/src/main/java/org/chorem/vradi/services/VradiDataServiceImpl.java
trunk/vradi-services/src/main/java/org/chorem/vradi/services/VradiStorageService.java
trunk/vradi-services/src/main/java/org/chorem/vradi/services/VradiStorageServiceImpl.java
trunk/vradi-services/src/main/resources/i18n/vradi-services_fr_FR.properties
trunk/vradi-services/src/main/resources/vradi-services.properties
trunk/vradi-services/src/test/java/org/chorem/vradi/VradiTestAbstract.java
trunk/vradi-swing/pom.xml
trunk/vradi-swing/src/main/java/org/chorem/vradi/VradiConfig.java
trunk/vradi-swing/src/main/java/org/chorem/vradi/VradiConfigHelper.java
trunk/vradi-swing/src/main/java/org/chorem/vradi/services/VradiService.java
trunk/vradi-swing/src/main/java/org/chorem/vradi/ui/VradiMainUIHandler.java
trunk/vradi-swing/src/main/resources/vradi.properties
trunk/vradi-web/pom.xml
trunk/vradi-web/src/main/java/org/chorem/vradi/VradiProxy.java
trunk/vradi-web/src/main/java/org/chorem/vradi/VradiSession.java
trunk/vradi-web/src/main/resources/vradi-web.properties
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2011-05-26 09:47:13 UTC (rev 53)
+++ trunk/pom.xml 2011-05-26 13:39:50 UTC (rev 54)
@@ -277,12 +277,6 @@
</dependency>
<dependency>
- <groupId>org.nuiton.wikitty</groupId>
- <artifactId>wikitty-hessian-client</artifactId>
- <version>${wikittyVersion}</version>
- </dependency>
-
- <dependency>
<groupId>org.apache.tika</groupId>
<artifactId>tika-core</artifactId>
<version>0.8</version>
@@ -354,13 +348,6 @@
</dependency>
<dependency>
- <groupId>com.caucho</groupId>
- <artifactId>hessian</artifactId>
- <version>4.0.6</version>
- <scope>compile</scope>
- </dependency>
-
- <dependency>
<groupId>commons-fileupload</groupId>
<artifactId>commons-fileupload</artifactId>
<version>1.2.2</version>
Modified: trunk/vradi-services/src/main/java/org/chorem/vradi/VradiServiceAction.java
===================================================================
--- trunk/vradi-services/src/main/java/org/chorem/vradi/VradiServiceAction.java 2011-05-26 09:47:13 UTC (rev 53)
+++ trunk/vradi-services/src/main/java/org/chorem/vradi/VradiServiceAction.java 2011-05-26 13:39:50 UTC (rev 54)
@@ -31,7 +31,7 @@
import org.chorem.vradi.entities.Status;
import org.chorem.vradi.entities.Thesaurus;
import org.chorem.vradi.entities.User;
-import org.chorem.vradi.services.ServiceFactory;
+import org.chorem.vradi.services.VradiServiceContext;
import org.chorem.vradi.services.VradiException;
import org.chorem.vradi.services.VradiStorageService;
import org.nuiton.util.ApplicationConfig;
@@ -85,7 +85,7 @@
long startingTime = System.nanoTime();
- ServiceFactory.getWikittyProxy().syncSearchEngine();
+ VradiServiceContext.getWikittyProxy().syncSearchEngine();
if (log.isInfoEnabled()) {
log.info("ReIndex solr is finished in " + StringUtil.convertTime(startingTime, System.nanoTime()));
@@ -101,7 +101,7 @@
Criteria criteria = Search.query().eq(Element.ELT_EXTENSION, Thesaurus.EXT_THESAURUS).criteria();
- WikittyProxy proxy = ServiceFactory.getWikittyProxy();
+ WikittyProxy proxy = VradiServiceContext.getWikittyProxy();
List<Thesaurus> thesauruses = proxy.findAllByCriteria(Thesaurus.class, criteria).getAll();
for (Thesaurus thesaurus : thesauruses) {
@@ -131,7 +131,7 @@
Criteria criteria = Search.query().eq(Element.ELT_EXTENSION, Status.EXT_STATUS).criteria();
- WikittyProxy proxy = ServiceFactory.getWikittyProxy();
+ WikittyProxy proxy = VradiServiceContext.getWikittyProxy();
List<Status> statuses = proxy.findAllByCriteria(Status.class, criteria).getAll();
List<String> statusesIds = new ArrayList<String>();
@@ -143,7 +143,7 @@
proxy.delete(statusesIds);
try {
- ServiceFactory.getVradiStorageService().createDefaultStatuses();
+ VradiServiceContext.getVradiStorageService().createDefaultStatuses();
} catch (VradiException eee) {
log.error(eee);
}
@@ -160,7 +160,7 @@
Criteria criteria = Search.query().eq(Element.ELT_EXTENSION, User.EXT_USER).criteria();
- WikittyProxy proxy = ServiceFactory.getWikittyProxy();
+ WikittyProxy proxy = VradiServiceContext.getWikittyProxy();
List<User> users = proxy.findAllByCriteria(User.class, criteria).getAll();
for (User user : users) {
@@ -190,7 +190,7 @@
Criteria criteria = Search.query().eq(Element.ELT_EXTENSION, User.EXT_USER).criteria();
- WikittyProxy proxy = ServiceFactory.getWikittyProxy();
+ WikittyProxy proxy = VradiServiceContext.getWikittyProxy();
List<User> users = proxy.findAllByCriteria(User.class, criteria).getAll();
for (User user : users) {
@@ -242,7 +242,7 @@
String uri = f.toURI().toString();
try {
log.info("Start import file " + uri);
- ServiceFactory.getVradiStorageService().importAsCSV(uri);
+ VradiServiceContext.getVradiStorageService().importAsCSV(uri);
} catch (VradiException eee) {
log.error("failled to import file : " + uri, eee);
}
@@ -265,7 +265,7 @@
}
// export
- VradiStorageService vradiStorageService = ServiceFactory.getVradiStorageService();
+ VradiStorageService vradiStorageService = VradiServiceContext.getVradiStorageService();
String vscContent = null;
try {
vscContent = vradiStorageService.exportClientDB();
@@ -305,7 +305,7 @@
Criteria criteria = search.criteria();
// export
- VradiStorageService vradiStorageService = ServiceFactory.getVradiStorageService();
+ VradiStorageService vradiStorageService = VradiServiceContext.getVradiStorageService();
String vscContent = null;
try {
vscContent = vradiStorageService.exportAsCSV(criteria);
Modified: trunk/vradi-services/src/main/java/org/chorem/vradi/VradiServiceConfiguration.java
===================================================================
--- trunk/vradi-services/src/main/java/org/chorem/vradi/VradiServiceConfiguration.java 2011-05-26 09:47:13 UTC (rev 53)
+++ trunk/vradi-services/src/main/java/org/chorem/vradi/VradiServiceConfiguration.java 2011-05-26 13:39:50 UTC (rev 54)
@@ -169,6 +169,22 @@
_("vradi.service.config.version.description"),
null, String.class, false, false),
+ // achitecture client serveur
+ REMOTE_ENDPOINT(
+ "vradi.remote.endpoint",
+ _("vradi.config.remote.endpoint.description"),
+ "", String.class, false, false),
+
+ SERVLET_PORT(
+ "vradi.remote.servlet.port",
+ _("vradi.config.remote.servlet.port.description"),
+ "0", Integer.class, false, false),
+
+ SERVICE_PORT(
+ "vradi.remote.service.port",
+ _("vradi.config.remote.service.port.description"),
+ "0", Integer.class, false, false),
+
DATA_DIR(
"vradi.data.dir",
_("vradi.service.config.data.dir.description"),
Modified: trunk/vradi-services/src/main/java/org/chorem/vradi/VradiServiceConfigurationHelper.java
===================================================================
--- trunk/vradi-services/src/main/java/org/chorem/vradi/VradiServiceConfigurationHelper.java 2011-05-26 09:47:13 UTC (rev 53)
+++ trunk/vradi-services/src/main/java/org/chorem/vradi/VradiServiceConfigurationHelper.java 2011-05-26 13:39:50 UTC (rev 54)
@@ -239,4 +239,50 @@
public static String getWikittyEventTransporterXMPPRoom(ApplicationConfig config) {
return config.getOption(WikittyConfigOption.WIKITTY_EVENT_TRANSPORTER_XMPP_ROOM.key);
}
+
+ /**
+ * Get remote endpoint base url.
+ * <p/>
+ * If not valid url, embedded mode is used.
+ *
+ * @param config vradi swing configuration
+ * @return remote endpoint base url
+ */
+ public static String getRemoteEndpoint(ApplicationConfig config) {
+ String endpoint = config.getOption(VradiServiceOption.REMOTE_ENDPOINT.key);
+ return endpoint;
+ }
+
+
+ /**
+ * Change remote endpoint url.
+ *
+ * @param config vradi swing configuration
+ * @param newEndpoint new base url
+ */
+ public static void setRemoteEndPoint(ApplicationConfig config, String newEndpoint) {
+ config.setOption(VradiServiceOption.REMOTE_ENDPOINT.key, newEndpoint);
+ }
+
+ /**
+ * Get remote servlet port.
+ *
+ * @param config vradi swing configuration
+ * @return remote servlet port
+ */
+ public static int getServletPort(ApplicationConfig config) {
+ int servletPort = config.getOptionAsInt(VradiServiceOption.SERVLET_PORT.key);
+ return servletPort;
+ }
+
+ /**
+ * Get remote service port.
+ *
+ * @param config vradi swing configuration
+ * @return remote service port
+ */
+ public static int getServicePort(ApplicationConfig config) {
+ int endpoint = config.getOptionAsInt(VradiServiceOption.SERVICE_PORT.key);
+ return endpoint;
+ }
}
Deleted: trunk/vradi-services/src/main/java/org/chorem/vradi/services/ServiceFactory.java
===================================================================
--- trunk/vradi-services/src/main/java/org/chorem/vradi/services/ServiceFactory.java 2011-05-26 09:47:13 UTC (rev 53)
+++ trunk/vradi-services/src/main/java/org/chorem/vradi/services/ServiceFactory.java 2011-05-26 13:39:50 UTC (rev 54)
@@ -1,244 +0,0 @@
-/*
- * #%L
- * Vradi :: Services
- *
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2009 - 2010 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%
- */
-package org.chorem.vradi.services;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.chorem.vradi.VradiServiceConfiguration;
-import org.chorem.vradi.VradiServiceConfigurationHelper;
-import org.chorem.vradi.entities.ClientImpl;
-import org.chorem.vradi.entities.FormImpl;
-import org.chorem.vradi.entities.GroupFormsImpl;
-import org.chorem.vradi.entities.GroupImpl;
-import org.chorem.vradi.entities.InfogeneImpl;
-import org.chorem.vradi.entities.ModificationTagImpl;
-import org.chorem.vradi.entities.QueryMakerImpl;
-import org.chorem.vradi.entities.RootThesaurusImpl;
-import org.chorem.vradi.entities.SendingImpl;
-import org.chorem.vradi.entities.SessionImpl;
-import org.chorem.vradi.entities.StatusImpl;
-import org.chorem.vradi.entities.ThesaurusImpl;
-import org.chorem.vradi.entities.UserImpl;
-import org.chorem.vradi.entities.VradiUserImpl;
-import org.chorem.vradi.entities.WebHarvestStreamImpl;
-import org.chorem.vradi.entities.XmlFieldBindingImpl;
-import org.chorem.vradi.entities.XmlStreamImpl;
-import org.nuiton.i18n.I18n;
-import org.nuiton.util.ApplicationConfig;
-import org.nuiton.util.converter.ConverterUtil;
-import org.nuiton.wikitty.WikittyProxy;
-import org.nuiton.wikitty.WikittyService;
-import org.nuiton.wikitty.WikittyServiceFactory;
-import org.nuiton.wikitty.entities.WikittyExtension;
-import org.nuiton.wikitty.entities.WikittyTreeNodeImpl;
-import org.nuiton.wikitty.entities.WikittyUserImpl;
-
-import java.util.Arrays;
-import java.util.List;
-
-/**
- * ServiceFactory.
- *
- * @author $Author$
- * @version $Revision$ $Date$
- * @since 24 févr. 2010 22:18:17
- */
-public class ServiceFactory {
-
- /** Log. */
- private static final Log log = LogFactory.getLog(ServiceFactory.class);
-
- /** Wikitty service (cached version) for remote access. */
- protected static WikittyService vradiWikittyService;
-
- /** Single instance of storage service. */
- protected static VradiStorageService vradiStorageService;
-
- /** Single instance of wikitty proxy. */
- protected static WikittyProxy wikittyProxy;
-
- protected static ApplicationConfig config;
-
-
- static {
- // Dans un block static pour definition des variables
- // d'environnement solr et jbossts
- // A voir pourquoi, les converters s'initialise mal durant les tests
- try {
-
- ConverterUtil.initConverters();
- config = VradiServiceConfiguration.getConfig();
- I18n.setDefaultLocale(VradiServiceConfigurationHelper.getLocale(config));
- } catch (Exception eee) {
- log.error("Cant initialize Service factory : ", eee);
- }
- }
-
- public static synchronized VradiStorageService getVradiStorageService() {
- if (vradiStorageService == null) {
- vradiStorageService = new VradiStorageServiceImpl();
- }
- return vradiStorageService;
- }
-
- /**
- * Creates wikitty service (cached).
- * <p/>
- * Getter for service, with default service configuration.
- *
- * @return a unique instance of WikittyService
- */
- public static synchronized WikittyService getWikittyService() {
- if (vradiWikittyService == null) {
- getWikittyService(config);
- }
-
- return vradiWikittyService;
- }
-
- /**
- * Creates wikitty service (cached).
- * <p/>
- * Constructor added for UI embedded mode, with custom configuration.
- *
- * @param config configuration of vradi service
- * @return a unique instance of WikittyService
- */
- public static synchronized WikittyService getWikittyService(ApplicationConfig config) {
- if (vradiWikittyService == null) {
-
- vradiWikittyService = WikittyServiceFactory.buildWikittyService(config);
- }
-
- return vradiWikittyService;
- }
-
- /**
- * Creates wikitty proxy.
- *
- * @return a unique instance of WikittyProxy.
- */
- public static synchronized WikittyProxy getWikittyProxy() {
- if (wikittyProxy == null) {
- WikittyService wikittyService = getWikittyService();
-
- // init proxy on cached service
- wikittyProxy = new WikittyProxy(wikittyService);
-
- // post operation : register extensions
- updateExtensions(wikittyProxy);
-
- // post operation : reindex data if necessary
- reindexData(wikittyProxy);
- }
-
- return wikittyProxy;
- }
-
- /**
- * Register all extensions.
- * <p/>
- * Already existing extensions with same version are skipped,
- * new extension are created and stored.
- *
- * @param localWikittyProxy wikitty proxy
- */
- static void updateExtensions(WikittyProxy localWikittyProxy) {
-
- // easier if ordered
- // TODO EC20100616 don't work with required extensions :(
- List<WikittyExtension> extensions = Arrays.asList(
- ClientImpl.extensionClient,
- FormImpl.extensionForm,
- GroupImpl.extensionGroup,
- InfogeneImpl.extensionInfogene,
- ModificationTagImpl.extensionModificationTag,
- QueryMakerImpl.extensionQueryMaker,
- RootThesaurusImpl.extensionRootThesaurus,
- SendingImpl.extensionSending,
- SessionImpl.extensionSession,
- StatusImpl.extensionStatus,
- ThesaurusImpl.extensionThesaurus,
- WikittyTreeNodeImpl.extensionWikittyTreeNode,
- UserImpl.extensionUser,
- VradiUserImpl.extensionVradiUser,
- WebHarvestStreamImpl.extensionWebHarvestStream,
- WikittyUserImpl.extensionWikittyUser,
- XmlFieldBindingImpl.extensionXmlFieldBinding,
- XmlStreamImpl.extensionXmlStream,
- GroupFormsImpl.extensionGroupForms);
-
- localWikittyProxy.storeExtension(extensions);
- }
-
- /**
- * Check if version has changed and launch wikitty service reindex.
- *
- * @param localWikittyProxy local proxy
- */
- protected static void reindexData(WikittyProxy localWikittyProxy) {
- try {
-
- String currentVersion = VradiServiceConfigurationHelper.getApplicationVersion(config);
- String lastVersion = VradiServiceConfigurationHelper.getServiceVersion(config);
-
- // different is enougth to reindex
- // currentVersion is never null, lastVersion could be
- if (!currentVersion.equals(lastVersion)) {
-
- // do version change migration
- ServiceMigration.versionChangeMigration(lastVersion, currentVersion, localWikittyProxy);
-
- // Dont reindex data on version change
-// if (log.isInfoEnabled()) {
-// log.info(_("Version change detected : %s. Reindexing data...", lastVersion));
-// }
-// long timeBefore = System.currentTimeMillis();
-//
-// // call syncEngin
-// localWikittyProxy.syncEngin();
-//
-// long timeAfter = System.currentTimeMillis();
-//
-// if (log.isInfoEnabled()) {
-// log.info("Reindexing completed in " + (timeAfter - timeBefore) + " ms");
-// }
-
- // save new version
- VradiServiceConfigurationHelper.setServiceVersion(config, currentVersion);
- config.saveForUser();
- } else {
- if (log.isInfoEnabled()) {
- log.info("No version change, skipping reindexing.");
- }
- }
-
- // post operation : register migration classes
- ServiceMigration.configureMigration();
-
- } catch (Exception eee) {
- log.error("Failled to reindex data : ", eee);
- }
- }
-}
Modified: trunk/vradi-services/src/main/java/org/chorem/vradi/services/ServiceMigration.java
===================================================================
--- trunk/vradi-services/src/main/java/org/chorem/vradi/services/ServiceMigration.java 2011-05-26 09:47:13 UTC (rev 53)
+++ trunk/vradi-services/src/main/java/org/chorem/vradi/services/ServiceMigration.java 2011-05-26 13:39:50 UTC (rev 54)
@@ -26,14 +26,31 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.chorem.vradi.VradiServiceConfigurationHelper;
+import org.chorem.vradi.entities.ClientImpl;
+import org.chorem.vradi.entities.FormImpl;
import org.chorem.vradi.entities.GroupForms;
import org.chorem.vradi.entities.GroupFormsImpl;
+import org.chorem.vradi.entities.GroupImpl;
+import org.chorem.vradi.entities.InfogeneImpl;
+import org.chorem.vradi.entities.ModificationTagImpl;
+import org.chorem.vradi.entities.QueryMakerImpl;
import org.chorem.vradi.entities.RootThesaurusImpl;
import org.chorem.vradi.entities.Sending;
+import org.chorem.vradi.entities.SendingImpl;
+import org.chorem.vradi.entities.SessionImpl;
import org.chorem.vradi.entities.Status;
+import org.chorem.vradi.entities.StatusImpl;
import org.chorem.vradi.entities.Thesaurus;
+import org.chorem.vradi.entities.ThesaurusImpl;
import org.chorem.vradi.entities.User;
+import org.chorem.vradi.entities.UserImpl;
import org.chorem.vradi.entities.VradiUser;
+import org.chorem.vradi.entities.VradiUserImpl;
+import org.chorem.vradi.entities.WebHarvestStreamImpl;
+import org.chorem.vradi.entities.XmlFieldBindingImpl;
+import org.chorem.vradi.entities.XmlStreamImpl;
+import org.nuiton.util.ApplicationConfig;
import org.nuiton.util.Version;
import org.nuiton.util.VersionUtil;
import org.nuiton.wikitty.WikittyProxy;
@@ -43,6 +60,7 @@
import org.nuiton.wikitty.entities.WikittyImpl;
import org.nuiton.wikitty.entities.WikittyTreeNode;
import org.nuiton.wikitty.entities.WikittyTreeNodeImpl;
+import org.nuiton.wikitty.entities.WikittyUserImpl;
import org.nuiton.wikitty.search.Criteria;
import org.nuiton.wikitty.search.Search;
import org.nuiton.wikitty.search.operators.Element;
@@ -50,6 +68,7 @@
import org.nuiton.wikitty.services.WikittyExtensionMigrationRename;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.List;
import java.util.Set;
@@ -485,4 +504,91 @@
(currentVersion.equals(migrationVersion)
|| currentVersion.after(migrationVersion));
}
+
+ /**
+ * Register all extensions.
+ * <p/>
+ * Already existing extensions with same version are skipped,
+ * new extension are created and stored.
+ *
+ * @param localWikittyProxy wikitty proxy
+ */
+ static void updateExtensions(WikittyProxy localWikittyProxy) {
+
+ // easier if ordered
+ // TODO EC20100616 don't work with required extensions :(
+ List<WikittyExtension> extensions = Arrays.asList(
+ ClientImpl.extensionClient,
+ FormImpl.extensionForm,
+ GroupImpl.extensionGroup,
+ InfogeneImpl.extensionInfogene,
+ ModificationTagImpl.extensionModificationTag,
+ QueryMakerImpl.extensionQueryMaker,
+ RootThesaurusImpl.extensionRootThesaurus,
+ SendingImpl.extensionSending,
+ SessionImpl.extensionSession,
+ StatusImpl.extensionStatus,
+ ThesaurusImpl.extensionThesaurus,
+ WikittyTreeNodeImpl.extensionWikittyTreeNode,
+ UserImpl.extensionUser,
+ VradiUserImpl.extensionVradiUser,
+ WebHarvestStreamImpl.extensionWebHarvestStream,
+ WikittyUserImpl.extensionWikittyUser,
+ XmlFieldBindingImpl.extensionXmlFieldBinding,
+ XmlStreamImpl.extensionXmlStream,
+ GroupFormsImpl.extensionGroupForms);
+
+ localWikittyProxy.storeExtension(extensions);
+ }
+
+ /**
+ * Check if version has changed and launch wikitty service reindex.
+ *
+ * @param config app configuration
+ * @param localWikittyProxy local proxy
+ */
+ protected static void reindexData(ApplicationConfig config, WikittyProxy localWikittyProxy) {
+ try {
+
+ String currentVersion = VradiServiceConfigurationHelper.getApplicationVersion(config);
+ String lastVersion = VradiServiceConfigurationHelper.getServiceVersion(config);
+
+ // different is enougth to reindex
+ // currentVersion is never null, lastVersion could be
+ if (!currentVersion.equals(lastVersion)) {
+
+ // do version change migration
+ ServiceMigration.versionChangeMigration(lastVersion, currentVersion, localWikittyProxy);
+
+ // Dont reindex data on version change
+// if (log.isInfoEnabled()) {
+// log.info(_("Version change detected : %s. Reindexing data...", lastVersion));
+// }
+// long timeBefore = System.currentTimeMillis();
+//
+// // call syncEngin
+// localWikittyProxy.syncEngin();
+//
+// long timeAfter = System.currentTimeMillis();
+//
+// if (log.isInfoEnabled()) {
+// log.info("Reindexing completed in " + (timeAfter - timeBefore) + " ms");
+// }
+
+ // save new version
+ VradiServiceConfigurationHelper.setServiceVersion(config, currentVersion);
+ config.saveForUser();
+ } else {
+ if (log.isInfoEnabled()) {
+ log.info("No version change, skipping reindexing.");
+ }
+ }
+
+ // post operation : register migration classes
+ ServiceMigration.configureMigration();
+
+ } catch (Exception eee) {
+ log.error("Failled to reindex data : ", eee);
+ }
+ }
}
Modified: trunk/vradi-services/src/main/java/org/chorem/vradi/services/VradiDataServiceImpl.java
===================================================================
--- trunk/vradi-services/src/main/java/org/chorem/vradi/services/VradiDataServiceImpl.java 2011-05-26 09:47:13 UTC (rev 53)
+++ trunk/vradi-services/src/main/java/org/chorem/vradi/services/VradiDataServiceImpl.java 2011-05-26 13:39:50 UTC (rev 54)
@@ -106,17 +106,6 @@
* <p/>
* Make sure that wikitty proxy doesn't access remote service.
*
- * @param wikittyProxy wikitty proxy
- */
- public VradiDataServiceImpl(WikittyProxy wikittyProxy) {
- this(VradiServiceConfiguration.getConfig(), wikittyProxy);
- }
-
- /**
- * Constructor with a wikitty proxy.
- * <p/>
- * Make sure that wikitty proxy doesn't access remote service.
- *
* @param config vradi configuration
* @param wikittyProxy wikitty proxy
*/
Added: trunk/vradi-services/src/main/java/org/chorem/vradi/services/VradiServiceContext.java
===================================================================
--- trunk/vradi-services/src/main/java/org/chorem/vradi/services/VradiServiceContext.java (rev 0)
+++ trunk/vradi-services/src/main/java/org/chorem/vradi/services/VradiServiceContext.java 2011-05-26 13:39:50 UTC (rev 54)
@@ -0,0 +1,113 @@
+package org.chorem.vradi.services;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.chorem.vradi.VradiServiceConfiguration;
+import org.chorem.vradi.VradiServiceConfigurationHelper;
+import org.nuiton.i18n.I18n;
+import org.nuiton.util.ApplicationConfig;
+import org.nuiton.util.converter.ConverterUtil;
+import org.nuiton.wikitty.WikittyProxy;
+import org.nuiton.wikitty.WikittyService;
+import org.nuiton.wikitty.WikittyServiceFactory;
+
+/**
+ * Context to keep all instanciate service
+ *
+ * Must be used only for vradi service, for clients, please use {@link VradiServiceFactory}
+ *
+ * @author sletellier
+ */
+public class VradiServiceContext {
+
+ /** Log. */
+ private static final Log log = LogFactory.getLog(VradiServiceFactory.class);
+
+ /** Wikitty service (cached version) for remote access. */
+ protected static WikittyService vradiWikittyService;
+
+ /** Single instance of storage service. */
+ protected static VradiStorageService vradiStorageService;
+
+ /** Single instance of wikitty proxy. */
+ protected static WikittyProxy wikittyProxy;
+
+ protected static ApplicationConfig config;
+
+ static {
+ // Dans un block static pour definition des variables
+ // d'environnement solr et jbossts
+ // A voir pourquoi, les converters s'initialise mal durant les tests
+ try {
+
+ ConverterUtil.initConverters();
+ config = VradiServiceConfiguration.getConfig();
+ I18n.setDefaultLocale(VradiServiceConfigurationHelper.getLocale(config));
+ } catch (Exception eee) {
+ log.error("Cant initialize Service factory : ", eee);
+ }
+ }
+
+ public static synchronized VradiStorageService getVradiStorageService() {
+ if (vradiStorageService == null) {
+ vradiStorageService = new VradiStorageServiceImpl();
+ }
+ return vradiStorageService;
+ }
+
+ /**
+ * Creates wikitty service (cached).
+ * <p/>
+ * Getter for service, with default service configuration.
+ *
+ * @return a unique instance of WikittyService
+ */
+ public static synchronized WikittyService getWikittyService() {
+ if (vradiWikittyService == null) {
+ getWikittyService(config);
+ }
+
+ return vradiWikittyService;
+ }
+
+ /**
+ * Creates wikitty service (cached).
+ * <p/>
+ * Constructor added for UI embedded mode, with custom configuration.
+ *
+ * @param config configuration of vradi service
+ * @return a unique instance of WikittyService
+ */
+ public static synchronized WikittyService getWikittyService(ApplicationConfig config) {
+ if (vradiWikittyService == null) {
+
+ synchronized (VradiServiceContext.class) {
+ vradiWikittyService = WikittyServiceFactory.buildWikittyService(config);
+ }
+ }
+
+ return vradiWikittyService;
+ }
+
+ /**
+ * Creates wikitty proxy.
+ *
+ * @return a unique instance of WikittyProxy.
+ */
+ public static synchronized WikittyProxy getWikittyProxy() {
+ if (wikittyProxy == null) {
+ WikittyService wikittyService = getWikittyService();
+
+ // init proxy on cached service
+ wikittyProxy = new WikittyProxy(wikittyService);
+
+ // post operation : register extensions
+ ServiceMigration.updateExtensions(wikittyProxy);
+
+ // post operation : reindex data if necessary
+ ServiceMigration.reindexData(config, wikittyProxy);
+ }
+
+ return wikittyProxy;
+ }
+}
Copied: trunk/vradi-services/src/main/java/org/chorem/vradi/services/VradiServiceFactory.java (from rev 53, trunk/vradi-services/src/main/java/org/chorem/vradi/services/ServiceFactory.java)
===================================================================
--- trunk/vradi-services/src/main/java/org/chorem/vradi/services/VradiServiceFactory.java (rev 0)
+++ trunk/vradi-services/src/main/java/org/chorem/vradi/services/VradiServiceFactory.java 2011-05-26 13:39:50 UTC (rev 54)
@@ -0,0 +1,165 @@
+/*
+ * #%L
+ * Vradi :: Services
+ *
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2009 - 2010 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%
+ */
+package org.chorem.vradi.services;
+
+import gnu.cajo.utils.extra.TransparentItemProxy;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.chorem.vradi.VradiServiceConfigurationHelper;
+import org.nuiton.util.ApplicationConfig;
+import org.nuiton.wikitty.WikittyProxy;
+import org.nuiton.wikitty.WikittyService;
+
+/**
+ * VradiServiceFactory.
+ *
+ * @author $Author$
+ * @version $Revision$ $Date$
+ * @since 24 févr. 2010 22:18:17
+ */
+public class VradiServiceFactory {
+
+ /** Log. */
+ private static final Log log = LogFactory.getLog(VradiServiceFactory.class);
+
+ /**
+ * Build {@link VradiStorageService} instance with on remote mode
+ * if {@link org.chorem.vradi.VradiServiceConfiguration.VradiServiceOption#REMOTE_ENDPOINT}
+ * is filled in config pass in param.
+ *
+ * @param config config of application
+ * @return instance of vradiServiceStorage
+ */
+ public static VradiStorageService getVradiServiceStorage(ApplicationConfig config) {
+
+ synchronized(VradiServiceFactory.class) {
+ String serviceEndpoint = VradiServiceConfigurationHelper.getRemoteEndpoint(config);
+
+ VradiStorageService result = null;
+ // check is it's valid url
+ if (isValidUrl(serviceEndpoint)) {
+
+ try {
+
+ String cajoEndPoint = serviceEndpoint;
+ // cajo url is not http or other protocol, url must start with //
+ // example: //localhost:1198/ws
+ // remove protocol
+ int i = cajoEndPoint.indexOf("://");
+ if (i >= 0) {
+ cajoEndPoint = serviceEndpoint.substring(i+1);
+ }
+ int servicePort = VradiServiceConfigurationHelper.getServicePort(config);
+ serviceEndpoint = getServiceURL(cajoEndPoint, servicePort, VradiStorageService.VRADI_SERVICE);
+
+ if (log.isInfoEnabled()) {
+ log.info("Use remote mode with url : " + serviceEndpoint);
+ }
+ result = (VradiStorageService) TransparentItemProxy.getItem(
+ serviceEndpoint, new Class[]{VradiStorageService.class});
+
+ } catch (Exception eee) {
+ if (log.isErrorEnabled()) {
+ log.error("Can't init remote proxy", eee);
+ }
+ }
+ } else {
+ if (log.isWarnEnabled()) {
+ log.warn("Can't parse remote serveur endpoint as valid url (" + serviceEndpoint + ")");
+ log.warn("Use local embedded mode");
+ }
+
+ result = new VradiStorageServiceImpl();
+ }
+ return result;
+ }
+ }
+
+ public static VradiDataService getVradiDataService(ApplicationConfig config, WikittyProxy proxy) {
+ return new VradiDataServiceImpl(config, proxy);
+ }
+
+ /**
+ * Get wikittyService instanciate by vradiService
+ *
+ * @param vradiService of application
+ * @return wikittyService instanciate
+ */
+ public static WikittyService getWikittyService(VradiStorageService vradiService) {
+ return vradiService.getWikittyService();
+ }
+
+ /**
+ * Get proxy instanciate with wikittyService
+ *
+ * @param wikittyService of application
+ * @return wikittyProxy
+ */
+ public static WikittyProxy getProxy(WikittyService wikittyService) {
+ return new WikittyProxy(wikittyService);
+ }
+
+ public static FileService getFileService(ApplicationConfig config) {
+
+ FileService fileService;
+ String serviceEndpoint = VradiServiceConfigurationHelper.getRemoteEndpoint(config);
+ if (isValidUrl(serviceEndpoint)) {
+ int servletPort = VradiServiceConfigurationHelper.getServletPort(config);
+ // file service
+ String fileServiceUrl = getServiceURL(serviceEndpoint, servletPort, "file");
+ log.info("File service url : " + fileServiceUrl);
+ fileService = new FileServiceProxy(fileServiceUrl);
+ } else {
+ fileService = new FileServiceImpl();
+ }
+ return fileService;
+ }
+
+ protected static boolean isValidUrl(String serviceEndpoint) {
+ return serviceEndpoint != null && serviceEndpoint.startsWith("http://");
+ }
+
+ /**
+ * Get service full url.
+ *
+ * @param serviceEndpoint end point (can't be null)
+ * @param serviceEndUrl service small name
+ * @return service full url
+ */
+ protected static String getServiceURL(String serviceEndpoint, int port, String serviceEndUrl) {
+ String fullUrl = serviceEndpoint;
+
+ // Add port if != 0
+ if (port != 0) {
+ fullUrl += ":" + port;
+ }
+
+ // Warn hessian won't work with double /
+ if (!fullUrl.endsWith("/")) {
+ fullUrl += "/";
+ }
+ fullUrl += serviceEndUrl;
+ return fullUrl;
+ }
+}
Property changes on: trunk/vradi-services/src/main/java/org/chorem/vradi/services/VradiServiceFactory.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Modified: trunk/vradi-services/src/main/java/org/chorem/vradi/services/VradiStorageService.java
===================================================================
--- trunk/vradi-services/src/main/java/org/chorem/vradi/services/VradiStorageService.java 2011-05-26 09:47:13 UTC (rev 53)
+++ trunk/vradi-services/src/main/java/org/chorem/vradi/services/VradiStorageService.java 2011-05-26 13:39:50 UTC (rev 54)
@@ -34,6 +34,7 @@
import org.chorem.vradi.entities.VradiUser;
import org.chorem.vradi.entities.WebHarvestStream;
import org.chorem.vradi.entities.XmlStream;
+import org.nuiton.wikitty.WikittyService;
import org.nuiton.wikitty.entities.WikittyExtension;
import org.nuiton.wikitty.search.Criteria;
@@ -58,7 +59,10 @@
*/
public interface VradiStorageService {
+ public static final String VRADI_SERVICE = "vradiservice";
+ WikittyService getWikittyService();
+
/**
* Create all default status.
*
@@ -402,4 +406,5 @@
* @throws VradiException if exception occured
*/
Form updateForms(Form form, List<String> thesaurusIdsToAttach) throws VradiException;
+
}
Modified: trunk/vradi-services/src/main/java/org/chorem/vradi/services/VradiStorageServiceImpl.java
===================================================================
--- trunk/vradi-services/src/main/java/org/chorem/vradi/services/VradiStorageServiceImpl.java 2011-05-26 09:47:13 UTC (rev 53)
+++ trunk/vradi-services/src/main/java/org/chorem/vradi/services/VradiStorageServiceImpl.java 2011-05-26 13:39:50 UTC (rev 54)
@@ -23,18 +23,14 @@
*/
package org.chorem.vradi.services;
-import org.apache.commons.lang.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.chorem.vradi.VradiConstants;
import org.chorem.vradi.VradiServiceConfiguration;
import org.chorem.vradi.VradiServiceConfigurationHelper;
-import org.chorem.vradi.beans.SendingHelper;
import org.chorem.vradi.beans.XmlStreamImportResult;
import org.chorem.vradi.entities.Client;
import org.chorem.vradi.entities.Form;
import org.chorem.vradi.entities.Group;
-import org.chorem.vradi.entities.Infogene;
import org.chorem.vradi.entities.QueryMaker;
import org.chorem.vradi.entities.Sending;
import org.chorem.vradi.entities.Session;
@@ -53,7 +49,6 @@
import org.chorem.vradi.services.managers.ThesaurusManager;
import org.chorem.vradi.services.tasks.TasksManager;
import org.nuiton.util.ApplicationConfig;
-import org.nuiton.util.DateUtil;
import org.nuiton.wikitty.WikittyException;
import org.nuiton.wikitty.WikittyProxy;
import org.nuiton.wikitty.WikittyService;
@@ -66,18 +61,11 @@
import org.nuiton.wikitty.search.operators.Element;
import java.io.File;
-import java.util.ArrayList;
import java.util.Collection;
-import java.util.Collections;
-import java.util.Date;
-import java.util.HashMap;
import java.util.List;
import java.util.Map;
-import java.util.Set;
-import static org.chorem.vradi.VradiConstants.SendingStatus;
import static org.chorem.vradi.VradiConstants.SessionStatus;
-import static org.nuiton.i18n.I18n._;
/**
* Vradi storage implementation.
@@ -114,9 +102,11 @@
protected FileService fileService;
- /** Remote instantiation and empty constructor for hessian. */
- public VradiStorageServiceImpl() {
- this(VradiServiceConfiguration.getConfig(), ServiceFactory.getWikittyProxy());
+ /**
+ * Must be instanciate using {@link VradiServiceFactory}
+ */
+ protected VradiStorageServiceImpl() {
+ this(VradiServiceConfiguration.getConfig(), VradiServiceContext.getWikittyProxy());
}
/**
@@ -163,6 +153,11 @@
return importExportService;
}
+ @Override
+ public WikittyService getWikittyService() {
+ return wikittyProxy.getWikittyService();
+ }
+
/**
* Create all default status.
*
Modified: trunk/vradi-services/src/main/resources/i18n/vradi-services_fr_FR.properties
===================================================================
--- trunk/vradi-services/src/main/resources/i18n/vradi-services_fr_FR.properties 2011-05-26 09:47:13 UTC (rev 53)
+++ trunk/vradi-services/src/main/resources/i18n/vradi-services_fr_FR.properties 2011-05-26 13:39:50 UTC (rev 54)
@@ -9,6 +9,9 @@
vradi.adminXmlStream.config.interval.hours=heures
vradi.adminXmlStream.config.interval.minutes=minutes
vradi.autoSend.hour.description=
+vradi.config.remote.endpoint.description=
+vradi.config.remote.service.port.description=
+vradi.config.remote.servlet.port.description=
vradi.email.status.deleted=Supprimée
vradi.email.status.error=Erreur
vradi.email.status.received=Reçu
Modified: trunk/vradi-services/src/main/resources/vradi-services.properties
===================================================================
--- trunk/vradi-services/src/main/resources/vradi-services.properties 2011-05-26 09:47:13 UTC (rev 53)
+++ trunk/vradi-services/src/main/resources/vradi-services.properties 2011-05-26 13:39:50 UTC (rev 54)
@@ -68,4 +68,4 @@
#wikitty.service.cache.priority.extensions=Thesaurus
jcs.default=
jcs.default.cacheattributes.MaxObjects=10000
-#jcs.priority.cacheattributes.MaxObjects=10000
+#jcs.priority.cacheattributes.MaxObjects=10000
\ No newline at end of file
Modified: trunk/vradi-services/src/test/java/org/chorem/vradi/VradiTestAbstract.java
===================================================================
--- trunk/vradi-services/src/test/java/org/chorem/vradi/VradiTestAbstract.java 2011-05-26 09:47:13 UTC (rev 53)
+++ trunk/vradi-services/src/test/java/org/chorem/vradi/VradiTestAbstract.java 2011-05-26 13:39:50 UTC (rev 54)
@@ -48,7 +48,7 @@
import org.chorem.vradi.entities.XmlStreamImpl;
import org.chorem.vradi.services.FileService;
import org.chorem.vradi.services.FileServiceImpl;
-import org.chorem.vradi.services.ServiceFactory;
+import org.chorem.vradi.services.VradiServiceContext;
import org.chorem.vradi.services.VradiDataService;
import org.chorem.vradi.services.VradiDataServiceImpl;
import org.chorem.vradi.services.VradiException;
@@ -59,7 +59,6 @@
import org.nuiton.util.ApplicationConfig;
import org.nuiton.util.Resource;
import org.nuiton.util.converter.ConverterUtil;
-import org.nuiton.wikitty.WikittyConfig;
import org.nuiton.wikitty.WikittyConfigOption;
import org.nuiton.wikitty.WikittyProxy;
import org.nuiton.wikitty.entities.BusinessEntity;
@@ -140,8 +139,8 @@
config = VradiTestConfiguration.getConfig();
- storageService = ServiceFactory.getVradiStorageService();
- wikittyProxy = ServiceFactory.getWikittyProxy();
+ storageService = VradiServiceContext.getVradiStorageService();
+ wikittyProxy = VradiServiceContext.getWikittyProxy();
wikittyProxy.clear();
dataService = new VradiDataServiceImpl(config, wikittyProxy);
fileService = new FileServiceImpl(config);
Modified: trunk/vradi-services-web/pom.xml
===================================================================
--- trunk/vradi-services-web/pom.xml 2011-05-26 09:47:13 UTC (rev 53)
+++ trunk/vradi-services-web/pom.xml 2011-05-26 13:39:50 UTC (rev 54)
@@ -47,11 +47,6 @@
</dependency>
<dependency>
- <groupId>com.caucho</groupId>
- <artifactId>hessian</artifactId>
- </dependency>
-
- <dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<scope>provided</scope>
Added: trunk/vradi-services-web/src/main/java/org/chorem/vradi/ApplicationListener.java
===================================================================
--- trunk/vradi-services-web/src/main/java/org/chorem/vradi/ApplicationListener.java (rev 0)
+++ trunk/vradi-services-web/src/main/java/org/chorem/vradi/ApplicationListener.java 2011-05-26 13:39:50 UTC (rev 54)
@@ -0,0 +1,51 @@
+package org.chorem.vradi;
+
+import gnu.cajo.invoke.Remote;
+import gnu.cajo.utils.ItemServer;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.chorem.vradi.services.VradiServiceFactory;
+import org.chorem.vradi.services.VradiStorageService;
+import org.nuiton.util.ApplicationConfig;
+
+import javax.servlet.ServletContextEvent;
+import javax.servlet.ServletContextListener;
+import java.io.IOException;
+
+/**
+ * For init cajo services
+ *
+ * @author sletellier
+ */
+public class ApplicationListener implements ServletContextListener {
+
+ protected static final Log log =
+ LogFactory.getLog(ApplicationListener.class);
+
+ @Override
+ public void contextInitialized(ServletContextEvent sce) {
+ if (log.isInfoEnabled()) {
+ log.info("Vradi starting...");
+ }
+ // Init wikitty service
+ ApplicationConfig config = VradiServiceConfiguration.getConfig();
+
+ // get port and path part of server url, only that is used for cajo
+ try {
+ VradiStorageService storageService = VradiServiceFactory.getVradiServiceStorage(config);
+
+ int port = VradiServiceConfigurationHelper.getServicePort(config);
+
+ Remote.config(null, port, null, 0);
+ ItemServer.bind(storageService, VradiStorageService.VRADI_SERVICE);
+ log.info(String.format("The vradi server is running on %s:%s/%s",
+ Remote.getDefaultServerHost(), Remote.getDefaultServerPort(), VradiStorageService.VRADI_SERVICE));
+ } catch (IOException eee) {
+ log.error("Error ocurred binding service, abording", eee);
+ }
+ }
+
+ @Override
+ public void contextDestroyed(ServletContextEvent sce) {
+ }
+}
Deleted: trunk/vradi-services-web/src/main/java/org/chorem/vradi/services/VradiWikittyServiceDelegator.java
===================================================================
--- trunk/vradi-services-web/src/main/java/org/chorem/vradi/services/VradiWikittyServiceDelegator.java 2011-05-26 09:47:13 UTC (rev 53)
+++ trunk/vradi-services-web/src/main/java/org/chorem/vradi/services/VradiWikittyServiceDelegator.java 2011-05-26 13:39:50 UTC (rev 54)
@@ -1,47 +0,0 @@
-/*
- * #%L
- * Vradi :: Services Web
- *
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2009 - 2010 Codelutin, Chatellier Eric
- * %%
- * 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%
- */
-
-package org.chorem.vradi.services;
-
-import org.nuiton.wikitty.services.WikittyServiceDelegator;
-
-/**
- * Wikitty proxy delegator.
- * <p/>
- * This delegator exist only because we cannot put instance as hessian service.
- * <p/>
- * This delegator just delegate everything to a static real wikitty service.
- *
- * @author chatellier
- * @version $Revision$
- * <p/>
- * Last update : $Date$
- * By : $Author$
- */
-public class VradiWikittyServiceDelegator extends WikittyServiceDelegator {
-
- public VradiWikittyServiceDelegator() {
- super(ServiceFactory.getWikittyService());
- }
-}
Modified: trunk/vradi-services-web/src/main/webapp/WEB-INF/web.xml
===================================================================
--- trunk/vradi-services-web/src/main/webapp/WEB-INF/web.xml 2011-05-26 09:47:13 UTC (rev 53)
+++ trunk/vradi-services-web/src/main/webapp/WEB-INF/web.xml 2011-05-26 13:39:50 UTC (rev 54)
@@ -29,48 +29,53 @@
<display-name>Vradi</display-name>
+ <!--<servlet>-->
+ <!--<servlet-name>vradiStorageServlet</servlet-name>-->
+ <!--<servlet-class>com.caucho.hessian.server.HessianServlet</servlet-class>-->
+ <!--<init-param>-->
+ <!--<param-name>home-api</param-name>-->
+ <!--<param-value>org.chorem.vradi.services.VradiStorageService</param-value>-->
+ <!--</init-param>-->
+ <!--<init-param>-->
+ <!--<param-name>home-class</param-name>-->
+ <!--<param-value>org.chorem.vradi.services.VradiStorageServiceImpl-->
+ <!--</param-value>-->
+ <!--</init-param>-->
+ <!--<load-on-startup>1</load-on-startup>-->
+ <!--</servlet>-->
+ <!--<servlet>-->
+ <!--<servlet-name>wikittyServiceServlet</servlet-name>-->
+ <!--<servlet-class>com.caucho.hessian.server.HessianServlet</servlet-class>-->
+ <!--<init-param>-->
+ <!--<param-name>home-api</param-name>-->
+ <!--<param-value>org.nuiton.wikitty.WikittyService</param-value>-->
+ <!--</init-param>-->
+ <!--<init-param>-->
+ <!--<param-name>home-class</param-name>-->
+ <!--<param-value>org.chorem.vradi.services.VradiWikittyServiceDelegator-->
+ <!--</param-value>-->
+ <!--</init-param>-->
+ <!--<load-on-startup>2</load-on-startup>-->
+ <!--</servlet>-->
<servlet>
- <servlet-name>vradiStorageServlet</servlet-name>
- <servlet-class>com.caucho.hessian.server.HessianServlet</servlet-class>
- <init-param>
- <param-name>home-api</param-name>
- <param-value>org.chorem.vradi.services.VradiStorageService</param-value>
- </init-param>
- <init-param>
- <param-name>home-class</param-name>
- <param-value>org.chorem.vradi.services.VradiStorageServiceImpl
- </param-value>
- </init-param>
- <load-on-startup>1</load-on-startup>
- </servlet>
- <servlet>
- <servlet-name>wikittyServiceServlet</servlet-name>
- <servlet-class>com.caucho.hessian.server.HessianServlet</servlet-class>
- <init-param>
- <param-name>home-api</param-name>
- <param-value>org.nuiton.wikitty.WikittyService</param-value>
- </init-param>
- <init-param>
- <param-name>home-class</param-name>
- <param-value>org.chorem.vradi.services.VradiWikittyServiceDelegator
- </param-value>
- </init-param>
- <load-on-startup>2</load-on-startup>
- </servlet>
- <servlet>
<servlet-name>fileServlet</servlet-name>
<servlet-class>org.chorem.vradi.services.FileServlet</servlet-class>
</servlet>
+ <!--<servlet-mapping>-->
+ <!--<servlet-name>vradiStorageServlet</servlet-name>-->
+ <!--<url-pattern>/vradiservice</url-pattern>-->
+ <!--</servlet-mapping>-->
+ <!--<servlet-mapping>-->
+ <!--<servlet-name>wikittyServiceServlet</servlet-name>-->
+ <!--<url-pattern>/wikittyservice</url-pattern>-->
+ <!--</servlet-mapping>-->
+ <listener>
+ <description>Init</description>
+ <listener-class>org.chorem.vradi.ApplicationListener</listener-class>
+ </listener>
+
<servlet-mapping>
- <servlet-name>vradiStorageServlet</servlet-name>
- <url-pattern>/vradiservice</url-pattern>
- </servlet-mapping>
- <servlet-mapping>
- <servlet-name>wikittyServiceServlet</servlet-name>
- <url-pattern>/wikittyservice</url-pattern>
- </servlet-mapping>
- <servlet-mapping>
<servlet-name>fileServlet</servlet-name>
<url-pattern>/file/*</url-pattern>
</servlet-mapping>
Modified: trunk/vradi-services-web/src/test/java/org/chorem/vradi/services/ClearServiceImpl.java
===================================================================
--- trunk/vradi-services-web/src/test/java/org/chorem/vradi/services/ClearServiceImpl.java 2011-05-26 09:47:13 UTC (rev 53)
+++ trunk/vradi-services-web/src/test/java/org/chorem/vradi/services/ClearServiceImpl.java 2011-05-26 13:39:50 UTC (rev 54)
@@ -43,7 +43,7 @@
@Override
public void clear() {
- WikittyProxy proxy = ServiceFactory.getWikittyProxy();
+ WikittyProxy proxy = VradiServiceContext.getWikittyProxy();
proxy.clear();
}
Deleted: trunk/vradi-services-web/src/test/java/org/chorem/vradi/services/VradiHessianStorageTest.java
===================================================================
--- trunk/vradi-services-web/src/test/java/org/chorem/vradi/services/VradiHessianStorageTest.java 2011-05-26 09:47:13 UTC (rev 53)
+++ trunk/vradi-services-web/src/test/java/org/chorem/vradi/services/VradiHessianStorageTest.java 2011-05-26 13:39:50 UTC (rev 54)
@@ -1,199 +0,0 @@
-/*
- * #%L
- * Vradi :: Services Web
- *
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2009 - 2010 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%
- */
-package org.chorem.vradi.services;
-
-import com.caucho.hessian.client.HessianProxyFactory;
-import org.apache.commons.lang.time.DateUtils;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.chorem.vradi.VradiConstants;
-import org.chorem.vradi.beans.XmlStreamImportResult;
-import org.chorem.vradi.entities.Session;
-import org.chorem.vradi.entities.SessionImpl;
-import org.chorem.vradi.entities.XmlFieldBinding;
-import org.chorem.vradi.entities.XmlStream;
-import org.junit.AfterClass;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Test;
-import org.mortbay.jetty.runner.Runner;
-import org.nuiton.util.Resource;
-import org.nuiton.util.converter.ConverterUtil;
-import org.nuiton.wikitty.WikittyProxy;
-import org.nuiton.wikitty.WikittyService;
-import org.nuiton.wikitty.WikittyUtil;
-import org.nuiton.wikitty.entities.WikittyExtension;
-
-import java.net.URL;
-import java.util.Date;
-import java.util.List;
-
-/**
- * VradiHessianStorageTest.
- *
- * @author $Author$
- * @version $Revision$ $Date$
- * @since 21 févr. 2010 02:13:16
- */
-public class VradiHessianStorageTest extends VradiStorageServiceTest {
- static final Log log = LogFactory.getLog(VradiHessianStorageTest.class);
-
- static final String port = "9000";
-
- static final String clearUrl = "http://localhost:" + port + "/clearservice";
-
- static final String storageUrl = "http://localhost:" + port + "/vradiservice";
-
- static final String wikittyUrl = "http://localhost:" + port + "/wikittyservice";
-
- static final String fileUrl = "http://localhost:" + port + "/file";
-
- static VradiJettyRunner runner;
-
- public static class VradiJettyRunner extends Runner {
- @Override
- public void run() throws Exception {
- _server.start();
- // Skip join
- }
-
- public void stop() throws Exception {
- _server.stop();
- }
- }
-
- @BeforeClass
- public static void startServer() throws Exception {
- runner = new VradiJettyRunner();
-
- // This is the file to find to get the path of vradi-services-web module
- String placeHolder = "/vradi_services_web.place_holder";
-
- // Find the file
- URL url = Resource.getURL(placeHolder);
-
- // Remove the file name and folder 'target/test-classes'
- String contextPath = url.toString();
- String target = "/target/test-classes";
- contextPath = contextPath.substring(0, contextPath.length() - (placeHolder.length() + target.length()));
-
- // Add webapp context
- contextPath += "/src/test/webapp";
- String[] args = {"--port", port, contextPath};
- runner.configure(args);
-
- runner.run();
- }
-
- @AfterClass
- public static void stopServer() throws Exception {
- runner.stop();
- }
-
- @Override
- @Before
- public void clear() throws Exception {
- ConverterUtil.initConverters();
-
- HessianProxyFactory factory = new HessianProxyFactory();
- factory.setHessian2Request(true);
- factory.setOverloadEnabled(true);
-
- log.debug("--clear-----------------------------------------");
- ClearService clearService = (ClearService) factory.create(ClearService.class, clearUrl);
- clearService.clear();
- storageService = (VradiStorageService) factory.create(VradiStorageService.class, storageUrl);
- WikittyService wikittyService = (WikittyService) factory.create(WikittyService.class, wikittyUrl);
- wikittyProxy = new WikittyProxy(wikittyService);
- dataService = new VradiDataServiceImpl(wikittyProxy);
-
- // fait avec le proxy > servlet pour tester
- fileService = new FileServiceProxy(fileUrl);
- }
-
- @Override
- protected XmlStreamImportResult initData(WikittyExtension extension)
- throws Exception {
- List<XmlFieldBinding> bindings = createXmlBindings(extension);
- XmlStream xmlStream = createXmlStream(extension, bindings);
- return storageService.importFormsFromXmlStream(xmlStream);
- }
-
- /*
- * TODO add doc about this test !!!
- *
- */
- @Test
- public void testPropagation() throws Exception {
-
- Session session = new SessionImpl();
-
- session.setNum(7);
- wikittyProxy.getWikitty(session).addExtension(
- new WikittyExtension("ouaf", "2.0", null,
- WikittyUtil.buildFieldMapExtension(
- "Numeric a",
- "Numeric b",
- "String c")));
- session.setSessionDate(new Date());
-
- session.setStatus(VradiConstants.SessionStatus.ACTIVE.getValue());
-
- session = wikittyProxy.store(session);
-
- session.setField("ouaf", "a", 1);
- session.setField("ouaf", "b", 1.0);
- session.setField("ouaf", "c", "Ouaf");
- session.setNum(1);
- session.setSessionDate(DateUtils.addMinutes(new Date(), 15));
- Session sessionService = wikittyProxy.store(session);
-
- if (session.getWikittyId().equals(sessionService.getWikittyId())) {
- int scInt = wikittyProxy.getWikitty(sessionService).getFieldAsInt("ouaf", "a");
- int lcInt = wikittyProxy.getWikitty(session).getFieldAsInt("ouaf", "a");
-
- Float scFloat = wikittyProxy.getWikitty(sessionService).getFieldAsFloat("ouaf", "b");
- Float lcFloat = wikittyProxy.getWikitty(session).getFieldAsFloat("ouaf", "b");
-
- String scString = wikittyProxy.getWikitty(sessionService).getFieldAsString("ouaf", "c");
- String lcString = wikittyProxy.getWikitty(session).getFieldAsString("ouaf", "c");
-
- log.info("testPropagation result, local : " + session.getNum() + " serveur : " + sessionService.getNum());
- log.info("testPropagation result as int, local : " + lcInt + " serveur : " + scInt);
- log.info("testPropagation result as float, local : " + lcFloat + " serveur : " + scFloat);
- log.info("testPropagation result as String, local : " + lcString + " serveur : " + scString);
- log.info("testPropagation result, local : " + session.getSessionDate() + " serveur : " + sessionService.getSessionDate());
-
- Assert.assertEquals(session.getNum(), sessionService.getNum());
- Assert.assertEquals(lcInt, scInt);
- Assert.assertEquals(lcFloat, scFloat);
- Assert.assertEquals(lcString, scString);
- Assert.assertEquals(session.getSessionDate(), sessionService.getSessionDate());
- }
-
- wikittyProxy.delete(session.getWikittyId());
- }
-
-}
Modified: trunk/vradi-swing/pom.xml
===================================================================
--- trunk/vradi-swing/pom.xml 2011-05-26 09:47:13 UTC (rev 53)
+++ trunk/vradi-swing/pom.xml 2011-05-26 13:39:50 UTC (rev 54)
@@ -86,12 +86,6 @@
</dependency>
<dependency>
- <groupId>org.nuiton.wikitty</groupId>
- <artifactId>wikitty-hessian-client</artifactId>
- <scope>runtime</scope>
- </dependency>
-
- <dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</dependency>
@@ -112,11 +106,6 @@
</dependency>
<dependency>
- <groupId>com.caucho</groupId>
- <artifactId>hessian</artifactId>
- </dependency>
-
- <dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-webapp</artifactId>
<scope>runtime</scope>
Modified: trunk/vradi-swing/src/main/java/org/chorem/vradi/VradiConfig.java
===================================================================
--- trunk/vradi-swing/src/main/java/org/chorem/vradi/VradiConfig.java 2011-05-26 09:47:13 UTC (rev 53)
+++ trunk/vradi-swing/src/main/java/org/chorem/vradi/VradiConfig.java 2011-05-26 13:39:50 UTC (rev 54)
@@ -170,12 +170,6 @@
_("vradi.config.password"),
"", String.class, true, true),
- // achitecture client serveur
- REMOTE_ENDPOINT(
- "vradi.remote.endpoint",
- _("vradi.config.remote.endpoint.description"),
- "", String.class, false, false),
-
// user datas
QUERIES(
"vradi.queries",
Modified: trunk/vradi-swing/src/main/java/org/chorem/vradi/VradiConfigHelper.java
===================================================================
--- trunk/vradi-swing/src/main/java/org/chorem/vradi/VradiConfigHelper.java 2011-05-26 09:47:13 UTC (rev 53)
+++ trunk/vradi-swing/src/main/java/org/chorem/vradi/VradiConfigHelper.java 2011-05-26 13:39:50 UTC (rev 54)
@@ -165,19 +165,6 @@
}
/**
- * Get remote endpoint base url.
- * <p/>
- * If not valid url, embedded mode is used.
- *
- * @param config vradi swing configuration
- * @return remote endpoint base url
- */
- public static String getRemoteEndpoint(ApplicationConfig config) {
- String endpoint = config.getOption(VradiConfig.VradiSwingOption.REMOTE_ENDPOINT.key);
- return endpoint;
- }
-
- /**
* Get user queries (comma separated).
* <p/>
* Warning to inner comma in queries, use {@link StringUtil#split(String, String)}
@@ -372,15 +359,4 @@
config.setOption(VradiConfig.VradiSwingOption.THESAURUS_EXPANDED.key, String.valueOf(state));
config.saveForUser();
}
-
- /**
- * Change remote endpoint url.
- *
- * @param config vradi swing configuration
- * @param newEndpoint new base url
- */
- public static void setRemoteEndPoint(ApplicationConfig config, String newEndpoint) {
- config.setOption(VradiConfig.VradiSwingOption.REMOTE_ENDPOINT.key, newEndpoint);
- }
-
}
Modified: trunk/vradi-swing/src/main/java/org/chorem/vradi/services/VradiService.java
===================================================================
--- trunk/vradi-swing/src/main/java/org/chorem/vradi/services/VradiService.java 2011-05-26 09:47:13 UTC (rev 53)
+++ trunk/vradi-swing/src/main/java/org/chorem/vradi/services/VradiService.java 2011-05-26 13:39:50 UTC (rev 54)
@@ -23,23 +23,14 @@
*/
package org.chorem.vradi.services;
-import com.caucho.hessian.client.HessianProxyFactory;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.chorem.vradi.VradiConfigHelper;
import org.nuiton.util.ApplicationConfig;
-import org.nuiton.wikitty.WikittyConfig;
-import org.nuiton.wikitty.WikittyConfigOption;
import org.nuiton.wikitty.WikittyProxy;
import org.nuiton.wikitty.WikittyService;
-import org.nuiton.wikitty.WikittyServiceFactory;
-import java.net.MalformedURLException;
-
/**
* Vradi service management.
- * <p/>
- * Can handle embedded server or remote hessian service.
*
* @author $Author$
* @version $Revision$ $Date$
@@ -72,91 +63,18 @@
*/
public static void initServiceProxies(ApplicationConfig configuration) {
- String serviceEndpoint = VradiConfigHelper.getRemoteEndpoint(configuration);
+ vradiStorageService = VradiServiceFactory.getVradiServiceStorage(configuration);
- // check is it's valid url
- if (serviceEndpoint != null && serviceEndpoint.startsWith("http://")) {
- if (log.isInfoEnabled()) {
- log.info("Use remote mode with url : " + serviceEndpoint);
- }
+ wikittyService = VradiServiceFactory.getWikittyService(vradiStorageService);
- HessianProxyFactory factory = new HessianProxyFactory();
- // Fix : com.caucho.hessian.io.HessianProtocolException: '���' is an unknown code
- factory.setHessian2Request(true);
- // pour que les méthodes aux noms dupliquées fonctionnent (arguments different)
- factory.setOverloadEnabled(true);
+ fileService = VradiServiceFactory.getFileService(configuration);
- try {
+ wikittyProxy = VradiServiceFactory.getProxy(wikittyService);
- // vradi service
- vradiStorageService = (VradiStorageService) factory.create(VradiStorageService.class,
- getServiceURL(serviceEndpoint, "vradiservice"));
-
- wikittyService = initLocalWikittyService(configuration);
-
- // file service
- fileService = new FileServiceProxy(getServiceURL(serviceEndpoint, "file"));
-
- } catch (MalformedURLException eee) {
- if (log.isErrorEnabled()) {
- log.error("Can't init remote proxy", eee);
- }
- }
- } else {
- if (log.isWarnEnabled()) {
- log.warn("Can't parse remote serveur endpoint as valid url (" + serviceEndpoint + ")");
- log.warn("Use local embedded mode");
- }
-
- vradiStorageService = new VradiStorageServiceImpl();
- wikittyService = ServiceFactory.getWikittyService(configuration);
- fileService = new FileServiceImpl();
- }
-
- // wrap service local/remote to a proxy
- wikittyProxy = new WikittyProxy();
- wikittyProxy.setWikittyService(wikittyService);
-
- // init data service on local cached wikitty proxy
- vradiDataService = new VradiDataServiceImpl(wikittyProxy);
+ vradiDataService = VradiServiceFactory.getVradiDataService(configuration, wikittyProxy);
}
/**
- * Create a new wikitty service with cache support that use
- * provided WikittyService for non cached data.
- *
- * @param configuration vradi server configuration
- * @return local wikitty service
- */
- protected static WikittyService initLocalWikittyService(ApplicationConfig configuration) {
-
- log.info("Propagation event is set to : " + VradiConfigHelper.getWikittyEventPropagate(configuration));
- log.info("XMPP server is set to : " + VradiConfigHelper.getWikittyEventTransporterXMPPServer(configuration));
- log.info("XMPP room is set to : " + VradiConfigHelper.getWikittyEventTransporterXMPPRoom(configuration));
-
- WikittyService wikittyServiceLocal = WikittyServiceFactory.buildWikittyService(configuration);
- return wikittyServiceLocal;
- }
-
- /**
- * Get service full url.
- *
- * @param serviceEndpoint end point (can't be null)
- * @param serviceEndUrl service small name
- * @return service full url
- */
- protected static String getServiceURL(String serviceEndpoint, String serviceEndUrl) {
- String fullUrl = serviceEndpoint;
-
- // Warn hessian won't work with double /
- if (!fullUrl.endsWith("/")) {
- fullUrl += "/";
- }
- fullUrl += serviceEndUrl;
- return fullUrl;
- }
-
- /**
* Get remote vradi service (execute code on server).s
*
* @return vradi storage service proxy
Modified: trunk/vradi-swing/src/main/java/org/chorem/vradi/ui/VradiMainUIHandler.java
===================================================================
--- trunk/vradi-swing/src/main/java/org/chorem/vradi/ui/VradiMainUIHandler.java 2011-05-26 09:47:13 UTC (rev 53)
+++ trunk/vradi-swing/src/main/java/org/chorem/vradi/ui/VradiMainUIHandler.java 2011-05-26 13:39:50 UTC (rev 54)
@@ -386,9 +386,9 @@
modelBuilder.addOption(VradiConfig.VradiSwingOption.LOCALE);
// category 3
- modelBuilder.addCategory(n_("vradi.config.category.remote"),
- n_("vradi.config.category.remote.description"));
- modelBuilder.addOption(VradiConfig.VradiSwingOption.REMOTE_ENDPOINT);
+// modelBuilder.addCategory(n_("vradi.config.category.remote"),
+// n_("vradi.config.category.remote.description"));
+// modelBuilder.addOption(VradiConfig.VradiSwingOption.REMOTE_ENDPOINT);
modelBuilder.buildUI(context, "vradi.config.category.directories");
Modified: trunk/vradi-swing/src/main/resources/vradi.properties
===================================================================
--- trunk/vradi-swing/src/main/resources/vradi.properties 2011-05-26 09:47:13 UTC (rev 53)
+++ trunk/vradi-swing/src/main/resources/vradi.properties 2011-05-26 13:39:50 UTC (rev 54)
@@ -31,8 +31,7 @@
application.organisation.url=${project.organization.url}
# Wikitty
-wikitty.WikittyService.components=org.nuiton.wikitty.services.WikittyServiceHessianClient,\
-org.nuiton.wikitty.services.WikittyServiceNotifier,\
+wikitty.WikittyService.components=org.nuiton.wikitty.services.WikittyServiceNotifier,\
org.nuiton.wikitty.services.WikittyServiceCached,\
org.nuiton.wikitty.services.WikittyServiceSecurity
wikitty.service.cache.allwaysRestoreCopies=false
Modified: trunk/vradi-web/pom.xml
===================================================================
--- trunk/vradi-web/pom.xml 2011-05-26 09:47:13 UTC (rev 53)
+++ trunk/vradi-web/pom.xml 2011-05-26 13:39:50 UTC (rev 54)
@@ -186,12 +186,6 @@
</dependency>
<dependency>
- <groupId>org.nuiton.wikitty</groupId>
- <artifactId>wikitty-hessian-client</artifactId>
- <scope>runtime</scope>
- </dependency>
-
- <dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<scope>runtime</scope>
Modified: trunk/vradi-web/src/main/java/org/chorem/vradi/VradiProxy.java
===================================================================
--- trunk/vradi-web/src/main/java/org/chorem/vradi/VradiProxy.java 2011-05-26 09:47:13 UTC (rev 53)
+++ trunk/vradi-web/src/main/java/org/chorem/vradi/VradiProxy.java 2011-05-26 13:39:50 UTC (rev 54)
@@ -4,10 +4,11 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.chorem.vradi.entities.Attachment;
+import org.chorem.vradi.services.VradiServiceFactory;
+import org.chorem.vradi.services.VradiStorageService;
import org.nuiton.util.ApplicationConfig;
import org.nuiton.wikitty.WikittyProxy;
import org.nuiton.wikitty.WikittyService;
-import org.nuiton.wikitty.WikittyServiceFactory;
import org.nuiton.wikitty.search.Criteria;
import org.nuiton.wikitty.search.PagedResult;
import org.nuiton.wikitty.search.Search;
@@ -37,9 +38,11 @@
* @param token
* @return
*/
- static public VradiProxy getInstance(String token) {
+ static public VradiProxy getInstance(VradiStorageService vradiStorageService, String token) {
ApplicationConfig config = VradiWebConfig.getConfig();
- WikittyService ws = getWikittyService(config);
+ if (ws == null) {
+ ws = VradiServiceFactory.getWikittyService(vradiStorageService);
+ }
VradiProxy result = new VradiProxy(config, ws);
result.setSecurityToken(token);
@@ -47,35 +50,17 @@
}
/**
- * Returns WikittyService to use. This WikittyService is singleton.
- *
- * @param config
- * @return WikittyService instance
- */
- static protected WikittyService getWikittyService(ApplicationConfig config) {
- if (ws == null) {
- synchronized(VradiProxy.class) {
- if (ws == null) {
- ws = WikittyServiceFactory.buildWikittyService(config);
- }
- }
- }
- return ws;
- }
-
- /**
* Returns the attachments linked with a wikitty id ordered descending
* by date
*
* @param formNoteId
* @return the list of attachments
*/
- static public List<Attachment> getAttachments(String formNoteId) {
+ public List<Attachment> getAttachments(String formNoteId) {
Criteria criteria = Search.query().
eq(Attachment.FQ_FIELD_ATTACHMENT_FORMNOTE, formNoteId)
.criteria().addSortDescending(Attachment.FQ_FIELD_ATTACHMENT_DATE);
- PagedResult<Attachment> result = getInstance(null).
- findAllByCriteria(Attachment.class, criteria);
+ PagedResult<Attachment> result = findAllByCriteria(Attachment.class, criteria);
List<Attachment> attachments = result.getAll();
return attachments;
}
Modified: trunk/vradi-web/src/main/java/org/chorem/vradi/VradiSession.java
===================================================================
--- trunk/vradi-web/src/main/java/org/chorem/vradi/VradiSession.java 2011-05-26 09:47:13 UTC (rev 53)
+++ trunk/vradi-web/src/main/java/org/chorem/vradi/VradiSession.java 2011-05-26 13:39:50 UTC (rev 54)
@@ -1,6 +1,5 @@
package org.chorem.vradi;
-import java.util.Locale;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
@@ -8,15 +7,11 @@
import org.apache.commons.logging.LogFactory;
import org.chorem.vradi.entities.VradiUser;
import org.chorem.vradi.services.VradiDataService;
-import org.chorem.vradi.services.VradiDataServiceImpl;
+import org.chorem.vradi.services.VradiServiceFactory;
+import org.chorem.vradi.services.VradiStorageService;
import org.nuiton.i18n.I18n;
import org.nuiton.i18n.init.DefaultI18nInitializer;
import org.nuiton.util.ApplicationConfig;
-import org.nuiton.wikitty.WikittyConfigOption;
-import org.nuiton.wikitty.WikittyProxy;
-import org.nuiton.wikitty.WikittyService;
-import org.nuiton.wikitty.WikittyServiceFactory;
-import org.nuiton.wikitty.entities.WikittyUser;
/**
* Classe utilisee pour stocker les objets utils en session utilisateur
@@ -39,6 +34,7 @@
transient protected VradiProxy proxy = null;
transient protected VradiDataService dataService;
+ transient protected VradiStorageService vradiServiceStorage;
public VradiSession() {
// FIXME poussin 20110521 ?
@@ -64,7 +60,7 @@
public VradiProxy getProxy() {
if (proxy == null) {
- proxy = VradiProxy.getInstance(securityToken);
+ proxy = VradiProxy.getInstance(getVradiStorageService(), securityToken);
}
return proxy;
}
@@ -101,13 +97,25 @@
return result;
}
+ public VradiStorageService getVradiStorageService() {
+ if (vradiServiceStorage == null) {
+ synchronized(VradiSession.class) {
+ if (vradiServiceStorage == null) {
+ ApplicationConfig config = VradiWebConfig.getConfig();
+ vradiServiceStorage = VradiServiceFactory.getVradiServiceStorage(config);
+ }
+ }
+ }
+ return vradiServiceStorage;
+ }
+
public VradiDataService getDataService() {
if (dataService == null) {
synchronized(VradiSession.class) {
if (dataService == null) {
ApplicationConfig config = VradiWebConfig.getConfig();
VradiProxy proxy = getProxy();
- dataService = new VradiDataServiceImpl(config, proxy);
+ dataService = VradiServiceFactory.getVradiDataService(config, proxy);
}
}
}
Modified: trunk/vradi-web/src/main/resources/vradi-web.properties
===================================================================
--- trunk/vradi-web/src/main/resources/vradi-web.properties 2011-05-26 09:47:13 UTC (rev 53)
+++ trunk/vradi-web/src/main/resources/vradi-web.properties 2011-05-26 13:39:50 UTC (rev 54)
@@ -37,7 +37,6 @@
wikitty.service.event.listen=true
wikitty.service.event.propagate.transporter=org.nuiton.wikitty.services.XMPPNotifierTransporter
wikitty.WikittyServiceCached.components=org.nuiton.wikitty.services.WikittyCacheJCS
-wikitty.service.server.url=${vradi.remote.endpoint}/wikittyservice
wikitty.service.cache.priority.extensions=Thesaurus, User, Status, XmlStream
jcs.default=
jcs.default.cacheattributes.MaxObjects=1000
1
0
Author: bpoussin
Date: 2011-05-26 11:47:13 +0200 (Thu, 26 May 2011)
New Revision: 53
Url: http://chorem.org/repositories/revision/vradi/53
Log:
- add jquery plugin (better than dojo)
- add rst action (generate from rst and set field if necessary)
- add AbstractEditAction used for EditAction and RSTAction to filter acceptable wikitty field
Modified:
trunk/vradi-web/src/main/resources/struts.xml
Modified: trunk/vradi-web/src/main/resources/struts.xml
===================================================================
--- trunk/vradi-web/src/main/resources/struts.xml 2011-05-26 09:46:08 UTC (rev 52)
+++ trunk/vradi-web/src/main/resources/struts.xml 2011-05-26 09:47:13 UTC (rev 53)
@@ -4,11 +4,18 @@
"-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
"http://struts.apache.org/dtds/struts-2.0.dtd">
<struts>
- <constant name="struts.devMode" value="true"/>
+ <constant name="struts.enable.SlashesInActionNames" value="true"/>
<constant name="struts.ognl.allowStaticMethodAccess" value="true"/>
- <constant name="struts.enable.SlashesInActionNames" value="true"/>
<!--
+ | next constant is for development process, in production this constants
+ | must be removed
+ +-->
+ <constant name="struts.devMode" value="true"/>
+ <constant name="struts.ognl.logMissingProperties" value="true" />
+ <constant name="struts.el.throwExceptionOnFailure" value="true" />
+
+ <!--
| Definition d'un package pour l'espace public
| - surcharge de parametre de certain intercepteur
+-->
@@ -112,5 +119,28 @@
<result type="wikitty-json"/>
</action>
</package>
-
+
+ <package name="ajax" namespace="/ajax" extends="restrictedArea">
+ <!--
+ | Essai de generer du HTML a partir d'un champs d'un objet ou du
+ | parametre 'rst'
+ +-->
+ <action name="rst" class="org.chorem.vradi.actions.RSTAction">
+ <param name="includes">FormNote\.summary,FormNote\.content</param>
+ <result type="stream">
+ <param name="contentType">${mimeType}</param>
+ <param name="inputName">rstResult</param>
+ </result>
+ </action>
+ <!--
+ | Edit n'importe qu'elle objet en modifiant les valeurs des champs retrouve
+ | en parametre
+ +-->
+ <action name="edit/*" class="org.chorem.vradi.actions.EditAction">
+ <param name="id">{1}</param>
+ <param name="includes">FormNote\..*</param>
+ <result type="wikitty-json"/>
+ </action>
+ </package>
+
</struts>
1
0