jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tri...@apache.org
Subject svn commit: r165294 - in /incubator/jackrabbit/trunk/contrib/jcr-server: ./ client/ server/ server/src/java/org/apache/jackrabbit/server/ server/src/java/org/apache/jackrabbit/server/io/ webapp/ webdav/ webdav/src/java/org/apache/jackrabbit/ webdav/src/java/org/apache/jackrabbit/webdav/jcr/
Date Fri, 29 Apr 2005 11:29:00 GMT
Author: tripod
Date: Fri Apr 29 04:29:00 2005
New Revision: 165294

URL: http://svn.apache.org/viewcvs?rev=165294&view=rev
Log:
- adapting server to latest api 0.16.4.1
- adding support for better repository extensibility
- add primary-item export command

Added:
    incubator/jackrabbit/trunk/contrib/jcr-server/server/src/java/org/apache/jackrabbit/server/io/PrimaryItemExportCommand.java
  (with props)
Modified:
    incubator/jackrabbit/trunk/contrib/jcr-server/   (props changed)
    incubator/jackrabbit/trunk/contrib/jcr-server/client/project.xml
    incubator/jackrabbit/trunk/contrib/jcr-server/project.xml
    incubator/jackrabbit/trunk/contrib/jcr-server/server/project.xml
    incubator/jackrabbit/trunk/contrib/jcr-server/server/src/java/org/apache/jackrabbit/server/RepositoryStartupServlet.java
    incubator/jackrabbit/trunk/contrib/jcr-server/webapp/   (props changed)
    incubator/jackrabbit/trunk/contrib/jcr-server/webapp/project.xml
    incubator/jackrabbit/trunk/contrib/jcr-server/webdav/   (props changed)
    incubator/jackrabbit/trunk/contrib/jcr-server/webdav/project.xml
    incubator/jackrabbit/trunk/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/JcrConstants.java
    incubator/jackrabbit/trunk/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/jcr/VersionControlledItemCollection.java

Propchange: incubator/jackrabbit/trunk/contrib/jcr-server/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Fri Apr 29 04:29:00 2005
@@ -0,0 +1,2 @@
+*.ipr
+*.iws

Modified: incubator/jackrabbit/trunk/contrib/jcr-server/client/project.xml
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-server/client/project.xml?rev=165294&r1=165293&r2=165294&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/contrib/jcr-server/client/project.xml (original)
+++ incubator/jackrabbit/trunk/contrib/jcr-server/client/project.xml Fri Apr 29 04:29:00 2005
@@ -37,16 +37,16 @@
         <dependency>
             <groupId>jsr170</groupId>
             <artifactId>jcr</artifactId>
-            <version>0.16.4</version>
-            <url>http://www.day.com/maven/jsr170/jars/jcr-0.16.4.jar</url>
+            <version>0.16.4.1</version>
+            <url>http://www.day.com/maven/jsr170/jars/jcr-0.16.4.1.jar</url>
         </dependency>
         <dependency>
             <id>jackrabbit</id>
-            <version>0.16.4-dev</version>
+            <version>0.16.4.1-dev</version>
         </dependency>
         <dependency>
             <id>jcr-rmi</id>
-            <version>0.16.4</version>
+            <version>0.16.4.1</version>
         </dependency>
         <dependency>
             <id>jdom</id>
@@ -66,7 +66,7 @@
         </dependency>
         <dependency>
           <id>commons-collections</id>
-          <version>2.1</version>
+          <version>3.1</version>
         </dependency>
     </dependencies>
 

Modified: incubator/jackrabbit/trunk/contrib/jcr-server/project.xml
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-server/project.xml?rev=165294&r1=165293&r2=165294&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/contrib/jcr-server/project.xml (original)
+++ incubator/jackrabbit/trunk/contrib/jcr-server/project.xml Fri Apr 29 04:29:00 2005
@@ -23,7 +23,7 @@
     <groupId>jcr-server</groupId>
 
     <name>Jackrabbit-Server</name>
-    <currentVersion>0.16.4</currentVersion>
+    <currentVersion>0.16.4.1</currentVersion>
     <inceptionYear>2005</inceptionYear>
     <package>org.apache.jackrabbit.server.*</package>
     <description>

Modified: incubator/jackrabbit/trunk/contrib/jcr-server/server/project.xml
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-server/server/project.xml?rev=165294&r1=165293&r2=165294&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/contrib/jcr-server/server/project.xml (original)
+++ incubator/jackrabbit/trunk/contrib/jcr-server/server/project.xml Fri Apr 29 04:29:00 2005
@@ -45,12 +45,12 @@
         <dependency>
             <groupId>jsr170</groupId>
             <artifactId>jcr</artifactId>
-            <version>0.16.4</version>
-            <url>http://www.day.com/maven/jsr170/jars/jcr-0.16.4.jar</url>
+            <version>0.16.4.1</version>
+            <url>http://www.day.com/maven/jsr170/jars/jcr-0.16.4.1.jar</url>
         </dependency>
         <dependency>
             <id>jackrabbit</id>
-            <version>0.16.4-dev</version>
+            <version>0.16.4.1-dev</version>
         </dependency>
         <dependency>
             <id>jdom</id>
@@ -66,7 +66,7 @@
         </dependency>
         <dependency>
             <id>jcr-rmi</id>
-            <version>0.16.4</version>
+            <version>0.16.4.1</version>
         </dependency>
         <dependency>
             <id>commons-chain</id>

Modified: incubator/jackrabbit/trunk/contrib/jcr-server/server/src/java/org/apache/jackrabbit/server/RepositoryStartupServlet.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-server/server/src/java/org/apache/jackrabbit/server/RepositoryStartupServlet.java?rev=165294&r1=165293&r2=165294&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/contrib/jcr-server/server/src/java/org/apache/jackrabbit/server/RepositoryStartupServlet.java
(original)
+++ incubator/jackrabbit/trunk/contrib/jcr-server/server/src/java/org/apache/jackrabbit/server/RepositoryStartupServlet.java
Fri Apr 29 04:29:00 2005
@@ -63,7 +63,7 @@
     public final static String INIT_PARAM_LOG4J_CONFIG = "log4j-config";
 
     /** the registered repository */
-    private static RepositoryImpl repository;
+    private static Repository repository;
 
     /** the name of the repository as configured */
     private static String repositoryName;
@@ -173,15 +173,27 @@
 	log.info("  repository-name = " + repositoryName);
 
 	try {
-	    InputSource is = new InputSource(in);
-	    RepositoryConfig config = RepositoryConfig.create(is, repositoryHome.getAbsolutePath());
-	    repository = RepositoryImpl.create(config);
+	    repository = createRepository(new InputSource(in), repositoryHome);
 	} catch (RepositoryException e) {
 	    throw new ServletException("Error while creating repository", e);
 	}
     }
 
     /**
+     * Creates the repository for the given config and homedir.
+     *
+     * @param is
+     * @param homedir
+     * @return
+     * @throws RepositoryException
+     */
+    protected Repository createRepository(InputSource is, File homedir)
+            throws RepositoryException {
+        RepositoryConfig config = RepositoryConfig.create(is, homedir.getAbsolutePath());
+        return RepositoryImpl.create(config);
+    }
+
+    /**
      * Registers the repository in the JNDI context
      * @throws ServletException
      */
@@ -237,7 +249,7 @@
 	    }
 
 	    // try to create remote repository
-	    Remote remote = null;
+	    Remote remote;
 	    try {
 		Class clazz = Class.forName("org.apache.jackrabbit.server.RMIRemoteFactoryDelegater");
 		RemoteFactoryDelegater rmf = (RemoteFactoryDelegater) clazz.newInstance();

Added: incubator/jackrabbit/trunk/contrib/jcr-server/server/src/java/org/apache/jackrabbit/server/io/PrimaryItemExportCommand.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-server/server/src/java/org/apache/jackrabbit/server/io/PrimaryItemExportCommand.java?rev=165294&view=auto
==============================================================================
--- incubator/jackrabbit/trunk/contrib/jcr-server/server/src/java/org/apache/jackrabbit/server/io/PrimaryItemExportCommand.java
(added)
+++ incubator/jackrabbit/trunk/contrib/jcr-server/server/src/java/org/apache/jackrabbit/server/io/PrimaryItemExportCommand.java
Fri Apr 29 04:29:00 2005
@@ -0,0 +1,134 @@
+/*
+ * Copyright 2004-2005 The Apache Software Foundation or its licensors,
+ *                     as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.server.io;
+
+import org.apache.commons.chain.Command;
+import org.apache.commons.chain.Context;
+import org.apache.jackrabbit.JcrConstants;
+
+import javax.jcr.Node;
+import javax.jcr.Item;
+import javax.jcr.ItemNotFoundException;
+import javax.jcr.Property;
+import javax.jcr.RepositoryException;
+import javax.jcr.PropertyType;
+
+/**
+ * This Class implements an abstract export command for a nc-resource. It acts
+ * as generic base class that retrieves the resource properties from the
+ * exporting node.
+ * </p>
+ */
+public class PrimaryItemExportCommand implements Command, JcrConstants {
+
+    /**
+     * Executes this command by calling {@link #execute(ExportContext)} if
+     * the given context is of the correct class.
+     *
+     * @param context the (export) context.
+     * @return the return value of the delegated method or false;
+     * @throws Exception in an error occurrs
+     */
+    public boolean execute(Context context) throws Exception {
+        if (context instanceof ExportContext) {
+            return execute((ExportContext) context);
+        } else {
+            return false;
+        }
+    }
+
+    /**
+     * Executs this command using the given export context.
+     *
+     * @param context the export context
+     * @return
+     * @throws Exception if an error occurrs
+     */
+    public boolean execute(ExportContext context) throws Exception {
+        Item item = context.getNode();
+        long creationTime=0;
+
+        // find primary item
+        while (item.isNode()) {
+            Node node = (Node)item;
+            // creation time not set with the files/folders
+            if (node.hasProperty(JCR_CREATED)) {
+                creationTime = node.getProperty(JCR_CREATED).getValue().getLong();
+            }
+            // avoid 'ItemNotFound' if no primary item is present
+            try {
+                item = ((Node) item).getPrimaryItem();
+            } catch (ItemNotFoundException e) {
+                // no primary item existing, stop searching
+                break;
+            }
+        }
+
+        // access property values
+        if (!item.isNode()) {
+            Property prop = (Property) item;
+            Node parent = prop.getParent();
+
+            context.setCreationTime(creationTime);
+            // check for last modified sibling
+            try {
+                if (parent.hasProperty(JCR_LASTMODIFIED)) {
+                    context.setModificationTime(parent.getProperty(JCR_LASTMODIFIED).getLong());
+                }
+            } catch (RepositoryException e) {
+                // ignore
+            }
+
+            // check for contenttype and encoding sibling of the primary item.
+            String contentType="application/octet-stream";
+            if (!context.getNode().isSame(item)) {
+                try {
+                    if (parent.hasProperty(JCR_MIMETYPE)) {
+                        contentType = parent.getProperty(JCR_MIMETYPE).getString();
+
+                        if (parent.hasProperty(JCR_ENCODING)) {
+                            String encoding = parent.getProperty(JCR_ENCODING).getString();
+                            if (!encoding.equals("")) {
+                                contentType+="; charset=\"" + encoding + "\"";
+                            }
+                        }
+                    }
+                } catch (RepositoryException e) {
+                    // ignore
+                }
+            } else {
+                // property was requested > set content type according to type
+                contentType = (prop.getType() == PropertyType.BINARY) ? "application/octet-stream"
: "text/plain";
+            }
+            context.setContentType(contentType);
+
+            // get content length
+            if (prop.getDefinition().isMultiple()) {
+                context.setInputStream(prop.getValues()[0].getStream());
+                context.setContentLength(prop.getLengths()[0]);
+            } else {
+                context.setInputStream(prop.getValue().getStream());
+                context.setContentLength(prop.getLength());
+            }
+            return true;
+        } else {
+            /* no primaryItem property could be retrieved, abort command */
+            return false;
+
+        }
+    }
+}

Propchange: incubator/jackrabbit/trunk/contrib/jcr-server/server/src/java/org/apache/jackrabbit/server/io/PrimaryItemExportCommand.java
------------------------------------------------------------------------------
    svn = 

Propchange: incubator/jackrabbit/trunk/contrib/jcr-server/server/src/java/org/apache/jackrabbit/server/io/PrimaryItemExportCommand.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/jackrabbit/trunk/contrib/jcr-server/webapp/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Fri Apr 29 04:29:00 2005
@@ -1 +1,2 @@
 target
+*.iml

Modified: incubator/jackrabbit/trunk/contrib/jcr-server/webapp/project.xml
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-server/webapp/project.xml?rev=165294&r1=165293&r2=165294&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/contrib/jcr-server/webapp/project.xml (original)
+++ incubator/jackrabbit/trunk/contrib/jcr-server/webapp/project.xml Fri Apr 29 04:29:00 2005
@@ -57,15 +57,15 @@
         <dependency>
             <groupId>jsr170</groupId>
             <artifactId>jcr</artifactId>
-            <version>0.16.4</version>
-            <url>http://www.day.com/maven/jsr170/jars/jcr-0.16.4.jar</url>
+            <version>0.16.4.1</version>
+            <url>http://www.day.com/maven/jsr170/jars/jcr-0.16.4.1.jar</url>
             <properties>
                 <war.bundle>true</war.bundle>
             </properties>
         </dependency>
         <dependency>
             <id>jackrabbit</id>
-            <version>0.16.4-dev</version>
+            <version>0.16.4.1-dev</version>
             <properties>
                 <war.bundle>true</war.bundle>
             </properties>
@@ -90,7 +90,7 @@
         </dependency>
         <dependency>
             <id>jcr-rmi</id>
-            <version>0.16.4</version>
+            <version>0.16.4.1</version>
             <properties>
                 <war.bundle>false</war.bundle>
             </properties>
@@ -105,7 +105,7 @@
         </dependency>
         <dependency>
           <id>commons-collections</id>
-          <version>2.1</version>
+          <version>3.1</version>
             <properties>
                 <war.bundle>true</war.bundle>
             </properties>

Propchange: incubator/jackrabbit/trunk/contrib/jcr-server/webdav/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Fri Apr 29 04:29:00 2005
@@ -1 +1,2 @@
 target
+*.iml

Modified: incubator/jackrabbit/trunk/contrib/jcr-server/webdav/project.xml
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-server/webdav/project.xml?rev=165294&r1=165293&r2=165294&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/contrib/jcr-server/webdav/project.xml (original)
+++ incubator/jackrabbit/trunk/contrib/jcr-server/webdav/project.xml Fri Apr 29 04:29:00 2005
@@ -32,12 +32,12 @@
         <dependency>
             <groupId>jsr170</groupId>
             <artifactId>jcr</artifactId>
-            <version>0.16.4</version>
-            <url>http://www.day.com/maven/jsr170/jars/jcr-0.16.4.jar</url>
+            <version>0.16.4.1</version>
+            <url>http://www.day.com/maven/jsr170/jars/jcr-0.16.4.1.jar</url>
         </dependency>
         <dependency>
             <id>jackrabbit</id>
-            <version>0.16.4-dev</version>
+            <version>0.16.4.1-dev</version>
         </dependency>
         <dependency>
             <id>jdom</id>

Modified: incubator/jackrabbit/trunk/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/JcrConstants.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/JcrConstants.java?rev=165294&r1=165293&r2=165294&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/JcrConstants.java
(original)
+++ incubator/jackrabbit/trunk/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/JcrConstants.java
Fri Apr 29 04:29:00 2005
@@ -124,6 +124,10 @@
      */
     public static final String JCR_ONPARENTVERSION = "jcr:onParentVersion";
     /**
+     * jcr:path
+     */
+    public static final String JCR_PATH = "jcr:path";
+    /**
      * jcr:predecessors
      */
     public static final String JCR_PREDECESSORS = "jcr:predecessors";

Modified: incubator/jackrabbit/trunk/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/jcr/VersionControlledItemCollection.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/jcr/VersionControlledItemCollection.java?rev=165294&r1=165293&r2=165294&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/jcr/VersionControlledItemCollection.java
(original)
+++ incubator/jackrabbit/trunk/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/jcr/VersionControlledItemCollection.java
Fri Apr 29 04:29:00 2005
@@ -468,7 +468,7 @@
                         // never occurs, because merging without bestEffort flag
                         // being set results in an exception on failure.
                         if (n.hasProperty(JcrConstants.JCR_MERGEFAILED)) {
-                            ReferenceValue[] mergeFailed = (ReferenceValue[]) n.getProperty(JcrConstants.JCR_MERGEFAILED).getValues();
+                            Value[] mergeFailed = n.getProperty(JcrConstants.JCR_MERGEFAILED).getValues();
                             addHrefProperty(AUTO_MERGE_SET, mergeFailed, false);
                         }
                         // todo: checkout-fork, checkin-fork
@@ -487,7 +487,7 @@
      * Add a {@link org.apache.jackrabbit.webdav.property.HrefProperty} with the specified
property name and values.
      *
      * @param name
-     * @param values Array of {@link ReferenceValue}s.
+     * @param values Array of {@link Value}s.
      * @param isProtected
      * @throws javax.jcr.ValueFormatException
      * @throws IllegalStateException



Mime
View raw message