Restructure node distirbution
authorMathieu Baudier <mbaudier@argeo.org>
Wed, 5 Sep 2012 10:44:46 +0000 (10:44 +0000)
committerMathieu Baudier <mbaudier@argeo.org>
Wed, 5 Sep 2012 10:44:46 +0000 (10:44 +0000)
git-svn-id: https://svn.argeo.org/commons/trunk@5555 4cfe0d0a-d680-48aa-b62c-e0a02a3f76cc

31 files changed:
security/dep/org.argeo.security.dep.node/pom.xml
security/runtime/org.argeo.security.mvc/.classpath [deleted file]
security/runtime/org.argeo.security.mvc/.project [deleted file]
security/runtime/org.argeo.security.mvc/.settings/org.eclipse.jdt.core.prefs [deleted file]
security/runtime/org.argeo.security.mvc/.settings/org.maven.ide.eclipse.prefs [deleted file]
security/runtime/org.argeo.security.mvc/build.properties [deleted file]
security/runtime/org.argeo.security.mvc/pom.xml [deleted file]
security/runtime/org.argeo.security.mvc/src/main/java/org/argeo/security/mvc/ArgeoRememberMeServices.java [deleted file]
security/runtime/org.argeo.security.mvc/src/main/java/org/argeo/security/mvc/ArgeoUserInterceptor.java [deleted file]
security/runtime/org.argeo.security.mvc/src/main/java/org/argeo/security/mvc/UsersRolesController.java [deleted file]
security/runtime/pom.xml
server/dep/org.argeo.server.dep.activemq/pom.xml
server/modules/org.argeo.jackrabbit.webapp/WEB-INF/jcr-manager-servlet.xml [deleted file]
server/modules/org.argeo.jackrabbit.webapp/WEB-INF/web.xml
server/modules/org.argeo.jackrabbit.webapp/WEB-INF/xmlremoting-servlet.xml [deleted file]
server/modules/org.argeo.jackrabbit.webapp/pom.xml
server/runtime/org.argeo.server.core/pom.xml
server/runtime/org.argeo.server.core/src/main/java/org/argeo/server/mvc/jcr/JcrBrowserController.java [new file with mode: 0644]
server/runtime/org.argeo.server.core/src/main/java/org/argeo/server/mvc/jcr/JcrManagerController.java [new file with mode: 0644]
server/runtime/org.argeo.server.core/src/main/java/org/argeo/server/mvc/jcr/JcrMvcConstants.java [new file with mode: 0644]
server/runtime/org.argeo.server.core/src/main/java/org/argeo/server/mvc/jcr/JcrXmlServerSerializer.java [new file with mode: 0644]
server/runtime/org.argeo.server.core/src/main/java/org/argeo/server/mvc/jcr/OpenSessionInViewJcrInterceptor.java [new file with mode: 0644]
server/runtime/org.argeo.server.jackrabbit/pom.xml
server/runtime/org.argeo.server.jcr.mvc/pom.xml
server/runtime/org.argeo.server.jcr.mvc/src/main/java/org/argeo/jcr/mvc/JcrBrowserController.java [deleted file]
server/runtime/org.argeo.server.jcr.mvc/src/main/java/org/argeo/jcr/mvc/JcrManagerController.java [deleted file]
server/runtime/org.argeo.server.jcr.mvc/src/main/java/org/argeo/jcr/mvc/JcrMvcConstants.java [deleted file]
server/runtime/org.argeo.server.jcr.mvc/src/main/java/org/argeo/jcr/mvc/JcrXmlServerSerializer.java [deleted file]
server/runtime/org.argeo.server.jcr.mvc/src/main/java/org/argeo/jcr/mvc/MultipleRepositoryHandlerMapping.java
server/runtime/org.argeo.server.jcr.mvc/src/main/java/org/argeo/jcr/mvc/OpenSessionInViewJcrInterceptor.java [deleted file]
server/runtime/org.argeo.server.jcr.mvc/src/main/java/org/argeo/jcr/mvc/ResourceProxyServlet.java

index e55a787023766550046706867b310ec462e1f211..5a265ae9a7ae9fb4a781edaa8743446f0e3cd5be 100644 (file)
                </plugins>
        </build>
        <dependencies>
+               <!-- Default JCR repositories configurations -->
+               <dependency>
+                       <groupId>org.argeo.commons.server</groupId>
+                       <artifactId>org.argeo.node.repo.jackrabbit</artifactId>
+                       <version>1.1.4-SNAPSHOT</version>
+               </dependency>
+               <dependency>
+                       <groupId>org.argeo.commons.server</groupId>
+                       <artifactId>org.argeo.node.repofactory.jackrabbit</artifactId>
+                       <version>1.1.4-SNAPSHOT</version>
+               </dependency>
+
                <!-- OSGi Boot (and Equinox) -->
                <dependency>
                        <groupId>org.argeo.commons.base</groupId>
                        <artifactId>org.argeo.security.core</artifactId>
                        <version>1.1.4-SNAPSHOT</version>
                </dependency>
-               <dependency>
-                       <groupId>org.argeo.commons.security</groupId>
-                       <artifactId>org.argeo.security.mvc</artifactId>
-                       <version>1.1.4-SNAPSHOT</version>
-               </dependency>
 
                <!-- Xerces and Xalan -->
                <dependency>
                        <artifactId>javax.mail</artifactId>
                </dependency>
 
+               <!-- Bouncycastle (cryptography) -->
+               <dependency>
+                       <groupId>org.argeo.tp</groupId>
+                       <artifactId>bcprov</artifactId>
+               </dependency>
+               <dependency>
+                       <groupId>org.argeo.tp</groupId>
+                       <artifactId>bcmail</artifactId>
+               </dependency>
+
                <!-- Commons -->
                <dependency>
                        <groupId>org.argeo.tp</groupId>
                        <groupId>org.argeo.tp</groupId>
                        <artifactId>org.springframework.context.support</artifactId>
                </dependency>
-               <!-- <dependency> -->
-               <!-- <groupId>org.springframework</groupId> -->
-               <!-- <artifactId>org.springframework.orm</artifactId> -->
-               <!-- </dependency> -->
-               <!-- <dependency> -->
-               <!-- <groupId>org.springframework</groupId> -->
-               <!-- <artifactId>org.springframework.jdbc</artifactId> -->
-               <!-- </dependency> -->
-               <dependency>
-                       <groupId>org.argeo.tp</groupId>
-                       <artifactId>org.springframework.jms</artifactId>
-               </dependency>
 
                <!-- Spring OSGi -->
                <dependency>
                        <artifactId>org.argeo.security.jackrabbit</artifactId>
                        <version>1.1.4-SNAPSHOT</version>
                </dependency>
-               <dependency>
-                       <groupId>org.argeo.commons.server</groupId>
-                       <artifactId>org.argeo.node.repo.jackrabbit</artifactId>
-                       <version>1.1.4-SNAPSHOT</version>
-               </dependency>
-               <dependency>
-                       <groupId>org.argeo.commons.server</groupId>
-                       <artifactId>org.argeo.node.repofactory.jackrabbit</artifactId>
-                       <version>1.1.4-SNAPSHOT</version>
-               </dependency>
-
-               <!-- Active MQ -->
-               <dependency>
-                       <groupId>org.argeo.commons.server</groupId>
-                       <artifactId>org.argeo.server.dep.activemq</artifactId>
-                       <version>1.1.4-SNAPSHOT</version>
-                       <type>pom</type>
-               </dependency>
-               <dependency>
-                       <groupId>org.argeo.commons.security</groupId>
-                       <artifactId>org.argeo.security.activemq</artifactId>
-                       <version>1.1.4-SNAPSHOT</version>
-               </dependency>
-               <dependency>
-                       <groupId>org.argeo.commons.server</groupId>
-                       <artifactId>org.argeo.server.activemq.broker</artifactId>
-                       <version>1.1.4-SNAPSHOT</version>
-               </dependency>
 
                <!-- Scheduling -->
                <dependency>
                        <version>1.1.4-SNAPSHOT</version>
                </dependency>
 
-               <!-- LDAP server -->
+               <!-- DB drivers -->
                <dependency>
-                       <groupId>org.argeo.commons.server</groupId>
-                       <artifactId>org.argeo.server.dep.ads</artifactId>
-                       <version>1.1.4-SNAPSHOT</version>
-                       <type>pom</type>
+                       <groupId>org.argeo.tp</groupId>
+                       <artifactId>org.h2</artifactId>
                </dependency>
                <dependency>
-                       <groupId>org.argeo.commons.server</groupId>
-                       <artifactId>org.argeo.server.ads.server</artifactId>
-                       <version>1.1.4-SNAPSHOT</version>
+                       <groupId>org.argeo.tp</groupId>
+                       <artifactId>com.mysql.jdbc</artifactId>
                </dependency>
                <dependency>
-                       <groupId>org.argeo.commons.server</groupId>
-                       <artifactId>org.argeo.server.ads</artifactId>
-                       <version>1.1.4-SNAPSHOT</version>
+                       <groupId>org.argeo.tp</groupId>
+                       <artifactId>org.postgresql.jdbc3</artifactId>
                </dependency>
-               <!-- <dependency> -->
-               <!-- <groupId>org.argeo.commons.server</groupId> -->
-               <!-- <artifactId>org.argeo.server.json</artifactId> -->
-               <!-- <version>0.3.4-SNAPSHOT</version> -->
-               <!-- </dependency> -->
 
-               <!-- Hibernate -->
+               <!-- LDAP Apache Directory server -->
                <dependency>
                        <groupId>org.argeo.commons.server</groupId>
-                       <artifactId>org.argeo.server.dep.hibernate</artifactId>
+                       <artifactId>org.argeo.server.dep.ads</artifactId>
                        <version>1.1.4-SNAPSHOT</version>
                        <type>pom</type>
                </dependency>
-
-               <!-- DB drivers -->
-               <dependency>
-                       <groupId>org.argeo.tp</groupId>
-                       <artifactId>org.h2</artifactId>
-               </dependency>
                <dependency>
-                       <groupId>org.argeo.tp</groupId>
-                       <artifactId>com.mysql.jdbc</artifactId>
+                       <groupId>org.argeo.commons.server</groupId>
+                       <artifactId>org.argeo.server.ads.server</artifactId>
+                       <version>1.1.4-SNAPSHOT</version>
                </dependency>
                <dependency>
-                       <groupId>org.argeo.tp</groupId>
-                       <artifactId>org.postgresql.jdbc3</artifactId>
+                       <groupId>org.argeo.commons.server</groupId>
+                       <artifactId>org.argeo.server.ads</artifactId>
+                       <version>1.1.4-SNAPSHOT</version>
                </dependency>
 
                <!-- Software development -->
diff --git a/security/runtime/org.argeo.security.mvc/.classpath b/security/runtime/org.argeo.security.mvc/.classpath
deleted file mode 100644 (file)
index ff41fbb..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
-       <classpathentry kind="src" output="target/classes" path="src/main/java"/>
-       <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
-       <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
-       <classpathentry kind="output" path="bin"/>
-</classpath>
diff --git a/security/runtime/org.argeo.security.mvc/.project b/security/runtime/org.argeo.security.mvc/.project
deleted file mode 100644 (file)
index b287d08..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
-       <name>org.argeo.security.mvc</name>
-       <comment></comment>
-       <projects>
-       </projects>
-       <buildSpec>
-               <buildCommand>
-                       <name>org.eclipse.jdt.core.javabuilder</name>
-                       <arguments>
-                       </arguments>
-               </buildCommand>
-               <buildCommand>
-                       <name>org.eclipse.pde.ManifestBuilder</name>
-                       <arguments>
-                       </arguments>
-               </buildCommand>
-               <buildCommand>
-                       <name>org.eclipse.pde.SchemaBuilder</name>
-                       <arguments>
-                       </arguments>
-               </buildCommand>
-       </buildSpec>
-       <natures>
-               <nature>org.eclipse.jdt.core.javanature</nature>
-               <nature>org.eclipse.pde.PluginNature</nature>
-       </natures>
-</projectDescription>
diff --git a/security/runtime/org.argeo.security.mvc/.settings/org.eclipse.jdt.core.prefs b/security/runtime/org.argeo.security.mvc/.settings/org.eclipse.jdt.core.prefs
deleted file mode 100644 (file)
index d2110d0..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-#Tue Sep 15 11:35:07 CEST 2009
-eclipse.preferences.version=1
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
-org.eclipse.jdt.core.compiler.compliance=1.5
-org.eclipse.jdt.core.compiler.source=1.5
diff --git a/security/runtime/org.argeo.security.mvc/.settings/org.maven.ide.eclipse.prefs b/security/runtime/org.argeo.security.mvc/.settings/org.maven.ide.eclipse.prefs
deleted file mode 100644 (file)
index 2169c43..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-#Tue Sep 15 11:35:01 CEST 2009
-activeProfiles=
-eclipse.preferences.version=1
-fullBuildGoals=process-test-resources
-includeModules=false
-resolveWorkspaceProjects=true
-resourceFilterGoals=process-resources resources\:testResources
-skipCompilerPlugin=true
-version=1
diff --git a/security/runtime/org.argeo.security.mvc/build.properties b/security/runtime/org.argeo.security.mvc/build.properties
deleted file mode 100644 (file)
index a740a34..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-additional.bundles = org.springframework.beans
-source.. = src/main/java/
diff --git a/security/runtime/org.argeo.security.mvc/pom.xml b/security/runtime/org.argeo.security.mvc/pom.xml
deleted file mode 100644 (file)
index 85cd0d7..0000000
+++ /dev/null
@@ -1,72 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?><project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
-       <modelVersion>4.0.0</modelVersion>
-       <parent>
-               <groupId>org.argeo.commons.security</groupId>
-               <artifactId>runtime</artifactId>
-               <version>1.1.4-SNAPSHOT</version>
-               <relativePath>..</relativePath>
-       </parent>
-       <artifactId>org.argeo.security.mvc</artifactId>
-       <name>Commons Security MVC</name>
-       <build>
-               <plugins>
-                       <plugin>
-                               <groupId>org.apache.maven.plugins</groupId>
-                               <artifactId>maven-compiler-plugin</artifactId>
-                       </plugin>
-                       <plugin>
-                               <groupId>org.apache.maven.plugins</groupId>
-                               <artifactId>maven-source-plugin</artifactId>
-                       </plugin>
-                       <plugin>
-                               <groupId>org.apache.maven.plugins</groupId>
-                               <artifactId>maven-jar-plugin</artifactId>
-                       </plugin>
-                       <plugin>
-                               <groupId>org.apache.felix</groupId>
-                               <artifactId>maven-bundle-plugin</artifactId>
-
-                               <configuration>
-                                       <instructions>
-                                               <Export-Package>
-                                                       org.argeo.security.mvc.*
-                                               </Export-Package>
-                                               <Import-Package>*,javax.servlet</Import-Package>
-                                       </instructions>
-                               </configuration>
-                       </plugin>
-               </plugins>
-       </build>
-       <dependencies>
-               <!-- Argeo Server -->
-               <dependency>
-                       <groupId>org.argeo.commons.server</groupId>
-                       <artifactId>org.argeo.server.core</artifactId>
-                       <version>1.1.4-SNAPSHOT</version>
-               </dependency>
-
-               <!-- Argeo Security -->
-               <dependency>
-                       <groupId>org.argeo.commons.security</groupId>
-                       <artifactId>org.argeo.security.core</artifactId>
-                       <version>1.1.4-SNAPSHOT</version>
-               </dependency>
-
-               <!-- Spring -->
-               <dependency>
-                       <groupId>org.argeo.tp</groupId>
-                       <artifactId>org.springframework.web.servlet</artifactId>
-               </dependency>
-               <dependency>
-                       <groupId>org.argeo.tp</groupId>
-                       <artifactId>org.springframework.aop</artifactId>
-               </dependency>
-
-               <!-- J2EE -->
-               <dependency>
-                       <groupId>org.argeo.tp</groupId>
-                       <artifactId>javax.servlet</artifactId>
-               </dependency>
-
-       </dependencies>
-</project>
\ No newline at end of file
diff --git a/security/runtime/org.argeo.security.mvc/src/main/java/org/argeo/security/mvc/ArgeoRememberMeServices.java b/security/runtime/org.argeo.security.mvc/src/main/java/org/argeo/security/mvc/ArgeoRememberMeServices.java
deleted file mode 100644 (file)
index fde9f30..0000000
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Copyright (C) 2007-2012 Mathieu Baudier
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *         http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.argeo.security.mvc;
-
-import javax.servlet.http.Cookie;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import org.springframework.security.ui.rememberme.TokenBasedRememberMeServices;
-
-public class ArgeoRememberMeServices extends TokenBasedRememberMeServices {
-       public final static String DEFAULT_COOKIE_NAME = "ARGEO_SECURITY";
-
-       public ArgeoRememberMeServices() {
-               setCookieName(DEFAULT_COOKIE_NAME);
-       }
-
-       /**
-        * Sets a "cancel cookie" (with maxAge = 0) on the response to disable
-        * persistent logins.
-        * 
-        * @param request
-        * @param response
-        */
-       protected void cancelCookie(HttpServletRequest request,
-                       HttpServletResponse response) {
-               Cookie cookie = new Cookie(getCookieName(), null);
-               cookie.setMaxAge(0);
-               cookie.setPath("/");
-
-               response.addCookie(cookie);
-       }
-
-       /**
-        * Sets the cookie on the response
-        * 
-        * @param tokens
-        *            the tokens which will be encoded to make the cookie value.
-        * @param maxAge
-        *            the value passed to {@link Cookie#setMaxAge(int)}
-        * @param request
-        *            the request
-        * @param response
-        *            the response to add the cookie to.
-        */
-       protected void setCookie(String[] tokens, int maxAge,
-                       HttpServletRequest request, HttpServletResponse response) {
-               String cookieValue = encodeCookie(tokens);
-               Cookie cookie = new Cookie(getCookieName(), cookieValue);
-               cookie.setMaxAge(maxAge);
-               cookie.setPath("/");
-               response.addCookie(cookie);
-       }
-
-}
diff --git a/security/runtime/org.argeo.security.mvc/src/main/java/org/argeo/security/mvc/ArgeoUserInterceptor.java b/security/runtime/org.argeo.security.mvc/src/main/java/org/argeo/security/mvc/ArgeoUserInterceptor.java
deleted file mode 100644 (file)
index fd83e9f..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Copyright (C) 2007-2012 Mathieu Baudier
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *         http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.argeo.security.mvc;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import org.argeo.security.UserAdminService;
-import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;
-
-/** Add the current argeo user as an attribute to the request. */
-public class ArgeoUserInterceptor extends HandlerInterceptorAdapter {
-       private UserAdminService securityService;
-
-       @Override
-       public boolean preHandle(HttpServletRequest request,
-                       HttpServletResponse response, Object handler) throws Exception {
-               //request.setAttribute("argeoUser", securityService.getCurrentUser());
-               return super.preHandle(request, response, handler);
-       }
-
-       public void setSecurityService(UserAdminService securityService) {
-               this.securityService = securityService;
-       }
-
-}
diff --git a/security/runtime/org.argeo.security.mvc/src/main/java/org/argeo/security/mvc/UsersRolesController.java b/security/runtime/org.argeo.security.mvc/src/main/java/org/argeo/security/mvc/UsersRolesController.java
deleted file mode 100644 (file)
index 185d376..0000000
+++ /dev/null
@@ -1,134 +0,0 @@
-/*
- * Copyright (C) 2007-2012 Mathieu Baudier
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *         http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.argeo.security.mvc;
-
-import org.argeo.server.mvc.MvcConstants;
-import org.springframework.stereotype.Controller;
-
-@Controller
-public class UsersRolesController implements MvcConstants {
-//     private ArgeoSecurityService securityService;
-//     private Deserializer userDeserializer = null;
-
-       /* USER */
-
-//     @RequestMapping("/getCredentials.*")
-//     @ModelAttribute("user")
-//     public ArgeoUser getCredentials() {
-//             ArgeoUser argeoUser = securityService.getCurrentUser();
-//             if (argeoUser == null)
-//                     return new SimpleArgeoUser();
-//             else
-//                     return argeoUser;
-//     }
-//
-//     @RequestMapping("/getUsersList.*")
-//     @ModelAttribute("users")
-//     public Set<ArgeoUser> getUsersList() {
-//             return securityService.listUsers();
-//     }
-//
-//     @RequestMapping("/userExists.*")
-//     public BooleanAnswer userExists(@RequestParam("username") String username) {
-//             return new BooleanAnswer(securityService.userExists(username));
-//     }
-//
-//     @RequestMapping("/createUser.*")
-//     @ModelAttribute("user")
-//     public ArgeoUser createUser(Reader reader) {
-//             ArgeoUser user = userDeserializer.deserialize(reader,
-//                             SimpleArgeoUser.class);
-//             securityService.newUser(user);
-//             return securityService.getUser(user.getUsername());
-//     }
-//
-//     @RequestMapping("/updateUser.*")
-//     @ModelAttribute("user")
-//     public ArgeoUser updateUser(Reader reader) {
-//             ArgeoUser user = userDeserializer.deserialize(reader,
-//                             SimpleArgeoUser.class);
-//             securityService.updateUser(user);
-//             return securityService.getUser(user.getUsername());
-//     }
-//
-//     @RequestMapping("/updateUserSelf.*")
-//     @ModelAttribute("user")
-//     /** Will only update the user natures.*/
-//     public ArgeoUser updateUserSelf(Reader reader) {
-//             ArgeoUser user = securityService.getCurrentUser();
-//             ArgeoUser userForNatures = userDeserializer.deserialize(reader,
-//                             SimpleArgeoUser.class);
-//             user.updateUserNatures(userForNatures.getUserNatures());
-//             securityService.updateUser(user);
-//             return securityService.getUser(user.getUsername());
-//     }
-//
-//     @RequestMapping("/deleteUser.*")
-//     public ServerAnswer deleteUser(@RequestParam("username") String username) {
-//             securityService.deleteUser(username);
-//             return ServerAnswer.ok("User " + username + " deleted");
-//     }
-//
-//     @RequestMapping("/getUserDetails.*")
-//     @ModelAttribute("user")
-//     public ArgeoUser getUserDetails(@RequestParam("username") String username) {
-//             return securityService.getUser(username);
-//     }
-
-       /* ROLE */
-//     @RequestMapping("/getRolesList.*")
-//     @ModelAttribute("roles")
-//     public Set<String> getEditableRolesList() {
-//             return securityService.listEditableRoles();
-//     }
-//
-//     @RequestMapping("/createRole.*")
-//     public ServerAnswer createRole(@RequestParam("role") String role) {
-//             securityService.newRole(role);
-//             return ServerAnswer.ok("Role " + role + " created");
-//     }
-//
-//     @RequestMapping("/deleteRole.*")
-//     public ServerAnswer deleteRole(@RequestParam("role") String role) {
-//             securityService.deleteRole(role);
-//             return ServerAnswer.ok("Role " + role + " deleted");
-//     }
-//
-//     @RequestMapping("/updateUserPassword.*")
-//     public ServerAnswer updateUserPassword(
-//                     @RequestParam("username") String username,
-//                     @RequestParam("password") String password) {
-//             securityService.updateUserPassword(username, password);
-//             return ServerAnswer.ok("Password updated for user " + username);
-//     }
-//
-//     @RequestMapping("/updatePassword.*")
-//     public ServerAnswer updatePassword(
-//                     @RequestParam("oldPassword") String oldPassword,
-//                     @RequestParam("password") String password) {
-//             securityService.updateCurrentUserPassword(oldPassword, password);
-//             return ServerAnswer.ok("Password updated");
-//     }
-//
-//     public void setUserDeserializer(Deserializer userDeserializer) {
-//             this.userDeserializer = userDeserializer;
-//     }
-//
-//     public void setSecurityService(ArgeoSecurityService securityService) {
-//             this.securityService = securityService;
-//     }
-
-}
index 7b718829a8a9bf42f3d665a8324c0712660e9ca3..c2753944dbdf77b65f3bc7bbef20cda9346ad97d 100644 (file)
@@ -16,7 +16,6 @@
                <module>org.argeo.security.ldap</module>
                <module>org.argeo.security.activemq</module>
                <module>org.argeo.security.jackrabbit</module>
-               <module>org.argeo.security.mvc</module>
        </modules>
        <build>
                <resources>
index 46e2eb9c28e845eb2d2b1aa783027919a538c138..7461ff14c119049b27acd944e3ea6a683dc0c182 100644 (file)
 <!--                   <groupId>org.argeo.dep.osgi</groupId> -->
 <!--                   <artifactId>org.argeo.dep.osgi.activemq.optional</artifactId> -->
 <!--           </dependency> -->
-               
-               <dependency>
-                       <groupId>org.argeo.tp</groupId>
-                       <artifactId>org.apache.commons.collections</artifactId>
-                       <scope>test</scope>
-               </dependency>
-               <dependency>
-                       <groupId>org.argeo.tp</groupId>
-                       <artifactId>org.springframework.oxm</artifactId>
-                       <scope>test</scope>
-               </dependency>
-               <dependency>
-                       <groupId>org.argeo.tp</groupId>
-                       <artifactId>org.springframework.xml</artifactId>
-                       <scope>test</scope>
-               </dependency>
        </dependencies>
 </project>
\ No newline at end of file
diff --git a/server/modules/org.argeo.jackrabbit.webapp/WEB-INF/jcr-manager-servlet.xml b/server/modules/org.argeo.jackrabbit.webapp/WEB-INF/jcr-manager-servlet.xml
deleted file mode 100644 (file)
index e2879ec..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<beans xmlns="http://www.springframework.org/schema/beans"
-       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:aop="http://www.springframework.org/schema/aop"
-       xmlns:context="http://www.springframework.org/schema/context"
-       xsi:schemaLocation="
-       http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd 
-       http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
-       http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd">
-
-<!--   <context:component-scan base-package="org.argeo.jcr.mvc" /> -->
-
-<!--   <bean name="**" class="org.argeo.jcr.mvc.JcrManagerController"> -->
-<!--   </bean> -->
-
-<!--   <bean id="viewResolver" class="org.argeo.server.mvc.SerializingViewResolver"> -->
-<!--           <property name="serializer" ref="serverMapper" /> -->
-<!--   </bean> -->
-
-<!--   <bean id="serverMapper" class="org.argeo.server.json.JsonServerMapper"> -->
-<!--   </bean> -->
-
-<!--   <bean class="org.argeo.server.mvc.DefaultHandlerExceptionResolver" /> -->
-
-<!--   <bean id="handlerMapping" -->
-<!--           class="org.springframework.web.servlet.handler.BeanNameUrlHandlerMapping"> -->
-<!--           <property name="interceptors"> -->
-<!--                   <list> -->
-<!--                           <ref bean="osivInterceptor" /> -->
-<!--                   </list> -->
-<!--           </property> -->
-<!--   </bean> -->
-
-</beans>
\ No newline at end of file
index 9e0a7528086ac9e9e4c1cf8d0a6058b41a8d9e04..a017ce9926a629b3266a0d24bc9189e41f9d1694 100644 (file)
                <url-pattern>/pub/*</url-pattern>
        </servlet-mapping>
 
-       <!-- XML remoting
-       <servlet>
-               <servlet-name>xmlremoting</servlet-name>
-               <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
-               <init-param>
-                       <param-name>contextClass</param-name>
-                       <param-value>org.springframework.osgi.web.context.support.OsgiBundleXmlWebApplicationContext</param-value>
-               </init-param>
-               <load-on-startup>1</load-on-startup>
-       </servlet>
-       <servlet-mapping>
-               <servlet-name>xmlremoting</servlet-name>
-               <url-pattern>*.jcr</url-pattern>
-       </servlet-mapping>
- -->
        <!-- WEBDAV servlet -->
        <servlet>
                <servlet-name>webdav</servlet-name>
                <url-pattern>/public/*</url-pattern>
        </servlet-mapping>
 
-       <!-- JCR-MANAGER servlet
-       <servlet>
-               <servlet-name>jcr-manager</servlet-name>
-               <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
-               <init-param>
-                       <param-name>contextClass</param-name>
-                       <param-value>org.springframework.osgi.web.context.support.OsgiBundleXmlWebApplicationContext</param-value>
-               </init-param>
-               <load-on-startup>1</load-on-startup>
-       </servlet>
-
-       <servlet-mapping>
-               <servlet-name>jcr-manager</servlet-name>
-               <url-pattern>/jcr-manager/*</url-pattern>
-       </servlet-mapping>
- -->
-
        <!--  Security -->
        <filter>
                <filter-name>springSecurityFilterChain</filter-name>
diff --git a/server/modules/org.argeo.jackrabbit.webapp/WEB-INF/xmlremoting-servlet.xml b/server/modules/org.argeo.jackrabbit.webapp/WEB-INF/xmlremoting-servlet.xml
deleted file mode 100644 (file)
index b6e2ade..0000000
+++ /dev/null
@@ -1,51 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<beans xmlns="http://www.springframework.org/schema/beans"
-       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:aop="http://www.springframework.org/schema/aop"
-       xmlns:context="http://www.springframework.org/schema/context"
-       xsi:schemaLocation="
-               http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd 
-               http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
-               http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd">
-
-<!--   <context:component-scan base-package="org.argeo.jcr.mvc" /> -->
-
-<!--   <bean name="/*.jcr" class="org.argeo.jcr.mvc.JcrBrowserController" /> -->
-
-<!--   Views -->
-<!--   <bean name="getJcrItem" class="org.argeo.server.mvc.SerializingView"> -->
-<!--           <property name="serializer"> -->
-<!--                   <bean class="org.argeo.jcr.mvc.JcrXmlServerSerializer" /> -->
-<!--           </property> -->
-<!--   </bean> -->
-
-<!--   <bean name="queryJcrNodes" class="org.argeo.server.mvc.SerializingView"> -->
-<!--           <property name="serializer" ref="jsonSerializer" /> -->
-<!--   </bean> -->
-
-<!--   <bean name="queryJcrTable" class="org.argeo.server.mvc.SerializingView"> -->
-<!--           <property name="serializer" ref="jsonSerializer" /> -->
-<!--   </bean> -->
-
-<!--   <bean name="500" class="org.argeo.server.mvc.SerializingView"> -->
-<!--           <property name="serializer" ref="jsonSerializer" /> -->
-<!--   </bean> -->
-
-<!--   Serializers -->
-<!--   <bean id="jsonSerializer" class="org.argeo.server.json.JsonServerSerializer" /> -->
-
-<!--   MVC -->
-<!--   <bean id="handlerMapping" -->
-<!--           class="org.springframework.web.servlet.handler.BeanNameUrlHandlerMapping"> -->
-<!--           <property name="interceptors"> -->
-<!--                   <list> -->
-<!--                           <ref bean="osivInterceptor" /> -->
-<!--                   </list> -->
-<!--           </property> -->
-<!--   </bean> -->
-
-<!--   <bean id="viewResolver" -->
-<!--           class="org.springframework.web.servlet.view.BeanNameViewResolver" /> -->
-
-<!--   <bean class="org.argeo.server.mvc.DefaultHandlerExceptionResolver" /> -->
-
-</beans>
\ No newline at end of file
index 2be9e3d1ffe70fcd4ae71a0b86683d938969a044..201bf0f2303725a534da7dc40d23bb95cac2ffda 100644 (file)
@@ -29,7 +29,6 @@
                                                        org.argeo.jackrabbit.remote,
                                                        org.argeo.jcr,
                                                        org.argeo.jcr.mvc,
-                                                       org.argeo.server.mvc,
                                                        org.springframework.aop,
                                                        org.springframework.aop.framework,
                                                        org.springframework.aop.scope,
index 8e158f110f2c50290a8709b49150e6debd7280f7..6d3d914bef267c468a6adf107d2df20e87887ac4 100644 (file)
@@ -1,5 +1,6 @@
 <?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
        <modelVersion>4.0.0</modelVersion>
        <parent>
                <groupId>org.argeo.commons.server</groupId>
                        <version>1.1.4-SNAPSHOT</version>
                </dependency>
 
+               <!-- JCR -->
+               <dependency>
+                       <groupId>org.argeo.commons.server</groupId>
+                       <artifactId>org.argeo.server.jcr</artifactId>
+                       <version>1.1.4-SNAPSHOT</version>
+               </dependency>
 
                <!-- Apache Commons -->
                <dependency>
@@ -78,5 +85,9 @@
                        <artifactId>slf4j.org.apache.commons.logging</artifactId>
                </dependency>
 
+               <dependency>
+                       <groupId>org.argeo.tp</groupId>
+                       <artifactId>org.apache.commons.fileupload</artifactId>
+               </dependency>
        </dependencies>
 </project>
\ No newline at end of file
diff --git a/server/runtime/org.argeo.server.core/src/main/java/org/argeo/server/mvc/jcr/JcrBrowserController.java b/server/runtime/org.argeo.server.core/src/main/java/org/argeo/server/mvc/jcr/JcrBrowserController.java
new file mode 100644 (file)
index 0000000..bed554f
--- /dev/null
@@ -0,0 +1,88 @@
+/*
+ * Copyright (C) 2007-2012 Mathieu Baudier
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *         http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.argeo.server.mvc.jcr;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import javax.jcr.Item;
+import javax.jcr.NodeIterator;
+import javax.jcr.RepositoryException;
+import javax.jcr.Session;
+import javax.jcr.Value;
+import javax.jcr.query.Query;
+import javax.jcr.query.QueryResult;
+import javax.jcr.query.Row;
+import javax.jcr.query.RowIterator;
+
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.context.request.RequestAttributes;
+import org.springframework.web.context.request.WebRequest;
+
+@Controller
+public class JcrBrowserController implements JcrMvcConstants {
+
+       @RequestMapping("/getJcrItem.*")
+       public Item getJcrItem(WebRequest webRequest,
+                       @RequestParam("path") String path) throws RepositoryException {
+               return ((Session) webRequest.getAttribute(REQUEST_ATTR_SESSION,
+                               RequestAttributes.SCOPE_REQUEST)).getItem(path);
+       }
+
+       @RequestMapping("/queryJcrNodes.*")
+       public List<String> queryJcrNodes(WebRequest webRequest,
+                       @RequestParam("statement") String statement,
+                       @RequestParam("language") String language)
+                       throws RepositoryException {
+               Session session = ((Session) webRequest.getAttribute(
+                               REQUEST_ATTR_SESSION, RequestAttributes.SCOPE_REQUEST));
+               Query query = session.getWorkspace().getQueryManager().createQuery(
+                               statement, language);
+               NodeIterator nit = query.execute().getNodes();
+               List<String> paths = new ArrayList<String>();
+               while (nit.hasNext()) {
+                       paths.add(nit.nextNode().getPath());
+               }
+               return paths;
+       }
+
+       @RequestMapping("/queryJcrTable.*")
+       public List<List<String>> queryJcrTable(WebRequest webRequest,
+                       @RequestParam("statement") String statement,
+                       @RequestParam("language") String language)
+                       throws RepositoryException {
+               Session session = ((Session) webRequest.getAttribute(
+                               REQUEST_ATTR_SESSION, RequestAttributes.SCOPE_REQUEST));
+               Query query = session.getWorkspace().getQueryManager().createQuery(
+                               statement, language);
+               QueryResult queryResult = query.execute();
+               List<List<String>> results = new ArrayList<List<String>>();
+               results.add(Arrays.asList(queryResult.getColumnNames()));
+               RowIterator rit = queryResult.getRows();
+
+               while (rit.hasNext()) {
+                       Row row = rit.nextRow();
+                       List<String> lst = new ArrayList<String>();
+                       for (Value value : row.getValues()) {
+                               lst.add(value.getString());
+                       }
+               }
+               return results;
+       }
+}
diff --git a/server/runtime/org.argeo.server.core/src/main/java/org/argeo/server/mvc/jcr/JcrManagerController.java b/server/runtime/org.argeo.server.core/src/main/java/org/argeo/server/mvc/jcr/JcrManagerController.java
new file mode 100644 (file)
index 0000000..e878378
--- /dev/null
@@ -0,0 +1,96 @@
+/*
+ * Copyright (C) 2007-2012 Mathieu Baudier
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *         http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.argeo.server.mvc.jcr;
+
+import java.util.List;
+import java.util.StringTokenizer;
+
+import javax.jcr.Session;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.commons.fileupload.FileItem;
+import org.apache.commons.fileupload.FileItemFactory;
+import org.apache.commons.fileupload.disk.DiskFileItemFactory;
+import org.apache.commons.fileupload.servlet.ServletFileUpload;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.argeo.jcr.JcrResourceAdapter;
+import org.argeo.server.ServerAnswer;
+import org.argeo.server.mvc.MvcConstants;
+import org.springframework.core.io.ByteArrayResource;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.ModelAttribute;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.context.request.RequestAttributes;
+import org.springframework.web.context.request.WebRequest;
+
+@Controller
+public class JcrManagerController implements MvcConstants, JcrMvcConstants {
+       private final static Log log = LogFactory
+                       .getLog(JcrManagerController.class);
+
+       // Create a factory for disk-based file items
+       private FileItemFactory factory = new DiskFileItemFactory();
+
+       // Create a new file upload handler
+       private ServletFileUpload upload = new ServletFileUpload(factory);
+
+       @SuppressWarnings("unchecked")
+       @RequestMapping("/upload/**")
+       @ModelAttribute(ANSWER_MODEL_KEY_AS_HTML)
+       public ServerAnswer upload(WebRequest webRequest,
+                       HttpServletRequest request, HttpServletResponse response)
+                       throws Exception {
+
+               Session session = ((Session) webRequest.getAttribute(
+                               REQUEST_ATTR_SESSION, RequestAttributes.SCOPE_REQUEST));
+               JcrResourceAdapter resourceAdapter = new JcrResourceAdapter(session);
+               // Parse the request
+               List<FileItem> items = upload.parseRequest(request);
+
+               byte[] arr = null;
+               for (FileItem item : items) {
+                       if (!item.isFormField()) {
+                               arr = item.get();
+                               break;
+                       }
+               }
+
+               ByteArrayResource res = new ByteArrayResource(arr);
+               // String pathInfo = request.getPathInfo();
+
+               StringBuffer path = new StringBuffer("/");
+               StringTokenizer st = new StringTokenizer(request.getPathInfo(), "/");
+               st.nextToken();// skip /upload/
+               while (st.hasMoreTokens()) {
+                       String token = st.nextToken();
+                       if (!st.hasMoreTokens()) {
+                               resourceAdapter.mkdirs(path.toString());
+                               path.append(token);
+                       } else {
+                               path.append(token).append('/');
+                       }
+               }
+               // String path = '/' + pathInfo.substring(1).substring(
+               // pathInfo.indexOf('/'));
+               if (log.isDebugEnabled())
+                       log.debug("Upload to " + path);
+               resourceAdapter.update(path.toString(), res.getInputStream());
+               return ServerAnswer.ok("File " + path + " imported");
+       }
+
+}
diff --git a/server/runtime/org.argeo.server.core/src/main/java/org/argeo/server/mvc/jcr/JcrMvcConstants.java b/server/runtime/org.argeo.server.core/src/main/java/org/argeo/server/mvc/jcr/JcrMvcConstants.java
new file mode 100644 (file)
index 0000000..eec12bd
--- /dev/null
@@ -0,0 +1,20 @@
+/*
+ * Copyright (C) 2007-2012 Mathieu Baudier
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *         http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.argeo.server.mvc.jcr;
+
+public interface JcrMvcConstants {
+       public final static String REQUEST_ATTR_SESSION = "jcrSession";
+}
diff --git a/server/runtime/org.argeo.server.core/src/main/java/org/argeo/server/mvc/jcr/JcrXmlServerSerializer.java b/server/runtime/org.argeo.server.core/src/main/java/org/argeo/server/mvc/jcr/JcrXmlServerSerializer.java
new file mode 100644 (file)
index 0000000..467b4d3
--- /dev/null
@@ -0,0 +1,129 @@
+/*
+ * Copyright (C) 2007-2012 Mathieu Baudier
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *         http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.argeo.server.mvc.jcr;
+
+import javax.jcr.Node;
+import javax.jcr.NodeIterator;
+import javax.jcr.RepositoryException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.stream.StreamResult;
+
+import org.argeo.ArgeoException;
+import org.argeo.server.ServerSerializer;
+import org.springframework.xml.dom.DomContentHandler;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.NodeList;
+import org.xml.sax.SAXException;
+
+/** @deprecated */
+public class JcrXmlServerSerializer implements ServerSerializer {
+       private String contentTypeCharset = "UTF-8";
+
+       private final DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory
+                       .newInstance();
+       private final TransformerFactory transformerFactory = TransformerFactory
+                       .newInstance();
+
+       public void serialize(Object obj, HttpServletRequest request,
+                       HttpServletResponse response) {
+               if (!(obj instanceof Node))
+                       throw new ArgeoException("Only " + Node.class + " is supported");
+
+               String noRecurseStr = request.getParameter("noRecurse");
+               boolean noRecurse = noRecurseStr != null && noRecurseStr.equals("true");
+
+               String depthStr = request.getParameter("depth");
+               String downloadStr = request.getParameter("download");
+
+               Node node = (Node) obj;
+
+               try {
+                       String contentType = "text/xml;charset=" + contentTypeCharset;
+                       // download case
+                       if (downloadStr != null && downloadStr.equals("true")) {
+                               String fileName = node.getName().replace(':', '_') + ".xml";
+                               contentType = contentType + ";name=\"" + fileName + "\"";
+                               response.setHeader("Content-Disposition",
+                                               "attachment; filename=\"" + fileName + "\"");
+                               response.setHeader("Expires", "0");
+                               response
+                                               .setHeader("Cache-Control", "no-cache, must-revalidate");
+                               response.setHeader("Pragma", "no-cache");
+                       }
+
+                       response.setContentType(contentType);
+                       if (depthStr == null) {
+                               node.getSession().exportDocumentView(node.getPath(),
+                                               response.getOutputStream(), true, noRecurse);
+                       } else {
+                               int depth = Integer.parseInt(depthStr);
+                               Document document = documentBuilderFactory.newDocumentBuilder()
+                                               .newDocument();
+                               serializeLevelToDom(node, document, 0, depth);
+                               Transformer transformer = transformerFactory.newTransformer();
+                               transformer.transform(new DOMSource(document),
+                                               new StreamResult(response.getOutputStream()));
+                       }
+               } catch (Exception e) {
+                       throw new ArgeoException("Cannot serialize " + node, e);
+               }
+       }
+
+       protected void serializeLevelToDom(Node currentJcrNode,
+                       org.w3c.dom.Node currentDomNode, int currentDepth, int targetDepth)
+                       throws RepositoryException, SAXException {
+               DomContentHandler domContentHandler = new DomContentHandler(
+                               currentDomNode);
+               currentJcrNode.getSession().exportDocumentView(
+                               currentJcrNode.getPath(), domContentHandler, true, true);
+
+               if (currentDepth == targetDepth)
+                       return;
+
+               // TODO: filter
+               NodeIterator nit = currentJcrNode.getNodes();
+               while (nit.hasNext()) {
+                       Node nextJcrNode = nit.nextNode();
+                       org.w3c.dom.Node nextDomNode;
+                       if (currentDomNode instanceof Document)
+                               nextDomNode = ((Document) currentDomNode).getDocumentElement();
+                       else {
+                               String name = currentJcrNode.getName();
+                               NodeList nodeList = ((Element) currentDomNode)
+                                               .getElementsByTagName(name);
+                               if (nodeList.getLength() < 1)
+                                       throw new ArgeoException("No elment named " + name
+                                                       + " under " + currentDomNode);
+                               // we know it is the last one added
+                               nextDomNode = nodeList.item(nodeList.getLength() - 1);
+                       }
+                       // recursive call
+                       serializeLevelToDom(nextJcrNode, nextDomNode, currentDepth + 1,
+                                       targetDepth);
+               }
+       }
+
+       public void setContentTypeCharset(String contentTypeCharset) {
+               this.contentTypeCharset = contentTypeCharset;
+       }
+
+}
diff --git a/server/runtime/org.argeo.server.core/src/main/java/org/argeo/server/mvc/jcr/OpenSessionInViewJcrInterceptor.java b/server/runtime/org.argeo.server.core/src/main/java/org/argeo/server/mvc/jcr/OpenSessionInViewJcrInterceptor.java
new file mode 100644 (file)
index 0000000..77d2663
--- /dev/null
@@ -0,0 +1,70 @@
+/*
+ * Copyright (C) 2007-2012 Mathieu Baudier
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *         http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.argeo.server.mvc.jcr;
+
+import javax.jcr.Session;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.springframework.ui.ModelMap;
+import org.springframework.web.context.request.RequestAttributes;
+import org.springframework.web.context.request.WebRequest;
+import org.springframework.web.context.request.WebRequestInterceptor;
+
+/** @deprecated */
+public class OpenSessionInViewJcrInterceptor implements WebRequestInterceptor,
+               JcrMvcConstants {
+       private final static Log log = LogFactory
+                       .getLog(OpenSessionInViewJcrInterceptor.class);
+
+       private Session session;
+
+       public void preHandle(WebRequest request) throws Exception {
+               if (log.isTraceEnabled())
+                       log.trace("preHandle: " + request);
+               // Authentication auth = SecurityContextHolder.getContext()
+               // .getAuthentication();
+               // if (auth != null)
+               // log.debug("auth=" + auth + ", authenticated="
+               // + auth.isAuthenticated() + ", name=" + auth.getName());
+               // else
+               // log.debug("No auth");
+
+               // FIXME: find a safer way to initialize
+               // FIXME: not really needed to initialize here
+               // session.getRepository();
+               request.setAttribute(REQUEST_ATTR_SESSION, session,
+                               RequestAttributes.SCOPE_REQUEST);
+       }
+
+       public void postHandle(WebRequest request, ModelMap model) throws Exception {
+               // if (log.isDebugEnabled())
+               // log.debug("postHandle: " + request);
+       }
+
+       public void afterCompletion(WebRequest request, Exception ex)
+                       throws Exception {
+               if (log.isTraceEnabled())
+                       log.trace("afterCompletion: " + request);
+               // FIXME: only close session that were open
+               session.logout();
+       }
+
+       public void setSession(Session session) {
+               this.session = session;
+       }
+
+}
index 98dfaa29fcc8871ebf2755b6edfec4d879d7792b..1b57143d724a0f51f5f690410808a306a2012181 100644 (file)
                        <artifactId>org.argeo.util</artifactId>
                        <version>1.1.4-SNAPSHOT</version>
                </dependency>
-               <dependency>
-                       <groupId>org.argeo.commons.server</groupId>
-                       <artifactId>org.argeo.server.core</artifactId>
-                       <version>1.1.4-SNAPSHOT</version>
-               </dependency>
-               <dependency>
-                       <groupId>org.argeo.commons.security</groupId>
-                       <artifactId>org.argeo.security.core</artifactId>
-                       <version>1.1.4-SNAPSHOT</version>
-               </dependency>
                <dependency>
                        <groupId>org.argeo.commons.server</groupId>
                        <artifactId>org.argeo.server.jcr.mvc</artifactId>
                        <groupId>org.argeo.tp</groupId>
                        <artifactId>org.springframework.web.servlet</artifactId>
                </dependency>
-               <dependency>
-                       <groupId>org.argeo.tp</groupId>
-                       <artifactId>org.springframework.xml</artifactId>
-               </dependency>
 
                <!-- TEST -->
                <dependency>
index 3779a77efca4f5019a7e4960d3a20ea61d889a7a..fbdb96add100f5ecfe16b7f57bfe21fb93f9ef6e 100644 (file)
@@ -1,4 +1,6 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?><project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
        <modelVersion>4.0.0</modelVersion>
        <parent>
                <groupId>org.argeo.commons.server</groupId>
@@ -32,6 +34,7 @@
                                                        org.argeo.jcr.mvc.*
                                                </Export-Package>
                                                <Import-Package>
+                                                       org.springframework.core,
                                                        org.springframework.beans.factory,
                                                        javax.xml.transform.*;version="0.0.0",
                                                        javax.xml.parsers.*;version="0.0.0",
                        <version>1.1.4-SNAPSHOT</version>
                </dependency>
 
+               <!-- Spring -->
                <dependency>
-                       <groupId>org.argeo.commons.server</groupId>
-                       <artifactId>org.argeo.server.core</artifactId>
-                       <version>1.1.4-SNAPSHOT</version>
+                       <groupId>org.argeo.tp</groupId>
+                       <artifactId>org.springframework.context</artifactId>
                </dependency>
-
                <dependency>
                        <groupId>org.argeo.tp</groupId>
-                       <artifactId>org.apache.commons.io</artifactId>
+                       <artifactId>org.springframework.core</artifactId>
                </dependency>
-
-               <!-- Spring -->
                <dependency>
                        <groupId>org.argeo.tp</groupId>
-                       <artifactId>org.springframework.web.servlet</artifactId>
+                       <artifactId>org.springframework.beans</artifactId>
                </dependency>
-
                <dependency>
                        <groupId>org.argeo.tp</groupId>
-                       <artifactId>org.springframework.security.core</artifactId>
+                       <artifactId>org.springframework.web</artifactId>
                </dependency>
-
                <dependency>
                        <groupId>org.argeo.tp</groupId>
-                       <artifactId>org.springframework.xml</artifactId>
+                       <artifactId>org.springframework.web.servlet</artifactId>
                </dependency>
 
                <!-- Logging -->
                        <groupId>org.argeo.tp</groupId>
                        <artifactId>slf4j.org.apache.commons.logging</artifactId>
                </dependency>
-
-               <dependency>
-                       <groupId>org.argeo.tp</groupId>
-                       <artifactId>org.apache.commons.fileupload</artifactId>
-               </dependency>
        </dependencies>
 </project>
\ No newline at end of file
diff --git a/server/runtime/org.argeo.server.jcr.mvc/src/main/java/org/argeo/jcr/mvc/JcrBrowserController.java b/server/runtime/org.argeo.server.jcr.mvc/src/main/java/org/argeo/jcr/mvc/JcrBrowserController.java
deleted file mode 100644 (file)
index c655543..0000000
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * Copyright (C) 2007-2012 Mathieu Baudier
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *         http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.argeo.jcr.mvc;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
-import javax.jcr.Item;
-import javax.jcr.NodeIterator;
-import javax.jcr.RepositoryException;
-import javax.jcr.Session;
-import javax.jcr.Value;
-import javax.jcr.query.Query;
-import javax.jcr.query.QueryResult;
-import javax.jcr.query.Row;
-import javax.jcr.query.RowIterator;
-
-import org.springframework.stereotype.Controller;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestParam;
-import org.springframework.web.context.request.RequestAttributes;
-import org.springframework.web.context.request.WebRequest;
-
-@Controller
-public class JcrBrowserController implements JcrMvcConstants {
-
-       @RequestMapping("/getJcrItem.*")
-       public Item getJcrItem(WebRequest webRequest,
-                       @RequestParam("path") String path) throws RepositoryException {
-               return ((Session) webRequest.getAttribute(REQUEST_ATTR_SESSION,
-                               RequestAttributes.SCOPE_REQUEST)).getItem(path);
-       }
-
-       @RequestMapping("/queryJcrNodes.*")
-       public List<String> queryJcrNodes(WebRequest webRequest,
-                       @RequestParam("statement") String statement,
-                       @RequestParam("language") String language)
-                       throws RepositoryException {
-               Session session = ((Session) webRequest.getAttribute(
-                               REQUEST_ATTR_SESSION, RequestAttributes.SCOPE_REQUEST));
-               Query query = session.getWorkspace().getQueryManager().createQuery(
-                               statement, language);
-               NodeIterator nit = query.execute().getNodes();
-               List<String> paths = new ArrayList<String>();
-               while (nit.hasNext()) {
-                       paths.add(nit.nextNode().getPath());
-               }
-               return paths;
-       }
-
-       @RequestMapping("/queryJcrTable.*")
-       public List<List<String>> queryJcrTable(WebRequest webRequest,
-                       @RequestParam("statement") String statement,
-                       @RequestParam("language") String language)
-                       throws RepositoryException {
-               Session session = ((Session) webRequest.getAttribute(
-                               REQUEST_ATTR_SESSION, RequestAttributes.SCOPE_REQUEST));
-               Query query = session.getWorkspace().getQueryManager().createQuery(
-                               statement, language);
-               QueryResult queryResult = query.execute();
-               List<List<String>> results = new ArrayList<List<String>>();
-               results.add(Arrays.asList(queryResult.getColumnNames()));
-               RowIterator rit = queryResult.getRows();
-
-               while (rit.hasNext()) {
-                       Row row = rit.nextRow();
-                       List<String> lst = new ArrayList<String>();
-                       for (Value value : row.getValues()) {
-                               lst.add(value.getString());
-                       }
-               }
-               return results;
-       }
-}
diff --git a/server/runtime/org.argeo.server.jcr.mvc/src/main/java/org/argeo/jcr/mvc/JcrManagerController.java b/server/runtime/org.argeo.server.jcr.mvc/src/main/java/org/argeo/jcr/mvc/JcrManagerController.java
deleted file mode 100644 (file)
index 67a99ae..0000000
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- * Copyright (C) 2007-2012 Mathieu Baudier
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *         http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.argeo.jcr.mvc;
-
-import java.util.List;
-import java.util.StringTokenizer;
-
-import javax.jcr.Session;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import org.apache.commons.fileupload.FileItem;
-import org.apache.commons.fileupload.FileItemFactory;
-import org.apache.commons.fileupload.disk.DiskFileItemFactory;
-import org.apache.commons.fileupload.servlet.ServletFileUpload;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.argeo.jcr.JcrResourceAdapter;
-import org.argeo.server.ServerAnswer;
-import org.argeo.server.mvc.MvcConstants;
-import org.springframework.core.io.ByteArrayResource;
-import org.springframework.stereotype.Controller;
-import org.springframework.web.bind.annotation.ModelAttribute;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.context.request.RequestAttributes;
-import org.springframework.web.context.request.WebRequest;
-
-@Controller
-public class JcrManagerController implements MvcConstants, JcrMvcConstants {
-       private final static Log log = LogFactory
-                       .getLog(JcrManagerController.class);
-
-       // Create a factory for disk-based file items
-       private FileItemFactory factory = new DiskFileItemFactory();
-
-       // Create a new file upload handler
-       private ServletFileUpload upload = new ServletFileUpload(factory);
-
-       @SuppressWarnings("unchecked")
-       @RequestMapping("/upload/**")
-       @ModelAttribute(ANSWER_MODEL_KEY_AS_HTML)
-       public ServerAnswer upload(WebRequest webRequest,
-                       HttpServletRequest request, HttpServletResponse response)
-                       throws Exception {
-
-               Session session = ((Session) webRequest.getAttribute(
-                               REQUEST_ATTR_SESSION, RequestAttributes.SCOPE_REQUEST));
-               JcrResourceAdapter resourceAdapter = new JcrResourceAdapter(session);
-               // Parse the request
-               List<FileItem> items = upload.parseRequest(request);
-
-               byte[] arr = null;
-               for (FileItem item : items) {
-                       if (!item.isFormField()) {
-                               arr = item.get();
-                               break;
-                       }
-               }
-
-               ByteArrayResource res = new ByteArrayResource(arr);
-               // String pathInfo = request.getPathInfo();
-
-               StringBuffer path = new StringBuffer("/");
-               StringTokenizer st = new StringTokenizer(request.getPathInfo(), "/");
-               st.nextToken();// skip /upload/
-               while (st.hasMoreTokens()) {
-                       String token = st.nextToken();
-                       if (!st.hasMoreTokens()) {
-                               resourceAdapter.mkdirs(path.toString());
-                               path.append(token);
-                       } else {
-                               path.append(token).append('/');
-                       }
-               }
-               // String path = '/' + pathInfo.substring(1).substring(
-               // pathInfo.indexOf('/'));
-               if (log.isDebugEnabled())
-                       log.debug("Upload to " + path);
-               resourceAdapter.update(path.toString(), res.getInputStream());
-               return ServerAnswer.ok("File " + path + " imported");
-       }
-
-}
diff --git a/server/runtime/org.argeo.server.jcr.mvc/src/main/java/org/argeo/jcr/mvc/JcrMvcConstants.java b/server/runtime/org.argeo.server.jcr.mvc/src/main/java/org/argeo/jcr/mvc/JcrMvcConstants.java
deleted file mode 100644 (file)
index d1f9888..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
- * Copyright (C) 2007-2012 Mathieu Baudier
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *         http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.argeo.jcr.mvc;
-
-public interface JcrMvcConstants {
-       public final static String REQUEST_ATTR_SESSION = "jcrSession";
-}
diff --git a/server/runtime/org.argeo.server.jcr.mvc/src/main/java/org/argeo/jcr/mvc/JcrXmlServerSerializer.java b/server/runtime/org.argeo.server.jcr.mvc/src/main/java/org/argeo/jcr/mvc/JcrXmlServerSerializer.java
deleted file mode 100644 (file)
index 615a322..0000000
+++ /dev/null
@@ -1,129 +0,0 @@
-/*
- * Copyright (C) 2007-2012 Mathieu Baudier
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *         http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.argeo.jcr.mvc;
-
-import javax.jcr.Node;
-import javax.jcr.NodeIterator;
-import javax.jcr.RepositoryException;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.transform.Transformer;
-import javax.xml.transform.TransformerFactory;
-import javax.xml.transform.dom.DOMSource;
-import javax.xml.transform.stream.StreamResult;
-
-import org.argeo.ArgeoException;
-import org.argeo.server.ServerSerializer;
-import org.springframework.xml.dom.DomContentHandler;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.NodeList;
-import org.xml.sax.SAXException;
-
-/** @deprecated */
-public class JcrXmlServerSerializer implements ServerSerializer {
-       private String contentTypeCharset = "UTF-8";
-
-       private final DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory
-                       .newInstance();
-       private final TransformerFactory transformerFactory = TransformerFactory
-                       .newInstance();
-
-       public void serialize(Object obj, HttpServletRequest request,
-                       HttpServletResponse response) {
-               if (!(obj instanceof Node))
-                       throw new ArgeoException("Only " + Node.class + " is supported");
-
-               String noRecurseStr = request.getParameter("noRecurse");
-               boolean noRecurse = noRecurseStr != null && noRecurseStr.equals("true");
-
-               String depthStr = request.getParameter("depth");
-               String downloadStr = request.getParameter("download");
-
-               Node node = (Node) obj;
-
-               try {
-                       String contentType = "text/xml;charset=" + contentTypeCharset;
-                       // download case
-                       if (downloadStr != null && downloadStr.equals("true")) {
-                               String fileName = node.getName().replace(':', '_') + ".xml";
-                               contentType = contentType + ";name=\"" + fileName + "\"";
-                               response.setHeader("Content-Disposition",
-                                               "attachment; filename=\"" + fileName + "\"");
-                               response.setHeader("Expires", "0");
-                               response
-                                               .setHeader("Cache-Control", "no-cache, must-revalidate");
-                               response.setHeader("Pragma", "no-cache");
-                       }
-
-                       response.setContentType(contentType);
-                       if (depthStr == null) {
-                               node.getSession().exportDocumentView(node.getPath(),
-                                               response.getOutputStream(), true, noRecurse);
-                       } else {
-                               int depth = Integer.parseInt(depthStr);
-                               Document document = documentBuilderFactory.newDocumentBuilder()
-                                               .newDocument();
-                               serializeLevelToDom(node, document, 0, depth);
-                               Transformer transformer = transformerFactory.newTransformer();
-                               transformer.transform(new DOMSource(document),
-                                               new StreamResult(response.getOutputStream()));
-                       }
-               } catch (Exception e) {
-                       throw new ArgeoException("Cannot serialize " + node, e);
-               }
-       }
-
-       protected void serializeLevelToDom(Node currentJcrNode,
-                       org.w3c.dom.Node currentDomNode, int currentDepth, int targetDepth)
-                       throws RepositoryException, SAXException {
-               DomContentHandler domContentHandler = new DomContentHandler(
-                               currentDomNode);
-               currentJcrNode.getSession().exportDocumentView(
-                               currentJcrNode.getPath(), domContentHandler, true, true);
-
-               if (currentDepth == targetDepth)
-                       return;
-
-               // TODO: filter
-               NodeIterator nit = currentJcrNode.getNodes();
-               while (nit.hasNext()) {
-                       Node nextJcrNode = nit.nextNode();
-                       org.w3c.dom.Node nextDomNode;
-                       if (currentDomNode instanceof Document)
-                               nextDomNode = ((Document) currentDomNode).getDocumentElement();
-                       else {
-                               String name = currentJcrNode.getName();
-                               NodeList nodeList = ((Element) currentDomNode)
-                                               .getElementsByTagName(name);
-                               if (nodeList.getLength() < 1)
-                                       throw new ArgeoException("No elment named " + name
-                                                       + " under " + currentDomNode);
-                               // we know it is the last one added
-                               nextDomNode = nodeList.item(nodeList.getLength() - 1);
-                       }
-                       // recursive call
-                       serializeLevelToDom(nextJcrNode, nextDomNode, currentDepth + 1,
-                                       targetDepth);
-               }
-       }
-
-       public void setContentTypeCharset(String contentTypeCharset) {
-               this.contentTypeCharset = contentTypeCharset;
-       }
-
-}
index ab796366985e1c72797d80af17246277f7f64edd..4f0649b2f5a3be7796f7efec9ea8183c2b58bde0 100644 (file)
@@ -39,6 +39,7 @@ import org.springframework.web.context.ServletContextAware;
 import org.springframework.web.servlet.HandlerExecutionChain;
 import org.springframework.web.servlet.HandlerMapping;
 
+/** Handles multiple JCR servers with a single servlet. */
 public abstract class MultipleRepositoryHandlerMapping implements
                HandlerMapping, ApplicationContextAware, ServletContextAware {
        private final static Log log = LogFactory
diff --git a/server/runtime/org.argeo.server.jcr.mvc/src/main/java/org/argeo/jcr/mvc/OpenSessionInViewJcrInterceptor.java b/server/runtime/org.argeo.server.jcr.mvc/src/main/java/org/argeo/jcr/mvc/OpenSessionInViewJcrInterceptor.java
deleted file mode 100644 (file)
index 7419904..0000000
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Copyright (C) 2007-2012 Mathieu Baudier
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *         http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.argeo.jcr.mvc;
-
-import javax.jcr.Session;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.springframework.ui.ModelMap;
-import org.springframework.web.context.request.RequestAttributes;
-import org.springframework.web.context.request.WebRequest;
-import org.springframework.web.context.request.WebRequestInterceptor;
-
-/** @deprecated */
-public class OpenSessionInViewJcrInterceptor implements WebRequestInterceptor,
-               JcrMvcConstants {
-       private final static Log log = LogFactory
-                       .getLog(OpenSessionInViewJcrInterceptor.class);
-
-       private Session session;
-
-       public void preHandle(WebRequest request) throws Exception {
-               if (log.isTraceEnabled())
-                       log.trace("preHandle: " + request);
-               // Authentication auth = SecurityContextHolder.getContext()
-               // .getAuthentication();
-               // if (auth != null)
-               // log.debug("auth=" + auth + ", authenticated="
-               // + auth.isAuthenticated() + ", name=" + auth.getName());
-               // else
-               // log.debug("No auth");
-
-               // FIXME: find a safer way to initialize
-               // FIXME: not really needed to initialize here
-               // session.getRepository();
-               request.setAttribute(REQUEST_ATTR_SESSION, session,
-                               RequestAttributes.SCOPE_REQUEST);
-       }
-
-       public void postHandle(WebRequest request, ModelMap model) throws Exception {
-               // if (log.isDebugEnabled())
-               // log.debug("postHandle: " + request);
-       }
-
-       public void afterCompletion(WebRequest request, Exception ex)
-                       throws Exception {
-               if (log.isTraceEnabled())
-                       log.trace("afterCompletion: " + request);
-               // FIXME: only close session that were open
-               session.logout();
-       }
-
-       public void setSession(Session session) {
-               this.session = session;
-       }
-
-}
index 4a868312992d0acbf16e2b864c28eb6b8c0128cb..c2e56379efdb94aae557338c580e18f3957eb14d 100644 (file)
@@ -33,12 +33,11 @@ import org.apache.commons.io.IOUtils;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.argeo.ArgeoException;
-import org.argeo.jcr.ArgeoNames;
 import org.argeo.jcr.JcrUtils;
 import org.argeo.jcr.proxy.ResourceProxy;
 
 /** Wraps a proxy via HTTP */
-public class ResourceProxyServlet extends HttpServlet implements ArgeoNames {
+public class ResourceProxyServlet extends HttpServlet {
        private static final long serialVersionUID = -8886549549223155801L;
 
        private final static Log log = LogFactory