Author: bcarothers
Date: 2009-05-28 08:57:37 -0400 (Thu, 28 May 2009)
New Revision: 941
Added:
trunk/extensions/dna-web-jcr-rest-war/
trunk/extensions/dna-web-jcr-rest-war/.classpath
trunk/extensions/dna-web-jcr-rest-war/.project
trunk/extensions/dna-web-jcr-rest-war/.settings/
trunk/extensions/dna-web-jcr-rest-war/.settings/.jsdtscope
trunk/extensions/dna-web-jcr-rest-war/.settings/org.eclipse.jdt.core.prefs
trunk/extensions/dna-web-jcr-rest-war/.settings/org.eclipse.wst.common.component
trunk/extensions/dna-web-jcr-rest-war/.settings/org.eclipse.wst.common.project.facet.core.xml
trunk/extensions/dna-web-jcr-rest-war/.settings/org.eclipse.wst.jsdt.ui.superType.container
trunk/extensions/dna-web-jcr-rest-war/.settings/org.eclipse.wst.jsdt.ui.superType.name
trunk/extensions/dna-web-jcr-rest-war/.settings/org.maven.ide.eclipse.prefs
trunk/extensions/dna-web-jcr-rest-war/pom.xml
trunk/extensions/dna-web-jcr-rest-war/src/
trunk/extensions/dna-web-jcr-rest-war/src/main/
trunk/extensions/dna-web-jcr-rest-war/src/main/webapp/
trunk/extensions/dna-web-jcr-rest-war/src/main/webapp/META-INF/
trunk/extensions/dna-web-jcr-rest-war/src/main/webapp/META-INF/MANIFEST.MF
trunk/extensions/dna-web-jcr-rest-war/src/main/webapp/WEB-INF/
trunk/extensions/dna-web-jcr-rest-war/src/main/webapp/WEB-INF/lib/
trunk/extensions/dna-web-jcr-rest-war/src/main/webapp/WEB-INF/web.xml
trunk/extensions/dna-web-jcr-rest-war/src/test/
trunk/extensions/dna-web-jcr-rest-war/src/test/java/
trunk/extensions/dna-web-jcr-rest-war/src/test/java/org/
trunk/extensions/dna-web-jcr-rest-war/src/test/java/org/jboss/
trunk/extensions/dna-web-jcr-rest-war/src/test/java/org/jboss/dna/
trunk/extensions/dna-web-jcr-rest-war/src/test/java/org/jboss/dna/web/
trunk/extensions/dna-web-jcr-rest-war/src/test/java/org/jboss/dna/web/jcr/
trunk/extensions/dna-web-jcr-rest/.settings/
trunk/extensions/dna-web-jcr-rest/.settings/org.eclipse.jdt.core.prefs
trunk/extensions/dna-web-jcr-rest/.settings/org.eclipse.wst.common.component
trunk/extensions/dna-web-jcr-rest/.settings/org.eclipse.wst.common.project.facet.core.xml
trunk/extensions/dna-web-jcr-rest/.settings/org.maven.ide.eclipse.prefs
trunk/extensions/dna-web-jcr-rest/src/main/java/org/jboss/dna/web/jcr/rest/DnaJcrDeployer.java
trunk/extensions/dna-web-jcr-rest/src/main/java/org/jboss/dna/web/jcr/rest/RepositoryFactory.java
trunk/extensions/dna-web-jcr-rest/src/main/java/org/jboss/dna/web/jcr/rest/model/
trunk/extensions/dna-web-jcr-rest/src/main/java/org/jboss/dna/web/jcr/rest/model/RepositoryEntry.java
trunk/extensions/dna-web-jcr-rest/src/main/java/org/jboss/dna/web/jcr/rest/model/RepositoryResources.java
trunk/extensions/dna-web-jcr-rest/src/main/java/org/jboss/dna/web/jcr/rest/model/WorkspaceEntry.java
trunk/extensions/dna-web-jcr-rest/src/main/java/org/jboss/dna/web/jcr/rest/model/WorkspaceResources.java
trunk/extensions/dna-web-jcr-rest/src/main/java/org/jboss/dna/web/jcr/rest/spi/
trunk/extensions/dna-web-jcr-rest/src/main/java/org/jboss/dna/web/jcr/rest/spi/DnaJcrRepositoryProvider.java
trunk/extensions/dna-web-jcr-rest/src/main/java/org/jboss/dna/web/jcr/rest/spi/RepositoryProvider.java
Removed:
trunk/extensions/dna-web-jcr-rest/src/main/resources/
trunk/extensions/dna-web-jcr-rest/src/test/java/
Modified:
trunk/dna-graph/src/main/java/org/jboss/dna/graph/ExecutionContext.java
trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/JcrEngine.java
trunk/extensions/dna-web-jcr-rest/.classpath
trunk/extensions/dna-web-jcr-rest/.project
trunk/extensions/dna-web-jcr-rest/pom.xml
trunk/extensions/dna-web-jcr-rest/src/main/java/org/jboss/dna/web/jcr/rest/JcrResources.java
trunk/extensions/dna-web-jcr-rest/src/main/webapp/WEB-INF/web.xml
Log:
DNA-312 Implement HTTP GET action for any resource at any path (folder or file)
Applied patch that provides GET, PUT, DELETE, and POST support for items as well as GET
support for workspaces and repositories. Further detail and documentation for the patch
is attached as a comment to DNA-312.
Modified: trunk/dna-graph/src/main/java/org/jboss/dna/graph/ExecutionContext.java
===================================================================
--- trunk/dna-graph/src/main/java/org/jboss/dna/graph/ExecutionContext.java 2009-05-28
02:13:55 UTC (rev 940)
+++ trunk/dna-graph/src/main/java/org/jboss/dna/graph/ExecutionContext.java 2009-05-28
12:57:37 UTC (rev 941)
@@ -42,6 +42,7 @@
import org.jboss.dna.common.component.StandardClassLoaderFactory;
import org.jboss.dna.common.util.CheckArg;
import org.jboss.dna.common.util.Logger;
+import org.jboss.dna.common.util.Reflection;
import org.jboss.dna.graph.connector.federation.FederatedLexicon;
import org.jboss.dna.graph.mimetype.ExtensionBasedMimeTypeDetector;
import org.jboss.dna.graph.mimetype.MimeTypeDetector;
@@ -528,6 +529,9 @@
* @see
javax.security.auth.callback.CallbackHandler#handle(javax.security.auth.callback.Callback[])
*/
public void handle( Callback[] callbacks ) throws UnsupportedCallbackException,
IOException {
+ boolean userSet = false;
+ boolean passwordSet = false;
+
for (int i = 0; i < callbacks.length; i++) {
if (callbacks[i] instanceof TextOutputCallback) {
@@ -563,6 +567,7 @@
}
nc.setName(this.userId);
+ userSet = true;
} else if (callbacks[i] instanceof PasswordCallback) {
@@ -573,9 +578,32 @@
System.out.flush();
}
pc.setPassword(this.password);
+ passwordSet = true;
} else {
- throw new UnsupportedCallbackException(callbacks[i],
"Unrecognized Callback");
+ /*
+ * Jetty uses its own callback for setting the password. Since
we're using Jetty for integration
+ * testing of the web project(s), we have to accomodate this. Rather
than introducing a direct
+ * dependency, we'll add code to handle the case of unexpected
callback handlers with a setObject method.
+ */
+ try {
+ // Assume that a callback chain will ask for the user before the
password
+ if (!userSet) {
+ new
Reflection(callbacks[i].getClass()).invokeSetterMethodOnTarget("object",
callbacks[i], this.userId);
+ userSet = true;
+ }
+ else if (!passwordSet) {
+ // Jetty also seems to eschew passing passwords as char
arrays
+ new
Reflection(callbacks[i].getClass()).invokeSetterMethodOnTarget("object",
callbacks[i], new String(this.password));
+ passwordSet = true;
+ }
+ // It worked - need to continue processing the callbacks
+ continue;
+ } catch (Exception ex) {
+ // If the property cannot be set, fall through to the failure
+ }
+ throw new UnsupportedCallbackException(callbacks[i],
"Unrecognized Callback: "
+ +
callbacks[i].getClass().getName());
}
}
Modified: trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/JcrEngine.java
===================================================================
--- trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/JcrEngine.java 2009-05-28 02:13:55 UTC
(rev 940)
+++ trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/JcrEngine.java 2009-05-28 12:57:37 UTC
(rev 941)
@@ -23,7 +23,10 @@
*/
package org.jboss.dna.jcr;
+import java.util.ArrayList;
+import java.util.Collection;
import java.util.HashMap;
+import java.util.List;
import java.util.Map;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.locks.Lock;
@@ -44,6 +47,7 @@
import org.jboss.dna.graph.property.Property;
import org.jboss.dna.jcr.JcrRepository.Option;
import org.jboss.dna.repository.DnaEngine;
+import org.jboss.dna.repository.RepositoryLibrary;
import org.jboss.dna.repository.RepositoryService;
import org.jboss.dna.repository.sequencer.SequencingService;
@@ -103,6 +107,24 @@
}
/**
+ * Returns a list of the names of all available JCR repositories.
+ * <p>
+ * In a {@code JcrEngine}, the available repositories are {@link
RepositoryLibrary#getSourceNames() all repositories} except
+ * for the {@link RepositoryService#getConfigurationSourceName() the configuration
repository}.
+ * </p>
+ *
+ * @return a list of all repository names.
+ */
+ public final Collection<String> getJcrRepositoryNames() {
+ List<String> jcrRepositories = new ArrayList<String>();
+
jcrRepositories.addAll(getRepositoryService().getRepositoryLibrary().getSourceNames());
+
+ jcrRepositories.remove(getRepositoryService().getConfigurationSourceName());
+
+ return jcrRepositories;
+ }
+
+ /**
* Get the {@link Repository} implementation for the named repository.
*
* @param repositoryName the name of the repository, which corresponds to the name of
a configured {@link RepositorySource}
Modified: trunk/extensions/dna-web-jcr-rest/.classpath
===================================================================
--- trunk/extensions/dna-web-jcr-rest/.classpath 2009-05-28 02:13:55 UTC (rev 940)
+++ trunk/extensions/dna-web-jcr-rest/.classpath 2009-05-28 12:57:37 UTC (rev 941)
@@ -1,9 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
- <classpathentry kind="src" path="src/main/java"/>
- <classpathentry kind="src" path="src/main/resources"/>
- <classpathentry kind="src" path="src/test/java"/>
- <classpathentry kind="con"
path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+ <classpathentry kind="src" output="target/classes"
path="src/main/java"/>
<classpathentry kind="con"
path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>
+ <classpathentry kind="con"
path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+ <classpathentry kind="con"
path="org.eclipse.jst.j2ee.internal.module.container"/>
<classpathentry kind="output" path="target/classes"/>
</classpath>
Modified: trunk/extensions/dna-web-jcr-rest/.project
===================================================================
--- trunk/extensions/dna-web-jcr-rest/.project 2009-05-28 02:13:55 UTC (rev 940)
+++ trunk/extensions/dna-web-jcr-rest/.project 2009-05-28 12:57:37 UTC (rev 941)
@@ -1,23 +1,36 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>dna-web-jcr-rest</name>
- <comment></comment>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.jdt.core.javabuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.maven.ide.eclipse.maven2Builder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.jdt.core.javanature</nature>
- <nature>org.maven.ide.eclipse.maven2Nature</nature>
- </natures>
-</projectDescription>
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>dna-web-jcr-rest</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.wst.common.project.facet.core.builder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.maven.ide.eclipse.maven2Builder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.wst.validation.validationbuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.jem.workbench.JavaEMFNature</nature>
+ <nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ <nature>org.maven.ide.eclipse.maven2Nature</nature>
+ <nature>org.eclipse.wst.common.project.facet.core.nature</nature>
+ </natures>
+</projectDescription>
Added: trunk/extensions/dna-web-jcr-rest/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- trunk/extensions/dna-web-jcr-rest/.settings/org.eclipse.jdt.core.prefs
(rev 0)
+++ trunk/extensions/dna-web-jcr-rest/.settings/org.eclipse.jdt.core.prefs 2009-05-28
12:57:37 UTC (rev 941)
@@ -0,0 +1,7 @@
+#Wed May 27 16:41:15 EDT 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.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.5
Added: trunk/extensions/dna-web-jcr-rest/.settings/org.eclipse.wst.common.component
===================================================================
--- trunk/extensions/dna-web-jcr-rest/.settings/org.eclipse.wst.common.component
(rev 0)
+++
trunk/extensions/dna-web-jcr-rest/.settings/org.eclipse.wst.common.component 2009-05-28
12:57:37 UTC (rev 941)
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project-modules id="moduleCoreId" project-version="1.5.0">
+ <wb-module deploy-name="dna-web-jcr-rest">
+ <wb-resource deploy-path="/"
source-path="/src/main/java"/>
+ <wb-resource deploy-path="/"
source-path="/src/main/resources"/>
+ <wb-resource deploy-path="/"
source-path="/src/test/java"/>
+ <wb-resource deploy-path="/"
source-path="/src/test/resources"/>
+ </wb-module>
+</project-modules>
Added:
trunk/extensions/dna-web-jcr-rest/.settings/org.eclipse.wst.common.project.facet.core.xml
===================================================================
---
trunk/extensions/dna-web-jcr-rest/.settings/org.eclipse.wst.common.project.facet.core.xml
(rev 0)
+++
trunk/extensions/dna-web-jcr-rest/.settings/org.eclipse.wst.common.project.facet.core.xml 2009-05-28
12:57:37 UTC (rev 941)
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<faceted-project>
+ <installed facet="jst.java" version="5.0"/>
+ <installed facet="jst.utility" version="1.0"/>
+</faceted-project>
Property changes on:
trunk/extensions/dna-web-jcr-rest/.settings/org.eclipse.wst.common.project.facet.core.xml
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: trunk/extensions/dna-web-jcr-rest/.settings/org.maven.ide.eclipse.prefs
===================================================================
--- trunk/extensions/dna-web-jcr-rest/.settings/org.maven.ide.eclipse.prefs
(rev 0)
+++ trunk/extensions/dna-web-jcr-rest/.settings/org.maven.ide.eclipse.prefs 2009-05-28
12:57:37 UTC (rev 941)
@@ -0,0 +1,9 @@
+#Wed May 27 16:24:52 EDT 2009
+activeProfiles=
+eclipse.preferences.version=1
+fullBuildGoals=process-test-resources
+includeModules=false
+resolveWorkspaceProjects=true
+resourceFilterGoals=process-resources resources\:testResources
+skipCompilerPlugin=true
+version=1
Modified: trunk/extensions/dna-web-jcr-rest/pom.xml
===================================================================
--- trunk/extensions/dna-web-jcr-rest/pom.xml 2009-05-28 02:13:55 UTC (rev 940)
+++ trunk/extensions/dna-web-jcr-rest/pom.xml 2009-05-28 12:57:37 UTC (rev 941)
@@ -7,9 +7,8 @@
<version>0.5-SNAPSHOT</version>
<relativePath>../..</relativePath>
</parent>
- <groupId>org.jboss.dna</groupId>
<artifactId>dna-web-jcr-rest</artifactId>
- <packaging>war</packaging>
+ <packaging>jar</packaging>
<name>JBoss DNA JCR REST Servlet</name>
<description>JBoss DNA servlet that provides RESTful access to JCR
items</description>
<
url>http://labs.jboss.org/dna</url>
@@ -19,7 +18,26 @@
<artifactId>resteasy-jaxrs</artifactId>
<version>1.1-RC2</version>
</dependency>
+ <dependency>
+ <groupId>org.jboss.resteasy</groupId>
+ <artifactId>resteasy-jaxb-provider</artifactId>
+ <version>1.1-RC2</version>
+ <!--
+ <scope>runtime, integration-test</scope>
+ -->
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.dna</groupId>
+ <artifactId>dna-jcr</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-log4j12</artifactId>
+ <version>1.4.3</version>
+ <scope>runtime</scope>
+ </dependency>
<!--
Java Content Repository API
-->
@@ -42,57 +60,10 @@
<scope>integration-test</scope>
</dependency>
+ <dependency>
+ <groupId>javax.xml.bind</groupId>
+ <artifactId>jaxb-api</artifactId>
+ <version>2.1</version>
+ </dependency>
</dependencies>
- <build>
- <finalName>resources</finalName>
- <plugins>
- <plugin>
- <groupId>org.codehaus.cargo</groupId>
- <artifactId>cargo-maven2-plugin</artifactId>
- <executions>
- <execution>
- <id>start-container</id>
- <phase>pre-integration-test</phase>
- <goals>
- <goal>start</goal>
- </goals>
- </execution>
- <execution>
- <id>stop-container</id>
- <phase>post-integration-test</phase>
- <goals>
- <goal>stop</goal>
- </goals>
- </execution>
- </executions>
- <configuration>
- <wait>false</wait>
- </configuration>
- </plugin>
- <!--
- Override the default Surefire behavior to run during
- integration-test phase
- -->
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-surefire-plugin</artifactId>
- <configuration>
- <skip>true</skip>
- </configuration>
- <executions>
- <execution>
- <id>surefire-it</id>
- <phase>integration-test</phase>
- <goals>
- <goal>test</goal>
- </goals>
- <configuration>
- <skip>false</skip>
- </configuration>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
-
</project>
Added:
trunk/extensions/dna-web-jcr-rest/src/main/java/org/jboss/dna/web/jcr/rest/DnaJcrDeployer.java
===================================================================
---
trunk/extensions/dna-web-jcr-rest/src/main/java/org/jboss/dna/web/jcr/rest/DnaJcrDeployer.java
(rev 0)
+++
trunk/extensions/dna-web-jcr-rest/src/main/java/org/jboss/dna/web/jcr/rest/DnaJcrDeployer.java 2009-05-28
12:57:37 UTC (rev 941)
@@ -0,0 +1,25 @@
+package org.jboss.dna.web.jcr.rest;
+import javax.servlet.ServletContextEvent;
+import javax.servlet.ServletContextListener;
+
+
+
+public class DnaJcrDeployer implements ServletContextListener {
+
+ public static final String DEFAULT_JNDI_NAME =
"java:comp/env/org/jboss/dna/Engine";
+
+ public static final String SYSTEM_PROPERTY_JNDI_NAME =
"org.jboss.dna.dnaEngineJndiName";
+
+ public static final String INIT_PARAMETER_JNDI_NAME =
"org.jboss.dna.dnaEngineJndiName";
+
+ public void contextDestroyed( ServletContextEvent event ) {
+ RepositoryFactory.shutdown();
+ }
+
+ /**
+ * Mounts a DNA engine
+ */
+ public void contextInitialized( ServletContextEvent event ) {
+ RepositoryFactory.initialize(event.getServletContext());
+ }
+}
Property changes on:
trunk/extensions/dna-web-jcr-rest/src/main/java/org/jboss/dna/web/jcr/rest/DnaJcrDeployer.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified:
trunk/extensions/dna-web-jcr-rest/src/main/java/org/jboss/dna/web/jcr/rest/JcrResources.java
===================================================================
---
trunk/extensions/dna-web-jcr-rest/src/main/java/org/jboss/dna/web/jcr/rest/JcrResources.java 2009-05-28
02:13:55 UTC (rev 940)
+++
trunk/extensions/dna-web-jcr-rest/src/main/java/org/jboss/dna/web/jcr/rest/JcrResources.java 2009-05-28
12:57:37 UTC (rev 941)
@@ -23,9 +23,49 @@
*/
package org.jboss.dna.web.jcr.rest;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import javax.jcr.Credentials;
+import javax.jcr.Item;
+import javax.jcr.Node;
+import javax.jcr.NodeIterator;
+import javax.jcr.PathNotFoundException;
+import javax.jcr.Property;
+import javax.jcr.PropertyIterator;
+import javax.jcr.Repository;
+import javax.jcr.RepositoryException;
+import javax.jcr.Session;
+import javax.jcr.SimpleCredentials;
+import javax.jcr.Value;
+import javax.jcr.nodetype.PropertyDefinition;
+import javax.servlet.http.HttpServletRequest;
+import javax.ws.rs.Consumes;
+import javax.ws.rs.DELETE;
+import javax.ws.rs.DefaultValue;
import javax.ws.rs.GET;
+import javax.ws.rs.POST;
+import javax.ws.rs.PUT;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+import javax.ws.rs.QueryParam;
+import javax.ws.rs.core.Context;
+import javax.ws.rs.core.Response;
+import javax.ws.rs.core.Response.Status;
+import javax.ws.rs.ext.ExceptionMapper;
+import javax.ws.rs.ext.Provider;
+import org.codehaus.jettison.json.JSONArray;
+import org.codehaus.jettison.json.JSONException;
+import org.codehaus.jettison.json.JSONObject;
+import org.jboss.dna.common.text.UrlEncoder;
+import org.jboss.dna.web.jcr.rest.model.RepositoryEntry;
+import org.jboss.dna.web.jcr.rest.model.WorkspaceEntry;
+import org.jboss.resteasy.spi.NotFoundException;
+import org.jboss.resteasy.spi.UnauthorizedException;
/**
* RESTEasy handler to provide the JCR resources at the URIs below. Please note that
these URIs assume a context of {@code
@@ -42,45 +82,23 @@
* <td>GET</td>
* </tr>
* <tr>
- * <td>/resources/repositories</td>
- * <td>returns a list of accessible repositories</td>
- * <td>GET</td>
- * </tr>
- * <tr>
* <td>/resources/{repositoryName}</td>
* <td>returns a list of accessible workspaces within that repository</td>
* <td>GET</td>
* </tr>
* <tr>
- * <td>/resources/{repositoryName}/workspaces</td>
- * <td>returns a list of accessible workspaces within that repository</td>
- * <td>GET</td>
- * </tr>
- * <tr>
* <td>/resources/{repositoryName}/{workspaceName}</td>
* <td>returns a list of operations within the workspace</td>
* <td>GET</td>
* </tr>
* <tr>
* <td>/resources/{repositoryName}/{workspaceName}/item/{path}</td>
- * <td>accesses the node at the path</td>
+ * <td>accesses the item (node or property) at the path</td>
* <td>ALL</td>
* </tr>
- * <tr>
- *
<td>/resources/{repositoryName}/{workspaceName}/item/{path}/@{propertyName}</td>
- * <td>accesses the named property at the path</td>
- * <td>ALL (except PUT)</td>
- * </tr>
- * <tr>
- *
<td>/resources/{repositoryName}/{workspaceName}/item/{path}/@{propertyName}</td>
- * <td>adds the value from the body to the named property at the path</td>
- * <td>PUT</td>
- * </tr>
- * <tr>
- * <td>/resources/{repositoryName}/{workspaceName}/uuid/{uuid}</td>
+ * <td>/resources/{repositoryName}/{workspaceName}/node/{uuid}</td>
* <td>accesses the node with the given UUID</td>
- * <td>ALL</td>
- * </tr>
+ * <td>ALL</td> </tr>
* <tr>
* <td>/resources/{repositoryName}/{workspaceName}/lock/{path}</td>
* <td>locks the node at the path</td>
@@ -96,25 +114,543 @@
@Path( "/" )
public class JcrResources {
+ private static final UrlEncoder URL_ENCODER = new UrlEncoder();
+
+ private static final String PROPERTIES_HOLDER = "properties";
+ private static final String CHILD_NODE_HOLDER = "children";
+
+ private static final String PRIMARY_TYPE_PROPERTY = "jcr:primaryType";
+ private static final String MIXIN_TYPES_PROPERTY = "jcr:mixinTypes";
+
+ /** Name to be used when the repository name is empty string as {@code
"//"} is not a valid path. */
+ public static final String EMPTY_REPOSITORY_NAME = "<default>";
+ /** Name to be used when the workspace name is empty string as {@code "//"}
is not a valid path. */
+ public static final String EMPTY_WORKSPACE_NAME = "<default>";
+
/**
+ * Returns a reference to the named repository, if it exists.
+ *
+ * @param repositoryName the name of the repository to load
+ * @return the repository
+ * @throws RepositoryException if any other error occurs
+ */
+ private Repository getRepository( String repositoryName ) throws RepositoryException
{
+ return RepositoryFactory.getRepository(repositoryName);
+ }
+
+ /**
+ * Returns an active session for the given workspace name in the named repository.
+ *
+ * @param rawRepositoryName the URL-encoded name of the repository in which the
session is created
+ * @param rawWorkspaceName the URL-endecoded name of the workspace to which the
session should be connected
+ * @return an active session with the given workspace in the named repository
+ * @throws RepositoryException if any other error occurs
+ */
+ private Session getSession( String rawRepositoryName,
+ String rawWorkspaceName ) throws NotFoundException,
RepositoryException {
+
+ Repository repository;
+ try {
+ repository = getRepository(repositoryNameFor(rawRepositoryName));
+ } catch (RepositoryException re) {
+ throw new NotFoundException(re.getMessage(), re);
+ }
+
+ Credentials credentials = new SimpleCredentials("dnauser",
"password".toCharArray());
+
+ return repository.login(credentials, workspaceNameFor(rawWorkspaceName));
+ }
+
+ /**
* Returns the list of JCR repositories available on this server
+ *
+ * @param request the servlet request; may not be null
* @return the list of JCR repositories available on this server
*/
@GET
- @Path( "/repositories" )
- public String repositories() {
- return "Hello, DNA!";
+ @Path( "/" )
+ @Produces( "application/json" )
+ public Map<String, RepositoryEntry> getRepositories( @Context
HttpServletRequest request ) {
+ assert request != null;
+
+ Map<String, RepositoryEntry> repositories = new HashMap<String,
RepositoryEntry>();
+
+ for (String name : RepositoryFactory.getJcrRepositoryNames()) {
+ if (name.trim().length() == 0) {
+ name = EMPTY_REPOSITORY_NAME;
+ }
+ name = URL_ENCODER.encode(name);
+ repositories.put(name, new RepositoryEntry(request.getContextPath(), name));
+ }
+
+ return repositories;
}
/**
* Returns the list of workspaces available to this user within the named
repository.
- * @param repositoryName the name of the repository
+ *
+ * @param rawRepositoryName the name of the repository; may not be null
+ * @param request the servlet request; may not be null
* @return the list of workspaces available to this user within the named
repository.
+ * @throws IOException if the given repository name does not map to any repositories
and there is an error writing the error
+ * code to the response.
+ * @throws RepositoryException if there is any other error accessing the list of
available workspaces for the repository
*/
@GET
- @Path( "/{repositoryName}/workspaces" )
- public String workspaces( @PathParam( "repositoryName" ) String
repositoryName ) {
+ @Path( "/{repositoryName}" )
+ @Produces( "application/json" )
+ public Map<String, WorkspaceEntry> getWorkspaces( @Context HttpServletRequest
request,
+ @PathParam(
"repositoryName" ) String rawRepositoryName )
+ throws RepositoryException, IOException {
+
+ assert request != null;
+ assert rawRepositoryName != null;
+
+ Map<String, WorkspaceEntry> workspaces = new HashMap<String,
WorkspaceEntry>();
+
+ Session session = getSession(rawRepositoryName, null);
+ rawRepositoryName = URL_ENCODER.encode(rawRepositoryName);
+
+ for (String name : session.getWorkspace().getAccessibleWorkspaceNames()) {
+ if (name.trim().length() == 0) {
+ name = EMPTY_WORKSPACE_NAME;
+ }
+ name = URL_ENCODER.encode(name);
+ workspaces.put(name, new WorkspaceEntry(request.getContextPath(),
rawRepositoryName, name));
+ }
+
+ return workspaces;
+ }
+
+ /**
+ * Handles GET requests for an item in a workspace.
+ *
+ * @param rawRepositoryName the URL-encoded repository name
+ * @param rawWorkspaceName the URL-encoded workspace name
+ * @param path the path to the item
+ * @param depth the depth of the node graph that should be returned if {@code path}
refers to a node. @{code 0} means return
+ * the requested node only. A negative value indicates that the full subgraph
under the node should be returned. This
+ * parameter defaults to {@code 0} and is ignored if {@code path} refers to a
property.
+ * @return the JSON-encoded version of the item (and, if the item is a node, its
subgraph, depending on the value of {@code
+ * depth})
+ * @throws NotFoundException if the named repository does not exists, the named
workspace does not exist, or the user does not
+ * have access to the named workspace
+ * @throws JSONException if there is an error encoding the node
+ * @throws UnauthorizedException if the given login information is invalid
+ * @throws RepositoryException if any other error occurs
+ * @see #EMPTY_REPOSITORY_NAME
+ * @see #EMPTY_WORKSPACE_NAME
+ * @see Session#getItem(String)
+ */
+ @GET
+ @Path( "/{repositoryName}/{workspaceName}/items{path:.*}" )
+ @Produces( "application/json" )
+ public String getItem( @PathParam( "repositoryName" ) String
rawRepositoryName,
+ @PathParam( "workspaceName" ) String
rawWorkspaceName,
+ @PathParam( "path" ) String path,
+ @QueryParam( "dna:depth" ) @DefaultValue(
"0" ) int depth )
+ throws JSONException, UnauthorizedException, RepositoryException {
+ assert path != null;
+ assert rawRepositoryName != null;
+ assert rawWorkspaceName != null;
+
+ Session session = getSession(rawRepositoryName, rawWorkspaceName);
+ Item item;
+
+ if ("/".equals(path) || "".equals(path)) {
+ item = session.getRootNode();
+ } else {
+ try {
+ item = session.getItem(path);
+ } catch (PathNotFoundException pnfe) {
+ throw new NotFoundException(pnfe.getMessage(), pnfe);
+ }
+ }
+
+ if (item instanceof Node) {
+ return jsonFor((Node)item, depth).toString();
+ }
+ return jsonFor((Property)item);
+ }
+
+ /**
+ * Returns the JSON-encoded version of the given property. If the property is
single-valued, the returned string is {@code
+ * property.getValue().getString()} encoded as a JSON string. If the property is
multi-valued with {@code N} values, this
+ * method returns a JSON array containing {@code property.getValues()[N].getString()}
for all values of {@code N}.
+ *
+ * @param property the property to be encoded
+ * @return the JSON-encoded version of the property
+ * @throws RepositoryException if an error occurs accessing the property, its values,
or its definition.
+ * @see Property#getDefinition()
+ * @see PropertyDefinition#isMultiple()
+ */
+ private String jsonFor( Property property ) throws RepositoryException {
+ if (property.getDefinition().isMultiple()) {
+ Value[] values = property.getValues();
+ List<String> list = new ArrayList<String>(values.length);
+ for (int i = 0; i < values.length; i++) {
+ list.add(values[i].getString());
+ }
+ return new JSONArray(list).toString();
+ }
+ return JSONObject.quote(property.getValue().getString());
+ }
+
+ /**
+ * Recursively returns the JSON-encoding of a node and its children to depth {@code
toDepth}.
+ *
+ * @param node the node to be encoded
+ * @param toDepth the depth to which the recursion should extend; {@code 0} means no
further recursion should occur.
+ * @return the JSON-encoding of a node and its children to depth {@code toDepth}.
+ * @throws JSONException if there is an error encoding the node
+ * @throws RepositoryException if any other error occurs
+ */
+ private JSONObject jsonFor( Node node,
+ int toDepth ) throws JSONException, RepositoryException
{
+ JSONObject jsonNode = new JSONObject();
+
+ JSONObject properties = new JSONObject();
+
+ for (PropertyIterator iter = node.getProperties(); iter.hasNext();) {
+ Property prop = iter.nextProperty();
+ String propName = prop.getName();
+
+ if (prop.getDefinition().isMultiple()) {
+ Value[] values = prop.getValues();
+ JSONArray array = new JSONArray();
+ for (int i = 0; i < values.length; i++) {
+ array.put(values[i].getString());
+ }
+ properties.put(propName, array);
+
+ } else {
+ properties.put(propName, prop.getValue().getString());
+ }
+
+ }
+ if (properties.length() > 0) {
+ jsonNode.put(PROPERTIES_HOLDER, properties);
+ }
+
+ if (toDepth == 0) {
+ List<String> children = new ArrayList<String>();
+
+ for (NodeIterator iter = node.getNodes(); iter.hasNext();) {
+ Node child = iter.nextNode();
+
+ children.add(child.getName());
+ }
+
+ if (children.size() > 0) {
+ jsonNode.put(CHILD_NODE_HOLDER, new JSONArray(children));
+ }
+ } else {
+ JSONObject children = new JSONObject();
+
+ for (NodeIterator iter = node.getNodes(); iter.hasNext();) {
+ Node child = iter.nextNode();
+
+ children.put(child.getName(), jsonFor(child, toDepth - 1));
+ }
+
+ if (children.length() > 0) {
+ jsonNode.put(CHILD_NODE_HOLDER, children);
+ }
+ }
+
+ return jsonNode;
+ }
+
+ /**
+ * Adds the content of the request as a node (or subtree of nodes) at the location
specified by {@code path}.
+ * <p>
+ * The primary type and mixin type(s) may optionally be specified through the {@code
jcr:primaryType} and {@code
+ * jcr:mixinTypes} properties.
+ * </p>
+ *
+ * @param rawRepositoryName the URL-encoded repository name
+ * @param rawWorkspaceName the URL-encoded workspace name
+ * @param path the path to the item
+ * @param requestContent the JSON-encoded representation of the node or nodes to be
added
+ * @return the JSON-encoded representation of the node or nodes that were added. This
will differ from {@code requestContent}
+ * in that auto-created and protected properties (e.g., jcr:uuid) will be
populated.
+ * @throws NotFoundException if the parent of the item to be added does not exist
+ * @throws UnauthorizedException if the user does not have the access required to
create the node at this path
+ * @throws JSONException if there is an error encoding the node
+ * @throws RepositoryException if any other error occurs
+ */
+ @POST
+ @Path( "/{repositoryName}/{workspaceName}/items/{path:.*}" )
+ @Consumes( "application/json" )
+ public Response postItem( @PathParam( "repositoryName" ) String
rawRepositoryName,
+ @PathParam( "workspaceName" ) String
rawWorkspaceName,
+ @PathParam( "path" ) String path,
+ String requestContent )
+ throws NotFoundException, UnauthorizedException, RepositoryException,
JSONException {
+
+ assert rawRepositoryName != null;
+ assert rawWorkspaceName != null;
+ assert path != null;
+ JSONObject body = new JSONObject(requestContent);
+
+ int lastSlashInd = path.lastIndexOf('/');
+ String parentPath = lastSlashInd == -1 ? "/" : "/" +
path.substring(0, lastSlashInd);
+ String newNodeName = lastSlashInd == -1 ? path : path.substring(lastSlashInd +
1);
+
+ Session session = getSession(rawRepositoryName, rawWorkspaceName);
+
+ Node parentNode = (Node)session.getItem(parentPath);
+
+ Node newNode = addNode(parentNode, newNodeName, body);
+
+ session.save();
+
+ String json = jsonFor(newNode, -1).toString();
+ return Response.status(Status.CREATED).entity(json).build();
+ }
+
+ /**
+ * Adds the node described by {@code jsonNode} with name {@code nodeName} to the
existing node {@code parentNode}.
+ *
+ * @param parentNode the parent of the node to be added
+ * @param nodeName the name of the node to be added
+ * @param jsonNode the JSON-encoded representation of the node or nodes to be added.
+ * @return the JSON-encoded representation of the node or nodes that were added. This
will differ from {@code requestContent}
+ * in that auto-created and protected properties (e.g., jcr:uuid) will be
populated.
+ * @throws JSONException if there is an error encoding the node
+ * @throws RepositoryException if any other error occurs
+ */
+ private Node addNode( Node parentNode,
+ String nodeName,
+ JSONObject jsonNode ) throws RepositoryException, JSONException
{
+ Node newNode;
+
+ JSONObject properties = jsonNode.has(PROPERTIES_HOLDER) ?
jsonNode.getJSONObject(PROPERTIES_HOLDER) : new JSONObject();
+
+ if (properties.has(PRIMARY_TYPE_PROPERTY)) {
+ String primaryType = properties.getString(PRIMARY_TYPE_PROPERTY);
+ newNode = parentNode.addNode(nodeName, primaryType);
+ } else {
+ newNode = parentNode.addNode(nodeName);
+ }
+
+ if (properties.has(MIXIN_TYPES_PROPERTY)) {
+ Object rawMixinTypes = properties.get(MIXIN_TYPES_PROPERTY);
+
+ if (rawMixinTypes instanceof JSONArray) {
+ JSONArray mixinTypes = (JSONArray)rawMixinTypes;
+ for (int i = 0; i < mixinTypes.length(); i++) {
+ newNode.addMixin(mixinTypes.getString(i));
+ }
+
+ } else {
+ newNode.addMixin(rawMixinTypes.toString());
+
+ }
+ }
+
+ for (Iterator<?> iter = properties.keys(); iter.hasNext();) {
+ String key = (String)iter.next();
+
+ if (PRIMARY_TYPE_PROPERTY.equals(key)) continue;
+ if (MIXIN_TYPES_PROPERTY.equals(key)) continue;
+ setPropertyOnNode(newNode, key, properties.get(key));
+ }
+
+ if (jsonNode.has(CHILD_NODE_HOLDER)) {
+ JSONObject children = jsonNode.getJSONObject(CHILD_NODE_HOLDER);
+
+ for (Iterator<?> iter = children.keys(); iter.hasNext();) {
+ String childName = (String)iter.next();
+ JSONObject child = children.getJSONObject(childName);
+
+ addNode(newNode, childName, child);
+ }
+ }
+
+ return newNode;
+ }
+
+ /**
+ * Sets the named property on the given node. This method expects {@code value} to be
either a JSON string or a JSON array of
+ * JSON strings. If {@code value} is a JSON array, {@code Node#setProperty(String,
String[]) the multi-valued property setter}
+ * will be used.
+ *
+ * @param node the node on which the property is to be set
+ * @param propName the name of the property to set
+ * @param value the JSON-encoded values to be set
+ * @throws RepositoryException if there is an error setting the property
+ * @throws JSONException if {@code value} cannot be decoded
+ */
+ private void setPropertyOnNode( Node node,
+ String propName,
+ Object value ) throws RepositoryException,
JSONException {
+ if (value instanceof JSONArray) {
+ JSONArray jsonValues = (JSONArray)value;
+ String[] values = new String[jsonValues.length()];
+
+ for (int i = 0; i < values.length; i++) {
+ values[i] = jsonValues.getString(i);
+ }
+ node.setProperty(propName, values);
+ } else {
+ node.setProperty(propName, (String)value);
+ }
+
+ }
+
+ /**
+ * Deletes the item at {@code path}.
+ *
+ * @param rawRepositoryName the URL-encoded repository name
+ * @param rawWorkspaceName the URL-encoded workspace name
+ * @param path the path to the item
+ * @throws NotFoundException if no item exists at {@code path}
+ * @throws UnauthorizedException if the user does not have the access required to
delete the item at this path
+ * @throws RepositoryException if any other error occurs
+ */
+ @DELETE
+ @Path( "/{repositoryName}/{workspaceName}/items{path:.*}" )
+ @Consumes( "application/json" )
+ public void deleteItem( @PathParam( "repositoryName" ) String
rawRepositoryName,
+ @PathParam( "workspaceName" ) String
rawWorkspaceName,
+ @PathParam( "path" ) String path )
+ throws NotFoundException, UnauthorizedException, RepositoryException {
+
+ assert rawRepositoryName != null;
+ assert rawWorkspaceName != null;
+ assert path != null;
+
+ Session session = getSession(rawRepositoryName, rawWorkspaceName);
+
+ Item item;
+ try {
+ item = session.getItem(path);
+ } catch (PathNotFoundException pnfe) {
+ throw new NotFoundException(pnfe.getMessage(), pnfe);
+ }
+ item.remove();
+ session.save();
+ }
+
+ /**
+ * Updates the properties at the path.
+ * <p>
+ * If path points to a property, this method expects the request content to be either
a JSON array or a JSON string. The array
+ * or string will become the values or value of the property. If path points to a
node, this method expects the request
+ * content to be a JSON object. The keys of the objects correspond to property names
that will be set and the values for the
+ * keys correspond to the values that will be set on the properties.
+ * </p>
+ *
+ * @param rawRepositoryName the URL-encoded repository name
+ * @param rawWorkspaceName the URL-encoded workspace name
+ * @param path the path to the item
+ * @param requestContent the JSON-encoded representation of the values and, possibly,
properties to be set
+ * @return the JSON-encoded representation of the node on which the property or
properties were set.
+ * @throws NotFoundException if the parent of the item to be added does not exist
+ * @throws UnauthorizedException if the user does not have the access required to
create the node at this path
+ * @throws JSONException if there is an error encoding the node
+ * @throws RepositoryException if any other error occurs
+ */
+ @PUT
+ @Path( "/{repositoryName}/{workspaceName}/items{path:.*}" )
+ @Consumes( "application/json" )
+ public String putItem( @PathParam( "repositoryName" ) String
rawRepositoryName,
+ @PathParam( "workspaceName" ) String
rawWorkspaceName,
+ @PathParam( "path" ) String path,
+ String requestContent ) throws UnauthorizedException,
JSONException, RepositoryException {
+
+ assert path != null;
+ assert rawRepositoryName != null;
+ assert rawWorkspaceName != null;
+
+ Session session = getSession(rawRepositoryName, rawWorkspaceName);
+ Node node;
+ Item item;
+ if ("".equals(path) || "/".equals(path)) {
+ item = session.getRootNode();
+ } else {
+ try {
+ item = session.getItem(path);
+ } catch (PathNotFoundException pnfe) {
+ throw new NotFoundException(pnfe.getMessage(), pnfe);
+ }
+ }
+
+ if (item instanceof Node) {
+ JSONObject properties = new JSONObject(requestContent);
+ node = (Node)item;
+
+ for (Iterator<?> iter = properties.keys(); iter.hasNext();) {
+ String key = (String)iter.next();
+
+ setPropertyOnNode(node, key, properties.get(key));
+ }
+
+ } else {
+ /*
+ * The incoming content should be a JSON string or a JSON array. Wrap it into
an object so it can be parsed more easily
+ */
+
+ JSONObject properties = new JSONObject("{ \"value\": " +
requestContent + "}");
+ Property property = (Property)item;
+ node = property.getParent();
+
+ setPropertyOnNode(node, property.getName(),
properties.get("value"));
+ }
+
+ return jsonFor(node, 0).toString();
+ }
+
+ private String workspaceNameFor( String rawWorkspaceName ) {
+ String workspaceName = URL_ENCODER.decode(rawWorkspaceName);
+
+ if (EMPTY_WORKSPACE_NAME.equals(workspaceName)) {
+ workspaceName = "";
+ }
+
+ return workspaceName;
+ }
+
+ private String repositoryNameFor( String rawRepositoryName ) {
+ String repositoryName = URL_ENCODER.decode(rawRepositoryName);
+
+ if (EMPTY_REPOSITORY_NAME.equals(repositoryName)) {
+ repositoryName = "";
+ }
+
return repositoryName;
}
+ @Provider
+ public static class NotFoundExceptionMapper implements
ExceptionMapper<NotFoundException> {
+
+ public Response toResponse( NotFoundException exception ) {
+ return
Response.status(Status.NOT_FOUND).entity(exception.getMessage()).build();
+ }
+
+ }
+
+ @Provider
+ public static class JSONExceptionMapper implements
ExceptionMapper<JSONException> {
+
+ public Response toResponse( JSONException exception ) {
+ return
Response.status(Status.BAD_REQUEST).entity(exception.getMessage()).build();
+ }
+
+ }
+
+ @Provider
+ public static class RepositoryExceptionMapper implements
ExceptionMapper<RepositoryException> {
+
+ public Response toResponse( RepositoryException exception ) {
+ /*
+ * This error code is murky - the request must have been syntactically valid
to get to
+ * the JCR operations, but there isn't an HTTP status code for
"semantically invalid."
+ */
+ return
Response.status(Status.BAD_REQUEST).entity(exception.getMessage()).build();
+ }
+
+ }
+
}
Added:
trunk/extensions/dna-web-jcr-rest/src/main/java/org/jboss/dna/web/jcr/rest/RepositoryFactory.java
===================================================================
---
trunk/extensions/dna-web-jcr-rest/src/main/java/org/jboss/dna/web/jcr/rest/RepositoryFactory.java
(rev 0)
+++
trunk/extensions/dna-web-jcr-rest/src/main/java/org/jboss/dna/web/jcr/rest/RepositoryFactory.java 2009-05-28
12:57:37 UTC (rev 941)
@@ -0,0 +1,41 @@
+package org.jboss.dna.web.jcr.rest;
+
+import java.util.Collection;
+import javax.jcr.Repository;
+import javax.jcr.RepositoryException;
+import javax.servlet.ServletContext;
+import org.jboss.dna.web.jcr.rest.spi.RepositoryProvider;
+
+public class RepositoryFactory {
+
+ public static final String PROVIDER_KEY =
"org.jboss.dna.web.jcr.rest.REPOSITORY_PROVIDER";
+
+ private static RepositoryProvider provider;
+
+ private RepositoryFactory() {
+
+ }
+
+ static void initialize( ServletContext context ) {
+ String className = context.getInitParameter(PROVIDER_KEY);
+
+ try {
+ Class<? extends RepositoryProvider> providerClass =
Class.forName(className).asSubclass(RepositoryProvider.class);
+ provider = providerClass.newInstance();
+ } catch (Exception ex) {
+ throw new IllegalStateException(ex);
+ }
+ }
+
+ public static Repository getRepository( String repositoryName ) throws
RepositoryException {
+ return provider.getRepository(repositoryName);
+ }
+
+ public static Collection<String> getJcrRepositoryNames() {
+ return provider.getJcrRepositoryNames();
+ }
+
+ static void shutdown() {
+ provider.shutdown();
+ }
+}
Property changes on:
trunk/extensions/dna-web-jcr-rest/src/main/java/org/jboss/dna/web/jcr/rest/RepositoryFactory.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
trunk/extensions/dna-web-jcr-rest/src/main/java/org/jboss/dna/web/jcr/rest/model/RepositoryEntry.java
===================================================================
---
trunk/extensions/dna-web-jcr-rest/src/main/java/org/jboss/dna/web/jcr/rest/model/RepositoryEntry.java
(rev 0)
+++
trunk/extensions/dna-web-jcr-rest/src/main/java/org/jboss/dna/web/jcr/rest/model/RepositoryEntry.java 2009-05-28
12:57:37 UTC (rev 941)
@@ -0,0 +1,32 @@
+package org.jboss.dna.web.jcr.rest.model;
+
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+
+@XmlRootElement( name = "repository" )
+public class RepositoryEntry {
+
+ private String name;
+ private RepositoryResources resources;
+
+ public RepositoryEntry() {
+ resources = new RepositoryResources();
+ }
+
+ public RepositoryEntry( String contextName,
+ String repositoryName ) {
+ this.name = repositoryName;
+
+ resources = new RepositoryResources(contextName, repositoryName);
+ }
+
+ @XmlElement
+ public String getName() {
+ return name;
+ }
+
+ @XmlElement
+ public RepositoryResources getResources() {
+ return resources;
+ }
+}
Property changes on:
trunk/extensions/dna-web-jcr-rest/src/main/java/org/jboss/dna/web/jcr/rest/model/RepositoryEntry.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
trunk/extensions/dna-web-jcr-rest/src/main/java/org/jboss/dna/web/jcr/rest/model/RepositoryResources.java
===================================================================
---
trunk/extensions/dna-web-jcr-rest/src/main/java/org/jboss/dna/web/jcr/rest/model/RepositoryResources.java
(rev 0)
+++
trunk/extensions/dna-web-jcr-rest/src/main/java/org/jboss/dna/web/jcr/rest/model/RepositoryResources.java 2009-05-28
12:57:37 UTC (rev 941)
@@ -0,0 +1,21 @@
+package org.jboss.dna.web.jcr.rest.model;
+
+import javax.xml.bind.annotation.XmlElement;
+
+public class RepositoryResources {
+ private String baseUri;
+
+ public RepositoryResources() {
+ }
+
+ public RepositoryResources( String contextName,
+ String repositoryName ) {
+ this.baseUri = contextName + "/" + repositoryName;
+ }
+
+ @XmlElement( name = "workspaces" )
+ public String getWorkspaces() {
+ return baseUri;
+ }
+}
+
Property changes on:
trunk/extensions/dna-web-jcr-rest/src/main/java/org/jboss/dna/web/jcr/rest/model/RepositoryResources.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
trunk/extensions/dna-web-jcr-rest/src/main/java/org/jboss/dna/web/jcr/rest/model/WorkspaceEntry.java
===================================================================
---
trunk/extensions/dna-web-jcr-rest/src/main/java/org/jboss/dna/web/jcr/rest/model/WorkspaceEntry.java
(rev 0)
+++
trunk/extensions/dna-web-jcr-rest/src/main/java/org/jboss/dna/web/jcr/rest/model/WorkspaceEntry.java 2009-05-28
12:57:37 UTC (rev 941)
@@ -0,0 +1,34 @@
+package org.jboss.dna.web.jcr.rest.model;
+
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+
+@XmlRootElement( name = "workspace" )
+public class WorkspaceEntry {
+
+ private String name;
+ private WorkspaceResources resources;
+
+ public WorkspaceEntry() {
+
+ }
+
+ public WorkspaceEntry( String contextName,
+ String repositoryName,
+ String workspaceName ) {
+ this.name = workspaceName;
+
+ resources = new WorkspaceResources(contextName, repositoryName, workspaceName);
+ }
+
+ @XmlElement
+ public String getName() {
+ return name;
+ }
+
+ @XmlElement
+ public WorkspaceResources getResources() {
+ return resources;
+ }
+}
+
Property changes on:
trunk/extensions/dna-web-jcr-rest/src/main/java/org/jboss/dna/web/jcr/rest/model/WorkspaceEntry.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
trunk/extensions/dna-web-jcr-rest/src/main/java/org/jboss/dna/web/jcr/rest/model/WorkspaceResources.java
===================================================================
---
trunk/extensions/dna-web-jcr-rest/src/main/java/org/jboss/dna/web/jcr/rest/model/WorkspaceResources.java
(rev 0)
+++
trunk/extensions/dna-web-jcr-rest/src/main/java/org/jboss/dna/web/jcr/rest/model/WorkspaceResources.java 2009-05-28
12:57:37 UTC (rev 941)
@@ -0,0 +1,22 @@
+package org.jboss.dna.web.jcr.rest.model;
+
+import javax.xml.bind.annotation.XmlElement;
+
+public class WorkspaceResources {
+ private String baseUri;
+
+ public WorkspaceResources() {
+ }
+
+ public WorkspaceResources( String contextName,
+ String repositoryName,
+ String workspaceName ) {
+ this.baseUri = contextName + "/" + repositoryName + "/" +
workspaceName;
+ }
+
+ @XmlElement( name = "items" )
+ public String getWorkspaces() {
+ return baseUri + "/items";
+ }
+}
+
Property changes on:
trunk/extensions/dna-web-jcr-rest/src/main/java/org/jboss/dna/web/jcr/rest/model/WorkspaceResources.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
trunk/extensions/dna-web-jcr-rest/src/main/java/org/jboss/dna/web/jcr/rest/spi/DnaJcrRepositoryProvider.java
===================================================================
---
trunk/extensions/dna-web-jcr-rest/src/main/java/org/jboss/dna/web/jcr/rest/spi/DnaJcrRepositoryProvider.java
(rev 0)
+++
trunk/extensions/dna-web-jcr-rest/src/main/java/org/jboss/dna/web/jcr/rest/spi/DnaJcrRepositoryProvider.java 2009-05-28
12:57:37 UTC (rev 941)
@@ -0,0 +1,46 @@
+package org.jboss.dna.web.jcr.rest.spi;
+
+import java.util.HashSet;
+import java.util.Set;
+import javax.jcr.Repository;
+import javax.jcr.RepositoryException;
+import org.jboss.dna.graph.connector.inmemory.InMemoryRepositorySource;
+import org.jboss.dna.jcr.JcrConfiguration;
+import org.jboss.dna.jcr.JcrEngine;
+
+public class DnaJcrRepositoryProvider implements RepositoryProvider {
+
+ private JcrEngine jcrEngine;
+
+ public DnaJcrRepositoryProvider() {
+ jcrEngine = new JcrConfiguration().withConfigurationRepository()
+ .usingClass(InMemoryRepositorySource.class.getName())
+ .loadedFromClasspath()
+ .describedAs("Configuration Repository")
+ .with("name").setTo("configuration")
+ .with("retryLimit")
+ .setTo(5)
+ .and()
+ .addRepository("Source2")
+ .usingClass(InMemoryRepositorySource.class.getName())
+ .loadedFromClasspath()
+ .describedAs("description")
+ .with("name").setTo("JCR Repository")
+ .and()
+ .build();
+ jcrEngine.start();
+
+ }
+
+ public Set<String> getJcrRepositoryNames() {
+ return new HashSet<String>(jcrEngine.getJcrRepositoryNames());
+ }
+
+ public Repository getRepository( String repositoryName ) throws RepositoryException
{
+ return jcrEngine.getRepository(repositoryName);
+ }
+
+ public void shutdown() {
+ jcrEngine.shutdown();
+ }
+}
Property changes on:
trunk/extensions/dna-web-jcr-rest/src/main/java/org/jboss/dna/web/jcr/rest/spi/DnaJcrRepositoryProvider.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
trunk/extensions/dna-web-jcr-rest/src/main/java/org/jboss/dna/web/jcr/rest/spi/RepositoryProvider.java
===================================================================
---
trunk/extensions/dna-web-jcr-rest/src/main/java/org/jboss/dna/web/jcr/rest/spi/RepositoryProvider.java
(rev 0)
+++
trunk/extensions/dna-web-jcr-rest/src/main/java/org/jboss/dna/web/jcr/rest/spi/RepositoryProvider.java 2009-05-28
12:57:37 UTC (rev 941)
@@ -0,0 +1,35 @@
+package org.jboss.dna.web.jcr.rest.spi;
+
+import java.util.Set;
+import javax.jcr.Repository;
+import javax.jcr.RepositoryException;
+
+/**
+ * Interface for any class that provides access to one or more local JCR repositories.
Repository providers must provide a public,
+ * no-argument constructor.
+ */
+public interface RepositoryProvider {
+
+ /**
+ * Returns a reference to the named repository
+ *
+ * @param repositoryName the name of the repository to retrieve; may be null
+ * @return the repository with the given name; may not be null
+ * @throws RepositoryException if no repository with the given name exists or there
is an error obtaining a reference to the
+ * named repository
+ */
+ Repository getRepository( String repositoryName ) throws RepositoryException;
+
+ /**
+ * Returns the available repository names
+ *
+ * @return the available repository names; may not be null
+ */
+ Set<String> getJcrRepositoryNames();
+
+ /**
+ * Signals the repository provider that it should complete any pending transactions,
shutdown, and release
+ * any external resource held.
+ */
+ void shutdown();
+}
Property changes on:
trunk/extensions/dna-web-jcr-rest/src/main/java/org/jboss/dna/web/jcr/rest/spi/RepositoryProvider.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified: trunk/extensions/dna-web-jcr-rest/src/main/webapp/WEB-INF/web.xml
===================================================================
--- trunk/extensions/dna-web-jcr-rest/src/main/webapp/WEB-INF/web.xml 2009-05-28 02:13:55
UTC (rev 940)
+++ trunk/extensions/dna-web-jcr-rest/src/main/webapp/WEB-INF/web.xml 2009-05-28 12:57:37
UTC (rev 941)
@@ -1,54 +1,65 @@
<?xml version="1.0"?>
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application
2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd">
-<!--
- JBoss DNA (
http://www.jboss.org/dna)
- See the COPYRIGHT.txt file distributed with this work for information
- regarding copyright ownership. Some portions may be licensed
- to Red Hat, Inc. under one or more contributor license agreements.
- See the AUTHORS.txt file in the distribution for a full listing of
- individual contributors.
+ <!--
+ JBoss DNA (
http://www.jboss.org/dna) See the COPYRIGHT.txt file
+ distributed with this work for information regarding copyright
+ ownership. Some portions may be licensed to Red Hat, Inc. under one or
+ more contributor license agreements. See the AUTHORS.txt file in the
+ distribution for a full listing of individual contributors. JBoss DNA
+ is free software. Unless otherwise indicated, all code in JBoss DNA is
+ licensed to you under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either version
+ 2.1 of the License, or (at your option) any later version. JBoss DNA
+ is distributed in the hope that it will be useful, but WITHOUT ANY
+ WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+ License for more details. You should have received a copy of the GNU
+ Lesser General Public License along with this software; if not, write
+ to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ Boston, MA 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ -->
+<web-app>
+ <display-name>JBoss DNA JCR RESTful Interface</display-name>
- JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA
- is licensed to you under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of
- the License, or (at your option) any later version.
+ <context-param>
+ <param-name>org.jboss.dna.web.jcr.rest.REPOSITORY_PROVIDER</param-name>
+ <param-value>org.jboss.dna.web.jcr.rest.spi.DnaJcrRepositoryProvider</param-value>
+ </context-param>
- JBoss DNA is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
+ <context-param>
+ <param-name>resteasy.providers</param-name>
+ <param-value>org.jboss.dna.web.jcr.rest.JcrResources$NotFoundExceptionMapper,
+ org.jboss.dna.web.jcr.rest.JcrResources$JSONExceptionMapper,
+ org.jboss.dna.web.jcr.rest.JcrResources$RepositoryExceptionMapper
+ </param-value>
+ </context-param>
- You should have received a copy of the GNU Lesser General Public
- License along with this software; if not, write to the Free
- Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ <context-param>
+ <param-name>javax.ws.rs.core.Application</param-name>
+ <param-value>org.jboss.dna.web.jcr.rest.JcrApplication</param-value>
+ </context-param>
- -->
-<web-app>
- <display-name>JBoss DNA JCR RESTful Interface</display-name>
+ <listener>
+ <listener-class>
+ org.jboss.resteasy.plugins.server.servlet.ResteasyBootstrap
+ </listener-class>
+ </listener>
- <context-param>
- <param-name>javax.ws.rs.core.Application</param-name>
- <param-value>org.jboss.dna.web.jcr.rest.JcrApplication</param-value>
- </context-param>
+ <listener>
+ <listener-class>org.jboss.dna.web.jcr.rest.DnaJcrDeployer</listener-class>
+ </listener>
- <listener>
- <listener-class>
- org.jboss.resteasy.plugins.server.servlet.ResteasyBootstrap
- </listener-class>
- </listener>
-
- <servlet>
- <servlet-name>Resteasy</servlet-name>
- <servlet-class>
- org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher
+ <servlet>
+ <servlet-name>Resteasy</servlet-name>
+ <servlet-class>
+ org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher
</servlet-class>
- </servlet>
+ </servlet>
- <servlet-mapping>
- <servlet-name>Resteasy</servlet-name>
- <url-pattern>/*</url-pattern>
- </servlet-mapping>
+ <servlet-mapping>
+ <servlet-name>Resteasy</servlet-name>
+ <url-pattern>/*</url-pattern>
+ </servlet-mapping>
</web-app>
\ No newline at end of file
Added: trunk/extensions/dna-web-jcr-rest-war/.classpath
===================================================================
--- trunk/extensions/dna-web-jcr-rest-war/.classpath (rev 0)
+++ trunk/extensions/dna-web-jcr-rest-war/.classpath 2009-05-28 12:57:37 UTC (rev 941)
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" output="target/test-classes"
path="src/test/java"/>
+ <classpathentry excluding="**" kind="src"
output="target/test-classes" path="src/test/resources"/>
+ <classpathentry kind="con"
path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+ <classpathentry kind="con"
path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER">
+ <attributes>
+ <attribute name="org.eclipse.jst.component.dependency"
value="/WEB-INF/lib"/>
+ </attributes>
+ </classpathentry>
+ <classpathentry kind="con"
path="org.eclipse.jst.j2ee.internal.web.container"/>
+ <classpathentry kind="con"
path="org.eclipse.jst.j2ee.internal.module.container"/>
+ <classpathentry kind="output" path="target/classes"/>
+</classpath>
Added: trunk/extensions/dna-web-jcr-rest-war/.project
===================================================================
--- trunk/extensions/dna-web-jcr-rest-war/.project (rev 0)
+++ trunk/extensions/dna-web-jcr-rest-war/.project 2009-05-28 12:57:37 UTC (rev 941)
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>dna-web-jcr-rest-war</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.wst.jsdt.core.javascriptValidator</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.wst.common.project.facet.core.builder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.wst.validation.validationbuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.maven.ide.eclipse.maven2Builder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.jem.workbench.JavaEMFNature</nature>
+ <nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ <nature>org.maven.ide.eclipse.maven2Nature</nature>
+ <nature>org.eclipse.wst.common.project.facet.core.nature</nature>
+ <nature>org.eclipse.wst.jsdt.core.jsNature</nature>
+ </natures>
+</projectDescription>
Added: trunk/extensions/dna-web-jcr-rest-war/.settings/.jsdtscope
===================================================================
--- trunk/extensions/dna-web-jcr-rest-war/.settings/.jsdtscope
(rev 0)
+++ trunk/extensions/dna-web-jcr-rest-war/.settings/.jsdtscope 2009-05-28 12:57:37 UTC
(rev 941)
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con"
path="org.eclipse.wst.jsdt.launching.JRE_CONTAINER"/>
+ <classpathentry kind="con"
path="org.eclipse.wst.jsdt.launching.WebProject">
+ <attributes>
+ <attribute name="hide" value="true"/>
+ </attributes>
+ </classpathentry>
+ <classpathentry kind="con"
path="org.eclipse.wst.jsdt.launching.baseBrowserLibrary"/>
+ <classpathentry kind="output" path=""/>
+</classpath>
Added: trunk/extensions/dna-web-jcr-rest-war/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- trunk/extensions/dna-web-jcr-rest-war/.settings/org.eclipse.jdt.core.prefs
(rev 0)
+++ trunk/extensions/dna-web-jcr-rest-war/.settings/org.eclipse.jdt.core.prefs 2009-05-28
12:57:37 UTC (rev 941)
@@ -0,0 +1,7 @@
+#Wed May 27 16:41:12 EDT 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.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.5
Added: trunk/extensions/dna-web-jcr-rest-war/.settings/org.eclipse.wst.common.component
===================================================================
--- trunk/extensions/dna-web-jcr-rest-war/.settings/org.eclipse.wst.common.component
(rev 0)
+++
trunk/extensions/dna-web-jcr-rest-war/.settings/org.eclipse.wst.common.component 2009-05-28
12:57:37 UTC (rev 941)
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project-modules id="moduleCoreId" project-version="1.5.0">
+ <wb-module deploy-name="dna-web-jcr-rest-war">
+ <wb-resource deploy-path="/"
source-path="/src/main/webapp"/>
+ <wb-resource deploy-path="/WEB-INF/classes"
source-path="/src/test/java"/>
+ <wb-resource deploy-path="/WEB-INF/classes"
source-path="/src/test/resources"/>
+ <dependent-module deploy-path="/WEB-INF/lib"
handle="module:/resource/dna-web-jcr-rest/dna-web-jcr-rest">
+ <dependency-type>uses</dependency-type>
+ </dependent-module>
+ <dependent-module deploy-path="/WEB-INF/lib"
handle="module:/resource/dna-jcr/dna-jcr">
+ <dependency-type>uses</dependency-type>
+ </dependent-module>
+ <dependent-module deploy-path="/WEB-INF/lib"
handle="module:/resource/dna-common/dna-common">
+ <dependency-type>uses</dependency-type>
+ </dependent-module>
+ <dependent-module deploy-path="/WEB-INF/lib"
handle="module:/resource/dna-graph/dna-graph">
+ <dependency-type>uses</dependency-type>
+ </dependent-module>
+ <dependent-module deploy-path="/WEB-INF/lib"
handle="module:/resource/dna-repository/dna-repository">
+ <dependency-type>uses</dependency-type>
+ </dependent-module>
+ <dependent-module deploy-path="/WEB-INF/lib"
handle="module:/resource/dna-connector-federation/dna-connector-federation">
+ <dependency-type>uses</dependency-type>
+ </dependent-module>
+ <dependent-module deploy-path="/WEB-INF/lib"
handle="module:/resource/dna-cnd/dna-cnd">
+ <dependency-type>uses</dependency-type>
+ </dependent-module>
+ <property name="context-root"
value="dna-web-jcr-rest-war"/>
+ <property name="java-output-path"/>
+ </wb-module>
+</project-modules>
Added:
trunk/extensions/dna-web-jcr-rest-war/.settings/org.eclipse.wst.common.project.facet.core.xml
===================================================================
---
trunk/extensions/dna-web-jcr-rest-war/.settings/org.eclipse.wst.common.project.facet.core.xml
(rev 0)
+++
trunk/extensions/dna-web-jcr-rest-war/.settings/org.eclipse.wst.common.project.facet.core.xml 2009-05-28
12:57:37 UTC (rev 941)
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<faceted-project>
+ <installed facet="jst.java" version="5.0"/>
+ <installed facet="jst.web" version="2.3"/>
+</faceted-project>
Property changes on:
trunk/extensions/dna-web-jcr-rest-war/.settings/org.eclipse.wst.common.project.facet.core.xml
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
trunk/extensions/dna-web-jcr-rest-war/.settings/org.eclipse.wst.jsdt.ui.superType.container
===================================================================
---
trunk/extensions/dna-web-jcr-rest-war/.settings/org.eclipse.wst.jsdt.ui.superType.container
(rev 0)
+++
trunk/extensions/dna-web-jcr-rest-war/.settings/org.eclipse.wst.jsdt.ui.superType.container 2009-05-28
12:57:37 UTC (rev 941)
@@ -0,0 +1 @@
+org.eclipse.wst.jsdt.launching.baseBrowserLibrary
\ No newline at end of file
Added:
trunk/extensions/dna-web-jcr-rest-war/.settings/org.eclipse.wst.jsdt.ui.superType.name
===================================================================
---
trunk/extensions/dna-web-jcr-rest-war/.settings/org.eclipse.wst.jsdt.ui.superType.name
(rev 0)
+++
trunk/extensions/dna-web-jcr-rest-war/.settings/org.eclipse.wst.jsdt.ui.superType.name 2009-05-28
12:57:37 UTC (rev 941)
@@ -0,0 +1 @@
+Window
\ No newline at end of file
Added: trunk/extensions/dna-web-jcr-rest-war/.settings/org.maven.ide.eclipse.prefs
===================================================================
--- trunk/extensions/dna-web-jcr-rest-war/.settings/org.maven.ide.eclipse.prefs
(rev 0)
+++ trunk/extensions/dna-web-jcr-rest-war/.settings/org.maven.ide.eclipse.prefs 2009-05-28
12:57:37 UTC (rev 941)
@@ -0,0 +1,9 @@
+#Wed May 27 16:41:08 EDT 2009
+activeProfiles=
+eclipse.preferences.version=1
+fullBuildGoals=process-test-resources
+includeModules=true
+resolveWorkspaceProjects=true
+resourceFilterGoals=process-resources resources\:testResources
+skipCompilerPlugin=true
+version=1
Added: trunk/extensions/dna-web-jcr-rest-war/pom.xml
===================================================================
--- trunk/extensions/dna-web-jcr-rest-war/pom.xml (rev 0)
+++ trunk/extensions/dna-web-jcr-rest-war/pom.xml 2009-05-28 12:57:37 UTC (rev 941)
@@ -0,0 +1,111 @@
+<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>
+ <artifactId>dna</artifactId>
+ <groupId>org.jboss.dna</groupId>
+ <version>0.5-SNAPSHOT</version>
+ <relativePath>../..</relativePath>
+ </parent>
+ <artifactId>dna-web-jcr-rest-war</artifactId>
+ <packaging>war</packaging>
+ <name>JBoss DNA JCR REST Servlet</name>
+ <description>JBoss DNA servlet that provides RESTful access to JCR
items</description>
+ <
url>http://labs.jboss.org/dna</url>
+ <dependencies>
+ <dependency>
+ <groupId>org.jboss.dna</groupId>
+ <artifactId>dna-web-jcr-rest</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-log4j12</artifactId>
+ <version>1.4.3</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <!-- TESTING DEPENDENCIES -->
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit-dep</artifactId>
+ <version>4.4</version>
+ <scope>integration-test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.resteasy</groupId>
+ <artifactId>resteasy-client</artifactId>
+ <version>1.0-beta-8</version>
+ <scope>integration-test</scope>
+ </dependency>
+ </dependencies>
+ <build>
+ <finalName>resources</finalName>
+ <pluginManagement>
+ <plugins>
+ <plugin>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+ <plugins>
+ <plugin>
+ <groupId>org.codehaus.cargo</groupId>
+ <artifactId>cargo-maven2-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>start-container</id>
+ <phase>pre-integration-test</phase>
+ <goals>
+ <goal>start</goal>
+ </goals>
+ </execution>
+ <execution>
+ <id>stop-container</id>
+ <phase>post-integration-test</phase>
+ <goals>
+ <goal>stop</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <configuration>
+ <properties>
+ <cargo.logging>high</cargo.logging>
+ </properties>
+ </configuration>
+ <container>
+ <systemProperties>
+ <java.security.auth.login.config>${project.build.directory}/test-classes/jetty-dna.policy</java.security.auth.login.config>
+ </systemProperties>
+ </container>
+ <wait>false</wait>
+ </configuration>
+ </plugin>
+ <!--
+ Override the default Surefire behavior to run during
+ integration-test phase
+ -->
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <skip>true</skip>
+ </configuration>
+ <executions>
+ <execution>
+ <id>surefire-it</id>
+ <phase>integration-test</phase>
+ <goals>
+ <goal>test</goal>
+ </goals>
+ <configuration>
+ <skip>false</skip>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
Property changes on: trunk/extensions/dna-web-jcr-rest-war/pom.xml
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: trunk/extensions/dna-web-jcr-rest-war/src/main/webapp/META-INF/MANIFEST.MF
===================================================================
--- trunk/extensions/dna-web-jcr-rest-war/src/main/webapp/META-INF/MANIFEST.MF
(rev 0)
+++ trunk/extensions/dna-web-jcr-rest-war/src/main/webapp/META-INF/MANIFEST.MF 2009-05-28
12:57:37 UTC (rev 941)
@@ -0,0 +1,3 @@
+Manifest-Version: 1.0
+Class-Path:
+
Added: trunk/extensions/dna-web-jcr-rest-war/src/main/webapp/WEB-INF/web.xml
===================================================================
--- trunk/extensions/dna-web-jcr-rest-war/src/main/webapp/WEB-INF/web.xml
(rev 0)
+++ trunk/extensions/dna-web-jcr-rest-war/src/main/webapp/WEB-INF/web.xml 2009-05-28
12:57:37 UTC (rev 941)
@@ -0,0 +1,65 @@
+<?xml version="1.0"?>
+<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application
2.3//EN"
+ "http://java.sun.com/dtd/web-app_2_3.dtd">
+ <!--
+ JBoss DNA (
http://www.jboss.org/dna) See the COPYRIGHT.txt file
+ distributed with this work for information regarding copyright
+ ownership. Some portions may be licensed to Red Hat, Inc. under one or
+ more contributor license agreements. See the AUTHORS.txt file in the
+ distribution for a full listing of individual contributors. JBoss DNA
+ is free software. Unless otherwise indicated, all code in JBoss DNA is
+ licensed to you under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either version
+ 2.1 of the License, or (at your option) any later version. JBoss DNA
+ is distributed in the hope that it will be useful, but WITHOUT ANY
+ WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+ License for more details. You should have received a copy of the GNU
+ Lesser General Public License along with this software; if not, write
+ to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ Boston, MA 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ -->
+<web-app>
+ <display-name>JBoss DNA JCR RESTful Interface</display-name>
+
+ <context-param>
+ <param-name>org.jboss.dna.web.jcr.rest.REPOSITORY_PROVIDER</param-name>
+ <param-value>org.jboss.dna.web.jcr.rest.spi.DnaJcrRepositoryProvider</param-value>
+ </context-param>
+
+ <context-param>
+ <param-name>resteasy.providers</param-name>
+ <param-value>org.jboss.dna.web.jcr.rest.JcrResources$NotFoundExceptionMapper,
+ org.jboss.dna.web.jcr.rest.JcrResources$JSONExceptionMapper,
+ org.jboss.dna.web.jcr.rest.JcrResources$RepositoryExceptionMapper
+ </param-value>
+ </context-param>
+
+ <context-param>
+ <param-name>javax.ws.rs.core.Application</param-name>
+ <param-value>org.jboss.dna.web.jcr.rest.JcrApplication</param-value>
+ </context-param>
+
+ <listener>
+ <listener-class>
+ org.jboss.resteasy.plugins.server.servlet.ResteasyBootstrap
+ </listener-class>
+ </listener>
+
+ <listener>
+ <listener-class>org.jboss.dna.web.jcr.rest.DnaJcrDeployer</listener-class>
+ </listener>
+
+ <servlet>
+ <servlet-name>Resteasy</servlet-name>
+ <servlet-class>
+ org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher
+ </servlet-class>
+ </servlet>
+
+ <servlet-mapping>
+ <servlet-name>Resteasy</servlet-name>
+ <url-pattern>/*</url-pattern>
+ </servlet-mapping>
+
+</web-app>
\ No newline at end of file
Property changes on:
trunk/extensions/dna-web-jcr-rest-war/src/main/webapp/WEB-INF/web.xml
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF