jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tri...@apache.org
Subject svn commit: r156314 [12/15] - in incubator/jackrabbit/trunk/contrib/jcr-server: ./ client/ client/src/ client/src/java/ client/src/java/org/ client/src/java/org/apache/ client/src/java/org/apache/jackrabbit/ client/src/java/org/apache/jackrabbit/client/ server/ server/src/ server/src/java/ server/src/java/org/ server/src/java/org/apache/ server/src/java/org/apache/jackrabbit/ server/src/java/org/apache/jackrabbit/server/ server/src/java/org/apache/jackrabbit/server/simple/ server/src/java/org/apache/jackrabbit/server/simple/dav/ server/src/java/org/apache/jackrabbit/server/simple/dav/lock/ server/src/java/org/apache/jackrabbit/webdav/ server/src/java/org/apache/jackrabbit/webdav/spi/ server/src/java/org/apache/jackrabbit/webdav/spi/lock/ server/src/java/org/apache/jackrabbit/webdav/spi/nodetype/ server/src/java/org/apache/jackrabbit/webdav/spi/observation/ server/src/java/org/apache/jackrabbit/webdav/spi/search/ server/src/java/org/apache/jackrabbit/webdav/spi/transaction/ server/src/java/org/apache/jackrabbit/webdav/spi/version/ server/src/java/org/apache/jackrabbit/webdav/spi/version/report/ webapp/ webapp/src/ webapp/src/webapp/ webapp/src/webapp/WEB-INF/ webapp/src/webapp/WEB-INF/repository/ webdav/ webdav/src/ webdav/src/java/ webdav/src/java/org/ webdav/src/java/org/apache/ webdav/src/java/org/apache/jackrabbit/ webdav/src/java/org/apache/jackrabbit/webdav/ webdav/src/java/org/apache/jackrabbit/webdav/lock/ webdav/src/java/org/apache/jackrabbit/webdav/observation/ webdav/src/java/org/apache/jackrabbit/webdav/ordering/ webdav/src/java/org/apache/jackrabbit/webdav/property/ webdav/src/java/org/apache/jackrabbit/webdav/search/ webdav/src/java/org/apache/jackrabbit/webdav/transaction/ webdav/src/java/org/apache/jackrabbit/webdav/util/ webdav/src/java/org/apache/jackrabbit/webdav/version/ webdav/src/java/org/apache/jackrabbit/webdav/version/report/
Date Sun, 06 Mar 2005 14:03:11 GMT
Added: incubator/jackrabbit/trunk/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/search/QueryGrammerSet.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/search/QueryGrammerSet.java?view=auto&rev=156314
==============================================================================
--- incubator/jackrabbit/trunk/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/search/QueryGrammerSet.java (added)
+++ incubator/jackrabbit/trunk/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/search/QueryGrammerSet.java Sun Mar  6 06:02:39 2005
@@ -0,0 +1,111 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ *
+ * 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.webdav.search;
+
+import org.apache.jackrabbit.webdav.property.DavProperty;
+import org.apache.jackrabbit.webdav.property.AbstractDavProperty;
+import org.jdom.Element;
+import org.jdom.Namespace;
+
+import java.util.List;
+import java.util.ArrayList;
+import java.util.Iterator;
+
+/**
+ * <code>QueryGrammerSet</code> is a {@link DavProperty} that
+ * encapsulates the 'supported-query-grammer-set' as defined by the
+ * Webdav SEARCH internet draft.
+ */
+public class QueryGrammerSet extends AbstractDavProperty implements SearchConstants {
+
+    private List queryLanguages = new ArrayList();
+
+    /**
+     * Create a new <code>QueryGrammerSet</code> from the given query languages
+     * string array. The default {@link SearchConstants#NAMESPACE} is assumed.
+     * @param qLanguages
+     */
+    public QueryGrammerSet(String[] qLanguages) {
+        super(QUERY_GRAMMER_SET, true);
+        if (qLanguages != null) {
+            for (int i = 0; i < qLanguages.length; i++) {
+                queryLanguages.add(new Element(qLanguages[i], SearchConstants.NAMESPACE));
+            }
+        }
+    }
+
+    /**
+     * Add another query language to this set.
+     *
+     * @param qLanguage
+     * @param namespace
+     */
+    public void addQueryLanguage(String qLanguage, Namespace namespace) {
+        if (namespace == null) {
+            namespace = SearchConstants.NAMESPACE;
+        }
+        queryLanguages.add(new Element(qLanguage, namespace));
+    }
+
+    /**
+     * Return a String array containing the URIs of the query
+     * languages supported.
+     *
+     * @return names of the supported query languages
+     */
+    public String[] getQueryLanguages() {
+        int size = queryLanguages.size();
+        if (size > 0) {
+            String[] qLangStr = new String[size];
+            Element[] elements = (Element[]) queryLanguages.toArray(new Element[size]);
+            for (int i = 0; i < elements.length; i++) {
+                qLangStr[i] = elements[i].getNamespaceURI() + elements[i].getName();
+            }
+            return qLangStr;
+        } else {
+            return new String[0];
+        }
+    }
+
+    /**
+     * Return the Xml representation of this property according to the definition
+     * of the 'supported-query-grammer-set'.
+     *
+     * @return Xml representation
+     * @see SearchConstants#QUERY_GRAMMER_SET
+     * @see org.apache.jackrabbit.webdav.property.DavProperty#toXml()
+     */
+    public Element toXml() {
+        Element elem = getName().toXml();
+        Iterator qlIter = queryLanguages.iterator();
+        while (qlIter.hasNext()) {
+            Element grammer = new Element(XML_GRAMMER, SearchConstants.NAMESPACE).addContent((Element)qlIter.next());
+            Element sqg = new Element(XML_QUERY_GRAMMAR, SearchConstants.NAMESPACE).addContent(grammer);
+            elem.addContent(sqg);
+        }
+        return elem;
+    }
+
+    /**
+     * Returns the list of supported query languages.
+     *
+     * @return list of supported query languages.
+     * @see org.apache.jackrabbit.webdav.property.DavProperty#getValue()
+     */
+    public Object getValue() {
+        return queryLanguages;
+    }
+}
\ No newline at end of file

Propchange: incubator/jackrabbit/trunk/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/search/QueryGrammerSet.java
------------------------------------------------------------------------------
    svn = 

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

Added: incubator/jackrabbit/trunk/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/search/SearchConstants.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/search/SearchConstants.java?view=auto&rev=156314
==============================================================================
--- incubator/jackrabbit/trunk/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/search/SearchConstants.java (added)
+++ incubator/jackrabbit/trunk/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/search/SearchConstants.java Sun Mar  6 06:02:39 2005
@@ -0,0 +1,88 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ *
+ * 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.webdav.search;
+
+import org.apache.jackrabbit.webdav.property.DavPropertyName;
+import org.apache.jackrabbit.webdav.DavConstants;
+import org.jdom.Namespace;
+
+/**
+ * <code>SearchConstants</code> interface provide constants for request
+ * and response headers, Xml elements and property names used for WebDAV
+ * search.
+ */
+public interface SearchConstants {
+
+    /**
+     * Namespace definition.<br>
+     * NOTE: For convenience reasons, the namespace is defined to be the default
+     * {@link  DavConstants#NAMESPACE DAV:} namespace. This is not correct for the
+     * underlaying specification is still in a draft state. See also the editorial
+     * note inside the
+     * <a href="http://greenbytes.de/tech/webdav/draft-reschke-webdav-search-latest.html#rfc.section.1.5">Internet Draft WebDAV Search</a>
+     * document.
+     */
+    public static final Namespace NAMESPACE = DavConstants.NAMESPACE;
+
+    /**
+     * The DASL response header specifing the query languages supported by
+     * the requested resource.
+     */
+    public static final String HEADER_DASL = "DASL";
+
+    /**
+     * Xml element name for a single query grammar element inside
+     * the {@link #QUERY_GRAMMER_SET supported-query-grammer-set property}.
+     */
+    public static final String XML_QUERY_GRAMMAR = "supported-query-grammar";
+
+    /**
+     * Name constant for the 'DAV:grammar' element, which is used inside the
+     * {@link #XML_QUERY_GRAMMAR} element.
+     */
+    public static final String XML_GRAMMER = "grammar";
+
+    /**
+     * Xml element name for the required request body of a SEARCH request.
+     *
+     * @see SearchRequest
+     * @see SearchResource#search(SearchRequest)
+     */
+    public static final String XML_SEARCHREQUEST = "searchrequest";
+
+    /**
+     * Optional Xml element name used in the SEARCH request body instead of {@link XML_SEARCHREQUEST}
+     * in order to access a given query schema.
+     */
+    public static final String XML_QUERY_SCHEMA_DISCOVERY = "query-schema-discovery";
+
+
+    /**
+     * Predefined basic query grammer.
+     */
+    public static final String BASICSEARCH = NAMESPACE.getPrefix()+"basicsearch";
+
+    /**
+     * Property indicating the set of query languages the given resource is
+     * able deal with. The property has the following definition:<br>
+     * <pre>
+     * &lt;!ELEMENT supported-query-grammar-set (supported-query-grammar*)&gt;
+     * &lt;!ELEMENT supported-query-grammar grammar&gt;
+     * &lt;!ELEMENT grammar ANY&gt;
+     * </pre>
+     */
+    public static final DavPropertyName QUERY_GRAMMER_SET = DavPropertyName.create("supported-query-grammar-set", NAMESPACE);
+}
\ No newline at end of file

Propchange: incubator/jackrabbit/trunk/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/search/SearchConstants.java
------------------------------------------------------------------------------
    svn = 

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

Added: incubator/jackrabbit/trunk/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/search/SearchRequest.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/search/SearchRequest.java?view=auto&rev=156314
==============================================================================
--- incubator/jackrabbit/trunk/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/search/SearchRequest.java (added)
+++ incubator/jackrabbit/trunk/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/search/SearchRequest.java Sun Mar  6 06:02:39 2005
@@ -0,0 +1,105 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ *
+ * 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.webdav.search;
+
+import org.apache.log4j.Logger;
+import org.jdom.*;
+
+/**
+ * <code>SearchRequest</code> parses the 'searchrequest' element of a SEARCH
+ * request body and performs basic validation. Both query language and the
+ * query itself can be access from the resulting object.<br>
+ * NOTE: The query is expected to be represented by the text contained in the
+ * Xml element specifying the query language, thus the 'basicsearch' defined
+ * by the Webdav Search Internet Draft is not supported by this implementation.
+ * <p/>
+ *
+ * Example of a valid 'searchrequest' body
+ * <pre>
+ * &lt;d:searchrequest xmlns:d="DAV:" jcr:="http://www.day.com/jcr/webdav/1.0" &gt;
+ *    &lt;jcr:xpath>//sv:node[@sv:name='myapp:paragraph'][1]&lt;/jcr:xpath&gt;
+ * &lt;/d:searchrequest&gt;
+ * </pre>
+ *
+ * Would return the following values:
+ * <pre>
+ *    getLanguageName() -&gt; xpath
+ *    getQuery()    -&gt; //sv:node[@sv:name='myapp:paragraph'][1]
+ * </pre>
+ *
+ */
+public class SearchRequest implements SearchConstants {
+
+    private static Logger log = Logger.getLogger(SearchRequest.class);
+
+    private final Element language;
+
+    /**
+     * Create a new <code>SearchRequest</code> from the specified element.
+     *
+     * @param searchRequest
+     * @throws IllegalArgumentException if the element's name is other than
+     * 'searchrequest' or if it does not contain a single child element specifying
+     * the query language to be used.
+     */
+    public SearchRequest(Element searchRequest) {
+        if (searchRequest == null || !XML_SEARCHREQUEST.equals(searchRequest.getName()))  {
+            throw new IllegalArgumentException("The root element must be 'searchrequest'.");
+        } else if (searchRequest.getChildren().size() != 1) {
+            throw new IllegalArgumentException("A single child element is expected with the 'searchrequest'.");
+        }
+        Element child = (Element)searchRequest.getChildren().get(0);
+        language = (Element) child.detach();
+    }
+
+    /**
+     * Create a new <code>SearchRequest</code> from the specifying document
+     * retrieved from the request body.
+     *
+     * @param searchDocument
+     * @see #SearchRequest(Element)
+     */
+    public SearchRequest(Document searchDocument) {
+        this(searchDocument.getRootElement());
+    }
+
+    /**
+     * Returns the name of the query language to be used.
+     *
+     * @return name of the query language
+     */
+    public String getLanguageName() {
+        return language.getName();
+    }
+
+    /**
+     * Returns the namespace of the language specified with the search request element.
+     *
+     * @return namespace of the requestes language.
+     */
+    public Namespace getLanguageNameSpace() {
+        return language.getNamespace();
+    }
+
+    /**
+     * Return the query string.
+     *
+     * @return query string
+     */
+    public String getQuery() {
+        return language.getText();
+    }
+}
\ No newline at end of file

Propchange: incubator/jackrabbit/trunk/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/search/SearchRequest.java
------------------------------------------------------------------------------
    svn = 

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

Added: incubator/jackrabbit/trunk/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/search/SearchResource.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/search/SearchResource.java?view=auto&rev=156314
==============================================================================
--- incubator/jackrabbit/trunk/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/search/SearchResource.java (added)
+++ incubator/jackrabbit/trunk/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/search/SearchResource.java Sun Mar  6 06:02:39 2005
@@ -0,0 +1,60 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ *
+ * 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.webdav.search;
+
+import org.apache.jackrabbit.webdav.MultiStatus;
+import org.apache.jackrabbit.webdav.DavException;
+
+/**
+ * <code>SearchResource</code> defines METHODS required in order to handle
+ * a SEARCH request.
+ */
+public interface SearchResource {
+
+    /**
+     * No extra compliance class defined by the Webdav Search spec.
+     * Instead an extra DASL header is included.
+     */
+    public String COMPLIANCE_CLASS = "";
+
+    /**
+     * The 'SEARCH' method
+     */
+    public String METHODS = "SEARCH";
+
+
+    /**
+     * Returns the protected DAV:supported-method-set property which is defined
+     * mandatory by RTF 3253. This method call is a shortcut for
+     * <code>DavResource.getProperty(SearchConstants.QUERY_GRAMMER_SET)</code>.
+     *
+     * @return the DAV:supported-query-grammer-set
+     * @see SearchConstants#QUERY_GRAMMER_SET
+     */
+    public QueryGrammerSet getQueryGrammerSet();
+
+    /**
+     * Runs a search with the language and query defined in the {@link SearchRequest}
+     * object specified and returns a {@link MultiStatus} object listing the
+     * results.
+     *
+     * @param sRequest <code>SearchRequest</code> element encapsulating the SEARCH
+     * request body.
+     * @return <code>MultiStatus</code> object listing the results.
+     * @throws DavException
+     */
+    public MultiStatus search(SearchRequest sRequest) throws DavException;
+}
\ No newline at end of file

Propchange: incubator/jackrabbit/trunk/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/search/SearchResource.java
------------------------------------------------------------------------------
    svn = 

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

Added: incubator/jackrabbit/trunk/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/search/package.html
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/search/package.html?view=auto&rev=156314
==============================================================================
--- incubator/jackrabbit/trunk/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/search/package.html (added)
+++ incubator/jackrabbit/trunk/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/search/package.html Sun Mar  6 06:02:39 2005
@@ -0,0 +1,5 @@
+<body>
+Contains interfaces and classes used to cover the functionality defined by the
+<a href="http://greenbytes.de/tech/webdav/draft-reschke-webdav-search-latest.html">Internet
+Draft WebDAV Search</a>.
+</body>
\ No newline at end of file

Propchange: incubator/jackrabbit/trunk/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/search/package.html
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/jackrabbit/trunk/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/statuscode.properties
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/statuscode.properties?view=auto&rev=156314
==============================================================================
--- incubator/jackrabbit/trunk/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/statuscode.properties (added)
+++ incubator/jackrabbit/trunk/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/statuscode.properties Sun Mar  6 06:02:39 2005
@@ -0,0 +1,47 @@
+100=Continue
+101=Switching Protocols
+102=Processing
+200=OK
+201=Created
+202=Accepted
+203=Non-Authoritative Information
+204=No Content
+205=Reset Content
+206=Partial Content
+207=Multi-Status
+300=Multiple Choices
+301=Moved Permanently
+302=Found
+303=See Other
+304=Not Modified
+305=Use Proxy
+307=Temporary Redirect
+400=Bad Request
+401=Unauthorized
+402=Payment Required
+403=Forbidden
+404=Not Found
+405=Method Not Allowed
+406=Not Acceptable
+407=Proxy Authentication Required
+408=Request Time-out
+409=Conflict
+410=Gone
+411=Length Required
+412=Precondition Failed
+413=Request Entity Too Large
+414=Request-URI Too Large
+415=Unsupported Media Type
+416=Requested range not satisfiable
+417=Expectation Failed
+420=Method Failure
+422=Unprocessable Entity
+423=Locked
+424=Failed Dependency
+500=Internal Server Error
+501=Not Implemented
+502=Bad Gateway
+503=Service Unavailable
+504=Gateway Time-out
+505=HTTP Version not supported
+507=Insufficient Storage

Propchange: incubator/jackrabbit/trunk/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/statuscode.properties
------------------------------------------------------------------------------
    svn = 

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

Added: incubator/jackrabbit/trunk/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/transaction/TransactionConstants.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/transaction/TransactionConstants.java?view=auto&rev=156314
==============================================================================
--- incubator/jackrabbit/trunk/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/transaction/TransactionConstants.java (added)
+++ incubator/jackrabbit/trunk/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/transaction/TransactionConstants.java Sun Mar  6 06:02:39 2005
@@ -0,0 +1,141 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ *
+ * 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.webdav.transaction;
+
+import org.apache.jackrabbit.webdav.DavConstants;
+import org.apache.jackrabbit.webdav.lock.Type;
+import org.apache.jackrabbit.webdav.lock.Scope;
+import org.apache.jackrabbit.webdav.property.DavPropertyName;
+import org.jdom.Namespace;
+
+/**
+ * <code>TransactionConstants</code> interface provide constants for request
+ * and response headers, Xml elements and property names used for handling
+ * transactions over WebDAV. There exists no public standard for this functionality.
+ *
+ * todo: 'local' and 'global' are not accurate terms in the given context > replace
+ */
+public interface TransactionConstants {
+
+    /**
+     * Namespace for transaction related xml elements
+     */
+    public static final Namespace NAMESPACE = Namespace.getNamespace("jcr", "http://www.day.com/jcr/webdav/1.0");
+
+    /**
+     * TransactionId Header
+     */
+    public static final String HEADER_TRANSACTIONID = "TransactionId";
+
+    /**
+     * transaction XML element<br>
+     * Used as element inside the {@link DavConstants#XML_LOCKTYPE locktype}
+     * element.
+     * @see DavConstants#XML_LOCKTYPE
+     */
+    public static final String XML_TRANSACTION = "transaction";
+
+    /**
+     * global XML element<br>
+     * Used as element inside of the {@link DavConstants#XML_LOCKSCOPE lockscope} element.
+     * It indicates the transaction to be global (e.g. a JCR transaction).
+     *
+     * @see DavConstants#XML_LOCKSCOPE
+     */
+    public static final String XML_GLOBAL = "global";
+
+    /**
+     * local XML element<br>
+     * Used as element inside of the {@link DavConstants#XML_LOCKSCOPE lockscope} element.
+     * It indicates the transaction to be local (e.g. transient changes to
+     * a repository).
+     *
+     * @see DavConstants#XML_LOCKSCOPE
+     */
+    public static final String XML_LOCAL = "local";
+
+    /**
+     * transactioninfo XML element<br>
+     * Mandatory element of the UNLOCK request body, if the unlock request
+     * is intended to complete a transaction.
+     */
+    public static final String XML_TRANSACTIONINFO = "transactioninfo";
+
+    /**
+     * transactionstatus XML element<br>
+     * Mandatory element inside the {@link #XML_TRANSACTIONINFO transactioninfo}
+     * element indicating how the transaction should be completed.
+     * @see #XML_TRANSACTIONINFO
+     */
+    public static final String XML_TRANSACTIONSTATUS = "transactionstatus";
+
+    /**
+     * commit XML element<br>
+     * Used as element inside of the {@link #XML_TRANSACTIONSTATUS transactionstatus}
+     * element. It indicates a completion by committing the transaction.
+     * @see #XML_TRANSACTIONSTATUS
+     */
+    public static final String XML_COMMIT = "commit";
+
+    /**
+     * rollback XML element<br>
+     * Used as element inside of the {@link #XML_TRANSACTIONSTATUS transactionstatus}
+     * element. It indicates a completion by roll backing the transaction.
+     * @see #XML_TRANSACTIONSTATUS
+     */
+    public static final String XML_ROLLBACK = "rollback";
+
+    /**
+     * String defining the 'isnew' property, that identifies a {@link TransactionResource}
+     * to be new within the given local transaction, meaning that it exists only in
+     * transient storage. This property is not defined by any of the Webdav RTFs.
+     * @see javax.jcr.Item#isNew()
+     * @see #XML_LOCAL
+     */
+    public static final DavPropertyName ISNEW = DavPropertyName.create("isnew", NAMESPACE);
+
+    /**
+     * String defining the 'ismodified' property, that is present on any {@link TransactionResource}
+     * that has been modified whithout the corresponding local transaction
+     * being completed yet. This property is not defined by any of the Webdav RTFs.
+     * @see javax.jcr.Item#isModified()
+     * @see #XML_LOCAL
+     */
+    public static final DavPropertyName ISMODIFIED = DavPropertyName.create("ismodified", NAMESPACE);
+
+    /**
+     * "transaction" lock type constant.
+     * @see #XML_TRANSACTION
+     * @see Type#create(String, org.jdom.Namespace)
+     */
+    public static final Type TRANSACTION = Type.create(XML_TRANSACTION, TransactionConstants.NAMESPACE);
+
+    /**
+     * "local" lock scope constant.
+     *
+     * @see #XML_LOCAL
+     * @see Scope#create(String, org.jdom.Namespace)
+     */
+    public static final Scope LOCAL = Scope.create(XML_LOCAL, TransactionConstants.NAMESPACE);
+
+    /**
+     * "global" lock scope constant.
+     * 
+     * @see #XML_GLOBAL
+     * @see Scope#create(String, org.jdom.Namespace)
+     */
+    public static final Scope GLOBAL = Scope.create(XML_GLOBAL, TransactionConstants.NAMESPACE);
+}
\ No newline at end of file

Propchange: incubator/jackrabbit/trunk/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/transaction/TransactionConstants.java
------------------------------------------------------------------------------
    svn = 

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

Added: incubator/jackrabbit/trunk/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/transaction/TransactionDavServletRequest.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/transaction/TransactionDavServletRequest.java?view=auto&rev=156314
==============================================================================
--- incubator/jackrabbit/trunk/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/transaction/TransactionDavServletRequest.java (added)
+++ incubator/jackrabbit/trunk/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/transaction/TransactionDavServletRequest.java Sun Mar  6 06:02:39 2005
@@ -0,0 +1,48 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ *
+ * 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.webdav.transaction;
+
+import org.apache.jackrabbit.webdav.DavServletRequest;
+
+/**
+ * <code>TransactionDavServletRequest</code> provides extensions to the
+ * {@link DavServletRequest} interface used for dealing with transaction lock
+ * requests.
+ */
+public interface TransactionDavServletRequest extends DavServletRequest {
+
+    /**
+     * Retrieve the 'transactioninfo' request body that must be included with
+     * the UNLOCK request of a transaction lock. If the request body is does not
+     * provide the information required (either because it is missing or the
+     * Xml is not valid) <code>null</code> is returned.
+     *
+     * @return <code>TransactionInfo</code> object encapsulating the 'transactioninfo'
+     * Xml element present in the request body or <code>null</null> if no
+     * body is present or if it could not be parsed.
+     */
+    public TransactionInfo getTransactionInfo();
+
+
+    /**
+     * Retrieve the transaction id from the
+     * {@link TransactionConstants#HEADER_TRANSACTIONID TransactionId header}.
+     *
+     * @return transaction id as present in the {@link TransactionConstants#HEADER_TRANSACTIONID TransactionId header}
+     * or <code>null</code>.
+     */
+    public String getTransactionId();
+}
\ No newline at end of file

Propchange: incubator/jackrabbit/trunk/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/transaction/TransactionDavServletRequest.java
------------------------------------------------------------------------------
    svn = 

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

Added: incubator/jackrabbit/trunk/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/transaction/TransactionInfo.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/transaction/TransactionInfo.java?view=auto&rev=156314
==============================================================================
--- incubator/jackrabbit/trunk/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/transaction/TransactionInfo.java (added)
+++ incubator/jackrabbit/trunk/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/transaction/TransactionInfo.java Sun Mar  6 06:02:39 2005
@@ -0,0 +1,80 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ *
+ * 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.webdav.transaction;
+
+import org.apache.log4j.Logger;
+import org.jdom.Element;
+
+/**
+ * <code>TransactionInfo</code> class encapsultes the information present
+ * in the {@link #XML_TRANSACTIONINFO} element that forms the request body of
+ * the UNLOCk request for a transaction lock.
+ *
+ * @see TransactionConstants#XML_TRANSACTIONINFO
+ * @see TransactionConstants#XML_TRANSACTION
+ */
+public class TransactionInfo implements TransactionConstants {
+
+    private static Logger log = Logger.getLogger(TransactionInfo.class);
+
+    private Element status;
+
+    /**
+     * Creates a <code>TransactionInfo</code> object from the given 'transactionInfo'
+     * element. The 'transactionInfo' must have the following form:
+     * <pre>
+     *
+     *  &lt;!ELEMENT transactioninfo (transactionstatus) &gt;
+     *  &lt;!ELEMENT transactionstatus ( commit | rollback ) &gt;
+     *  &lt;!ELEMENT commit EMPTY &gt;
+     *  &lt;!ELEMENT rollback EMPTY &gt;
+     * </pre>
+     * @param transactionInfo as present in the UNLOCK request body.
+     * @throws IllegalArgumentException if the given transactionInfo element
+     * is not valid.
+     */
+    public TransactionInfo(Element transactionInfo) {
+        if (transactionInfo == null || !XML_TRANSACTIONINFO.equals(transactionInfo.getName())) {
+            throw new IllegalArgumentException("transactionInfo element expected.");
+        }
+        Element tStatus = transactionInfo.getChild(XML_TRANSACTIONSTATUS, NAMESPACE);
+        if (tStatus == null) {
+            throw new IllegalArgumentException("transactionInfo must contain a single 'jcr:transactionstatus' element.");
+        }
+
+        // retrieve status: commit or rollback
+        status = tStatus.getChild(XML_COMMIT, NAMESPACE);
+        if (status == null) {
+            status = tStatus.getChild(XML_ROLLBACK, NAMESPACE);
+        }
+
+        if (status == null) {
+            throw new IllegalArgumentException("'jcr:transactionstatus' element must contain either a '" + XML_COMMIT + "' or a '" + XML_ROLLBACK + "' elements.");
+        }
+    }
+
+    /**
+     * Returns either 'commit' or 'rollback' with are the only allowed status
+     * types.
+     *
+     * @return 'commit' or 'rollback'
+     * @see #XML_COMMIT
+     * @see #XML_ROLLBACK
+     */
+    public String getStatus() {
+        return status.getName();
+    }
+}
\ No newline at end of file

Propchange: incubator/jackrabbit/trunk/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/transaction/TransactionInfo.java
------------------------------------------------------------------------------
    svn = 

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

Added: incubator/jackrabbit/trunk/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/transaction/TransactionResource.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/transaction/TransactionResource.java?view=auto&rev=156314
==============================================================================
--- incubator/jackrabbit/trunk/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/transaction/TransactionResource.java (added)
+++ incubator/jackrabbit/trunk/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/transaction/TransactionResource.java Sun Mar  6 06:02:39 2005
@@ -0,0 +1,67 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ *
+ * 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.webdav.transaction;
+
+import org.apache.jackrabbit.webdav.DavException;
+import org.apache.jackrabbit.webdav.DavResource;
+import org.apache.jackrabbit.webdav.DavSession;
+
+/**
+ * <code>TransactionResource</code> extends the {@link DavResource} interface by
+ * transaction relevant METHODS.
+ */
+public interface TransactionResource extends DavResource {
+
+    public static final String COMPLIANCE_CLASS = "";
+    public static final String METHODS = "";
+
+    /**
+     * Initializes the <code>TransactionResource</code>.
+     *
+     * @param txMgr
+     * @param transactionId
+     */
+    public void init(TxLockManager txMgr, String transactionId);
+
+    /**
+     * Retrieve the <code>DavSession</code> associated with this resource.
+     *
+     * @return session object associated with this resource.
+     */
+    public DavSession getSession();
+
+    /**
+     * The TransactionId or <code>null</code> according to the value of the
+     * corresponding request {@link TransactionConstants#HEADER_TRANSACTIONID header}
+     * field.
+     *
+     * @return TransactionId header or <code>null</code>
+     */
+    public String getTransactionId();
+
+    /**
+     * Overloads the {@link DavResource#unlock unlock} method of the <code>DavResource</code>
+     * interface.
+     *
+     * @param lockToken lock token as present in the request header.
+     * @param info transaction info object as present in the UNLOCK request body.
+     * @throws DavException if an error occurs
+     * @see DavResource#unlock(String)
+     * @see TransactionDavServletRequest#getTransactionId()
+     * @see org.apache.jackrabbit.webdav.DavServletRequest#getLockToken()
+     */
+    public void unlock(String lockToken, TransactionInfo info) throws DavException;
+}
\ No newline at end of file

Propchange: incubator/jackrabbit/trunk/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/transaction/TransactionResource.java
------------------------------------------------------------------------------
    svn = 

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

Added: incubator/jackrabbit/trunk/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/transaction/TxActiveLock.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/transaction/TxActiveLock.java?view=auto&rev=156314
==============================================================================
--- incubator/jackrabbit/trunk/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/transaction/TxActiveLock.java (added)
+++ incubator/jackrabbit/trunk/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/transaction/TxActiveLock.java Sun Mar  6 06:02:39 2005
@@ -0,0 +1,89 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ *
+ * 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.webdav.transaction;
+
+import org.apache.jackrabbit.webdav.lock.DefaultActiveLock;
+import org.apache.jackrabbit.webdav.lock.LockInfo;
+import org.apache.jackrabbit.webdav.lock.Type;
+import org.apache.jackrabbit.webdav.lock.Scope;
+
+/**
+ * <code>TxActiveLock</code> represents the transaction lock present on a
+ * {@link TransactionResource}.
+ */
+public class TxActiveLock extends DefaultActiveLock implements TransactionConstants {
+
+    public static final long DEFAULT_TIMEOUT = 300000; // 5 minutes
+
+    private final Scope scope;
+
+    /**
+     * Create a new transaction lock.<br>
+     * If the lockInfo element is <code>null</code> the timeout defaults to
+     * half and hour. The default scope is 'local'.
+     *
+     * @param lockInfo
+     * @throws IllegalArgumentException if either scope or type is invalid or if
+     * a depth other than infinity is requested.
+     */
+    public TxActiveLock(LockInfo lockInfo) {
+        if (lockInfo != null) {
+            if (!TRANSACTION.equals(lockInfo.getType())) {
+               throw new IllegalArgumentException("Only 'transaction' type is allowed for a transaction-activelock object.");
+            }
+            if (!(LOCAL.equals(lockInfo.getScope()) || GLOBAL.equals(lockInfo.getScope()))) {
+               throw new IllegalArgumentException("Only 'global' or 'local' are valid scopes within a transaction-activelock element.");
+            }
+            if (!lockInfo.isDeep()) {
+               throw new IllegalArgumentException("Only transaction locks can only be deep.");
+            }
+            setOwner(lockInfo.getOwner());
+            setTimeout(lockInfo.getTimeout());
+            scope = lockInfo.getScope();
+        } else {
+            setTimeout(DEFAULT_TIMEOUT);
+            // local scope by default
+            scope = LOCAL;
+        }
+    }
+
+    /**
+     * Always returns true.
+     *
+     * @return true
+     */
+    public boolean isDeep() {
+        return true;
+    }
+
+    /**
+     * Always returns the {@link #TRANSACTION} type.
+     *
+     * @return {@link #TRANSACTION}
+     */
+    public Type getType() {
+        return TRANSACTION;
+    }
+
+    /**
+     * Returns the scope of this lock which is either {@link #LOCAL} or {@link #GLOBAL}.
+     *
+     * @return {@link #LOCAL} or {@link #GLOBAL}
+     */
+    public Scope getScope() {
+        return scope;
+    }
+}
\ No newline at end of file

Propchange: incubator/jackrabbit/trunk/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/transaction/TxActiveLock.java
------------------------------------------------------------------------------
    svn = 

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

Added: incubator/jackrabbit/trunk/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/transaction/TxLockEntry.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/transaction/TxLockEntry.java?view=auto&rev=156314
==============================================================================
--- incubator/jackrabbit/trunk/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/transaction/TxLockEntry.java (added)
+++ incubator/jackrabbit/trunk/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/transaction/TxLockEntry.java Sun Mar  6 06:02:39 2005
@@ -0,0 +1,70 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ *
+ * 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.webdav.transaction;
+
+import org.apache.log4j.Logger;
+import org.apache.jackrabbit.webdav.lock.Type;
+import org.apache.jackrabbit.webdav.lock.Scope;
+import org.apache.jackrabbit.webdav.lock.AbstractLockEntry;
+
+/**
+ * <code>TxLockEntry</code> represents the lock entry objects allowed for
+ * a transaction lock.
+ */
+public final class TxLockEntry extends AbstractLockEntry implements TransactionConstants {
+
+    private static Logger log = Logger.getLogger(TxLockEntry.class);
+
+    private final Scope scope;
+
+    /**
+     * Create a lock entry that identifies transaction lock.
+     *
+     * @param isLocal boolean value indicating whether this is a local or a global
+     * lock entry.
+     */
+    public TxLockEntry(boolean isLocal) {
+        if (isLocal) {
+            scope = LOCAL;
+        } else {
+            scope = GLOBAL;
+        }
+    }
+
+    /**
+     * Returns the {@link #TRANSACTION 'transaction'} lock type.
+     *
+     * @return always returns the 'transaction' type.
+     * @see org.apache.jackrabbit.webdav.lock.LockEntry#getType()
+     * @see #TRANSACTION
+     */
+    public Type getType() {
+        return TRANSACTION;
+    }
+
+    /**
+     * Returns either {@link #LOCAL local} or {@link #GLOBAL global} scope
+     * depending on the initial construtor value.
+     *
+     * @return returns 'global' or 'local' scope.
+     * @see org.apache.jackrabbit.webdav.lock.LockEntry#getScope()
+     * @see #GLOBAL
+     * @see #LOCAL
+     */
+    public Scope getScope() {
+        return scope;
+    }
+}
\ No newline at end of file

Propchange: incubator/jackrabbit/trunk/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/transaction/TxLockEntry.java
------------------------------------------------------------------------------
    svn = 

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

Added: incubator/jackrabbit/trunk/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/transaction/TxLockManager.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/transaction/TxLockManager.java?view=auto&rev=156314
==============================================================================
--- incubator/jackrabbit/trunk/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/transaction/TxLockManager.java (added)
+++ incubator/jackrabbit/trunk/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/transaction/TxLockManager.java Sun Mar  6 06:02:39 2005
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2005 Your Corporation. All Rights Reserved.
+ */
+package org.apache.jackrabbit.webdav.transaction;
+
+import org.apache.jackrabbit.webdav.*;
+import org.apache.jackrabbit.webdav.lock.*;
+
+/**
+ * <code>TxLockManager</code> manages locks with locktype
+ * '{@link TransactionConstants#TRANSACTION jcr:transaction}'.
+ *
+ * todo: removing all expired locks
+ * todo: 'local' and 'global' are not accurate terms in the given context > replace
+ * todo: the usage of the 'global' transaction is not according to the JTA specification,
+ * which explicitely requires any transaction present on a servlet to be completed before
+ * the service method returns. Starting/completing transactions on the session object,
+ * which is possible with the jackrabbit implementation is a hack.
+ * todo: review of this transaction part is therefore required. Is there a use-case
+ * for those 'global' transactions at all...
+ */
+public interface TxLockManager extends LockManager {
+
+
+    /**
+     * Release the lock identified by the given lock token.
+     *
+     * @param lockInfo
+     * @param lockToken
+     * @param resource
+     * @throws org.apache.jackrabbit.webdav.DavException
+     */
+    public void releaseLock(TransactionInfo lockInfo, String lockToken,
+			    TransactionResource resource) throws DavException;
+
+
+    /**
+     * Return the lock applied to the given resource or <code>null</code>
+     *
+     * @param type
+     * @param scope
+     * @param resource
+     * @return lock applied to the given resource or <code>null</code>
+     * @see org.apache.jackrabbit.webdav.lock.LockManager#getLock(org.apache.jackrabbit.webdav.lock.Type, org.apache.jackrabbit.webdav.lock.Scope, org.apache.jackrabbit.webdav.DavResource)
+     */
+    public ActiveLock getLock(Type type, Scope scope, TransactionResource resource);
+
+
+}

Propchange: incubator/jackrabbit/trunk/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/transaction/TxLockManager.java
------------------------------------------------------------------------------
    svn = 

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

Added: incubator/jackrabbit/trunk/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/transaction/package.html
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/transaction/package.html?view=auto&rev=156314
==============================================================================
--- incubator/jackrabbit/trunk/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/transaction/package.html (added)
+++ incubator/jackrabbit/trunk/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/transaction/package.html Sun Mar  6 06:02:39 2005
@@ -0,0 +1,3 @@
+<body>
+Contains interfaces and classes related to transaction locks.
+</body>
\ No newline at end of file

Propchange: incubator/jackrabbit/trunk/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/transaction/package.html
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message