jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ang...@apache.org
Subject svn commit: r1002639 [2/3] - in /jackrabbit/trunk: jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/webdav/ jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/util/ jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/ser...
Date Wed, 29 Sep 2010 14:11:54 GMT
Modified: jackrabbit/trunk/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/webdav/jcr/search/SearchResultProperty.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/webdav/jcr/search/SearchResultProperty.java?rev=1002639&r1=1002638&r2=1002639&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/webdav/jcr/search/SearchResultProperty.java (original)
+++ jackrabbit/trunk/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/webdav/jcr/search/SearchResultProperty.java Wed Sep 29 14:11:53 2010
@@ -16,6 +16,7 @@
  */
 package org.apache.jackrabbit.webdav.jcr.search;
 
+import org.apache.jackrabbit.commons.webdav.QueryUtil;
 import org.apache.jackrabbit.value.ValueHelper;
 import org.apache.jackrabbit.webdav.jcr.ItemResourceConstants;
 import org.apache.jackrabbit.webdav.property.AbstractDavProperty;
@@ -30,7 +31,6 @@ import org.w3c.dom.Element;
 import javax.jcr.PropertyType;
 import javax.jcr.RepositoryException;
 import javax.jcr.Value;
-import javax.jcr.ValueFormatException;
 import javax.jcr.ValueFactory;
 import java.util.ArrayList;
 import java.util.List;
@@ -43,8 +43,7 @@ public class SearchResultProperty extend
 
     private static Logger log = LoggerFactory.getLogger(SearchResultProperty.class);
 
-    public static final DavPropertyName SEARCH_RESULT_PROPERTY = DavPropertyName.create("search-result-property", ItemResourceConstants.NAMESPACE);
-    private static final String COLUMN = "column";
+    private static final DavPropertyName SEARCH_RESULT_PROPERTY = DavPropertyName.create(JCR_QUERY_RESULT_LN, ItemResourceConstants.NAMESPACE);
 
     private final String[] columnNames;
     private final String[] selectorNames;
@@ -87,49 +86,14 @@ public class SearchResultProperty extend
         List<String> colList = new ArrayList<String>();
         List<String> selList = new ArrayList<String>();
         List<Value> valList = new ArrayList<Value>();
-        Object propValue = property.getValue();
-        if (propValue instanceof List) {
-            for (Object o : ((List<?>) propValue)) {
-                if (o instanceof Element) {
-                    parseColumnElement((Element) o, colList, selList, valList, valueFactory);
-                }
-            }
-        } else if (propValue instanceof Element) {
-            parseColumnElement((Element)property.getValue(), colList, selList, valList, valueFactory);
-        } else {
-            throw new IllegalArgumentException("SearchResultProperty requires a list of 'dcr:column' xml elements.");
-        }
+
+        QueryUtil.parseResultPropertyValue(property.getValue(), colList, selList, valList, valueFactory);
 
         columnNames = colList.toArray(new String[colList.size()]);
         selectorNames = selList.toArray(new String[selList.size()]);
         values = valList.toArray(new Value[valList.size()]);
     }
 
-    private void parseColumnElement(Element columnElement,
-                                    List<String> columnNames,
-                                    List<String> selectorNames,
-                                    List<Value> values,
-                                    ValueFactory valueFactory)
-        throws ValueFormatException, RepositoryException {
-        if (!DomUtil.matches(columnElement, COLUMN, ItemResourceConstants.NAMESPACE)) {
-            log.debug("dcr:column element expected within search result.");
-            return;
-        }
-        columnNames.add(DomUtil.getChildText(columnElement, JCR_NAME.getName(), JCR_NAME.getNamespace()));
-        selectorNames.add(DomUtil.getChildText(columnElement, JCR_SELECTOR_NAME.getName(), JCR_SELECTOR_NAME.getNamespace()));
-
-        Value jcrValue;
-        Element valueElement = DomUtil.getChildElement(columnElement, JCR_VALUE.getName(), JCR_VALUE.getNamespace());
-        if (valueElement != null) {
-            String typeStr = DomUtil.getAttribute(valueElement, ATTR_VALUE_TYPE, ItemResourceConstants.NAMESPACE);
-            jcrValue = ValueHelper.deserialize(DomUtil.getText(valueElement),
-                    PropertyType.valueFromName(typeStr), true, valueFactory);
-        } else {
-            jcrValue = null;
-        }
-        values.add(jcrValue);
-    }
-
     /**
      * Return the column names representing the names of the properties present
      * in the {@link #getValues() values}.
@@ -216,7 +180,7 @@ public class SearchResultProperty extend
             String selectorName = selectorNames[i];
             Value propertyValue = values[i];
 
-            Element columnEl = DomUtil.addChildElement(elem, COLUMN, ItemResourceConstants.NAMESPACE);
+            Element columnEl = DomUtil.addChildElement(elem, XML_QUERY_RESULT_COLUMN, ItemResourceConstants.NAMESPACE);
             DomUtil.addChildElement(columnEl, JCR_NAME.getName(), JCR_NAME.getNamespace(), propertyName);
             if (propertyValue != null) {
                 try {

Modified: jackrabbit/trunk/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/webdav/jcr/version/report/ExportViewReport.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/webdav/jcr/version/report/ExportViewReport.java?rev=1002639&r1=1002638&r2=1002639&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/webdav/jcr/version/report/ExportViewReport.java (original)
+++ jackrabbit/trunk/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/webdav/jcr/version/report/ExportViewReport.java Wed Sep 29 14:11:53 2010
@@ -16,6 +16,7 @@
  */
 package org.apache.jackrabbit.webdav.jcr.version.report;
 
+import org.apache.jackrabbit.commons.webdav.JcrRemotingConstants;
 import org.apache.jackrabbit.util.Text;
 import org.apache.jackrabbit.webdav.DavException;
 import org.apache.jackrabbit.webdav.DavResource;
@@ -40,7 +41,6 @@ import java.io.FileInputStream;
 import java.io.FileNotFoundException;
 import java.io.FileOutputStream;
 import java.io.IOException;
-import java.io.InputStream;
 
 /**
  * <code>ExportViewReport</code> handles REPORT requests for the 'exportview'
@@ -64,12 +64,10 @@ public class ExportViewReport extends Ab
 
     private static Logger log = LoggerFactory.getLogger(ExportViewReport.class);
 
-    private static final String REPORT_NAME = "exportview";
-
     /**
      * The exportview report type
      */
-    public static final ReportType EXPORTVIEW_REPORT = ReportType.register(REPORT_NAME, ItemResourceConstants.NAMESPACE, ExportViewReport.class);
+    public static final ReportType EXPORTVIEW_REPORT = ReportType.register(JcrRemotingConstants.REPORT_EXPORT_VIEW, ItemResourceConstants.NAMESPACE, ExportViewReport.class);
 
     private String absNodePath;
 

Modified: jackrabbit/trunk/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/webdav/jcr/version/report/JcrPrivilegeReport.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/webdav/jcr/version/report/JcrPrivilegeReport.java?rev=1002639&r1=1002638&r2=1002639&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/webdav/jcr/version/report/JcrPrivilegeReport.java (original)
+++ jackrabbit/trunk/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/webdav/jcr/version/report/JcrPrivilegeReport.java Wed Sep 29 14:11:53 2010
@@ -16,6 +16,7 @@
  */
 package org.apache.jackrabbit.webdav.jcr.version.report;
 
+import org.apache.jackrabbit.commons.webdav.JcrRemotingConstants;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.apache.jackrabbit.webdav.version.report.Report;
@@ -47,12 +48,10 @@ public class JcrPrivilegeReport extends 
 
     private static Logger log = LoggerFactory.getLogger(JcrPrivilegeReport.class);
 
-    private static final String REPORT_NAME = "privileges";
-
     /**
      * The exportview report type
      */
-    public static final ReportType PRIVILEGES_REPORT = ReportType.register(REPORT_NAME, ItemResourceConstants.NAMESPACE, JcrPrivilegeReport.class);
+    public static final ReportType PRIVILEGES_REPORT = ReportType.register(JcrRemotingConstants.REPORT_PRIVILEGES, ItemResourceConstants.NAMESPACE, JcrPrivilegeReport.class);
 
     private static final Privilege[] PRIVS = new Privilege[] {
         ItemResourceConstants.PRIVILEGE_JCR_READ,

Modified: jackrabbit/trunk/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/webdav/jcr/version/report/LocateByUuidReport.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/webdav/jcr/version/report/LocateByUuidReport.java?rev=1002639&r1=1002638&r2=1002639&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/webdav/jcr/version/report/LocateByUuidReport.java (original)
+++ jackrabbit/trunk/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/webdav/jcr/version/report/LocateByUuidReport.java Wed Sep 29 14:11:53 2010
@@ -16,6 +16,7 @@
  */
 package org.apache.jackrabbit.webdav.jcr.version.report;
 
+import org.apache.jackrabbit.commons.webdav.JcrRemotingConstants;
 import org.apache.jackrabbit.webdav.DavConstants;
 import org.apache.jackrabbit.webdav.DavException;
 import org.apache.jackrabbit.webdav.DavResource;
@@ -50,12 +51,10 @@ public class LocateByUuidReport extends 
 
     private static Logger log = LoggerFactory.getLogger(LocateByUuidReport.class);
 
-    private static final String REPORT_NAME = "locate-by-uuid";
-
     /**
      * The exportview report type
      */
-    public static final ReportType LOCATE_BY_UUID_REPORT = ReportType.register(REPORT_NAME, ItemResourceConstants.NAMESPACE, LocateByUuidReport.class);
+    public static final ReportType LOCATE_BY_UUID_REPORT = ReportType.register(JcrRemotingConstants.REPORT_LOCATE_BY_UUID, ItemResourceConstants.NAMESPACE, LocateByUuidReport.class);
 
     private MultiStatus ms;
 

Modified: jackrabbit/trunk/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/webdav/jcr/version/report/LocateCorrespondingNodeReport.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/webdav/jcr/version/report/LocateCorrespondingNodeReport.java?rev=1002639&r1=1002638&r2=1002639&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/webdav/jcr/version/report/LocateCorrespondingNodeReport.java (original)
+++ jackrabbit/trunk/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/webdav/jcr/version/report/LocateCorrespondingNodeReport.java Wed Sep 29 14:11:53 2010
@@ -16,6 +16,7 @@
  */
 package org.apache.jackrabbit.webdav.jcr.version.report;
 
+import org.apache.jackrabbit.commons.webdav.JcrRemotingConstants;
 import org.apache.jackrabbit.webdav.DavConstants;
 import org.apache.jackrabbit.webdav.DavException;
 import org.apache.jackrabbit.webdav.DavResource;
@@ -65,14 +66,12 @@ public class LocateCorrespondingNodeRepo
 
     private static Logger log = LoggerFactory.getLogger(LocateCorrespondingNodeReport.class);
 
-    private static final String REPORT_NAME = "locate-corresponding-node";
-
     private String correspHref;
 
     /**
      * The corresponding-node report type
      */
-    public static final ReportType LOCATE_CORRESPONDING_NODE_REPORT = ReportType.register(REPORT_NAME, ItemResourceConstants.NAMESPACE, LocateByUuidReport.class);
+    public static final ReportType LOCATE_CORRESPONDING_NODE_REPORT = ReportType.register(JcrRemotingConstants.REPORT_LOCATE_CORRESPONDING_NODE, ItemResourceConstants.NAMESPACE, LocateByUuidReport.class);
 
     /**
      * Returns {@link #LOCATE_CORRESPONDING_NODE_REPORT}

Modified: jackrabbit/trunk/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/webdav/jcr/version/report/NodeTypesReport.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/webdav/jcr/version/report/NodeTypesReport.java?rev=1002639&r1=1002638&r2=1002639&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/webdav/jcr/version/report/NodeTypesReport.java (original)
+++ jackrabbit/trunk/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/webdav/jcr/version/report/NodeTypesReport.java Wed Sep 29 14:11:53 2010
@@ -17,12 +17,14 @@
 package org.apache.jackrabbit.webdav.jcr.version.report;
 
 import org.apache.jackrabbit.commons.iterator.NodeTypeIteratorAdapter;
+import org.apache.jackrabbit.commons.webdav.JcrRemotingConstants;
+import org.apache.jackrabbit.commons.webdav.NodeTypeConstants;
 import org.apache.jackrabbit.webdav.DavException;
 import org.apache.jackrabbit.webdav.DavResource;
 import org.apache.jackrabbit.webdav.DavServletResponse;
+import org.apache.jackrabbit.webdav.jcr.ItemResourceConstants;
 import org.apache.jackrabbit.webdav.jcr.JcrDavException;
 import org.apache.jackrabbit.webdav.jcr.nodetype.NodeDefinitionImpl;
-import org.apache.jackrabbit.webdav.jcr.nodetype.NodeTypeConstants;
 import org.apache.jackrabbit.webdav.jcr.nodetype.PropertyDefinitionImpl;
 import org.apache.jackrabbit.webdav.version.report.Report;
 import org.apache.jackrabbit.webdav.version.report.ReportInfo;
@@ -56,8 +58,6 @@ import java.util.List;
  * &lt;!ELEMENT mixin-nodetypes EMPTY &gt;
  * &lt;!ELEMENT primary-nodetypes EMPTY &gt;
  * </pre>
- *
- * @see NodeTypeConstants#NAMESPACE
  */
 //todo: currently the nodetype report is not consistent with the general way of representing nodetype names (with NodetypeElement) in order to be compatible with the jackrabbit nodetype registry...
 //todo: for the same reason, not the complete nodetype-definition, but only the nodetype def as stored is represented.
@@ -69,7 +69,7 @@ public class NodeTypesReport extends Abs
     /**
      * The registered type of this report.
      */
-    public static final ReportType NODETYPES_REPORT = ReportType.register("nodetypes", NodeTypeConstants.NAMESPACE, NodeTypesReport.class);
+    public static final ReportType NODETYPES_REPORT = ReportType.register(JcrRemotingConstants.REPORT_NODETYPES, ItemResourceConstants.NAMESPACE, NodeTypesReport.class);
 
     private NodeTypeIterator ntIter;
 
@@ -173,16 +173,16 @@ public class NodeTypesReport extends Abs
         NodeTypeManager ntMgr = session.getWorkspace().getNodeTypeManager();
 
         // check the simple types first...
-        if (info.containsContentElement(XML_REPORT_ALLNODETYPES, NAMESPACE)) {
+        if (info.containsContentElement(XML_REPORT_ALLNODETYPES, ItemResourceConstants.NAMESPACE)) {
             return ntMgr.getAllNodeTypes();
-        } else if (info.containsContentElement(XML_REPORT_MIXINNODETYPES, NAMESPACE)) {
+        } else if (info.containsContentElement(XML_REPORT_MIXINNODETYPES, ItemResourceConstants.NAMESPACE)) {
             return ntMgr.getMixinNodeTypes();
-        } else if (info.containsContentElement(XML_REPORT_PRIMARYNODETYPES, NAMESPACE)) {
+        } else if (info.containsContentElement(XML_REPORT_PRIMARYNODETYPES, ItemResourceConstants.NAMESPACE)) {
             return ntMgr.getPrimaryNodeTypes();
         } else {
             // None of the simple types. test if a report for individual
             // nodetype was request. If not, the request body is not valid.
-            List<Element> elemList = info.getContentElements(XML_NODETYPE, NAMESPACE);
+            List<Element> elemList = info.getContentElements(XML_NODETYPE, ItemResourceConstants.NAMESPACE);
             if (elemList.isEmpty()) {
                 // throw exception if the request body does not contain a single nodetype element
                 throw new DavException(DavServletResponse.SC_BAD_REQUEST, "NodeTypes report: request body has invalid format.");
@@ -191,7 +191,7 @@ public class NodeTypesReport extends Abs
             // todo: find better solution...
             List<NodeType> ntList = new ArrayList<NodeType>();
             for (Element el : elemList) {
-                String nodetypeName = DomUtil.getChildTextTrim(el, XML_NODETYPENAME, NAMESPACE);
+                String nodetypeName = DomUtil.getChildTextTrim(el, XML_NODETYPENAME, ItemResourceConstants.NAMESPACE);
                 if (nodetypeName != null) {
                     ntList.add(ntMgr.getNodeType(nodetypeName));
                 }

Modified: jackrabbit/trunk/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/webdav/jcr/version/report/RegisteredNamespacesReport.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/webdav/jcr/version/report/RegisteredNamespacesReport.java?rev=1002639&r1=1002638&r2=1002639&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/webdav/jcr/version/report/RegisteredNamespacesReport.java (original)
+++ jackrabbit/trunk/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/webdav/jcr/version/report/RegisteredNamespacesReport.java Wed Sep 29 14:11:53 2010
@@ -58,7 +58,7 @@ public class RegisteredNamespacesReport 
     /**
      * The registered type of this report.
      */
-    public static final ReportType REGISTERED_NAMESPACES_REPORT = ReportType.register("registerednamespaces", ItemResourceConstants.NAMESPACE, RegisteredNamespacesReport.class);
+    public static final ReportType REGISTERED_NAMESPACES_REPORT = ReportType.register(REPORT_REGISTERED_NAMESPACES, ItemResourceConstants.NAMESPACE, RegisteredNamespacesReport.class);
 
     private NamespaceRegistry nsReg;
 

Modified: jackrabbit/trunk/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/webdav/jcr/version/report/RepositoryDescriptorsReport.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/webdav/jcr/version/report/RepositoryDescriptorsReport.java?rev=1002639&r1=1002638&r2=1002639&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/webdav/jcr/version/report/RepositoryDescriptorsReport.java (original)
+++ jackrabbit/trunk/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/webdav/jcr/version/report/RepositoryDescriptorsReport.java Wed Sep 29 14:11:53 2010
@@ -65,7 +65,7 @@ public class RepositoryDescriptorsReport
     /**
      * The registered type of this report.
      */
-    public static final ReportType REPOSITORY_DESCRIPTORS_REPORT = ReportType.register("repositorydescriptors", ItemResourceConstants.NAMESPACE, RepositoryDescriptorsReport.class);
+    public static final ReportType REPOSITORY_DESCRIPTORS_REPORT = ReportType.register(REPORT_REPOSITORY_DESCRIPTORS, ItemResourceConstants.NAMESPACE, RepositoryDescriptorsReport.class);
 
     /**
      * Returns {@link #REPOSITORY_DESCRIPTORS_REPORT} type.

Modified: jackrabbit/trunk/jackrabbit-spi2dav/pom.xml
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-spi2dav/pom.xml?rev=1002639&r1=1002638&r2=1002639&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-spi2dav/pom.xml (original)
+++ jackrabbit/trunk/jackrabbit-spi2dav/pom.xml Wed Sep 29 14:11:53 2010
@@ -151,21 +151,6 @@
       <version>2.2-SNAPSHOT</version>
     </dependency>
     <dependency>
-      <groupId>org.apache.jackrabbit</groupId>
-      <artifactId>jackrabbit-jcr-server</artifactId>
-      <version>2.2-SNAPSHOT</version>
-      <exclusions>
-        <exclusion>
-          <groupId>org.apache.tika</groupId>
-          <artifactId>tika-core</artifactId>
-        </exclusion>
-        <exclusion>
-          <groupId>commons-fileupload</groupId>
-          <artifactId>commons-fileupload</artifactId>
-        </exclusion>
-      </exclusions>
-    </dependency>
-    <dependency>
       <groupId>javax.jcr</groupId>
       <artifactId>jcr</artifactId>
     </dependency>

Modified: jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/DefinitionUtil.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/DefinitionUtil.java?rev=1002639&r1=1002638&r2=1002639&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/DefinitionUtil.java (original)
+++ jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/DefinitionUtil.java Wed Sep 29 14:11:53 2010
@@ -16,6 +16,7 @@
  */
 package org.apache.jackrabbit.spi2dav;
 
+import org.apache.jackrabbit.commons.webdav.NodeTypeConstants;
 import org.apache.jackrabbit.spi.Name;
 import org.apache.jackrabbit.spi.QNodeDefinition;
 import org.apache.jackrabbit.spi.QNodeTypeDefinition;
@@ -32,7 +33,6 @@ import org.apache.jackrabbit.spi.commons
 import org.apache.jackrabbit.spi.commons.nodetype.constraint.ValueConstraint;
 import org.apache.jackrabbit.spi.commons.value.ValueFactoryQImpl;
 import org.apache.jackrabbit.spi.commons.value.ValueFormat;
-import org.apache.jackrabbit.webdav.jcr.nodetype.NodeTypeConstants;
 import org.apache.jackrabbit.webdav.xml.DomUtil;
 import org.apache.jackrabbit.webdav.xml.ElementIterator;
 import org.w3c.dom.Element;

Modified: jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/EventImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/EventImpl.java?rev=1002639&r1=1002638&r2=1002639&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/EventImpl.java (original)
+++ jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/EventImpl.java Wed Sep 29 14:11:53 2010
@@ -30,6 +30,7 @@ import org.apache.jackrabbit.spi.commons
 import org.apache.jackrabbit.webdav.observation.ObservationConstants;
 import org.apache.jackrabbit.webdav.xml.DomUtil;
 import org.apache.jackrabbit.webdav.xml.ElementIterator;
+import org.apache.jackrabbit.webdav.xml.Namespace;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.w3c.dom.Element;
@@ -96,6 +97,9 @@ public class EventImpl
         while (it.hasNext()) {
             Element el = it.nextElement();
             String uri = el.getNamespaceURI();
+            if (uri == null) {
+                uri = Namespace.EMPTY_NAMESPACE.getURI();
+            }
             String localName = el.getLocalName();
             String value = DomUtil.getTextTrim(el);
             try {

Modified: jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/ItemInfoImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/ItemInfoImpl.java?rev=1002639&r1=1002638&r2=1002639&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/ItemInfoImpl.java (original)
+++ jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/ItemInfoImpl.java Wed Sep 29 14:11:53 2010
@@ -16,15 +16,13 @@
  */
 package org.apache.jackrabbit.spi2dav;
 
+import org.apache.jackrabbit.commons.webdav.JcrRemotingConstants;
 import org.apache.jackrabbit.spi.ItemInfo;
 import org.apache.jackrabbit.spi.Path;
-import org.apache.jackrabbit.webdav.property.DavPropertySet;
-import org.apache.jackrabbit.webdav.property.DavProperty;
-import org.apache.jackrabbit.webdav.jcr.ItemResourceConstants;
-import org.apache.jackrabbit.spi.commons.conversion.NamePathResolver;
 import org.apache.jackrabbit.spi.commons.conversion.NameException;
-import org.slf4j.LoggerFactory;
-import org.slf4j.Logger;
+import org.apache.jackrabbit.spi.commons.conversion.NamePathResolver;
+import org.apache.jackrabbit.webdav.property.DavProperty;
+import org.apache.jackrabbit.webdav.property.DavPropertySet;
 
 import javax.jcr.NamespaceException;
 
@@ -33,8 +31,6 @@ import javax.jcr.NamespaceException;
  */
 abstract class ItemInfoImpl implements ItemInfo {
 
-    private static Logger log = LoggerFactory.getLogger(ItemInfoImpl.class);
-
     private final Path path;
 
     ItemInfoImpl(Path path) {
@@ -44,7 +40,7 @@ abstract class ItemInfoImpl implements I
     ItemInfoImpl(DavPropertySet propSet, NamePathResolver resolver)
             throws NameException, NamespaceException {
 
-        DavProperty<?> pathProp = propSet.get(ItemResourceConstants.JCR_PATH);
+        DavProperty<?> pathProp = propSet.get(JcrRemotingConstants.JCR_PATH_LN, ItemResourceConstants.NAMESPACE);
         String jcrPath = pathProp.getValue().toString();
         path = resolver.getQPath(jcrPath);
     }

Copied: jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/ItemResourceConstants.java (from r987195, jackrabbit/trunk/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/webdav/jcr/ItemResourceConstants.java)
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/ItemResourceConstants.java?p2=jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/ItemResourceConstants.java&p1=jackrabbit/trunk/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/webdav/jcr/ItemResourceConstants.java&r1=987195&r2=1002639&rev=1002639&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/webdav/jcr/ItemResourceConstants.java (original)
+++ jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/ItemResourceConstants.java Wed Sep 29 14:11:53 2010
@@ -14,72 +14,22 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.jackrabbit.webdav.jcr;
+package org.apache.jackrabbit.spi2dav;
 
-import org.apache.jackrabbit.webdav.DavResource;
+import org.apache.jackrabbit.commons.webdav.JcrRemotingConstants;
 import org.apache.jackrabbit.webdav.lock.Scope;
-import org.apache.jackrabbit.webdav.observation.ObservationResource;
-import org.apache.jackrabbit.webdav.property.DavPropertyName;
-import org.apache.jackrabbit.webdav.search.SearchResource;
-import org.apache.jackrabbit.webdav.security.Privilege;
-import org.apache.jackrabbit.webdav.version.DeltaVResource;
 import org.apache.jackrabbit.webdav.xml.Namespace;
 
-import javax.jcr.PropertyType;
-
 /**
  * <code>ItemResourceConstants</code> provides constants for any resources
  * representing repository items.
  */
-public interface ItemResourceConstants {
-
-    /**
-     * Methods common to all item resources.
-     */
-    public static final String METHODS = DavResource.METHODS + ", " + ObservationResource.METHODS + ", " + SearchResource.METHODS + ", " +DeltaVResource.METHODS;
-
-    /**
-     * The resource path of the root-item-resource.
-     */
-    public static final String ROOT_ITEM_PATH = "/";
-    /**
-     * Placeholder resource path for the JCR root node.
-     */
-    public static final String ROOT_ITEM_RESOURCEPATH = "/jcr:root";
-
-    /**
-     * The version storage item resource path.
-     */
-    public static final String VERSIONSTORAGE_PATH = "/jcr:system/jcr:versionStorage";
+public interface ItemResourceConstants extends JcrRemotingConstants {
 
     /**
      * The namespace for all jcr specific extensions.
      */
-    public static final Namespace NAMESPACE = Namespace.getNamespace("dcr", "http://www.day.com/jcr/webdav/1.0");
-
-    public static final String IMPORT_UUID_BEHAVIOR = "ImportUUIDBehavior";
-
-    // xml element names
-    public static final String XML_PRIMARYNODETYPE = "primarynodetype";
-    public static final String XML_VALUE = "value";
-    /**
-     * 'type' attribute for the {@link #XML_VALUE value} element, reflecting the
-     * {@link PropertyType type} of the value being transported.
-     */
-    public static final String ATTR_VALUE_TYPE = "type";
-    public static final String XML_LENGTH = "length";
-    public static final String XML_EXCLUSIVE_SESSION_SCOPED = "exclusive-session-scoped";
-
-    // xml elements used to reflect the workspaces ns-registry
-    // TODO: to be reviewed...
-    public static final String XML_NAMESPACE = "namespace";
-    public static final String XML_PREFIX = "prefix";
-    public static final String XML_URI = "uri";
-
-    // xml elements used for repository-descriptors report
-    public static final String XML_DESCRIPTOR = "descriptor";
-    public static final String XML_DESCRIPTORKEY = "descriptorkey";
-    public static final String XML_DESCRIPTORVALUE = "descriptorvalue";
+    public static final Namespace NAMESPACE = Namespace.getNamespace(NS_PREFIX, NS_URI);
 
     /**
      * Extension to the WebDAV 'exclusive' lock, that allows to distinguish
@@ -88,82 +38,4 @@ public interface ItemResourceConstants {
      * @see javax.jcr.Node#lock(boolean, boolean)
      */
     public static final Scope EXCLUSIVE_SESSION = Scope.create(XML_EXCLUSIVE_SESSION_SCOPED, NAMESPACE);
-
-    /**
-     * The 'removeexisting' element is not defined by RFC 3253. If it is present
-     * in the UPDATE request body, uuid conflicts should be solved by removing
-     * the existing nodes.
-     *
-     * @see javax.jcr.Node#restore(javax.jcr.version.Version, boolean)
-     * @see javax.jcr.Workspace#restore(javax.jcr.version.Version[], boolean)
-     * @see org.apache.jackrabbit.webdav.version.UpdateInfo
-     */
-    public static final String XML_REMOVEEXISTING = "removeexisting";
-
-    /**
-     * The 'relpath' element is not defined by RFC 3253. If it is present
-     * in the UPDATE request body, the server is forced to used the text contained
-     * as 'relPath' argument for the {@link javax.jcr.Node#restore(javax.jcr.version.Version, String, boolean)
-     * Node.restore} call.
-     *
-     * @see javax.jcr.Node#restore(javax.jcr.version.Version, String, boolean)
-     * @see org.apache.jackrabbit.webdav.version.UpdateInfo
-     */
-    public static final String XML_RELPATH = "relpath";
-
-    // name of the workspace for which the repository session has been created.
-    public static final DavPropertyName JCR_WORKSPACE_NAME = DavPropertyName.create("workspaceName", NAMESPACE);
-
-    // general property names
-    public static final DavPropertyName JCR_NAME = DavPropertyName.create("name", NAMESPACE);
-    public static final DavPropertyName JCR_PATH = DavPropertyName.create("path", NAMESPACE);
-    public static final DavPropertyName JCR_DEPTH = DavPropertyName.create("depth", NAMESPACE);
-    public static final DavPropertyName JCR_PARENT = DavPropertyName.create("parent", NAMESPACE);
-    public static final DavPropertyName JCR_ISNEW = DavPropertyName.create("isnew", NAMESPACE);
-    public static final DavPropertyName JCR_ISMODIFIED = DavPropertyName.create("ismodified", NAMESPACE);
-    public static final DavPropertyName JCR_DEFINITION = DavPropertyName.create("definition", NAMESPACE);
-    public static final DavPropertyName JCR_SELECTOR_NAME = DavPropertyName.create("selectorName", NAMESPACE);
-
-    // property names used for resources representing jcr-nodes
-    public static final DavPropertyName JCR_PRIMARYNODETYPE = DavPropertyName.create(XML_PRIMARYNODETYPE, NAMESPACE);
-    public static final DavPropertyName JCR_MIXINNODETYPES = DavPropertyName.create("mixinnodetypes", NAMESPACE);
-    public static final DavPropertyName JCR_INDEX = DavPropertyName.create("index", NAMESPACE);
-    public static final DavPropertyName JCR_REFERENCES = DavPropertyName.create("references", NAMESPACE);
-    /**
-     * @since JCR 2.0
-     */
-    public static final DavPropertyName JCR_WEAK_REFERENCES = DavPropertyName.create("weakreferences", NAMESPACE);
-    public static final DavPropertyName JCR_UUID = DavPropertyName.create("uuid", NAMESPACE);
-    public static final DavPropertyName JCR_PRIMARYITEM = DavPropertyName.create("primaryitem", NAMESPACE);
-
-    // property names used for resources representing jcr-properties
-    public static final DavPropertyName JCR_TYPE = DavPropertyName.create("type", NAMESPACE);
-    public static final DavPropertyName JCR_VALUE = DavPropertyName.create("value", NAMESPACE);
-    public static final DavPropertyName JCR_VALUES = DavPropertyName.create("values", NAMESPACE);
-    public static final DavPropertyName JCR_LENGTH = DavPropertyName.create("length", NAMESPACE);
-    public static final DavPropertyName JCR_LENGTHS = DavPropertyName.create("lengths", NAMESPACE);
-
-    // property names used for resource representing a workspace
-    public static final DavPropertyName JCR_NAMESPACES = DavPropertyName.create("namespaces", NAMESPACE);
-
-    // property names used for resource representing a version history
-    public static final DavPropertyName JCR_VERSIONABLEUUID = DavPropertyName.create("versionableuuid", NAMESPACE);
-
-    //-----------------------------------------< JSR170 specific privileges >---
-    /**
-     * Privilege representing the JSR170 'read' action.
-     */
-    public static final Privilege PRIVILEGE_JCR_READ = Privilege.getPrivilege("read", NAMESPACE);
-    /**
-     * Privilege representing the JSR170 'add_node' action.
-     */
-    public static final Privilege PRIVILEGE_JCR_ADD_NODE = Privilege.getPrivilege("add_node", NAMESPACE);
-    /**
-     * Privilege representing the JSR170 'set_property' action.
-     */
-    public static final Privilege PRIVILEGE_JCR_SET_PROPERTY = Privilege.getPrivilege("set_property", NAMESPACE);
-    /**
-     * Privilege representing the JSR170 'remove' action.
-     */
-    public static final Privilege PRIVILEGE_JCR_REMOVE = Privilege.getPrivilege("remove", NAMESPACE);
-}
+}
\ No newline at end of file

Modified: jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/LockInfoImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/LockInfoImpl.java?rev=1002639&r1=1002638&r2=1002639&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/LockInfoImpl.java (original)
+++ jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/LockInfoImpl.java Wed Sep 29 14:11:53 2010
@@ -16,7 +16,6 @@
 package org.apache.jackrabbit.spi2dav;
 
 import org.apache.jackrabbit.webdav.lock.ActiveLock;
-import org.apache.jackrabbit.webdav.jcr.ItemResourceConstants;
 import org.apache.jackrabbit.webdav.DavConstants;
 import org.apache.jackrabbit.spi.LockInfo;
 import org.apache.jackrabbit.spi.NodeId;
@@ -56,7 +55,7 @@ public class LockInfoImpl implements Loc
     }
 
     public boolean isSessionScoped() {
-        return activeLock.getScope() == ItemResourceConstants.EXCLUSIVE_SESSION;
+        return ItemResourceConstants.EXCLUSIVE_SESSION.equals(activeLock.getScope());
     }
 
     public long getSecondsRemaining() {

Modified: jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/NodeInfoImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/NodeInfoImpl.java?rev=1002639&r1=1002638&r2=1002639&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/NodeInfoImpl.java (original)
+++ jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/NodeInfoImpl.java Wed Sep 29 14:11:53 2010
@@ -16,8 +16,8 @@
  */
 package org.apache.jackrabbit.spi2dav;
 
-import org.apache.jackrabbit.webdav.jcr.nodetype.NodeTypeProperty;
-import org.apache.jackrabbit.webdav.jcr.ItemResourceConstants;
+import org.apache.jackrabbit.commons.webdav.JcrRemotingConstants;
+import org.apache.jackrabbit.commons.webdav.NodeTypeUtil;
 import org.apache.jackrabbit.webdav.property.DavPropertySet;
 import org.apache.jackrabbit.webdav.property.DavProperty;
 import org.apache.jackrabbit.spi.commons.conversion.NameException;
@@ -32,9 +32,9 @@ import org.slf4j.LoggerFactory;
 import org.slf4j.Logger;
 
 import javax.jcr.RepositoryException;
+import java.util.Collection;
 import java.util.List;
 import java.util.Iterator;
-import java.util.Set;
 import java.util.ArrayList;
 
 /**
@@ -61,7 +61,7 @@ public class NodeInfoImpl extends ItemIn
         // set id
         this.id = id;
 
-        DavProperty<?> indexProp = propSet.get(ItemResourceConstants.JCR_INDEX);
+        DavProperty<?> indexProp = propSet.get(JcrRemotingConstants.JCR_INDEX_LN, ItemResourceConstants.NAMESPACE);
         if (indexProp != null && indexProp.getValue() != null) {
             index = Integer.parseInt(indexProp.getValue().toString());
         } else {
@@ -70,8 +70,9 @@ public class NodeInfoImpl extends ItemIn
 
         // retrieve properties
         try {
-            if (propSet.contains(ItemResourceConstants.JCR_PRIMARYNODETYPE)) {
-                Iterator<String> it = new NodeTypeProperty(propSet.get(ItemResourceConstants.JCR_PRIMARYNODETYPE)).getNodeTypeNames().iterator();
+            DavProperty<?> prop = propSet.get(JcrRemotingConstants.JCR_PRIMARYNODETYPE_LN, ItemResourceConstants.NAMESPACE);
+            if (prop != null) {
+                Iterator<String> it = NodeTypeUtil.ntNamesFromXml(prop.getValue()).iterator();
                 if (it.hasNext()) {
                     String jcrName = it.next();
                     primaryNodeTypeName = resolver.getQName(jcrName);
@@ -81,8 +82,10 @@ public class NodeInfoImpl extends ItemIn
             } else {
                 throw new RepositoryException("Missing primary nodetype for node " + id);
             }
-            if (propSet.contains(ItemResourceConstants.JCR_MIXINNODETYPES)) {
-                Set<String> mixinNames = new NodeTypeProperty(propSet.get(ItemResourceConstants.JCR_MIXINNODETYPES)).getNodeTypeNames();
+
+            prop = propSet.get(JcrRemotingConstants.JCR_MIXINNODETYPES_LN, ItemResourceConstants.NAMESPACE);
+            if (prop != null) {
+                Collection<String> mixinNames = NodeTypeUtil.ntNamesFromXml(prop.getValue());
                 mixinNodeTypeNames = new Name[mixinNames.size()];
                 int i = 0;
                 for (String jcrName : mixinNames) {

Modified: jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/PropertyInfoImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/PropertyInfoImpl.java?rev=1002639&r1=1002638&r2=1002639&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/PropertyInfoImpl.java (original)
+++ jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/PropertyInfoImpl.java Wed Sep 29 14:11:53 2010
@@ -16,6 +16,8 @@
  */
 package org.apache.jackrabbit.spi2dav;
 
+import org.apache.jackrabbit.commons.webdav.JcrRemotingConstants;
+import org.apache.jackrabbit.commons.webdav.ValueUtil;
 import org.apache.jackrabbit.spi.Path;
 import org.apache.jackrabbit.spi.PropertyId;
 import org.apache.jackrabbit.spi.PropertyInfo;
@@ -24,9 +26,7 @@ import org.apache.jackrabbit.spi.QValueF
 import org.apache.jackrabbit.spi.commons.conversion.NameException;
 import org.apache.jackrabbit.spi.commons.conversion.NamePathResolver;
 import org.apache.jackrabbit.spi.commons.value.ValueFormat;
-import org.apache.jackrabbit.webdav.DavException;
-import org.apache.jackrabbit.webdav.jcr.ItemResourceConstants;
-import org.apache.jackrabbit.webdav.jcr.property.ValuesProperty;
+import org.apache.jackrabbit.webdav.property.DavProperty;
 import org.apache.jackrabbit.webdav.property.DavPropertySet;
 
 import javax.jcr.PropertyType;
@@ -58,36 +58,39 @@ public class PropertyInfoImpl extends It
     public PropertyInfoImpl(PropertyId id, DavPropertySet propSet,
                             NamePathResolver resolver, ValueFactory valueFactory,
                             QValueFactory qValueFactory)
-            throws RepositoryException, DavException, IOException, NameException {
+            throws RepositoryException, IOException, NameException {
 
         super(propSet, resolver);
         // set id
         this.id = id;
 
         // retrieve properties
-        String typeName = propSet.get(ItemResourceConstants.JCR_TYPE).getValue().toString();
+        String typeName = propSet.get(JcrRemotingConstants.JCR_TYPE_LN, ItemResourceConstants.NAMESPACE).getValue().toString();
         type = PropertyType.valueFromName(typeName);
 
         // values from jcr-server must be converted to SPI values.
-        if (propSet.contains(ItemResourceConstants.JCR_VALUE)) {
-            ValuesProperty vp = new ValuesProperty(propSet.get(ItemResourceConstants.JCR_VALUE), type, valueFactory);
-            Value jcrValue = vp.getJcrValue(type, valueFactory);
-            if (jcrValue == null) {
+        DavProperty<?> prop = propSet.get(JcrRemotingConstants.JCR_VALUE_LN, ItemResourceConstants.NAMESPACE);
+        if (prop != null) {
+            Value[] jcrValues = ValueUtil.valuesFromXml(prop.getValue(), type, valueFactory);
+            if (jcrValues == null || jcrValues.length == 0) {
                 // TODO: should never occur. since 'null' single values are not allowed. rather throw?
                 values = QValue.EMPTY_ARRAY;
             } else {
                 QValue qv;
                 if (type == PropertyType.BINARY) {
-                    qv = qValueFactory.create(jcrValue.getStream());
+                    qv = qValueFactory.create(jcrValues[0].getStream());
                 } else {
-                    qv = ValueFormat.getQValue(jcrValue, resolver, qValueFactory);
+                    qv = ValueFormat.getQValue(jcrValues[0], resolver, qValueFactory);
                 }
                 values = new QValue[] {qv};
             }
         } else {
             isMultiValued = true;
-            ValuesProperty vp = new ValuesProperty(propSet.get(ItemResourceConstants.JCR_VALUES), type, valueFactory);
-            Value[] jcrValues = vp.getJcrValues(type, valueFactory);
+            prop = propSet.get(JcrRemotingConstants.JCR_VALUES_LN, ItemResourceConstants.NAMESPACE);
+            if (prop == null) {
+                throw new RepositoryException("Item with id " + id.toString() + " doesn't represent a valid property.");
+            }
+            Value[] jcrValues = ValueUtil.valuesFromXml(prop.getValue(), type, valueFactory);
             values = new QValue[jcrValues.length];
             for (int i = 0; i < jcrValues.length; i++) {
                 if (type == PropertyType.BINARY) {

Modified: jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/QueryResultRowImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/QueryResultRowImpl.java?rev=1002639&r1=1002638&r2=1002639&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/QueryResultRowImpl.java (original)
+++ jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/QueryResultRowImpl.java Wed Sep 29 14:11:53 2010
@@ -16,13 +16,17 @@
  */
 package org.apache.jackrabbit.spi2dav;
 
+import java.util.ArrayList;
+import java.util.List;
 import java.util.Map;
 import java.util.HashMap;
 
-import javax.jcr.Value;
 import javax.jcr.RepositoryException;
+import javax.jcr.Value;
 import javax.jcr.ValueFactory;
 
+import org.apache.jackrabbit.commons.webdav.JcrRemotingConstants;
+import org.apache.jackrabbit.commons.webdav.QueryUtil;
 import org.apache.jackrabbit.spi.QueryResultRow;
 import org.apache.jackrabbit.spi.NodeId;
 import org.apache.jackrabbit.spi.Name;
@@ -32,22 +36,24 @@ import org.apache.jackrabbit.spi.IdFacto
 import org.apache.jackrabbit.spi.commons.value.ValueFormat;
 import org.apache.jackrabbit.spi.commons.conversion.NamePathResolver;
 import org.apache.jackrabbit.spi.commons.name.NameConstants;
+import org.apache.jackrabbit.webdav.property.DavPropertyName;
 import org.apache.jackrabbit.webdav.property.DavPropertySet;
 import org.apache.jackrabbit.webdav.property.DavProperty;
 import org.apache.jackrabbit.webdav.DavServletResponse;
 import org.apache.jackrabbit.webdav.MultiStatusResponse;
-import org.apache.jackrabbit.webdav.jcr.search.SearchResultProperty;
 import org.slf4j.LoggerFactory;
 import org.slf4j.Logger;
 
 /**
  * <code>QueryResultRowImpl</code> implements a QueryResultRow that is
- * initialized from a multi status response.
+ * initialized from a multistatus response.
  */
 public class QueryResultRowImpl implements QueryResultRow {
 
     private static final Logger log = LoggerFactory.getLogger(QueryResultRowImpl.class);
 
+    private static final DavPropertyName SEARCH_RESULT_PROPERTY = DavPropertyName.create(JcrRemotingConstants.JCR_QUERY_RESULT_LN, ItemResourceConstants.NAMESPACE);
+
     private final Map<Name, NodeId> nodeIds = new HashMap<Name, NodeId>();
 
     private final Map<Name, Double> scores = new HashMap<Name, Double>();
@@ -70,16 +76,22 @@ public class QueryResultRowImpl implemen
 
         String jcrPath = resolver.getJCRName(NameConstants.JCR_PATH);
         String jcrScore = resolver.getJCRName(NameConstants.JCR_SCORE);
-        DavProperty<?> davProp = okSet.get(SearchResultProperty.SEARCH_RESULT_PROPERTY);
-        SearchResultProperty resultProp = new SearchResultProperty(davProp, valueFactory);
-        Value[] values = resultProp.getValues();
-        String[] names = resultProp.getColumnNames();
-        String[] selectorNames = resultProp.getSelectorNames();
-        this.selectorNames = new Name[selectorNames.length];
+        DavProperty<?> davProp = okSet.get(SEARCH_RESULT_PROPERTY);
+
+        List<String> colList = new ArrayList<String>();
+        List<String> selList = new ArrayList<String>();
+        List<Value> valList = new ArrayList<Value>();
+        QueryUtil.parseResultPropertyValue(davProp.getValue(), colList, selList, valList, valueFactory);
+
+        String[] names = colList.toArray(new String[colList.size()]);
+        Value[] values = valList.toArray(new Value[valList.size()]);
+
+        this.selectorNames = new Name[selList.size()];
         for (int i = 0; i < values.length; i++) {
             try {
+                String selectorName = selList.get(i);
                 QValue v = (values[i] == null) ? null : ValueFormat.getQValue(values[i], resolver, qValueFactory);
-                this.selectorNames[i] = (selectorNames[i] == null) ? null : resolver.getQName(selectorNames[i]);
+                this.selectorNames[i] = (selectorName == null) ? null : resolver.getQName(selectorName);
                 if (jcrScore.equals(names[i])) {
                     Double score = 0.0;
                     if (v != null) {

Modified: jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/RepositoryServiceImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/RepositoryServiceImpl.java?rev=1002639&r1=1002638&r2=1002639&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/RepositoryServiceImpl.java (original)
+++ jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/RepositoryServiceImpl.java Wed Sep 29 14:11:53 2010
@@ -69,6 +69,12 @@ import org.apache.commons.httpclient.met
 import org.apache.commons.httpclient.methods.InputStreamRequestEntity;
 import org.apache.commons.httpclient.methods.RequestEntity;
 import org.apache.commons.httpclient.methods.StringRequestEntity;
+import org.apache.jackrabbit.commons.webdav.EventUtil;
+import org.apache.jackrabbit.commons.webdav.JcrRemotingConstants;
+import org.apache.jackrabbit.commons.webdav.JcrValueType;
+import org.apache.jackrabbit.commons.webdav.NodeTypeConstants;
+import org.apache.jackrabbit.commons.webdav.NodeTypeUtil;
+import org.apache.jackrabbit.commons.webdav.ValueUtil;
 import org.apache.jackrabbit.spi.Batch;
 import org.apache.jackrabbit.spi.ChildInfo;
 import org.apache.jackrabbit.spi.Event;
@@ -148,17 +154,6 @@ import org.apache.jackrabbit.webdav.clie
 import org.apache.jackrabbit.webdav.client.methods.UpdateMethod;
 import org.apache.jackrabbit.webdav.header.CodedUrlHeader;
 import org.apache.jackrabbit.webdav.header.IfHeader;
-import org.apache.jackrabbit.webdav.jcr.ItemResourceConstants;
-import org.apache.jackrabbit.webdav.jcr.JcrValueType;
-import org.apache.jackrabbit.webdav.jcr.nodetype.NodeTypeConstants;
-import org.apache.jackrabbit.webdav.jcr.nodetype.NodeTypeProperty;
-import org.apache.jackrabbit.webdav.jcr.observation.SubscriptionImpl;
-import org.apache.jackrabbit.webdav.jcr.property.NamespacesProperty;
-import org.apache.jackrabbit.webdav.jcr.property.ValuesProperty;
-import org.apache.jackrabbit.webdav.jcr.version.report.JcrPrivilegeReport;
-import org.apache.jackrabbit.webdav.jcr.version.report.NodeTypesReport;
-import org.apache.jackrabbit.webdav.jcr.version.report.RegisteredNamespacesReport;
-import org.apache.jackrabbit.webdav.jcr.version.report.RepositoryDescriptorsReport;
 import org.apache.jackrabbit.webdav.lock.ActiveLock;
 import org.apache.jackrabbit.webdav.lock.LockDiscovery;
 import org.apache.jackrabbit.webdav.lock.Scope;
@@ -191,6 +186,7 @@ import org.apache.jackrabbit.webdav.vers
 import org.apache.jackrabbit.webdav.xml.DomUtil;
 import org.apache.jackrabbit.webdav.xml.ElementIterator;
 import org.apache.jackrabbit.webdav.xml.Namespace;
+import org.apache.jackrabbit.webdav.xml.XmlSerializable;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.w3c.dom.Document;
@@ -206,7 +202,7 @@ public class RepositoryServiceImpl imple
 
     private static Logger log = LoggerFactory.getLogger(RepositoryServiceImpl.class);
 
-    private static final SubscriptionInfo S_INFO = new SubscriptionInfo(SubscriptionImpl.getAllEventTypes(), true, INFINITE_TIMEOUT);
+    private static final SubscriptionInfo S_INFO = new SubscriptionInfo(DefaultEventType.create(EventUtil.EVENT_ALL, ItemResourceConstants.NAMESPACE), true, INFINITE_TIMEOUT);
 
     private final IdFactory idFactory;
     private final NameFactory nameFactory;
@@ -420,8 +416,9 @@ public class RepositoryServiceImpl imple
     private NodeId getParentId(DavPropertySet propSet, SessionInfo sessionInfo)
         throws RepositoryException {
         NodeId parentId = null;
-        if (propSet.contains(ItemResourceConstants.JCR_PARENT)) {
-            HrefProperty parentProp = new HrefProperty(propSet.get(ItemResourceConstants.JCR_PARENT));
+        DavProperty<?> p = propSet.get(JcrRemotingConstants.JCR_PARENT_LN, ItemResourceConstants.NAMESPACE);
+        if (p != null) {
+            HrefProperty parentProp = new HrefProperty(p);
             String parentHref = parentProp.getHrefs().get(0);
             if (parentHref != null && parentHref.length() > 0) {
                 parentId = uriResolver.getNodeId(parentHref, sessionInfo);
@@ -431,15 +428,16 @@ public class RepositoryServiceImpl imple
     }
 
     String getUniqueID(DavPropertySet propSet) {
-        if (propSet.contains(ItemResourceConstants.JCR_UUID)) {
-            return propSet.get(ItemResourceConstants.JCR_UUID).getValue().toString();
+        DavProperty<?> prop = propSet.get(JcrRemotingConstants.JCR_UUID_LN, ItemResourceConstants.NAMESPACE);
+        if (prop != null) {
+            return prop.getValue().toString();
         } else {
             return null;
         }
     }
 
     Name getQName(DavPropertySet propSet, NamePathResolver resolver) throws RepositoryException {
-        DavProperty<?> nameProp = propSet.get(ItemResourceConstants.JCR_NAME);
+        DavProperty<?> nameProp = propSet.get(JcrRemotingConstants.JCR_NAME_LN, ItemResourceConstants.NAMESPACE);
         if (nameProp != null && nameProp.getValue() != null) {
             // not root node. Note that 'unespacing' is not required since
             // the jcr:name property does not provide the value in escaped form.
@@ -456,7 +454,7 @@ public class RepositoryServiceImpl imple
 
     int getIndex(DavPropertySet propSet) {
         int index = Path.INDEX_UNDEFINED;
-        DavProperty<?> indexProp = propSet.get(ItemResourceConstants.JCR_INDEX);
+        DavProperty<?> indexProp = propSet.get(JcrRemotingConstants.JCR_INDEX_LN, ItemResourceConstants.NAMESPACE);
         if (indexProp != null && indexProp.getValue() != null) {
             index = Integer.parseInt(indexProp.getValue().toString());
         }
@@ -524,7 +522,7 @@ public class RepositoryServiceImpl imple
      */
     public Map<String, QValue[]> getRepositoryDescriptors() throws RepositoryException {
         if (descriptors == null) {
-            ReportInfo info = new ReportInfo(RepositoryDescriptorsReport.REPOSITORY_DESCRIPTORS_REPORT, DEPTH_0);
+            ReportInfo info = new ReportInfo(JcrRemotingConstants.REPORT_REPOSITORY_DESCRIPTORS, ItemResourceConstants.NAMESPACE);
             ReportMethod method = null;
             try {
                 method = new ReportMethod(uriResolver.getRepositoryUri(), info);
@@ -535,17 +533,17 @@ public class RepositoryServiceImpl imple
                 descriptors = new HashMap<String, QValue[]>();
                 if (doc != null) {
                     Element rootElement = doc.getDocumentElement();
-                    ElementIterator nsElems = DomUtil.getChildren(rootElement, ItemResourceConstants.XML_DESCRIPTOR, ItemResourceConstants.NAMESPACE);
+                    ElementIterator nsElems = DomUtil.getChildren(rootElement, JcrRemotingConstants.XML_DESCRIPTOR, ItemResourceConstants.NAMESPACE);
                     while (nsElems.hasNext()) {
                         Element elem = nsElems.nextElement();
-                        String key = DomUtil.getChildText(elem, ItemResourceConstants.XML_DESCRIPTORKEY, ItemResourceConstants.NAMESPACE);
-                        ElementIterator it = DomUtil.getChildren(elem, ItemResourceConstants.XML_DESCRIPTORVALUE, ItemResourceConstants.NAMESPACE);
+                        String key = DomUtil.getChildText(elem, JcrRemotingConstants.XML_DESCRIPTORKEY, ItemResourceConstants.NAMESPACE);
+                        ElementIterator it = DomUtil.getChildren(elem, JcrRemotingConstants.XML_DESCRIPTORVALUE, ItemResourceConstants.NAMESPACE);
                         List<QValue> vs = new ArrayList<QValue>();
                         while (it.hasNext()) {
                             Element dv = it.nextElement();
                             String descriptor = DomUtil.getText(dv);
                             if (key != null && descriptor != null) {
-                                String typeStr = (DomUtil.getAttribute(dv, ItemResourceConstants.ATTR_VALUE_TYPE, null));
+                                String typeStr = (DomUtil.getAttribute(dv, JcrRemotingConstants.ATTR_VALUE_TYPE, null));
                                 int type = (typeStr == null) ? PropertyType.STRING : PropertyType.valueFromName(typeStr);
                                 vs.add(getQValueFactory().create(descriptor, type));
                             } else {
@@ -598,7 +596,7 @@ public class RepositoryServiceImpl imple
             // for backwards compat. -> retrieve DAV:workspace if the newly
             // added property (workspaceName) is not supported by the server.
             nameSet.add(DeltaVConstants.WORKSPACE);
-            nameSet.add(ItemResourceConstants.JCR_WORKSPACE_NAME);
+            nameSet.add(JcrRemotingConstants.JCR_WORKSPACE_NAME_LN, ItemResourceConstants.NAMESPACE);
 
             method = new PropFindMethod(uriResolver.getWorkspaceUri(workspaceName), nameSet, DEPTH_0);
             getClient(sessionInfo).executeMethod(method);
@@ -609,8 +607,9 @@ public class RepositoryServiceImpl imple
             }
 
             DavPropertySet props = responses[0].getProperties(DavServletResponse.SC_OK);
-            if (props.contains(ItemResourceConstants.JCR_WORKSPACE_NAME)) {
-                String wspName = props.get(ItemResourceConstants.JCR_WORKSPACE_NAME).getValue().toString();
+            DavProperty<?> prop = props.get(JcrRemotingConstants.JCR_WORKSPACE_NAME_LN, ItemResourceConstants.NAMESPACE);
+            if (prop != null) {
+                String wspName = prop.getValue().toString();
                 if (workspaceName == null) {
                     // login with 'null' workspace name -> retrieve the effective
                     // workspace name from the property and recreate the SessionInfo.
@@ -697,7 +696,7 @@ public class RepositoryServiceImpl imple
         ReportMethod method = null;
         try {
             String uri = getItemUri(itemId, sessionInfo);
-            ReportInfo reportInfo = new ReportInfo(JcrPrivilegeReport.PRIVILEGES_REPORT);
+            ReportInfo reportInfo = new ReportInfo(JcrRemotingConstants.REPORT_PRIVILEGES, ItemResourceConstants.NAMESPACE);
             reportInfo.setContentElement(DomUtil.hrefToXml(uri, domFactory));
 
             method = new ReportMethod(uriResolver.getWorkspaceUri(sessionInfo.getWorkspaceName()), reportInfo);
@@ -760,7 +759,7 @@ public class RepositoryServiceImpl imple
     private QItemDefinition getItemDefinition(SessionInfo sessionInfo, ItemId itemId) throws RepositoryException {
         // set of properties to be retrieved
         DavPropertyNameSet nameSet = new DavPropertyNameSet();
-        nameSet.add(ItemResourceConstants.JCR_DEFINITION);
+        nameSet.add(JcrRemotingConstants.JCR_DEFINITION_LN, ItemResourceConstants.NAMESPACE);
         nameSet.add(DavPropertyName.RESOURCETYPE);
 
         DavMethodBase method = null;
@@ -788,8 +787,8 @@ public class RepositoryServiceImpl imple
 
             // build the definition
             QItemDefinition definition = null;
-            if (propertySet.contains(ItemResourceConstants.JCR_DEFINITION)) {
-                DavProperty<?> prop = propertySet.get(ItemResourceConstants.JCR_DEFINITION);
+            DavProperty<?> prop = propertySet.get(JcrRemotingConstants.JCR_DEFINITION_LN, ItemResourceConstants.NAMESPACE);
+            if (prop != null) {
                 Object value = prop.getValue();
                 if (value != null && value instanceof Element) {
                     Element idfElem = (Element) value;
@@ -821,14 +820,14 @@ public class RepositoryServiceImpl imple
     public NodeInfo getNodeInfo(SessionInfo sessionInfo, NodeId nodeId) throws RepositoryException {
         // set of properties to be retrieved
         DavPropertyNameSet nameSet = new DavPropertyNameSet();
-        nameSet.add(ItemResourceConstants.JCR_INDEX);
-        nameSet.add(ItemResourceConstants.JCR_PARENT);
-        nameSet.add(ItemResourceConstants.JCR_NAME);
-        nameSet.add(ItemResourceConstants.JCR_PRIMARYNODETYPE);
-        nameSet.add(ItemResourceConstants.JCR_MIXINNODETYPES);
-        nameSet.add(ItemResourceConstants.JCR_REFERENCES);
-        nameSet.add(ItemResourceConstants.JCR_UUID);
-        nameSet.add(ItemResourceConstants.JCR_PATH);
+        nameSet.add(JcrRemotingConstants.JCR_INDEX_LN, ItemResourceConstants.NAMESPACE);
+        nameSet.add(JcrRemotingConstants.JCR_PARENT_LN, ItemResourceConstants.NAMESPACE);
+        nameSet.add(JcrRemotingConstants.JCR_NAME_LN, ItemResourceConstants.NAMESPACE);
+        nameSet.add(JcrRemotingConstants.JCR_PRIMARYNODETYPE_LN, ItemResourceConstants.NAMESPACE);
+        nameSet.add(JcrRemotingConstants.JCR_MIXINNODETYPES_LN, ItemResourceConstants.NAMESPACE);
+        nameSet.add(JcrRemotingConstants.JCR_REFERENCES_LN, ItemResourceConstants.NAMESPACE);
+        nameSet.add(JcrRemotingConstants.JCR_UUID_LN, ItemResourceConstants.NAMESPACE);
+        nameSet.add(JcrRemotingConstants.JCR_PATH_LN, ItemResourceConstants.NAMESPACE);
         nameSet.add(DavPropertyName.RESOURCETYPE);
 
         DavMethodBase method = null;
@@ -917,8 +916,9 @@ public class RepositoryServiceImpl imple
                                        NamePathResolver resolver) throws NameException, RepositoryException {
         NodeId id = uriResolver.buildNodeId(parentId, nodeResponse, sessionInfo.getWorkspaceName(), getNamePathResolver(sessionInfo));
         NodeInfoImpl nInfo = new NodeInfoImpl(id, propSet, resolver);
-        if (propSet.contains(ItemResourceConstants.JCR_REFERENCES)) {
-            HrefProperty refProp = new HrefProperty(propSet.get(ItemResourceConstants.JCR_REFERENCES));
+        DavProperty p = propSet.get(JcrRemotingConstants.JCR_REFERENCES_LN, ItemResourceConstants.NAMESPACE);
+        if (p != null) {
+            HrefProperty refProp = new HrefProperty(p);
             for (String propertyHref : refProp.getHrefs()) {
                 PropertyId propertyId = uriResolver.getPropertyId(propertyHref, sessionInfo);
                 nInfo.addReference(propertyId);
@@ -968,10 +968,10 @@ public class RepositoryServiceImpl imple
     public Iterator<ChildInfo> getChildInfos(SessionInfo sessionInfo, NodeId parentId) throws RepositoryException {
         // set of properties to be retrieved
         DavPropertyNameSet nameSet = new DavPropertyNameSet();
-        nameSet.add(ItemResourceConstants.JCR_NAME);
-        nameSet.add(ItemResourceConstants.JCR_INDEX);
-        nameSet.add(ItemResourceConstants.JCR_PARENT);
-        nameSet.add(ItemResourceConstants.JCR_UUID);
+        nameSet.add(JcrRemotingConstants.JCR_NAME_LN, ItemResourceConstants.NAMESPACE);
+        nameSet.add(JcrRemotingConstants.JCR_INDEX_LN, ItemResourceConstants.NAMESPACE);
+        nameSet.add(JcrRemotingConstants.JCR_PARENT_LN, ItemResourceConstants.NAMESPACE);
+        nameSet.add(JcrRemotingConstants.JCR_UUID_LN, ItemResourceConstants.NAMESPACE);
         nameSet.add(DavPropertyName.RESOURCETYPE);
 
         DavMethodBase method = null;
@@ -1028,9 +1028,9 @@ public class RepositoryServiceImpl imple
         // set of properties to be retrieved
         DavPropertyNameSet nameSet = new DavPropertyNameSet();
         if (weakReferences) {
-            nameSet.add(ItemResourceConstants.JCR_WEAK_REFERENCES);
+            nameSet.add(JcrRemotingConstants.JCR_WEAK_REFERENCES_LN, ItemResourceConstants.NAMESPACE);
         } else {
-            nameSet.add(ItemResourceConstants.JCR_REFERENCES);
+            nameSet.add(JcrRemotingConstants.JCR_REFERENCES_LN, ItemResourceConstants.NAMESPACE);
         }
 
         DavMethodBase method = null;
@@ -1051,9 +1051,9 @@ public class RepositoryServiceImpl imple
                     DavPropertySet props = resp.getProperties(DavServletResponse.SC_OK);
                     DavProperty<?> p;
                     if (weakReferences) {
-                        p = props.get(ItemResourceConstants.JCR_WEAK_REFERENCES);
+                        p = props.get(JcrRemotingConstants.JCR_WEAK_REFERENCES_LN, ItemResourceConstants.NAMESPACE);
                     } else {
-                        p = props.get(ItemResourceConstants.JCR_REFERENCES);
+                        p = props.get(JcrRemotingConstants.JCR_REFERENCES_LN, ItemResourceConstants.NAMESPACE);
                     }
 
                     if (p != null) {
@@ -1157,16 +1157,14 @@ public class RepositoryServiceImpl imple
     private QValue[] getValues(InputStream response, NamePathResolver resolver, ItemId id) throws RepositoryException {
         try {
             Document doc = DomUtil.parseDocument(response);
-            Element prop = DomUtil.getChildElement(doc, ItemResourceConstants.JCR_VALUES.getName(), ItemResourceConstants.JCR_VALUES.getNamespace());
+            Element prop = DomUtil.getChildElement(doc, JcrRemotingConstants.JCR_VALUES_LN, ItemResourceConstants.NAMESPACE);
             if (prop == null) {
                 // no jcr-values present in the response body -> apparently
                 // not representation of a jcr-property
                 throw new ItemNotFoundException("No property found at " + saveGetIdString(id, resolver));
             } else {
                 DavProperty<?> p = DefaultDavProperty.createFromXml(prop);
-                ValuesProperty vp = new ValuesProperty(p, PropertyType.STRING, valueFactory);
-
-                Value[] jcrVs = vp.getJcrValues();
+                Value[] jcrVs = ValueUtil.valuesFromXml(p.getValue(), PropertyType.STRING, valueFactory);
                 QValue[] qvs = new QValue[jcrVs.length];
                 int type = (jcrVs.length > 0) ? jcrVs[0].getType() : PropertyType.STRING;
 
@@ -1190,14 +1188,12 @@ public class RepositoryServiceImpl imple
         } catch (ParserConfigurationException e) {
             log.warn("Internal error: ", e.getMessage());
             throw new RepositoryException(e);
-        } catch (DavException e) {
-            throw ExceptionConverter.generate(e);
         }
     }
 
     private int loadType(String propertyURI, HttpClient client, PropertyId propertyId, NamePathResolver resolver) throws IOException, DavException, RepositoryException {
         DavPropertyNameSet nameSet = new DavPropertyNameSet();
-        nameSet.add(ItemResourceConstants.JCR_TYPE);
+        nameSet.add(JcrRemotingConstants.JCR_TYPE_LN, ItemResourceConstants.NAMESPACE);
 
         DavMethodBase method = null;
         try {
@@ -1208,7 +1204,7 @@ public class RepositoryServiceImpl imple
             MultiStatusResponse[] responses = method.getResponseBodyAsMultiStatus().getResponses();
             if (responses.length == 1) {
                 DavPropertySet props = responses[0].getProperties(DavServletResponse.SC_OK);
-                DavProperty<?> type = props.get(ItemResourceConstants.JCR_TYPE);
+                DavProperty<?> type = props.get(JcrRemotingConstants.JCR_TYPE_LN, ItemResourceConstants.NAMESPACE);
                 if (type != null) {
                     return PropertyType.valueFromName(type.getValue().toString());
                 } else {
@@ -1284,7 +1280,7 @@ public class RepositoryServiceImpl imple
         Name nodeName = getNameFactory().create(Name.NS_DEFAULT_URI, UUID.randomUUID().toString());
         String uri = getItemUri(parentId, nodeName, sessionInfo);
         MkColMethod method = new MkColMethod(uri);
-        method.addRequestHeader(ItemResourceConstants.IMPORT_UUID_BEHAVIOR, Integer.toString(uuidBehaviour));
+        method.addRequestHeader(JcrRemotingConstants.IMPORT_UUID_BEHAVIOR, Integer.toString(uuidBehaviour));
         method.setRequestEntity(new InputStreamRequestEntity(xmlStream, "text/xml"));
         execute(method, sessionInfo);
     }
@@ -1336,7 +1332,7 @@ public class RepositoryServiceImpl imple
         // set of Dav-properties to be retrieved
         DavPropertyNameSet nameSet = new DavPropertyNameSet();
         nameSet.add(DavPropertyName.LOCKDISCOVERY);
-        nameSet.add(ItemResourceConstants.JCR_PARENT);
+        nameSet.add(JcrRemotingConstants.JCR_PARENT_LN, ItemResourceConstants.NAMESPACE);
 
         PropFindMethod method = null;
         try {
@@ -1450,7 +1446,7 @@ public class RepositoryServiceImpl imple
         ActiveLock activeLock = null;
         for (ActiveLock l : activeLocks) {
             Scope sc = l.getScope();
-            if (l.getType() == Type.WRITE && (sc == Scope.EXCLUSIVE || sc == ItemResourceConstants.EXCLUSIVE_SESSION)) {
+            if (l.getType() == Type.WRITE && (Scope.EXCLUSIVE.equals(sc) || sc == ItemResourceConstants.EXCLUSIVE_SESSION)) {
                 if (activeLock != null) {
                     throw new RepositoryException("Node " + saveGetIdString(nodeId, sessionInfo) + " contains multiple exclusive write locks.");
                 } else {
@@ -1606,10 +1602,10 @@ public class RepositoryServiceImpl imple
             if (removeExisting || relPath != null) {
                 Element uElem = UpdateInfo.createUpdateElement(updateSource, updateType, domFactory);
                 if (removeExisting) {
-                    DomUtil.addChildElement(uElem, ItemResourceConstants.XML_REMOVEEXISTING, ItemResourceConstants.NAMESPACE);
+                    DomUtil.addChildElement(uElem, JcrRemotingConstants.XML_REMOVEEXISTING, ItemResourceConstants.NAMESPACE);
                 }
                 if (relPath != null) {
-                    DomUtil.addChildElement(uElem, ItemResourceConstants.XML_RELPATH, ItemResourceConstants.NAMESPACE, getNamePathResolver(sessionInfo).getJCRPath(relPath));
+                    DomUtil.addChildElement(uElem, JcrRemotingConstants.XML_RELPATH, ItemResourceConstants.NAMESPACE, getNamePathResolver(sessionInfo).getJCRPath(relPath));
                 }
 
                 uInfo = new UpdateInfo(uElem);
@@ -2018,21 +2014,16 @@ public class RepositoryServiceImpl imple
             EventType[] et = DefaultEventType.createFromXml(typeEl);
             if (et.length == 0 || et.length > 1) {
                 // should not occur.
-                log.error("Ambigous event type definition: expected one single eventtype.");
+                log.error("Ambiguous event type definition: expected one single event type.");
                 continue;
             }
 
             String href = DomUtil.getChildTextTrim(evElem, XML_HREF, NAMESPACE);
 
-            int type;
+            int type = EventUtil.getJcrEventType(et[0].getName());
             Path eventPath;
             try {
-                type = SubscriptionImpl.getJcrEventType(et[0]);
                 eventPath = uriResolver.getQPath(href, sessionInfo);
-            } catch (DavException e) {
-                // should not occur
-                log.error("Internal error while building Event", e.getMessage());
-                continue;
             } catch (RepositoryException e) {
                 // should not occur
                 log.error("Internal error while building Event", e.getMessage());
@@ -2068,7 +2059,7 @@ public class RepositoryServiceImpl imple
      * @see RepositoryService#getRegisteredNamespaces(SessionInfo)
      */
     public Map<String, String> getRegisteredNamespaces(SessionInfo sessionInfo) throws RepositoryException {
-        ReportInfo info = new ReportInfo(RegisteredNamespacesReport.REGISTERED_NAMESPACES_REPORT, DEPTH_0);
+        ReportInfo info = new ReportInfo(JcrRemotingConstants.REPORT_REGISTERED_NAMESPACES, ItemResourceConstants.NAMESPACE);
         ReportMethod method = null;
         try {
             method = new ReportMethod(uriResolver.getWorkspaceUri(sessionInfo.getWorkspaceName()), info);
@@ -2079,11 +2070,11 @@ public class RepositoryServiceImpl imple
             Map<String, String> namespaces = new HashMap<String, String>();
             if (doc != null) {
                 Element rootElement = doc.getDocumentElement();
-                ElementIterator nsElems = DomUtil.getChildren(rootElement, ItemResourceConstants.XML_NAMESPACE, ItemResourceConstants.NAMESPACE);
+                ElementIterator nsElems = DomUtil.getChildren(rootElement, JcrRemotingConstants.XML_NAMESPACE, ItemResourceConstants.NAMESPACE);
                 while (nsElems.hasNext()) {
                     Element elem = nsElems.nextElement();
-                    String prefix = DomUtil.getChildText(elem, ItemResourceConstants.XML_PREFIX, ItemResourceConstants.NAMESPACE);
-                    String uri = DomUtil.getChildText(elem, ItemResourceConstants.XML_URI, ItemResourceConstants.NAMESPACE);
+                    String prefix = DomUtil.getChildText(elem, JcrRemotingConstants.XML_PREFIX, ItemResourceConstants.NAMESPACE);
+                    String uri = DomUtil.getChildText(elem, JcrRemotingConstants.XML_URI, ItemResourceConstants.NAMESPACE);
                     // default namespace
                     if (prefix == null && uri == null) {
                         prefix = uri = "";
@@ -2183,7 +2174,7 @@ public class RepositoryServiceImpl imple
      */
     private void internalSetNamespaces(SessionInfo sessionInfo, Map<String, String> namespaces) throws NamespaceException, UnsupportedRepositoryOperationException, AccessDeniedException, RepositoryException {
         DavPropertySet setProperties = new DavPropertySet();
-        setProperties.add(new NamespacesProperty(namespaces));
+        setProperties.add(createNamespaceProperty(namespaces));
 
         PropPatchMethod method = null;
         try {
@@ -2209,8 +2200,8 @@ public class RepositoryServiceImpl imple
      * @see RepositoryService#getQNodeTypeDefinitions(SessionInfo)
      */
     public Iterator<QNodeTypeDefinition> getQNodeTypeDefinitions(SessionInfo sessionInfo) throws RepositoryException {
-        ReportInfo info = new ReportInfo(NodeTypesReport.NODETYPES_REPORT, DEPTH_0);
-        info.setContentElement(DomUtil.createElement(domFactory, NodeTypeConstants.XML_REPORT_ALLNODETYPES, NodeTypeConstants.NAMESPACE));
+        ReportInfo info = new ReportInfo(JcrRemotingConstants.REPORT_NODETYPES, ItemResourceConstants.NAMESPACE);
+        info.setContentElement(DomUtil.createElement(domFactory, NodeTypeConstants.XML_REPORT_ALLNODETYPES, ItemResourceConstants.NAMESPACE));
 
         ReportMethod method = null;
         try {
@@ -2298,6 +2289,65 @@ public class RepositoryServiceImpl imple
             return ntDefs.iterator();
     }
 
+    private static DavProperty<List<XmlSerializable>> createValuesProperty(Value[] jcrValues) {
+        // convert the specified jcr values to a xml-serializable value
+        List<XmlSerializable> val = new ArrayList<XmlSerializable>();
+        for (final Value jcrValue : jcrValues) {
+            val.add(new XmlSerializable() {
+                public Element toXml(Document document) {
+                    try {
+                        return ValueUtil.valueToXml(jcrValue, document);
+                    } catch (RepositoryException e) {
+                        throw new RuntimeException(e);
+                    }
+                }
+            });
+        }
+        return new DefaultDavProperty<List<XmlSerializable>>(JcrRemotingConstants.JCR_VALUES_LN, val, ItemResourceConstants.NAMESPACE, false);
+    }
+
+    private static DavProperty<List<XmlSerializable>> createNamespaceProperty(final Map<String, String> namespaces) {
+        // convert the specified namespace to a xml-serializable value
+        List<XmlSerializable> val = new ArrayList<XmlSerializable>();
+        for (final String prefix : namespaces.keySet()) {
+            val.add(new XmlSerializable() {
+
+                public Element toXml(Document document) {
+                    Element nsElem = document.createElementNS(JcrRemotingConstants.NS_URI, JcrRemotingConstants.NS_PREFIX + ":" + JcrRemotingConstants.XML_NAMESPACE);
+                    Element prefixElem = document.createElementNS(JcrRemotingConstants.NS_URI, JcrRemotingConstants.NS_PREFIX + ":" + JcrRemotingConstants.XML_PREFIX);
+                    org.w3c.dom.Text txt = document.createTextNode(prefix);
+                    prefixElem.appendChild(txt);
+
+                    final String uri = namespaces.get(prefix);
+                    Element uriElem = document.createElementNS(JcrRemotingConstants.NS_URI, JcrRemotingConstants.NS_PREFIX + ":" + JcrRemotingConstants.XML_URI);
+                    org.w3c.dom.Text txt2 = document.createTextNode(uri);
+                    uriElem.appendChild(txt2);
+
+
+                    nsElem.appendChild(prefixElem);
+                    nsElem.appendChild(uriElem);
+
+                    return nsElem;
+                }
+            });
+        }
+        return new DefaultDavProperty<List<XmlSerializable>>(JcrRemotingConstants.JCR_NAMESPACES_LN, val, ItemResourceConstants.NAMESPACE, false);
+    }
+
+
+    private static DavProperty<List<XmlSerializable>> createNodeTypeProperty(String localName, String[] ntNames) {
+        // convert the specified node type names to a xml-serializable value
+        List<XmlSerializable> val = new ArrayList<XmlSerializable>();
+        for (final String ntName : ntNames) {
+            val.add(new XmlSerializable() {
+                public Element toXml(Document document) {
+                    return NodeTypeUtil.ntNameToXml(ntName, document);
+                }
+            });
+        }
+        return new DefaultDavProperty<List<XmlSerializable>>(localName, val, ItemResourceConstants.NAMESPACE, false);
+    }
+
     /**
      * The XML elements and attributes used in serialization
      */
@@ -2475,7 +2525,7 @@ public class RepositoryServiceImpl imple
                 for (int i = 0; i < values.length; i++) {
                     jcrValues[i] = ValueFormat.getJCRValue(values[i], resolver, valueFactory);
                 }
-                ValuesProperty vp = new ValuesProperty(jcrValues);
+                DavProperty<List<XmlSerializable>> vp = createValuesProperty(jcrValues);
                 PutMethod method = new PutMethod(uri);
                 method.setRequestBody(vp);
 
@@ -2521,7 +2571,7 @@ public class RepositoryServiceImpl imple
                 for (int i = 0; i < values.length; i++) {
                     jcrValues[i] = ValueFormat.getJCRValue(values[i], resolver, valueFactory);
                 }
-                setProperties.add(new ValuesProperty(jcrValues));
+                setProperties.add(createValuesProperty(jcrValues));
                 try {
                     String uri = getItemUri(propertyId, sessionInfo);
                     PropPatchMethod method = new PropPatchMethod(uri, setProperties, new DavPropertyNameSet());
@@ -2612,14 +2662,14 @@ public class RepositoryServiceImpl imple
                 if (mixinNodeTypeIds == null || mixinNodeTypeIds.length == 0) {
                     setProperties = new DavPropertySet();
                     removeProperties = new DavPropertyNameSet();
-                    removeProperties.add(ItemResourceConstants.JCR_MIXINNODETYPES);
+                    removeProperties.add(JcrRemotingConstants.JCR_MIXINNODETYPES_LN, ItemResourceConstants.NAMESPACE);
                 } else {
                     String[] ntNames = new String[mixinNodeTypeIds.length];
                     for (int i = 0; i < mixinNodeTypeIds.length; i++) {
                         ntNames[i] = resolver.getJCRName(mixinNodeTypeIds[i]);
                     }
                     setProperties = new DavPropertySet();
-                    setProperties.add(new NodeTypeProperty(ItemResourceConstants.JCR_MIXINNODETYPES, ntNames, false));
+                    setProperties.add(createNodeTypeProperty(JcrRemotingConstants.JCR_MIXINNODETYPES_LN, ntNames));
                     removeProperties = new DavPropertyNameSet();
                 }
 
@@ -2639,7 +2689,7 @@ public class RepositoryServiceImpl imple
             checkConsumed();
             try {
                 DavPropertySet setProperties = new DavPropertySet();
-                setProperties.add(new NodeTypeProperty(ItemResourceConstants.JCR_PRIMARYNODETYPE, new String[] {resolver.getJCRName(primaryNodeTypeName)}, false));
+                setProperties.add(createNodeTypeProperty(JcrRemotingConstants.JCR_PRIMARYNODETYPE_LN, new String[] {resolver.getJCRName(primaryNodeTypeName)}));
 
                 String uri = getItemUri(nodeId, sessionInfo);
                 PropPatchMethod method = new PropPatchMethod(uri, setProperties, new DavPropertyNameSet());

Modified: jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/URIResolverImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/URIResolverImpl.java?rev=1002639&r1=1002638&r2=1002639&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/URIResolverImpl.java (original)
+++ jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/URIResolverImpl.java Wed Sep 29 14:11:53 2010
@@ -17,6 +17,7 @@
 package org.apache.jackrabbit.spi2dav;
 
 import org.apache.commons.httpclient.URI;
+import org.apache.jackrabbit.commons.webdav.JcrRemotingConstants;
 import org.apache.jackrabbit.spi.commons.conversion.NameException;
 import org.apache.jackrabbit.spi.commons.conversion.NamePathResolver;
 import org.apache.jackrabbit.spi.commons.name.NameConstants;
@@ -35,8 +36,6 @@ import org.apache.jackrabbit.webdav.Mult
 import org.apache.jackrabbit.webdav.client.methods.DavMethodBase;
 import org.apache.jackrabbit.webdav.client.methods.PropFindMethod;
 import org.apache.jackrabbit.webdav.client.methods.ReportMethod;
-import org.apache.jackrabbit.webdav.jcr.ItemResourceConstants;
-import org.apache.jackrabbit.webdav.jcr.version.report.LocateByUuidReport;
 import org.apache.jackrabbit.webdav.property.DavPropertyNameSet;
 import org.apache.jackrabbit.webdav.property.DavPropertySet;
 import org.apache.jackrabbit.webdav.version.report.ReportInfo;
@@ -91,7 +90,7 @@ class URIResolverImpl implements URIReso
     }
 
     String getRootItemUri(String workspaceName) {
-        return getWorkspaceUri(workspaceName) + Text.escapePath(ItemResourceConstants.ROOT_ITEM_RESOURCEPATH);
+        return getWorkspaceUri(workspaceName) + Text.escapePath(JcrRemotingConstants.ROOT_ITEM_RESOURCEPATH);
     }
 
     String getItemUri(ItemId itemId, String workspaceName, SessionInfo sessionInfo)
@@ -114,7 +113,7 @@ class URIResolverImpl implements URIReso
                     uriBuffer.append(cache.getUri(uuidId));
                 } else {
                     // try to request locate-by-uuid report to build the uri
-                    ReportInfo rInfo = new ReportInfo(LocateByUuidReport.LOCATE_BY_UUID_REPORT);
+                    ReportInfo rInfo = new ReportInfo(JcrRemotingConstants.REPORT_LOCATE_BY_UUID, ItemResourceConstants.NAMESPACE);
                     rInfo.setContentElement(DomUtil.hrefToXml(uniqueID, domFactory));
 
                     ReportMethod rm = null;
@@ -198,7 +197,7 @@ class URIResolverImpl implements URIReso
 
         try {
             DavPropertySet propSet = response.getProperties(DavServletResponse.SC_OK);
-            Name name = resolver.getQName(propSet.get(ItemResourceConstants.JCR_NAME).getValue().toString());
+            Name name = resolver.getQName(propSet.get(JcrRemotingConstants.JCR_NAME_LN, ItemResourceConstants.NAMESPACE).getValue().toString());
             PropertyId propertyId = service.getIdFactory().createPropertyId(parentId, name);
 
             cache.add(response.getHref(), propertyId);
@@ -275,9 +274,9 @@ class URIResolverImpl implements URIReso
         }
 
         DavPropertyNameSet nameSet = new DavPropertyNameSet();
-        nameSet.add(ItemResourceConstants.JCR_UUID);
-        nameSet.add(ItemResourceConstants.JCR_NAME);
-        nameSet.add(ItemResourceConstants.JCR_INDEX);
+        nameSet.add(JcrRemotingConstants.JCR_UUID_LN, ItemResourceConstants.NAMESPACE);
+        nameSet.add(JcrRemotingConstants.JCR_NAME_LN, ItemResourceConstants.NAMESPACE);
+        nameSet.add(JcrRemotingConstants.JCR_INDEX_LN, ItemResourceConstants.NAMESPACE);
         DavMethodBase method = null;
         try {
             method = new PropFindMethod(uri, nameSet, DavConstants.DEPTH_0);

Modified: jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2davex/QValueFactoryImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2davex/QValueFactoryImpl.java?rev=1002639&r1=1002638&r2=1002639&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2davex/QValueFactoryImpl.java (original)
+++ jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2davex/QValueFactoryImpl.java Wed Sep 29 14:11:53 2010
@@ -19,16 +19,16 @@ package org.apache.jackrabbit.spi2davex;
 import static org.apache.jackrabbit.webdav.DavConstants.HEADER_ETAG;
 import static org.apache.jackrabbit.webdav.DavConstants.HEADER_LAST_MODIFIED;
 
+import org.apache.jackrabbit.commons.webdav.JcrRemotingConstants;
+import org.apache.jackrabbit.commons.webdav.ValueUtil;
 import org.apache.jackrabbit.spi.Name;
 import org.apache.jackrabbit.spi.Path;
 import org.apache.jackrabbit.spi.QValue;
 import org.apache.jackrabbit.spi.commons.conversion.NamePathResolver;
 import org.apache.jackrabbit.spi.commons.value.AbstractQValue;
 import org.apache.jackrabbit.spi.commons.value.ValueFactoryQImpl;
+import org.apache.jackrabbit.spi2dav.ItemResourceConstants;
 import org.apache.jackrabbit.util.TransientFileFactory;
-import org.apache.jackrabbit.webdav.DavException;
-import org.apache.jackrabbit.webdav.jcr.ItemResourceConstants;
-import org.apache.jackrabbit.webdav.jcr.property.ValuesProperty;
 import org.apache.jackrabbit.webdav.property.DavProperty;
 import org.apache.jackrabbit.webdav.property.DefaultDavProperty;
 import org.apache.jackrabbit.webdav.xml.DomUtil;
@@ -549,16 +549,12 @@ class QValueFactoryImpl extends org.apac
                 // TODO: improve. jcr-server sends XML for multivalued properties
                 try {
                     Document doc = DomUtil.parseDocument(in);
-                    Element prop = DomUtil.getChildElement(doc, ItemResourceConstants.JCR_VALUES.getName(), ItemResourceConstants.JCR_VALUES.getNamespace());
+                    Element prop = DomUtil.getChildElement(doc, JcrRemotingConstants.JCR_VALUES_LN, ItemResourceConstants.NAMESPACE);
                     DavProperty<?> p = DefaultDavProperty.createFromXml(prop);
-                    ValuesProperty vp = new ValuesProperty(p, PropertyType.BINARY, vf);
-
-                    Value[] jcrVs = vp.getJcrValues();
+                    Value[] jcrVs = ValueUtil.valuesFromXml(p.getValue(), PropertyType.BINARY, vf);
                     init(jcrVs[index].getStream(), true);
                 } catch (RepositoryException e) {
                     throw new IOException(e.getMessage());
-                }catch (DavException e) {
-                    throw new IOException(e.getMessage());
                 } catch (SAXException e) {
                     throw new IOException(e.getMessage());
                 } catch (ParserConfigurationException e) {

Modified: jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2davex/RepositoryServiceImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2davex/RepositoryServiceImpl.java?rev=1002639&r1=1002638&r2=1002639&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2davex/RepositoryServiceImpl.java (original)
+++ jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2davex/RepositoryServiceImpl.java Wed Sep 29 14:11:53 2010
@@ -39,6 +39,8 @@ import org.apache.commons.httpclient.met
 import org.apache.jackrabbit.JcrConstants;
 import org.apache.jackrabbit.commons.json.JsonParser;
 import org.apache.jackrabbit.commons.json.JsonUtil;
+import org.apache.jackrabbit.commons.webdav.JcrRemotingConstants;
+import org.apache.jackrabbit.commons.webdav.JcrValueType;
 import org.apache.jackrabbit.spi.Batch;
 import org.apache.jackrabbit.spi.ItemId;
 import org.apache.jackrabbit.spi.ItemInfo;
@@ -62,8 +64,6 @@ import org.apache.jackrabbit.util.Text;
 import org.apache.jackrabbit.webdav.DavException;
 import org.apache.jackrabbit.webdav.DavServletResponse;
 import org.apache.jackrabbit.webdav.header.IfHeader;
-import org.apache.jackrabbit.webdav.jcr.ItemResourceConstants;
-import org.apache.jackrabbit.webdav.jcr.JcrValueType;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -156,7 +156,7 @@ public class RepositoryServiceImpl exten
                     // fallback:
                     // calculated uri does not start with the rootURI
                     // -> search /jcr:root and start sub-string behind.
-                    String rootSegment = Text.escapePath(ItemResourceConstants.ROOT_ITEM_RESOURCEPATH);
+                    String rootSegment = Text.escapePath(JcrRemotingConstants.ROOT_ITEM_RESOURCEPATH);
                     jcrPath = uri.substring(uri.indexOf(rootSegment) + rootSegment.length());
                 }
                 jcrPath = Text.unescape(jcrPath);
@@ -187,7 +187,7 @@ public class RepositoryServiceImpl exten
 
     private String getRootURI(SessionInfo sessionInfo) {
         StringBuffer sb = new StringBuffer(getWorkspaceURI(sessionInfo));
-        sb.append(Text.escapePath(ItemResourceConstants.ROOT_ITEM_RESOURCEPATH));
+        sb.append(Text.escapePath(JcrRemotingConstants.ROOT_ITEM_RESOURCEPATH));
         return sb.toString();
     }
 



Mime
View raw message