You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@rave.apache.org by ma...@apache.org on 2012/08/30 22:34:18 UTC

svn commit: r1379124 [2/3] - in /rave/sandbox/content-services: rave-jcr-integration/ rave-jcr-integration/data-model/ rave-jcr-integration/data-model/src/ rave-jcr-integration/data-model/src/main/ rave-jcr-integration/data-model/src/main/java/ rave-jc...

Added: rave/sandbox/content-services/rave-jcr-integration/data-model/src/test/resources/repositoryHelperPool.properties
URL: http://svn.apache.org/viewvc/rave/sandbox/content-services/rave-jcr-integration/data-model/src/test/resources/repositoryHelperPool.properties?rev=1379124&view=auto
==============================================================================
--- rave/sandbox/content-services/rave-jcr-integration/data-model/src/test/resources/repositoryHelperPool.properties (added)
+++ rave/sandbox/content-services/rave-jcr-integration/data-model/src/test/resources/repositoryHelperPool.properties Thu Aug 30 20:34:15 2012
@@ -0,0 +1,17 @@
+#  Licensed to the Apache Software Foundation (ASF) under one or more
+#  contributor license agreements.  See the NOTICE file distributed with
+#  this work for additional information regarding copyright ownership.
+#  The ASF licenses this file to You 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.
+
+# first helper uses default values
+helper.0.=

Propchange: rave/sandbox/content-services/rave-jcr-integration/data-model/src/test/resources/repositoryHelperPool.properties
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: rave/sandbox/content-services/rave-jcr-integration/data-model/src/test/resources/repositoryHelperPool.properties
------------------------------------------------------------------------------
    svn:keywords = Id

Added: rave/sandbox/content-services/rave-jcr-integration/data-model/src/test/resources/repositoryStubImpl.properties
URL: http://svn.apache.org/viewvc/rave/sandbox/content-services/rave-jcr-integration/data-model/src/test/resources/repositoryStubImpl.properties?rev=1379124&view=auto
==============================================================================
--- rave/sandbox/content-services/rave-jcr-integration/data-model/src/test/resources/repositoryStubImpl.properties (added)
+++ rave/sandbox/content-services/rave-jcr-integration/data-model/src/test/resources/repositoryStubImpl.properties Thu Aug 30 20:34:15 2012
@@ -0,0 +1,17 @@
+#  Licensed to the Apache Software Foundation (ASF) under one or more
+#  contributor license agreements.  See the NOTICE file distributed with
+#  this work for additional information regarding copyright ownership.
+#  The ASF licenses this file to You 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.
+
+# Stub implementation class
+javax.jcr.tck.repository_stub_impl=org.apache.jackrabbit.core.JackrabbitRepositoryStub

Propchange: rave/sandbox/content-services/rave-jcr-integration/data-model/src/test/resources/repositoryStubImpl.properties
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: rave/sandbox/content-services/rave-jcr-integration/data-model/src/test/resources/repositoryStubImpl.properties
------------------------------------------------------------------------------
    svn:keywords = Id

Added: rave/sandbox/content-services/rave-jcr-integration/data-model/src/test/resources/test-data.json
URL: http://svn.apache.org/viewvc/rave/sandbox/content-services/rave-jcr-integration/data-model/src/test/resources/test-data.json?rev=1379124&view=auto
==============================================================================
--- rave/sandbox/content-services/rave-jcr-integration/data-model/src/test/resources/test-data.json (added)
+++ rave/sandbox/content-services/rave-jcr-integration/data-model/src/test/resources/test-data.json Thu Aug 30 20:34:15 2012
@@ -0,0 +1,29 @@
+{
+    "binaries":{
+        "css":{
+            "jcr:primaryType":"ravedata:binary",
+            "id":"css",
+            "resource":{
+                "jcr:primaryType":"ravedata:resource",
+                "jcr:lastModifiedBy":"admin",
+                "jcr:binary:jcr:data":"LmZvb3sKICAgIGJhY2tncm91bmQtY29sb3I6IHJlZDsKfQ==",
+                "jcr:encoding":"test",
+                "jcr:mimeType":"text/plain",
+                "jcr:lastModified":"2012-08-30T11:21:52.247+0200"
+            }
+        },
+        "img":{
+            "jcr:primaryType":"ravedata:binary",
+            "id":"image",
+            "resource":{
+                "jcr:primaryType":"ravedata:resource",
+                "jcr:lastModifiedBy":"admin",
+                "jcr:binary:jcr:data":"iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAABHNCSVQICAgIfAhkiAAAAA1JREFUCJljYGBg+A8AAQQBAH2yyN8AAAAASUVORK5CYII=",
+                "jcr:encoding":"test",
+                "jcr:mimeType":"image/png",
+                "jcr:lastModified":"2012-08-30T10:48:40.534+0200"
+            }
+        }
+    }
+}
+

Modified: rave/sandbox/content-services/rave-jcr-integration/page-configuration/src/test/java/org/apache/rave/jcr/config/BaseConfigTest.java
URL: http://svn.apache.org/viewvc/rave/sandbox/content-services/rave-jcr-integration/page-configuration/src/test/java/org/apache/rave/jcr/config/BaseConfigTest.java?rev=1379124&r1=1379123&r2=1379124&view=diff
==============================================================================
--- rave/sandbox/content-services/rave-jcr-integration/page-configuration/src/test/java/org/apache/rave/jcr/config/BaseConfigTest.java (original)
+++ rave/sandbox/content-services/rave-jcr-integration/page-configuration/src/test/java/org/apache/rave/jcr/config/BaseConfigTest.java Thu Aug 30 20:34:15 2012
@@ -20,66 +20,21 @@
 package org.apache.rave.jcr.config;
 
 import java.io.File;
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.io.InputStream;
 import java.io.UnsupportedEncodingException;
 import java.net.URL;
 import java.net.URLDecoder;
 
-import javax.jcr.NamespaceRegistry;
-import javax.jcr.RepositoryException;
-import javax.jcr.Session;
-import javax.jcr.Workspace;
-import javax.jcr.nodetype.NoSuchNodeTypeException;
-import javax.jcr.nodetype.NodeTypeManager;
-
-import org.apache.jackrabbit.core.nodetype.InvalidNodeTypeDefException;
-import org.apache.jackrabbit.core.nodetype.NodeTypeManagerImpl;
-import org.apache.jackrabbit.core.nodetype.NodeTypeRegistry;
-import org.apache.jackrabbit.core.nodetype.xml.NodeTypeReader;
-import org.apache.jackrabbit.spi.Name;
-import org.apache.jackrabbit.spi.QNodeTypeDefinition;
 import org.apache.jackrabbit.test.AbstractJCRTest;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
 /**
  * @version "$Id$"
  */
 public abstract class BaseConfigTest extends AbstractJCRTest {
 
-    private static Logger log = LoggerFactory.getLogger(BaseConfigTest.class);
-    public static final String RAVE_NODE_TYPES_XML = "rave-node-types.xml";
-
 
     @Override
     public void setUp() throws Exception {
         super.setUp();
-        //registerNamespace(superuser);
-        // registerNamespace(superuser);
-        //registerNodeTypes(superuser);
-
-
-    }
-
-
-    protected void registerNodeTypes(Session session) throws InvalidNodeTypeDefException, RepositoryException, IOException {
-        InputStream xml = new FileInputStream(getFile(RAVE_NODE_TYPES_XML));
-        QNodeTypeDefinition[] types = NodeTypeReader.read(xml);
-        Workspace workspace = session.getWorkspace();
-        NodeTypeManager ntMgr = workspace.getNodeTypeManager();
-        NodeTypeRegistry ntReg = ((NodeTypeManagerImpl) ntMgr).getNodeTypeRegistry();
-        for (QNodeTypeDefinition def : types) {
-            try {
-                final Name name = def.getName();
-                log.info("Registering {}", name);
-                ntReg.getNodeTypeDef(name);
-            } catch (NoSuchNodeTypeException nsne) {
-                ntReg.registerNodeType(def);
-            }
-
-        }
     }
 
     protected File getFile(final String path) throws UnsupportedEncodingException {
@@ -91,20 +46,5 @@ public abstract class BaseConfigTest ext
         return new File(fileName);
     }
 
-    private void registerNamespace(final Session session) throws RepositoryException {
-        final NamespaceRegistry namespaceRegistry = superuser.getWorkspace().getNamespaceRegistry();
-        String[] prefixes = namespaceRegistry.getPrefixes();
-        boolean register = true;
-        for (String ns : prefixes) {
-            if (ns.equals("ocm")) {
-                register = false;
-                log.debug("Ocm namespace already registered");
-            }
-        }
-        if (register) {
-            namespaceRegistry.registerNamespace("ocm", "http://jackrabbit.apache.org/ocm");
-        }
-    }
-
 
 }

Modified: rave/sandbox/content-services/rave-jcr-integration/pom.xml
URL: http://svn.apache.org/viewvc/rave/sandbox/content-services/rave-jcr-integration/pom.xml?rev=1379124&r1=1379123&r2=1379124&view=diff
==============================================================================
--- rave/sandbox/content-services/rave-jcr-integration/pom.xml (original)
+++ rave/sandbox/content-services/rave-jcr-integration/pom.xml Thu Aug 30 20:34:15 2012
@@ -48,6 +48,7 @@
     <module>module1</module>
     <module>module2</module>
     <module>test</module>
+    <module>data-model</module>
     <module>page-configuration</module>
   </modules>
 

Modified: rave/sandbox/content-services/rave-jcr-utils/pom.xml
URL: http://svn.apache.org/viewvc/rave/sandbox/content-services/rave-jcr-utils/pom.xml?rev=1379124&r1=1379123&r2=1379124&view=diff
==============================================================================
--- rave/sandbox/content-services/rave-jcr-utils/pom.xml (original)
+++ rave/sandbox/content-services/rave-jcr-utils/pom.xml Thu Aug 30 20:34:15 2012
@@ -35,4 +35,40 @@
   <description>Apache Rave JCR Utilities Module</description>
   <packaging>jar</packaging>
 
+  <dependencies>
+    <dependency>
+      <groupId>org.slf4j</groupId>
+      <artifactId>slf4j-log4j12</artifactId>
+      <scope>provided</scope>
+    </dependency>
+    <dependency>
+      <groupId>log4j</groupId>
+      <artifactId>log4j</artifactId>
+      <scope>provided</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.slf4j</groupId>
+      <artifactId>slf4j-api</artifactId>
+      <scope>provided</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.springframework</groupId>
+      <artifactId>spring-core</artifactId>
+      <version>${org.springframework.version}</version>
+      <scope>provided</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.springframework</groupId>
+      <artifactId>spring-beans</artifactId>
+      <version>${org.springframework.version}</version>
+      <scope>provided</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.jackrabbit</groupId>
+      <artifactId>jackrabbit-core</artifactId>
+      <version>${apache.jackrabbit.version}</version>
+      <scope>provided</scope>
+    </dependency>
+  </dependencies>
+
 </project>

Added: rave/sandbox/content-services/rave-jcr-utils/src/main/java/org/apache/rave/jcr/utils/BaseRepositoryFactoryBean.java
URL: http://svn.apache.org/viewvc/rave/sandbox/content-services/rave-jcr-utils/src/main/java/org/apache/rave/jcr/utils/BaseRepositoryFactoryBean.java?rev=1379124&view=auto
==============================================================================
--- rave/sandbox/content-services/rave-jcr-utils/src/main/java/org/apache/rave/jcr/utils/BaseRepositoryFactoryBean.java (added)
+++ rave/sandbox/content-services/rave-jcr-utils/src/main/java/org/apache/rave/jcr/utils/BaseRepositoryFactoryBean.java Thu Aug 30 20:34:15 2012
@@ -0,0 +1,77 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.apache.rave.jcr.utils;
+
+import javax.jcr.Repository;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.springframework.beans.factory.DisposableBean;
+import org.springframework.beans.factory.FactoryBean;
+import org.springframework.beans.factory.InitializingBean;
+import org.springframework.core.io.Resource;
+
+/**
+ * @version "$Id$"
+ */
+public abstract class BaseRepositoryFactoryBean implements InitializingBean, DisposableBean, FactoryBean<Repository> {
+
+    protected final Log log = LogFactory.getLog(getClass());
+
+    protected Resource configuration;
+
+    protected Repository repository;
+
+    protected abstract void resolveConfigurationResource() throws Exception;
+
+
+    protected abstract Repository createRepository() throws Exception;
+
+    public void afterPropertiesSet() throws Exception {
+        resolveConfigurationResource();
+        repository = createRepository();
+
+    }
+
+    public void destroy() throws Exception {
+    }
+
+    public Repository getObject() throws Exception {
+        return this.repository;
+    }
+
+    public Class<Repository> getObjectType() {
+        return Repository.class;
+    }
+
+    public boolean isSingleton() {
+        return true;
+    }
+
+
+    public Resource getConfiguration() {
+        return this.configuration;
+    }
+
+    public void setConfiguration(Resource configuration) {
+        this.configuration = configuration;
+    }
+
+}

Propchange: rave/sandbox/content-services/rave-jcr-utils/src/main/java/org/apache/rave/jcr/utils/BaseRepositoryFactoryBean.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: rave/sandbox/content-services/rave-jcr-utils/src/main/java/org/apache/rave/jcr/utils/BaseRepositoryFactoryBean.java
------------------------------------------------------------------------------
    svn:keywords = Id

Added: rave/sandbox/content-services/rave-jcr-utils/src/main/java/org/apache/rave/jcr/utils/JcrSessionFactory.java
URL: http://svn.apache.org/viewvc/rave/sandbox/content-services/rave-jcr-utils/src/main/java/org/apache/rave/jcr/utils/JcrSessionFactory.java?rev=1379124&view=auto
==============================================================================
--- rave/sandbox/content-services/rave-jcr-utils/src/main/java/org/apache/rave/jcr/utils/JcrSessionFactory.java (added)
+++ rave/sandbox/content-services/rave-jcr-utils/src/main/java/org/apache/rave/jcr/utils/JcrSessionFactory.java Thu Aug 30 20:34:15 2012
@@ -0,0 +1,90 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.apache.rave.jcr.utils;
+
+import java.util.Properties;
+
+import javax.jcr.Credentials;
+import javax.jcr.Repository;
+import javax.jcr.RepositoryException;
+import javax.jcr.Session;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * @version "$Id$"
+ */
+public class JcrSessionFactory implements SessionFactory {
+
+    private static Logger log = LoggerFactory.getLogger(JcrSessionFactory.class);
+
+    private Repository repository;
+    private String workspaceName;
+    private Credentials credentials;
+
+    private Properties namespaces;
+
+
+    public JcrSessionFactory() {
+    }
+
+    public JcrSessionFactory(Repository repository, String workspaceName, Credentials credentials) {
+
+        this.repository = repository;
+        this.workspaceName = workspaceName;
+        this.credentials = credentials;
+
+    }
+
+    public Repository getRepository() {
+        return repository;
+    }
+
+    public void setRepository(Repository repository) {
+        this.repository = repository;
+    }
+
+    public void setWorkspaceName(String workspaceName) {
+        this.workspaceName = workspaceName;
+    }
+
+    public void setCredentials(Credentials credentials) {
+        this.credentials = credentials;
+    }
+
+    public void afterPropertiesSet() throws Exception {
+        log.info("@After properties set");
+    }
+
+
+    public Session getSession() throws RepositoryException {
+        return repository.login(credentials, workspaceName);
+    }
+
+
+    public Credentials getCredentials() {
+        return credentials;
+    }
+
+    public String getWorkspaceName() {
+        return workspaceName;
+    }
+}

Propchange: rave/sandbox/content-services/rave-jcr-utils/src/main/java/org/apache/rave/jcr/utils/JcrSessionFactory.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: rave/sandbox/content-services/rave-jcr-utils/src/main/java/org/apache/rave/jcr/utils/JcrSessionFactory.java
------------------------------------------------------------------------------
    svn:keywords = Id

Modified: rave/sandbox/content-services/rave-jcr-utils/src/main/java/org/apache/rave/jcr/utils/JcrUtils.java
URL: http://svn.apache.org/viewvc/rave/sandbox/content-services/rave-jcr-utils/src/main/java/org/apache/rave/jcr/utils/JcrUtils.java?rev=1379124&r1=1379123&r2=1379124&view=diff
==============================================================================
--- rave/sandbox/content-services/rave-jcr-utils/src/main/java/org/apache/rave/jcr/utils/JcrUtils.java (original)
+++ rave/sandbox/content-services/rave-jcr-utils/src/main/java/org/apache/rave/jcr/utils/JcrUtils.java Thu Aug 30 20:34:15 2012
@@ -22,7 +22,10 @@ import javax.jcr.Node;
 import javax.jcr.PathNotFoundException;
 import javax.jcr.RepositoryException;
 
-public class JcrUtils {
+public final class JcrUtils {
+
+    private JcrUtils() {
+    }
 
     public static String getStringProperty(Node node, String propertyName, String defaultValue) throws RepositoryException {
         try {

Added: rave/sandbox/content-services/rave-jcr-utils/src/main/java/org/apache/rave/jcr/utils/RepositoryFactoryBean.java
URL: http://svn.apache.org/viewvc/rave/sandbox/content-services/rave-jcr-utils/src/main/java/org/apache/rave/jcr/utils/RepositoryFactoryBean.java?rev=1379124&view=auto
==============================================================================
--- rave/sandbox/content-services/rave-jcr-utils/src/main/java/org/apache/rave/jcr/utils/RepositoryFactoryBean.java (added)
+++ rave/sandbox/content-services/rave-jcr-utils/src/main/java/org/apache/rave/jcr/utils/RepositoryFactoryBean.java Thu Aug 30 20:34:15 2012
@@ -0,0 +1,108 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.apache.rave.jcr.utils;
+
+import javax.jcr.Repository;
+
+import org.apache.jackrabbit.api.JackrabbitRepository;
+import org.apache.jackrabbit.core.RepositoryImpl;
+import org.apache.jackrabbit.core.config.RepositoryConfig;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.core.io.ClassPathResource;
+import org.springframework.core.io.FileSystemResource;
+import org.springframework.core.io.Resource;
+import org.xml.sax.InputSource;
+
+/**
+ * @version "$Id$"
+ */
+public class RepositoryFactoryBean extends BaseRepositoryFactoryBean {
+
+    private static final Logger log = LoggerFactory.getLogger(RepositoryFactoryBean.class);
+
+
+    private static final String DEFAULT_REPOSITORY_FILE = "repository.xml";
+
+    private static final String DEFAULT_REPOSITORY_DIR = ".";
+    private String repositoryFile;
+
+    private Resource homeDirectory;
+
+
+    private RepositoryConfig repositoryConfig;
+
+    public Resource getHomeDirectory() {
+        return this.homeDirectory;
+    }
+
+    public void setHomeDirectory(Resource defaultRepDir) {
+        this.homeDirectory = defaultRepDir;
+    }
+
+    public RepositoryConfig getRepositoryConfig() {
+        return this.repositoryConfig;
+    }
+
+    public void setRepositoryConfig(RepositoryConfig repositoryConfig) {
+        this.repositoryConfig = repositoryConfig;
+    }
+
+    @Override
+    protected Repository createRepository() throws Exception {
+        return RepositoryImpl.create(repositoryConfig);
+    }
+
+    @Override
+    protected void resolveConfigurationResource() throws Exception {
+        if (repositoryConfig != null) {
+            return;
+        }
+
+        if (this.configuration == null) {
+            this.configuration = new ClassPathResource(getRepositoryFile());
+        }
+        if (homeDirectory == null) {
+            this.homeDirectory = new FileSystemResource(DEFAULT_REPOSITORY_DIR);
+        }
+        this.repositoryConfig = RepositoryConfig.create(new InputSource(configuration.getInputStream()), homeDirectory.getFile().getAbsolutePath());
+        log.debug("Created repository: homeDirectory {}, configuration={}", homeDirectory, configuration);
+    }
+
+
+    public void setRepositoryFile(String repositoryFile) {
+        this.repositoryFile = repositoryFile;
+    }
+
+    public String getRepositoryFile() {
+        if (repositoryFile == null) {
+            return DEFAULT_REPOSITORY_FILE;
+        }
+        return repositoryFile;
+    }
+
+    @Override
+    public void destroy() throws Exception {
+        if (repository instanceof JackrabbitRepository) {
+            ((JackrabbitRepository) repository).shutdown();
+        }
+    }
+}
+

Propchange: rave/sandbox/content-services/rave-jcr-utils/src/main/java/org/apache/rave/jcr/utils/RepositoryFactoryBean.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: rave/sandbox/content-services/rave-jcr-utils/src/main/java/org/apache/rave/jcr/utils/RepositoryFactoryBean.java
------------------------------------------------------------------------------
    svn:keywords = Id

Copied: rave/sandbox/content-services/rave-jcr-utils/src/main/java/org/apache/rave/jcr/utils/SessionFactory.java (from r1379122, rave/sandbox/content-services/rave-web-hmvc/src/main/java/org/apache/rave/portal/web/hmvc/resource/JcrResourceUtils.java)
URL: http://svn.apache.org/viewvc/rave/sandbox/content-services/rave-jcr-utils/src/main/java/org/apache/rave/jcr/utils/SessionFactory.java?p2=rave/sandbox/content-services/rave-jcr-utils/src/main/java/org/apache/rave/jcr/utils/SessionFactory.java&p1=rave/sandbox/content-services/rave-web-hmvc/src/main/java/org/apache/rave/portal/web/hmvc/resource/JcrResourceUtils.java&r1=1379122&r2=1379124&rev=1379124&view=diff
==============================================================================
--- rave/sandbox/content-services/rave-web-hmvc/src/main/java/org/apache/rave/portal/web/hmvc/resource/JcrResourceUtils.java (original)
+++ rave/sandbox/content-services/rave-jcr-utils/src/main/java/org/apache/rave/jcr/utils/SessionFactory.java Thu Aug 30 20:34:15 2012
@@ -17,16 +17,16 @@
  * under the License.
  */
 
-package org.apache.rave.portal.web.hmvc.resource;
+package org.apache.rave.jcr.utils;
+
+import javax.jcr.RepositoryException;
+import javax.jcr.Session;
 
 /**
  * @version "$Id$"
  */
-public final class JcrResourceUtils {
+public interface SessionFactory {
 
-    /**
-     * Prefix which indicates  resource is accessed from JCR repository
-     */
-    public static final String JCR_URL_PREFIX = "jcr:";
+    public Session getSession() throws RepositoryException;
 
 }

Copied: rave/sandbox/content-services/rave-jcr-utils/src/main/java/org/apache/rave/jcr/utils/TransientBaseRepositoryFactoryBean.java (from r1379122, rave/sandbox/content-services/rave-web-hmvc/src/main/java/org/apache/rave/portal/web/hmvc/resource/JcrResourceUtils.java)
URL: http://svn.apache.org/viewvc/rave/sandbox/content-services/rave-jcr-utils/src/main/java/org/apache/rave/jcr/utils/TransientBaseRepositoryFactoryBean.java?p2=rave/sandbox/content-services/rave-jcr-utils/src/main/java/org/apache/rave/jcr/utils/TransientBaseRepositoryFactoryBean.java&p1=rave/sandbox/content-services/rave-web-hmvc/src/main/java/org/apache/rave/portal/web/hmvc/resource/JcrResourceUtils.java&r1=1379122&r2=1379124&rev=1379124&view=diff
==============================================================================
--- rave/sandbox/content-services/rave-web-hmvc/src/main/java/org/apache/rave/portal/web/hmvc/resource/JcrResourceUtils.java (original)
+++ rave/sandbox/content-services/rave-jcr-utils/src/main/java/org/apache/rave/jcr/utils/TransientBaseRepositoryFactoryBean.java Thu Aug 30 20:34:15 2012
@@ -17,16 +17,22 @@
  * under the License.
  */
 
-package org.apache.rave.portal.web.hmvc.resource;
+package org.apache.rave.jcr.utils;
+
+import javax.jcr.Repository;
+
+import org.apache.jackrabbit.core.TransientRepository;
 
 /**
  * @version "$Id$"
  */
-public final class JcrResourceUtils {
+public class TransientBaseRepositoryFactoryBean extends RepositoryFactoryBean {
+
+
+    @Override
+    protected Repository createRepository() throws Exception {
+        return new TransientRepository(getRepositoryConfig());
+    }
 
-    /**
-     * Prefix which indicates  resource is accessed from JCR repository
-     */
-    public static final String JCR_URL_PREFIX = "jcr:";
 
 }

Modified: rave/sandbox/content-services/rave-web-hmvc/pom.xml
URL: http://svn.apache.org/viewvc/rave/sandbox/content-services/rave-web-hmvc/pom.xml?rev=1379124&r1=1379123&r2=1379124&view=diff
==============================================================================
--- rave/sandbox/content-services/rave-web-hmvc/pom.xml (original)
+++ rave/sandbox/content-services/rave-web-hmvc/pom.xml Thu Aug 30 20:34:15 2012
@@ -42,6 +42,16 @@
     </dependency>
     <dependency>
       <groupId>org.apache.rave.sandbox.jcr</groupId>
+      <artifactId>rave-jcr-data-model</artifactId>
+      <version>${project.version}</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.rave.sandbox.jcr</groupId>
+      <artifactId>rave-jcr-utils</artifactId>
+      <version>${project.version}</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.rave.sandbox.jcr</groupId>
       <artifactId>rave-jcr-service</artifactId>
       <version>${project.version}</version>
     </dependency>
@@ -91,6 +101,13 @@
 
     <!-- Test -->
     <dependency>
+      <groupId>org.apache.jackrabbit</groupId>
+      <artifactId>jackrabbit-jcr-tests</artifactId>
+      <version>${apache.jackrabbit.version}</version>
+      <scope>test</scope>
+    </dependency>
+
+    <dependency>
       <groupId>junit</groupId>
       <artifactId>junit</artifactId>
     </dependency>

Copied: rave/sandbox/content-services/rave-web-hmvc/src/main/java/org/apache/rave/portal/web/hmvc/resource/BinaryRepositoryController.java (from r1379122, rave/sandbox/content-services/rave-web-hmvc/src/main/java/org/apache/rave/portal/web/hmvc/resource/FreeMarkerTemplateLoader.java)
URL: http://svn.apache.org/viewvc/rave/sandbox/content-services/rave-web-hmvc/src/main/java/org/apache/rave/portal/web/hmvc/resource/BinaryRepositoryController.java?p2=rave/sandbox/content-services/rave-web-hmvc/src/main/java/org/apache/rave/portal/web/hmvc/resource/BinaryRepositoryController.java&p1=rave/sandbox/content-services/rave-web-hmvc/src/main/java/org/apache/rave/portal/web/hmvc/resource/FreeMarkerTemplateLoader.java&r1=1379122&r2=1379124&rev=1379124&view=diff
==============================================================================
--- rave/sandbox/content-services/rave-web-hmvc/src/main/java/org/apache/rave/portal/web/hmvc/resource/FreeMarkerTemplateLoader.java (original)
+++ rave/sandbox/content-services/rave-web-hmvc/src/main/java/org/apache/rave/portal/web/hmvc/resource/BinaryRepositoryController.java Thu Aug 30 20:34:15 2012
@@ -19,48 +19,30 @@
 
 package org.apache.rave.portal.web.hmvc.resource;
 
-import java.io.IOException;
-import java.io.Reader;
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
 
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
-
-import freemarker.cache.TemplateLoader;
+import org.springframework.web.servlet.ModelAndView;
+import org.springframework.web.servlet.mvc.multiaction.MultiActionController;
 
 /**
+ * Serves binaries from JCR repository
+ *
  * @version "$Id$"
  */
-public class FreeMarkerTemplateLoader implements TemplateLoader {
-
-    private static Logger log = LoggerFactory.getLogger(FreeMarkerTemplateLoader.class);
-
-    private JcrRepositoryResourceLoader loader;
 
-    @Override
-    public Object findTemplateSource(String name) throws IOException {
-        return null;
-    }
-
-    @Override
-    public long getLastModified(Object templateSource) {
-        return 1L;
-    }
+public class BinaryRepositoryController extends MultiActionController {
+    private static final Logger log = LoggerFactory.getLogger(BinaryRepositoryController.class);
 
-    @Override
-    public Reader getReader(Object templateSource, String encoding) throws IOException {
-        return null;
+    public ModelAndView render(HttpServletRequest request, HttpServletResponse response) {
+        final BinaryResourceView view = new BinaryResourceView();
+        final Map<String, Object> model = new HashMap<String, Object>();
+        return new ModelAndView(view, model);
     }
 
-    @Override
-    public void closeTemplateSource(Object templateSource) throws IOException {
-
-    }
-
-    public void setLoader(JcrRepositoryResourceLoader loader) {
-        this.loader = loader;
-    }
 }
-
-
-
-

Copied: rave/sandbox/content-services/rave-web-hmvc/src/main/java/org/apache/rave/portal/web/hmvc/resource/BinaryResourceView.java (from r1379122, rave/sandbox/content-services/rave-web-hmvc/src/main/java/org/apache/rave/portal/web/hmvc/resource/FreeMarkerTemplateLoader.java)
URL: http://svn.apache.org/viewvc/rave/sandbox/content-services/rave-web-hmvc/src/main/java/org/apache/rave/portal/web/hmvc/resource/BinaryResourceView.java?p2=rave/sandbox/content-services/rave-web-hmvc/src/main/java/org/apache/rave/portal/web/hmvc/resource/BinaryResourceView.java&p1=rave/sandbox/content-services/rave-web-hmvc/src/main/java/org/apache/rave/portal/web/hmvc/resource/FreeMarkerTemplateLoader.java&r1=1379122&r2=1379124&rev=1379124&view=diff
==============================================================================
--- rave/sandbox/content-services/rave-web-hmvc/src/main/java/org/apache/rave/portal/web/hmvc/resource/FreeMarkerTemplateLoader.java (original)
+++ rave/sandbox/content-services/rave-web-hmvc/src/main/java/org/apache/rave/portal/web/hmvc/resource/BinaryResourceView.java Thu Aug 30 20:34:15 2012
@@ -19,48 +19,42 @@
 
 package org.apache.rave.portal.web.hmvc.resource;
 
-import java.io.IOException;
-import java.io.Reader;
+import java.io.ByteArrayOutputStream;
+import java.util.Map;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
 
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
-
-import freemarker.cache.TemplateLoader;
+import org.springframework.web.servlet.view.AbstractView;
 
 /**
  * @version "$Id$"
  */
-public class FreeMarkerTemplateLoader implements TemplateLoader {
+public class BinaryResourceView extends AbstractView {
 
-    private static Logger log = LoggerFactory.getLogger(FreeMarkerTemplateLoader.class);
-
-    private JcrRepositoryResourceLoader loader;
+    private static Logger log = LoggerFactory.getLogger(BinaryResourceView.class);
+    private static final int DEFAULT_SIZE = 1024 << 10;
 
     @Override
-    public Object findTemplateSource(String name) throws IOException {
-        return null;
-    }
+    protected void renderMergedOutputModel(Map<String, Object> model, HttpServletRequest request, HttpServletResponse response) throws Exception {
 
-    @Override
-    public long getLastModified(Object templateSource) {
-        return 1L;
-    }
+        final ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(DEFAULT_SIZE);
+        setContentType(extractContentType(request));
 
-    @Override
-    public Reader getReader(Object templateSource, String encoding) throws IOException {
-        return null;
-    }
+        try {
 
-    @Override
-    public void closeTemplateSource(Object templateSource) throws IOException {
+            writeToResponse(response, byteArrayOutputStream);
+        } finally {
+            byteArrayOutputStream.close();
+        }
 
     }
 
-    public void setLoader(JcrRepositoryResourceLoader loader) {
-        this.loader = loader;
+    private String extractContentType(HttpServletRequest request) {
+        return "html/text";
     }
-}
-
-
 
 
+}

Added: rave/sandbox/content-services/rave-web-hmvc/src/main/java/org/apache/rave/portal/web/hmvc/resource/FreeMarkerTemplateHolder.java
URL: http://svn.apache.org/viewvc/rave/sandbox/content-services/rave-web-hmvc/src/main/java/org/apache/rave/portal/web/hmvc/resource/FreeMarkerTemplateHolder.java?rev=1379124&view=auto
==============================================================================
--- rave/sandbox/content-services/rave-web-hmvc/src/main/java/org/apache/rave/portal/web/hmvc/resource/FreeMarkerTemplateHolder.java (added)
+++ rave/sandbox/content-services/rave-web-hmvc/src/main/java/org/apache/rave/portal/web/hmvc/resource/FreeMarkerTemplateHolder.java Thu Aug 30 20:34:15 2012
@@ -0,0 +1,87 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.apache.rave.portal.web.hmvc.resource;
+
+import java.io.Serializable;
+
+/**
+ * Wrapper for  freemarker templates loaded from JCR repository
+ *
+ * @version "$Id$"
+ */
+public class FreeMarkerTemplateHolder implements Serializable {
+
+
+    private static final long serialVersionUID = 1L;
+    private String name;
+    private String data;
+    private long lastModified;
+
+    public FreeMarkerTemplateHolder() {
+    }
+
+    public FreeMarkerTemplateHolder(String name, String data, long lastModified) {
+        this.name = name;
+        this.data = data;
+        this.lastModified = lastModified;
+    }
+
+    public FreeMarkerTemplateHolder(String name, String data) {
+        this.name = name;
+        this.data = data;
+        this.lastModified = -1;
+    }
+
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public String getData() {
+        return data;
+    }
+
+    public void setData(String data) {
+        this.data = data;
+    }
+
+    public long getLastModified() {
+        return lastModified;
+    }
+
+    public void setLastModified(long lastModified) {
+        this.lastModified = lastModified;
+    }
+
+    @Override
+    public String toString() {
+        final StringBuilder sb = new StringBuilder();
+        sb.append("FreeMarkerTemplateHolder");
+        sb.append("{name='").append(name).append('\'');
+        sb.append(", data='").append(data).append('\'');
+        sb.append(", lastModified=").append(lastModified);
+        sb.append('}');
+        return sb.toString();
+    }
+}

Propchange: rave/sandbox/content-services/rave-web-hmvc/src/main/java/org/apache/rave/portal/web/hmvc/resource/FreeMarkerTemplateHolder.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: rave/sandbox/content-services/rave-web-hmvc/src/main/java/org/apache/rave/portal/web/hmvc/resource/FreeMarkerTemplateHolder.java
------------------------------------------------------------------------------
    svn:keywords = Id

Modified: rave/sandbox/content-services/rave-web-hmvc/src/main/java/org/apache/rave/portal/web/hmvc/resource/FreeMarkerTemplateLoader.java
URL: http://svn.apache.org/viewvc/rave/sandbox/content-services/rave-web-hmvc/src/main/java/org/apache/rave/portal/web/hmvc/resource/FreeMarkerTemplateLoader.java?rev=1379124&r1=1379123&r2=1379124&view=diff
==============================================================================
--- rave/sandbox/content-services/rave-web-hmvc/src/main/java/org/apache/rave/portal/web/hmvc/resource/FreeMarkerTemplateLoader.java (original)
+++ rave/sandbox/content-services/rave-web-hmvc/src/main/java/org/apache/rave/portal/web/hmvc/resource/FreeMarkerTemplateLoader.java Thu Aug 30 20:34:15 2012
@@ -20,43 +20,61 @@
 package org.apache.rave.portal.web.hmvc.resource;
 
 import java.io.IOException;
+import java.io.InputStream;
 import java.io.Reader;
+import java.io.StringReader;
 
+import org.apache.commons.io.IOUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
+import org.springframework.core.io.Resource;
+import org.springframework.core.io.ResourceLoader;
 
 import freemarker.cache.TemplateLoader;
 
 /**
+ * Loads FreeMarker templates from JCR repository.
+ *
  * @version "$Id$"
  */
 public class FreeMarkerTemplateLoader implements TemplateLoader {
 
     private static Logger log = LoggerFactory.getLogger(FreeMarkerTemplateLoader.class);
 
-    private JcrRepositoryResourceLoader loader;
+    private ResourceLoader loader;
 
     @Override
     public Object findTemplateSource(String name) throws IOException {
-        return null;
+        log.debug("Loading freemarker template from JCR repository {}", name);
+        final Resource resource = loader.getResource(name);
+        if (resource == null) {
+            return null;
+        }
+        // parse resource
+        final InputStream inputStream = resource.getInputStream();
+        String stringTemplate = IOUtils.toString(inputStream, "UTF-8");
+        return new FreeMarkerTemplateHolder(name, stringTemplate);
     }
 
     @Override
     public long getLastModified(Object templateSource) {
-        return 1L;
+        if (templateSource == null) {
+            return -1;
+        }
+        return ((FreeMarkerTemplateHolder) templateSource).getLastModified();
     }
 
     @Override
     public Reader getReader(Object templateSource, String encoding) throws IOException {
-        return null;
+        return new StringReader(((FreeMarkerTemplateHolder) templateSource).getData());
     }
 
     @Override
     public void closeTemplateSource(Object templateSource) throws IOException {
-
+        // NOOP
     }
 
-    public void setLoader(JcrRepositoryResourceLoader loader) {
+    public void setLoader(ResourceLoader loader) {
         this.loader = loader;
     }
 }

Modified: rave/sandbox/content-services/rave-web-hmvc/src/main/java/org/apache/rave/portal/web/hmvc/resource/JcrRepositoryResourceLoader.java
URL: http://svn.apache.org/viewvc/rave/sandbox/content-services/rave-web-hmvc/src/main/java/org/apache/rave/portal/web/hmvc/resource/JcrRepositoryResourceLoader.java?rev=1379124&r1=1379123&r2=1379124&view=diff
==============================================================================
--- rave/sandbox/content-services/rave-web-hmvc/src/main/java/org/apache/rave/portal/web/hmvc/resource/JcrRepositoryResourceLoader.java (original)
+++ rave/sandbox/content-services/rave-web-hmvc/src/main/java/org/apache/rave/portal/web/hmvc/resource/JcrRepositoryResourceLoader.java Thu Aug 30 20:34:15 2012
@@ -19,12 +19,8 @@
 
 package org.apache.rave.portal.web.hmvc.resource;
 
-import java.io.InputStream;
-
-import javax.jcr.Node;
-import javax.jcr.RepositoryException;
-import javax.jcr.Session;
-
+import org.apache.rave.jcr.data.document.impl.BinaryContent;
+import org.apache.rave.jcr.data.mapping.DocumentManager;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.core.io.InputStreamResource;
@@ -42,35 +38,34 @@ public class JcrRepositoryResourceLoader
 
     private static Logger log = LoggerFactory.getLogger(JcrRepositoryResourceLoader.class);
 
-    private final Session session;
 
-    public JcrRepositoryResourceLoader(Session session) {
-        this.session = session;
+    private final DocumentManager documentManager;
+
+    public JcrRepositoryResourceLoader(DocumentManager documentManager) {
+        this.documentManager = documentManager;
     }
 
 
     @Override
     public Resource getResource(String absolutePath) {
         Assert.notNull(absolutePath, "Resource path must not be null");
-        if (!absolutePath.startsWith("/") || !absolutePath.startsWith(JcrResourceUtils.JCR_URL_PREFIX)) {
+        if (!absolutePath.startsWith("/") && !absolutePath.startsWith(JcrResourceUtils.JCR_URL_PREFIX)) {
             log.error("Location provided was not absolute path nor JCR protocol: {}", absolutePath);
             return null;
         }
-        try {
-            if (!session.nodeExists(absolutePath)) {
-                log.error("Location provided does not exists: {}", absolutePath);
-                return null;
-            }
-            final Node item = session.getNode(absolutePath);
-            final Node content = item.getNode("jcr:content");
-            if (content.hasProperty("jcr:data")) {
-                InputStream ins = content.getProperty("jcr:data").getBinary().getStream();
-                return new InputStreamResource(ins);
-            }
-        } catch (RepositoryException e) {
-            log.error("Error fetching resource for path:" + absolutePath, e);
+        final BinaryContent content = documentManager.fetchDocument(preparePath(absolutePath), BinaryContent.class);
+        if (content == null) {
+            log.warn("### Resource does not exists: {}", absolutePath);
+            return null;
+        }
+        return new InputStreamResource(content.getResource().getData());
+    }
+
+    private String preparePath(String absolutePath) {
+        if (absolutePath.startsWith("/")) {
+            return absolutePath;
         }
-        return null;
+        return absolutePath.substring(JcrResourceUtils.JCR_URL_PREFIX_LENGTH);
     }
 
 

Modified: rave/sandbox/content-services/rave-web-hmvc/src/main/java/org/apache/rave/portal/web/hmvc/resource/JcrResourceUtils.java
URL: http://svn.apache.org/viewvc/rave/sandbox/content-services/rave-web-hmvc/src/main/java/org/apache/rave/portal/web/hmvc/resource/JcrResourceUtils.java?rev=1379124&r1=1379123&r2=1379124&view=diff
==============================================================================
--- rave/sandbox/content-services/rave-web-hmvc/src/main/java/org/apache/rave/portal/web/hmvc/resource/JcrResourceUtils.java (original)
+++ rave/sandbox/content-services/rave-web-hmvc/src/main/java/org/apache/rave/portal/web/hmvc/resource/JcrResourceUtils.java Thu Aug 30 20:34:15 2012
@@ -28,5 +28,6 @@ public final class JcrResourceUtils {
      * Prefix which indicates  resource is accessed from JCR repository
      */
     public static final String JCR_URL_PREFIX = "jcr:";
+    public static final int JCR_URL_PREFIX_LENGTH = JCR_URL_PREFIX.length();
 
 }

Modified: rave/sandbox/content-services/rave-web-hmvc/src/test/java/org/apache/rave/portal/web/hmvc/HmvcHandlerMethodMappingByConfigTest.java
URL: http://svn.apache.org/viewvc/rave/sandbox/content-services/rave-web-hmvc/src/test/java/org/apache/rave/portal/web/hmvc/HmvcHandlerMethodMappingByConfigTest.java?rev=1379124&r1=1379123&r2=1379124&view=diff
==============================================================================
--- rave/sandbox/content-services/rave-web-hmvc/src/test/java/org/apache/rave/portal/web/hmvc/HmvcHandlerMethodMappingByConfigTest.java (original)
+++ rave/sandbox/content-services/rave-web-hmvc/src/test/java/org/apache/rave/portal/web/hmvc/HmvcHandlerMethodMappingByConfigTest.java Thu Aug 30 20:34:15 2012
@@ -67,7 +67,7 @@ public class HmvcHandlerMethodMappingByC
     public void setUp() throws Exception {
         request = new MockHttpServletRequest();
         response = new MockHttpServletResponse();
-        handlerAdapter = (HmvcHandlerMethodHandlerAdapter) applicationContext.getBean("handlerAdapter");
+        handlerAdapter = (HmvcHandlerMethodHandlerAdapter) applicationContext.getBean("hmvcHandlerAdapter");
         controller = new MyPageController();
 
     }

Copied: rave/sandbox/content-services/rave-web-hmvc/src/test/java/org/apache/rave/portal/web/hmvc/resource/BinaryRepositoryControllerTest.java (from r1379122, rave/sandbox/content-services/rave-web-hmvc/src/test/java/org/apache/rave/portal/web/hmvc/HmvcHandlerMethodMappingByConfigTest.java)
URL: http://svn.apache.org/viewvc/rave/sandbox/content-services/rave-web-hmvc/src/test/java/org/apache/rave/portal/web/hmvc/resource/BinaryRepositoryControllerTest.java?p2=rave/sandbox/content-services/rave-web-hmvc/src/test/java/org/apache/rave/portal/web/hmvc/resource/BinaryRepositoryControllerTest.java&p1=rave/sandbox/content-services/rave-web-hmvc/src/test/java/org/apache/rave/portal/web/hmvc/HmvcHandlerMethodMappingByConfigTest.java&r1=1379122&r2=1379124&rev=1379124&view=diff
==============================================================================
--- rave/sandbox/content-services/rave-web-hmvc/src/test/java/org/apache/rave/portal/web/hmvc/HmvcHandlerMethodMappingByConfigTest.java (original)
+++ rave/sandbox/content-services/rave-web-hmvc/src/test/java/org/apache/rave/portal/web/hmvc/resource/BinaryRepositoryControllerTest.java Thu Aug 30 20:34:15 2012
@@ -17,14 +17,12 @@
  * under the License.
  */
 
-package org.apache.rave.portal.web.hmvc;
+package org.apache.rave.portal.web.hmvc.resource;
 
 import java.util.Map;
-import java.util.Set;
 
 import javax.servlet.http.HttpServletRequest;
 
-import org.apache.rave.portal.web.hmvc.example.MyPageController;
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
@@ -39,62 +37,66 @@ import org.springframework.test.context.
 import org.springframework.web.servlet.HandlerExecutionChain;
 import org.springframework.web.servlet.HandlerMapping;
 import org.springframework.web.servlet.ModelAndView;
+import org.springframework.web.servlet.handler.SimpleUrlHandlerMapping;
+import org.springframework.web.servlet.mvc.Controller;
+import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter;
 
-import static junit.framework.Assert.assertEquals;
+import static junit.framework.Assert.assertNotNull;
 import static junit.framework.Assert.assertTrue;
-import static org.springframework.test.web.ModelAndViewAssert.assertViewName;
 
 /**
  * @version "$Id$"
  */
-
 @RunWith(SpringJUnit4ClassRunner.class)
 @ContextConfiguration({"classpath:test-config.xml"})
-public class HmvcHandlerMethodMappingByConfigTest {
-    private static Logger log = LoggerFactory.getLogger(HmvcHandlerMethodMappingByConfigTest.class);
+public class BinaryRepositoryControllerTest {
+
+    private static Logger log = LoggerFactory.getLogger(BinaryRepositoryControllerTest.class);
 
     @Autowired
     private ApplicationContext applicationContext;
     private MockHttpServletRequest request;
     private MockHttpServletResponse response;
-    private HmvcHandlerMethodHandlerAdapter handlerAdapter;
-    //<bean name="handlerAdapter" class="org.apache.rave.portal.web.hmvc.HmvcHandlerMethodHandlerAdapter"/>
 
-    private MyPageController controller;
+    @Autowired
+    private RequestMappingHandlerAdapter handlerAdapter;
+
+
+    private SimpleUrlHandlerMapping handlerMapping;
 
 
     @Before
     public void setUp() throws Exception {
         request = new MockHttpServletRequest();
         response = new MockHttpServletResponse();
-        handlerAdapter = (HmvcHandlerMethodHandlerAdapter) applicationContext.getBean("handlerAdapter");
-        controller = new MyPageController();
+        handlerMapping = (SimpleUrlHandlerMapping) applicationContext.getBean("org.springframework.web.servlet.config.viewControllerHandlerMapping");
 
     }
 
     @Test
-    public void testRegistering() throws Exception {
-
-        final String requestUri = "/mypage2";
+    public void testRender() throws Exception {
+        String requestUri = "/binaries/foo.css";
+        request.setRequestURI(requestUri);
+        HandlerExecutionChain chain = handlerMapping.getHandler(request);
+        assertNotNull("HandlerExecutionChain was null", chain);
+        Controller controller = (Controller) chain.getHandler();
+        request.setMethod("GET");
+        ModelAndView modelAndView = controller.handleRequest(request, response);
+        assertTrue("expected model and view", modelAndView != null);
+        // subfolder
+        requestUri = "/binaries/somepath/test/foo.jpeg";
+        request.setRequestURI(requestUri);
+        chain = handlerMapping.getHandler(request);
+        assertNotNull("HandlerExecutionChain was null", chain);
+        controller = (Controller) chain.getHandler();
+        request.setMethod("GET");
+        modelAndView = controller.handleRequest(request, response);
+        assertTrue("expected model and view", modelAndView != null);
+        // mismatch
+        requestUri = "/no-binaries/somepath/test/foo.jpeg";
         request.setRequestURI(requestUri);
-        final Object handler = this.getHandler(request);
-        HmvcHandlerMethod handlerMethod = (HmvcHandlerMethod) handler;
-        final ModelAndView mav = handlerAdapter.handle(request, response, handlerMethod);
-        final Set<String> childrenNames = handlerMethod.getConfiguration().getChildren().keySet();
-        assertTrue("Expected 3 child names", childrenNames.size() == 3);
-        assertTrue("Expected body", childrenNames.contains("body"));
-        assertTrue("Expected head", childrenNames.contains("head"));
-        assertTrue("Expected footer", childrenNames.contains("footer"));
-        final HmvcHandlerMethod child = handlerMethod.getConfiguration().getChildren().get("body").getMethods().get("default");
-        final Set<String> bodyKids = child.getConfiguration().getChildren().keySet();
-        assertTrue("body should have zero children", bodyKids.size() == 0);
-        assertViewName(mav, "hmvc/mypage");
-        @SuppressWarnings("unchecked")
-        final Map<String, ModelAndView> childModels = (Map<String, ModelAndView>) mav.getModelMap().get(HmvcHandlerMethod.MODEL_AND_VIEW);
-        assertTrue(childModels != null);
-        final ModelAndView head = childModels.get("head");
-        assertTrue(head != null);
-        assertEquals("Expected view override", "hmvc/override/myheader", head.getViewName());
+        chain = handlerMapping.getHandler(request);
+        assertTrue("HandlerExecutionChain should be null", chain == null);
 
     }
 
@@ -109,4 +111,6 @@ public class HmvcHandlerMethodMappingByC
         }
         return null;
     }
+
 }
+

Added: rave/sandbox/content-services/rave-web-hmvc/src/test/java/org/apache/rave/portal/web/hmvc/resource/FreeMarkerTemplateLoaderTest.java
URL: http://svn.apache.org/viewvc/rave/sandbox/content-services/rave-web-hmvc/src/test/java/org/apache/rave/portal/web/hmvc/resource/FreeMarkerTemplateLoaderTest.java?rev=1379124&view=auto
==============================================================================
--- rave/sandbox/content-services/rave-web-hmvc/src/test/java/org/apache/rave/portal/web/hmvc/resource/FreeMarkerTemplateLoaderTest.java (added)
+++ rave/sandbox/content-services/rave-web-hmvc/src/test/java/org/apache/rave/portal/web/hmvc/resource/FreeMarkerTemplateLoaderTest.java Thu Aug 30 20:34:15 2012
@@ -0,0 +1,70 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.apache.rave.portal.web.hmvc.resource;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.ApplicationContext;
+import org.springframework.core.io.ResourceLoader;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+import org.springframework.web.servlet.view.freemarker.FreeMarkerConfig;
+
+import freemarker.cache.TemplateLoader;
+import freemarker.template.Configuration;
+import static org.junit.Assert.assertNotNull;
+
+/**
+ * @version "$Id$"
+ */
+@RunWith(SpringJUnit4ClassRunner.class)
+@ContextConfiguration({"classpath:test-config.xml"})
+public class FreeMarkerTemplateLoaderTest {
+
+    private static Logger log = LoggerFactory.getLogger(FreeMarkerTemplateLoaderTest.class);
+
+    @Autowired
+    private ApplicationContext applicationContext;
+    private ResourceLoader loader;
+
+    @Before
+    public void setUp() throws Exception {
+        //
+
+    }
+
+    @Test
+    public void testFindTemplateSource() throws Exception {
+
+        log.info("applicationContext {}", applicationContext);
+        final FreeMarkerConfig freemarkerConfig = (FreeMarkerConfig) applicationContext.getBean("freemarkerConfig");
+        final Configuration configuration = freemarkerConfig.getConfiguration();
+        final TemplateLoader templateLoader = configuration.getTemplateLoader();
+        assertNotNull(templateLoader);
+        final Object test = templateLoader.findTemplateSource("test");
+        log.info("test {}", test);
+
+
+    }
+}

Propchange: rave/sandbox/content-services/rave-web-hmvc/src/test/java/org/apache/rave/portal/web/hmvc/resource/FreeMarkerTemplateLoaderTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: rave/sandbox/content-services/rave-web-hmvc/src/test/java/org/apache/rave/portal/web/hmvc/resource/FreeMarkerTemplateLoaderTest.java
------------------------------------------------------------------------------
    svn:keywords = Id

Modified: rave/sandbox/content-services/rave-web-hmvc/src/test/java/org/apache/rave/portal/web/hmvc/resource/JcrRepositoryResourceLoaderTest.java
URL: http://svn.apache.org/viewvc/rave/sandbox/content-services/rave-web-hmvc/src/test/java/org/apache/rave/portal/web/hmvc/resource/JcrRepositoryResourceLoaderTest.java?rev=1379124&r1=1379123&r2=1379124&view=diff
==============================================================================
--- rave/sandbox/content-services/rave-web-hmvc/src/test/java/org/apache/rave/portal/web/hmvc/resource/JcrRepositoryResourceLoaderTest.java (original)
+++ rave/sandbox/content-services/rave-web-hmvc/src/test/java/org/apache/rave/portal/web/hmvc/resource/JcrRepositoryResourceLoaderTest.java Thu Aug 30 20:34:15 2012
@@ -19,40 +19,121 @@
 
 package org.apache.rave.portal.web.hmvc.resource;
 
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.StringWriter;
+import java.util.Calendar;
+
+import javax.jcr.RepositoryException;
+import javax.jcr.Session;
+import javax.jcr.nodetype.NodeType;
+
+import org.apache.commons.io.IOUtils;
+import org.apache.jackrabbit.commons.cnd.CndImporter;
+import org.apache.rave.jcr.data.document.BinaryDocument;
+import org.apache.rave.jcr.data.document.impl.BinaryContent;
+import org.apache.rave.jcr.data.document.impl.BinaryResource;
+import org.apache.rave.jcr.data.document.impl.ContentFolder;
+import org.apache.rave.jcr.data.mapping.DocumentManager;
+import org.junit.Before;
 import org.junit.Test;
+import org.junit.runner.RunWith;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.ApplicationContext;
 import org.springframework.core.io.Resource;
 import org.springframework.core.io.ResourceLoader;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
 
 import static junit.framework.Assert.assertEquals;
+import static junit.framework.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
 
 /**
  * @version "$Id$"
  */
+@RunWith(SpringJUnit4ClassRunner.class)
+@ContextConfiguration({"classpath:test-config.xml"})
 public class JcrRepositoryResourceLoaderTest {
 
     private static Logger log = LoggerFactory.getLogger(JcrRepositoryResourceLoaderTest.class);
 
-    @Test
-    public void testGetResource() throws Exception {
+    @Autowired
+    private ApplicationContext applicationContext;
+
+    @Before
+    public void setUp() throws Exception {
+
+
+        // load samples into repository:
+        DocumentManager manager = (DocumentManager) applicationContext.getBean("documentManager");
+        // register CND:
+        final String cndFile = "/rave-data-model.cnd";
+        final InputStream cnd = getClass().getResourceAsStream(cndFile);
+        registerCnd(manager.getSession(), cnd);
+        // create binaries folder:
+        manager.saveDocument(new ContentFolder("/binaries"));
+
+        final BinaryDocument document = new BinaryContent();
+        document.setPath("/binaries/freemarker");
+        final BinaryResource resource = new BinaryResource();
+        resource.setLastModified(Calendar.getInstance());
+        resource.setData(getClass().getResourceAsStream("/test-template.ftl"));
+        resource.setMimeType("plain/text");
+        document.setResource(resource);
+        manager.saveDocument(document);
 
     }
 
-    @Test(expected = IllegalArgumentException.class)
-    public void testNullResource() throws Exception {
-        ResourceLoader loader = new JcrRepositoryResourceLoader(null);
-        loader.getResource(null);
+
+    @Test
+    public void testValidResource() throws Exception {
+        ResourceLoader loader = (ResourceLoader) applicationContext.getBean("jcrResourceLoader");
+        assertTrue(loader != null);
+        Resource resource = loader.getResource("/binaries/freemarker");
+        assertNotNull("Expected valid resource", resource);
+        final InputStream inputStream = resource.getInputStream();
+        StringWriter writer = new StringWriter();
+        IOUtils.copy(inputStream, writer, "UTF-8");
+        assertEquals("<h1>${text}</h1>", writer.toString());
+
     }
 
     @Test
     public void testInvalidResource() throws Exception {
-        ResourceLoader loader = new JcrRepositoryResourceLoader(null);
+        ResourceLoader loader = (ResourceLoader) applicationContext.getBean("jcrResourceLoader");
         Resource resource = loader.getResource("foo/bar");
         assertEquals("Expected invalid resource", null, resource);
         resource = loader.getResource("jcr:/foo/bar");
         assertEquals("Expected invalid resource", null, resource);
     }
 
+    @Test(expected = IllegalArgumentException.class)
+    public void testNullResource() throws Exception {
+        ResourceLoader loader = new JcrRepositoryResourceLoader(null);
+        loader.getResource(null);
+    }
+
+
+    protected void registerCnd(final Session session, final InputStream stream) {
+
+        try {
+            NodeType[] nodeTypes = CndImporter.registerNodeTypes(new InputStreamReader(stream), session);
+            for (NodeType nt : nodeTypes) {
+                log.info("@registered nodetype: {}", nt.getName());
+            }
+
+        } catch (org.apache.jackrabbit.commons.cnd.ParseException e) {
+            log.error("Error parsing CND: ", e);
+        } catch (RepositoryException e) {
+            log.error("Error registering CND: ", e);
+        } catch (IOException e) {
+            log.error("Error loading CND file: ", e);
+        }
+
+    }
 
 }

Added: rave/sandbox/content-services/rave-web-hmvc/src/test/repository/repository.xml
URL: http://svn.apache.org/viewvc/rave/sandbox/content-services/rave-web-hmvc/src/test/repository/repository.xml?rev=1379124&view=auto
==============================================================================
--- rave/sandbox/content-services/rave-web-hmvc/src/test/repository/repository.xml (added)
+++ rave/sandbox/content-services/rave-web-hmvc/src/test/repository/repository.xml Thu Aug 30 20:34:15 2012
@@ -0,0 +1,44 @@
+<?xml version="1.0"?>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements.  See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership.  The ASF licenses this file
+  to you 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.
+  -->
+<!DOCTYPE Repository PUBLIC "-//The Apache Software Foundation//DTD Jackrabbit 1.6//EN" "http://jackrabbit.apache.org/dtd/repository-1.6.dtd">
+<Repository>
+  <FileSystem class="org.apache.jackrabbit.core.fs.mem.MemoryFileSystem"/>
+
+  <DataStore class="org.apache.jackrabbit.core.data.FileDataStore"/>
+
+  <Security appName="Jackrabbit">
+    <SecurityManager class="org.apache.jackrabbit.core.security.simple.SimpleSecurityManager" workspaceName="security"/>
+    <AccessManager class="org.apache.jackrabbit.core.security.simple.SimpleAccessManager"/>
+    <LoginModule class="org.apache.jackrabbit.core.security.simple.SimpleLoginModule"/>
+  </Security>
+
+  <Workspaces rootPath="${rep.home}/workspaces" defaultWorkspace="default" maxIdleTime="2"/>
+
+  <Workspace name="${wsp.name}">
+    <FileSystem class="org.apache.jackrabbit.core.fs.mem.MemoryFileSystem"/>
+    <PersistenceManager class="org.apache.jackrabbit.core.persistence.mem.InMemBundlePersistenceManager"/>
+  </Workspace>
+
+  <Versioning rootPath="${rep.home}/version">
+    <FileSystem class="org.apache.jackrabbit.core.fs.mem.MemoryFileSystem"/>
+    <PersistenceManager class="org.apache.jackrabbit.core.persistence.mem.InMemBundlePersistenceManager"/>
+  </Versioning>
+
+</Repository>

Propchange: rave/sandbox/content-services/rave-web-hmvc/src/test/repository/repository.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: rave/sandbox/content-services/rave-web-hmvc/src/test/repository/repository.xml
------------------------------------------------------------------------------
    svn:keywords = Id

Added: rave/sandbox/content-services/rave-web-hmvc/src/test/repository/workspaces/default/workspace.xml
URL: http://svn.apache.org/viewvc/rave/sandbox/content-services/rave-web-hmvc/src/test/repository/workspaces/default/workspace.xml?rev=1379124&view=auto
==============================================================================
--- rave/sandbox/content-services/rave-web-hmvc/src/test/repository/workspaces/default/workspace.xml (added)
+++ rave/sandbox/content-services/rave-web-hmvc/src/test/repository/workspaces/default/workspace.xml Thu Aug 30 20:34:15 2012
@@ -0,0 +1,21 @@
+<?xml version="1.0"?>
+<!--
+   Licensed to the Apache Software Foundation (ASF) under one or more
+   contributor license agreements.  See the NOTICE file distributed with
+   this work for additional information regarding copyright ownership.
+   The ASF licenses this file to You 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.
+  -->
+<Workspace name="default">
+  <FileSystem class="org.apache.jackrabbit.core.fs.mem.MemoryFileSystem"/>
+  <PersistenceManager class="org.apache.jackrabbit.core.persistence.mem.InMemBundlePersistenceManager"/>
+</Workspace>
\ No newline at end of file

Propchange: rave/sandbox/content-services/rave-web-hmvc/src/test/repository/workspaces/default/workspace.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: rave/sandbox/content-services/rave-web-hmvc/src/test/repository/workspaces/default/workspace.xml
------------------------------------------------------------------------------
    svn:keywords = Id

Added: rave/sandbox/content-services/rave-web-hmvc/src/test/resources/log4j.dtd
URL: http://svn.apache.org/viewvc/rave/sandbox/content-services/rave-web-hmvc/src/test/resources/log4j.dtd?rev=1379124&view=auto
==============================================================================
--- rave/sandbox/content-services/rave-web-hmvc/src/test/resources/log4j.dtd (added)
+++ rave/sandbox/content-services/rave-web-hmvc/src/test/resources/log4j.dtd Thu Aug 30 20:34:15 2012
@@ -0,0 +1,230 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements.  See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership.  The ASF licenses this file
+  to you 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.
+  -->
+
+<!-- Authors: Chris Taylor, Ceki Gulcu. -->
+
+<!-- Version: 1.2 -->
+
+<!-- A configuration element consists of optional renderer
+elements,appender elements, categories and an optional root
+element. -->
+
+<!ELEMENT log4j:configuration (renderer*, appender*,plugin*, (category|logger)*,root?,
+                               (categoryFactory|loggerFactory)?)>
+
+<!-- The "threshold" attribute takes a level value below which -->
+<!-- all logging statements are disabled. -->
+
+<!-- Setting the "debug" enable the printing of internal log4j logging   -->
+<!-- statements.                                                         -->
+
+<!-- By default, debug attribute is "null", meaning that we not do touch -->
+<!-- internal log4j logging settings. The "null" value for the threshold -->
+<!-- attribute can be misleading. The threshold field of a repository	 -->
+<!-- cannot be set to null. The "null" value for the threshold attribute -->
+<!-- simply means don't touch the threshold field, the threshold field   --> 
+<!-- keeps its old value.                                                -->
+     
+<!ATTLIST log4j:configuration
+  xmlns:log4j              CDATA #FIXED "http://jakarta.apache.org/log4j/" 
+  threshold                (all|trace|debug|info|warn|error|fatal|off|null) "null"
+  debug                    (true|false|null)  "null"
+  reset                    (true|false) "false"
+>
+
+<!-- renderer elements allow the user to customize the conversion of  -->
+<!-- message objects to String.                                       -->
+
+<!ELEMENT renderer EMPTY>
+<!ATTLIST renderer
+  renderedClass  CDATA #REQUIRED
+  renderingClass CDATA #REQUIRED
+>
+
+<!-- Appenders must have a name and a class. -->
+<!-- Appenders may contain an error handler, a layout, optional parameters -->
+<!-- and filters. They may also reference (or include) other appenders. -->
+<!ELEMENT appender (errorHandler?, param*,
+      rollingPolicy?, triggeringPolicy?, connectionSource?,
+      layout?, filter*, appender-ref*)>
+<!ATTLIST appender
+  name 		CDATA 	#REQUIRED
+  class 	CDATA	#REQUIRED
+>
+
+<!ELEMENT layout (param*)>
+<!ATTLIST layout
+  class		CDATA	#REQUIRED
+>
+
+<!ELEMENT filter (param*)>
+<!ATTLIST filter
+  class		CDATA	#REQUIRED
+>
+
+<!-- ErrorHandlers can be of any class. They can admit any number of -->
+<!-- parameters. -->
+
+<!ELEMENT errorHandler (param*, root-ref?, logger-ref*,  appender-ref?)> 
+<!ATTLIST errorHandler
+   class        CDATA   #REQUIRED 
+>
+
+<!ELEMENT root-ref EMPTY>
+
+<!ELEMENT logger-ref EMPTY>
+<!ATTLIST logger-ref
+  ref CDATA #REQUIRED
+>
+
+<!ELEMENT param EMPTY>
+<!ATTLIST param
+  name		CDATA   #REQUIRED
+  value		CDATA	#REQUIRED
+>
+
+
+<!-- The priority class is org.apache.log4j.Level by default -->
+<!ELEMENT priority (param*)>
+<!ATTLIST priority
+  class   CDATA	#IMPLIED
+  value	  CDATA #REQUIRED
+>
+
+<!-- The level class is org.apache.log4j.Level by default -->
+<!ELEMENT level (param*)>
+<!ATTLIST level
+  class   CDATA	#IMPLIED
+  value	  CDATA #REQUIRED
+>
+
+
+<!-- If no level element is specified, then the configurator MUST not -->
+<!-- touch the level of the named category. -->
+<!ELEMENT category (param*,(priority|level)?,appender-ref*)>
+<!ATTLIST category
+  class         CDATA   #IMPLIED
+  name		CDATA	#REQUIRED
+  additivity	(true|false) "true"  
+>
+
+<!-- If no level element is specified, then the configurator MUST not -->
+<!-- touch the level of the named logger. -->
+
+<!ELEMENT logger (level?,appender-ref*)>
+<!ATTLIST logger
+  name		CDATA	#REQUIRED
+  additivity	(true|false) "true"  
+>
+
+
+<!ELEMENT categoryFactory (param*)>
+<!ATTLIST categoryFactory 
+   class        CDATA #REQUIRED>
+
+<!ELEMENT loggerFactory (param*)>
+<!ATTLIST loggerFactory
+   class        CDATA #REQUIRED>
+
+<!ELEMENT appender-ref EMPTY>
+<!ATTLIST appender-ref
+  ref CDATA #REQUIRED
+>
+
+<!-- plugins must have a name and class and can have optional parameters -->
+<!ELEMENT plugin (param*, connectionSource?)>
+<!ATTLIST plugin
+  name 		CDATA 	   #REQUIRED
+  class 	CDATA  #REQUIRED
+>
+
+<!ELEMENT connectionSource (dataSource?, param*)>
+<!ATTLIST connectionSource
+  class        CDATA  #REQUIRED
+>
+
+<!ELEMENT dataSource (param*)>
+<!ATTLIST dataSource
+  class        CDATA  #REQUIRED
+>
+
+<!ELEMENT triggeringPolicy ((param|filter)*)>
+<!ATTLIST triggeringPolicy
+  name 		CDATA  #IMPLIED
+  class 	CDATA  #REQUIRED
+>
+
+<!ELEMENT rollingPolicy (param*)>
+<!ATTLIST rollingPolicy
+  name 		CDATA  #IMPLIED
+  class 	CDATA  #REQUIRED
+>
+
+
+<!-- If no priority element is specified, then the configurator MUST not -->
+<!-- touch the priority of root. -->
+<!-- The root category always exists and cannot be subclassed. -->
+<!ELEMENT root (param*, (priority|level)?, appender-ref*)>
+
+
+<!-- ==================================================================== -->
+<!--                       A logging event                                -->
+<!-- ==================================================================== -->
+<!ELEMENT log4j:eventSet (log4j:event*)>
+<!ATTLIST log4j:eventSet
+  xmlns:log4j             CDATA #FIXED "http://jakarta.apache.org/log4j/" 
+  version                (1.1|1.2) "1.2" 
+  includesLocationInfo   (true|false) "true"
+>
+
+
+
+<!ELEMENT log4j:event (log4j:message, log4j:NDC?, log4j:throwable?, 
+                       log4j:locationInfo?, log4j:properties?) >
+
+<!-- The timestamp format is application dependent. -->
+<!ATTLIST log4j:event
+    logger     CDATA #REQUIRED
+    level      CDATA #REQUIRED
+    thread     CDATA #REQUIRED
+    timestamp  CDATA #REQUIRED
+    time       CDATA #IMPLIED
+>
+
+<!ELEMENT log4j:message (#PCDATA)>
+<!ELEMENT log4j:NDC (#PCDATA)>
+
+<!ELEMENT log4j:throwable (#PCDATA)>
+
+<!ELEMENT log4j:locationInfo EMPTY>
+<!ATTLIST log4j:locationInfo
+  class  CDATA	#REQUIRED
+  method CDATA	#REQUIRED
+  file   CDATA	#REQUIRED
+  line   CDATA	#REQUIRED
+>
+
+<!ELEMENT log4j:properties (log4j:data*)>
+
+<!ELEMENT log4j:data EMPTY>
+<!ATTLIST log4j:data
+  name   CDATA	#REQUIRED
+  value  CDATA	#REQUIRED
+>

Propchange: rave/sandbox/content-services/rave-web-hmvc/src/test/resources/log4j.dtd
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: rave/sandbox/content-services/rave-web-hmvc/src/test/resources/log4j.dtd
------------------------------------------------------------------------------
    svn:keywords = Id

Modified: rave/sandbox/content-services/rave-web-hmvc/src/test/resources/log4j.xml
URL: http://svn.apache.org/viewvc/rave/sandbox/content-services/rave-web-hmvc/src/test/resources/log4j.xml?rev=1379124&r1=1379123&r2=1379124&view=diff
==============================================================================
--- rave/sandbox/content-services/rave-web-hmvc/src/test/resources/log4j.xml (original)
+++ rave/sandbox/content-services/rave-web-hmvc/src/test/resources/log4j.xml Thu Aug 30 20:34:15 2012
@@ -43,7 +43,7 @@
   <!-- ====================================================================== -->
 
   <category name="org.apache.jackrabbit">
-    <level value="warn"/>
+    <level value="info"/>
   </category>
 
   <category name="org.springframework">

Added: rave/sandbox/content-services/rave-web-hmvc/src/test/resources/org/apache/rave/jcr/jackrabbit/repository.xml
URL: http://svn.apache.org/viewvc/rave/sandbox/content-services/rave-web-hmvc/src/test/resources/org/apache/rave/jcr/jackrabbit/repository.xml?rev=1379124&view=auto
==============================================================================
--- rave/sandbox/content-services/rave-web-hmvc/src/test/resources/org/apache/rave/jcr/jackrabbit/repository.xml (added)
+++ rave/sandbox/content-services/rave-web-hmvc/src/test/resources/org/apache/rave/jcr/jackrabbit/repository.xml Thu Aug 30 20:34:15 2012
@@ -0,0 +1,44 @@
+<?xml version="1.0"?>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements.  See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership.  The ASF licenses this file
+  to you 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.
+  -->
+<!DOCTYPE Repository PUBLIC "-//The Apache Software Foundation//DTD Jackrabbit 1.6//EN" "http://jackrabbit.apache.org/dtd/repository-1.6.dtd">
+<Repository>
+  <FileSystem class="org.apache.jackrabbit.core.fs.mem.MemoryFileSystem"/>
+
+  <DataStore class="org.apache.jackrabbit.core.data.FileDataStore"/>
+
+  <Security appName="Jackrabbit">
+    <SecurityManager class="org.apache.jackrabbit.core.security.simple.SimpleSecurityManager" workspaceName="security"/>
+    <AccessManager class="org.apache.jackrabbit.core.security.simple.SimpleAccessManager"/>
+    <LoginModule class="org.apache.jackrabbit.core.security.simple.SimpleLoginModule"/>
+  </Security>
+
+  <Workspaces rootPath="${rep.home}/workspaces" defaultWorkspace="default" maxIdleTime="2"/>
+
+  <Workspace name="${wsp.name}">
+    <FileSystem class="org.apache.jackrabbit.core.fs.mem.MemoryFileSystem"/>
+    <PersistenceManager class="org.apache.jackrabbit.core.persistence.mem.InMemBundlePersistenceManager"/>
+  </Workspace>
+
+  <Versioning rootPath="${rep.home}/version">
+    <FileSystem class="org.apache.jackrabbit.core.fs.mem.MemoryFileSystem"/>
+    <PersistenceManager class="org.apache.jackrabbit.core.persistence.mem.InMemBundlePersistenceManager"/>
+  </Versioning>
+
+</Repository>

Propchange: rave/sandbox/content-services/rave-web-hmvc/src/test/resources/org/apache/rave/jcr/jackrabbit/repository.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: rave/sandbox/content-services/rave-web-hmvc/src/test/resources/org/apache/rave/jcr/jackrabbit/repository.xml
------------------------------------------------------------------------------
    svn:keywords = Id

Added: rave/sandbox/content-services/rave-web-hmvc/src/test/resources/repositoryHelperPool.properties
URL: http://svn.apache.org/viewvc/rave/sandbox/content-services/rave-web-hmvc/src/test/resources/repositoryHelperPool.properties?rev=1379124&view=auto
==============================================================================
--- rave/sandbox/content-services/rave-web-hmvc/src/test/resources/repositoryHelperPool.properties (added)
+++ rave/sandbox/content-services/rave-web-hmvc/src/test/resources/repositoryHelperPool.properties Thu Aug 30 20:34:15 2012
@@ -0,0 +1,21 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you 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.
+#
+
+# first helper uses default values
+helper.0.=

Propchange: rave/sandbox/content-services/rave-web-hmvc/src/test/resources/repositoryHelperPool.properties
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: rave/sandbox/content-services/rave-web-hmvc/src/test/resources/repositoryHelperPool.properties
------------------------------------------------------------------------------
    svn:keywords = Id

Added: rave/sandbox/content-services/rave-web-hmvc/src/test/resources/repositoryStubImpl.properties
URL: http://svn.apache.org/viewvc/rave/sandbox/content-services/rave-web-hmvc/src/test/resources/repositoryStubImpl.properties?rev=1379124&view=auto
==============================================================================
--- rave/sandbox/content-services/rave-web-hmvc/src/test/resources/repositoryStubImpl.properties (added)
+++ rave/sandbox/content-services/rave-web-hmvc/src/test/resources/repositoryStubImpl.properties Thu Aug 30 20:34:15 2012
@@ -0,0 +1,17 @@
+#  Licensed to the Apache Software Foundation (ASF) under one or more
+#  contributor license agreements.  See the NOTICE file distributed with
+#  this work for additional information regarding copyright ownership.
+#  The ASF licenses this file to You 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.
+
+# Stub implementation class
+javax.jcr.tck.repository_stub_impl=org.apache.jackrabbit.core.JackrabbitRepositoryStub

Propchange: rave/sandbox/content-services/rave-web-hmvc/src/test/resources/repositoryStubImpl.properties
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: rave/sandbox/content-services/rave-web-hmvc/src/test/resources/repositoryStubImpl.properties
------------------------------------------------------------------------------
    svn:keywords = Id