diff --git a/.gitignore b/.gitignore
new file mode 100644
index 00000000000..d2c4fc09ca5
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,8 @@
+target
+.classpath
+.project
+.settings
+*.iml
+*.ipr
+*.iws
+.idea
diff --git a/HEADER.txt b/HEADER.txt
deleted file mode 100644
index 1c669de7240..00000000000
--- a/HEADER.txt
+++ /dev/null
@@ -1,16 +0,0 @@
-/*
- * Copyright 2004-2005 The Apache Software Foundation or its licensors,
- * as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
\ No newline at end of file
diff --git a/LICENSE.txt b/LICENSE.txt
index d6456956733..883ab098f7f 100644
--- a/LICENSE.txt
+++ b/LICENSE.txt
@@ -200,3 +200,65 @@
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.
+
+
+APACHE JACKRABBIT SUBCOMPONENTS
+
+Apache Jackrabbit includes parts with separate copyright notices and license
+terms. Your use of these subcomponents is subject to the terms and conditions
+of the following licenses:
+
+ XPath 2.0/XQuery 1.0 Parser:
+ http://www.w3.org/2002/11/xquery-xpath-applets/xgrammar.zip
+
+ Copyright (C) 2002 World Wide Web Consortium, (Massachusetts Institute of
+ Technology, European Research Consortium for Informatics and Mathematics,
+ Keio University). All Rights Reserved.
+
+ This work is distributed under the W3C(R) Software License in the hope
+ that it will be useful, but WITHOUT ANY WARRANTY; without even the
+ implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+ W3C(R) SOFTWARE NOTICE AND LICENSE
+ http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
+
+ This work (and included software, documentation such as READMEs, or
+ other related items) is being provided by the copyright holders under
+ the following license. By obtaining, using and/or copying this work,
+ you (the licensee) agree that you have read, understood, and will comply
+ with the following terms and conditions.
+
+ Permission to copy, modify, and distribute this software and its
+ documentation, with or without modification, for any purpose and
+ without fee or royalty is hereby granted, provided that you include
+ the following on ALL copies of the software and documentation or
+ portions thereof, including modifications:
+
+ 1. The full text of this NOTICE in a location viewable to users
+ of the redistributed or derivative work.
+
+ 2. Any pre-existing intellectual property disclaimers, notices,
+ or terms and conditions. If none exist, the W3C Software Short
+ Notice should be included (hypertext is preferred, text is
+ permitted) within the body of any redistributed or derivative code.
+
+ 3. Notice of any changes or modifications to the files, including
+ the date changes were made. (We recommend you provide URIs to the
+ location from which the code is derived.)
+
+ THIS SOFTWARE AND DOCUMENTATION IS PROVIDED "AS IS," AND COPYRIGHT
+ HOLDERS MAKE NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED,
+ INCLUDING BUT NOT LIMITED TO, WARRANTIES OF MERCHANTABILITY OR FITNESS
+ FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF THE SOFTWARE OR
+ DOCUMENTATION WILL NOT INFRINGE ANY THIRD PARTY PATENTS, COPYRIGHTS,
+ TRADEMARKS OR OTHER RIGHTS.
+
+ COPYRIGHT HOLDERS WILL NOT BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL
+ OR CONSEQUENTIAL DAMAGES ARISING OUT OF ANY USE OF THE SOFTWARE OR
+ DOCUMENTATION.
+
+ The name and trademarks of copyright holders may NOT be used in
+ advertising or publicity pertaining to the software without specific,
+ written prior permission. Title to copyright in this software and
+ any associated documentation will at all times remain with
+ copyright holders.
diff --git a/NOTICE.txt b/NOTICE.txt
index 1010997e172..0dc6f68c75a 100644
--- a/NOTICE.txt
+++ b/NOTICE.txt
@@ -1,15 +1,8 @@
-This product includes software developed by
+Apache Jackrabbit
+Copyright 2014 The Apache Software Foundation
+
+This product includes software developed at
The Apache Software Foundation (http://www.apache.org/).
Based on source code originally developed by
-Day Software (http://www.day.com).
-
-This product contains a preliminary implementation of the
-Content Repository for Java Technology API, as specified by
-
- http://www.jcp.org/en/jsr/detail?id=170
-
-that is not in final form and will change in the future.
-Implementations prior to final publication of JSR 170
-are not considered compliant with JSR 170 and cannot be
-advertised as such.
+Day Software (http://www.day.com/).
diff --git a/README.txt b/README.txt
index fbda05aac4f..2143f553530 100644
--- a/README.txt
+++ b/README.txt
@@ -1,110 +1,79 @@
-=======================================================================
-Welcome to Apache Jackrabbit
- * If the remote item is a {@link RemoteNode}, this method delegates
- * to {@link #getNode(Session, RemoteNode)}.
- *
- * @param session current session
- * @param remote remote item
- * @return local property, node, or item adapter
- */
- protected Item getItem(Session session, RemoteItem remote) {
- if (remote instanceof RemoteProperty) {
- return factory.getProperty(session, (RemoteProperty) remote);
- } else if (remote instanceof RemoteNode) {
- return getNode(session, (RemoteNode) remote);
- } else {
- return factory.getItem(session, remote);
- }
- }
-
- /**
- * Utility method to create a local adapter for a remote node.
- * This method introspects the remote reference to determine
- * whether to instantiate a {@link Node Node},
- * a {@link javax.jcr.version.VersionHistory VersionHistory}, or a
- * {@link Version Version} adapter using
- * the local adapter factory.
- *
- * @param session current session
- * @param remote remote node
- * @return local node, version, or version history adapter
- */
- protected Node getNode(Session session, RemoteNode remote) {
- if (remote instanceof RemoteVersion) {
- return factory.getVersion(session, (RemoteVersion) remote);
- } else if (remote instanceof RemoteVersionHistory) {
- return factory.getVersionHistory(session, (RemoteVersionHistory) remote);
- } else {
- return factory.getNode(session, (RemoteNode) remote);
- }
- }
-
- /**
- * Utility method for creating a property iterator for an array
- * of remote properties. The properties in the returned iterator
- * are created using the local adapter factory.
- *
- * A
- * A
- * A
- * A
- * A
- * A
- * A
- * A
- * The repository references are cached so that only one client instance
- * (per factory) exists for each remote repository.
- *
- * @param url the RMI URL of the remote repository
- * @return repository client
- * @throws ClassCastException if the URL points to an unknown object
- * @throws MalformedURLException if the URL is malformed
- * @throws NotBoundException if the URL points to nowhere
- * @throws RemoteException on RMI errors
- */
- public synchronized Repository getRepository(String url) throws
- ClassCastException, MalformedURLException,
- NotBoundException, RemoteException {
- Repository repository = (Repository) repositories.get(url);
- if (repository == null) {
- RemoteRepository remote = (RemoteRepository) Naming.lookup(url);
- repository = factory.getRepository(remote);
- repositories.put(url, repository);
- }
- return repository;
- }
-
- /**
- * Utility method for looking up the URL within the given RefAddr object.
- * Feeds the content of the RefAddr object to
- * {@link #getRepository(String) getRepository(String)} and wraps all
- * errors to {@link NamingException NamingExceptions}.
- *
- * Used by {@link #getObjectInstance(Object, Name, Context, Hashtable) getObjectInstance()}.
- *
- * @param url the URL reference
- * @return repository client
- * @throws NamingException on all errors
- */
- private Repository getRepository(RefAddr url) throws NamingException {
- try {
- return getRepository((String) url.getContent());
- } catch (Exception ex) {
- throw new NamingException(ex.getMessage());
- }
- }
-
- /**
- * JNDI factory method for creating JCR-RMI clients. Looks up a
- * remote repository using the reference parameter "url" as the RMI URL
- * and returns a client wrapper for the remote repository.
- *
- * @param object reference parameters
- * @param name unused
- * @param context unused
- * @param environment unused
- * @return repository client
- * @throws NamingException on all errors
- */
- public Object getObjectInstance(
- Object object, Name name, Context context, Hashtable environment)
- throws NamingException {
- if (object instanceof Reference) {
- Reference reference = (Reference) object;
- if (Repository.class.getName().equals(reference.getClassName())) {
- RefAddr url = reference.get(URL_PARAMETER);
- if (url != null) {
- return getRepository(url);
- }
- }
- }
- return null;
- }
-
-}
diff --git a/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/client/ClientRow.java b/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/client/ClientRow.java
deleted file mode 100644
index 212e395f7a0..00000000000
--- a/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/client/ClientRow.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * Copyright 2004-2005 The Apache Software Foundation or its licensors,
- * as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.jackrabbit.rmi.client;
-
-import java.rmi.RemoteException;
-
-import javax.jcr.RepositoryException;
-import javax.jcr.Value;
-import javax.jcr.query.Row;
-
-import org.apache.jackrabbit.rmi.remote.RemoteRow;
-
-/**
- * Local adapter for the JCR-RMI {@link RemoteRow RemoteRow}
- * inteface. This class makes a remote query row locally available using
- * the JCR {@link Row Row} interface.
- *
- * @author Philipp Koch
- * @see javax.jcr.query.Row Row
- * @see org.apache.jackrabbit.rmi.remote.RemoteRow
- */
-public class ClientRow implements Row {
-
- /** The remote query row. */
- private RemoteRow remote;
-
- /**
- * Creates a client adapter for the given remote query row.
- *
- * @param remote remote query row
- */
- public ClientRow(RemoteRow remote) {
- this.remote = remote;
- }
-
- /** {@inheritDoc} */
- public Value[] getValues() throws RepositoryException {
- try {
- return remote.getValues();
- } catch (RemoteException ex) {
- throw new RemoteRepositoryException(ex);
- }
- }
-
- /** {@inheritDoc} */
- public Value getValue(String s) throws RepositoryException {
- try {
- return remote.getValue(s);
- } catch (RemoteException ex) {
- throw new RemoteRepositoryException(ex);
- }
- }
-}
diff --git a/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/client/ClientSession.java b/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/client/ClientSession.java
deleted file mode 100644
index c8ce8258ee7..00000000000
--- a/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/client/ClientSession.java
+++ /dev/null
@@ -1,417 +0,0 @@
-/*
- * Copyright 2004-2005 The Apache Software Foundation or its licensors,
- * as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.jackrabbit.rmi.client;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.rmi.RemoteException;
-import java.security.AccessControlException;
-
-import javax.jcr.Credentials;
-import javax.jcr.Item;
-import javax.jcr.Node;
-import javax.jcr.Repository;
-import javax.jcr.RepositoryException;
-import javax.jcr.Session;
-import javax.jcr.Workspace;
-import javax.xml.transform.Result;
-import javax.xml.transform.Source;
-import javax.xml.transform.Transformer;
-import javax.xml.transform.TransformerConfigurationException;
-import javax.xml.transform.TransformerException;
-import javax.xml.transform.TransformerFactory;
-import javax.xml.transform.sax.SAXResult;
-import javax.xml.transform.stream.StreamSource;
-
-import org.apache.jackrabbit.rmi.remote.RemoteSession;
-import org.apache.jackrabbit.rmi.xml.SessionImportContentHandler;
-import org.xml.sax.ContentHandler;
-import org.xml.sax.SAXException;
-
-/**
- * Local adapter for the JCR-RMI
- * {@link org.apache.jackrabbit.rmi.remote.RemoteSession RemoteSession}
- * inteface. This class makes a remote session locally available using
- * the JCR {@link javax.jcr.Session Session} interface.
- *
- * @author Jukka Zitting
- * @see javax.jcr.Session
- * @see org.apache.jackrabbit.rmi.remote.RemoteSession
- */
-public class ClientSession extends ClientObject implements Session {
-
- /** The current repository. */
- private Repository repository;
-
- /** The adapted remote session. */
- private RemoteSession remote;
-
- /**
- * Creates a client adapter for the given remote session.
- *
- * @param repository current repository
- * @param remote remote repository
- * @param factory local adapter factory
- */
- public ClientSession(Repository repository, RemoteSession remote,
- LocalAdapterFactory factory) {
- super(factory);
- this.repository = repository;
- this.remote = remote;
- }
-
- /**
- * Returns the current repository without contacting the remote session.
- *
- * {@inheritDoc}
- */
- public Repository getRepository() {
- return repository;
- }
-
- /** {@inheritDoc} */
- public String getUserId() {
- try {
- return remote.getUserId();
- } catch (RemoteException ex) {
- throw new RemoteRuntimeException(ex);
- }
- }
-
- /** {@inheritDoc} */
- public Object getAttribute(String name) {
- try {
- return remote.getAttribute(name);
- } catch (RemoteException ex) {
- throw new RemoteRuntimeException(ex);
- }
- }
-
- /** {@inheritDoc} */
- public String[] getAttributeNames() {
- try {
- return remote.getAttributeNames();
- } catch (RemoteException ex) {
- throw new RemoteRuntimeException(ex);
- }
- }
-
- /** {@inheritDoc} */
- public Workspace getWorkspace() {
- try {
- return getFactory().getWorkspace(this, remote.getWorkspace());
- } catch (RemoteException ex) {
- throw new RemoteRuntimeException(ex);
- }
- }
-
- /** {@inheritDoc} */
- public Session impersonate(Credentials credentials)
- throws RepositoryException {
- try {
- RemoteSession session = remote.impersonate(credentials);
- return getFactory().getSession(repository, session);
- } catch (RemoteException ex) {
- throw new RemoteRepositoryException(ex);
- }
- }
-
- /** {@inheritDoc} */
- public Node getRootNode() throws RepositoryException {
- try {
- return getNode(this, remote.getRootNode());
- } catch (RemoteException ex) {
- throw new RemoteRepositoryException(ex);
- }
- }
-
- /** {@inheritDoc} */
- public Node getNodeByUUID(String uuid) throws RepositoryException {
- try {
- return getNode(this, remote.getNodeByUUID(uuid));
- } catch (RemoteException ex) {
- throw new RemoteRepositoryException(ex);
- }
- }
-
- /** {@inheritDoc} */
- public Item getItem(String path) throws RepositoryException {
- try {
- return getItem(this, remote.getItem(path));
- } catch (RemoteException ex) {
- throw new RemoteRepositoryException(ex);
- }
- }
-
- /** {@inheritDoc} */
- public boolean itemExists(String path) {
- try {
- return remote.itemExists(path);
- } catch (RemoteException ex) {
- throw new RemoteRuntimeException(ex);
- }
- }
-
- /** {@inheritDoc} */
- public void move(String from, String to) throws RepositoryException {
- try {
- remote.move(from, to);
- } catch (RemoteException ex) {
- throw new RemoteRepositoryException(ex);
- }
- }
-
- /** {@inheritDoc} */
- public void save() throws RepositoryException {
- try {
- remote.save();
- } catch (RemoteException ex) {
- throw new RemoteRepositoryException(ex);
- }
- }
-
- /** {@inheritDoc} */
- public void refresh(boolean keepChanges) throws RepositoryException {
- try {
- remote.refresh(keepChanges);
- } catch (RemoteException ex) {
- throw new RemoteRepositoryException(ex);
- }
- }
-
- /** {@inheritDoc} */
- public boolean hasPendingChanges() throws RepositoryException {
- try {
- return remote.hasPendingChanges();
- } catch (RemoteException ex) {
- throw new RemoteRepositoryException(ex);
- }
- }
-
- /** {@inheritDoc} */
- public void checkPermission(String path, String actions)
- throws AccessControlException {
- try {
- remote.checkPermission(path, actions);
- } catch (RemoteException ex) {
- throw new RemoteRuntimeException(ex);
- }
- }
-
- /** {@inheritDoc} */
- public void importXML(String path, InputStream xml)
- throws IOException, RepositoryException {
- try {
- ByteArrayOutputStream buffer = new ByteArrayOutputStream();
- byte[] bytes = new byte[4096];
- for (int n = xml.read(bytes); n != -1; n = xml.read(bytes)) {
- buffer.write(bytes, 0, n);
- }
- remote.importXML(path, buffer.toByteArray());
- } catch (RemoteException ex) {
- throw new RemoteRepositoryException(ex);
- }
- }
-
- /** {@inheritDoc} */
- public ContentHandler getImportContentHandler(String path)
- throws RepositoryException {
- return new SessionImportContentHandler(this, path);
- }
-
- /** {@inheritDoc} */
- public void setNamespacePrefix(String prefix, String uri)
- throws RepositoryException {
- try {
- remote.setNamespacePrefix(prefix, uri);
- } catch (RemoteException ex) {
- throw new RemoteRuntimeException(ex);
- }
- }
-
- /** {@inheritDoc} */
- public String[] getNamespacePrefixes() throws RepositoryException {
- try {
- return remote.getNamespacePrefixes();
- } catch (RemoteException ex) {
- throw new RemoteRepositoryException(ex);
- }
- }
-
- /** {@inheritDoc} */
- public String getNamespaceURI(String prefix) throws RepositoryException {
- try {
- return remote.getNamespaceURI(prefix);
- } catch (RemoteException ex) {
- throw new RemoteRepositoryException(ex);
- }
- }
-
- /** {@inheritDoc} */
- public String getNamespacePrefix(String uri) throws RepositoryException {
- try {
- return remote.getNamespacePrefix(uri);
- } catch (RemoteException ex) {
- throw new RemoteRepositoryException(ex);
- }
- }
-
- /** {@inheritDoc} */
- public void logout() {
- try {
- remote.logout();
- } catch (RemoteException ex) {
- throw new RemoteRuntimeException(ex);
- }
- }
-
- /** {@inheritDoc} */
- public void addLockToken(String name) {
- try {
- remote.addLockToken(name);
- } catch (RemoteException ex) {
- throw new RemoteRuntimeException(ex);
- }
- }
-
- /** {@inheritDoc} */
- public String[] getLockTokens() {
- try {
- return remote.getLockTokens();
- } catch (RemoteException ex) {
- throw new RemoteRuntimeException(ex);
- }
- }
-
- /** {@inheritDoc} */
- public void removeLockToken(String name) {
- try {
- remote.removeLockToken(name);
- } catch (RemoteException ex) {
- throw new RemoteRuntimeException(ex);
- }
- }
-
- /**
- * Exports the XML system view of the specified repository location
- * to the given XML content handler. This method first requests the
- * raw XML data from the remote session, and then uses an identity
- * transformation to feed the data to the given XML content handler.
- * Possible IO and transformer exceptions are thrown as SAXExceptions.
- *
- * {@inheritDoc}
- */
- public void exportSysView(
- String path, ContentHandler handler,
- boolean binaryAsLink, boolean noRecurse)
- throws SAXException, RepositoryException {
- try {
- byte[] xml = remote.exportSysView(path, binaryAsLink, noRecurse);
-
- Source source = new StreamSource(new ByteArrayInputStream(xml));
- Result result = new SAXResult(handler);
-
- TransformerFactory factory = TransformerFactory.newInstance();
- Transformer transformer = factory.newTransformer();
- transformer.transform(source, result);
- } catch (RemoteException ex) {
- throw new RemoteRepositoryException(ex);
- } catch (IOException ex) {
- throw new SAXException(ex);
- } catch (TransformerConfigurationException ex) {
- throw new SAXException(ex);
- } catch (TransformerException ex) {
- throw new SAXException(ex);
- }
- }
-
- /**
- * Exports the XML system view of the specified repository location
- * to the given output stream. This method first requests the
- * raw XML data from the remote session, and then writes the data to
- * the output stream.
- *
- * {@inheritDoc}
- */
- public void exportSysView(
- String path, OutputStream output,
- boolean binaryAsLink, boolean noRecurse)
- throws IOException, RepositoryException {
- try {
- byte[] xml = remote.exportSysView(path, binaryAsLink, noRecurse);
- output.write(xml);
- } catch (RemoteException ex) {
- throw new RemoteRepositoryException(ex);
- }
- }
-
- /**
- * Exports the XML document view of the specified repository location
- * to the given XML content handler. This method first requests the
- * raw XML data from the remote session, and then uses an identity
- * transformation to feed the data to the given XML content handler.
- * Possible IO and transformer exceptions are thrown as SAXExceptions.
- *
- * {@inheritDoc}
- */
- public void exportDocView(
- String path, ContentHandler handler,
- boolean binaryAsLink, boolean noRecurse)
- throws SAXException, RepositoryException {
- try {
- byte[] xml = remote.exportDocView(path, binaryAsLink, noRecurse);
-
- Source source = new StreamSource(new ByteArrayInputStream(xml));
- Result result = new SAXResult(handler);
-
- TransformerFactory factory = TransformerFactory.newInstance();
- Transformer transformer = factory.newTransformer();
- transformer.transform(source, result);
- } catch (RemoteException ex) {
- throw new RemoteRepositoryException(ex);
- } catch (IOException ex) {
- throw new SAXException(ex);
- } catch (TransformerConfigurationException ex) {
- throw new SAXException(ex);
- } catch (TransformerException ex) {
- throw new SAXException(ex);
- }
- }
-
- /**
- * Exports the XML document view of the specified repository location
- * to the given output stream. This method first requests the
- * raw XML data from the remote session, and then writes the data to
- * the output stream.
- *
- * {@inheritDoc}
- */
- public void exportDocView(
- String path, OutputStream output,
- boolean binaryAsLink, boolean noRecurse)
- throws IOException, RepositoryException {
- try {
- byte[] xml = remote.exportDocView(path, binaryAsLink, noRecurse);
- output.write(xml);
- } catch (RemoteException ex) {
- throw new RemoteRepositoryException(ex);
- }
- }
-}
diff --git a/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/client/ClientVersion.java b/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/client/ClientVersion.java
deleted file mode 100644
index b5bed4e9254..00000000000
--- a/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/client/ClientVersion.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * Copyright 2004-2005 The Apache Software Foundation or its licensors,
- * as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.jackrabbit.rmi.client;
-
-import java.rmi.RemoteException;
-import java.util.Calendar;
-
-import javax.jcr.RepositoryException;
-import javax.jcr.Session;
-import javax.jcr.version.Version;
-
-import org.apache.jackrabbit.rmi.remote.RemoteVersion;
-
-/**
- * Local adapter for the JCR-RMI
- * {@link org.apache.jackrabbit.rmi.remote.RemoteVersion RemoteVersion}
- * interface. This class makes a remote version locally available using
- * the JCR {@link javax.jcr.version.Version Version} interface.
- *
- * @author Felix Meschberger
- * @see javax.jcr.version.Version
- * @see org.apache.jackrabbit.rmi.remote.RemoteVersion
- */
-public class ClientVersion extends ClientNode implements Version {
-
- /** The adapted remote version. */
- private RemoteVersion remote;
-
- /**
- * Creates a local adapter for the given remote version.
- *
- * @param session current session
- * @param remote remote version
- * @param factory local adapter factory
- */
- public ClientVersion(Session session, RemoteVersion remote,
- LocalAdapterFactory factory) {
- super(session, remote, factory);
- this.remote = remote;
- }
-
- /** {@inheritDoc} */
- public Calendar getCreated() throws RepositoryException {
- try {
- return remote.getCreated();
- } catch (RemoteException ex) {
- throw new RemoteRepositoryException(ex);
- }
- }
-
- /** {@inheritDoc} */
- public Version[] getSuccessors() throws RepositoryException {
- try {
- return getVersionArray(getSession(), remote.getSuccessors());
- } catch (RemoteException ex) {
- throw new RemoteRepositoryException(ex);
- }
- }
-
- /** {@inheritDoc} */
- public Version[] getPredecessors() throws RepositoryException {
- try {
- return getVersionArray(getSession(), remote.getPredecessors());
- } catch (RemoteException ex) {
- throw new RemoteRepositoryException(ex);
- }
- }
-}
\ No newline at end of file
diff --git a/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/client/ClientVersionHistory.java b/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/client/ClientVersionHistory.java
deleted file mode 100644
index dea6927ee0a..00000000000
--- a/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/client/ClientVersionHistory.java
+++ /dev/null
@@ -1,168 +0,0 @@
-/*
- * Copyright 2004-2005 The Apache Software Foundation or its licensors,
- * as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.jackrabbit.rmi.client;
-
-import java.rmi.RemoteException;
-
-import javax.jcr.RepositoryException;
-import javax.jcr.Session;
-import javax.jcr.UnsupportedRepositoryOperationException;
-import javax.jcr.version.Version;
-import javax.jcr.version.VersionException;
-import javax.jcr.version.VersionHistory;
-import javax.jcr.version.VersionIterator;
-
-import org.apache.jackrabbit.rmi.remote.RemoteVersionHistory;
-
-/**
- * Local adapter for the JCR-RMI
- * {@link org.apache.jackrabbit.rmi.remote.RemoteVersionHistory RemoteVersionHistory}
- * interface. This class makes a remote version history locally available using
- * the JCR {@link javax.jcr.version.VersionHistory VersionHistory} interface.
- *
- * @author Felix Meschberger
- * @see javax.jcr.version.VersionHistory
- * @see org.apache.jackrabbit.rmi.remote.RemoteVersionHistory
- */
-public class ClientVersionHistory extends ClientNode implements VersionHistory {
-
- /** The adapted remote version history. */
- private RemoteVersionHistory remote;
-
- /**
- * Creates a local adapter for the given remote version history.
- *
- * @param session current session
- * @param remote remote version history
- * @param factory local adapter factory
- */
- public ClientVersionHistory(Session session, RemoteVersionHistory remote,
- LocalAdapterFactory factory) {
- super(session, remote, factory);
- this.remote = remote;
- }
-
- /** {@inheritDoc} */
- public Version getRootVersion() throws RepositoryException {
- try {
- return getFactory().getVersion(getSession(), remote.getRootVersion());
- } catch (RemoteException ex) {
- throw new RemoteRepositoryException(ex);
- }
- }
-
- /** {@inheritDoc} */
- public VersionIterator getAllVersions() throws RepositoryException {
- try {
- return getVersionIterator(getSession(), remote.getAllVersions());
- } catch (RemoteException ex) {
- throw new RemoteRepositoryException(ex);
- }
- }
-
- /** {@inheritDoc} */
- public Version getVersion(String versionName) throws VersionException,
- RepositoryException {
- try {
- return getFactory().getVersion(getSession(), remote.getVersion(versionName));
- } catch (RemoteException ex) {
- throw new RemoteRepositoryException(ex);
- }
- }
-
- /** {@inheritDoc} */
- public Version getVersionByLabel(String label) throws RepositoryException {
- try {
- return getFactory().getVersion(getSession(), remote.getVersionByLabel(label));
- } catch (RemoteException ex) {
- throw new RemoteRepositoryException(ex);
- }
- }
-
- /** {@inheritDoc} */
- public void addVersionLabel(String versionName, String label,
- boolean moveLabel) throws VersionException, RepositoryException {
- try {
- remote.addVersionLabel(versionName, label, moveLabel);
- } catch (RemoteException ex) {
- throw new RemoteRepositoryException(ex);
- }
- }
-
- /** {@inheritDoc} */
- public void removeVersionLabel(String label)
- throws VersionException, RepositoryException {
- try {
- remote.removeVersionLabel(label);
- } catch (RemoteException ex) {
- throw new RemoteRepositoryException(ex);
- }
- }
-
- /** {@inheritDoc} */
- public boolean hasVersionLabel(String label) {
- try {
- return remote.hasVersionLabel(label);
- } catch (RemoteException ex) {
- // grok the exception and assume label is missing
- return false;
- }
- }
-
- /** {@inheritDoc} */
- public boolean hasVersionLabel(Version version, String label)
- throws VersionException, RepositoryException {
- try {
- String versionUUID = version.getUUID();
- return remote.hasVersionLabel(versionUUID, label);
- } catch (RemoteException ex) {
- throw new RemoteRepositoryException(ex);
- }
- }
-
- /** {@inheritDoc} */
- public String[] getVersionLabels() {
- try {
- return remote.getVersionLabels();
- } catch (RemoteException ex) {
- // grok the exception and return an empty array
- return new String[0];
- }
- }
-
- /** {@inheritDoc} */
- public String[] getVersionLabels(Version version)
- throws VersionException, RepositoryException {
- try {
- String versionUUID = version.getUUID();
- return remote.getVersionLabels(versionUUID);
- } catch (RemoteException ex) {
- throw new RemoteRepositoryException(ex);
- }
- }
-
- /** {@inheritDoc} */
- public void removeVersion(String versionName)
- throws UnsupportedRepositoryOperationException, VersionException,
- RepositoryException {
- try {
- remote.removeVersion(versionName);
- } catch (RemoteException ex) {
- throw new RemoteRepositoryException(ex);
- }
- }
-}
diff --git a/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/client/ClientWorkspace.java b/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/client/ClientWorkspace.java
deleted file mode 100644
index d6085677963..00000000000
--- a/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/client/ClientWorkspace.java
+++ /dev/null
@@ -1,207 +0,0 @@
-/*
- * Copyright 2004-2005 The Apache Software Foundation or its licensors,
- * as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.jackrabbit.rmi.client;
-
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.rmi.RemoteException;
-
-import javax.jcr.NamespaceRegistry;
-import javax.jcr.RepositoryException;
-import javax.jcr.Session;
-import javax.jcr.UnsupportedRepositoryOperationException;
-import javax.jcr.Workspace;
-import javax.jcr.nodetype.NodeTypeManager;
-import javax.jcr.observation.ObservationManager;
-import javax.jcr.query.QueryManager;
-import javax.jcr.version.Version;
-
-import org.apache.jackrabbit.rmi.remote.RemoteNamespaceRegistry;
-import org.apache.jackrabbit.rmi.remote.RemoteNodeTypeManager;
-import org.apache.jackrabbit.rmi.remote.RemoteQueryManager;
-import org.apache.jackrabbit.rmi.remote.RemoteWorkspace;
-import org.apache.jackrabbit.rmi.xml.WorkspaceImportContentHandler;
-import org.xml.sax.ContentHandler;
-
-/**
- * Local adapter for the JCR-RMI {@link RemoteWorkspace RemoteWorkspace}
- * interface. This class makes a remote workspace locally available using
- * the JCR {@link Workspace Workspace} interface.
- *
- * @author Jukka Zitting
- * @author Philipp Koch
- * @see javax.jcr.Workspace
- * @see org.apache.jackrabbit.rmi.remote.RemoteWorkspace
- */
-public class ClientWorkspace extends ClientObject implements Workspace {
-
- /** The current session. */
- private Session session;
-
- /** The adapted remote workspace. */
- private RemoteWorkspace remote;
-
- /**
- * Creates a client adapter for the given remote workspace.
- *
- * @param session current session
- * @param remote remote workspace
- * @param factory local adapter factory
- */
- public ClientWorkspace(
- Session session, RemoteWorkspace remote,
- LocalAdapterFactory factory) {
- super(factory);
- this.session = session;
- this.remote = remote;
- }
-
- /**
- * Returns the current session without contacting the remote workspace.
- *
- * {@inheritDoc}
- */
- public Session getSession() {
- return session;
- }
-
- /** {@inheritDoc} */
- public String getName() {
- try {
- return remote.getName();
- } catch (RemoteException ex) {
- throw new RemoteRuntimeException(ex);
- }
- }
-
- /** {@inheritDoc} */
- public void copy(String from, String to) throws RepositoryException {
- try {
- remote.copy(from, to);
- } catch (RemoteException ex) {
- throw new RemoteRepositoryException(ex);
- }
- }
-
- /** {@inheritDoc} */
- public void copy(String workspace, String to, String from)
- throws RepositoryException {
- try {
- remote.copy(workspace, from, to);
- } catch (RemoteException ex) {
- throw new RemoteRepositoryException(ex);
- }
- }
-
- /** {@inheritDoc} */
- public void move(String from, String to) throws RepositoryException {
- try {
- remote.move(from, to);
- } catch (RemoteException ex) {
- throw new RemoteRepositoryException(ex);
- }
- }
-
- /** {@inheritDoc} */
- public QueryManager getQueryManager() throws RepositoryException {
- try {
- RemoteQueryManager manager = remote.getQueryManager();
- return getFactory().getQueryManager(session, manager);
- } catch (RemoteException ex) {
- throw new RemoteRepositoryException(ex);
- }
- }
-
- /** {@inheritDoc} */
- public NamespaceRegistry getNamespaceRegistry() throws RepositoryException {
- try {
- RemoteNamespaceRegistry registry = remote.getNamespaceRegistry();
- return getFactory().getNamespaceRegistry(registry);
- } catch (RemoteException ex) {
- throw new RemoteRepositoryException(ex);
- }
- }
-
- /** {@inheritDoc} */
- public NodeTypeManager getNodeTypeManager() throws RepositoryException {
- try {
- RemoteNodeTypeManager manager = remote.getNodeTypeManager();
- return getFactory().getNodeTypeManager(manager);
- } catch (RemoteException ex) {
- throw new RemoteRepositoryException(ex);
- }
- }
-
- /** {@inheritDoc} */
- public ObservationManager getObservationManager()
- throws RepositoryException {
- // TODO Auto-generated method stub
- // return null;
- throw new UnsupportedRepositoryOperationException();
- }
-
- /** {@inheritDoc} */
- public void clone(
- String workspace, String src, String dst, boolean removeExisting)
- throws RepositoryException {
- try {
- remote.clone(workspace, src, dst, removeExisting);
- } catch (RemoteException ex) {
- throw new RemoteRepositoryException(ex);
- }
- }
-
- /** {@inheritDoc} */
- public String[] getAccessibleWorkspaceNames() throws RepositoryException {
- try {
- return remote.getAccessibleWorkspaceNames();
- } catch (RemoteException ex) {
- throw new RemoteRepositoryException(ex);
- }
- }
-
- /** {@inheritDoc} */
- public ContentHandler getImportContentHandler(
- String path, int uuidBehaviour)
- throws RepositoryException {
- return new WorkspaceImportContentHandler(this, path, uuidBehaviour);
- }
-
- /** {@inheritDoc} */
- public void importXML(String path, InputStream xml, int uuidBehaviour)
- throws IOException, RepositoryException {
- try {
- ByteArrayOutputStream buffer = new ByteArrayOutputStream();
- byte[] bytes = new byte[4096];
- for (int n = xml.read(bytes); n != -1; n = xml.read(bytes)) {
- buffer.write(bytes, 0, n);
- }
- remote.importXML(path, buffer.toByteArray(), uuidBehaviour);
- } catch (RemoteException ex) {
- throw new RemoteRepositoryException(ex);
- }
- }
-
- /** {@inheritDoc} */
- public void restore(Version[] versions, boolean removeExisting)
- throws RepositoryException {
- // TODO Auto-generated method stub
- throw new UnsupportedRepositoryOperationException();
- }
-
-}
diff --git a/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/client/LocalAdapterFactory.java b/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/client/LocalAdapterFactory.java
deleted file mode 100644
index 98c8abadfe5..00000000000
--- a/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/client/LocalAdapterFactory.java
+++ /dev/null
@@ -1,259 +0,0 @@
-/*
- * Copyright 2004-2005 The Apache Software Foundation or its licensors,
- * as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.jackrabbit.rmi.client;
-
-import javax.jcr.Item;
-import javax.jcr.NamespaceRegistry;
-import javax.jcr.Node;
-import javax.jcr.Property;
-import javax.jcr.Repository;
-import javax.jcr.Session;
-import javax.jcr.Workspace;
-import javax.jcr.lock.Lock;
-import javax.jcr.nodetype.ItemDef;
-import javax.jcr.nodetype.NodeDef;
-import javax.jcr.nodetype.NodeType;
-import javax.jcr.nodetype.NodeTypeManager;
-import javax.jcr.nodetype.PropertyDef;
-import javax.jcr.query.Query;
-import javax.jcr.query.QueryManager;
-import javax.jcr.query.QueryResult;
-import javax.jcr.query.Row;
-import javax.jcr.version.Version;
-import javax.jcr.version.VersionHistory;
-
-import org.apache.jackrabbit.rmi.remote.RemoteItem;
-import org.apache.jackrabbit.rmi.remote.RemoteItemDef;
-import org.apache.jackrabbit.rmi.remote.RemoteLock;
-import org.apache.jackrabbit.rmi.remote.RemoteNamespaceRegistry;
-import org.apache.jackrabbit.rmi.remote.RemoteNode;
-import org.apache.jackrabbit.rmi.remote.RemoteNodeDef;
-import org.apache.jackrabbit.rmi.remote.RemoteNodeType;
-import org.apache.jackrabbit.rmi.remote.RemoteNodeTypeManager;
-import org.apache.jackrabbit.rmi.remote.RemoteProperty;
-import org.apache.jackrabbit.rmi.remote.RemotePropertyDef;
-import org.apache.jackrabbit.rmi.remote.RemoteQuery;
-import org.apache.jackrabbit.rmi.remote.RemoteQueryManager;
-import org.apache.jackrabbit.rmi.remote.RemoteQueryResult;
-import org.apache.jackrabbit.rmi.remote.RemoteRepository;
-import org.apache.jackrabbit.rmi.remote.RemoteRow;
-import org.apache.jackrabbit.rmi.remote.RemoteSession;
-import org.apache.jackrabbit.rmi.remote.RemoteVersion;
-import org.apache.jackrabbit.rmi.remote.RemoteVersionHistory;
-import org.apache.jackrabbit.rmi.remote.RemoteWorkspace;
-
-/**
- * Factory interface for creating local adapters for remote references.
- * This interface defines how remote JCR-RMI references are adapted
- * back to the normal JCR interfaces. The adaption mechanism can be
- * modified (for example to add extra features) by changing the
- * local adapter factory used by the repository client.
- *
- * Note that the
- * {@link org.apache.jackrabbit.rmi.client.ClientObject ClientObject}
- * base class provides a number of utility methods designed to work with
- * a local adapter factory. Adapter implementations may want to inherit
- * that functionality by subclassing from ClientObject.
- *
- * @author Jukka Zitting
- * @author Philipp Koch
- * @see org.apache.jackrabbit.rmi.server.RemoteAdapterFactory
- * @see org.apache.jackrabbit.rmi.client.ClientAdapterFactory
- * @see org.apache.jackrabbit.rmi.client.ClientObject
- */
-public interface LocalAdapterFactory {
-
- /**
- * Factory method for creating a local adapter for a remote repository.
- *
- * @param remote remote repository
- * @return local repository adapter
- */
- Repository getRepository(RemoteRepository remote);
-
- /**
- * Factory method for creating a local adapter for a remote session.
- *
- * @param repository current repository
- * @param remote remote session
- * @return local session adapter
- */
- Session getSession(Repository repository, RemoteSession remote);
-
- /**
- * Factory method for creating a local adapter for a remote workspace.
- *
- * @param session current session
- * @param remote remote workspace
- * @return local workspace adapter
- */
- Workspace getWorkspace(Session session, RemoteWorkspace remote);
-
- /**
- * Factory method for creating a local adapter for a remote namespace
- * registry.
- *
- * @param remote remote namespace registry
- * @return local namespace registry adapter
- */
- NamespaceRegistry getNamespaceRegistry(RemoteNamespaceRegistry remote);
-
- /**
- * Factory method for creating a local adapter for a remote node type
- * manager.
- *
- * @param remote remote node type manager
- * @return local node type manager adapter
- */
- NodeTypeManager getNodeTypeManager(RemoteNodeTypeManager remote);
-
- /**
- * Factory method for creating a local adapter for a remote item.
- * Note that before calling this method, the client may want to
- * introspect the remote item reference to determine whether to use the
- * {@link #getNode(Session, RemoteNode) getNode} or
- * {@link #getProperty(Session, RemoteProperty) getProperty} method
- * instead, as the adapter returned by this method will only cover
- * the basic {@link Item Item} interface.
- *
- * @param session current session
- * @param remote remote item
- * @return local item adapter
- */
- Item getItem(Session session, RemoteItem remote);
-
- /**
- * Factory method for creating a local adapter for a remote property.
- *
- * @param session current session
- * @param remote remote property
- * @return local property adapter
- */
- Property getProperty(Session session, RemoteProperty remote);
-
- /**
- * Factory method for creating a local adapter for a remote node.
- *
- * @param session current session
- * @param remote remote node
- * @return local node adapter
- */
- Node getNode(Session session, RemoteNode remote);
-
- /**
- * Factory method for creating a local adapter for a remote version.
- *
- * @param session current session
- * @param remote remote version
- * @return local version adapter
- */
- Version getVersion(Session session, RemoteVersion remote);
-
- /**
- * Factory method for creating a local adapter for a remote version history.
- *
- * @param session current session
- * @param remote remote version history
- * @return local version history adapter
- */
- VersionHistory getVersionHistory(Session session, RemoteVersionHistory remote);
-
- /**
- * Factory method for creating a local adapter for a remote node type.
- *
- * @param remote remote node type
- * @return local node type adapter
- */
- NodeType getNodeType(RemoteNodeType remote);
-
- /**
- * Factory method for creating a local adapter for a remote item
- * definition. Note that before calling this method, the client may want to
- * introspect the remote item definition to determine whether to use the
- * {@link #getNodeDef(RemoteNodeDef) getNodeDef} or
- * {@link #getPropertyDef(RemotePropertyDef) getPropertyDef} method
- * instead, as the adapter returned by this method will only cover
- * the {@link ItemDef ItemDef} base interface.
- *
- * @param remote remote item definition
- * @return local item definition adapter
- */
- ItemDef getItemDef(RemoteItemDef remote);
-
- /**
- * Factory method for creating a local adapter for a remote node
- * definition.
- *
- * @param remote remote node definition
- * @return local node definition adapter
- */
- NodeDef getNodeDef(RemoteNodeDef remote);
-
- /**
- * Factory method for creating a local adapter for a remote property
- * definition.
- *
- * @param remote remote property definition
- * @return local property definition adapter
- */
- PropertyDef getPropertyDef(RemotePropertyDef remote);
-
- /**
- * Factory method for creating a local adapter for a remote lock.
- *
- * @param node current node
- * @param remote remote lock
- * @return local lock adapter
- */
- Lock getLock(Node node, RemoteLock remote);
-
- /**
- * Factory method for creating a local adapter for a remote query manager.
- *
- * @param session current session
- * @param remote remote query manager
- * @return local query manager adapter
- */
- QueryManager getQueryManager(Session session, RemoteQueryManager remote);
-
- /**
- * Factory method for creating a local adapter for a remote query.
- *
- * @param session current session
- * @param remote remote query
- * @return local query adapter
- */
- Query getQuery(Session session, RemoteQuery remote);
-
- /**
- * Factory method for creating a local adapter for a remote query result.
- *
- * @param session current session
- * @param remote remote query result
- * @return local query result adapter
- */
- QueryResult getQueryResult(Session session, RemoteQueryResult remote);
-
- /**
- * Factory method for creating a local adapter for a remote query row.
- *
- * @param remote remote query row
- * @return local query row adapter
- */
- Row getRow(RemoteRow remote);
-
-}
diff --git a/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/client/RemoteRepositoryException.java b/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/client/RemoteRepositoryException.java
deleted file mode 100644
index 0f7d2f32267..00000000000
--- a/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/client/RemoteRepositoryException.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Copyright 2004-2005 The Apache Software Foundation or its licensors,
- * as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.jackrabbit.rmi.client;
-
-import java.rmi.RemoteException;
-
-import javax.jcr.RepositoryException;
-
-/**
- * JCR-RMI remote exception. Used by the JCR-RMI client to wrap RMI errors
- * into RepositoryExceptions to avoid breaking the JCR interfaces.
- *
- * Note that if a RemoteException is received by call with no declared
- * exceptions, then the RemoteException is wrapped into a
- * RemoteRuntimeException.
- *
- * @author Jukka Zitting
- */
-public class RemoteRepositoryException extends RepositoryException {
-
- /**
- * Creates a RemoteRepositoryException based on the given RemoteException.
- *
- * @param ex the remote exception
- */
- public RemoteRepositoryException(RemoteException ex) {
- super(ex);
- }
-
-}
diff --git a/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/client/RemoteRuntimeException.java b/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/client/RemoteRuntimeException.java
deleted file mode 100644
index 80fbf3a011e..00000000000
--- a/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/client/RemoteRuntimeException.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Copyright 2004-2005 The Apache Software Foundation or its licensors,
- * as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.jackrabbit.rmi.client;
-
-import java.rmi.RemoteException;
-
-/**
- * JCR-RMI remote runtime exception. Used by the JCR-RMI client to wrap
- * RMI errors into RuntimeExceptions to avoid breaking the JCR interfaces.
- *
- * Note that if a RemoteException is received by call that declares to
- * throw RepositoryExceptions, then the RemoteException is wrapped into
- * a RemoteRepositoryException.
- *
- * @author Jukka Zitting
- */
-public class RemoteRuntimeException extends RuntimeException {
-
- /**
- * Creates a RemoteRuntimeException based on the given RemoteException.
- *
- * @param ex the remote exception
- */
- public RemoteRuntimeException(RemoteException ex) {
- super(ex);
- }
-
-}
diff --git a/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/client/package.html b/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/client/package.html
deleted file mode 100644
index b343705eb0e..00000000000
--- a/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/client/package.html
+++ /dev/null
@@ -1,60 +0,0 @@
-
-This package contains the default client implementation of the
-transparent JCR-RMI layer. The classes in this package can be used
-to make a remote JCR-RMI service seem like a local JCR repository.
-
-The contents of this package is designed using two design patterns,
-Factory and Adapter. All the ClientObject subclasses implement the
-Adapter pattern to adapt a remote JCR-RMI reference to the corresponding
-local JCR interface. The Factory pattern is used to centralize the
-creation and configuration of all adapter instances.
-
-
-The ClientRepositoryFactory class provides a convenient mechanism for
-looking up a remote JCR-RMI repository. The factory can be used either
-directly or as a JNDI object factory.
-
-The following example shows how to use the ClientRepositoryFactory
-directly:
-
-
-The ClientRepositoryFactory can also be used via JNDI. The following
-example settings and code demonstrate how to configure and use the
-transparent JCR-RMI layer in a Tomcat 5.5 web application:
-
-
-Note that in the example above only the context.xml configuration file
-contains a direct references to the JCR-RMI layer. All other parts of the
-web application can be implemented using the standard JCR interfaces.
-
-
diff --git a/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/iterator/ArrayIterator.java b/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/iterator/ArrayIterator.java
deleted file mode 100644
index c956ce6862e..00000000000
--- a/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/iterator/ArrayIterator.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * Copyright 2004-2005 The Apache Software Foundation or its licensors,
- * as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.jackrabbit.rmi.iterator;
-
-import javax.jcr.RangeIterator;
-
-/**
- * Array implementation of the JCR
- * {@link javax.jcr.RangeIterator RangeIterator} interface. This class
- * implements the RangeIterator functionality for an underlying array
- * of objects. Used as the base class for the type-specific iterator
- * classes defined in this package.
- *
- * @author Jukka Zitting
- */
-public class ArrayIterator implements RangeIterator {
-
- /** The current iterator position. */
- private int position;
-
- /** The underlying array of objects. */
- private Object[] array;
-
- /**
- * Creates an iterator for the given array of objects.
- *
- * @param array the objects to iterate
- */
- public ArrayIterator(Object[] array) {
- this.position = 0;
- this.array = array;
- }
-
- /** {@inheritDoc} */
- public boolean hasNext() {
- return (position < array.length);
- }
-
- /** {@inheritDoc} */
- public Object next() {
- return array[position++];
- }
-
- /** {@inheritDoc} */
- public void remove() {
- throw new UnsupportedOperationException();
- }
-
- /** {@inheritDoc} */
- public void skip(long items) {
- position += items;
- }
-
- /** {@inheritDoc} */
- public long getSize() {
- return array.length;
- }
-
- /** {@inheritDoc} */
- public long getPos() {
- return position;
- }
-
-}
diff --git a/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/iterator/ArrayNodeIterator.java b/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/iterator/ArrayNodeIterator.java
deleted file mode 100644
index 233bd860029..00000000000
--- a/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/iterator/ArrayNodeIterator.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Copyright 2004-2005 The Apache Software Foundation or its licensors,
- * as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.jackrabbit.rmi.iterator;
-
-import javax.jcr.Node;
-import javax.jcr.NodeIterator;
-
-/**
- * Array implementation of the JCR
- * {@link javax.jcr.NodeIterator NodeIterator} interface.
- * This class is used by the JCR-RMI client adapters to convert
- * node arrays to iterators.
- *
- * @author Jukka Zitting
- */
-public class ArrayNodeIterator extends ArrayIterator implements NodeIterator {
-
- /**
- * Creates an iterator for the given array of nodes.
- *
- * @param nodes the nodes to iterate
- */
- public ArrayNodeIterator(Node[] nodes) {
- super(nodes);
- }
-
- /** {@inheritDoc} */
- public Node nextNode() {
- return (Node) next();
- }
-
-}
diff --git a/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/iterator/ArrayNodeTypeIterator.java b/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/iterator/ArrayNodeTypeIterator.java
deleted file mode 100644
index f41eea5cae3..00000000000
--- a/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/iterator/ArrayNodeTypeIterator.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Copyright 2004-2005 The Apache Software Foundation or its licensors,
- * as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.jackrabbit.rmi.iterator;
-
-import javax.jcr.nodetype.NodeType;
-import javax.jcr.nodetype.NodeTypeIterator;
-
-/**
- * Array implementation of the JCR
- * {@link javax.jcr.NodeTypeIterator NodeTypeIterator} interface.
- * This class is used by the JCR-RMI client adapters to convert
- * node type arrays to iterators.
- *
- * @author Jukka Zitting
- */
-public class ArrayNodeTypeIterator extends ArrayIterator implements
- NodeTypeIterator {
-
- /**
- * Creates an iterator for the given array of node types.
- *
- * @param types the node types to iterate
- */
- public ArrayNodeTypeIterator(NodeType[] types) {
- super(types);
- }
-
- /** {@inheritDoc} */
- public NodeType nextNodeType() {
- return (NodeType) next();
- }
-
-}
diff --git a/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/iterator/ArrayPropertyIterator.java b/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/iterator/ArrayPropertyIterator.java
deleted file mode 100644
index f53e79dbde5..00000000000
--- a/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/iterator/ArrayPropertyIterator.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Copyright 2004-2005 The Apache Software Foundation or its licensors,
- * as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.jackrabbit.rmi.iterator;
-
-import javax.jcr.Property;
-import javax.jcr.PropertyIterator;
-
-/**
- * Array implementation of the JCR
- * {@link javax.jcr.PropertyIterator PropertyIterator} interface.
- * This class is used by the JCR-RMI client adapters to convert
- * property arrays to iterators.
- *
- * @author Jukka Zitting
- */
-public class ArrayPropertyIterator extends ArrayIterator
- implements PropertyIterator {
-
- /**
- * Creates an iterator for the given array of properties.
- *
- * @param properties the properties to iterate
- */
- public ArrayPropertyIterator(Property[] properties) {
- super(properties);
- }
-
- /** {@inheritDoc} */
- public Property nextProperty() {
- return (Property) next();
- }
-
-}
diff --git a/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/iterator/ArrayRowIterator.java b/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/iterator/ArrayRowIterator.java
deleted file mode 100644
index d04d7ae0a94..00000000000
--- a/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/iterator/ArrayRowIterator.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Copyright 2004-2005 The Apache Software Foundation or its licensors,
- * as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.jackrabbit.rmi.iterator;
-
-import javax.jcr.query.Row;
-import javax.jcr.query.RowIterator;
-
-/**
- * Array implementation of the JCR
- * {@link javax.jcr.query.RowIterator RowIterator} interface.
- * This class is used by the JCR-RMI client adapters to convert
- * node arrays to iterators.
- *
- * @author Philipp Koch
- */
-public class ArrayRowIterator extends ArrayIterator implements RowIterator {
-
- /**
- * Creates an iterator for the given array of rows.
- *
- * @param rows the rows to iterate
- */
- public ArrayRowIterator(Row[] rows) {
- super(rows);
- }
-
- /** {@inheritDoc} */
- public Row nextRow() {
- return (Row) next();
- }
-
-}
diff --git a/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/iterator/ArrayVersionIterator.java b/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/iterator/ArrayVersionIterator.java
deleted file mode 100644
index f81cb989b08..00000000000
--- a/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/iterator/ArrayVersionIterator.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Copyright 2004-2005 The Apache Software Foundation or its licensors,
- * as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.jackrabbit.rmi.iterator;
-
-import javax.jcr.version.Version;
-import javax.jcr.version.VersionIterator;
-
-/**
- * Array implementation of the JCR
- * {@link javax.jcr.version.VersionIterator VersionIterator} interface.
- * This class is used by the JCR-RMI client adapters to convert
- * version arrays to iterators.
- *
- * @author Felix Meschberger
- */
-public class ArrayVersionIterator extends ArrayIterator implements VersionIterator {
-
- /**
- * Creates an iterator for the given array of nodes.
- *
- * @param versions the versions to iterate
- */
- public ArrayVersionIterator(Version[] versions) {
- super(versions);
- }
-
- /** {@inheritDoc} */
- public Version nextVersion() {
- return (Version) next();
- }
-
-}
diff --git a/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/iterator/package.html b/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/iterator/package.html
deleted file mode 100644
index fc702d1ed1e..00000000000
--- a/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/iterator/package.html
+++ /dev/null
@@ -1,10 +0,0 @@
-
-This package contains array-based implementations of the JCR
-{@link javax.jcr.RangeIterator RangeIterator} interfaces.
-
-These utility classes were designed for the transparent JCR-RMI layer,
-but can easily be used as a part of any JCR repository implementation.
-This package depends only on the standard JCR and J2SE APIs.
-
diff --git a/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/remote/RemoteItemDef.java b/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/remote/RemoteItemDef.java
deleted file mode 100644
index 0e9da275211..00000000000
--- a/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/remote/RemoteItemDef.java
+++ /dev/null
@@ -1,108 +0,0 @@
-/*
- * Copyright 2004-2005 The Apache Software Foundation or its licensors,
- * as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.jackrabbit.rmi.remote;
-
-import java.rmi.Remote;
-import java.rmi.RemoteException;
-
-/**
- * Remote version of the JCR {@link javax.jcr.nodetype.ItemDef ItemDef}
- * interface. Used by the
- * {@link org.apache.jackrabbit.rmi.server.ServerItemDef ServerItemDef} and
- * {@link org.apache.jackrabbit.rmi.client.ClientItemDef ClientItemDef}
- * adapter base classes to provide transparent RMI access to remote item
- * definitions.
- *
- * The methods in this interface are documented only with a reference
- * to a corresponding ItemDef method. The remote object will simply forward
- * the method call to the underlying ItemDef instance. Argument and return
- * values, as well as possible exceptions, are copied over the network.
- * Compex {@link javax.jcr.nodetype.NodeType NodeType} return values
- * are returned as remote references to the
- * {@link org.apache.jackrabbit.rmi.remote.RemoteNodeType RemoteNodeType}
- * interface. RMI errors are signalled with RemoteExceptions.
- *
- * @author Jukka Zitting
- * @see javax.jcr.nodetype.ItemDef
- * @see org.apache.jackrabbit.rmi.client.ClientItemDef
- * @see org.apache.jackrabbit.rmi.server.ServerItemDef
- */
-public interface RemoteItemDef extends Remote {
-
- /**
- * Remote version of the
- * {@link javax.jcr.nodetype.ItemDef#getDeclaringNodeType() ItemDef.getDeclaringNodeType()}
- * method.
- *
- * @return declaring node type
- * @throws RemoteException on RMI errors
- */
- RemoteNodeType getDeclaringNodeType() throws RemoteException;
-
- /**
- * Remote version of the
- * {@link javax.jcr.nodetype.ItemDef#getName() ItemDef.getName()} method.
- *
- * @return item name
- * @throws RemoteException on RMI errors
- */
- String getName() throws RemoteException;
-
- /**
- * Remote version of the
- * {@link javax.jcr.nodetype.ItemDef#isAutoCreate() ItemDef.isAutoCreate()}
- * method.
- *
- * @return
- * The methods in this interface are documented only with a reference
- * to a corresponding Lock method. The remote object will simply forward
- * the method call to the underlying Lock instance. Return values and
- * possible exceptions are copied over the network. RMI errors are signalled
- * with RemoteExceptions.
- *
- * @author Jukka Zitting
- * @see javax.jcr.lock.Lock
- * @see org.apache.jackrabbit.rmi.client.ClientLock
- * @see org.apache.jackrabbit.rmi.server.ServerLock
- */
-public interface RemoteLock extends Remote {
-
- /**
- * Remote version of the
- * {@link javax.jcr.lock.Lock#getLockOwner() Lock.getLockOwner()} method.
- *
- * @return lock owner
- * @throws RemoteException on RMI errors
- */
- String getLockOwner() throws RemoteException;
-
- /**
- * Remote version of the
- * {@link javax.jcr.lock.Lock#isDeep() Lock.isDeep()} method.
- *
- * @return
- * The methods in this interface are documented only with a reference
- * to a corresponding NodeDef method. The remote object will simply forward
- * the method call to the underlying NodeDef instance. Return values
- * and possible exceptions are copied over the network. Complex
- * {@link javax.jcr.nodetype.NodeType NodeType} return values
- * are returned as remote references to the
- * {@link org.apache.jackrabbit.rmi.remote.RemoteNodeType RemoteNodeType}
- * interface. RMI errors are signalled with RemoteExceptions.
- *
- * @author Jukka Zitting
- * @see javax.jcr.nodetype.NodeDef
- * @see org.apache.jackrabbit.rmi.client.ClientNodeDef
- * @see org.apache.jackrabbit.rmi.server.ServerNodeDef
- */
-public interface RemoteNodeDef extends RemoteItemDef {
-
- /**
- * Remote version of the
- * {@link javax.jcr.nodetype.NodeDef#getRequiredPrimaryTypes() NodeDef.getRequiredPrimaryTypes()}
- * method.
- *
- * @return required primary node types
- * @throws RemoteException on RMI errors
- */
- RemoteNodeType[] getRequiredPrimaryTypes() throws RemoteException;
-
- /**
- * Remote version of the
- * {@link javax.jcr.nodetype.NodeDef#getDefaultPrimaryType() NodeDef.getDefaultPrimaryType()}
- * method.
- *
- * @return default primary node type
- * @throws RemoteException on RMI errors
- */
- RemoteNodeType getDefaultPrimaryType() throws RemoteException;
-
- /**
- * Remote version of the
- * {@link javax.jcr.nodetype.NodeDef#allowSameNameSibs() NodeDef.allowSameNameSibs()}
- * method.
- *
- * @return
- * The methods in this interface are documented only with a reference
- * to a corresponding NodeType method. The remote object will simply forward
- * the method call to the underlying NodeType instance. Return values
- * and possible exceptions are copied over the network. Complex return
- * values (like NodeTypes and PropertyDefs) are retunred as remote
- * references to the corresponding remote interfaces. RMI errors are
- * signalled with RemoteExceptions.
- *
- * @author Jukka Zitting
- * @see javax.jcr.nodetype.NodeType
- * @see org.apache.jackrabbit.rmi.client.ClientNodeType
- * @see org.apache.jackrabbit.rmi.server.ServerNodeType
- */
-public interface RemoteNodeType extends Remote {
-
- /**
- * Remote version of the
- * {@link javax.jcr.nodetype.NodeType#getName() NodeType.getName()} method.
- *
- * @return node type name
- * @throws RemoteException on RMI errors
- */
- String getName() throws RemoteException;
-
- /**
- * Remote version of the
- * {@link javax.jcr.nodetype.NodeType#isMixin() NodeType.isMixin()} method.
- *
- * @return
- * The methods in this interface are documented only with a reference
- * to a corresponding PropertyDef method. The remote object will simply
- * forward the method call to the underlying PropertyDef instance. Return
- * values and possible exceptions are copied over the network. RMI errors
- * are signalled with RemoteExceptions.
- *
- * Note that returned Value objects must be serializable and implemented
- * using classes available on both the client and server side. The
- * {@link org.apache.jackrabbit.rmi.remote.SerialValue SerialValue}
- * decorator utility provides a convenient way to satisfy these
- * requirements.
- *
- * @author Jukka Zitting
- * @see javax.jcr.nodetype.PropertyDef
- * @see org.apache.jackrabbit.rmi.client.ClientPropertyDef
- * @see org.apache.jackrabbit.rmi.server.ServerPropertyDef
- */
-public interface RemotePropertyDef extends RemoteItemDef {
-
- /**
- * Remote version of the
- * {@link javax.jcr.nodetype.PropertyDef#getRequiredType() PropertyDef.getRequiredType()}
- * method.
- *
- * @return required type
- * @throws RemoteException on RMI errors
- */
- int getRequiredType() throws RemoteException;
-
- /**
- * Remote version of the
- * {@link javax.jcr.nodetype.PropertyDef#getValueConstraints() PropertyDef.getValueConstraints()}
- * method.
- *
- * @return value constraints
- * @throws RemoteException on RMI errors
- */
- String[] getValueConstraints() throws RemoteException;
-
- /**
- * Remote version of the
- * {@link javax.jcr.nodetype.PropertyDef#getDefaultValues() PropertyDef.getDefaultValues()}
- * method.
- *
- * @return default values
- * @throws RemoteException on RMI errors
- */
- Value[] getDefaultValues() throws RemoteException;
-
- /**
- * Remote version of the
- * {@link javax.jcr.nodetype.PropertyDef#isMultiple() PropertyDef.isMultiple()}
- * method.
- *
- * @return
- * RMI errors are signalled with RemoteExceptions.
- *
- * @author Philipp Koch
- * @see javax.jcr.query.Query
- * @see org.apache.jackrabbit.rmi.client.ClientQuery
- * @see org.apache.jackrabbit.rmi.server.ServerQuery
- */
-public interface RemoteQuery extends Remote {
-
- /**
- * @see javax.jcr.query.Query#execute()
- *
- * @return a
- * RMI errors are signalled with RemoteExceptions.
- *
- * @author Philipp Koch
- * @see javax.jcr.query.QueryResult
- * @see org.apache.jackrabbit.rmi.client.ClientQueryResult
- * @see org.apache.jackrabbit.rmi.server.ServerQueryResult
- */
-public interface RemoteQueryResult extends Remote {
- /**
- * @see javax.jcr.query.QueryResult#getPropertyNames()
- *
- * @return a
- * The methods in this interface are documented only with a reference
- * to a corresponding Repository method. The remote object will simply
- * forward the method call to the underlying Repository instance.
- * {@link javax.jcr.Session Session} objects are returned as remote references
- * to the {@link RemoteSession RemoteSession} interface. Simple return
- * values and possible exceptions are copied over the network to the client.
- * RMI errors are signalled with RemoteExceptions.
- *
- * @author Jukka Zitting
- * @see javax.jcr.Repository
- * @see org.apache.jackrabbit.rmi.client.ClientRepository
- * @see org.apache.jackrabbit.rmi.server.ServerRepository
- */
-public interface RemoteRepository extends Remote {
-
- /**
- * Remote version of the
- * {@link javax.jcr.Repository#getDescriptor(String) Repository.getDescriptor(String)}
- * method.
- *
- * @param key descriptor key
- * @return descriptor value
- * @throws RemoteException on RMI errors
- */
- String getDescriptor(String key) throws RemoteException;
-
- /**
- * Remote version of the
- * {@link javax.jcr.Repository#getDescriptorKeys() Repository.getDescriptorKeys()}
- * method.
- *
- * @return descriptor keys
- * @throws RemoteException on RMI errors
- */
- String[] getDescriptorKeys() throws RemoteException;
-
- /**
- * Remote version of the
- * {@link javax.jcr.Repository#login() Repository.login(}} method.
- *
- * @return remote session
- * @throws RepositoryException on repository errors
- * @throws RemoteException on RMI errors
- */
- RemoteSession login() throws RepositoryException, RemoteException;
-
- /**
- * Remote version of the
- * {@link javax.jcr.Repository#login(String) Repository.login(String}}
- * method.
- *
- * @param workspace workspace name
- * @return remote session
- * @throws RepositoryException on repository errors
- * @throws RemoteException on RMI errors
- */
- RemoteSession login(String workspace)
- throws RepositoryException, RemoteException;
-
- /**
- * Remote version of the
- * {@link javax.jcr.Repository#login(Credentials) Repository.login(Credentials}}
- * method.
- *
- * @param credentials client credentials
- * @return remote session
- * @throws RepositoryException on repository errors
- * @throws RemoteException on RMI errors
- */
- RemoteSession login(Credentials credentials)
- throws RepositoryException, RemoteException;
-
- /**
- * Remote version of the
- * {@link javax.jcr.Repository#login(Credentials,String) Repository.login(Credentials,String}}
- * method.
- *
- * @param credentials client credentials
- * @param workspace workspace name
- * @return remote session
- * @throws RepositoryException on repository errors
- * @throws RemoteException on RMI errors
- */
- RemoteSession login(Credentials credentials, String workspace)
- throws RepositoryException, RemoteException;
-
-}
diff --git a/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/remote/RemoteRow.java b/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/remote/RemoteRow.java
deleted file mode 100644
index 6c82e4a8fcb..00000000000
--- a/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/remote/RemoteRow.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Copyright 2004-2005 The Apache Software Foundation or its licensors,
- * as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.jackrabbit.rmi.remote;
-
-import java.rmi.Remote;
-import java.rmi.RemoteException;
-
-import javax.jcr.RepositoryException;
-import javax.jcr.Value;
-
-/**
- * Remote version of the JCR {@link javax.jcr.query.Row Row} interface.
- * Used by the {@link org.apache.jackrabbit.rmi.server.ServerRow ServerRow}
- * and {@link org.apache.jackrabbit.rmi.client.ClientRow ClientRow}
- * adapter base classes to provide transparent RMI access to remote items.
- *
- * RMI errors are signalled with RemoteExceptions.
- *
- * @author Philipp Koch
- * @see javax.jcr.query.Row
- * @see org.apache.jackrabbit.rmi.client.ClientRow
- * @see org.apache.jackrabbit.rmi.server.ServerRow
- */
-public interface RemoteRow extends Remote {
-
- /**
- * @see javax.jcr.query.Row#getValues()
- *
- * @return row values
- * @throws RepositoryException on repository errors
- * @throws RemoteException on RMI errors
- */
- Value[] getValues() throws RepositoryException, RemoteException;
-
- /**
- * @see javax.jcr.query.Row#getValue(String)
- *
- * @param propertyName property name
- * @return identified value
- * @throws RepositoryException on repository errors
- * @throws RemoteException on RMI errors
- */
- Value getValue(String propertyName)
- throws RepositoryException, RemoteException;
-}
diff --git a/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/remote/RemoteSession.java b/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/remote/RemoteSession.java
deleted file mode 100644
index 8d133c214fb..00000000000
--- a/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/remote/RemoteSession.java
+++ /dev/null
@@ -1,360 +0,0 @@
-/*
- * Copyright 2004-2005 The Apache Software Foundation or its licensors,
- * as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.jackrabbit.rmi.remote;
-
-import java.io.IOException;
-import java.rmi.Remote;
-import java.rmi.RemoteException;
-import java.security.AccessControlException;
-
-import javax.jcr.Credentials;
-import javax.jcr.RepositoryException;
-
-/**
- * Remote version of the JCR {@link javax.jcr.Session Session} interface.
- * Used by the
- * {@link org.apache.jackrabbit.rmi.server.ServerSession ServerSession}
- * and
- * {@link org.apache.jackrabbit.rmi.client.ClientSession ClientSession}
- * adapters to provide transparent RMI access to remote sessions.
- *
- * Most of the methods in this interface are documented only with a reference
- * to a corresponding Session method. In these cases the remote object
- * will simply forward the method call to the underlying Session instance.
- * Complex return values like workspaces and other objects are returned
- * as remote references to the corresponding remote interface. Simple
- * return values and possible exceptions are simply copied over the network
- * to the client. RMI errors are signalled with RemoteExceptions.
- *
- * @author Jukka Zitting
- * @see javax.jcr.Session
- * @see org.apache.jackrabbit.rmi.client.ClientSession
- * @see org.apache.jackrabbit.rmi.server.ServerSession
- */
-public interface RemoteSession extends Remote {
-
- /**
- * Remote version of the
- * {@link javax.jcr.Session#getUserId() Session.getUserId()} method.
- *
- * @return user id
- * @throws RemoteException on RMI errors
- * @see javax.jcr.Session#getUserId()
- */
- String getUserId() throws RemoteException;
-
- /**
- * Returns the named attribute. Note that only serializable
- * attribute values can be transmitted over the network and that
- * the client should have (or be able to fetch) the object class
- * to access the returned value. Failures to meet these conditions
- * are signalled with RemoteExceptions.
- *
- * @param name attribute name
- * @return attribute value
- * @throws RemoteException on RMI errors
- * @see javax.jcr.Session#getAttribute(java.lang.String)
- */
- Object getAttribute(String name) throws RemoteException;
-
- /**
- * Remote version of the
- * {@link javax.jcr.Session#getAttributeNames() Session.getAttributeNames()}
- * method.
- *
- * @return attribute names
- * @throws RemoteException on RMI errors
- */
- String[] getAttributeNames() throws RemoteException;
-
- /**
- * Remote version of the
- * {@link javax.jcr.Session#getWorkspace() Session.getWorkspace()} method.
- *
- * @return workspace
- * @see javax.jcr.Session#getWorkspace()
- * @throws RemoteException on RMI errors
- */
- RemoteWorkspace getWorkspace() throws RemoteException;
-
- /**
- * Remote version of the
- * {@link javax.jcr.Session#impersonate(Credentials) Session.impersonate(Credentials)}
- * method.
- *
- * @param credentials credentials for the new session
- * @return new session
- * @throws RepositoryException on repository errors
- * @throws RemoteException on RMI errors
- */
- RemoteSession impersonate(Credentials credentials)
- throws RepositoryException, RemoteException;
-
- /**
- * Remote version of the
- * {@link javax.jcr.Session#getNodeByUUID(String) Session.getNodeByUUID(String)}
- * method.
- *
- * @param uuid node uuid
- * @return node
- * @throws RepositoryException on repository errors
- * @throws RemoteException on RMI errors
- */
- RemoteNode getNodeByUUID(String uuid)
- throws RepositoryException, RemoteException;
-
- /**
- * Remote version of the
- * {@link javax.jcr.Session#getItem(String) Session.getItem(String)}
- * method.
- *
- * @param path item path
- * @return item
- * @throws RepositoryException on repository errors
- * @throws RemoteException on RMI errors
- */
- RemoteItem getItem(String path) throws RepositoryException, RemoteException;
-
- /**
- * Remote version of the
- * {@link javax.jcr.Session#itemExists(String) Session.itemExists(String)}
- * method.
- *
- * @param path item path
- * @return
- * The methods in this interface are documented only with a reference
- * to a corresponding Version method. The remote object will simply forward
- * the method call to the underlying Version instance. Argument and return
- * values, as well as possible exceptions, are copied over the network.
- * Complex return values (like Versions) are returned as remote
- * references to the corresponding remote interfaces. Iterator values
- * are transmitted as object arrays. RMI errors are signalled with
- * RemoteExceptions.
- *
- * @author Felix Meschberger
- * @see javax.jcr.version.Version
- * @see org.apache.jackrabbit.rmi.client.ClientVersion
- * @see org.apache.jackrabbit.rmi.server.ServerVersion
- */
-public interface RemoteVersion extends RemoteNode {
-
- /**
- * Remote version of the
- * {@link javax.jcr.version.Version#getContainingHistory() Version.getContainingHistory()} method.
- *
- * @return a
- * The methods in this interface are documented only with a reference
- * to a corresponding VersionHistory method. The remote object will simply
- * forward the method call to the underlying VersionHistory instance. Argument
- * and return values, as well as possible exceptions, are copied over the
- * network. Complex return values (like Versions) are returned as remote
- * references to the corresponding remote interfaces. Iterator values
- * are transmitted as object arrays. RMI errors are signalled with
- * RemoteExceptions.
- *
- * @author Felix Meschberger
- * @see javax.jcr.version.Version
- * @see org.apache.jackrabbit.rmi.client.ClientVersionHistory
- * @see org.apache.jackrabbit.rmi.server.ServerVersionHistory
- */
-public interface RemoteVersionHistory extends RemoteNode {
-
- /**
- * Remote version of the
- * {@link javax.jcr.version.VersionHistory#getVersionableUUID() VersionHistory.getVersionableUUID()}
- * method.
- *
- * @return the UUID of the versionable node for which this is the version history.
- * @throws RepositoryException if an error occurs.
- * @throws RemoteException on RMI errors
- */
-// String getVersionableUUID() throws RepositoryException, RemoteException;
-
- /**
- * Remote version of the
- * {@link javax.jcr.version.VersionHistory#getRootVersion() VersionHistory.getRootVersion()}
- * method.
- *
- * @return a
- * Serialization is achieved by extracting and serializing the type and
- * underlying data of the Value object. On deserialization the type and
- * data information is used to create a standard JCR Value object as
- * a copy of the original value. This makes it possible to copy even
- * system-specific Value instances to a remote JVM that might not contain
- * the implementation class of the original Value object.
- *
- * The SerialValue decorator adds no other functionality to the Value
- * interface. Normal method calls are simply forwarded to the decorated
- * Value object.
- *
- * Note that a decorator object keeps a reference to the underlying value
- * object and uses the standard value access methods to perform serialization.
- * Serialization therefore affects the internal state of the underlying value!
- * On the other hand, the internal state of a value might interfere with the
- * serialization decorator. The safest course of action is to only decorate
- * and serialize fresh value objects and to discard them after serialization.
- *
- * @author Jukka Zitting
- * @see javax.jcr.Value
- * @see java.io.Serializable
- */
-public class SerialValue implements Value, Serializable {
-
- /** Static serial version UID. */
- static final long serialVersionUID = 8070492457339121953L;
-
- /** The decorated value. */
- private Value value;
-
- /**
- * Creates a serialization decorator for the given value.
- *
- * @param value the value to be decorated
- */
- public SerialValue(Value value) {
- this.value = value;
- }
-
- /**
- * Utility method for decorating an array of values. The
- * returned array will contain SerialValue decorators for
- * all the given values. Note that the contents of the
- * original values will only be copied when the decorators
- * are serialized.
- *
- * If the given array is
-This package contains all the interfaces and classes used by both
-the client and server sides of the transparent JCR-RMI layer.
-The compiled contents of this package should thus be included
-in both client and server installations. Note also that RMI stubs and
-skeletons need to be generated for all the remote interfaces when using
-old JDK versions (stubs for JDK < 1.5, skeletons for JDK < 1.2).
-
-The interfaces in this package are remote versions of the
-corresponding interfaces in the javax.jcr packages. They are used by
-the adapter classes in the .rmi.client and .rmi.server packages. The server
-classes adapt local JCR objects to the remote interfaces, and the client
-classes adapt the resulting remote references back to the JCR interfaces.
-
-The SerialValue class is a decorator utility used by both the client and
-server classes to safely pass Value objects over the network.
-
diff --git a/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/RemoteAdapterFactory.java b/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/RemoteAdapterFactory.java
deleted file mode 100644
index 6dd5923e355..00000000000
--- a/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/RemoteAdapterFactory.java
+++ /dev/null
@@ -1,271 +0,0 @@
-/*
- * Copyright 2004-2005 The Apache Software Foundation or its licensors,
- * as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.jackrabbit.rmi.server;
-
-import java.rmi.RemoteException;
-
-import javax.jcr.Item;
-import javax.jcr.NamespaceRegistry;
-import javax.jcr.Node;
-import javax.jcr.Property;
-import javax.jcr.Repository;
-import javax.jcr.Session;
-import javax.jcr.Workspace;
-import javax.jcr.lock.Lock;
-import javax.jcr.nodetype.ItemDef;
-import javax.jcr.nodetype.NodeDef;
-import javax.jcr.nodetype.NodeType;
-import javax.jcr.nodetype.NodeTypeManager;
-import javax.jcr.nodetype.PropertyDef;
-import javax.jcr.query.Query;
-import javax.jcr.query.QueryManager;
-import javax.jcr.query.QueryResult;
-import javax.jcr.query.Row;
-import javax.jcr.version.Version;
-import javax.jcr.version.VersionHistory;
-
-import org.apache.jackrabbit.rmi.remote.RemoteItem;
-import org.apache.jackrabbit.rmi.remote.RemoteItemDef;
-import org.apache.jackrabbit.rmi.remote.RemoteLock;
-import org.apache.jackrabbit.rmi.remote.RemoteNamespaceRegistry;
-import org.apache.jackrabbit.rmi.remote.RemoteNode;
-import org.apache.jackrabbit.rmi.remote.RemoteNodeDef;
-import org.apache.jackrabbit.rmi.remote.RemoteNodeType;
-import org.apache.jackrabbit.rmi.remote.RemoteNodeTypeManager;
-import org.apache.jackrabbit.rmi.remote.RemoteProperty;
-import org.apache.jackrabbit.rmi.remote.RemotePropertyDef;
-import org.apache.jackrabbit.rmi.remote.RemoteQuery;
-import org.apache.jackrabbit.rmi.remote.RemoteQueryManager;
-import org.apache.jackrabbit.rmi.remote.RemoteQueryResult;
-import org.apache.jackrabbit.rmi.remote.RemoteRepository;
-import org.apache.jackrabbit.rmi.remote.RemoteRow;
-import org.apache.jackrabbit.rmi.remote.RemoteSession;
-import org.apache.jackrabbit.rmi.remote.RemoteVersion;
-import org.apache.jackrabbit.rmi.remote.RemoteVersionHistory;
-import org.apache.jackrabbit.rmi.remote.RemoteWorkspace;
-
-/**
- * Factory interface for creating remote adapters for local resources.
- * This interface defines how the local JCR interfaces are adapted to
- * remote JCR-RMI references. The adaption mechanism can be
- * modified (for example to add extra features) by changing the
- * remote adapter factory used by the repository server.
- *
- * Note that the {@link ServerObject ServerObject} base class provides
- * a number of utility methods designed to work with a remote adapter
- * factory. Adapter implementations may want to inherit that functionality
- * by subclassing from ServerObject.
- *
- * @author Jukka Zitting
- * @author Philipp Koch
- * @see org.apache.jackrabbit.rmi.client.LocalAdapterFactory
- * @see org.apache.jackrabbit.rmi.server.ServerAdapterFactory
- * @see org.apache.jackrabbit.rmi.server.ServerObject
- */
-public interface RemoteAdapterFactory {
-
- /**
- * Returns a remote adapter for the given local repository.
- *
- * @param repository local repository
- * @return remote repository adapter
- * @throws RemoteException on RMI errors
- */
- RemoteRepository getRemoteRepository(Repository repository)
- throws RemoteException;
-
- /**
- * Returns a remote adapter for the given local session.
- *
- * @param session local session
- * @return remote session adapter
- * @throws RemoteException on RMI errors
- */
- RemoteSession getRemoteSession(Session session) throws RemoteException;
-
- /**
- * Returns a remote adapter for the given local workspace.
- *
- * @param workspace local workspace
- * @return remote workspace adapter
- * @throws RemoteException on RMI errors
- */
- RemoteWorkspace getRemoteWorkspace(Workspace workspace)
- throws RemoteException;
-
- /**
- * Returns a remote adapter for the given local namespace registry.
- *
- * @param registry local namespace registry
- * @return remote namespace registry adapter
- * @throws RemoteException on RMI errors
- */
- RemoteNamespaceRegistry getRemoteNamespaceRegistry(
- NamespaceRegistry registry) throws RemoteException;
-
- /**
- * Returns a remote adapter for the given local node type manager.
- *
- * @param manager local node type manager
- * @return remote node type manager adapter
- * @throws RemoteException on RMI errors
- */
- RemoteNodeTypeManager getRemoteNodeTypeManager(NodeTypeManager manager)
- throws RemoteException;
-
- /**
- * Returns a remote adapter for the given local item. This method
- * will return an adapter that implements only the
- * {@link Item Item} interface. The caller may want to introspect
- * the local item to determine whether to use either the
- * {@link #getRemoteNode(Node) getRemoteNode} or the
- * {@link #getRemoteProperty(Property) getRemoteProperty} method instead.
- *
- * @param item local item
- * @return remote item adapter
- * @throws RemoteException on RMI errors
- */
- RemoteItem getRemoteItem(Item item) throws RemoteException;
-
- /**
- * Returns a remote adapter for the given local property.
- *
- * @param property local property
- * @return remote property adapter
- * @throws RemoteException on RMI errors
- */
- RemoteProperty getRemoteProperty(Property property) throws RemoteException;
-
- /**
- * Returns a remote adapter for the given local node.
- *
- * @param node local node
- * @return remote node adapter
- * @throws RemoteException on RMI errors
- */
- RemoteNode getRemoteNode(Node node) throws RemoteException;
-
- /**
- * Returns a remote adapter for the given local version.
- *
- * @param version local version
- * @return remote version adapter
- * @throws RemoteException on RMI errors
- */
- RemoteVersion getRemoteVersion(Version version) throws RemoteException;
-
- /**
- * Returns a remote adapter for the given local version history.
- *
- * @param versionHistory local version history
- * @return remote version history adapter
- * @throws RemoteException on RMI errors
- */
- RemoteVersionHistory getRemoteVersionHistory(VersionHistory versionHistory)
- throws RemoteException;
-
- /**
- * Returns a remote adapter for the given local node type.
- *
- * @param type local node type
- * @return remote node type adapter
- * @throws RemoteException on RMI errors
- */
- RemoteNodeType getRemoteNodeType(NodeType type) throws RemoteException;
-
- /**
- * Returns a remote adapter for the given local item definition.
- * This method will return an adapter that implements only the
- * {@link ItemDef ItemDef} interface. The caller may want to introspect
- * the local item definition to determine whether to use either the
- * {@link #getRemoteNodeDef(NodeDef) getRemoteNodeDef} or the
- * {@link #getRemotePropertyDef(PropertyDef) getRemotePropertyDef}
- * method instead.
- *
- * @param def local item definition
- * @return remote item definition adapter
- * @throws RemoteException on RMI errors
- */
- RemoteItemDef getRemoteItemDef(ItemDef def) throws RemoteException;
-
- /**
- * Returns a remote adapter for the given local node definition.
- *
- * @param def local node definition
- * @return remote node definition adapter
- * @throws RemoteException on RMI errors
- */
- RemoteNodeDef getRemoteNodeDef(NodeDef def) throws RemoteException;
-
- /**
- * Returns a remote adapter for the given local property definition.
- *
- * @param def local property definition
- * @return remote property definition adapter
- * @throws RemoteException on RMI errors
- */
- RemotePropertyDef getRemotePropertyDef(PropertyDef def)
- throws RemoteException;
-
- /**
- * Returns a remote adapter for the given local lock.
- *
- * @param lock local lock
- * @return remote lock adapter
- * @throws RemoteException on RMI errors
- */
- RemoteLock getRemoteLock(Lock lock) throws RemoteException;
-
- /**
- * Returns a remote adapter for the given local query manager.
- *
- * @param manager local query manager
- * @return remote query manager adapter
- * @throws RemoteException on RMI errors
- */
- RemoteQueryManager getRemoteQueryManager(QueryManager manager)
- throws RemoteException;
-
- /**
- * Returns a remote adapter for the given local query.
- *
- * @param query local query
- * @return remote query adapter
- * @throws RemoteException on RMI errors
- */
- RemoteQuery getRemoteQuery(Query query) throws RemoteException;
-
- /**
- * Returns a remote adapter for the given local query result.
- *
- * @param result local query result
- * @return remote query result adapter
- * @throws RemoteException on RMI errors
- */
- RemoteQueryResult getRemoteQueryResult(QueryResult result)
- throws RemoteException;
-
- /**
- * Returns a remote adapter for the given local query row.
- *
- * @param row local query row
- * @return remote query row adapter
- * @throws RemoteException on RMI errors
- */
- RemoteRow getRemoteRow(Row row) throws RemoteException;
-
-}
diff --git a/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/ServerAdapterFactory.java b/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/ServerAdapterFactory.java
deleted file mode 100644
index 5a62804bf52..00000000000
--- a/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/ServerAdapterFactory.java
+++ /dev/null
@@ -1,241 +0,0 @@
-/*
- * Copyright 2004-2005 The Apache Software Foundation or its licensors,
- * as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.jackrabbit.rmi.server;
-
-import java.rmi.RemoteException;
-
-import javax.jcr.Item;
-import javax.jcr.NamespaceRegistry;
-import javax.jcr.Node;
-import javax.jcr.Property;
-import javax.jcr.Repository;
-import javax.jcr.Session;
-import javax.jcr.Workspace;
-import javax.jcr.lock.Lock;
-import javax.jcr.nodetype.ItemDef;
-import javax.jcr.nodetype.NodeDef;
-import javax.jcr.nodetype.NodeType;
-import javax.jcr.nodetype.NodeTypeManager;
-import javax.jcr.nodetype.PropertyDef;
-import javax.jcr.query.Query;
-import javax.jcr.query.QueryManager;
-import javax.jcr.query.QueryResult;
-import javax.jcr.query.Row;
-import javax.jcr.version.Version;
-import javax.jcr.version.VersionHistory;
-
-import org.apache.jackrabbit.rmi.remote.RemoteItem;
-import org.apache.jackrabbit.rmi.remote.RemoteItemDef;
-import org.apache.jackrabbit.rmi.remote.RemoteLock;
-import org.apache.jackrabbit.rmi.remote.RemoteNamespaceRegistry;
-import org.apache.jackrabbit.rmi.remote.RemoteNode;
-import org.apache.jackrabbit.rmi.remote.RemoteNodeDef;
-import org.apache.jackrabbit.rmi.remote.RemoteNodeType;
-import org.apache.jackrabbit.rmi.remote.RemoteNodeTypeManager;
-import org.apache.jackrabbit.rmi.remote.RemoteProperty;
-import org.apache.jackrabbit.rmi.remote.RemotePropertyDef;
-import org.apache.jackrabbit.rmi.remote.RemoteQuery;
-import org.apache.jackrabbit.rmi.remote.RemoteQueryManager;
-import org.apache.jackrabbit.rmi.remote.RemoteQueryResult;
-import org.apache.jackrabbit.rmi.remote.RemoteRepository;
-import org.apache.jackrabbit.rmi.remote.RemoteRow;
-import org.apache.jackrabbit.rmi.remote.RemoteSession;
-import org.apache.jackrabbit.rmi.remote.RemoteVersion;
-import org.apache.jackrabbit.rmi.remote.RemoteVersionHistory;
-import org.apache.jackrabbit.rmi.remote.RemoteWorkspace;
-
-/**
- * Default implementation of the
- * {@link RemoteAdapterFactory RemoteAdapterFactory} interface.
- * This factory uses the server adapters defined in this package as
- * the default adapter implementations. Subclasses can override or extend
- * the default adapters by implementing the corresponding factory methods.
- *
- * @author Jukka Zitting
- * @author Philipp Koch
- */
-public class ServerAdapterFactory implements RemoteAdapterFactory {
-
- /**
- * Creates a {@link ServerRepository ServerRepository} instance.
- * {@inheritDoc}
- */
- public RemoteRepository getRemoteRepository(Repository repository)
- throws RemoteException {
- return new ServerRepository(repository, this);
- }
-
- /**
- * Creates a {@link ServerSession ServerSession} instance.
- * {@inheritDoc}
- */
- public RemoteSession getRemoteSession(Session session)
- throws RemoteException {
- return new ServerSession(session, this);
- }
-
- /**
- * Creates a {@link ServerWorkspace ServerWorkspace} instance.
- * {@inheritDoc}
- */
- public RemoteWorkspace getRemoteWorkspace(Workspace workspace)
- throws RemoteException {
- return new ServerWorkspace(workspace, this);
- }
-
- /**
- * Creates a {@link ServerNamespaceRegistry ServerNamespaceRegistry}
- * instance.
- * {@inheritDoc}
- */
- public RemoteNamespaceRegistry getRemoteNamespaceRegistry(
- NamespaceRegistry registry)
- throws RemoteException {
- return new ServerNamespaceRegistry(registry, this);
- }
-
- /**
- * Creates a {@link ServerNodeTypeManager ServerNodeTypeManager} instance.
- * {@inheritDoc}
- */
- public RemoteNodeTypeManager getRemoteNodeTypeManager(
- NodeTypeManager manager)
- throws RemoteException {
- return new ServerNodeTypeManager(manager, this);
- }
-
- /**
- * Creates a {@link ServerItem ServerItem} instance.
- * {@inheritDoc}
- */
- public RemoteItem getRemoteItem(Item item) throws RemoteException {
- return new ServerItem(item, this);
- }
-
- /**
- * Creates a {@link ServerProperty ServerProperty} instance.
- * {@inheritDoc}
- */
- public RemoteProperty getRemoteProperty(Property property)
- throws RemoteException {
- return new ServerProperty(property, this);
- }
-
- /**
- * Creates a {@link ServerNode ServerNode} instance.
- * {@inheritDoc}
- */
- public RemoteNode getRemoteNode(Node node) throws RemoteException {
- return new ServerNode(node, this);
- }
-
- /**
- * Creates a {@link ServerVersion ServerVersion} instance.
- * {@inheritDoc}
- */
- public RemoteVersion getRemoteVersion(Version version) throws RemoteException {
- return new ServerVersion(version, this);
- }
-
- /**
- * Creates a {@link ServerVersionHistory ServerVersionHistory} instance.
- * {@inheritDoc}
- */
- public RemoteVersionHistory getRemoteVersionHistory(VersionHistory versionHistory)
- throws RemoteException {
- return new ServerVersionHistory(versionHistory, this);
- }
-
- /**
- * Creates a {@link ServerNodeType ServerNodeType} instance.
- * {@inheritDoc}
- */
- public RemoteNodeType getRemoteNodeType(NodeType type)
- throws RemoteException {
- return new ServerNodeType(type, this);
- }
-
- /**
- * Creates a {@link ServerItemDef ServerItemDef} instance.
- * {@inheritDoc}
- */
- public RemoteItemDef getRemoteItemDef(ItemDef def)
- throws RemoteException {
- return new ServerItemDef(def, this);
- }
-
- /**
- * Creates a {@link ServerNodeDef ServerNodeDef} instance.
- * {@inheritDoc}
- */
- public RemoteNodeDef getRemoteNodeDef(NodeDef def)
- throws RemoteException {
- return new ServerNodeDef(def, this);
- }
-
- /**
- * Creates a {@link ServerPropertyDef ServerPropertyDef} instance.
- * {@inheritDoc}
- */
- public RemotePropertyDef getRemotePropertyDef(PropertyDef def)
- throws RemoteException {
- return new ServerPropertyDef(def, this);
- }
-
- /**
- * Creates a {@link ServerLock ServerLock} instance.
- * {@inheritDoc}
- */
- public RemoteLock getRemoteLock(Lock lock) throws RemoteException {
- return new ServerLock(lock);
- }
-
- /**
- * Creates a {@link ServerQueryManager ServerQueryManager} instance.
- * {@inheritDoc}
- */
- public RemoteQueryManager getRemoteQueryManager(QueryManager manager)
- throws RemoteException {
- return new ServerQueryManager(manager, this);
- }
-
- /**
- * Creates a {@link ServerQuery ServerQuery} instance.
- * {@inheritDoc}
- */
- public RemoteQuery getRemoteQuery(Query query) throws RemoteException {
- return new ServerQuery(query, this);
- }
-
- /**
- * Creates a {@link ServerQueryResult ServerQueryResult} instance.
- * {@inheritDoc}
- */
- public RemoteQueryResult getRemoteQueryResult(QueryResult result)
- throws RemoteException {
- return new ServerQueryResult(result, this);
- }
-
- /**
- * Creates a {@link ServerQueryResult ServerQueryResult} instance.
- * {@inheritDoc}
- */
- public RemoteRow getRemoteRow(Row row) throws RemoteException {
- return new ServerRow(row, this);
- }
-
-}
diff --git a/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/ServerItemDef.java b/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/ServerItemDef.java
deleted file mode 100644
index b5a4d9f6447..00000000000
--- a/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/ServerItemDef.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * Copyright 2004-2005 The Apache Software Foundation or its licensors,
- * as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.jackrabbit.rmi.server;
-
-import java.rmi.RemoteException;
-
-import javax.jcr.nodetype.ItemDef;
-
-import org.apache.jackrabbit.rmi.remote.RemoteItemDef;
-import org.apache.jackrabbit.rmi.remote.RemoteNodeType;
-
-/**
- * Remote adapter for the JCR {@link javax.jcr.nodetype.ItemDef ItemDef}
- * interface. This class makes a local item definition available as an
- * RMI service using the
- * {@link org.apache.jackrabbit.rmi.remote.RemoteItemDef RemoteItemDef}
- * interface. Used mainly as the base class for the
- * {@link org.apache.jackrabbit.rmi.server.ServerPropertyDef ServerPropertyDef}
- * and
- * {@link org.apache.jackrabbit.rmi.server.ServerNodeDef ServerNodeDef}
- * adapters.
- *
- * @author Jukka Zitting
- * @see javax.jcr.nodetype.ItemDef
- * @see org.apache.jackrabbit.rmi.remote.RemoteItemDef
- */
-public class ServerItemDef extends ServerObject implements RemoteItemDef {
-
- /** The adapted local item definition. */
- private ItemDef def;
-
- /**
- * Creates a remote adapter for the given local item definition.
- *
- * @param def local item definition
- * @param factory remote adapter factory
- * @throws RemoteException on RMI errors
- */
- public ServerItemDef(ItemDef def, RemoteAdapterFactory factory)
- throws RemoteException {
- super(factory);
- this.def = def;
- }
-
- /** {@inheritDoc} */
- public RemoteNodeType getDeclaringNodeType() throws RemoteException {
- return getFactory().getRemoteNodeType(def.getDeclaringNodeType());
- }
-
- /** {@inheritDoc} */
- public String getName() throws RemoteException {
- return def.getName();
- }
-
- /** {@inheritDoc} */
- public boolean isAutoCreate() throws RemoteException {
- return def.isAutoCreate();
- }
-
- /** {@inheritDoc} */
- public boolean isMandatory() throws RemoteException {
- return def.isMandatory();
- }
-
- /** {@inheritDoc} */
- public int getOnParentVersion() throws RemoteException {
- return def.getOnParentVersion();
- }
-
- /** {@inheritDoc} */
- public boolean isProtected() throws RemoteException {
- return def.isProtected();
- }
-
-}
diff --git a/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/ServerLock.java b/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/ServerLock.java
deleted file mode 100644
index ede86cb751b..00000000000
--- a/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/ServerLock.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * Copyright 2004-2005 The Apache Software Foundation or its licensors,
- * as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.jackrabbit.rmi.server;
-
-import java.rmi.RemoteException;
-import java.rmi.server.UnicastRemoteObject;
-
-import javax.jcr.RepositoryException;
-import javax.jcr.lock.Lock;
-
-import org.apache.jackrabbit.rmi.remote.RemoteLock;
-
-/**
- * Remote adapter for the JCR {@link javax.jcr.lock.Lock Lock} interface.
- * This class makes a local lock available as an RMI service using
- * the {@link org.apache.jackrabbit.rmi.remote.RemoteLock RemoteLock}
- * interface.
- *
- * @author Jukka Zitting
- * @see javax.jcr.lock.Lock
- * @see org.apache.jackrabbit.rmi.remote.RemoteLock
- */
-public class ServerLock extends UnicastRemoteObject implements RemoteLock {
-
- /** The adapted local lock. */
- private Lock lock;
-
- /**
- * Creates a remote adapter for the given local lock.
- *
- * @param lock local lock
- * @throws RemoteException on RMI errors
- */
- public ServerLock(Lock lock) throws RemoteException {
- this.lock = lock;
- }
-
- /** {@inheritDoc} */
- public String getLockOwner() throws RemoteException {
- return lock.getLockOwner();
- }
-
- /** {@inheritDoc} */
- public boolean isDeep() throws RemoteException {
- return lock.isDeep();
- }
-
- /** {@inheritDoc} */
- public String getLockToken() throws RemoteException {
- return lock.getLockToken();
- }
-
- /** {@inheritDoc} */
- public boolean isLive() throws RemoteException {
- return lock.isLive();
- }
-
- /** {@inheritDoc} */
- public void refresh() throws RepositoryException, RemoteException {
- lock.refresh();
- }
-
-}
diff --git a/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/ServerNode.java b/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/ServerNode.java
deleted file mode 100644
index 57bc6577451..00000000000
--- a/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/ServerNode.java
+++ /dev/null
@@ -1,546 +0,0 @@
-/*
- * Copyright 2004-2005 The Apache Software Foundation or its licensors,
- * as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.jackrabbit.rmi.server;
-
-import java.rmi.RemoteException;
-
-import javax.jcr.Node;
-import javax.jcr.Property;
-import javax.jcr.RepositoryException;
-import javax.jcr.Session;
-import javax.jcr.Value;
-import javax.jcr.lock.Lock;
-import javax.jcr.version.Version;
-
-import org.apache.jackrabbit.rmi.remote.RemoteItem;
-import org.apache.jackrabbit.rmi.remote.RemoteLock;
-import org.apache.jackrabbit.rmi.remote.RemoteNode;
-import org.apache.jackrabbit.rmi.remote.RemoteNodeDef;
-import org.apache.jackrabbit.rmi.remote.RemoteNodeType;
-import org.apache.jackrabbit.rmi.remote.RemoteProperty;
-import org.apache.jackrabbit.rmi.remote.RemoteVersion;
-import org.apache.jackrabbit.rmi.remote.RemoteVersionHistory;
-
-/**
- * Remote adapter for the JCR {@link javax.jcr.Node Node} interface.
- * This class makes a local node available as an RMI service using
- * the {@link org.apache.jackrabbit.rmi.remote.RemoteNode RemoteNode}
- * interface.
- *
- * @author Jukka Zitting
- * @see javax.jcr.Node
- * @see org.apache.jackrabbit.rmi.remote.RemoteNode
- */
-public class ServerNode extends ServerItem implements RemoteNode {
-
- /** The adapted local node. */
- private Node node;
-
- /**
- * Creates a remote adapter for the given local node.
- *
- * @param node local node
- * @param factory remote adapter factory
- * @throws RemoteException on RMI errors
- */
- public ServerNode(Node node, RemoteAdapterFactory factory)
- throws RemoteException {
- super(node, factory);
- this.node = node;
- }
-
- /** {@inheritDoc} */
- public RemoteNode addNode(String path)
- throws RepositoryException, RemoteException {
- try {
- return getRemoteNode(node.addNode(path));
- } catch (RepositoryException ex) {
- throw getRepositoryException(ex);
- }
- }
-
- /** {@inheritDoc} */
- public RemoteNode addNode(String path, String type)
- throws RepositoryException, RemoteException {
- try {
- return getRemoteNode(node.addNode(path, type));
- } catch (RepositoryException ex) {
- throw getRepositoryException(ex);
- }
- }
-
- /** {@inheritDoc} */
- public RemoteProperty getProperty(String path)
- throws RepositoryException, RemoteException {
- try {
- return getFactory().getRemoteProperty(node.getProperty(path));
- } catch (RepositoryException ex) {
- throw getRepositoryException(ex);
- }
- }
-
- /** {@inheritDoc} */
- public RemoteProperty[] getProperties()
- throws RepositoryException, RemoteException {
- try {
- return getRemotePropertyArray(node.getProperties());
- } catch (RepositoryException ex) {
- throw getRepositoryException(ex);
- }
- }
-
- /** {@inheritDoc} */
- public RemoteItem getPrimaryItem()
- throws RepositoryException, RemoteException {
- try {
- return getRemoteItem(node.getPrimaryItem());
- } catch (RepositoryException ex) {
- throw getRepositoryException(ex);
- }
- }
-
- /** {@inheritDoc} */
- public RemoteProperty[] getProperties(String pattern)
- throws RepositoryException, RemoteException {
- try {
- return getRemotePropertyArray(node.getProperties(pattern));
- } catch (RepositoryException ex) {
- throw getRepositoryException(ex);
- }
- }
-
- /** {@inheritDoc} */
- public RemoteProperty[] getReferences()
- throws RepositoryException, RemoteException {
- try {
- return getRemotePropertyArray(node.getReferences());
- } catch (RepositoryException ex) {
- throw getRepositoryException(ex);
- }
- }
-
- /** {@inheritDoc} */
- public String getUUID() throws RepositoryException, RemoteException {
- try {
- return node.getUUID();
- } catch (RepositoryException ex) {
- throw getRepositoryException(ex);
- }
- }
-
- /** {@inheritDoc} */
- public boolean hasNodes() throws RepositoryException, RemoteException {
- try {
- return node.hasNodes();
- } catch (RepositoryException ex) {
- throw getRepositoryException(ex);
- }
- }
-
- /** {@inheritDoc} */
- public boolean hasProperties() throws RepositoryException, RemoteException {
- try {
- return node.hasProperties();
- } catch (RepositoryException ex) {
- throw getRepositoryException(ex);
- }
- }
-
- /** {@inheritDoc} */
- public boolean hasProperty(String path)
- throws RepositoryException, RemoteException {
- try {
- return node.hasProperty(path);
- } catch (RepositoryException ex) {
- throw getRepositoryException(ex);
- }
- }
-
- /** {@inheritDoc} */
- public RemoteNodeType[] getMixinNodeTypes()
- throws RepositoryException, RemoteException {
- try {
- return getRemoteNodeTypeArray(node.getMixinNodeTypes());
- } catch (RepositoryException ex) {
- throw getRepositoryException(ex);
- }
- }
-
- /** {@inheritDoc} */
- public RemoteNodeType getPrimaryNodeType()
- throws RepositoryException, RemoteException {
- try {
- return getFactory().getRemoteNodeType(node.getPrimaryNodeType());
- } catch (RepositoryException ex) {
- throw getRepositoryException(ex);
- }
- }
-
- /** {@inheritDoc} */
- public boolean isNodeType(String type)
- throws RepositoryException, RemoteException {
- try {
- return node.isNodeType(type);
- } catch (RepositoryException ex) {
- throw getRepositoryException(ex);
- }
- }
-
- /** {@inheritDoc} */
- public RemoteNode[] getNodes() throws RepositoryException, RemoteException {
- try {
- return getRemoteNodeArray(node.getNodes());
- } catch (RepositoryException ex) {
- throw getRepositoryException(ex);
- }
- }
-
- /** {@inheritDoc} */
- public RemoteNode[] getNodes(String pattern)
- throws RepositoryException, RemoteException {
- try {
- return getRemoteNodeArray(node.getNodes(pattern));
- } catch (RepositoryException ex) {
- throw getRepositoryException(ex);
- }
- }
-
- /** {@inheritDoc} */
- public RemoteNode getNode(String path)
- throws RepositoryException, RemoteException {
- try {
- return getRemoteNode(node.getNode(path));
- } catch (RepositoryException ex) {
- throw getRepositoryException(ex);
- }
- }
-
- /** {@inheritDoc} */
- public boolean hasNode(String path)
- throws RepositoryException, RemoteException {
- try {
- return node.hasNode(path);
- } catch (RepositoryException ex) {
- throw getRepositoryException(ex);
- }
- }
-
- /** {@inheritDoc} */
- public RemoteProperty setProperty(String name, Value value)
- throws RepositoryException, RemoteException {
- try {
- return getFactory().getRemoteProperty(node.setProperty(name, value));
- } catch (RepositoryException ex) {
- throw getRepositoryException(ex);
- }
- }
-
- /** {@inheritDoc} */
- public void addMixin(String name)
- throws RepositoryException, RemoteException {
- try {
- node.addMixin(name);
- } catch (RepositoryException ex) {
- throw getRepositoryException(ex);
- }
- }
-
- /** {@inheritDoc} */
- public boolean canAddMixin(String name)
- throws RepositoryException, RemoteException {
- try {
- return node.canAddMixin(name);
- } catch (RepositoryException ex) {
- throw getRepositoryException(ex);
- }
- }
-
- /** {@inheritDoc} */
- public void removeMixin(String name)
- throws RepositoryException, RemoteException {
- try {
- node.removeMixin(name);
- } catch (RepositoryException ex) {
- throw getRepositoryException(ex);
- }
- }
-
- /** {@inheritDoc} */
- public void orderBefore(String src, String dst)
- throws RepositoryException, RemoteException {
- try {
- node.orderBefore(src, dst);
- } catch (RepositoryException ex) {
- throw getRepositoryException(ex);
- }
- }
-
- /** {@inheritDoc} */
- public RemoteProperty setProperty(String name, Value[] values)
- throws RepositoryException, RemoteException {
- try {
- Property property = node.setProperty(name, values);
- return getFactory().getRemoteProperty(property);
- } catch (RepositoryException ex) {
- throw getRepositoryException(ex);
- }
- }
-
- /** {@inheritDoc} */
- public RemoteNodeDef getDefinition()
- throws RepositoryException, RemoteException {
- try {
- return getFactory().getRemoteNodeDef(node.getDefinition());
- } catch (RepositoryException ex) {
- throw getRepositoryException(ex);
- }
- }
-
- /** {@inheritDoc} */
- public RemoteVersion checkin() throws RepositoryException, RemoteException {
- try {
- return getFactory().getRemoteVersion(node.checkin());
- } catch (RepositoryException ex) {
- throw getRepositoryException(ex);
- }
- }
-
- /** {@inheritDoc} */
- public void checkout() throws RepositoryException, RemoteException {
- try {
- node.checkout();
- } catch (RepositoryException ex) {
- throw getRepositoryException(ex);
- }
- }
-
- /** {@inheritDoc} */
- public String getCorrespondingNodePath(String workspace)
- throws RepositoryException, RemoteException {
- try {
- return node.getCorrespondingNodePath(workspace);
- } catch (RepositoryException ex) {
- throw getRepositoryException(ex);
- }
- }
-
- /** {@inheritDoc} */
- public int getIndex() throws RepositoryException, RemoteException {
- try {
- return node.getIndex();
- } catch (RepositoryException ex) {
- throw getRepositoryException(ex);
- }
- }
-
- /** {@inheritDoc} */
- public void merge(String workspace, boolean bestEffort)
- throws RepositoryException, RemoteException {
- try {
- node.merge(workspace, bestEffort);
- } catch (RepositoryException ex) {
- throw getRepositoryException(ex);
- }
- }
-
- /** {@inheritDoc} */
- public void cancelMerge(String versionUUID)
- throws RepositoryException, RemoteException {
- try {
- node.cancelMerge(getVersionByUUID(versionUUID));
- } catch (RepositoryException ex) {
- throw getRepositoryException(ex);
- }
- }
-
- /** {@inheritDoc} */
- public void doneMerge(String versionUUID)
- throws RepositoryException, RemoteException {
- try {
- node.doneMerge(getVersionByUUID(versionUUID));
- } catch (RepositoryException ex) {
- throw getRepositoryException(ex);
- }
- }
-
- /** {@inheritDoc} */
- public void restore(String version, boolean removeExisting)
- throws RepositoryException, RemoteException {
- try {
- node.restore(version, removeExisting);
- } catch (RepositoryException ex) {
- throw getRepositoryException(ex);
- }
- }
-
- /** {@inheritDoc} */
- public void restoreByUUID(String versionUUID, boolean removeExisting)
- throws RepositoryException, RemoteException {
- try {
- node.restore(getVersionByUUID(versionUUID), removeExisting);
- } catch (RepositoryException ex) {
- throw getRepositoryException(ex);
- }
- }
-
- /** {@inheritDoc} */
- public void restore(String versionUUID, String path, boolean removeExisting)
- throws RepositoryException, RemoteException {
- try {
- node.restore(getVersionByUUID(versionUUID), path, removeExisting);
- } catch (RepositoryException ex) {
- throw getRepositoryException(ex);
- }
- }
-
- /** {@inheritDoc} */
- public void restoreByLabel(String label, boolean removeExisting)
- throws RepositoryException, RemoteException {
- try {
- node.restoreByLabel(label, removeExisting);
- } catch (RepositoryException ex) {
- throw getRepositoryException(ex);
- }
- }
-
- /** {@inheritDoc} */
- public void update(String workspace)
- throws RepositoryException, RemoteException {
- try {
- node.update(workspace);
- } catch (RepositoryException ex) {
- throw getRepositoryException(ex);
- }
- }
-
- /** {@inheritDoc} */
- public boolean holdsLock() throws RepositoryException, RemoteException {
- try {
- return node.holdsLock();
- } catch (RepositoryException ex) {
- throw getRepositoryException(ex);
- }
- }
-
- /** {@inheritDoc} */
- public boolean isCheckedOut() throws RepositoryException, RemoteException {
- try {
- return node.isCheckedOut();
- } catch (RepositoryException ex) {
- throw getRepositoryException(ex);
- }
- }
-
- /** {@inheritDoc} */
- public RemoteVersionHistory getVersionHistory()
- throws RepositoryException, RemoteException {
- try {
- return getFactory().getRemoteVersionHistory(node.getVersionHistory());
- } catch (RepositoryException ex) {
- throw getRepositoryException(ex);
- }
- }
-
- /** {@inheritDoc} */
- public RemoteVersion getBaseVersion()
- throws RepositoryException, RemoteException {
- try {
- return getFactory().getRemoteVersion(node.getBaseVersion());
- } catch (RepositoryException ex) {
- throw getRepositoryException(ex);
- }
- }
-
- /** {@inheritDoc} */
- public boolean isLocked() throws RepositoryException, RemoteException {
- try {
- return node.isLocked();
- } catch (RepositoryException ex) {
- throw getRepositoryException(ex);
- }
- }
-
- /** {@inheritDoc} */
- public RemoteProperty setProperty(String name, Value[] values, int type)
- throws RepositoryException, RemoteException {
- try {
- Property property = node.setProperty(name, values, type);
- return getFactory().getRemoteProperty(property);
- } catch (RepositoryException ex) {
- throw getRepositoryException(ex);
- }
- }
-
- /** {@inheritDoc} */
- public void unlock() throws RepositoryException, RemoteException {
- try {
- node.unlock();
- } catch (RepositoryException ex) {
- throw getRepositoryException(ex);
- }
- }
-
- /** {@inheritDoc} */
- public RemoteLock getLock() throws RepositoryException, RemoteException {
- try {
- return getFactory().getRemoteLock(node.getLock());
- } catch (RepositoryException ex) {
- throw getRepositoryException(ex);
- }
- }
-
- /** {@inheritDoc} */
- public RemoteLock lock(boolean isDeep, boolean isSessionScoped)
- throws RepositoryException, RemoteException {
- try {
- Lock lock = node.lock(isDeep, isSessionScoped);
- return getFactory().getRemoteLock(lock);
- } catch (RepositoryException ex) {
- throw getRepositoryException(ex);
- }
- }
-
- //---------- Implementation helper -----------------------------------------
-
- /**
- * Returns the {@link Version} instance for the given UUID.
- *
- * @param versionUUID The UUID of the version.
- *
- * @return The version node.
- *
- * @throws RepositoryException if an error occurrs accessing the version
- * node or if the UUID does not denote a version.
- */
- protected Version getVersionByUUID(String versionUUID)
- throws RepositoryException {
-
- // get the version node by its UUID from the version history's session
- Session session = node.getSession();
- Node versionNode = session.getNodeByUUID(versionUUID);
-
- // check whether the node is a session, which it should be according
- // to the spec (methods returning nodes should automatically return
- // the correct type).
- if (versionNode instanceof Version) {
- return (Version) versionNode;
- }
-
- // otherwise fail
- throw new RepositoryException("Cannot find version " + versionUUID);
- }
-}
diff --git a/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/ServerNodeDef.java b/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/ServerNodeDef.java
deleted file mode 100644
index 389f721d9b1..00000000000
--- a/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/ServerNodeDef.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Copyright 2004-2005 The Apache Software Foundation or its licensors,
- * as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.jackrabbit.rmi.server;
-
-import java.rmi.RemoteException;
-
-import javax.jcr.nodetype.NodeDef;
-
-import org.apache.jackrabbit.rmi.remote.RemoteNodeDef;
-import org.apache.jackrabbit.rmi.remote.RemoteNodeType;
-
-/**
- * Remote adapter for the JCR {@link javax.jcr.nodetype.NodeDef NodeDef}
- * interface. This class makes a local node definition available as an
- * RMI service using the
- * {@link org.apache.jackrabbit.rmi.remote.RemoteNodeDef RemoteNodeDef}
- * interface.
- *
- * @author Jukka Zitting
- * @see javax.jcr.nodetype.NodeDef
- * @see org.apache.jackrabbit.rmi.remote.RemoteNodeDef
- */
-public class ServerNodeDef extends ServerItemDef implements RemoteNodeDef {
-
- /** The adapted node definition. */
- private NodeDef def;
-
- /**
- * Creates a remote adapter for the given local node definition.
- *
- * @param def local node definition
- * @param factory remote adapter factory
- * @throws RemoteException on RMI errors
- */
- public ServerNodeDef(NodeDef def, RemoteAdapterFactory factory)
- throws RemoteException {
- super(def, factory);
- this.def = def;
- }
-
- /** {@inheritDoc} */
- public RemoteNodeType[] getRequiredPrimaryTypes() throws RemoteException {
- return getRemoteNodeTypeArray(def.getRequiredPrimaryTypes());
- }
-
- /** {@inheritDoc} */
- public RemoteNodeType getDefaultPrimaryType() throws RemoteException {
- return getFactory().getRemoteNodeType(def.getDefaultPrimaryType());
- }
-
- /** {@inheritDoc} */
- public boolean allowSameNameSibs() throws RemoteException {
- return def.allowSameNameSibs();
- }
-
-}
diff --git a/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/ServerNodeType.java b/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/ServerNodeType.java
deleted file mode 100644
index 313ef4104f1..00000000000
--- a/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/ServerNodeType.java
+++ /dev/null
@@ -1,144 +0,0 @@
-/*
- * Copyright 2004-2005 The Apache Software Foundation or its licensors,
- * as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.jackrabbit.rmi.server;
-
-import java.rmi.RemoteException;
-
-import javax.jcr.Value;
-import javax.jcr.nodetype.NodeType;
-import javax.jcr.nodetype.PropertyDef;
-
-import org.apache.jackrabbit.rmi.remote.RemoteNodeDef;
-import org.apache.jackrabbit.rmi.remote.RemoteNodeType;
-import org.apache.jackrabbit.rmi.remote.RemotePropertyDef;
-
-/**
- * Remote adapter for the JCR {@link javax.jcr.nodetype.NodeType NodeType}
- * interface. This class makes a local node type available as an RMI service
- * using the
- * {@link org.apache.jackrabbit.rmi.remote.RemoteNodeType RemoteNodeType}
- * interface.
- *
- * @author Jukka Zitting
- * @see javax.jcr.nodetype.NodeType
- * @see org.apache.jackrabbit.rmi.remote.RemoteNodeType
- */
-public class ServerNodeType extends ServerObject implements RemoteNodeType {
-
- /** The adapted local node type. */
- private NodeType type;
-
- /**
- * Creates a remote adapter for the given local node type.
- *
- * @param type local node type
- * @param factory remote adapter factory
- * @throws RemoteException on RMI errors
- */
- public ServerNodeType(NodeType type, RemoteAdapterFactory factory)
- throws RemoteException {
- super(factory);
- this.type = type;
- }
-
- /** {@inheritDoc} */
- public String getName() throws RemoteException {
- return type.getName();
- }
-
- /** {@inheritDoc} */
- public boolean isMixin() throws RemoteException {
- return type.isMixin();
- }
-
- /** {@inheritDoc} */
- public boolean hasOrderableChildNodes() throws RemoteException {
- return type.hasOrderableChildNodes();
- }
-
- /** {@inheritDoc} */
- public RemoteNodeType[] getSupertypes() throws RemoteException {
- return getRemoteNodeTypeArray(type.getSupertypes());
- }
-
- /** {@inheritDoc} */
- public RemoteNodeType[] getDeclaredSupertypes() throws RemoteException {
- return getRemoteNodeTypeArray(type.getDeclaredSupertypes());
- }
-
- /** {@inheritDoc} */
- public boolean isNodeType(String type) throws RemoteException {
- return this.type.isNodeType(type);
- }
-
- /** {@inheritDoc} */
- public RemotePropertyDef[] getPropertyDefs() throws RemoteException {
- PropertyDef[] defs = type.getPropertyDefs();
- return getRemotePropertyDefArray(defs);
- }
-
- /** {@inheritDoc} */
- public RemotePropertyDef[] getDeclaredPropertyDefs()
- throws RemoteException {
- PropertyDef[] defs = type.getDeclaredPropertyDefs();
- return getRemotePropertyDefArray(defs);
- }
-
- /** {@inheritDoc} */
- public RemoteNodeDef[] getChildNodeDefs() throws RemoteException {
- return getRemoteNodeDefArray(type.getChildNodeDefs());
- }
-
- /** {@inheritDoc} */
- public RemoteNodeDef[] getDeclaredChildNodeDefs() throws RemoteException {
- return getRemoteNodeDefArray(type.getDeclaredChildNodeDefs());
- }
-
- /** {@inheritDoc} */
- public boolean canSetProperty(String name, Value value)
- throws RemoteException {
- return type.canSetProperty(name, value);
- }
-
- /** {@inheritDoc} */
- public boolean canSetProperty(String name, Value[] values)
- throws RemoteException {
- return type.canSetProperty(name, values);
- }
-
- /** {@inheritDoc} */
- public boolean canAddChildNode(String name) throws RemoteException {
- return type.canAddChildNode(name);
- }
-
- /** {@inheritDoc} */
- public boolean canAddChildNode(String name, String type)
- throws RemoteException {
- return this.type.canAddChildNode(name, type);
- }
-
- /** {@inheritDoc} */
- public boolean canRemoveItem(String name) throws RemoteException {
- return type.canRemoveItem(name);
- }
-
- /** {@inheritDoc} */
- public String getPrimaryItemName() throws RemoteException {
- return type.getPrimaryItemName();
- }
-
-}
diff --git a/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/ServerNodeTypeManager.java b/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/ServerNodeTypeManager.java
deleted file mode 100644
index f95d6aad53e..00000000000
--- a/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/ServerNodeTypeManager.java
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
- * Copyright 2004-2005 The Apache Software Foundation or its licensors,
- * as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.jackrabbit.rmi.server;
-
-import java.rmi.RemoteException;
-
-import javax.jcr.RepositoryException;
-import javax.jcr.nodetype.NodeTypeManager;
-
-import org.apache.jackrabbit.rmi.remote.RemoteNodeType;
-import org.apache.jackrabbit.rmi.remote.RemoteNodeTypeManager;
-
-/**
- * Remote adapter for the JCR
- * {@link javax.jcr.nodetype.NodeTypeManager NodeTypeManager}
- * interface. This class makes a local node type manager available as an
- * RMI service using the
- * {@link org.apache.jackrabbit.rmi.remote.RemoteNodeTypeManager RemoteNodeTypeManager}
- * interface.
- *
- * @author Jukka Zitting
- * @see javax.jcr.nodetype.NodeTypeManager
- * @see org.apache.jackrabbit.rmi.remote.RemoteNodeTypeManager
- */
-public class ServerNodeTypeManager extends ServerObject
- implements RemoteNodeTypeManager {
-
- /** The adapted local node type manager. */
- private NodeTypeManager manager;
-
- /**
- * Creates a remote adapter for the given local node type manager.
- *
- * @param manager local node type manager
- * @param factory remote adapter factory
- * @throws RemoteException on RMI errors
- */
- public ServerNodeTypeManager(
- NodeTypeManager manager, RemoteAdapterFactory factory)
- throws RemoteException {
- super(factory);
- this.manager = manager;
- }
-
- /** {@inheritDoc} */
- public RemoteNodeType getNodeType(String name)
- throws RepositoryException, RemoteException {
- try {
- return getFactory().getRemoteNodeType(manager.getNodeType(name));
- } catch (RepositoryException ex) {
- throw getRepositoryException(ex);
- }
- }
-
- /** {@inheritDoc} */
- public RemoteNodeType[] getAllNodeTypes()
- throws RepositoryException, RemoteException {
- try {
- return getRemoteNodeTypeArray(manager.getAllNodeTypes());
- } catch (RepositoryException ex) {
- throw getRepositoryException(ex);
- }
- }
-
- /** {@inheritDoc} */
- public RemoteNodeType[] getPrimaryNodeTypes()
- throws RepositoryException, RemoteException {
- try {
- return getRemoteNodeTypeArray(manager.getPrimaryNodeTypes());
- } catch (RepositoryException ex) {
- throw getRepositoryException(ex);
- }
- }
-
- /** {@inheritDoc} */
- public RemoteNodeType[] getMixinNodeTypes()
- throws RepositoryException, RemoteException {
- try {
- return getRemoteNodeTypeArray(manager.getMixinNodeTypes());
- } catch (RepositoryException ex) {
- throw getRepositoryException(ex);
- }
- }
-
-}
diff --git a/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/ServerObject.java b/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/ServerObject.java
deleted file mode 100644
index 07589e81bf2..00000000000
--- a/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/ServerObject.java
+++ /dev/null
@@ -1,390 +0,0 @@
-/*
- * Copyright 2004-2005 The Apache Software Foundation or its licensors,
- * as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.jackrabbit.rmi.server;
-
-import java.rmi.RemoteException;
-import java.rmi.server.UnicastRemoteObject;
-
-import javax.jcr.AccessDeniedException;
-import javax.jcr.InvalidItemStateException;
-import javax.jcr.InvalidSerializedDataException;
-import javax.jcr.Item;
-import javax.jcr.ItemExistsException;
-import javax.jcr.ItemNotFoundException;
-import javax.jcr.LoginException;
-import javax.jcr.MergeException;
-import javax.jcr.NamespaceException;
-import javax.jcr.NoSuchWorkspaceException;
-import javax.jcr.Node;
-import javax.jcr.NodeIterator;
-import javax.jcr.PathNotFoundException;
-import javax.jcr.Property;
-import javax.jcr.PropertyIterator;
-import javax.jcr.ReferentialIntegrityException;
-import javax.jcr.RepositoryException;
-import javax.jcr.UnsupportedRepositoryOperationException;
-import javax.jcr.ValueFormatException;
-import javax.jcr.lock.LockException;
-import javax.jcr.nodetype.ConstraintViolationException;
-import javax.jcr.nodetype.NoSuchNodeTypeException;
-import javax.jcr.nodetype.NodeDef;
-import javax.jcr.nodetype.NodeType;
-import javax.jcr.nodetype.NodeTypeIterator;
-import javax.jcr.nodetype.PropertyDef;
-import javax.jcr.query.InvalidQueryException;
-import javax.jcr.version.Version;
-import javax.jcr.version.VersionException;
-import javax.jcr.version.VersionHistory;
-import javax.jcr.version.VersionIterator;
-
-import org.apache.jackrabbit.rmi.remote.RemoteItem;
-import org.apache.jackrabbit.rmi.remote.RemoteNode;
-import org.apache.jackrabbit.rmi.remote.RemoteNodeDef;
-import org.apache.jackrabbit.rmi.remote.RemoteNodeType;
-import org.apache.jackrabbit.rmi.remote.RemoteProperty;
-import org.apache.jackrabbit.rmi.remote.RemotePropertyDef;
-import org.apache.jackrabbit.rmi.remote.RemoteVersion;
-
-/**
- * Base class for remote adapters. The purpose of this class is to
- * centralize the handling of the RemoteAdapterFactory instance used
- * to instantiate new server adapters.
- *
- * @author Jukka Zitting
- */
-public class ServerObject extends UnicastRemoteObject {
-
- /** Factory for creating server adapters. */
- private RemoteAdapterFactory factory;
-
- /**
- * Creates a basic server adapter that uses the given factory
- * to create new adapters.
- *
- * @param factory remote adapter factory
- * @throws RemoteException on RMI errors
- */
- protected ServerObject(RemoteAdapterFactory factory)
- throws RemoteException {
- this.factory = factory;
- }
-
- /**
- * Returns the remote adapter factory used to create new adapters.
- *
- * @return remote adapter factory
- */
- protected RemoteAdapterFactory getFactory() {
- return factory;
- }
-
- /**
- * Returns a cleaned version of the given exception. In some cases
- * the underlying repository implementation may throw exceptions
- * that are either unserializable, use exception subclasses that are
- * only locally available, contain references to unserializable or
- * only locally available classes. This method returns a cleaned
- * version of such an exception. The returned exception contains only
- * the message string from the original exception, and uses the public
- * JCR exception class that most specifically matches the original
- * exception.
- *
- * @param ex the original exception
- * @return clean exception
- */
- protected RepositoryException getRepositoryException(
- RepositoryException ex) {
- if (ex instanceof AccessDeniedException) {
- return new AccessDeniedException(ex.getMessage());
- } else if (ex instanceof ConstraintViolationException) {
- return new ConstraintViolationException(ex.getMessage());
- } else if (ex instanceof InvalidItemStateException) {
- return new InvalidItemStateException(ex.getMessage());
- } else if (ex instanceof InvalidQueryException) {
- return new InvalidQueryException(ex.getMessage());
- } else if (ex instanceof InvalidSerializedDataException) {
- return new InvalidSerializedDataException(ex.getMessage());
- } else if (ex instanceof ItemExistsException) {
- return new ItemExistsException(ex.getMessage());
- } else if (ex instanceof ItemNotFoundException) {
- return new ItemNotFoundException(ex.getMessage());
- } else if (ex instanceof LockException) {
- return new LockException(ex.getMessage());
- } else if (ex instanceof LoginException) {
- return new LoginException(ex.getMessage());
- } else if (ex instanceof MergeException) {
- return new MergeException(ex.getMessage());
- } else if (ex instanceof NamespaceException) {
- return new NamespaceException(ex.getMessage());
- } else if (ex instanceof NoSuchNodeTypeException) {
- return new NoSuchNodeTypeException(ex.getMessage());
- } else if (ex instanceof NoSuchWorkspaceException) {
- return new NoSuchWorkspaceException(ex.getMessage());
- } else if (ex instanceof PathNotFoundException) {
- return new PathNotFoundException(ex.getMessage());
- } else if (ex instanceof ReferentialIntegrityException) {
- return new ReferentialIntegrityException(ex.getMessage());
- } else if (ex instanceof UnsupportedRepositoryOperationException) {
- return new UnsupportedRepositoryOperationException(ex.getMessage());
- } else if (ex instanceof ValueFormatException) {
- return new ValueFormatException(ex.getMessage());
- } else if (ex instanceof VersionException) {
- return new VersionException(ex.getMessage());
- } else {
- return new RepositoryException(ex.getMessage());
- }
- }
-
- /**
- * Utility method for creating a remote reference for a local item.
- * Unlike the factory method for creating remote item references, this
- * method introspects the type of the local item and returns the
- * corresponding node, property, or item remote reference using the
- * remote adapter factory.
- *
- * If the
- * A
- * A
- * A
- * A
- * A
- * A
- * A
- * A
-This package contains the default server implementation of the
-transparent JCR-RMI layer. The classes in this package can be used
-to make a local JCR repository available as an RMI service. In addition,
-this package offers a straightforward mechanism for extending or modifying
-the behaviour of the server layer.
-
-The contents of this package is designed using two design patterns,
-Factory and Adapter. All the remotely accessible ServerObject subclasses
-implement the Adapter pattern to adapt a local JCR interface to the
-corresponding remote JCR-RMI interface. The Factory pattern is used
-to centralize the creation and configuration of all adapter instances.
-
-
-Setting up the server part of the JCR-RMI layer is quite straightforward.
-After instantiating a local JCR repository you need to wrap it into a
-remote adapter and create an RMI binding for the repository. A variation
-of the following code is usually all that is needed in addition to the
-standard RMI setup (starting rmiregistry, etc.):
-
-
-The Factory pattern used by this package makes it easy to extend
-the behaviour of the JCR-RMI server. Such changes in behaviour or policy
-can be implemented by modifying or replacing the default
-ServerAdapterFactory used in the example above.
-
-The following example code adds transparent logging of all session logins
-and logouts:
-
-
- * Subclasses must implement this method to provide the actual
- * import mechanism.
- *
- * @param xml the XML data to import
- * @throws Exception on import errors
- */
- protected abstract void importXML(byte[] xml) throws Exception;
-
- /** {@inheritDoc} */
- public void setDocumentLocator(Locator locator) {
- handler.setDocumentLocator(locator);
- }
-
- /** {@inheritDoc} */
- public void startDocument() throws SAXException {
- handler.startDocument();
- }
-
- /** {@inheritDoc} */
- public void endDocument() throws SAXException {
- handler.endDocument();
- try {
- importXML(buffer.toByteArray());
- } catch (Exception ex) {
- throw new SAXException(ex);
- }
- }
-
- /** {@inheritDoc} */
- public void startPrefixMapping(String prefix, String uri)
- throws SAXException {
- handler.startPrefixMapping(prefix, uri);
- }
-
- /** {@inheritDoc} */
- public void endPrefixMapping(String prefix) throws SAXException {
- handler.endPrefixMapping(prefix);
- }
-
- /** {@inheritDoc} */
- public void startElement(String uri, String localName, String qName,
- Attributes atts) throws SAXException {
- handler.startElement(uri, localName, qName, atts);
- }
-
- /** {@inheritDoc} */
- public void endElement(String uri, String localName, String qName)
- throws SAXException {
- handler.endElement(uri, localName, qName);
- }
-
- /** {@inheritDoc} */
- public void characters(char[] ch, int start, int length)
- throws SAXException {
- handler.characters(ch, start, length);
- }
-
- /** {@inheritDoc} */
- public void ignorableWhitespace(char[] ch, int start, int length)
- throws SAXException {
- handler.ignorableWhitespace(ch, start, length);
- }
-
- /** {@inheritDoc} */
- public void processingInstruction(String target, String data)
- throws SAXException {
- handler.processingInstruction(target, data);
- }
-
- /** {@inheritDoc} */
- public void skippedEntity(String name) throws SAXException {
- handler.skippedEntity(name);
- }
-
-}
diff --git a/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/xml/SessionImportContentHandler.java b/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/xml/SessionImportContentHandler.java
deleted file mode 100644
index 8f3c57307bb..00000000000
--- a/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/xml/SessionImportContentHandler.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Copyright 2004-2005 The Apache Software Foundation or its licensors,
- * as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.jackrabbit.rmi.xml;
-
-import java.io.ByteArrayInputStream;
-
-import javax.jcr.Session;
-
-
-/**
- * SAX content handler for importing XML data to a JCR {@link Session Session}.
- * This utility class can be used to implement the
- * {@link Session#getImportContentHandler(String) Session.getImportContentHandler(String)}
- * method in terms of the
- * {@link Session#importXML(String, java.io.InputStream) Session.importXML(String, InputStream)}
- * method.
- *
- * @author Jukka Zitting
- */
-public class SessionImportContentHandler extends ImportContentHandler {
-
- /** The repository session. */
- private Session session;
-
- /** The import content path. */
- private String path;
-
- /**
- * Creates a SAX content handler for importing XML data to the given
- * session and path.
- *
- * @param session repository session
- * @param path import content path
- */
- public SessionImportContentHandler(Session session, String path) {
- this.session = session;
- this.path = path;
- }
-
- /**
- * Imports the serialized XML stream using the standard
- * {@link Session#importXML(String, java.io.InputStream) Session.importXML(String, InputStream)}
- * method.
- *
- * {@inheritDoc}
- */
- protected void importXML(byte[] xml) throws Exception {
- session.importXML(path, new ByteArrayInputStream(xml));
- }
-
-}
diff --git a/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/xml/WorkspaceImportContentHandler.java b/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/xml/WorkspaceImportContentHandler.java
deleted file mode 100644
index 9fcfd428c85..00000000000
--- a/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/xml/WorkspaceImportContentHandler.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Copyright 2004-2005 The Apache Software Foundation or its licensors,
- * as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.jackrabbit.rmi.xml;
-
-import java.io.ByteArrayInputStream;
-
-import javax.jcr.Workspace;
-
-
-/**
- * SAX content handler for importing XML data to a JCR {@link Workspace Workspace}.
- * This utility class can be used to implement the
- * {@link Workspace#getImportContentHandler(String, int) Workspace.getImportContentHandler(String, int)}
- * method in terms of the
- * {@link Workspace#importXML(String, java.io.InputStream, int) Workspace.importXML(String, InputStream, int)}
- * method.
- *
- * @author Jukka Zitting
- */
-public class WorkspaceImportContentHandler extends ImportContentHandler {
-
- /** The repository workspace. */
- private Workspace workspace;
-
- /** The import content path. */
- private String path;
-
- /** The UUID behaviour. */
- private int uuidBehaviour;
-
- /**
- * Creates a SAX content handler for importing XML data to the given
- * workspace and path using the given UUID behaviour.
- *
- * @param workspace repository workspace
- * @param path import content path
- * @param uuidBehaviour UUID behaviour
- */
- public WorkspaceImportContentHandler(Workspace workspace, String path, int uuidBehaviour) {
- this.workspace = workspace;
- this.path = path;
- this.uuidBehaviour = uuidBehaviour;
- }
-
- /**
- * Imports the serialized XML stream using the standard
- * {@link Workspace#importXML(String, java.io.InputStream, int) Workspace.importXML(String, InputStream, int)}
- * method.
- *
- * {@inheritDoc}
- */
- protected void importXML(byte[] xml) throws Exception {
- workspace.importXML(path, new ByteArrayInputStream(xml), uuidBehaviour);
- }
-
-}
diff --git a/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/xml/package.html b/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/xml/package.html
deleted file mode 100644
index 956e5ecb042..00000000000
--- a/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/xml/package.html
+++ /dev/null
@@ -1,15 +0,0 @@
-
-The classes in this package can be used for to implement the JCR
-{@link javax.jcr.Session#getImportContentHandler(java.lang.String) Session.getImportContentHandler(String)}
-and
-{@link javax.jcr.Workspace#getImportContentHandler(java.lang.String, int) Workspace.getImportContentHandler(String, int)}
-methods in terms of the corresponding importXML() methods.
-
-These utility classes were designed for the transparent JCR-RMI layer,
-but can easily be used as a part of any JCR repository implementation.
-The public interface of this package depends only on the standard JCR and
-J2SE APIs. The implementation uses Xerces as an extra dependency to
-serialize the SAX event streams.
-
diff --git a/contrib/jcr-rmi/src/test/org/apache/jackrabbit/test/rmi/RemoteAdapterTest.java b/contrib/jcr-rmi/src/test/org/apache/jackrabbit/test/rmi/RemoteAdapterTest.java
deleted file mode 100644
index e54279bcc45..00000000000
--- a/contrib/jcr-rmi/src/test/org/apache/jackrabbit/test/rmi/RemoteAdapterTest.java
+++ /dev/null
@@ -1,514 +0,0 @@
-/*
- * Copyright 2004-2005 The Apache Software Foundation or its licensors,
- * as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.jackrabbit.test.rmi;
-
-import java.lang.reflect.Method;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-
-import javax.jcr.Item;
-import javax.jcr.NamespaceRegistry;
-import javax.jcr.Node;
-import javax.jcr.Property;
-import javax.jcr.Repository;
-import javax.jcr.Session;
-import javax.jcr.Workspace;
-import javax.jcr.lock.Lock;
-import javax.jcr.nodetype.ItemDef;
-import javax.jcr.nodetype.NodeDef;
-import javax.jcr.nodetype.NodeType;
-import javax.jcr.nodetype.NodeTypeManager;
-import javax.jcr.nodetype.PropertyDef;
-import javax.jcr.query.Query;
-import javax.jcr.query.QueryManager;
-import javax.jcr.query.QueryResult;
-import javax.jcr.query.Row;
-import javax.jcr.version.Version;
-import javax.jcr.version.VersionHistory;
-
-import junit.framework.TestCase;
-
-import org.apache.jackrabbit.rmi.client.ClientAdapterFactory;
-import org.apache.jackrabbit.rmi.client.LocalAdapterFactory;
-import org.apache.jackrabbit.rmi.remote.RemoteItem;
-import org.apache.jackrabbit.rmi.remote.RemoteItemDef;
-import org.apache.jackrabbit.rmi.remote.RemoteLock;
-import org.apache.jackrabbit.rmi.remote.RemoteNamespaceRegistry;
-import org.apache.jackrabbit.rmi.remote.RemoteNode;
-import org.apache.jackrabbit.rmi.remote.RemoteNodeDef;
-import org.apache.jackrabbit.rmi.remote.RemoteNodeType;
-import org.apache.jackrabbit.rmi.remote.RemoteNodeTypeManager;
-import org.apache.jackrabbit.rmi.remote.RemoteProperty;
-import org.apache.jackrabbit.rmi.remote.RemotePropertyDef;
-import org.apache.jackrabbit.rmi.remote.RemoteQuery;
-import org.apache.jackrabbit.rmi.remote.RemoteQueryManager;
-import org.apache.jackrabbit.rmi.remote.RemoteQueryResult;
-import org.apache.jackrabbit.rmi.remote.RemoteRepository;
-import org.apache.jackrabbit.rmi.remote.RemoteRow;
-import org.apache.jackrabbit.rmi.remote.RemoteSession;
-import org.apache.jackrabbit.rmi.remote.RemoteVersion;
-import org.apache.jackrabbit.rmi.remote.RemoteVersionHistory;
-import org.apache.jackrabbit.rmi.remote.RemoteWorkspace;
-import org.apache.jackrabbit.rmi.server.RemoteAdapterFactory;
-import org.apache.jackrabbit.rmi.server.ServerAdapterFactory;
-import org.easymock.MockControl;
-
-/**
- * Tests for the adapter classes of JCR-RMI. These tests use reflection
- * to invoke all methods of an adapter object and to verify that the
- * corresponding methods of the underlying object get called by the adapter.
- */
-public class RemoteAdapterTest extends TestCase {
-
- /** Factory for creating remote test adapters. */
- private RemoteAdapterFactory remoteFactory;
-
- /** Factory for creating local test adapters. */
- private LocalAdapterFactory localFactory;
-
- /** Map of method names to method descriptions. */
- private Map methods;
-
- /** Mock controller. */
- private MockControl control;
-
- /** Mock object. */
- private Object mock;
-
- /**
- * Prepares the automated test suite to adapters of the given interface.
- *
- * @param iface adapter interface
- * @throws Exception on errors
- */
- private void prepareTests(Class iface) throws Exception {
- remoteFactory = new ServerAdapterFactory();
- localFactory = new ClientAdapterFactory();
-
- methods = new HashMap();
- Method[] m = iface.getDeclaredMethods();
- for (int i = 0; i < m.length; i++) {
- methods.put(m[i].getName(), m[i]);
- }
-
- control = MockControl.createControl(iface);
- mock = control.getMock();
- }
-
- /**
- * Removes the identified method from the automatic tests.
- *
- * @param name method name
- */
- private void ignoreMethod(String name) {
- methods.remove(name);
- }
-
- /**
- * Returns a parameter array for the given method.
- *
- * @param method method description
- * @return parameter array
- */
- private Object[] getParameters(Method method) {
- Class[] types = method.getParameterTypes();
- Object[] parameters = new Object[types.length];
- for (int i = 0; i < types.length; i++) {
- if (!types[i].isPrimitive()) {
- parameters[i] = null;
- } else if ("int".equals(types[i].getName())) {
- parameters[i] = new Integer(0);
- } else if ("boolean".equals(types[i].getName())) {
- parameters[i] = new Boolean(false);
- } else {
- System.out.println(types[i].getName());
- parameters[i] = null;
- }
- }
- return parameters;
- }
-
- /**
- * Sets the expected return value for the given method.
- *
- * @param method method description
- * @param control mock controller
- */
- private void setReturnValue(Method method, MockControl control) {
- Class type = method.getReturnType();
- if (!type.isPrimitive()) {
- control.setReturnValue(null);
- } else if ("void".equals(type.getName())) {
- control.setVoidCallable();
- } else if ("int".equals(type.getName())) {
- control.setReturnValue((int) 0);
- } else if ("long".equals(type.getName())) {
- control.setReturnValue((long) 0);
- } else if ("boolean".equals(type.getName())) {
- control.setReturnValue(false);
- } else {
- System.out.println(type.getName());
- control.setReturnValue(null);
- }
- }
-
- /**
- * Runs the automatic test suite on the given adapter instance.
- *
- * @param adapter adapter instance
- * @throws Exception on errors
- */
- private void runTests(Object adapter) throws Exception {
- Iterator iterator = methods.values().iterator();
- while (iterator.hasNext()) {
- Method method = (Method) iterator.next();
- Object[] parameters = getParameters(method);
-
- method.invoke(mock, parameters);
- setReturnValue(method, control);
- control.replay();
-
- method.invoke(adapter, parameters);
- control.verify();
-
- control.reset();
- }
- }
-
- /**
- * Tests Repository adapters.
- *
- * @throws Exception on errors
- */
- public void testRepository() throws Exception {
- prepareTests(Repository.class);
-
- Repository repository = (Repository) mock;
- RemoteRepository remote = remoteFactory.getRemoteRepository(repository);
- Repository local = localFactory.getRepository(remote);
-
- runTests(local);
- }
-
- /**
- * Tests Session adapters.
- *
- * @throws Exception on errors
- */
- public void testSession() throws Exception {
- prepareTests(Session.class);
- ignoreMethod("getRepository"); // implemented locally
- ignoreMethod("importXML"); // wrapped stream
- ignoreMethod("getImportContentHandler"); // implemented locally
- ignoreMethod("exportSysView"); // multiple methods
- ignoreMethod("exportDocView"); // multiple method
-
- Session session = (Session) mock;
- RemoteSession remote = remoteFactory.getRemoteSession(session);
- Session local = localFactory.getSession(null, remote);
-
- runTests(local);
- }
-
- /**
- * Tests Item adapters.
- *
- * @throws Exception on errors
- */
- public void testItem() throws Exception {
- prepareTests(Item.class);
- ignoreMethod("accept"); // implemented in subclasses
- ignoreMethod("getSession"); // implemented locally
- ignoreMethod("isNode"); // implemented in subclasses
- ignoreMethod("isSame"); // implemented locally
-
- Item item = (Item) mock;
- RemoteItem remote = remoteFactory.getRemoteItem(item);
- Item local = localFactory.getItem(null, remote);
-
- runTests(local);
- }
-
- /**
- * Tests Node adapters.
- *
- * @throws Exception on errors
- */
- public void testNode() throws Exception {
- prepareTests(Node.class);
- ignoreMethod("cancelMerge"); // TODO
- ignoreMethod("doneMerge"); // TODO
- ignoreMethod("checkin"); // TODO
- ignoreMethod("restore"); // multiple methods
- ignoreMethod("getVersionHistory"); // TODO
- ignoreMethod("getBaseVersion"); // TODO
- ignoreMethod("setProperty"); // multiple methods
-
- Node node = (Node) mock;
- RemoteNode remote = remoteFactory.getRemoteNode(node);
- Node local = localFactory.getNode(null, remote);
-
- runTests(local);
- }
-
- /**
- * Tests Property adapters.
- *
- * @throws Exception on errors
- */
- public void testProperty() throws Exception {
- prepareTests(Property.class);
- ignoreMethod("getBoolean"); // implemented locally
- ignoreMethod("getLong"); // implemented locally
- ignoreMethod("getDouble"); // implemented locally
- ignoreMethod("getDate"); // implemented locally
- ignoreMethod("getString"); // implemented locally
- ignoreMethod("getStream"); // implemented locally
- ignoreMethod("getNode"); // implemented locally
- ignoreMethod("setValue"); // multiple methods
-
- Property property = (Property) mock;
- RemoteProperty remote = remoteFactory.getRemoteProperty(property);
- Property local = localFactory.getProperty(null, remote);
-
- runTests(local);
- }
-
- /**
- * Tests Lock adapters.
- *
- * @throws Exception on errors
- */
- public void testLock() throws Exception {
- prepareTests(Lock.class);
- ignoreMethod("getNode"); // implemented locally
-
- Lock lock = (Lock) mock;
- RemoteLock remote = remoteFactory.getRemoteLock(lock);
- Lock local = localFactory.getLock(null, remote);
-
- runTests(local);
- }
-
- /**
- * Tests Workspace adapters.
- *
- * @throws Exception on errors
- */
- public void testWorkspace() throws Exception {
- prepareTests(Workspace.class);
- ignoreMethod("getObservationManager"); // TODO
- ignoreMethod("restore"); // TODO
- ignoreMethod("getSession"); // implemented locally
- ignoreMethod("copy"); // multiple methods
- ignoreMethod("importXML"); // wrapped stream
- ignoreMethod("getImportContentHandler"); // implemented locally
-
- Workspace workspace = (Workspace) mock;
- RemoteWorkspace remote = remoteFactory.getRemoteWorkspace(workspace);
- Workspace local = localFactory.getWorkspace(null, remote);
-
- runTests(local);
- }
-
- /**
- * Tests NamespaceRegistry adapters.
- *
- * @throws Exception on errors
- */
- public void testNamespaceRegistry() throws Exception {
- prepareTests(NamespaceRegistry.class);
-
- NamespaceRegistry registry = (NamespaceRegistry) mock;
- RemoteNamespaceRegistry remote =
- remoteFactory.getRemoteNamespaceRegistry(registry);
- NamespaceRegistry local = localFactory.getNamespaceRegistry(remote);
-
- runTests(local);
- }
-
- /**
- * Tests NodeTypeManager adapters.
- *
- * @throws Exception on errors
- */
- public void testNodeTypeManager() throws Exception {
- prepareTests(NodeTypeManager.class);
-
- NodeTypeManager manager = (NodeTypeManager) mock;
- RemoteNodeTypeManager remote =
- remoteFactory.getRemoteNodeTypeManager(manager);
- NodeTypeManager local = localFactory.getNodeTypeManager(remote);
-
- runTests(local);
- }
-
- /**
- * Tests NodeType adapters.
- *
- * @throws Exception on errors
- */
- public void testNodeType() throws Exception {
- prepareTests(NodeType.class);
- ignoreMethod("canSetProperty"); // wrapped Value object
-
- NodeType type = (NodeType) mock;
- RemoteNodeType remote = remoteFactory.getRemoteNodeType(type);
- NodeType local = localFactory.getNodeType(remote);
-
- runTests(local);
- }
-
- /**
- * Tests ItemDef adapters.
- *
- * @throws Exception on errors
- */
- public void testItemDef() throws Exception {
- prepareTests(ItemDef.class);
-
- ItemDef def = (ItemDef) mock;
- RemoteItemDef remote = remoteFactory.getRemoteItemDef(def);
- ItemDef local = localFactory.getItemDef(remote);
-
- runTests(local);
- }
-
- /**
- * Tests NodeDef adapters.
- *
- * @throws Exception on errors
- */
- public void testNodeDef() throws Exception {
- prepareTests(NodeDef.class);
-
- NodeDef def = (NodeDef) mock;
- RemoteNodeDef remote = remoteFactory.getRemoteNodeDef(def);
- NodeDef local = localFactory.getNodeDef(remote);
-
- runTests(local);
- }
-
- /**
- * Tests PropertyDef adapters.
- *
- * @throws Exception on errors
- */
- public void testPropertyDef() throws Exception {
- prepareTests(PropertyDef.class);
-
- PropertyDef def = (PropertyDef) mock;
- RemotePropertyDef remote = remoteFactory.getRemotePropertyDef(def);
- PropertyDef local = localFactory.getPropertyDef(remote);
-
- runTests(local);
- }
-
- /**
- * Tests QueryManager adapters.
- *
- * @throws Exception on errors
- */
- public void testQueryManager() throws Exception {
- prepareTests(QueryManager.class);
- ignoreMethod("getQuery"); // TODO
-
- QueryManager manager = (QueryManager) mock;
- RemoteQueryManager remote = remoteFactory.getRemoteQueryManager(manager);
- QueryManager local = localFactory.getQueryManager(null, remote);
-
- runTests(local);
- }
-
- /**
- * Tests Query adapters.
- *
- * @throws Exception on errors
- */
- public void testQuery() throws Exception {
- prepareTests(Query.class);
-
- Query query = (Query) mock;
- RemoteQuery remote = remoteFactory.getRemoteQuery(query);
- Query local = localFactory.getQuery(null, remote);
-
- runTests(local);
- }
-
- /**
- * Tests QueryResult adapters.
- *
- * @throws Exception on errors
- */
- public void testQueryResult() throws Exception {
- prepareTests(QueryResult.class);
-
- QueryResult result = (QueryResult) mock;
- RemoteQueryResult remote = remoteFactory.getRemoteQueryResult(result);
- QueryResult local = localFactory.getQueryResult(null, remote);
-
- runTests(local);
- }
-
- /**
- * Tests Row adapters.
- *
- * @throws Exception on errors
- */
- public void testRow() throws Exception {
- prepareTests(Row.class);
-
- Row row = (Row) mock;
- RemoteRow remote = remoteFactory.getRemoteRow(row);
- Row local = localFactory.getRow(remote);
-
- runTests(local);
- }
-
- /**
- * Tests Version adapters.
- *
- * @throws Exception on errors
- */
- public void testVersion() throws Exception {
- prepareTests(Version.class);
-
- Version version = (Version) mock;
- RemoteVersion remote = remoteFactory.getRemoteVersion(version);
- Version local = localFactory.getVersion(null, remote);
-
- runTests(local);
- }
-
- /**
- * Tests VersionHistory adapters.
- *
- * @throws Exception on errors
- */
- public void testVersionHistory() throws Exception {
- prepareTests(VersionHistory.class);
-
- VersionHistory history = (VersionHistory) mock;
- RemoteVersionHistory remote =
- remoteFactory.getRemoteVersionHistory(history);
- VersionHistory local = localFactory.getVersionHistory(null, remote);
-
- runTests(local);
- }
-
-}
diff --git a/contrib/jcr-rmi/src/test/org/apache/jackrabbit/test/rmi/TestAll.java b/contrib/jcr-rmi/src/test/org/apache/jackrabbit/test/rmi/TestAll.java
deleted file mode 100644
index 90c12a25dc3..00000000000
--- a/contrib/jcr-rmi/src/test/org/apache/jackrabbit/test/rmi/TestAll.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Copyright 2004-2005 The Apache Software Foundation or its licensors,
- * as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.jackrabbit.test.rmi;
-
-import junit.framework.Test;
-import junit.framework.TestSuite;
-
-/**
- * Test suite that contains all JCR-RMI test cases.
- */
-public class TestAll {
-
- /** This class cannot be instantiated. */
- private TestAll() {
- }
-
- /**
- * Returns the JCR-RMI test suite.
- *
- * @return JCR-RMI test suite
- */
- public static Test suite() {
- TestSuite suite = new TestSuite("Tests for org.apache.jackrabbit.rmi");
- //$JUnit-BEGIN$
- suite.addTestSuite(RemoteAdapterTest.class);
- //$JUnit-END$
- return suite;
- }
-
-}
diff --git a/contrib/jcr-rmi/src/test/org/apache/jackrabbit/test/rmi/package.html b/contrib/jcr-rmi/src/test/org/apache/jackrabbit/test/rmi/package.html
deleted file mode 100644
index 92594a1014d..00000000000
--- a/contrib/jcr-rmi/src/test/org/apache/jackrabbit/test/rmi/package.html
+++ /dev/null
@@ -1,6 +0,0 @@
-true
without contacting the remote node.
- *
- * {@inheritDoc}
- */
- public boolean isNode() {
- return true;
- }
-
- /**
- * Calls the {@link ItemVisitor#visit(Node) ItemVisitor.visit(Node)}
- * method of the given visitor. Does not contact the remote node, but
- * the visitor may invoke other methods that do contact the remote node.
- *
- * {@inheritDoc}
- */
- public void accept(ItemVisitor visitor) throws RepositoryException {
- visitor.visit(this);
- }
-
- /** {@inheritDoc} */
- public Node addNode(String path) throws RepositoryException {
- try {
- return getNode(getSession(), remote.addNode(path));
- } catch (RemoteException ex) {
- throw new RemoteRepositoryException(ex);
- }
- }
-
- /** {@inheritDoc} */
- public Node addNode(String path, String type) throws RepositoryException {
- try {
- RemoteNode node = remote.addNode(path, type);
- return getNode(getSession(), node);
- } catch (RemoteException ex) {
- throw new RemoteRepositoryException(ex);
- }
- }
-
- /** {@inheritDoc} */
- public void orderBefore(String src, String dst) throws RepositoryException {
- try {
- remote.orderBefore(src, dst);
- } catch (RemoteException ex) {
- throw new RemoteRepositoryException(ex);
- }
- }
-
- /** {@inheritDoc} */
- public Property setProperty(String name, Value value)
- throws RepositoryException {
- try {
- RemoteProperty property =
- remote.setProperty(name, new SerialValue(value));
- return getFactory().getProperty(getSession(), property);
- } catch (RemoteException ex) {
- throw new RemoteRepositoryException(ex);
- }
- }
-
- /** {@inheritDoc} */
- public Property setProperty(String name, Value[] values)
- throws RepositoryException {
- try {
- Value[] serials = SerialValue.makeSerialValueArray(values);
- RemoteProperty property = remote.setProperty(name, serials);
- return getFactory().getProperty(getSession(), property);
- } catch (RemoteException ex) {
- throw new RemoteRepositoryException(ex);
- }
- }
-
- /** {@inheritDoc} */
- public Property setProperty(String name, String[] strings)
- throws RepositoryException {
- Value[] values = new Value[strings.length];
- for (int i = 0; i < strings.length; i++) {
- values[i] = new StringValue(strings[i]);
- }
- return setProperty(name, values);
- }
-
- /** {@inheritDoc} */
- public Property setProperty(String name, String value)
- throws RepositoryException {
- return setProperty(name, new StringValue(value));
- }
-
- /** {@inheritDoc} */
- public Property setProperty(String name, InputStream value)
- throws RepositoryException {
- return setProperty(name, new BinaryValue(value));
- }
-
- /** {@inheritDoc} */
- public Property setProperty(String name, boolean value)
- throws RepositoryException {
- return setProperty(name, new BooleanValue(value));
- }
-
- /** {@inheritDoc} */
- public Property setProperty(String name, double value)
- throws RepositoryException {
- return setProperty(name, new DoubleValue(value));
- }
-
- /** {@inheritDoc} */
- public Property setProperty(String name, long value)
- throws RepositoryException {
- return setProperty(name, new LongValue(value));
- }
-
- /** {@inheritDoc} */
- public Property setProperty(String name, Calendar value)
- throws RepositoryException {
- return setProperty(name, new DateValue(value));
- }
-
- /** {@inheritDoc} */
- public Property setProperty(String name, Node value)
- throws RepositoryException {
- return setProperty(name, new ReferenceValue(value));
- }
-
- /** {@inheritDoc} */
- public Node getNode(String path) throws RepositoryException {
- try {
- return getNode(getSession(), remote.getNode(path));
- } catch (RemoteException ex) {
- throw new RemoteRepositoryException(ex);
- }
- }
-
- /** {@inheritDoc} */
- public NodeIterator getNodes() throws RepositoryException {
- try {
- return getNodeIterator(getSession(), remote.getNodes());
- } catch (RemoteException ex) {
- throw new RemoteRepositoryException(ex);
- }
- }
-
- /** {@inheritDoc} */
- public NodeIterator getNodes(String pattern) throws RepositoryException {
- try {
- return getNodeIterator(getSession(), remote.getNodes(pattern));
- } catch (RemoteException ex) {
- throw new RemoteRepositoryException(ex);
- }
- }
-
- /** {@inheritDoc} */
- public Property getProperty(String path) throws RepositoryException {
- try {
- RemoteProperty property = remote.getProperty(path);
- return getFactory().getProperty(getSession(), property);
- } catch (RemoteException ex) {
- throw new RemoteRepositoryException(ex);
- }
- }
-
- /** {@inheritDoc} */
- public PropertyIterator getProperties() throws RepositoryException {
- try {
- return getPropertyIterator(getSession(), remote.getProperties());
- } catch (RemoteException ex) {
- throw new RemoteRepositoryException(ex);
- }
- }
-
- /** {@inheritDoc} */
- public PropertyIterator getProperties(String pattern)
- throws RepositoryException {
- try {
- RemoteProperty[] properties = remote.getProperties(pattern);
- return getPropertyIterator(getSession(), properties);
- } catch (RemoteException ex) {
- throw new RemoteRepositoryException(ex);
- }
- }
-
- /** {@inheritDoc} */
- public Item getPrimaryItem() throws RepositoryException {
- try {
- return getItem(getSession(), remote.getPrimaryItem());
- } catch (RemoteException ex) {
- throw new RemoteRepositoryException(ex);
- }
- }
-
- /** {@inheritDoc} */
- public String getUUID() throws RepositoryException {
- try {
- return remote.getUUID();
- } catch (RemoteException ex) {
- throw new RemoteRepositoryException(ex);
- }
- }
-
- /** {@inheritDoc} */
- public PropertyIterator getReferences() throws RepositoryException {
- try {
- return getPropertyIterator(getSession(), remote.getReferences());
- } catch (RemoteException ex) {
- throw new RemoteRepositoryException(ex);
- }
- }
-
- /** {@inheritDoc} */
- public boolean hasNode(String path) throws RepositoryException {
- try {
- return remote.hasNode(path);
- } catch (RemoteException ex) {
- throw new RemoteRepositoryException(ex);
- }
- }
-
- /** {@inheritDoc} */
- public boolean hasProperty(String path) throws RepositoryException {
- try {
- return remote.hasProperty(path);
- } catch (RemoteException ex) {
- throw new RemoteRepositoryException(ex);
- }
- }
-
- /** {@inheritDoc} */
- public boolean hasNodes() throws RepositoryException {
- try {
- return remote.hasNodes();
- } catch (RemoteException ex) {
- throw new RemoteRepositoryException(ex);
- }
- }
-
- /** {@inheritDoc} */
- public boolean hasProperties() throws RepositoryException {
- try {
- return remote.hasProperties();
- } catch (RemoteException ex) {
- throw new RemoteRepositoryException(ex);
- }
- }
-
- /** {@inheritDoc} */
- public NodeType getPrimaryNodeType() throws RepositoryException {
- try {
- return getFactory().getNodeType(remote.getPrimaryNodeType());
- } catch (RemoteException ex) {
- throw new RemoteRepositoryException(ex);
- }
- }
-
- /** {@inheritDoc} */
- public NodeType[] getMixinNodeTypes() throws RepositoryException {
- try {
- return getNodeTypeArray(remote.getMixinNodeTypes());
- } catch (RemoteException ex) {
- throw new RemoteRepositoryException(ex);
- }
- }
-
- /** {@inheritDoc} */
- public boolean isNodeType(String type) throws RepositoryException {
- try {
- return remote.isNodeType(type);
- } catch (RemoteException ex) {
- throw new RemoteRepositoryException(ex);
- }
- }
-
- /** {@inheritDoc} */
- public void addMixin(String name) throws RepositoryException {
- try {
- remote.addMixin(name);
- } catch (RemoteException ex) {
- throw new RemoteRepositoryException(ex);
- }
- }
-
- /** {@inheritDoc} */
- public void removeMixin(String name) throws RepositoryException {
- try {
- remote.removeMixin(name);
- } catch (RemoteException ex) {
- throw new RemoteRepositoryException(ex);
- }
- }
-
- /** {@inheritDoc} */
- public boolean canAddMixin(String name) throws RepositoryException {
- try {
- return remote.canAddMixin(name);
- } catch (RemoteException ex) {
- throw new RemoteRepositoryException(ex);
- }
- }
-
- /** {@inheritDoc} */
- public NodeDef getDefinition() throws RepositoryException {
- try {
- return getFactory().getNodeDef(remote.getDefinition());
- } catch (RemoteException ex) {
- throw new RemoteRepositoryException(ex);
- }
- }
-
- /** {@inheritDoc} */
- public Version checkin() throws RepositoryException {
- try {
- return getFactory().getVersion(getSession(), remote.checkin());
- } catch (RemoteException ex) {
- throw new RemoteRepositoryException(ex);
- }
- }
-
- /** {@inheritDoc} */
- public void checkout() throws RepositoryException {
- try {
- remote.checkout();
- } catch (RemoteException ex) {
- throw new RemoteRepositoryException(ex);
- }
- }
-
- /** {@inheritDoc} */
- public void update(String workspace) throws RepositoryException {
- try {
- remote.update(workspace);
- } catch (RemoteException ex) {
- throw new RemoteRepositoryException(ex);
- }
- }
-
- /** {@inheritDoc} */
- public void merge(String workspace, boolean bestEffort)
- throws RepositoryException {
- try {
- remote.merge(workspace, bestEffort);
- } catch (RemoteException ex) {
- throw new RemoteRepositoryException(ex);
- }
- }
-
- /** {@inheritDoc} */
- public void cancelMerge(Version version) throws RepositoryException {
- try {
- remote.cancelMerge(version.getUUID());
- } catch (RemoteException ex) {
- throw new RemoteRepositoryException(ex);
- }
- }
-
- /** {@inheritDoc} */
- public void doneMerge(Version version) throws RepositoryException {
- try {
- remote.doneMerge(version.getUUID());
- } catch (RemoteException ex) {
- throw new RemoteRepositoryException(ex);
- }
- }
-
- /** {@inheritDoc} */
- public String getCorrespondingNodePath(String workspace)
- throws RepositoryException {
- try {
- return remote.getCorrespondingNodePath(workspace);
- } catch (RemoteException ex) {
- throw new RemoteRepositoryException(ex);
- }
- }
-
- /** {@inheritDoc} */
- public int getIndex() throws RepositoryException {
- try {
- return remote.getIndex();
- } catch (RemoteException ex) {
- throw new RemoteRepositoryException(ex);
- }
- }
-
- /** {@inheritDoc} */
- public void restore(String version, boolean removeExisting)
- throws RepositoryException {
- try {
- remote.restore(version, removeExisting);
- } catch (RemoteException ex) {
- throw new RemoteRepositoryException(ex);
- }
- }
-
- /** {@inheritDoc} */
- public void restore(Version version, boolean removeExisting)
- throws RepositoryException {
- try {
- remote.restoreByUUID(version.getUUID(), removeExisting);
- } catch (RemoteException ex) {
- throw new RemoteRepositoryException(ex);
- }
- }
-
- /** {@inheritDoc} */
- public void restore(Version version, String path, boolean removeExisting)
- throws RepositoryException {
- try {
- remote.restore(version.getUUID(), path, removeExisting);
- } catch (RemoteException ex) {
- throw new RemoteRepositoryException(ex);
- }
- }
-
- /** {@inheritDoc} */
- public void restoreByLabel(String label, boolean removeExisting)
- throws RepositoryException {
- try {
- remote.restoreByLabel(label, removeExisting);
- } catch (RemoteException ex) {
- throw new RemoteRepositoryException(ex);
- }
- }
-
- /** {@inheritDoc} */
- public Property setProperty(String name, String[] strings, int type)
- throws RepositoryException {
- Value[] values = new Value[strings.length];
- for (int i = 0; i < strings.length; i++) {
- values[i] = new StringValue(strings[i]);
- }
- return setProperty(name, values, type);
- }
-
- /** {@inheritDoc} */
- public Property setProperty(String name, Value[] values, int type)
- throws RepositoryException {
- try {
- Value[] serials = SerialValue.makeSerialValueArray(values);
- RemoteProperty property = remote.setProperty(name, serials, type);
- return getFactory().getProperty(getSession(), property);
- } catch (RemoteException ex) {
- throw new RemoteRepositoryException(ex);
- }
- }
-
- /** {@inheritDoc} */
- public boolean isCheckedOut() throws RepositoryException {
- try {
- return remote.isCheckedOut();
- } catch (RemoteException ex) {
- throw new RemoteRepositoryException(ex);
- }
- }
-
- /** {@inheritDoc} */
- public VersionHistory getVersionHistory() throws RepositoryException {
- try {
- return getFactory().getVersionHistory(getSession(), remote.getVersionHistory());
- } catch (RemoteException ex) {
- throw new RemoteRepositoryException(ex);
- }
- }
-
- /** {@inheritDoc} */
- public Version getBaseVersion() throws RepositoryException {
- try {
- return getFactory().getVersion(getSession(), remote.getBaseVersion());
- } catch (RemoteException ex) {
- throw new RemoteRepositoryException(ex);
- }
- }
-
- /** {@inheritDoc} */
- public Lock lock(boolean isDeep, boolean isSessionScoped)
- throws RepositoryException {
- try {
- RemoteLock lock = remote.lock(isDeep, isSessionScoped);
- return getFactory().getLock(this, lock);
- } catch (RemoteException ex) {
- throw new RemoteRepositoryException(ex);
- }
- }
-
- /** {@inheritDoc} */
- public Lock getLock() throws RepositoryException {
- try {
- return getFactory().getLock(this, remote.getLock());
- } catch (RemoteException ex) {
- throw new RemoteRepositoryException(ex);
- }
- }
-
- /** {@inheritDoc} */
- public void unlock() throws RepositoryException {
- try {
- remote.unlock();
- } catch (RemoteException ex) {
- throw new RemoteRepositoryException(ex);
- }
- }
-
- /** {@inheritDoc} */
- public boolean holdsLock() throws RepositoryException {
- try {
- return remote.holdsLock();
- } catch (RemoteException ex) {
- throw new RemoteRepositoryException(ex);
- }
- }
-
- /** {@inheritDoc} */
- public boolean isLocked() throws RepositoryException {
- try {
- return remote.isLocked();
- } catch (RemoteException ex) {
- throw new RemoteRepositoryException(ex);
- }
- }
-
-}
diff --git a/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/client/ClientNodeDef.java b/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/client/ClientNodeDef.java
deleted file mode 100644
index c4aef585db3..00000000000
--- a/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/client/ClientNodeDef.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * Copyright 2004-2005 The Apache Software Foundation or its licensors,
- * as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.jackrabbit.rmi.client;
-
-import java.rmi.RemoteException;
-
-import javax.jcr.nodetype.NodeDef;
-import javax.jcr.nodetype.NodeType;
-
-import org.apache.jackrabbit.rmi.remote.RemoteNodeDef;
-
-/**
- * Local adapter for the JCR-RMI
- * {@link org.apache.jackrabbit.rmi.remote.RemoteNodeDef RemoteNodeDef}
- * inteface. This class makes a remote node definition locally available using
- * the JCR {@link javax.jcr.nodetype.NodeDef NodeDef} interface.
- *
- * @author Jukka Zitting
- * @see javax.jcr.nodetype.NodeDef
- * @see org.apache.jackrabbit.rmi.remote.RemoteNodeDef
- */
-public class ClientNodeDef extends ClientItemDef implements NodeDef {
-
- /** The adapted remote node definition. */
- private RemoteNodeDef remote;
-
- /**
- * Creates a local adapter for the given remote node definition.
- *
- * @param remote remote node definition
- * @param factory local adapter factory
- */
- public ClientNodeDef(RemoteNodeDef remote, LocalAdapterFactory factory) {
- super(remote, factory);
- this.remote = remote;
- }
-
- /** {@inheritDoc} */
- public NodeType[] getRequiredPrimaryTypes() {
- try {
- return getNodeTypeArray(remote.getRequiredPrimaryTypes());
- } catch (RemoteException ex) {
- throw new RemoteRuntimeException(ex);
- }
- }
-
- /** {@inheritDoc} */
- public NodeType getDefaultPrimaryType() {
- try {
- return getFactory().getNodeType(remote.getDefaultPrimaryType());
- } catch (RemoteException ex) {
- throw new RemoteRuntimeException(ex);
- }
- }
-
- /** {@inheritDoc} */
- public boolean allowSameNameSibs() {
- try {
- return remote.allowSameNameSibs();
- } catch (RemoteException ex) {
- throw new RemoteRuntimeException(ex);
- }
- }
-
-}
diff --git a/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/client/ClientNodeType.java b/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/client/ClientNodeType.java
deleted file mode 100644
index 7b8f07fb8c3..00000000000
--- a/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/client/ClientNodeType.java
+++ /dev/null
@@ -1,202 +0,0 @@
-/*
- * Copyright 2004-2005 The Apache Software Foundation or its licensors,
- * as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.jackrabbit.rmi.client;
-
-import java.rmi.RemoteException;
-
-import javax.jcr.Value;
-import javax.jcr.nodetype.NodeDef;
-import javax.jcr.nodetype.NodeType;
-import javax.jcr.nodetype.PropertyDef;
-
-import org.apache.jackrabbit.rmi.remote.RemoteNodeDef;
-import org.apache.jackrabbit.rmi.remote.RemoteNodeType;
-import org.apache.jackrabbit.rmi.remote.SerialValue;
-
-/**
- * Local adapter for the JCR-RMI
- * {@link org.apache.jackrabbit.rmi.remote.RemoteNodeType RemoteNodeType}
- * inteface. This class makes a remote node type locally available using
- * the JCR {@link javax.jcr.nodetype.NodeType NodeType} interface.
- *
- * @author Jukka Zitting
- * @see javax.jcr.nodetype.NodeType
- * @see org.apache.jackrabbit.rmi.remote.RemoteNodeType
- */
-public class ClientNodeType extends ClientObject implements NodeType {
-
- /** The adapted remote node type. */
- private RemoteNodeType remote;
-
- /**
- * Creates a local adapter for the given remote node type.
- *
- * @param remote remote node type
- * @param factory local adapter factory
- */
- public ClientNodeType(RemoteNodeType remote, LocalAdapterFactory factory) {
- super(factory);
- this.remote = remote;
- }
-
- /** {@inheritDoc} */
- public String getName() {
- try {
- return remote.getName();
- } catch (RemoteException ex) {
- throw new RemoteRuntimeException(ex);
- }
- }
-
- /** {@inheritDoc} */
- public boolean isMixin() {
- try {
- return remote.isMixin();
- } catch (RemoteException ex) {
- throw new RemoteRuntimeException(ex);
- }
- }
-
- /** {@inheritDoc} */
- public boolean hasOrderableChildNodes() {
- try {
- return remote.hasOrderableChildNodes();
- } catch (RemoteException ex) {
- throw new RemoteRuntimeException(ex);
- }
- }
-
- /** {@inheritDoc} */
- public NodeType[] getSupertypes() {
- try {
- return getNodeTypeArray(remote.getSupertypes());
- } catch (RemoteException ex) {
- throw new RemoteRuntimeException(ex);
- }
- }
-
- /** {@inheritDoc} */
- public NodeType[] getDeclaredSupertypes() {
- try {
- return getNodeTypeArray(remote.getDeclaredSupertypes());
- } catch (RemoteException ex) {
- throw new RemoteRuntimeException(ex);
- }
- }
-
- /** {@inheritDoc} */
- public boolean isNodeType(String type) {
- try {
- return remote.isNodeType(type);
- } catch (RemoteException ex) {
- throw new RemoteRuntimeException(ex);
- }
- }
-
- /** {@inheritDoc} */
- public PropertyDef[] getPropertyDefs() {
- try {
- return getPropertyDefArray(remote.getPropertyDefs());
- } catch (RemoteException ex) {
- throw new RemoteRuntimeException(ex);
- }
- }
-
- /** {@inheritDoc} */
- public PropertyDef[] getDeclaredPropertyDefs() {
- try {
- return getPropertyDefArray(remote.getDeclaredPropertyDefs());
- } catch (RemoteException ex) {
- throw new RemoteRuntimeException(ex);
- }
- }
-
- /** {@inheritDoc} */
- public NodeDef[] getChildNodeDefs() {
- try {
- RemoteNodeDef[] defs = remote.getChildNodeDefs();
- return getNodeDefArray(defs);
- } catch (RemoteException ex) {
- throw new RemoteRuntimeException(ex);
- }
- }
-
- /** {@inheritDoc} */
- public NodeDef[] getDeclaredChildNodeDefs() {
- try {
- RemoteNodeDef[] defs = remote.getDeclaredChildNodeDefs();
- return getNodeDefArray(defs);
- } catch (RemoteException ex) {
- throw new RemoteRuntimeException(ex);
- }
- }
-
- /** {@inheritDoc} */
- public boolean canSetProperty(String name, Value value) {
- try {
- return remote.canSetProperty(name, new SerialValue(value));
- } catch (RemoteException ex) {
- throw new RemoteRuntimeException(ex);
- }
- }
-
- /** {@inheritDoc} */
- public boolean canSetProperty(String name, Value[] values) {
- try {
- Value[] serials = SerialValue.makeSerialValueArray(values);
- return remote.canSetProperty(name, serials);
- } catch (RemoteException ex) {
- throw new RemoteRuntimeException(ex);
- }
- }
-
- /** {@inheritDoc} */
- public boolean canAddChildNode(String name) {
- try {
- return remote.canAddChildNode(name);
- } catch (RemoteException ex) {
- throw new RemoteRuntimeException(ex);
- }
- }
-
- /** {@inheritDoc} */
- public boolean canAddChildNode(String name, String type) {
- try {
- return remote.canAddChildNode(name, type);
- } catch (RemoteException ex) {
- throw new RemoteRuntimeException(ex);
- }
- }
-
- /** {@inheritDoc} */
- public boolean canRemoveItem(String name) {
- try {
- return remote.canRemoveItem(name);
- } catch (RemoteException ex) {
- throw new RemoteRuntimeException(ex);
- }
- }
-
- /** {@inheritDoc} */
- public String getPrimaryItemName() {
- try {
- return remote.getPrimaryItemName();
- } catch (RemoteException ex) {
- throw new RemoteRuntimeException(ex);
- }
- }
-}
diff --git a/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/client/ClientNodeTypeManager.java b/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/client/ClientNodeTypeManager.java
deleted file mode 100644
index 5604f4d442a..00000000000
--- a/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/client/ClientNodeTypeManager.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * Copyright 2004-2005 The Apache Software Foundation or its licensors,
- * as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.jackrabbit.rmi.client;
-
-import java.rmi.RemoteException;
-
-import javax.jcr.RepositoryException;
-import javax.jcr.nodetype.NodeType;
-import javax.jcr.nodetype.NodeTypeIterator;
-import javax.jcr.nodetype.NodeTypeManager;
-
-import org.apache.jackrabbit.rmi.remote.RemoteNodeTypeManager;
-
-/**
- * Local adapter for the JCR-RMI
- * {@link org.apache.jackrabbit.rmi.remote.RemoteNodeTypeManager RemoteNodeTypeManager}
- * inteface. This class makes a remote node type manager locally available
- * using the JCR {@link javax.jcr.nodetype.NodeTypeManager NodeTypeManager}
- * interface.
- *
- * @author Jukka Zitting
- * @see javax.jcr.nodetype.NodeTypeManager
- * @see org.apache.jackrabbit.rmi.remote.RemoteNodeTypeManager
- */
-public class ClientNodeTypeManager extends ClientObject
- implements NodeTypeManager {
-
- /** The adapted remote node type manager. */
- private RemoteNodeTypeManager remote;
-
- /**
- * Creates a local adapter for the given remote node type manager.
- *
- * @param remote remote node type manager
- * @param factory local adapter factory
- */
- public ClientNodeTypeManager(
- RemoteNodeTypeManager remote, LocalAdapterFactory factory) {
- super(factory);
- this.remote = remote;
- }
-
- /** {@inheritDoc} */
- public NodeType getNodeType(String name) throws RepositoryException {
- try {
- return getFactory().getNodeType(remote.getNodeType(name));
- } catch (RemoteException ex) {
- throw new RemoteRepositoryException(ex);
- }
- }
-
- /** {@inheritDoc} */
- public NodeTypeIterator getAllNodeTypes() throws RepositoryException {
- try {
- return getNodeTypeIterator(remote.getAllNodeTypes());
- } catch (RemoteException ex) {
- throw new RemoteRepositoryException(ex);
- }
- }
-
- /** {@inheritDoc} */
- public NodeTypeIterator getPrimaryNodeTypes() throws RepositoryException {
- try {
- return getNodeTypeIterator(remote.getPrimaryNodeTypes());
- } catch (RemoteException ex) {
- throw new RemoteRepositoryException(ex);
- }
- }
-
- /** {@inheritDoc} */
- public NodeTypeIterator getMixinNodeTypes() throws RepositoryException {
- try {
- return getNodeTypeIterator(remote.getMixinNodeTypes());
- } catch (RemoteException ex) {
- throw new RemoteRepositoryException(ex);
- }
- }
-
-}
diff --git a/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/client/ClientObject.java b/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/client/ClientObject.java
deleted file mode 100644
index 1cbe0b0429a..00000000000
--- a/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/client/ClientObject.java
+++ /dev/null
@@ -1,291 +0,0 @@
-/*
- * Copyright 2004-2005 The Apache Software Foundation or its licensors,
- * as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.jackrabbit.rmi.client;
-
-import javax.jcr.Item;
-import javax.jcr.Node;
-import javax.jcr.NodeIterator;
-import javax.jcr.Property;
-import javax.jcr.PropertyIterator;
-import javax.jcr.Session;
-import javax.jcr.nodetype.NodeDef;
-import javax.jcr.nodetype.NodeType;
-import javax.jcr.nodetype.NodeTypeIterator;
-import javax.jcr.nodetype.PropertyDef;
-import javax.jcr.version.Version;
-import javax.jcr.version.VersionIterator;
-
-import org.apache.jackrabbit.rmi.iterator.ArrayNodeIterator;
-import org.apache.jackrabbit.rmi.iterator.ArrayNodeTypeIterator;
-import org.apache.jackrabbit.rmi.iterator.ArrayPropertyIterator;
-import org.apache.jackrabbit.rmi.iterator.ArrayVersionIterator;
-import org.apache.jackrabbit.rmi.remote.RemoteItem;
-import org.apache.jackrabbit.rmi.remote.RemoteNode;
-import org.apache.jackrabbit.rmi.remote.RemoteNodeDef;
-import org.apache.jackrabbit.rmi.remote.RemoteNodeType;
-import org.apache.jackrabbit.rmi.remote.RemoteProperty;
-import org.apache.jackrabbit.rmi.remote.RemotePropertyDef;
-import org.apache.jackrabbit.rmi.remote.RemoteVersion;
-import org.apache.jackrabbit.rmi.remote.RemoteVersionHistory;
-
-/**
- * Base class for client adapter objects. The only purpose of
- * this class is to centralize the handling of the
- * local adapter factory used by the client adapters to
- * instantiate new adapters.
- *
- * @author Jukka Zitting
- */
-public class ClientObject {
-
- /** Local adapter factory. */
- private LocalAdapterFactory factory;
-
- /**
- * Creates a basic client adapter that uses the given factory
- * to create new adapters.
- *
- * @param factory local adapter factory
- */
- protected ClientObject(LocalAdapterFactory factory) {
- this.factory = factory;
- }
-
- /**
- * Returns the local adapter factory used to create new adapters.
- *
- * @return local adapter factory
- */
- protected LocalAdapterFactory getFactory() {
- return factory;
- }
-
- /**
- * Utility method to create a local adapter for a remote item.
- * This method introspects the remote reference to determine
- * whether to instantiate a {@link Property Property},
- * a {@link Node Node}, or an {@link Item Item} adapter using
- * the local adapter factory.
- * null
input is treated as an empty array.
- *
- * @param session current session
- * @param remotes remote properties
- * @return local property iterator
- */
- protected PropertyIterator getPropertyIterator(
- Session session, RemoteProperty[] remotes) {
- if (remotes != null) {
- Property[] properties = new Property[remotes.length];
- for (int i = 0; i < remotes.length; i++) {
- properties[i] = factory.getProperty(session, remotes[i]);
- }
- return new ArrayPropertyIterator(properties);
- } else {
- return new ArrayPropertyIterator(new Property[0]); // for safety
- }
- }
-
- /**
- * Utility method for creating a node iterator for an array
- * of remote nodes. The nodes in the returned iterator
- * are created using the local adapter factory.
- * null
input is treated as an empty array.
- *
- * @param session current session
- * @param remotes remote nodes
- * @return local node iterator
- */
- protected NodeIterator getNodeIterator(
- Session session, RemoteNode[] remotes) {
- if (remotes != null) {
- Node[] nodes = new Node[remotes.length];
- for (int i = 0; i < remotes.length; i++) {
- nodes[i] = getNode(session, remotes[i]);
- }
- return new ArrayNodeIterator(nodes);
- } else {
- return new ArrayNodeIterator(new Node[0]); // for safety
- }
- }
-
- /**
- * Utility method for creating a version array for an array
- * of remote versions. The versions in the returned array
- * are created using the local adapter factory.
- * null
input is treated as an empty array.
- *
- * @param session current session
- * @param remotes remote versions
- * @return local version array
- */
- protected Version[] getVersionArray(
- Session session, RemoteVersion[] remotes) {
- if (remotes != null) {
- Version[] versions = new Version[remotes.length];
- for (int i = 0; i < remotes.length; i++) {
- versions[i] = factory.getVersion(session, remotes[i]);
- }
- return versions;
- } else {
- return new Version[0]; // for safety
- }
- }
-
- /**
- * Utility method for creating a version iterator for an array
- * of remote versions. The versions in the returned iterator
- * are created using the local adapter factory.
- * null
input is treated as an empty array.
- *
- * @param session current session
- * @param remotes remote versions
- * @return local version iterator
- */
- protected VersionIterator getVersionIterator(
- Session session, RemoteVersion[] remotes) {
- return new ArrayVersionIterator(getVersionArray(session, remotes));
- }
-
- /**
- * Utility method for creating an array of local node type adapters
- * for an array of remote node types. The node type adapters are created
- * using the local adapter factory.
- * null
input is treated as an empty array.
- *
- * @param remotes remote node types
- * @return local node type array
- */
- protected NodeType[] getNodeTypeArray(RemoteNodeType[] remotes) {
- if (remotes != null) {
- NodeType[] types = new NodeType[remotes.length];
- for (int i = 0; i < remotes.length; i++) {
- types[i] = factory.getNodeType(remotes[i]);
- }
- return types;
- } else {
- return new NodeType[0]; // for safety
- }
- }
-
- /**
- * Utility method for creating an iterator of local node type adapters
- * for an array of remote node types. The node type adapters are created
- * using the local adapter factory.
- * null
input is treated as an empty array.
- *
- * @param remotes remote node types
- * @return local node type iterator
- */
- protected NodeTypeIterator getNodeTypeIterator(RemoteNodeType[] remotes) {
- return new ArrayNodeTypeIterator(getNodeTypeArray(remotes));
- }
-
- /**
- * Utility method for creating an array of local node definition
- * adapters for an array of remote node definitions. The node
- * definition adapters are created using the local adapter factory.
- * null
input is treated as an empty array.
- *
- * @param remotes remote node definitions
- * @return local node definition array
- */
- protected NodeDef[] getNodeDefArray(RemoteNodeDef[] remotes) {
- if (remotes != null) {
- NodeDef[] defs = new NodeDef[remotes.length];
- for (int i = 0; i < remotes.length; i++) {
- defs[i] = factory.getNodeDef(remotes[i]);
- }
- return defs;
- } else {
- return new NodeDef[0]; // for safety
- }
- }
-
- /**
- * Utility method for creating an array of local property definition
- * adapters for an array of remote property definitions. The property
- * definition adapters are created using the local adapter factory.
- * null
input is treated as an empty array.
- *
- * @param remotes remote property definitions
- * @return local property definition array
- */
- protected PropertyDef[] getPropertyDefArray(RemotePropertyDef[] remotes) {
- if (remotes != null) {
- PropertyDef[] defs = new PropertyDef[remotes.length];
- for (int i = 0; i < remotes.length; i++) {
- defs[i] = factory.getPropertyDef(remotes[i]);
- }
- return defs;
- } else {
- return new PropertyDef[0]; // for safety
- }
- }
-
-}
diff --git a/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/client/ClientProperty.java b/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/client/ClientProperty.java
deleted file mode 100644
index 127d97351cc..00000000000
--- a/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/client/ClientProperty.java
+++ /dev/null
@@ -1,308 +0,0 @@
-/*
- * Copyright 2004-2005 The Apache Software Foundation or its licensors,
- * as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.jackrabbit.rmi.client;
-
-import java.io.InputStream;
-import java.rmi.RemoteException;
-import java.util.Calendar;
-
-import javax.jcr.BinaryValue;
-import javax.jcr.BooleanValue;
-import javax.jcr.DateValue;
-import javax.jcr.DoubleValue;
-import javax.jcr.ItemVisitor;
-import javax.jcr.LongValue;
-import javax.jcr.Node;
-import javax.jcr.Property;
-import javax.jcr.ReferenceValue;
-import javax.jcr.RepositoryException;
-import javax.jcr.Session;
-import javax.jcr.StringValue;
-import javax.jcr.Value;
-import javax.jcr.nodetype.PropertyDef;
-
-import org.apache.jackrabbit.rmi.remote.RemoteProperty;
-import org.apache.jackrabbit.rmi.remote.SerialValue;
-
-/**
- * Local adapter for the JCR-RMI
- * {@link org.apache.jackrabbit.rmi.remote.RemoteProperty RemoteProperty}
- * inteface. This class makes a remote property locally available using
- * the JCR {@link javax.jcr.Property Property} interface.
- *
- * @author Jukka Zitting
- * @see javax.jcr.Property
- * @see org.apache.jackrabbit.rmi.remote.RemoteProperty
- */
-public class ClientProperty extends ClientItem implements Property {
-
- /** The adapted remote property. */
- private RemoteProperty remote;
-
- /**
- * Creates a local adapter for the given remote property.
- *
- * @param session current session
- * @param remote remote property
- * @param factory local adapter factory
- */
- public ClientProperty(
- Session session, RemoteProperty remote,
- LocalAdapterFactory factory) {
- super(session, remote, factory);
- this.remote = remote;
- }
-
- /**
- * Calls the {@link ItemVisitor#visit(Property) ItemVisitor.visit(Property}
- * method of the given visitor. Does not contact the remote property, but
- * the visitor may invoke other methods that do contact the remote property.
- *
- * {@inheritDoc}
- */
- public void accept(ItemVisitor visitor) throws RepositoryException {
- visitor.visit(this);
- }
-
- /**
- * Returns the boolean value of this property. Implemented as
- * getValue().getBoolean().
- *
- * {@inheritDoc}
- */
- public boolean getBoolean() throws RepositoryException {
- return getValue().getBoolean();
- }
-
- /**
- * Returns the date value of this property. Implemented as
- * getValue().getDate().
- *
- * {@inheritDoc}
- */
- public Calendar getDate() throws RepositoryException {
- return getValue().getDate();
- }
-
- /**
- * Returns the double value of this property. Implemented as
- * getValue().getDouble().
- *
- * {@inheritDoc}
- */
- public double getDouble() throws RepositoryException {
- return getValue().getDouble();
- }
-
- /**
- * Returns the long value of this property. Implemented as
- * getValue().getLong().
- *
- * {@inheritDoc}
- */
- public long getLong() throws RepositoryException {
- return getValue().getLong();
- }
-
- /**
- * Returns the binary value of this property. Implemented as
- * getValue().getStream().
- *
- * {@inheritDoc}
- */
- public InputStream getStream() throws RepositoryException {
- return getValue().getStream();
- }
-
- /**
- * Returns the string value of this property. Implemented as
- * getValue().getString().
- *
- * {@inheritDoc}
- */
- public String getString() throws RepositoryException {
- return getValue().getString();
- }
-
- /** {@inheritDoc} */
- public Value getValue() throws RepositoryException {
- try {
- return remote.getValue();
- } catch (RemoteException ex) {
- throw new RemoteRepositoryException(ex);
- }
- }
-
- /** {@inheritDoc} */
- public Value[] getValues() throws RepositoryException {
- try {
- return remote.getValues();
- } catch (RemoteException ex) {
- throw new RemoteRepositoryException(ex);
- }
- }
-
- /**
- * Sets the boolean value of this property. Implemented as
- * setValue(new BooleanValue(value)).
- *
- * {@inheritDoc}
- */
- public void setValue(boolean value) throws RepositoryException {
- setValue(new BooleanValue(value));
- }
-
- /**
- * Sets the date value of this property. Implemented as
- * setValue(new DateValue(value)).
- *
- * {@inheritDoc}
- */
- public void setValue(Calendar value) throws RepositoryException {
- setValue(new DateValue(value));
- }
-
- /**
- * Sets the double value of this property. Implemented as
- * setValue(new DoubleValue(value)).
- *
- * {@inheritDoc}
- */
- public void setValue(double value) throws RepositoryException {
- setValue(new DoubleValue(value));
- }
-
- /**
- * Sets the binary value of this property. Implemented as
- * setValue(new BinaryValue(value)).
- *
- * {@inheritDoc}
- */
- public void setValue(InputStream value) throws RepositoryException {
- setValue(new BinaryValue(value));
- }
-
- /**
- * Sets the long value of this property. Implemented as
- * setValue(new LongValue(value)).
- *
- * {@inheritDoc}
- */
- public void setValue(long value) throws RepositoryException {
- setValue(new LongValue(value));
- }
-
- /**
- * Sets the reference value of this property. Implemented as
- * setValue(new ReferenceValue(value)).
- *
- * {@inheritDoc}
- */
- public void setValue(Node value) throws RepositoryException {
- setValue(new ReferenceValue(value));
- }
-
- /**
- * Sets the string value of this property. Implemented as
- * setValue(new StringValue(value)).
- *
- * {@inheritDoc}
- */
- public void setValue(String value) throws RepositoryException {
- setValue(new StringValue(value));
- }
-
- /**
- * Sets the string values of this property. Implemented as
- * setValue(new Value[] { new StringValue(strings[0]), ... }).
- *
- * {@inheritDoc}
- */
- public void setValue(String[] strings) throws RepositoryException {
- Value[] values = new Value[strings.length];
- for (int i = 0; i < strings.length; i++) {
- values[i] = new StringValue(strings[i]);
- }
- setValue(values);
- }
-
- /** {@inheritDoc} */
- public void setValue(Value value) throws RepositoryException {
- try {
- remote.setValue(new SerialValue(value));
- } catch (RemoteException ex) {
- throw new RemoteRepositoryException(ex);
- }
- }
-
- /** {@inheritDoc} */
- public void setValue(Value[] values) throws RepositoryException {
- try {
- remote.setValue(SerialValue.makeSerialValueArray(values));
- } catch (RemoteException ex) {
- throw new RemoteRepositoryException(ex);
- }
- }
-
- /**
- * Returns the reference value of this property. Implemented by
- * converting the reference value to an UUID string and using the
- * current session to look up the referenced node.
- *
- * {@inheritDoc}
- */
- public Node getNode() throws RepositoryException {
- return getSession().getNodeByUUID(getString());
- }
-
- /** {@inheritDoc} */
- public long getLength() throws RepositoryException {
- try {
- return remote.getLength();
- } catch (RemoteException ex) {
- throw new RemoteRepositoryException(ex);
- }
- }
-
- /** {@inheritDoc} */
- public long[] getLengths() throws RepositoryException {
- try {
- return remote.getLengths();
- } catch (RemoteException ex) {
- throw new RemoteRepositoryException(ex);
- }
- }
-
- /** {@inheritDoc} */
- public PropertyDef getDefinition() throws RepositoryException {
- try {
- return getFactory().getPropertyDef(remote.getDefinition());
- } catch (RemoteException ex) {
- throw new RemoteRepositoryException(ex);
- }
- }
-
- /** {@inheritDoc} */
- public int getType() throws RepositoryException {
- try {
- return remote.getType();
- } catch (RemoteException ex) {
- throw new RemoteRepositoryException(ex);
- }
- }
-
-}
diff --git a/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/client/ClientPropertyDef.java b/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/client/ClientPropertyDef.java
deleted file mode 100644
index 1af1b91477a..00000000000
--- a/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/client/ClientPropertyDef.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * Copyright 2004-2005 The Apache Software Foundation or its licensors,
- * as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.jackrabbit.rmi.client;
-
-import java.rmi.RemoteException;
-
-import javax.jcr.Value;
-import javax.jcr.nodetype.PropertyDef;
-
-import org.apache.jackrabbit.rmi.remote.RemotePropertyDef;
-
-/**
- * Local adapter for the JCR-RMI
- * {@link org.apache.jackrabbit.rmi.remote.RemotePropertyDef RemotePropertyDef}
- * inteface. This class makes a remote property definition locally available
- * using the JCR {@link javax.jcr.nodetype.PropertyDef PropertyDef} interface.
- *
- * @author Jukka Zitting
- * @see javax.jcr.nodetype.PropertyDef
- * @see org.apache.jackrabbit.rmi.remote.RemotePropertyDef
- */
-public class ClientPropertyDef extends ClientItemDef implements PropertyDef {
-
- /** The adapted remote property. */
- private RemotePropertyDef remote;
-
- /**
- * Creates a local adapter for the given remote property definition.
- *
- * @param remote remote property definition
- * @param factory local adapter factory
- */
- public ClientPropertyDef(
- RemotePropertyDef remote, LocalAdapterFactory factory) {
- super(remote, factory);
- this.remote = remote;
- }
-
- /** {@inheritDoc} */
- public int getRequiredType() {
- try {
- return remote.getRequiredType();
- } catch (RemoteException ex) {
- throw new RemoteRuntimeException(ex);
- }
- }
-
- /** {@inheritDoc} */
- public String[] getValueConstraints() {
- try {
- return remote.getValueConstraints();
- } catch (RemoteException ex) {
- throw new RemoteRuntimeException(ex);
- }
- }
-
- /** {@inheritDoc} */
- public Value[] getDefaultValues() {
- try {
- return remote.getDefaultValues();
- } catch (RemoteException ex) {
- throw new RemoteRuntimeException(ex);
- }
- }
-
- /** {@inheritDoc} */
- public boolean isMultiple() {
- try {
- return remote.isMultiple();
- } catch (RemoteException ex) {
- throw new RemoteRuntimeException(ex);
- }
- }
-
-}
diff --git a/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/client/ClientQuery.java b/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/client/ClientQuery.java
deleted file mode 100644
index d698f85706f..00000000000
--- a/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/client/ClientQuery.java
+++ /dev/null
@@ -1,104 +0,0 @@
-/*
- * Copyright 2004-2005 The Apache Software Foundation or its licensors,
- * as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.jackrabbit.rmi.client;
-
-import java.rmi.RemoteException;
-
-import javax.jcr.RepositoryException;
-import javax.jcr.Session;
-import javax.jcr.query.Query;
-import javax.jcr.query.QueryResult;
-
-import org.apache.jackrabbit.rmi.remote.RemoteQuery;
-
-/**
- * Local adapter for the JCR-RMI
- * {@link RemoteQuery RemoteQuery}
- * inteface. This class makes a remote query locally available using
- * the JCR {@link Query Query} interface.
- *
- * @author Philipp Koch
- * @see javax.jcr.query.Query Query
- * @see org.apache.jackrabbit.rmi.remote.RemoteQuery
- */
-public class ClientQuery extends ClientObject implements Query {
-
- /** The current session */
- private Session session;
-
- /** The adapted remote query manager. */
- private RemoteQuery remote;
-
- /**
- * Creates a client adapter for the given query.
- *
- * @param session current session
- * @param remote remote query
- * @param factory adapter factory
- */
- public ClientQuery(
- Session session, RemoteQuery remote, LocalAdapterFactory factory) {
- super(factory);
- this.session = session;
- this.remote = remote;
- }
-
- /** {@inheritDoc} */
- public QueryResult execute() throws RepositoryException {
- try {
- return getFactory().getQueryResult(session, remote.execute());
- } catch (RemoteException ex) {
- throw new RemoteRepositoryException(ex);
- }
- }
-
- /** {@inheritDoc} */
- public String getStatement() {
- try {
- return remote.getStatement();
- } catch (RemoteException ex) {
- throw new RemoteRuntimeException(ex);
- }
- }
-
- /** {@inheritDoc} */
- public String getLanguage() {
- try {
- return remote.getLanguage();
- } catch (RemoteException ex) {
- throw new RemoteRuntimeException(ex);
- }
- }
-
- /** {@inheritDoc} */
- public String getPersistentQueryPath() throws RepositoryException {
- try {
- return remote.getPersistentQueryPath();
- } catch (RemoteException ex) {
- throw new RemoteRepositoryException(ex);
- }
- }
-
- /** {@inheritDoc} */
- public void save(String absPath) throws RepositoryException {
- try {
- remote.save(absPath);
- } catch (RemoteException ex) {
- throw new RemoteRepositoryException(ex);
- }
- }
-}
diff --git a/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/client/ClientQueryResult.java b/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/client/ClientQueryResult.java
deleted file mode 100644
index f9b3f618fbf..00000000000
--- a/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/client/ClientQueryResult.java
+++ /dev/null
@@ -1,113 +0,0 @@
-/*
- * Copyright 2004-2005 The Apache Software Foundation or its licensors,
- * as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.jackrabbit.rmi.client;
-
-import java.rmi.RemoteException;
-
-import javax.jcr.Node;
-import javax.jcr.NodeIterator;
-import javax.jcr.RepositoryException;
-import javax.jcr.Session;
-import javax.jcr.query.QueryResult;
-import javax.jcr.query.Row;
-import javax.jcr.query.RowIterator;
-
-import org.apache.jackrabbit.rmi.iterator.ArrayNodeIterator;
-import org.apache.jackrabbit.rmi.iterator.ArrayRowIterator;
-import org.apache.jackrabbit.rmi.remote.RemoteNode;
-import org.apache.jackrabbit.rmi.remote.RemoteQueryResult;
-import org.apache.jackrabbit.rmi.remote.RemoteRow;
-
-/**
- * Local adapter for the JCR-RMI
- * {@link RemoteQueryResult RemoteQueryResult}
- * inteface. This class makes a remote query result locally available using
- * the JCR {@link QueryResult QueryResult} interface.
- *
- * @author Philipp Koch
- * @see javax.jcr.query.QueryResult QueryResult
- * @see org.apache.jackrabbit.rmi.remote.RemoteQueryResult
- */
-public class ClientQueryResult extends ClientObject implements QueryResult {
-
- /** The current session */
- private Session session;
-
- /** The adapted remote query result. */
- private RemoteQueryResult remote;
-
- /**
- * Creates a client adapter for the given remote query result.
- *
- * @param session current session
- * @param remote remote query result
- * @param factory adapter factory
- */
- public ClientQueryResult(
- Session session, RemoteQueryResult remote,
- LocalAdapterFactory factory) {
- super(factory);
- this.session = session;
- this.remote = remote;
- }
-
- /** {@inheritDoc} */
- public String[] getPropertyNames() throws RepositoryException {
- try {
- return remote.getPropertyNames();
- } catch (RemoteException ex) {
- throw new RemoteRepositoryException(ex);
- }
- }
-
- /** {@inheritDoc} */
- public RowIterator getRows() throws RepositoryException {
- try {
- RemoteRow[] remotes = remote.getRows();
- if (remotes != null) {
- Row[] rows = new Row[remotes.length];
- for (int i = 0; i < rows.length; i++) {
- rows[i] = getFactory().getRow(remotes[i]);
- }
- return new ArrayRowIterator(rows);
- } else {
- return new ArrayRowIterator(new Row[0]);
- }
- } catch (RemoteException ex) {
- throw new RemoteRepositoryException(ex);
- }
- }
-
- /** {@inheritDoc} */
- public NodeIterator getNodes() throws RepositoryException {
- try {
- RemoteNode[] remotes = remote.getNodes();
- if (remotes != null) {
- Node[] nodes = new Node[remotes.length];
- for (int i = 0; i < nodes.length; i++) {
- nodes[i] = getNode(session, remotes[i]);
- }
- return new ArrayNodeIterator(nodes);
- } else {
- return new ArrayNodeIterator(new Node[0]);
- }
- } catch (RemoteException ex) {
- throw new RemoteRepositoryException(ex);
- }
- }
-
-}
diff --git a/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/client/ClientRepository.java b/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/client/ClientRepository.java
deleted file mode 100644
index 1ce012cb145..00000000000
--- a/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/client/ClientRepository.java
+++ /dev/null
@@ -1,115 +0,0 @@
-/*
- * Copyright 2004-2005 The Apache Software Foundation or its licensors,
- * as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.jackrabbit.rmi.client;
-
-import java.rmi.RemoteException;
-
-import javax.jcr.Credentials;
-import javax.jcr.Repository;
-import javax.jcr.RepositoryException;
-import javax.jcr.Session;
-
-import org.apache.jackrabbit.rmi.remote.RemoteRepository;
-import org.apache.jackrabbit.rmi.remote.RemoteSession;
-
-/**
- * Local adapter for the JCR-RMI
- * {@link org.apache.jackrabbit.rmi.remote.RemoteRepository RemoteRepository}
- * inteface. This class makes a remote repository locally available using
- * the JCR {@link javax.jcr.Repository Repository} interface.
- *
- * @author Jukka Zitting
- * @see javax.jcr.Repository
- * @see org.apache.jackrabbit.rmi.remote.RemoteRepository
- */
-public class ClientRepository extends ClientObject implements Repository {
-
- /** The adapted remote repository. */
- private RemoteRepository remote;
-
- /**
- * Creates a client adapter for the given remote repository.
- *
- * @param remote remote repository
- * @param factory local adapter factory
- */
- public ClientRepository(
- RemoteRepository remote, LocalAdapterFactory factory) {
- super(factory);
- this.remote = remote;
- }
-
- /** {@inheritDoc} */
- public String getDescriptor(String name) {
- try {
- return remote.getDescriptor(name);
- } catch (RemoteException ex) {
- throw new RemoteRuntimeException(ex);
- }
- }
-
- /** {@inheritDoc} */
- public String[] getDescriptorKeys() {
- try {
- return remote.getDescriptorKeys();
- } catch (RemoteException ex) {
- throw new RemoteRuntimeException(ex);
- }
- }
-
- /** {@inheritDoc} */
- public Session login() throws RepositoryException {
- try {
- RemoteSession session = remote.login();
- return getFactory().getSession(this, session);
- } catch (RemoteException ex) {
- throw new RemoteRepositoryException(ex);
- }
- }
-
- /** {@inheritDoc} */
- public Session login(String workspace) throws RepositoryException {
- try {
- RemoteSession session = remote.login(workspace);
- return getFactory().getSession(this, session);
- } catch (RemoteException ex) {
- throw new RemoteRepositoryException(ex);
- }
- }
-
- /** {@inheritDoc} */
- public Session login(Credentials credentials) throws RepositoryException {
- try {
- RemoteSession session = remote.login(credentials);
- return getFactory().getSession(this, session);
- } catch (RemoteException ex) {
- throw new RemoteRepositoryException(ex);
- }
- }
-
- /** {@inheritDoc} */
- public Session login(Credentials credentials, String workspace)
- throws RepositoryException {
- try {
- RemoteSession session = remote.login(credentials, workspace);
- return getFactory().getSession(this, session);
- } catch (RemoteException ex) {
- throw new RemoteRepositoryException(ex);
- }
- }
-
-}
diff --git a/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/client/ClientRepositoryFactory.java b/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/client/ClientRepositoryFactory.java
deleted file mode 100644
index 6b920e48a46..00000000000
--- a/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/client/ClientRepositoryFactory.java
+++ /dev/null
@@ -1,153 +0,0 @@
-/*
- * Copyright 2004-2005 The Apache Software Foundation or its licensors,
- * as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.jackrabbit.rmi.client;
-
-import java.net.MalformedURLException;
-import java.rmi.Naming;
-import java.rmi.NotBoundException;
-import java.rmi.RemoteException;
-import java.util.HashMap;
-import java.util.Hashtable;
-import java.util.Map;
-
-import javax.jcr.Repository;
-import javax.naming.Context;
-import javax.naming.Name;
-import javax.naming.NamingException;
-import javax.naming.RefAddr;
-import javax.naming.Reference;
-import javax.naming.spi.ObjectFactory;
-
-import org.apache.jackrabbit.rmi.remote.RemoteRepository;
-
-/**
- * Object factory for JCR-RMI clients. This factory can be used either
- * directly or as a JNDI object factory.
- *
- * @author Jukka Zitting
- * @see ClientRepository
- */
-public class ClientRepositoryFactory implements ObjectFactory {
-
- /**
- * The JNDI parameter name for configuring the RMI URL of
- * a remote repository.
- */
- public static final String URL_PARAMETER = "url";
-
- /**
- * Cache for repository references.
- */
- private Map repositories;
-
- /**
- * Local adapter factory.
- */
- private LocalAdapterFactory factory;
-
- /**
- * Creates a JCR-RMI client factory with the default adapter factory.
- */
- public ClientRepositoryFactory() {
- this(new ClientAdapterFactory());
- }
-
- /**
- * Creates a JCR-RMI client factory with the given adapter factory.
- *
- * @param factory local adapter factory
- */
- public ClientRepositoryFactory(LocalAdapterFactory factory) {
- this.repositories = new HashMap();
- this.factory = factory;
- }
-
- /**
- * Returns a client wrapper for a remote content repository. The remote
- * repository is looked up from the RMI registry using the given URL and
- * wrapped into a {@link ClientRepository ClientRepository} adapter.
- * Looking up a JCR-RMI client
-
- String name = ...; // The RMI URL of the repository
-
- ClientRepositoryFactory factory = new ClientRepositoryFactory();
- Repository repository = factory.getRepository(name);
-
-
-
-context.xml:
- <Resource name="jcr/Repository" auth="Container"
- type="javax.jcr.Repository"
- factory="org.apache.jackrabbit.rmi.client.ClientRepositoryFactory"
- url="..."/>
-
-web.xml:
- <resource-env-ref>
- <description>The external content repository</description>
- <resource-env-ref-name>jcr/Repository</resource-env-ref-name>
- <resource-env-ref-type>javac.jcr.Repository</resource-env-ref-type>
- </resource-env-ref>
-
-...SomeServlet.java:
- Context initial = new InitialContext();
- Context context = (Context) initial.lookup("java:comp/env");
- Repository repository = (Repository) context.lookup("jcr/Repository");
-
-
-true
if the item is automatically created,
- * false
otherwise
- * @throws RemoteException on RMI errors
- */
- boolean isAutoCreate() throws RemoteException;
-
- /**
- * Remote version of the
- * {@link javax.jcr.nodetype.ItemDef#isMandatory() ItemDef.isMandatory()}
- * method.
- *
- * @return true
if the item is mandatory,
- * false
otherwise
- * @throws RemoteException on RMI errors
- */
- boolean isMandatory() throws RemoteException;
-
- /**
- * Remote version of the
- * {@link javax.jcr.nodetype.ItemDef#getOnParentVersion() ItemDef.getOnParentVersion()}
- * method.
- *
- * @return parent version behaviour
- * @throws RemoteException on RMI errors
- */
- int getOnParentVersion() throws RemoteException;
-
- /**
- * Remote version of the
- * {@link javax.jcr.nodetype.ItemDef#isProtected() ItemDef.isProtected()}
- * method.
- *
- * @return true
if the item is protected,
- * false
otherwise
- * @throws RemoteException on RMI errors
- */
- boolean isProtected() throws RemoteException;
-
-}
diff --git a/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/remote/RemoteLock.java b/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/remote/RemoteLock.java
deleted file mode 100644
index 015ffc3d630..00000000000
--- a/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/remote/RemoteLock.java
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * Copyright 2004-2005 The Apache Software Foundation or its licensors,
- * as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.jackrabbit.rmi.remote;
-
-import java.rmi.Remote;
-import java.rmi.RemoteException;
-
-import javax.jcr.RepositoryException;
-
-/**
- * Remote version of the JCR {@link javax.jcr.lock.Lock} interface.
- * Used by the {@link org.apache.jackrabbit.rmi.server.ServerLock ServerLock}
- * and {@link org.apache.jackrabbit.rmi.client.ClientLock ClientLock}
- * adapter classes to provide transparent RMI access to remote locks.
- * true
if the lock is deep,
- * false
otherwise
- * @throws RemoteException on RMI errors
- */
- boolean isDeep() throws RemoteException;
-
- /**
- * Remote version of the
- * {@link javax.jcr.lock.Lock#getLockToken() Lock.getLockToken()} method.
- *
- * @return lock token
- * @throws RemoteException on RMI errors
- */
- String getLockToken() throws RemoteException;
-
- /**
- * Remote version of the
- * {@link javax.jcr.lock.Lock#isLive() Lock.isLive()} method.
- *
- * @return true
if the lock is live,
- * false
otherwise
- * @throws RemoteException on RMI errors
- */
- boolean isLive() throws RemoteException;
-
- /**
- * Remote version of the
- * {@link javax.jcr.lock.Lock#refresh() Lock.refresh()} method.
- *
- * @throws RepositoryException on repository errors
- * @throws RemoteException on RMI errors
- */
- void refresh() throws RepositoryException, RemoteException;
-
-}
diff --git a/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/remote/RemoteNodeDef.java b/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/remote/RemoteNodeDef.java
deleted file mode 100644
index f774a0180f9..00000000000
--- a/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/remote/RemoteNodeDef.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Copyright 2004-2005 The Apache Software Foundation or its licensors,
- * as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.jackrabbit.rmi.remote;
-
-import java.rmi.RemoteException;
-
-/**
- * Remote version of the JCR {@link javax.jcr.nodetype.NodeDef NodeDef}
- * interface. Used by the
- * {@link org.apache.jackrabbit.rmi.server.ServerNodeDef ServerNodeDef} and
- * {@link org.apache.jackrabbit.rmi.client.ClientNodeDef ClientNodeDef}
- * adapters to provide transparent RMI access to remote node definitions.
- * true
if same name siblings are allowed,
- * false
otherwise
- * @throws RemoteException on RMI errors
- */
- boolean allowSameNameSibs() throws RemoteException;
-
-}
diff --git a/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/remote/RemoteNodeType.java b/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/remote/RemoteNodeType.java
deleted file mode 100644
index 0fa861d5873..00000000000
--- a/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/remote/RemoteNodeType.java
+++ /dev/null
@@ -1,221 +0,0 @@
-/*
- * Copyright 2004-2005 The Apache Software Foundation or its licensors,
- * as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.jackrabbit.rmi.remote;
-
-import java.rmi.Remote;
-import java.rmi.RemoteException;
-
-import javax.jcr.Value;
-
-/**
- * Remote version of the JCR {@link javax.jcr.nodetype.NodeType NodeType}
- * interface. Used by the
- * {@link org.apache.jackrabbit.rmi.server.ServerNodeType ServerNodeType} and
- * {@link org.apache.jackrabbit.rmi.client.ClientNodeType ClientNodeType}
- * adapters to provide transparent RMI access to remote node types.
- * true
if this is a mixin type,
- * false
otherwise
- * @throws RemoteException on RMI errors
- */
- boolean isMixin() throws RemoteException;
-
- /**
- * Remote version of the
- * {@link javax.jcr.nodetype.NodeType#hasOrderableChildNodes() NodeType.hasOrderableChildNodes()}
- * method.
- *
- * @return true
if nodes of this type has orderable
- * child nodes, false
otherwise
- * @throws RemoteException on RMI errors
- */
- boolean hasOrderableChildNodes() throws RemoteException;
-
- /**
- * Remote version of the
- * {@link javax.jcr.nodetype.NodeType#getSupertypes() NodeType.getSupertypes()}
- * method.
- *
- * @return supertypes
- * @throws RemoteException on RMI errors
- */
- RemoteNodeType[] getSupertypes() throws RemoteException;
-
- /**
- * Remote version of the
- * {@link javax.jcr.nodetype.NodeType#getDeclaredSupertypes() NodeType.getDeclaredSupertypes()}
- * method.
- *
- * @return declared supertypes
- * @throws RemoteException on RMI errors
- */
- RemoteNodeType[] getDeclaredSupertypes() throws RemoteException;
-
- /**
- * Remote version of the
- * {@link javax.jcr.nodetype.NodeType#isNodeType(String) NodeType.isNodeType(String)}
- * method.
- *
- * @param type node type name
- * @return true
if this node type is or extends the
- * given node type, false
otherwise
- * @throws RemoteException on RMI errors
- */
- boolean isNodeType(String type) throws RemoteException;
-
- /**
- * Remote version of the
- * {@link javax.jcr.nodetype.NodeType#getPropertyDefs() NodeType.getPropertyDefs()}
- * method.
- *
- * @return property definitions
- * @throws RemoteException on RMI errors
- */
- RemotePropertyDef[] getPropertyDefs() throws RemoteException;
-
- /**
- * Remote version of the
- * {@link javax.jcr.nodetype.NodeType#getDeclaredPropertyDefs() NodeType.getDeclaredPropertyDefs()}
- * method.
- *
- * @return declared property definitions
- * @throws RemoteException on RMI errors
- */
- RemotePropertyDef[] getDeclaredPropertyDefs() throws RemoteException;
-
- /**
- * Remote version of the
- * {@link javax.jcr.nodetype.NodeType#getChildNodeDefs() NodeType.getChildNodeDefs()}
- * method.
- *
- * @return child node definitions
- * @throws RemoteException on RMI errors
- */
- RemoteNodeDef[] getChildNodeDefs() throws RemoteException;
-
- /**
- * Remote version of the
- * {@link javax.jcr.nodetype.NodeType#getDeclaredChildNodeDefs() NodeType.getDeclaredChildNodeDefs()}
- * method.
- *
- * @return declared child node definitions
- * @throws RemoteException on RMI errors
- */
- RemoteNodeDef[] getDeclaredChildNodeDefs() throws RemoteException;
-
- /**
- * Remote version of the
- * {@link javax.jcr.nodetype.NodeType#canSetProperty(String,Value) NodeType.canSetProperty(String,Value)}
- * method.
- *
- * @param name property name
- * @param value property value
- * @return true
if the property can be set,
- * false
otherwise
- * @throws RemoteException on RMI errors
- */
- boolean canSetProperty(String name, Value value) throws RemoteException;
-
- /**
- * Remote version of the
- * {@link javax.jcr.nodetype.NodeType#canSetProperty(String,Value[]) NodeType.canSetProperty(String,Value[])}
- * method.
- *
- * @param name property name
- * @param values property values
- * @return true
if the property can be set,
- * false
otherwise
- * @throws RemoteException on RMI errors
- */
- boolean canSetProperty(String name, Value[] values) throws RemoteException;
-
- /**
- * Remote version of the
- * {@link javax.jcr.nodetype.NodeType#canAddChildNode(String) NodeType.canAddChildNode(String)}
- * method.
- *
- * @param name child node name
- * @return true
if the child node can be added,
- * false
otherwise
- * @throws RemoteException on RMI errors
- */
- boolean canAddChildNode(String name) throws RemoteException;
-
- /**
- * Remote version of the
- * {@link javax.jcr.nodetype.NodeType#canAddChildNode(String,String) NodeType.canAddChildNode(String,String)}
- * method.
- *
- * @param name child node name
- * @param type child node type
- * @return true
if the child node can be added,
- * false
otherwise
- * @throws RemoteException on RMI errors
- */
- boolean canAddChildNode(String name, String type) throws RemoteException;
-
- /**
- * Remote version of the
- * {@link javax.jcr.nodetype.NodeType#canRemoveItem(String) NodeType.canRemoveItem(String)}
- * method.
- *
- * @param name item name
- * @return true
if the item can be removed,
- * false
otherwise
- * @throws RemoteException on RMI errors
- */
- boolean canRemoveItem(String name) throws RemoteException;
-
- /**
- * Remote version of the
- * {@link javax.jcr.nodetype.NodeType#getPrimaryItemName() NodeType.getPrimaryItemName()}
- * method.
- *
- * @return primary item name
- * @throws RemoteException on RMI errors
- */
- String getPrimaryItemName() throws RemoteException;
-
-}
diff --git a/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/remote/RemotePropertyDef.java b/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/remote/RemotePropertyDef.java
deleted file mode 100644
index 8bb133a5fa1..00000000000
--- a/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/remote/RemotePropertyDef.java
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- * Copyright 2004-2005 The Apache Software Foundation or its licensors,
- * as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.jackrabbit.rmi.remote;
-
-import java.rmi.RemoteException;
-
-import javax.jcr.Value;
-
-/**
- * Remote version of the JCR {@link javax.jcr.nodetype.PropertyDef PropertyDef}
- * interface. Used by the
- * {@link org.apache.jackrabbit.rmi.server.ServerPropertyDef ServerPropertyDef}
- * and
- * {@link org.apache.jackrabbit.rmi.client.ClientPropertyDef ClientPropertyDef}
- * adapters to provide transparent RMI access to remote property definitions.
- * true
if the property is multi-valued,
- * false
otherwise
- * @throws RemoteException on RMI errors
- */
- boolean isMultiple() throws RemoteException;
-
-}
diff --git a/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/remote/RemoteQuery.java b/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/remote/RemoteQuery.java
deleted file mode 100644
index dc0a61991ee..00000000000
--- a/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/remote/RemoteQuery.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * Copyright 2004-2005 The Apache Software Foundation or its licensors,
- * as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.jackrabbit.rmi.remote;
-
-import java.rmi.Remote;
-import java.rmi.RemoteException;
-
-import javax.jcr.RepositoryException;
-
-/**
- * Remote version of the JCR {@link javax.jcr.query.Query Query} interface.
- * Used by the {@link org.apache.jackrabbit.rmi.server.ServerQuery ServerQuery}
- * and {@link org.apache.jackrabbit.rmi.client.ClientQuery ClientQuery}
- * adapter base classes to provide transparent RMI access to remote items.
- * QueryResult
- * @throws RepositoryException on repository errors
- * @throws RemoteException on RMI errors
- */
- RemoteQueryResult execute() throws RepositoryException, RemoteException;
-
- /**
- * @see javax.jcr.query.Query#getStatement()
- *
- * @return the query statement.
- * @throws RemoteException on RMI errors
- */
- String getStatement() throws RemoteException;
-
- /**
- * @see javax.jcr.query.Query#getLanguage()
- *
- * @return the query language.
- * @throws RemoteException on RMI errors
- */
- String getLanguage() throws RemoteException;
-
- /**
- * @see javax.jcr.query.Query#getPersistentQueryPath()
- *
- * @return path of the node representing this query.
- * @throws RepositoryException on repository errors
- * @throws RemoteException on RMI errors
- */
- String getPersistentQueryPath() throws RepositoryException, RemoteException;
-
- /**
- * @see javax.jcr.query.Query#save(String)
- *
- * @param absPath path at which to persist this query.
- * @throws RepositoryException on repository errors
- * @throws RemoteException on RMI errors
- */
- void save(String absPath) throws RepositoryException, RemoteException;
-
-}
diff --git a/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/remote/RemoteQueryResult.java b/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/remote/RemoteQueryResult.java
deleted file mode 100644
index c3bd4f2ce54..00000000000
--- a/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/remote/RemoteQueryResult.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Copyright 2004-2005 The Apache Software Foundation or its licensors,
- * as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.jackrabbit.rmi.remote;
-
-import java.rmi.Remote;
-import java.rmi.RemoteException;
-
-import javax.jcr.RepositoryException;
-
-/**
- * Remote version of the JCR {@link javax.jcr.query.QueryResult QueryResult} interface.
- * Used by the {@link org.apache.jackrabbit.rmi.server.ServerQueryResult ServerQueryResult}
- * and {@link org.apache.jackrabbit.rmi.client.ClientQueryResult ClientQueryResult}
- * adapter base classes to provide transparent RMI access to remote items.
- * PropertyIterator
- * @throws RepositoryException on repository errors
- * @throws RemoteException on RMI errors
- */
- String[] getPropertyNames() throws RepositoryException, RemoteException;
-
- /**
- * @see javax.jcr.query.QueryResult#getRows()
- *
- * @return a RowIterator
- * @throws RepositoryException on repository errors
- * @throws RemoteException on RMI errors
- */
- RemoteRow[] getRows() throws RepositoryException, RemoteException;
-
- /**
- * @see javax.jcr.query.QueryResult#getNodes()
- *
- * @return a NodeIterator
- * @throws RepositoryException on repository errors
- * @throws RemoteException on RMI errors
- */
- RemoteNode[] getNodes() throws RepositoryException, RemoteException;
-
-}
diff --git a/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/remote/RemoteRepository.java b/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/remote/RemoteRepository.java
deleted file mode 100644
index e8efeac0168..00000000000
--- a/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/remote/RemoteRepository.java
+++ /dev/null
@@ -1,119 +0,0 @@
-/*
- * Copyright 2004-2005 The Apache Software Foundation or its licensors,
- * as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.jackrabbit.rmi.remote;
-
-import java.rmi.Remote;
-import java.rmi.RemoteException;
-
-import javax.jcr.Credentials;
-import javax.jcr.RepositoryException;
-
-/**
- * Remote version of the JCR {@link javax.jcr.Repository Repository} interface.
- * Used by the
- * {@link org.apache.jackrabbit.rmi.server.ServerRepository ServerRepository}
- * and
- * {@link org.apache.jackrabbit.rmi.client.ClientRepository ClientRepository}
- * adapters to provide transparent RMI access to remote repositories.
-* true
if the item exists,
- * false
otherwise
- * @throws RemoteException on RMI errors
- */
- boolean itemExists(String path) throws RemoteException;
-
- /**
- * Remote version of the
- * {@link javax.jcr.Session#move(String,String) Session.move(String,String)}
- * method.
- *
- * @param from source path
- * @param to destination path
- * @throws RepositoryException on repository errors
- * @throws RemoteException on RMI errors
- */
- void move(String from, String to)
- throws RepositoryException, RemoteException;
-
- /**
- * Remote version of the
- * {@link javax.jcr.Session#save() Session.save()} method.
- *
- * @throws RepositoryException on repository errors
- * @throws RemoteException on RMI errors
- */
- void save() throws RepositoryException, RemoteException;
-
- /**
- * Remote version of the
- * {@link javax.jcr.Session#refresh(boolean) Session.refresh(boolean)}
- * method.
- *
- * @param keepChanges flag to keep transient changes
- * @throws RepositoryException on repository errors
- * @throws RemoteException on RMI errors
- */
- void refresh(boolean keepChanges)
- throws RepositoryException, RemoteException;
-
- /**
- * Remote version of the
- * {@link javax.jcr.Session#logout() Session.logout()}
- * method.
- *
- * @throws RemoteException on RMI errors
- */
- void logout() throws RemoteException;
-
- /**
- * Remote version of the
- * {@link javax.jcr.Session#getRootNode() Session.getRootNode()} method.
- *
- * @return root node
- * @throws RepositoryException on repository errors
- * @throws RemoteException on RMI errors
- */
- RemoteNode getRootNode() throws RepositoryException, RemoteException;
-
- /**
- * Remote version of the
- * {@link javax.jcr.Session#hasPendingChanges() Session.hasPendingChanges()}
- * method.
- *
- * @return true
if the session has pending changes,
- * false
otherwise
- * @throws RepositoryException on repository errors
- * @throws RemoteException on RMI errors
- */
- boolean hasPendingChanges() throws RepositoryException, RemoteException;
-
- /**
- * Remote version of the
- * {@link javax.jcr.Session#checkPermission(String,String) Session.checkPermission(String,String)}
- * method.
- *
- * @param path item path
- * @param actions actions
- * @throws AccessControlException if permission is denied
- * @throws RemoteException on RMI errors
- */
- void checkPermission(String path, String actions)
- throws AccessControlException, RemoteException;
-
- /**
- * Imports the system or document view XML data into a subtree of
- * the identified node. Note that the entire XML stream is transferred
- * as a single byte array over the network. This may cause problems with
- * large XML streams. The remote server will wrap the XML data into
- * a {@link java.io.ByteArrayInputStream ByteArrayInputStream} and feed
- * it to the normal importXML method.
- *
- * @param path node path
- * @param xml imported XML document
- * @throws IOException on IO errors
- * @throws RepositoryException on repository errors
- * @throws RemoteException on RMI errors
- * @see javax.jcr.Session#importXML(java.lang.String, java.io.InputStream)
- */
- void importXML(String path, byte[] xml)
- throws IOException, RepositoryException, RemoteException;
-
- /**
- * Remote version of the
- * {@link javax.jcr.Session#setNamespacePrefix(String,String) Session.setNamespacePrefix(String,String)}
- * method.
- *
- * @param prefix namespace prefix
- * @param uri namespace uri
- * @throws RepositoryException on repository errors
- * @throws RemoteException on RMI errors
- */
- void setNamespacePrefix(String prefix, String uri)
- throws RepositoryException, RemoteException;
-
- /**
- * Remote version of the
- * {@link javax.jcr.Session#getNamespacePrefixes() Session.getNamespacePrefixes()}
- * method.
- *
- * @return namespace prefixes
- * @throws RepositoryException on repository errors
- * @throws RemoteException on RMI errors
- */
- String[] getNamespacePrefixes() throws RepositoryException, RemoteException;
-
- /**
- * Remote version of the
- * {@link javax.jcr.Session#getNamespaceURI(String) Session.getNamespaceURI(String)}
- * method.
- *
- * @param prefix namespace prefix
- * @return namespace uri
- * @throws RepositoryException on repository errors
- * @throws RemoteException on RMI errors
- */
- String getNamespaceURI(String prefix)
- throws RepositoryException, RemoteException;
-
- /**
- * Remote version of the
- * {@link javax.jcr.Session#getNamespacePrefix(String) Session.getNamespacePrefix(String)}
- * method.
- *
- * @param uri namespace uri
- * @return namespace prefix
- * @throws RepositoryException on repository errors
- * @throws RemoteException on RMI errors
- */
- String getNamespacePrefix(String uri)
- throws RepositoryException, RemoteException;
-
- /**
- * Remote version of the
- * {@link javax.jcr.Session#addLockToken(String) Session.addLockToken(String)}
- * method.
- *
- * @param name lock token
- * @throws RemoteException on RMI errors
- */
- void addLockToken(String name) throws RemoteException;
-
- /**
- * Remote version of the
- * {@link javax.jcr.Session#getLockTokens() Session.getLockTokens()}
- * method.
- *
- * @return lock tokens
- * @throws RemoteException on RMI errors
- */
- String[] getLockTokens() throws RemoteException;
-
- /**
- * Remote version of the
- * {@link javax.jcr.Session#removeLockToken(String) Session.removeLockToken(String)}
- * method.
- *
- * @param name lock token
- * @throws RemoteException on RMI errors
- */
- void removeLockToken(String name) throws RemoteException;
-
- /**
- * Exports the identified repository subtree as a system view XML
- * stream. Note that the entire XML stream is transferred as a
- * single byte array over the network. This may cause problems with
- * large exports. The remote server uses a
- * {@link java.io.ByteArrayOutputStream ByteArrayOutputStream} to capture
- * the XML data written by the normal exportSysView method.
- *
- * @param path node path
- * @param binaryAsLink TODO
- * @param noRecurse TODO
- * @return exported XML document
- * @throws IOException on IO errors
- * @throws RepositoryException on repository errors
- * @throws RemoteException on RMI errors
- * @see javax.jcr.Workspace#exportSysView(java.lang.String, java.io.OutputStream, boolean, boolean)
- */
- byte[] exportSysView(String path, boolean binaryAsLink, boolean noRecurse)
- throws IOException, RepositoryException, RemoteException;
-
- /**
- * Exports the identified repository subtree as a document view XML
- * stream. Note that the entire XML stream is transferred as a
- * single byte array over the network. This may cause problems with
- * large exports. The remote server uses a
- * {@link java.io.ByteArrayOutputStream ByteArrayOutputStream} to capture
- * the XML data written by the normal exportDocView method.
- *
- * @param path node path
- * @param binaryAsLink TODO
- * @param noRecurse TODO
- * @return exported XML document
- * @throws IOException on IO errors
- * @throws RepositoryException on repository errors
- * @throws RemoteException on RMI errors
- * @see javax.jcr.Workspace#exportDocView(java.lang.String, java.io.OutputStream, boolean, boolean)
- */
- byte[] exportDocView(String path, boolean binaryAsLink, boolean noRecurse)
- throws IOException, RepositoryException, RemoteException;
-
-}
diff --git a/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/remote/RemoteVersion.java b/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/remote/RemoteVersion.java
deleted file mode 100644
index d7acdd303c9..00000000000
--- a/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/remote/RemoteVersion.java
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * Copyright 2004-2005 The Apache Software Foundation or its licensors,
- * as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.jackrabbit.rmi.remote;
-
-import java.rmi.RemoteException;
-import java.util.Calendar;
-
-import javax.jcr.RepositoryException;
-
-
-/**
- * Remote version of the JCR {@link javax.jcr.version.Version Version} interface.
- * Used by the {@link org.apache.jackrabbit.rmi.server.ServerVersion ServerVersion}
- * and {@link org.apache.jackrabbit.rmi.client.ClientVersion ClientVersion}
- * adapters to provide transparent RMI access to remote versions.
- * RemoteVersionHistory
object.
- *
- * @throws RepositoryException on repository errors
- * @throws RemoteException on RMI errors
- */
-// RemoteVersionHistory getContainingHistory() throws RepositoryException;
-
- /**
- * Remote version of the
- * {@link javax.jcr.version.Version#getCreated() Version.getCreated()} method.
- *
- * @return a Calendar
object.
- * @throws RepositoryException on repository errors
- * @throws RemoteException on RMI errors
- */
- Calendar getCreated() throws RepositoryException, RemoteException;
-
- /**
- * Remote version of the
- * {@link javax.jcr.version.Version#getSuccessors() Version.getSuccessors()} method.
- *
- * @return a RemoteVersion
array.
- * @throws RepositoryException on repository errors
- * @throws RemoteException on RMI errors
- */
- RemoteVersion[] getSuccessors() throws RepositoryException, RemoteException;
-
- /**
- * Remote version of the
- * {@link javax.jcr.version.Version#getPredecessors() Version.getPredecessors()} method.
- *
- * @return a RemoteVersion
array.
- * @throws RepositoryException on repository errors
- * @throws RemoteException on RMI errors
- */
- RemoteVersion[] getPredecessors() throws RepositoryException, RemoteException;
-
-}
diff --git a/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/remote/RemoteVersionHistory.java b/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/remote/RemoteVersionHistory.java
deleted file mode 100644
index 839647c2b4c..00000000000
--- a/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/remote/RemoteVersionHistory.java
+++ /dev/null
@@ -1,197 +0,0 @@
-/*
- * Copyright 2004-2005 The Apache Software Foundation or its licensors,
- * as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.jackrabbit.rmi.remote;
-
-import java.rmi.RemoteException;
-
-import javax.jcr.RepositoryException;
-
-/**
- * Remote version of the JC
- * {@link javax.jcr.version.VersionHistory VersionHistory} interface. Used by
- * the
- * {@link org.apache.jackrabbit.rmi.server.ServerVersionHistory ServerVersionHistory}
- * and
- * {@link org.apache.jackrabbit.rmi.client.ClientVersionHistory ClientVersionHistory}
- * adapters to provide transparent RMI access to remote version histories.
- * Version
object.
- * @throws RepositoryException if an error occurs.
- * @throws RemoteException on RMI errors
- */
- RemoteVersion getRootVersion() throws RepositoryException, RemoteException;
-
- /**
- * Remote version of the
- * {@link javax.jcr.version.VersionHistory#getAllVersions() VersionHistory.getAllVersions()}
- * method.
- *
- * @return a VersionIterator
object.
- * @throws RepositoryException if an error occurs.
- * @throws RemoteException on RMI errors
- */
- RemoteVersion[] getAllVersions()
- throws RepositoryException, RemoteException;
-
- /**
- * Remote version of the
- * {@link javax.jcr.version.VersionHistory#getVersion(String) VersionHistory.getVersion(String)}
- * method.
- *
- * @param versionName a version name
- * @return a Version
object.
- * @throws RepositoryException if an error occurs.
- * @throws RemoteException on RMI errors
- */
- RemoteVersion getVersion(String versionName)
- throws RepositoryException, RemoteException;
-
- /**
- * Remote version of the
- * {@link javax.jcr.version.VersionHistory#getVersionByLabel(String) VersionHistory.getVersionByLabel(String)}
- * method.
- *
- * @param label a version label
- * @return a Version
object.
- * @throws RepositoryException if an error occurs.
- * @throws RemoteException on RMI errors
- */
- RemoteVersion getVersionByLabel(String label)
- throws RepositoryException, RemoteException;
-
- /**
- * Remote version of the
- * {@link javax.jcr.version.VersionHistory#addVersionLabel(String, String, boolean)
- * VersionHistory.addVersionLabel(String, String, boolean)}
- * method.
- *
- * @param versionName the name of the version to which the label is to be added.
- * @param label the label to be added.
- * @param moveLabel if true
, then if label
is already assigned to a version in
- * this version history, it is moved to the new version specified; if false
, then attempting
- * to assign an already used label will throw a VersionException
.
- *
- * @throws RepositoryException if another error occurs.
- * @throws RemoteException on RMI errors
- */
- void addVersionLabel(String versionName, String label, boolean moveLabel)
- throws RepositoryException, RemoteException;
-
- /**
- * Remote version of the
- * {@link javax.jcr.version.VersionHistory#removeVersionLabel(String) VersionHistory.removeVersionLabel(String)}
- * method.
- *
- * @param label a version label
- * @throws RepositoryException if another error occurs.
- * @throws RemoteException on RMI errors
- */
- void removeVersionLabel(String label)
- throws RepositoryException, RemoteException;
-
- /**
- * Remote version of the
- * {@link javax.jcr.version.VersionHistory#hasVersionLabel(String) VersionHistory.hasVersionLabel(String)}
- * method.
- *
- * @param label a version label
- * @return a boolean
- * @throws RemoteException on RMI errors
- */
- boolean hasVersionLabel(String label) throws RemoteException;
-
- /**
- * Remote version of the
- * {@link javax.jcr.version.VersionHistory#hasVersionLabel(RemoteVersion, String) hasVersionLabel(RemoteVersion, String)}
- * method.
- *
- * @param versionUUID The UUID of the version whose labels are to be returned.
- * @param label a version label
- * @return a boolean
.
- * @throws RepositoryException if another error occurs.
- * @throws RemoteException on RMI errors
- */
- boolean hasVersionLabel(String versionUUID, String label)
- throws RepositoryException, RemoteException;
-
- /**
- * Remote version of the
- * {@link javax.jcr.version.VersionHistory#getVersionLabels() VersionHistory.getVersionLabels()}
- * method.
- *
- * @return a String
array containing all the labels of the version history
- * @throws RemoteException on RMI errors
- */
- String[] getVersionLabels() throws RemoteException;
-
- /**
- * Remote version of the
- * {@link javax.jcr.version.VersionHistory#getVersionLabels(RemoteVersion) VersionHistory.getVersionLabels(RemoteVersion)}
- * method.
- *
- * @param versionUUID The UUID of the version whose labels are to be returned.
- * @return a String
array containing all the labels of the given version
- * @throws RepositoryException if another error occurs.
- * @throws RemoteException on RMI errors
- */
- String[] getVersionLabels(String versionUUID)
- throws RepositoryException, RemoteException;
-
- /**
- * Remote version of the
- * {@link javax.jcr.version.VersionHistory#removeVersion(String) VersionHistory.removeVersion(String)}
- * method.
- *
- * @param versionName the name of a version in this version history.
- * @throws RepositoryException if another error occurs.
- * @throws RemoteException on RMI errors
- */
- void removeVersion(String versionName)
- throws RepositoryException, RemoteException;
-}
diff --git a/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/remote/SerialValue.java b/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/remote/SerialValue.java
deleted file mode 100644
index 2b78989e886..00000000000
--- a/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/remote/SerialValue.java
+++ /dev/null
@@ -1,274 +0,0 @@
-/*
- * Copyright 2004-2005 The Apache Software Foundation or its licensors,
- * as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.jackrabbit.rmi.remote;
-
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.ObjectInputStream;
-import java.io.ObjectOutputStream;
-import java.io.Serializable;
-import java.util.Calendar;
-
-import javax.jcr.BinaryValue;
-import javax.jcr.BooleanValue;
-import javax.jcr.DateValue;
-import javax.jcr.DoubleValue;
-import javax.jcr.LongValue;
-import javax.jcr.NameValue;
-import javax.jcr.PathValue;
-import javax.jcr.PropertyType;
-import javax.jcr.ReferenceValue;
-import javax.jcr.RepositoryException;
-import javax.jcr.StringValue;
-import javax.jcr.Value;
-import javax.jcr.ValueFormatException;
-
-/**
- * Serializable {@link Value Value} decorator. A SerialValue decorator
- * makes it possible to serialize the contents of a Value object even
- * if the object itself is not serializable. For example the standard
- * JCR Value classes are not serializable.
- * null
, then an empty
- * array is returned.
- *
- * @param values the values to be decorated
- * @return array of decorated values
- */
- public static Value[] makeSerialValueArray(Value[] values) {
- if (values != null) {
- Value[] serials = new Value[values.length];
- for (int i = 0; i < values.length; i++) {
- serials[i] = new SerialValue(values[i]);
- }
- return serials;
- } else {
- return new Value[0];
- }
- }
-
- /**
- * Serializes the underlying Value object. Instead of using
- * the normal serialization mechanism, the essential state
- * of the Value object is extracted and written to the serialization
- * stream as a type-value pair.
- *
- * @param out the serialization stream
- * @throws IOException on IO errors
- */
- private void writeObject(ObjectOutputStream out) throws IOException {
- try {
- int type = value.getType();
- out.writeInt(type);
- switch (type) {
- case PropertyType.BINARY:
- InputStream data = value.getStream();
- ByteArrayOutputStream buffer = new ByteArrayOutputStream();
- byte[] bytes = new byte[4096];
- for (int n = data.read(bytes); n != -1; n = data.read(bytes)) {
- buffer.write(bytes, 0, n);
- }
- out.writeInt(buffer.size());
- buffer.writeTo(out);
- break;
- case PropertyType.BOOLEAN:
- out.writeBoolean(value.getBoolean());
- break;
- case PropertyType.DATE:
- out.writeObject(value.getDate());
- break;
- case PropertyType.DOUBLE:
- out.writeDouble(value.getDouble());
- break;
- case PropertyType.LONG:
- out.writeLong(value.getLong());
- break;
- case PropertyType.NAME:
- case PropertyType.PATH:
- case PropertyType.REFERENCE:
- case PropertyType.STRING:
- out.writeUTF(value.getString());
- break;
- default:
- throw new IOException("Unknown value type");
- }
- } catch (RepositoryException ex) {
- throw new IOException(ex.getMessage());
- }
- }
-
- /**
- * Deserializes the underlying Value object. A new Value object
- * is created based on the type and state data read fro the
- * serialization stream.
- *
- * @param in the serialization stream
- * @throws IOException on IO errors
- */
- private void readObject(ObjectInputStream in) throws IOException {
- try {
- int type = in.readInt();
- switch (type) {
- case PropertyType.BINARY:
- byte[] bytes = new byte[in.readInt()];
- in.readFully(bytes);
- value = new BinaryValue(bytes);
- break;
- case PropertyType.BOOLEAN:
- value = new BooleanValue(in.readBoolean());
- break;
- case PropertyType.DATE:
- value = new DateValue((Calendar) in.readObject());
- break;
- case PropertyType.DOUBLE:
- value = new DoubleValue(in.readDouble());
- break;
- case PropertyType.LONG:
- value = new LongValue(in.readLong());
- break;
- case PropertyType.NAME:
- value = NameValue.valueOf(in.readUTF());
- break;
- case PropertyType.PATH:
- value = PathValue.valueOf(in.readUTF());
- break;
- case PropertyType.REFERENCE:
- value = ReferenceValue.valueOf(in.readUTF());
- break;
- case PropertyType.STRING:
- value = new StringValue(in.readUTF());
- break;
- default:
- throw new IllegalStateException("Illegal serial value type");
- }
- } catch (ValueFormatException ex) {
- throw new IOException(ex.getMessage());
- } catch (ClassNotFoundException ex) {
- throw new IOException(ex.getMessage());
- }
- }
-
- /**
- * Forwards the method call to the decorated value.
- * {@inheritDoc}
- */
- public boolean getBoolean() throws ValueFormatException,
- IllegalStateException, RepositoryException {
- return value.getBoolean();
- }
-
- /**
- * Forwards the method call to the decorated value.
- * {@inheritDoc}
- */
- public Calendar getDate() throws ValueFormatException,
- IllegalStateException, RepositoryException {
- return value.getDate();
- }
-
- /**
- * Forwards the method call to the decorated value.
- * {@inheritDoc}
- */
- public double getDouble() throws ValueFormatException,
- IllegalStateException, RepositoryException {
- return value.getDouble();
- }
-
- /**
- * Forwards the method call to the decorated value.
- * {@inheritDoc}
- */
- public long getLong() throws ValueFormatException, IllegalStateException,
- RepositoryException {
- return value.getLong();
- }
-
- /**
- * Forwards the method call to the decorated value.
- * {@inheritDoc}
- */
- public InputStream getStream() throws ValueFormatException,
- IllegalStateException, RepositoryException {
- return value.getStream();
- }
-
- /**
- * Forwards the method call to the decorated value.
- * {@inheritDoc}
- */
- public String getString() throws ValueFormatException,
- IllegalStateException, RepositoryException {
- return value.getString();
- }
-
- /**
- * Forwards the method call to the decorated value.
- * {@inheritDoc}
- */
- public int getType() {
- return value.getType();
- }
-
-}
diff --git a/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/remote/package.html b/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/remote/package.html
deleted file mode 100644
index 53883a550fc..00000000000
--- a/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/remote/package.html
+++ /dev/null
@@ -1,19 +0,0 @@
-item
, this method calls the
- * {@link #getRemoteNode(Node)} to return the correct remote type.
- *
- * @param item local node, property, or item
- * @return remote node, property, or item reference
- * @throws RemoteException on RMI errors
- */
- protected RemoteItem getRemoteItem(Item item) throws RemoteException {
- if (item instanceof Property) {
- return factory.getRemoteProperty((Property) item);
- } else if (item instanceof Node) {
- return getRemoteNode((Node) item);
- } else {
- return factory.getRemoteItem(item);
- }
- }
-
- /**
- * Utility method for creating a remote reference for a local node.
- * Unlike the factory method for creating remote node references, this
- * method introspects the type of the local node and returns the
- * corresponding node, version, or version history remote reference using
- * the remote adapter factory.
- *
- * @param node local version, versionhistory, or normal node
- * @return remote node, property, or item reference
- * @throws RemoteException on RMI errors
- */
- protected RemoteNode getRemoteNode(Node node) throws RemoteException {
- if (node instanceof Version) {
- return factory.getRemoteVersion((Version) node);
- } else if (node instanceof VersionHistory) {
- return factory.getRemoteVersionHistory((VersionHistory) node);
- } else {
- return factory.getRemoteNode(node);
- }
- }
-
- /**
- * Utility method for creating an array of remote references for
- * local properties. The remote references are created using the
- * remote adapter factory.
- * null
input is treated as an empty iterator.
- *
- * @param iterator local property iterator
- * @return remote property array
- * @throws RemoteException on RMI errors
- */
- protected RemoteProperty[] getRemotePropertyArray(PropertyIterator iterator)
- throws RemoteException {
- if (iterator == null) {
- return new RemoteProperty[0]; // for safety
- }
-
- RemoteProperty[] remotes = new RemoteProperty[(int) iterator.getSize()];
- for (int i = 0; iterator.hasNext(); i++) {
- remotes[i] = factory.getRemoteProperty(iterator.nextProperty());
- }
- return remotes;
- }
-
- /**
- * Utility method for creating an array of remote references for
- * local nodes. The remote references are created using the
- * remote adapter factory.
- * null
input is treated as an empty iterator.
- *
- * @param iterator local node iterator
- * @return remote node array
- * @throws RemoteException on RMI errors
- */
- protected RemoteNode[] getRemoteNodeArray(NodeIterator iterator)
- throws RemoteException {
- if (iterator != null) {
- RemoteNode[] remotes = new RemoteNode[(int) iterator.getSize()];
- for (int i = 0; iterator.hasNext(); i++) {
- remotes[i] = getRemoteNode(iterator.nextNode());
- }
- return remotes;
- } else {
- return new RemoteNode[0]; // for safety
- }
- }
-
- /**
- * Utility method for creating an array of remote references for
- * local versions. The remote references are created using the
- * remote adapter factory.
- * null
input is treated as an empty array.
- *
- * @param versions local version array
- * @return remote version array
- * @throws RemoteException on RMI errors
- */
- protected RemoteVersion[] getRemoteVersionArray(Version[] versions)
- throws RemoteException {
- if (versions != null) {
- RemoteVersion[] remotes = new RemoteVersion[versions.length];
- for (int i = 0; i < remotes.length; i++) {
- remotes[i] = factory.getRemoteVersion(versions[i]);
- }
- return remotes;
- } else {
- return new RemoteVersion[0]; // for safety
- }
- }
-
- /**
- * Utility method for creating an array of remote references for
- * local versions. The remote references are created using the
- * remote adapter factory.
- * null
input is treated as an empty iterator.
- *
- * @param iterator local version iterator
- * @return remote version array
- * @throws RemoteException on RMI errors
- */
- protected RemoteVersion[] getRemoteVersionArray(VersionIterator iterator)
- throws RemoteException {
- if (iterator != null) {
- RemoteVersion[] remotes = new RemoteVersion[(int) iterator.getSize()];
- for (int i = 0; iterator.hasNext(); i++) {
- remotes[i] = factory.getRemoteVersion(iterator.nextVersion());
- }
- return remotes;
- } else {
- return new RemoteVersion[0]; // for safety
- }
- }
-
- /**
- * Utility method for creating an array of remote references for
- * local node types. The remote references are created using the
- * remote adapter factory.
- * null
input is treated as an empty array.
- *
- * @param types local node type array
- * @return remote node type array
- * @throws RemoteException on RMI errors
- */
- protected RemoteNodeType[] getRemoteNodeTypeArray(NodeType[] types)
- throws RemoteException {
- if (types != null) {
- RemoteNodeType[] remotes = new RemoteNodeType[types.length];
- for (int i = 0; i < types.length; i++) {
- remotes[i] = factory.getRemoteNodeType(types[i]);
- }
- return remotes;
- } else {
- return new RemoteNodeType[0]; // for safety
- }
- }
-
- /**
- * Utility method for creating an array of remote references for
- * local node types. The remote references are created using the
- * remote adapter factory.
- * null
input is treated as an empty iterator.
- *
- * @param iterator local node type iterator
- * @return remote node type array
- * @throws RemoteException on RMI errors
- */
- protected RemoteNodeType[] getRemoteNodeTypeArray(NodeTypeIterator iterator)
- throws RemoteException {
- if (iterator != null) {
- RemoteNodeType[] remotes =
- new RemoteNodeType[(int) iterator.getSize()];
- for (int i = 0; iterator.hasNext(); i++) {
- remotes[i] = factory.getRemoteNodeType(iterator.nextNodeType());
- }
- return remotes;
- } else {
- return new RemoteNodeType[0]; // for safety
- }
- }
-
- /**
- * Utility method for creating an array of remote references for
- * local node definitions. The remote references are created using the
- * remote adapter factory.
- * null
input is treated as an empty array.
- *
- * @param defs local node definition array
- * @return remote node definition array
- * @throws RemoteException on RMI errors
- */
- protected RemoteNodeDef[] getRemoteNodeDefArray(NodeDef[] defs)
- throws RemoteException {
- if (defs != null) {
- RemoteNodeDef[] remotes = new RemoteNodeDef[defs.length];
- for (int i = 0; i < defs.length; i++) {
- remotes[i] = factory.getRemoteNodeDef(defs[i]);
- }
- return remotes;
- } else {
- return new RemoteNodeDef[0]; // for safety
- }
- }
-
- /**
- * Utility method for creating an array of remote references for
- * local property definitions. The remote references are created using the
- * remote adapter factory.
- * null
input is treated as an empty array.
- *
- * @param defs local property definition array
- * @return remote property definition array
- * @throws RemoteException on RMI errors
- */
- protected RemotePropertyDef[] getRemotePropertyDefArray(PropertyDef[] defs)
- throws RemoteException {
- if (defs != null) {
- RemotePropertyDef[] remotes = new RemotePropertyDef[defs.length];
- for (int i = 0; i < defs.length; i++) {
- remotes[i] = factory.getRemotePropertyDef(defs[i]);
- }
- return remotes;
- } else {
- return new RemotePropertyDef[0]; // for safety
- }
- }
-
-}
diff --git a/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/ServerPropertyDef.java b/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/ServerPropertyDef.java
deleted file mode 100644
index 51d0d4a28e6..00000000000
--- a/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/ServerPropertyDef.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * Copyright 2004-2005 The Apache Software Foundation or its licensors,
- * as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.jackrabbit.rmi.server;
-
-import java.rmi.RemoteException;
-
-import javax.jcr.Value;
-import javax.jcr.nodetype.PropertyDef;
-
-import org.apache.jackrabbit.rmi.remote.RemotePropertyDef;
-import org.apache.jackrabbit.rmi.remote.SerialValue;
-
-/**
- * Remote adapter for the JCR
- * {@link javax.jcr.nodetype.PropertyDef PropertyDef} interface. This
- * class makes a local property definition available as an RMI service
- * using the
- * {@link org.apache.jackrabbit.rmi.remote.RemotePropertyDef RemotePropertyDef}
- * interface.
- *
- * @author Jukka Zitting
- * @see javax.jcr.nodetype.PropertyDef
- * @see org.apache.jackrabbit.rmi.remote.RemotePropertyDef
- */
-public class ServerPropertyDef extends ServerItemDef
- implements RemotePropertyDef {
-
- /** The adapted local property definition. */
- private PropertyDef def;
-
- /**
- * Creates a remote adapter for the given local property definition.
- *
- * @param def local property definition
- * @param factory remote adapter factory
- * @throws RemoteException on RMI errors
- */
- public ServerPropertyDef(PropertyDef def, RemoteAdapterFactory factory)
- throws RemoteException {
- super(def, factory);
- this.def = def;
- }
-
- /** {@inheritDoc} */
- public int getRequiredType() throws RemoteException {
- return def.getRequiredType();
- }
-
- /** {@inheritDoc} */
- public String[] getValueConstraints() throws RemoteException {
- return def.getValueConstraints();
- }
-
- /** {@inheritDoc} */
- public Value[] getDefaultValues() throws RemoteException {
- return SerialValue.makeSerialValueArray(def.getDefaultValues());
- }
-
- /** {@inheritDoc} */
- public boolean isMultiple() throws RemoteException {
- return def.isMultiple();
- }
-
-}
diff --git a/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/ServerQuery.java b/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/ServerQuery.java
deleted file mode 100644
index 4510f5f115f..00000000000
--- a/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/ServerQuery.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * Copyright 2004-2005 The Apache Software Foundation or its licensors,
- * as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.jackrabbit.rmi.server;
-
-import java.rmi.RemoteException;
-
-import javax.jcr.RepositoryException;
-import javax.jcr.query.Query;
-
-import org.apache.jackrabbit.rmi.remote.RemoteQuery;
-import org.apache.jackrabbit.rmi.remote.RemoteQueryResult;
-
-/**
- * Remote adapter for the JCR {@link javax.jcr.query.Query Query} interface.
- * This class makes a local session available as an RMI service using the
- * {@link org.apache.jackrabbit.rmi.remote.RemoteQuery RemoteQuery}
- * interface.
- *
- * @author Philipp Koch
- * @see javax.jcr.query.Query
- * @see org.apache.jackrabbit.rmi.remote.RemoteQuery
- */
-public class ServerQuery extends ServerObject implements RemoteQuery {
-
- /** The adapted local query manager. */
- private Query query;
-
- /**
- * Creates a remote adapter for the given local Query
.
- *
- * @param query local Query
- * @param factory remote adapter factory
- * @throws RemoteException on RMI errors
- */
- public ServerQuery(Query query, RemoteAdapterFactory factory)
- throws RemoteException {
- super(factory);
- this.query = query;
- }
-
- /** {@inheritDoc} */
- public RemoteQueryResult execute()
- throws RepositoryException, RemoteException {
- return new ServerQueryResult(query.execute(), getFactory());
- }
-
- /** {@inheritDoc} */
- public String getStatement() throws RemoteException {
- return query.getStatement();
- }
-
- /** {@inheritDoc} */
- public String getLanguage() throws RemoteException {
- return query.getLanguage();
- }
-
- /** {@inheritDoc} */
- public String getPersistentQueryPath()
- throws RepositoryException, RemoteException {
- return query.getPersistentQueryPath();
- }
-
- /** {@inheritDoc} */
- public void save(String absPath)
- throws RepositoryException, RemoteException {
- query.save(absPath);
- }
-}
diff --git a/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/ServerQueryManager.java b/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/ServerQueryManager.java
deleted file mode 100644
index 26ce7f032c7..00000000000
--- a/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/ServerQueryManager.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- * Copyright 2004-2005 The Apache Software Foundation or its licensors,
- * as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.jackrabbit.rmi.server;
-
-import java.rmi.RemoteException;
-
-import javax.jcr.Node;
-import javax.jcr.RepositoryException;
-import javax.jcr.query.Query;
-import javax.jcr.query.QueryManager;
-
-import org.apache.jackrabbit.rmi.remote.RemoteQuery;
-import org.apache.jackrabbit.rmi.remote.RemoteQueryManager;
-
-/**
- * Remote adapter for the JCR {@link javax.jcr.query.QueryManager QueryManager}
- * interface. This class makes a local query manager available as an RMI
- * service using the
- * {@link org.apache.jackrabbit.rmi.remote.RemoteQueryManager RemoteQueryManager}
- * interface.
- *
- * @author Philipp Koch
- * @see javax.jcr.query.QueryManager
- * @see org.apache.jackrabbit.rmi.remote.RemoteQueryManager
- */
-public class ServerQueryManager extends ServerObject
- implements RemoteQueryManager {
-
- /** The adapted local query manager. */
- private QueryManager manager;
-
- /**
- * Creates a remote adapter for the given local query manager.
- *
- * @param manager local query manager
- * @param factory remote adapter factory
- * @throws RemoteException on RMI errors
- */
- public ServerQueryManager(
- QueryManager manager, ServerAdapterFactory factory)
- throws RemoteException {
- super(factory);
- this.manager = manager;
- }
-
- /** {@inheritDoc} */
- public RemoteQuery createQuery(String statement, String language)
- throws RepositoryException, RemoteException {
- try {
- Query query = manager.createQuery(statement, language);
- return getFactory().getRemoteQuery(query);
- } catch (RepositoryException ex) {
- throw getRepositoryException(ex);
- }
- }
-
- /** {@inheritDoc} */
- public RemoteQuery getQuery(String absPath)
- throws RepositoryException, RemoteException {
- try {
- Node node = null; // TODO
- return getFactory().getRemoteQuery(manager.getQuery(node));
- } catch (RepositoryException ex) {
- throw getRepositoryException(ex);
- }
- }
-
- /** {@inheritDoc} */
- public String[] getSupportedQueryLanguages() throws RemoteException {
- return manager.getSupportedQueryLanguages();
- }
-
-}
diff --git a/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/ServerQueryResult.java b/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/ServerQueryResult.java
deleted file mode 100644
index 60616929934..00000000000
--- a/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/ServerQueryResult.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * Copyright 2004-2005 The Apache Software Foundation or its licensors,
- * as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.jackrabbit.rmi.server;
-
-import java.rmi.RemoteException;
-
-import javax.jcr.NodeIterator;
-import javax.jcr.RepositoryException;
-import javax.jcr.query.QueryResult;
-import javax.jcr.query.RowIterator;
-
-import org.apache.jackrabbit.rmi.remote.RemoteNode;
-import org.apache.jackrabbit.rmi.remote.RemoteQueryResult;
-import org.apache.jackrabbit.rmi.remote.RemoteRow;
-
-/**
- * Remote adapter for the JCR {@link javax.jcr.query.QueryResult QueryResult} interface.
- * This class makes a local session available as an RMI service using the
- * {@link org.apache.jackrabbit.rmi.remote.RemoteQueryResult RemoteQueryResult}
- * interface.
- *
- * @author Philipp Koch
- * @see javax.jcr.query.QueryResult
- * @see org.apache.jackrabbit.rmi.remote.RemoteQueryResult
- */
-public class ServerQueryResult extends ServerObject
- implements RemoteQueryResult {
-
- /** The adapted local query result. */
- private QueryResult result;
-
- /**
- * Creates a remote adapter for the given local QueryResult
.
- *
- * @param result local QueryResult
- * @param factory remote adapter factory
- * @throws RemoteException on RMI errors
- */
- public ServerQueryResult(QueryResult result, RemoteAdapterFactory factory)
- throws RemoteException {
- super(factory);
- this.result = result;
- }
-
- /** {@inheritDoc} */
- public String[] getPropertyNames()
- throws RepositoryException, RemoteException {
- return result.getPropertyNames();
- }
-
- /** {@inheritDoc} */
- public RemoteRow[] getRows() throws RepositoryException, RemoteException {
- RowIterator iterator = result.getRows();
- if (iterator != null) {
- RemoteRow[] remotes = new RemoteRow[(int) iterator.getSize()];
- for (int i = 0; iterator.hasNext(); i++) {
- remotes[i] = getFactory().getRemoteRow(iterator.nextRow());
- }
- return remotes;
- } else {
- return new RemoteRow[0]; // for safety
- }
- }
-
- /** {@inheritDoc} */
- public RemoteNode[] getNodes() throws RepositoryException, RemoteException {
- NodeIterator iterator = result.getNodes();
- if (iterator != null) {
- RemoteNode[] remotes = new RemoteNode[(int) iterator.getSize()];
- for (int i = 0; iterator.hasNext(); i++) {
- remotes[i] = getRemoteNode(iterator.nextNode());
- }
- return remotes;
- } else {
- return new RemoteNode[0]; // for safety
- }
- }
-
-}
diff --git a/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/ServerRepository.java b/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/ServerRepository.java
deleted file mode 100644
index abc1425ae34..00000000000
--- a/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/ServerRepository.java
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
- * Copyright 2004-2005 The Apache Software Foundation or its licensors,
- * as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.jackrabbit.rmi.server;
-
-import java.rmi.RemoteException;
-
-import javax.jcr.Credentials;
-import javax.jcr.Repository;
-import javax.jcr.RepositoryException;
-import javax.jcr.Session;
-
-import org.apache.jackrabbit.rmi.remote.RemoteRepository;
-import org.apache.jackrabbit.rmi.remote.RemoteSession;
-
-/**
- * Remote adapter for the JCR {@link javax.jcr.Repository Repository}
- * interface. This class makes a local repository available as an RMI service
- * using the
- * {@link org.apache.jackrabbit.rmi.remote.RemoteRepository RemoteRepository}
- * interface.
- *
- * @author Jukka Zitting
- * @see javax.jcr.Repository
- * @see org.apache.jackrabbit.rmi.remote.RemoteRepository
- */
-public class ServerRepository extends ServerObject implements RemoteRepository {
-
- /** The adapted local repository. */
- private Repository repository;
-
- /**
- * Creates a remote adapter for the given local repository.
- *
- * @param repository local repository
- * @param factory remote adapter factory
- * @throws RemoteException on RMI errors
- */
- public ServerRepository(
- Repository repository, RemoteAdapterFactory factory)
- throws RemoteException {
- super(factory);
- this.repository = repository;
- }
-
- /** {@inheritDoc} */
- public String getDescriptor(String name) throws RemoteException {
- return repository.getDescriptor(name);
- }
-
- /** {@inheritDoc} */
- public String[] getDescriptorKeys() throws RemoteException {
- return repository.getDescriptorKeys();
- }
-
- /** {@inheritDoc} */
- public RemoteSession login() throws RepositoryException, RemoteException {
- try {
- Session session = repository.login();
- return getFactory().getRemoteSession(session);
- } catch (RepositoryException ex) {
- throw getRepositoryException(ex);
- }
- }
-
- /** {@inheritDoc} */
- public RemoteSession login(String workspace)
- throws RepositoryException, RemoteException {
- try {
- Session session = repository.login(workspace);
- return getFactory().getRemoteSession(session);
- } catch (RepositoryException ex) {
- throw getRepositoryException(ex);
- }
- }
-
- /** {@inheritDoc} */
- public RemoteSession login(Credentials credentials)
- throws RepositoryException, RemoteException {
- try {
- Session session = repository.login(credentials);
- return getFactory().getRemoteSession(session);
- } catch (RepositoryException ex) {
- throw getRepositoryException(ex);
- }
- }
-
- /** {@inheritDoc} */
- public RemoteSession login(Credentials credentials, String workspace)
- throws RepositoryException, RemoteException {
- try {
- Session session = repository.login(credentials, workspace);
- return getFactory().getRemoteSession(session);
- } catch (RepositoryException ex) {
- throw getRepositoryException(ex);
- }
- }
-
-}
diff --git a/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/ServerRow.java b/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/ServerRow.java
deleted file mode 100644
index 99c2c913a33..00000000000
--- a/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/ServerRow.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Copyright 2004-2005 The Apache Software Foundation or its licensors,
- * as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.jackrabbit.rmi.server;
-
-import java.rmi.RemoteException;
-
-import javax.jcr.RepositoryException;
-import javax.jcr.Value;
-import javax.jcr.query.Row;
-
-import org.apache.jackrabbit.rmi.remote.RemoteRow;
-
-/**
- * Remote adapter for the JCR {@link javax.jcr.query.Row Row} interface.
- * This class makes a local session available as an RMI service using the
- * {@link org.apache.jackrabbit.rmi.remote.RemoteRow RemoteRow}
- * interface.
- *
- * @author Philipp Koch
- * @see javax.jcr.query.Row
- * @see org.apache.jackrabbit.rmi.remote.RemoteRow
- */
-public class ServerRow extends ServerObject implements RemoteRow {
-
- /** The adapted local row. */
- private Row row;
-
- /**
- * Creates a remote adapter for the given local query row.
- *
- * @param row local query row
- * @param factory remote adapter factory
- * @throws RemoteException on RMI errors
- */
- public ServerRow(Row row, RemoteAdapterFactory factory)
- throws RemoteException {
- super(factory);
- this.row = row;
- }
-
- /** {@inheritDoc} */
- public Value[] getValues() throws RepositoryException, RemoteException {
- return row.getValues();
- }
-
- /** {@inheritDoc} */
- public Value getValue(String propertyName)
- throws RepositoryException, RemoteException {
- return row.getValue(propertyName);
- }
-}
diff --git a/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/ServerSession.java b/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/ServerSession.java
deleted file mode 100644
index 72c327758fc..00000000000
--- a/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/ServerSession.java
+++ /dev/null
@@ -1,269 +0,0 @@
-/*
- * Copyright 2004-2005 The Apache Software Foundation or its licensors,
- * as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.jackrabbit.rmi.server;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.rmi.RemoteException;
-import java.security.AccessControlException;
-
-import javax.jcr.Credentials;
-import javax.jcr.RepositoryException;
-import javax.jcr.Session;
-
-import org.apache.jackrabbit.rmi.remote.RemoteItem;
-import org.apache.jackrabbit.rmi.remote.RemoteNode;
-import org.apache.jackrabbit.rmi.remote.RemoteSession;
-import org.apache.jackrabbit.rmi.remote.RemoteWorkspace;
-
-/**
- * Remote adapter for the JCR {@link javax.jcr.Session Session} interface.
- * This class makes a local session available as an RMI service using the
- * {@link org.apache.jackrabbit.rmi.remote.RemoteSession RemoteSession}
- * interface.
- *
- * @author Jukka Zitting
- * @see javax.jcr.Session
- * @see org.apache.jackrabbit.rmi.remote.RemoteSession
- */
-public class ServerSession extends ServerObject implements RemoteSession {
-
- /** The adapted local session. */
- private Session session;
-
- /**
- * Creates a remote adapter for the given local session.
- *
- * @param session local session
- * @param factory remote adapter factory
- * @throws RemoteException on RMI errors
- */
- public ServerSession(Session session, RemoteAdapterFactory factory)
- throws RemoteException {
- super(factory);
- this.session = session;
- }
-
- /** {@inheritDoc} */
- public String getUserId() throws RemoteException {
- return session.getUserId();
- }
-
- /** {@inheritDoc} */
- public Object getAttribute(String name) throws RemoteException {
- return session.getAttribute(name);
- }
-
- /** {@inheritDoc} */
- public String[] getAttributeNames() throws RemoteException {
- return session.getAttributeNames();
- }
-
- /** {@inheritDoc} */
- public RemoteSession impersonate(Credentials credentials)
- throws RepositoryException, RemoteException {
- try {
- Session newSession = session.impersonate(credentials);
- return getFactory().getRemoteSession(newSession);
- } catch (RepositoryException ex) {
- throw getRepositoryException(ex);
- }
- }
-
- /** {@inheritDoc} */
- public RemoteWorkspace getWorkspace() throws RemoteException {
- return getFactory().getRemoteWorkspace(session.getWorkspace());
- }
-
- /** {@inheritDoc} */
- public void checkPermission(String path, String actions)
- throws AccessControlException, RemoteException {
- session.checkPermission(path, actions);
- }
-
- /** {@inheritDoc} */
- public String getNamespacePrefix(String uri)
- throws RepositoryException, RemoteException {
- try {
- return session.getNamespacePrefix(uri);
- } catch (RepositoryException ex) {
- throw getRepositoryException(ex);
- }
- }
-
- /** {@inheritDoc} */
- public String[] getNamespacePrefixes()
- throws RepositoryException, RemoteException {
- try {
- return session.getNamespacePrefixes();
- } catch (RepositoryException ex) {
- throw getRepositoryException(ex);
- }
- }
-
- /** {@inheritDoc} */
- public String getNamespaceURI(String prefix)
- throws RepositoryException, RemoteException {
- try {
- return session.getNamespaceURI(prefix);
- } catch (RepositoryException ex) {
- throw getRepositoryException(ex);
- }
- }
-
- /** {@inheritDoc} */
- public void setNamespacePrefix(String prefix, String uri)
- throws RepositoryException, RemoteException {
- try {
- session.setNamespacePrefix(prefix, uri);
- } catch (RepositoryException ex) {
- throw getRepositoryException(ex);
- }
- }
-
- /** {@inheritDoc} */
- public boolean itemExists(String path) throws RemoteException {
- return session.itemExists(path);
- }
-
- /** {@inheritDoc} */
- public RemoteNode getNodeByUUID(String uuid)
- throws RepositoryException, RemoteException {
- try {
- return getRemoteNode(session.getNodeByUUID(uuid));
- } catch (RepositoryException ex) {
- throw getRepositoryException(ex);
- }
- }
-
- /** {@inheritDoc} */
- public RemoteNode getRootNode()
- throws RepositoryException, RemoteException {
- try {
- return getRemoteNode(session.getRootNode());
- } catch (RepositoryException ex) {
- throw getRepositoryException(ex);
- }
- }
-
- /** {@inheritDoc} */
- public RemoteItem getItem(String path)
- throws RepositoryException, RemoteException {
- try {
- return getRemoteItem(session.getItem(path));
- } catch (RepositoryException ex) {
- throw getRepositoryException(ex);
- }
- }
-
- /** {@inheritDoc} */
- public boolean hasPendingChanges()
- throws RepositoryException, RemoteException {
- try {
- return session.hasPendingChanges();
- } catch (RepositoryException ex) {
- throw getRepositoryException(ex);
- }
- }
-
- /** {@inheritDoc} */
- public void move(String from, String to)
- throws RepositoryException, RemoteException {
- try {
- session.move(from, to);
- } catch (RepositoryException ex) {
- throw getRepositoryException(ex);
- }
- }
-
- /** {@inheritDoc} */
- public void save() throws RepositoryException, RemoteException {
- try {
- session.save();
- } catch (RepositoryException ex) {
- throw getRepositoryException(ex);
- }
- }
-
- /** {@inheritDoc} */
- public void refresh(boolean keepChanges)
- throws RepositoryException, RemoteException {
- try {
- session.refresh(keepChanges);
- } catch (RepositoryException ex) {
- throw getRepositoryException(ex);
- }
- }
-
- /** {@inheritDoc} */
- public void logout() throws RemoteException {
- session.logout();
- }
-
- /** {@inheritDoc} */
- public void importXML(String path, byte[] xml)
- throws IOException, RepositoryException, RemoteException {
- try {
- session.importXML(path, new ByteArrayInputStream(xml));
- } catch (RepositoryException ex) {
- throw getRepositoryException(ex);
- }
- }
-
- /** {@inheritDoc} */
- public void addLockToken(String token) throws RemoteException {
- session.addLockToken(token);
- }
-
- /** {@inheritDoc} */
- public String[] getLockTokens() throws RemoteException {
- return session.getLockTokens();
- }
-
- /** {@inheritDoc} */
- public void removeLockToken(String token) throws RemoteException {
- session.removeLockToken(token);
- }
-
- /** {@inheritDoc} */
- public byte[] exportDocView(
- String path, boolean binaryAsLink, boolean noRecurse)
- throws IOException, RepositoryException, RemoteException {
- try {
- ByteArrayOutputStream buffer = new ByteArrayOutputStream();
- session.exportDocView(path, buffer, binaryAsLink, noRecurse);
- return buffer.toByteArray();
- } catch (RepositoryException ex) {
- throw getRepositoryException(ex);
- }
- }
-
- /** {@inheritDoc} */
- public byte[] exportSysView(
- String path, boolean binaryAsLink, boolean noRecurse)
- throws IOException, RepositoryException, RemoteException {
- try {
- ByteArrayOutputStream buffer = new ByteArrayOutputStream();
- session.exportSysView(path, buffer, binaryAsLink, noRecurse);
- return buffer.toByteArray();
- } catch (RepositoryException ex) {
- throw getRepositoryException(ex);
- }
- }
-
-}
diff --git a/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/ServerVersion.java b/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/ServerVersion.java
deleted file mode 100644
index b2063b4ee30..00000000000
--- a/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/ServerVersion.java
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- * Copyright 2004-2005 The Apache Software Foundation or its licensors,
- * as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.jackrabbit.rmi.server;
-
-import java.rmi.RemoteException;
-import java.util.Calendar;
-
-import javax.jcr.RepositoryException;
-import javax.jcr.version.Version;
-
-import org.apache.jackrabbit.rmi.remote.RemoteVersion;
-
-/**
- * Remote adapter for the JCR {@link javax.jcr.version.Version Version} interface.
- * This class makes a local version available as an RMI service using
- * the {@link org.apache.jackrabbit.rmi.remote.RemoteVersion RemoteVersion}
- * interface.
- *
- * @author Felix Meschberger
- * @see javax.jcr.version.Version
- * @see org.apache.jackrabbit.rmi.remote.RemoteVersion
- */
-public class ServerVersion extends ServerNode implements RemoteVersion {
-
- /** The adapted local version. */
- private Version version;
-
- /**
- * Creates a remote adapter for the given local version.
- *
- * @param version local version
- * @param factory remote adapter factory
- * @throws RemoteException on RMI errors
- */
- public ServerVersion(Version version, RemoteAdapterFactory factory)
- throws RemoteException {
- super(version, factory);
- this.version = version;
- }
-
-// This is only available after 0.16.2
-// /** {@inheritDoc} */
-// public RemoteVersionHistory getContainingHistory() throws RepositoryException {
-// try {
-// return getFactory().getRemoteVersionHistory(version.getContainingHistory());
-// } catch (RepositoryException ex) {
-// throw getRepositoryException(ex);
-// }
-// }
-
- /** {@inheritDoc} */
- public Calendar getCreated() throws RepositoryException {
- try {
- return version.getCreated();
- } catch (RepositoryException ex) {
- throw getRepositoryException(ex);
- }
- }
-
- /** {@inheritDoc} */
- public RemoteVersion[] getSuccessors() throws RepositoryException, RemoteException {
- try {
- return getRemoteVersionArray(version.getSuccessors());
- } catch (RepositoryException ex) {
- throw getRepositoryException(ex);
- }
- }
-
- /** {@inheritDoc} */
- public RemoteVersion[] getPredecessors() throws RepositoryException, RemoteException {
- try {
- return getRemoteVersionArray(version.getPredecessors());
- } catch (RepositoryException ex) {
- throw getRepositoryException(ex);
- }
- }
-}
diff --git a/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/ServerVersionHistory.java b/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/ServerVersionHistory.java
deleted file mode 100644
index 3d8d63c769c..00000000000
--- a/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/ServerVersionHistory.java
+++ /dev/null
@@ -1,174 +0,0 @@
-/*
- * Copyright 2004-2005 The Apache Software Foundation or its licensors,
- * as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.jackrabbit.rmi.server;
-
-import java.rmi.RemoteException;
-
-import javax.jcr.RepositoryException;
-import javax.jcr.version.Version;
-import javax.jcr.version.VersionHistory;
-
-import org.apache.jackrabbit.rmi.remote.RemoteVersion;
-import org.apache.jackrabbit.rmi.remote.RemoteVersionHistory;
-
-/**
- * Remote adapter for the JCR {@link javax.jcr.version.VersionHistory VersionHistory}
- * interface. This class makes a local version history available as an RMI
- * service using the
- * {@link org.apache.jackrabbit.rmi.remote.RemoteVersionHistory RemoteVersionHistory}
- * interface.
- *
- * @author Felix Meschberger
- * @see javax.jcr.version.VersionHistory
- * @see org.apache.jackrabbit.rmi.remote.RemoteVersionHistory
- */
-public class ServerVersionHistory extends ServerNode
- implements RemoteVersionHistory {
-
- /** The adapted local version history. */
- private VersionHistory versionHistory;
-
- /**
- * Creates a remote adapter for the given local version history.
- *
- * @param versionHistory local version history
- * @param factory remote adapter factory
- * @throws RemoteException on RMI errors
- */
- public ServerVersionHistory(VersionHistory versionHistory,
- RemoteAdapterFactory factory) throws RemoteException {
- super(versionHistory, factory);
- this.versionHistory = versionHistory;
- }
-
- /** {@inheritDoc} */
-// public String getVersionableUUID()
-// throws RepositoryException, RemoteException {
-// try {
-// return versionHistory.getVersionableUUID();
-// } catch (RepositoryException ex) {
-// throw getRepositoryException(ex);
-// }
-// }
-
- /** {@inheritDoc} */
- public RemoteVersion getRootVersion()
- throws RepositoryException, RemoteException {
- try {
- return getFactory().getRemoteVersion(versionHistory.getRootVersion());
- } catch (RepositoryException ex) {
- throw getRepositoryException(ex);
- }
- }
-
- /** {@inheritDoc} */
- public RemoteVersion[] getAllVersions()
- throws RepositoryException, RemoteException {
- try {
- return getRemoteVersionArray(versionHistory.getAllVersions());
- } catch (RepositoryException ex) {
- throw getRepositoryException(ex);
- }
- }
-
- /** {@inheritDoc} */
- public RemoteVersion getVersion(String versionName)
- throws RepositoryException, RemoteException {
- try {
- Version version = versionHistory.getVersion(versionName);
- return getFactory().getRemoteVersion(version);
- } catch (RepositoryException ex) {
- throw getRepositoryException(ex);
- }
- }
-
- /** {@inheritDoc} */
- public RemoteVersion getVersionByLabel(String label)
- throws RepositoryException, RemoteException {
- try {
- Version version = versionHistory.getVersionByLabel(label);
- return getFactory().getRemoteVersion(version);
- } catch (RepositoryException ex) {
- throw getRepositoryException(ex);
- }
- }
-
- /** {@inheritDoc} */
- public void addVersionLabel(String versionName, String label,
- boolean moveLabel) throws RepositoryException, RemoteException {
- try {
- versionHistory.addVersionLabel(versionName, label, moveLabel);
- } catch (RepositoryException ex) {
- throw getRepositoryException(ex);
- }
- }
-
- /** {@inheritDoc} */
- public void removeVersionLabel(String label) throws RepositoryException,
- RemoteException {
- try {
- versionHistory.removeVersionLabel(label);
- } catch (RepositoryException ex) {
- throw getRepositoryException(ex);
- }
- }
-
- /** {@inheritDoc} */
- public boolean hasVersionLabel(String label) throws RemoteException {
- return versionHistory.hasVersionLabel(label);
- }
-
- /** {@inheritDoc} */
- public boolean hasVersionLabel(String versionUUID, String label)
- throws RepositoryException, RemoteException {
- try {
- Version version = getVersionByUUID(versionUUID);
- return versionHistory.hasVersionLabel(version, label);
- } catch (RepositoryException ex) {
- throw getRepositoryException(ex);
- }
- }
-
- /** {@inheritDoc} */
- public String[] getVersionLabels() throws RemoteException {
- return versionHistory.getVersionLabels();
- }
-
- /** {@inheritDoc} */
- public String[] getVersionLabels(String versionUUID)
- throws RepositoryException, RemoteException {
- try {
- Version version = getVersionByUUID(versionUUID);
- return versionHistory.getVersionLabels(version);
- } catch (ClassCastException cce) {
- // we do not expect this here as nodes should be returned correctly
- throw getRepositoryException(new RepositoryException(cce));
- } catch (RepositoryException ex) {
- throw getRepositoryException(ex);
- }
- }
-
- /** {@inheritDoc} */
- public void removeVersion(String versionName)
- throws RepositoryException, RemoteException {
- try {
- versionHistory.removeVersion(versionName);
- } catch (RepositoryException ex) {
- throw getRepositoryException(ex);
- }
- }
-}
diff --git a/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/ServerWorkspace.java b/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/ServerWorkspace.java
deleted file mode 100644
index 0aabda47186..00000000000
--- a/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/ServerWorkspace.java
+++ /dev/null
@@ -1,160 +0,0 @@
-/*
- * Copyright 2004-2005 The Apache Software Foundation or its licensors,
- * as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.jackrabbit.rmi.server;
-
-import java.io.ByteArrayInputStream;
-import java.io.IOException;
-import java.rmi.RemoteException;
-
-import javax.jcr.NamespaceRegistry;
-import javax.jcr.RepositoryException;
-import javax.jcr.Workspace;
-import javax.jcr.nodetype.NodeTypeManager;
-import javax.jcr.query.QueryManager;
-
-import org.apache.jackrabbit.rmi.remote.RemoteNamespaceRegistry;
-import org.apache.jackrabbit.rmi.remote.RemoteNodeTypeManager;
-import org.apache.jackrabbit.rmi.remote.RemoteQueryManager;
-import org.apache.jackrabbit.rmi.remote.RemoteWorkspace;
-
-/**
- * Remote adapter for the JCR {@link Workspace Workspace} interface.
- * This class makes a local workspace available as an RMI service using the
- * {@link RemoteWorkspace RemoteWorkspace} interface.
- *
- * @see Workspace
- * @see RemoteWorkspace
- */
-public class ServerWorkspace extends ServerObject implements RemoteWorkspace {
-
- /** The adapted local workspace. */
- private Workspace workspace;
-
- /**
- * Creates a remote adapter for the given local workspace.
- *
- * @param workspace local workspace
- * @param factory remote adapter factory
- * @throws RemoteException on RMI errors
- */
- public ServerWorkspace(Workspace workspace, RemoteAdapterFactory factory)
- throws RemoteException {
- super(factory);
- this.workspace = workspace;
- }
-
- /** {@inheritDoc} */
- public String getName() throws RemoteException {
- return workspace.getName();
- }
-
- /** {@inheritDoc} */
- public void copy(String from, String to)
- throws RepositoryException, RemoteException {
- try {
- workspace.copy(from, to);
- } catch (RepositoryException ex) {
- throw getRepositoryException(ex);
- }
- }
-
- /** {@inheritDoc} */
- public void copy(String from, String to, String workspace)
- throws RepositoryException, RemoteException {
- try {
- this.workspace.copy(from, to, workspace);
- } catch (RepositoryException ex) {
- throw getRepositoryException(ex);
- }
- }
-
- /** {@inheritDoc} */
- public void clone(
- String workspace, String from, String to, boolean removeExisting)
- throws RepositoryException, RemoteException {
- try {
- this.workspace.clone(workspace, from, to, removeExisting);
- } catch (RepositoryException ex) {
- throw getRepositoryException(ex);
- }
- }
-
- /** {@inheritDoc} */
- public void move(String from, String to)
- throws RepositoryException, RemoteException {
- try {
- workspace.move(from, to);
- } catch (RepositoryException ex) {
- throw getRepositoryException(ex);
- }
- }
-
- /** {@inheritDoc} */
- public RemoteNodeTypeManager getNodeTypeManager()
- throws RepositoryException, RemoteException {
- try {
- NodeTypeManager manager = workspace.getNodeTypeManager();
- return getFactory().getRemoteNodeTypeManager(manager);
- } catch (RepositoryException ex) {
- throw getRepositoryException(ex);
- }
- }
-
- /** {@inheritDoc} */
- public RemoteNamespaceRegistry getNamespaceRegistry()
- throws RepositoryException, RemoteException {
- try {
- NamespaceRegistry registry = workspace.getNamespaceRegistry();
- return getFactory().getRemoteNamespaceRegistry(registry);
- } catch (RepositoryException ex) {
- throw getRepositoryException(ex);
- }
- }
-
- /** {@inheritDoc} */
- public RemoteQueryManager getQueryManager()
- throws RepositoryException, RemoteException {
- try {
- QueryManager queryManager = workspace.getQueryManager();
- return getFactory().getRemoteQueryManager(queryManager);
- } catch (RepositoryException ex) {
- throw getRepositoryException(ex);
- }
- }
-
- /** {@inheritDoc} */
- public String[] getAccessibleWorkspaceNames()
- throws RepositoryException, RemoteException {
- try {
- return workspace.getAccessibleWorkspaceNames();
- } catch (RepositoryException ex) {
- throw getRepositoryException(ex);
- }
- }
-
- /** {@inheritDoc} */
- public void importXML(String path, byte[] xml, int uuidBehaviour)
- throws IOException, RepositoryException, RemoteException {
- try {
- workspace.importXML(
- path, new ByteArrayInputStream(xml), uuidBehaviour);
- } catch (RepositoryException ex) {
- throw getRepositoryException(ex);
- }
- }
-
-}
diff --git a/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/package.html b/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/package.html
deleted file mode 100644
index 9244e3fd966..00000000000
--- a/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/package.html
+++ /dev/null
@@ -1,64 +0,0 @@
-Setting up a JCR-RMI server
-
- Repository repository = ...; // The local repository
- String name = ...; // The RMI URL for the repository
-
- RemoteAdapterFactory factory = new ServerAdapterFactory();
- RemoteRepository remote = factory.getRemoteRepository(repository);
- Naming.bind(name, remote); // Make the RMI binding using java.rmi.Naming
-
-
-Extending the JCR-RMI server
-
- Repository repository = ...; // The local repository
- String name = ...; // The RMI URL for the repository
-
- RemoteAdapterFactory factory = new ServerAdapterFactory() {
- public RemoteSession getRemoteSession(Session session)
- throws RemoteException {
- System.out.println("LOGIN: " + session.getUserId());
- return new ServerSession(session, this) {
- public void logout() {
- System.out.println("LOGOUT: " + session.getUserId());
- super.logout();
- }
- };
- }
- };
-
- RemoteRepository remote = factory.getRemoteRepository(repository);
- Naming.bind(name, remote); // Make the RMI binding using java.rmi.Naming
-
-
-
\ No newline at end of file
diff --git a/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/xml/ImportContentHandler.java b/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/xml/ImportContentHandler.java
deleted file mode 100644
index ef620f94e91..00000000000
--- a/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/xml/ImportContentHandler.java
+++ /dev/null
@@ -1,133 +0,0 @@
-/*
- * Copyright 2004-2005 The Apache Software Foundation or its licensors,
- * as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.jackrabbit.rmi.xml;
-
-import java.io.ByteArrayOutputStream;
-
-import org.apache.xml.serialize.OutputFormat;
-import org.apache.xml.serialize.XMLSerializer;
-import org.xml.sax.Attributes;
-import org.xml.sax.ContentHandler;
-import org.xml.sax.Locator;
-import org.xml.sax.SAXException;
-
-/**
- * Base class for a SAX content handler for importing XML data. This
- * class provides a general mechanism for converting a SAX event stream
- * to raw XML data and feeding the received byte array into an import
- * method. Subclasses can provide different import mechanisms simply by
- * implementing the abstract {@link #importXML(byte[]) importXML(byte[])}
- * method.
- *
- * @author Jukka Zitting
- */
-public abstract class ImportContentHandler implements ContentHandler {
-
- /** Internal buffer for the XML byte stream. */
- private ByteArrayOutputStream buffer;
-
- /** The internal XML serializer. */
- private ContentHandler handler;
-
- /**
- * Creates a SAX content handler for importing XML data.
- */
- public ImportContentHandler() {
- this.buffer = new ByteArrayOutputStream();
- this.handler = new XMLSerializer(buffer, new OutputFormat());
- }
-
- /**
- * Imports the given XML data. This method is called by the
- * {@link #endDocument() endDocument()} method after the received
- * XML stream has been serialized.
- * null
or not of the required format, null
- * is returned.
- *
- * @param authHeader Authorization header as present in the Http request
- * @return credentials or null
.
- * @throws ServletException If an IOException occured while decoding the
- * Authorization header.
- * @see #getRepository()
- * @see #login(HttpServletRequest)
- */
- public static Credentials getCredentialsFromHeader(String authHeader)
- throws ServletException {
- try {
- if (authHeader != null) {
- String[] authStr = authHeader.split(" ");
- if (authStr.length >= 2 && authStr[0].equalsIgnoreCase(HttpServletRequest.BASIC_AUTH)) {
- ByteArrayOutputStream out = new ByteArrayOutputStream();
- Base64.decode(authStr[1].toCharArray(), out);
- String decAuthStr = out.toString("ISO-8859-1");
- int pos = decAuthStr.indexOf(':');
- String userid = decAuthStr.substring(0, pos);
- String passwd = decAuthStr.substring(pos + 1);
- return new SimpleCredentials(userid, passwd.toCharArray());
- }
- }
- return null;
- } catch (IOException e) {
- throw new ServletException("Unable to decode authorization: " + e.toString());
- }
- }
-
- /**
- * Simple login to the {@link Repository} accessed by this servlet using the
- * Authorization header present in the given request.
- * Please note, that no workspace information is provided to the repository
- * login ({@link Repository#login(javax.jcr.Credentials)}), thus the default
- * workspace will be selected. In order to provide a specific workspace name,
- * manual {@link Repository#login(Credentials, String) login} is required (see
- * also {@link #getRepository()}).
- *
- * @param request
- * @return Session object obtained upon {@link Repository#login(javax.jcr.Credentials)}.
- * @throws ServletException
- * @see #getRepository() in order to be able to login to a specific workspace.
- * @see #getCredentialsFromHeader(String) for a utility method to retrieve
- * credentials from the Authorization header string.
- */
- public static Session login(HttpServletRequest request) throws ServletException {
- String authHeader = request.getHeader(HEADER_AUTHORIZATION);
- try {
- return repository.login(getCredentialsFromHeader(authHeader));
- } catch (RepositoryException e) {
- throw new ServletException("Failed to login to the repository: " + e.toString());
- }
- }
-}
-
-/**
- * optional class for RMI, will only be used, if RMI client is present
- */
-abstract class ClientFactoryDelegater {
-
- public abstract Repository getRepository(String uri)
- throws RemoteException, MalformedURLException, NotBoundException;
-}
-
-/**
- * optional class for RMI, will only be used, if RMI server is present
- */
-class RMIClientFactoryDelegater extends ClientFactoryDelegater {
-
- // only used to enforce linking upon Class.forName()
- static String FactoryClassName = ClientRepositoryFactory.class.getName();
-
- public Repository getRepository(String uri)
- throws MalformedURLException, NotBoundException, RemoteException {
- System.setProperty("java.rmi.server.useCodebaseOnly", "true");
- return new ClientRepositoryFactory().getRepository(uri);
- }
-}
\ No newline at end of file
diff --git a/contrib/jcr-server/maven.xml b/contrib/jcr-server/maven.xml
deleted file mode 100644
index 11f77929899..00000000000
--- a/contrib/jcr-server/maven.xml
+++ /dev/null
@@ -1,41 +0,0 @@
-
-
-AbstractWebdavServlet
- *
- * todo respect Position header
- */
-abstract public class AbstractWebdavServlet extends HttpServlet implements DavConstants {
-
- /** default logger */
- private static Logger log = Logger.getLogger(AbstractWebdavServlet.class);
-
- /**
- * Create a new DavResource
- *
- * @param locator
- * @param request
- * @param response
- * @return resource for the given locator
- * @throws DavException
- */
- abstract protected DavResource createResource(DavResourceLocator locator,
- WebdavRequest request,
- WebdavResponse response) throws DavException;
-
- /**
- * The OPTION method
- *
- * @param request
- * @param response
- * @param resource
- */
- protected void doOptions(WebdavRequest request, WebdavResponse response,
- DavResource resource) throws IOException {
- response.addHeader(DavConstants.HEADER_DAV, resource.getComplianceClass());
- response.addHeader("Allow", resource.getSupportedMethods());
- response.addHeader("MS-Author-Via", DavConstants.HEADER_DAV);
- if (resource instanceof SearchResource) {
- String[] langs = ((SearchResource)resource).getQueryGrammerSet().getQueryLanguages();
- for (int i = 0; i < langs.length; i++) {
- response.addHeader(SearchConstants.HEADER_DASL, "<" + langs[i] + ">");
- }
- }
- // with DeltaV the OPTIONS request may contain a Xml body.
- OptionsResponse oR = null;
- OptionsInfo oInfo = request.getOptionsInfo();
- if (oInfo != null && resource instanceof DeltaVResource) {
- oR = ((DeltaVResource)resource).getOptionResponse(oInfo);
- }
- if (oR == null) {
- response.setStatus(DavServletResponse.SC_OK);
- } else {
- response.sendXmlResponse(oR.toXml(), DavServletResponse.SC_OK);
- }
- }
-
- /**
- * The HEAD method
- *
- * @param request
- * @param response
- * @param resource
- * @throws java.io.IOException
- */
- protected void doHead(WebdavRequest request, WebdavResponse response,
- DavResource resource) throws IOException {
- spoolResource(request, response, resource, false);
- }
-
- /**
- * The GET method
- *
- * @param request
- * @param response
- * @param resource
- * @throws IOException
- */
- protected void doGet(WebdavRequest request, WebdavResponse response,
- DavResource resource) throws IOException {
- spoolResource(request, response, resource, true);
- }
-
- /**
- * @param request
- * @param response
- * @param resource
- * @param sendContent
- * @throws IOException
- */
- private void spoolResource(WebdavRequest request, WebdavResponse response,
- DavResource resource, boolean sendContent)
- throws IOException {
-
- if (!resource.exists()) {
- response.sendError(HttpServletResponse.SC_NOT_FOUND);
- return;
- }
-
- long modTime = resource.getModificationTime();
- if (modTime != DavResource.UNDEFINED_MODIFICATIONTIME && modTime <= request.getDateHeader("If-Modified-Since")) {
- // resource has not been modified since the time indicated in the
- // 'If-Modified-Since' header.
- response.setStatus(HttpServletResponse.SC_NOT_MODIFIED);
- return;
- }
-
- DavProperty lastMod = resource.getProperty(DavPropertyName.GETLASTMODIFIED);
- if (lastMod != null) {
- response.setHeader("Last-Modified", String.valueOf(lastMod.getValue()));
- }
-
- DavProperty etag = resource.getProperty(DavPropertyName.GETETAG);
- if (etag != null) {
- response.setHeader("ETag", String.valueOf(etag.getValue()));
- }
-
- DavProperty contentType = resource.getProperty(DavPropertyName.GETCONTENTTYPE);
- if (contentType != null) {
- response.setHeader("Content-Type", String.valueOf(contentType.getValue()));
- }
-
- DavProperty contentLength = resource.getProperty(DavPropertyName.GETCONTENTLENGTH);
- if (contentLength != null) {
- try {
- int length = Integer.parseInt(contentLength.getValue()+"");
- if (length > 0) {
- response.setIntHeader("Content-Length", length);
- }
- } catch (NumberFormatException e) {
- log.error("Could not build content length from property value '" + contentLength.getValue() + "'");
- }
- }
-
- // spool content in case of 'GET' request
- if (sendContent) {
- InputStream in = resource.getStream();
- if (in != null) {
- OutputStream out = response.getOutputStream();
- byte[] buffer = new byte[8192];
- int read;
- while ((read = in.read(buffer)) >= 0 ) {
- out.write(buffer, 0, read);
- }
- in.close();
- }
- }
- response.flushBuffer();
- }
-
- /**
- * The PROPFIND method
- *
- * @param request
- * @param response
- * @param resource
- * @throws IOException
- */
- protected void doPropFind(WebdavRequest request, WebdavResponse response,
- DavResource resource) throws IOException {
-
- if (!resource.exists()) {
- response.sendError(DavServletResponse.SC_NOT_FOUND);
- return;
- }
-
- int depth = request.getDepth(DEPTH_INFINITY);
- DavPropertyNameSet requestProperties = request.getPropFindProperties();
- int propfindType = request.getPropFindType();
-
- MultiStatus mstatus = new MultiStatus();
- mstatus.addResourceProperties(resource, requestProperties, propfindType, depth);
- response.sendMultiStatusResponse(mstatus);
- }
-
- /**
- * The PROPPATCH method
- *
- * @param request
- * @param response
- * @param resource
- * @throws IOException
- */
- protected void doPropPatch(WebdavRequest request, WebdavResponse response,
- DavResource resource)
- throws IOException, DavException {
-
- DavPropertySet setProperties = request.getPropPatchSetProperties();
- DavPropertyNameSet removeProperties = request.getPropPatchRemoveProperties();
- if (setProperties.isEmpty() && removeProperties.isEmpty()) {
- response.sendError(DavServletResponse.SC_BAD_REQUEST);
- return;
- }
-
- // first resolve merge conflicts
- // TODO: not correct resolution of merge conflicts are immediately perstisted
- // TODO: rfc 2518 requires, that no changes must only be persisted if the complete proppatch-req succeeds
- if (resource instanceof VersionControlledResource) {
- ((VersionControlledResource)resource).resolveMergeConflict(setProperties, removeProperties);
- }
-
- // complete any other property setting or removing
- DavPropertyIterator setIter = setProperties.iterator();
- while (setIter.hasNext()) {
- DavProperty prop = setIter.nextProperty();
- resource.setProperty(prop);
- }
- Iterator remNameIter = removeProperties.iterator();
- while (remNameIter.hasNext()) {
- DavPropertyName propName = (DavPropertyName) remNameIter.next();
- resource.removeProperty(propName);
- }
- response.setStatus(DavServletResponse.SC_OK);
-
- // todo return multistatus response in case of failure
- }
-
- /**
- * The PUT method
- *
- * @param request
- * @param response
- * @param resource
- * @throws IOException
- * @throws DavException
- */
- protected void doPut(WebdavRequest request, WebdavResponse response,
- DavResource resource) throws IOException, DavException {
-
- DavResource parentResource = resource.getCollection();
- if (parentResource == null || !parentResource.exists()) {
- // parent does not exist
- response.sendError(DavServletResponse.SC_CONFLICT);
- return;
- }
-
- int status;
- // test if resource already exists
- if (resource.exists()){
- status = DavServletResponse.SC_NO_CONTENT;
- } else {
- status = DavServletResponse.SC_CREATED;
- }
-
- parentResource.addMember(resource, request.getInputStream());
- response.setStatus(status);
- }
-
- /**
- * The MKCOL method
- *
- * @param request
- * @param response
- * @param resource
- * @throws IOException
- * @throws DavException
- */
- protected void doMkCol(WebdavRequest request, WebdavResponse response,
- DavResource resource) throws IOException, DavException {
-
- DavResource parentResource = resource.getCollection();
- if (parentResource == null || !parentResource.exists() || !parentResource.isCollection()) {
- // parent does not exist or is not a collection
- response.sendError(DavServletResponse.SC_CONFLICT);
- return;
- }
-
- if (request.getContentLength() > 0 || request.getHeader("Transfer-Encoding") != null) {
- parentResource.addMember(resource, request.getInputStream());
- } else {
- parentResource.addMember(resource);
- }
- response.setStatus(DavServletResponse.SC_CREATED);
- }
-
- /**
- * The DELETE method
- *
- * @param request
- * @param response
- * @param resource
- * @throws IOException
- * @throws DavException
- */
- protected void doDelete(WebdavRequest request, WebdavResponse response,
- DavResource resource) throws IOException, DavException {
- DavResource parent = resource.getCollection();
- if (parent != null) {
- parent.removeMember(resource);
- response.setStatus(DavServletResponse.SC_NO_CONTENT);
- } else {
- response.sendError(DavServletResponse.SC_FORBIDDEN, "Cannot remove the root resource.");
- }
- }
-
- /**
- * The COPY method
- *
- * @param request
- * @param response
- * @param resource
- * @throws IOException
- * @throws DavException
- */
- protected void doCopy(WebdavRequest request, WebdavResponse response,
- DavResource resource) throws IOException, DavException {
-
- // only depth 0 and infinity is allowed
- int depth = request.getDepth(DEPTH_INFINITY);
- if (!(depth == DEPTH_0 || depth == DEPTH_INFINITY)) {
- response.sendError(DavServletResponse.SC_BAD_REQUEST);
- return;
- }
-
- DavResource destResource = createResource(request.getDestinationLocator(), request, response);
- int status = validateDestination(destResource, request);
- if (status > DavServletResponse.SC_NO_CONTENT) {
- response.sendError(status);
- return;
- }
-
- resource.copy(destResource, depth == DEPTH_0);
- response.setStatus(status);
- }
-
- /**
- * The MOVE method
- *
- * @param request
- * @param response
- * @param resource
- * @throws IOException
- * @throws DavException
- */
- protected void doMove(WebdavRequest request, WebdavResponse response,
- DavResource resource) throws IOException, DavException {
-
- DavResource destResource = createResource(request.getDestinationLocator(), request, response);
- int status = validateDestination(destResource, request);
- if (status > DavServletResponse.SC_NO_CONTENT) {
- response.sendError(status);
- return;
- }
-
- resource.move(destResource);
- response.setStatus(status);
- }
-
- /**
- * Validate the given destination resource and return the proper status
- * code: Any return value greater/equal than {@link DavServletResponse#SC_NO_CONTENT}
- * indicates an error.
- *
- * @param destResource destination resource to be validated.
- * @param request
- * @return status code indicating whether the destination is valid.
- */
- private int validateDestination(DavResource destResource, WebdavRequest request) {
-
- String destHeader = request.getHeader(HEADER_DESTINATION);
- if (destHeader == null || "".equals(destHeader)){
- return DavServletResponse.SC_BAD_REQUEST;
- }
- if (destResource.getLocator().equals(request.getRequestLocator())) {
- return DavServletResponse.SC_FORBIDDEN;
- }
-
- int status;
- if (destResource.exists()) {
- if (request.isOverwrite()) {
- // matching if-header required for existing resources
- if (!request.matchesIfHeader(destResource)) {
- return DavServletResponse.SC_PRECONDITION_FAILED;
- } else {
- // overwrite existing resource: its up to the webdavresource
- // object to deal with any delete prior to the copy/move
- status = DavServletResponse.SC_NO_CONTENT;
- }
- } else {
- // cannot copy/move to an existing item, if overwrite is not forced
- return DavServletResponse.SC_PRECONDITION_FAILED;
- }
- } else {
- // destination does not exist >> copy/move can be performed
- status = DavServletResponse.SC_CREATED;
- }
- return status;
- }
-
- /**
- * The LOCK method
- *
- * @param request
- * @param response
- * @param resource
- * @throws IOException
- * @throws DavException
- */
- protected void doLock(WebdavRequest request, WebdavResponse response,
- DavResource resource) throws IOException, DavException {
-
- LockInfo lockInfo = request.getLockInfo();
- if (lockInfo.isRefreshLock()) {
- // refresh any matching existing locks
- ActiveLock[] activeLocks = resource.getLocks();
- List lList = new ArrayList();
- for (int i = 0; i < activeLocks.length; i++) {
- if (request.matchesIfHeader(resource.getHref(), activeLocks[i].getToken(), "")) {
- lList.add(resource.refreshLock(lockInfo, activeLocks[i].getToken()));
- }
- }
- if (lList.isEmpty()) {
- throw new DavException(DavServletResponse.SC_PRECONDITION_FAILED);
- }
- ActiveLock[] refreshedLocks = (ActiveLock[]) lList.toArray(new ActiveLock[lList.size()]);
- response.sendRefreshLockResponse(refreshedLocks);
- } else {
- // create a new lock
- ActiveLock lock = resource.lock(lockInfo);
- response.sendLockResponse(lock);
- }
-
- // TODO multistatus in case of failure...
- // NOTE: spec says 409 status, but example says 207 (multistatus)
- }
-
- /**
- * The UNLOCK method
- *
- * @param request
- * @param response
- * @param resource
- * @throws DavException
- */
- protected void doUnlock(WebdavRequest request, WebdavResponse response,
- DavResource resource) throws DavException {
- // get lock token from header
- String lockToken = request.getLockToken();
- TransactionInfo tInfo = request.getTransactionInfo();
- if (tInfo != null) {
- ((TransactionResource)resource).unlock(lockToken, tInfo);
- } else {
- resource.unlock(lockToken);
- }
- response.setStatus(DavServletResponse.SC_NO_CONTENT);
- }
-
- /**
- * The ORDERPATCH method
- *
- * @param request
- * @param response
- * @param resource
- * @throws java.io.IOException
- * @throws DavException
- */
- protected void doOrderPatch(WebdavRequest request,
- WebdavResponse response,
- DavResource resource)
- throws IOException, DavException {
-
- if (!(resource instanceof OrderingResource)) {
- response.sendError(DavServletResponse.SC_METHOD_NOT_ALLOWED);
- return;
- }
-
- OrderPatch op = request.getOrderPatch();
- if (op == null) {
- response.sendError(DavServletResponse.SC_BAD_REQUEST);
- return;
- }
- // perform reordering of internal members
- ((OrderingResource)resource).orderMembers(op);
- response.setStatus(DavServletResponse.SC_OK);
-
- //TODO: in case of failure Multistatus is required...
- }
-
- /**
- * The SUBSCRIBE method
- *
- * @param request
- * @param response
- * @param resource
- * @throws IOException
- * @throws DavException
- */
- protected void doSubscribe(WebdavRequest request,
- WebdavResponse response,
- DavResource resource)
- throws IOException, DavException {
-
- if (!(resource instanceof ObservationResource)) {
- response.sendError(DavServletResponse.SC_METHOD_NOT_ALLOWED);
- return;
- }
-
- SubscriptionInfo info = request.getSubscriptionInfo();
- if (info == null) {
- response.sendError(DavServletResponse.SC_UNSUPPORTED_MEDIA_TYPE);
- return;
- }
- Subscription subs = ((ObservationResource)resource).subscribe(info, request.getSubscriptionId());
- response.sendSubscriptionResponse(subs);
- }
-
- /**
- * The UNSUBSCRIBE method
- *
- * @param request
- * @param response
- * @param resource
- * @throws IOException
- * @throws DavException
- */
- protected void doUnsubscribe(WebdavRequest request,
- WebdavResponse response,
- DavResource resource)
- throws IOException, DavException {
-
- if (!(resource instanceof ObservationResource)) {
- response.sendError(DavServletResponse.SC_METHOD_NOT_ALLOWED);
- return;
- }
- ((ObservationResource)resource).unsubscribe(request.getSubscriptionId());
- response.setStatus(DavServletResponse.SC_NO_CONTENT);
- }
-
- /**
- * The POLL method
- *
- * @param request
- * @param response
- * @param resource
- * @throws IOException
- * @throws DavException
- */
- protected void doPoll(WebdavRequest request,
- WebdavResponse response,
- DavResource resource)
- throws IOException, DavException {
-
- if (!(resource instanceof ObservationResource)) {
- response.sendError(DavServletResponse.SC_METHOD_NOT_ALLOWED);
- return;
- }
- EventDiscovery ed = ((ObservationResource)resource).poll(request.getSubscriptionId());
- response.sendPollResponse(ed);
- }
-
- /**
- * The VERSION-CONTROL method
- *
- * @param request
- * @param response
- * @param resource
- * @throws DavException
- * @throws IOException
- */
- protected void doVersionControl(WebdavRequest request, WebdavResponse response,
- DavResource resource)
- throws DavException, IOException {
- if (!(resource instanceof VersionableResource)) {
- response.sendError(DavServletResponse.SC_METHOD_NOT_ALLOWED);
- return;
- }
- ((VersionableResource)resource).addVersionControl();
- }
-
- /**
- * The LABEL method
- *
- * @param request
- * @param response
- * @param resource
- * @throws DavException
- * @throws IOException
- */
- protected void doLabel(WebdavRequest request, WebdavResponse response,
- DavResource resource)
- throws DavException, IOException {
-
- LabelInfo labelInfo = request.getLabelInfo();
- if (resource instanceof VersionResource) {
- ((VersionResource)resource).label(labelInfo);
- } else if (resource instanceof VersionControlledResource) {
- ((VersionControlledResource)resource).label(labelInfo);
- } else {
- // any other resource type that does not support a LABEL request
- response.sendError(DavServletResponse.SC_METHOD_NOT_ALLOWED);
- }
- }
-
- /**
- * The REPORT method
- *
- * @param request
- * @param response
- * @param resource
- * @throws DavException
- * @throws IOException
- */
- protected void doReport(WebdavRequest request, WebdavResponse response,
- DavResource resource)
- throws DavException, IOException {
- if (!(resource instanceof DeltaVResource)) {
- response.sendError(DavServletResponse.SC_METHOD_NOT_ALLOWED);
- return;
- }
- ReportInfo info = request.getReportInfo();
- Report report = ((DeltaVResource)resource).getReport(info);
- response.sendXmlResponse(report.toXml(), DavServletResponse.SC_OK);
- }
-
- /**
- * The CHECKIN method
- *
- * @param request
- * @param response
- * @param resource
- * @throws DavException
- * @throws IOException
- */
- protected void doCheckin(WebdavRequest request, WebdavResponse response,
- DavResource resource)
- throws DavException, IOException {
-
- if (!(resource instanceof VersionControlledResource)) {
- response.sendError(DavServletResponse.SC_METHOD_NOT_ALLOWED);
- return;
- }
- String versionHref = ((VersionControlledResource)resource).checkin();
- response.setHeader(DeltaVConstants.HEADER_LOCATION, versionHref);
- }
-
- /**
- * The CHECKOUT method
- *
- * @param request
- * @param response
- * @param resource
- * @throws DavException
- * @throws IOException
- */
- protected void doCheckout(WebdavRequest request, WebdavResponse response,
- DavResource resource)
- throws DavException, IOException {
- if (!(resource instanceof VersionControlledResource)) {
- response.sendError(DavServletResponse.SC_METHOD_NOT_ALLOWED);
- return;
- }
- ((VersionControlledResource)resource).checkout();
- }
-
- /**
- * The UNCHECKOUT method
- *
- * @param request
- * @param response
- * @param resource
- * @throws DavException
- * @throws IOException
- */
- protected void doUncheckout(WebdavRequest request, WebdavResponse response,
- DavResource resource)
- throws DavException, IOException {
- if (!(resource instanceof VersionControlledResource)) {
- response.sendError(DavServletResponse.SC_METHOD_NOT_ALLOWED);
- return;
- }
- ((VersionControlledResource)resource).uncheckout();
- }
-
- /**
- * The MERGE method
- *
- * @param request
- * @param response
- * @param resource
- * @throws DavException
- * @throws IOException
- */
- protected void doMerge(WebdavRequest request, WebdavResponse response,
- DavResource resource) throws DavException, IOException {
-
- if (!(resource instanceof VersionControlledResource)) {
- response.sendError(DavServletResponse.SC_METHOD_NOT_ALLOWED);
- return;
- }
- MergeInfo info = request.getMergeInfo();
- MultiStatus ms = ((VersionControlledResource)resource).merge(info);
- response.sendMultiStatusResponse(ms);
- }
-
- /**
- * The UPDATE method
- *
- * @param request
- * @param response
- * @param resource
- * @throws DavException
- * @throws IOException
- */
- protected void doUpdate(WebdavRequest request, WebdavResponse response,
- DavResource resource) throws DavException, IOException {
-
- if (!(resource instanceof VersionControlledResource)) {
- response.sendError(DavServletResponse.SC_METHOD_NOT_ALLOWED);
- return;
- }
- UpdateInfo info = request.getUpdateInfo();
- MultiStatus ms = ((VersionControlledResource)resource).update(info);
- response.sendMultiStatusResponse(ms);
- }
-
- /**
- * The MKWORKSPACE method
- *
- * @param request
- * @param response
- * @param resource
- * @throws DavException
- * @throws IOException
- */
- protected void doMkWorkspace(WebdavRequest request, WebdavResponse response,
- DavResource resource) throws DavException, IOException {
- if (resource.exists()) {
- log.warn("Cannot create a new workspace. Resource already exists.");
- response.sendError(DavServletResponse.SC_FORBIDDEN);
- return;
- }
-
- DavResource parentResource = resource.getCollection();
- if (parentResource == null || !parentResource.exists() || !parentResource.isCollection()) {
- // parent does not exist or is not a collection
- response.sendError(DavServletResponse.SC_CONFLICT);
- return;
- }
- if (!(parentResource instanceof DeltaVResource)) {
- response.sendError(DavServletResponse.SC_METHOD_NOT_ALLOWED);
- return;
- }
- ((DeltaVResource)parentResource).addWorkspace(resource);
- response.setStatus(DavServletResponse.SC_CREATED);
- }
-
- /**
- * The SEARCH method
- *
- * @param request
- * @param response
- * @param resource
- * @throws DavException
- * @throws IOException
- */
- protected void doSearch(WebdavRequest request, WebdavResponse response,
- DavResource resource) throws DavException, IOException {
-
- if (!(resource instanceof SearchResource)) {
- response.sendError(DavServletResponse.SC_METHOD_NOT_ALLOWED);
- return;
- }
- try {
- Document doc = request.getRequestDocument();
- if (doc != null) {
- SearchRequest sR = new SearchRequest(doc);
- response.sendMultiStatusResponse(((SearchResource)resource).search(sR));
- } else {
- // request without request body is valid if requested resource
- // is a 'query' resource.
- response.sendMultiStatusResponse(((SearchResource)resource).search(null));
- }
- } catch (IllegalArgumentException e) {
- response.sendError(DavServletResponse.SC_BAD_REQUEST);
- return;
- }
- }
-}
\ No newline at end of file
diff --git a/contrib/jcr-server/server/src/java/org/apache/jackrabbit/server/JCRWebdavServer.java b/contrib/jcr-server/server/src/java/org/apache/jackrabbit/server/JCRWebdavServer.java
deleted file mode 100644
index 438e3134a19..00000000000
--- a/contrib/jcr-server/server/src/java/org/apache/jackrabbit/server/JCRWebdavServer.java
+++ /dev/null
@@ -1,296 +0,0 @@
-/*
- * 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.server;
-
-import org.apache.log4j.Logger;
-import org.apache.jackrabbit.webdav.*;
-import org.apache.jackrabbit.webdav.spi.JcrDavException;
-import org.apache.jackrabbit.client.RepositoryAccessServlet;
-
-import javax.jcr.*;
-import javax.servlet.ServletException;
-import java.util.HashMap;
-import java.util.HashSet;
-/**
- * JCRWebdavServer
...
- */
-public class JCRWebdavServer implements DavSessionProvider {
-
- /** the default logger */
- private static Logger log = Logger.getLogger(JCRWebdavServer.class);
-
- /** the session cache */
- private final SessionCache cache = new SessionCache();
-
- /** the jcr repository */
- private final Repository repository;
-
- /**
- * Creates a new JCRWebdavServer that operates on the given repository.
- *
- * @param repository
- */
- public JCRWebdavServer(Repository repository) {
- this.repository = repository;
- }
-
- //---------------------------------------< DavSessionProvider interface >---
- /**
- * Acquires a DavSession either from the session cache or creates a new
- * one by login to the repository.
- * Upon success, the WebdavRequest will reference that session.
- *
- * @param request
- * @throws DavException if no session could be obtained.
- * @see DavSessionProvider#acquireSession(org.apache.jackrabbit.webdav.WebdavRequest)
- */
- public void acquireSession(WebdavRequest request)
- throws DavException {
- DavSession session = cache.get(request);
- request.setDavSession(session);
- }
-
- /**
- * Releases the reference from the request to the session. If no further
- * references to the session exist, the session will be removed from the
- * cache.
- *
- * @param request
- * @see DavSessionProvider#releaseSession(org.apache.jackrabbit.webdav.WebdavRequest)
- */
- public void releaseSession(WebdavRequest request) {
- DavSession session = request.getDavSession();
- if (session != null) {
- session.removeReference(request);
- }
- // remove the session from the request
- request.setDavSession(null);
- }
-
- //--------------------------------------------------------------------------
- /**
- * Private inner class implementing the DavSession
interface.
- */
- private class DavSessionImpl implements DavSession {
-
- /** the underlaying jcr session */
- private final Session session;
-
- /**
- * Private constructor.
- *
- * @param request
- * @throws DavException in case a {@link javax.jcr.LoginException} or {@link javax.jcr.RepositoryException} occurs.
- */
- private DavSessionImpl(DavServletRequest request) throws DavException {
- try {
- String workspaceName = request.getRequestLocator().getWorkspaceName();
- Credentials creds = RepositoryAccessServlet.getCredentialsFromHeader(request.getHeader(DavConstants.HEADER_AUTHORIZATION));
- session = repository.login(creds, workspaceName);
- } catch (RepositoryException e) {
- // LoginException, RepositoryException both result in FORBIDDEN
- throw new JcrDavException(e);
- } catch (ServletException e) {
- throw new DavException(DavServletResponse.SC_INTERNAL_SERVER_ERROR, e.getMessage());
- }
- }
-
- /**
- * Add a reference to this DavSession
.
- *
- * @see DavSession#addReference(Object)
- */
- public void addReference(Object reference) {
- cache.addReference(this, reference);
- }
-
- /**
- * Removes the reference from this DavSession
. If no
- * more references are present, this DavSession
is removed
- * from the internal cache and the underlaying session is released by calling
- * {@link javax.jcr.Session#logout()}.
- *
- * @see DavSession#removeReference(Object)
- */
- public void removeReference(Object reference) {
- cache.removeReference(this, reference);
- }
-
- /**
- * @see DavSession#getRepositorySession()
- */
- public Session getRepositorySession() {
- return session;
- }
-
- /**
- * @see DavSession#addLockToken(String)
- */
- public void addLockToken(String token) {
- session.addLockToken(token);
- }
-
- /**
- * @see DavSession#getLockTokens()
- */
- public String[] getLockTokens() {
- return session.getLockTokens();
- }
-
- /**
- * @see DavSession#removeLockToken(String)
- */
- public void removeLockToken(String token) {
- session.removeLockToken(token);
- }
- }
-
- /**
- * Private inner class providing a cache for referenced session objects.
- */
- private class SessionCache {
-
- private SessionMap sessionMap = new SessionMap();
- private HashMap referenceToSessionMap = new HashMap();
-
- /**
- * Try to retrieve DavSession
if a TransactionId or
- * SubscriptionId is present in the request header. If no cached session
- * was found null
is returned.
- *
- * @param request
- * @return a cached DavSession
or null
.
- * @throws DavException
- */
- private DavSession get(WebdavRequest request)
- throws DavException {
- String txId = request.getTransactionId();
- String subscriptionId = request.getSubscriptionId();
- String lockToken = request.getLockToken();
-
- if ((lockToken != null || txId != null) && subscriptionId != null) {
- throw new DavException(DavServletResponse.SC_PRECONDITION_FAILED, "Ambiguous headers: either TransactionId/Lock-Token or SubscriptionId can be present, not both.");
- }
-
- DavSession session = null;
- // try to retrieve a cached session
- if (lockToken != null && containsReference(lockToken)) {
- session = getSessionByReference(lockToken);
- } else if (txId != null && containsReference(txId)) {
- session = getSessionByReference(txId);
- } else if (subscriptionId != null && containsReference(subscriptionId)) {
- session = getSessionByReference(subscriptionId);
- }
- // no cached session present -> create new one.
- if (session == null) {
- session = new DavSessionImpl(request);
- sessionMap.put(session, new HashSet());
- log.info("login: User '" + session.getRepositorySession().getUserId() + "' logged in.");
- } else {
- log.info("login: Retrieved cached session for user '" + session.getRepositorySession().getUserId() + "'");
- }
- addReference(session, request);
- return session;
- }
-
- /**
- * Add a references to the specified DavSession
.
- *
- * @param session
- * @param reference
- */
- private void addReference(DavSession session, Object reference) {
- HashSet referenceSet = sessionMap.get(session);
- if (referenceSet != null) {
- referenceSet.add(reference);
- referenceToSessionMap.put(reference, session);
- } else {
- log.error("Failed to add reference to session. No entry in cache found.");
- }
- }
-
- /**
- * Remove the given reference from the specified DavSession
.
- *
- * @param session
- * @param reference
- */
- private void removeReference(DavSession session, Object reference) {
- HashSet referenceSet = sessionMap.get(session);
- if (referenceSet != null) {
- if (referenceSet.remove(reference)) {
- log.info("Removed reference " + reference + " to session " + session);
- referenceToSessionMap.remove(reference);
- } else {
- log.warn("Failed to remove reference " + reference + " to session " + session);
- }
- if (referenceSet.isEmpty()) {
- log.info("No more references present on webdav session -> clean up.");
- sessionMap.remove(session);
- log.info("Login: User '" + session.getRepositorySession().getUserId() + "' logged out");
- session.getRepositorySession().logout();
- } else {
- log.debug(referenceSet.size() + " references remaining on webdav session " + session);
- }
- } else {
- log.error("Failed to remove reference from session. No entry in cache found.");
- }
- }
-
- /**
- * Returns true, if there exists a DavSession
in the cache
- * that is referenced by the specified object.
- *
- * @param reference
- * @return true if a DavSession
is referenced by the given
- * object.
- */
- private boolean containsReference(Object reference) {
- return referenceToSessionMap.containsKey(reference);
- }
-
- /**
- * Returns the DavSession
that is referenced by the
- * specified reference object.
- *
- * @param reference
- * @return DavSession
that is referenced by this reference
- * object.
- * @see #containsReference(Object)
- */
- private DavSession getSessionByReference(Object reference) {
- return (DavSession) referenceToSessionMap.get(reference);
- }
- }
-
- /**
- * Simple inner class extending the {@link HashMap}.
- */
- private static class SessionMap extends HashMap {
-
- public HashSet get(DavSession key) {
- return (HashSet) super.get(key);
- }
-
- public HashSet put(DavSession key, HashSet value) {
- return (HashSet) super.put(key, value);
- }
-
- public HashSet remove(DavSession key) {
- return (HashSet) super.remove(key);
- }
- }
-}
\ No newline at end of file
diff --git a/contrib/jcr-server/server/src/java/org/apache/jackrabbit/server/JCRWebdavServerServlet.java b/contrib/jcr-server/server/src/java/org/apache/jackrabbit/server/JCRWebdavServerServlet.java
deleted file mode 100644
index deaf8dac469..00000000000
--- a/contrib/jcr-server/server/src/java/org/apache/jackrabbit/server/JCRWebdavServerServlet.java
+++ /dev/null
@@ -1,261 +0,0 @@
-/*
- * 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.server;
-
-import org.apache.log4j.Logger;
-import org.apache.jackrabbit.webdav.*;
-import org.apache.jackrabbit.webdav.WebdavRequestImpl;
-import org.apache.jackrabbit.webdav.observation.*;
-import org.apache.jackrabbit.webdav.spi.*;
-import org.apache.jackrabbit.webdav.spi.observation.SubscriptionManagerImpl;
-import org.apache.jackrabbit.webdav.spi.transaction.TxLockManagerImpl;
-import org.apache.jackrabbit.client.RepositoryAccessServlet;
-
-import javax.servlet.ServletException;
-import javax.servlet.http.*;
-import javax.jcr.Repository;
-import java.io.IOException;
-
-/**
- * JCRWebdavServerServlet provides request/response handling for the JCRWebdavServer.
- */
-public class JCRWebdavServerServlet extends AbstractWebdavServlet implements DavConstants {
-
- /** the default logger */
- private static Logger log = Logger.getLogger(JCRWebdavServerServlet.class);
-
- /** Init parameter specifying the prefix used with the resource path. */
- public static final String INIT_PARAM_PREFIX = "resource-path-prefix";
- private static String pathPrefix;
-
- private JCRWebdavServer server;
- private DavResourceFactory resourceFactory;
- private DavLocatorFactory locatorFactory;
- private TxLockManagerImpl txMgr;
- private SubscriptionManager subscriptionMgr;
-
- /**
- * Initializes the servlet set reads the following parameter from the
- * servlet configuration:
- *
- *
- *
- * @throws ServletException
- */
- public void init() throws ServletException {
- super.init();
-
- // set resource path prefix
- pathPrefix = getInitParameter(INIT_PARAM_PREFIX);
- log.debug(INIT_PARAM_PREFIX + " = " + pathPrefix);
-
- Repository repository = RepositoryAccessServlet.getRepository();
- if (repository == null) {
- throw new ServletException("Repository could not be retrieved. Check config of 'RepositoryServlet'.");
- }
- server = new JCRWebdavServer(repository);
- txMgr = new TxLockManagerImpl();
- subscriptionMgr = new SubscriptionManagerImpl();
-
- // todo: ev. make configurable
- resourceFactory = new DavResourceFactoryImpl(txMgr, subscriptionMgr);
- locatorFactory = new DavLocatorFactoryImpl(pathPrefix);
- }
-
- /**
- * Returns the path prefix
- *
- * @return pathPrefix
- * @see #INIT_PARAM_PREFIX
- */
- public static String getPathPrefix() {
- return pathPrefix;
- }
-
- /**
- * Service the request.
- *
- * @param request
- * @param response
- * @throws javax.servlet.ServletException
- * @throws java.io.IOException
- * @see HttpServlet#service(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
- */
- protected void service(HttpServletRequest request, HttpServletResponse response)
- throws ServletException, IOException {
-
- WebdavRequest webdavRequest = new WebdavRequestImpl(request, locatorFactory);
- WebdavResponse webdavResponse = new WebdavResponseImpl(response);
- try {
- // login to the server
- server.acquireSession(webdavRequest);
-
- // create the resource and perform initial precondition tests
- DavResource resource = createResource(webdavRequest.getRequestLocator(), webdavRequest, webdavResponse);
- if (preconditionFailed(webdavRequest, resource)) {
- webdavResponse.sendError(DavServletResponse.SC_PRECONDITION_FAILED);
- return;
- }
-
- // execute the requested method
- int methodCode = DavMethods.getMethodCode(webdavRequest.getMethod());
- execute(webdavRequest, webdavResponse, methodCode, resource);
- } catch (DavException e) {
- webdavResponse.sendErrorResponse(e);
- } finally {
- // logout
- server.releaseSession(webdavRequest);
- }
- }
-
- /**
- *
- * @param locator
- * @param request
- * @param response
- * @return
- */
- protected DavResource createResource(DavResourceLocator locator, WebdavRequest request,
- WebdavResponse response) throws DavException {
- return resourceFactory.createResource(locator, request, response);
- }
-
- /**
- *
- * @param request
- * @param resource
- * @return
- */
- private boolean preconditionFailed(WebdavRequest request, DavResource resource) {
- // first check matching If header
- if (!request.matchesIfHeader(resource)) {
- return true;
- }
-
- // test if the requested path matches to the existing session
- // this may occur if the session was retrieved from the cache.
- String wsName = request.getDavSession().getRepositorySession().getWorkspace().getName();
- boolean failed = !resource.getLocator().isSameWorkspace(wsName);
- if (!failed) {
- // make sure, the TransactionId header is valid
- String txId = request.getTransactionId();
- if (txId != null && !txMgr.hasLock(txId, resource)) {
- failed = true;
- }
- }
- return failed;
- }
-
- /**
- * @param request
- * @param response
- * @param method
- * @param resource
- * @throws ServletException
- * @throws IOException
- * @throws DavException
- */
- private void execute(WebdavRequest request, WebdavResponse response,
- int method, DavResource resource)
- throws ServletException, IOException, DavException {
-
- switch (method) {
- case DavMethods.DAV_GET:
- doGet(request, response, resource);
- break;
- case DavMethods.DAV_HEAD:
- doHead(request, response, resource);
- break;
- case DavMethods.DAV_PROPFIND:
- doPropFind(request, response, resource);
- break;
- case DavMethods.DAV_PROPPATCH:
- doPropPatch(request, response, resource);
- break;
- case DavMethods.DAV_POST:
- case DavMethods.DAV_PUT:
- doPut(request, response, resource);
- break;
- case DavMethods.DAV_DELETE:
- doDelete(request, response, resource);
- break;
- case DavMethods.DAV_COPY:
- doCopy(request, response, resource);
- break;
- case DavMethods.DAV_MOVE:
- doMove(request, response, resource);
- break;
- case DavMethods.DAV_MKCOL:
- doMkCol(request, response, resource);
- break;
- case DavMethods.DAV_OPTIONS:
- doOptions(request, response, resource);
- break;
- case DavMethods.DAV_LOCK:
- doLock(request, response, resource);
- break;
- case DavMethods.DAV_UNLOCK:
- doUnlock(request, response, resource);
- break;
- case DavMethods.DAV_ORDERPATCH:
- doOrderPatch(request, response, resource);
- break;
- case DavMethods.DAV_SUBSCRIBE:
- doSubscribe(request, response, resource);
- break;
- case DavMethods.DAV_UNSUBSCRIBE:
- doUnsubscribe(request, response, resource);
- break;
- case DavMethods.DAV_POLL:
- doPoll(request, response, resource);
- break;
- case DavMethods.DAV_SEARCH:
- doSearch(request, response, resource);
- break;
- case DavMethods.DAV_VERSION_CONTROL:
- doVersionControl(request, response, resource);
- break;
- case DavMethods.DAV_LABEL:
- doLabel(request, response, resource);
- break;
- case DavMethods.DAV_REPORT:
- doReport(request, response, resource);
- break;
- case DavMethods.DAV_CHECKIN:
- doCheckin(request, response, resource);
- break;
- case DavMethods.DAV_CHECKOUT:
- doCheckout(request, response, resource);
- break;
- case DavMethods.DAV_UNCHECKOUT:
- doUncheckout(request, response, resource);
- break;
- case DavMethods.DAV_MERGE:
- doMerge(request, response, resource);
- break;
- case DavMethods.DAV_UPDATE:
- doUpdate(request, response, resource);
- break;
- case DavMethods.DAV_MKWORKSPACE:
- doMkWorkspace(request, response, resource);
- break;
- default:
- // any other method
- super.service(request, response);
- }
- }
-}
diff --git a/contrib/jcr-server/server/src/java/org/apache/jackrabbit/server/RepositoryStartupServlet.java b/contrib/jcr-server/server/src/java/org/apache/jackrabbit/server/RepositoryStartupServlet.java
deleted file mode 100644
index 182687b5393..00000000000
--- a/contrib/jcr-server/server/src/java/org/apache/jackrabbit/server/RepositoryStartupServlet.java
+++ /dev/null
@@ -1,312 +0,0 @@
-/*
- * 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.server;
-
-import org.apache.log4j.PropertyConfigurator;
-import org.apache.log4j.Logger;
-import org.apache.jackrabbit.core.config.RepositoryConfig;
-import org.apache.jackrabbit.core.RepositoryImpl;
-import org.apache.jackrabbit.rmi.server.ServerAdapterFactory;
-import org.xml.sax.InputSource;
-
-import javax.servlet.http.HttpServlet;
-import javax.servlet.ServletException;
-import javax.jcr.*;
-import javax.naming.InitialContext;
-import javax.naming.NamingException;
-import java.io.*;
-import java.util.Properties;
-import java.util.Enumeration;
-import java.rmi.registry.Registry;
-import java.rmi.registry.LocateRegistry;
-import java.rmi.Naming;
-import java.rmi.RemoteException;
-import java.rmi.AlreadyBoundException;
-import java.rmi.Remote;
-import java.net.MalformedURLException;
-
-/**
- * The RepositoryStartupServlet starts a jackrabbit repository and registers it
- * to the JNDI environment and optional to the RMI registry.
- */
-public class RepositoryStartupServlet extends HttpServlet {
-
- /** the default logger */
- private static Logger log;
-
- /** initial param name for the repository config location */
- public final static String INIT_PARAM_REPOSITORY_CONFIG = "repository-config";
-
- /** initial param name for the repository home directory */
- public final static String INIT_PARAM_REPOSITORY_HOME = "repository-home";
-
- /** initial param name for the repository name */
- public final static String INIT_PARAM_REPOSITORY_NAME = "repository-name";
-
- /** initial param name for the rmi port */
- public final static String INIT_PARAM_RMI_PORT = "rmi-port";
-
- /** initial param name for the log4j config properties */
- public final static String INIT_PARAM_LOG4J_CONFIG = "log4j-config";
-
- /** the registered repository */
- private static RepositoryImpl repository;
-
- /** the name of the repository as configured */
- private static String repositoryName;
-
- /** the jndi context, created base on configuration */
- private static InitialContext jndiContext;
-
- /** the rmi uri, in the form of '//:${rmi-port}/${repository-name}' */
- private static String rmiURI;
-
- /**
- * Initializes the servlet
- * @throws ServletException
- */
- public void init() throws ServletException {
- super.init();
- initLog4J();
- log.info("RepositoryStartupServlet initializing...");
- initRepository();
- registerJNDI();
- registerRMI();
- log.info("RepositoryStartupServlet initialized.");
- }
-
- /**
- * destroy the servlet
- */
- public void destroy() {
- super.destroy();
- if (log == null) {
- log("RepositoryStartupServlet shutting down...");
- } else {
- log.info("RepositoryStartupServlet shutting down...");
- }
- unregisterRMI();
- unregisterJNDI();
- log("RepositoryStartupServlet shut down.");
- }
-
- /**
- * Initializes Log4J
- * @throws ServletException
- */
- private void initLog4J() throws ServletException {
- // setup log4j
- String log4jConfig = getServletConfig().getInitParameter(INIT_PARAM_LOG4J_CONFIG);
- InputStream in =getServletContext().getResourceAsStream(log4jConfig);
- if (in==null) {
- // try normal init
- PropertyConfigurator.configure(log4jConfig);
- } else {
- try {
- Properties log4jProperties = new Properties();
- log4jProperties.load(in);
- in.close();
- PropertyConfigurator.configure(log4jProperties);
- } catch (IOException e) {
- throw new ServletException("Unable to load log4jProperties: " + e.toString());
- }
- }
- log = Logger.getLogger(RepositoryStartupServlet.class);
- }
-
- /**
- * Creates a new Repository based on configuration
- * @throws ServletException
- */
- private void initRepository() throws ServletException {
- // setup home directory
- String repHome = getServletConfig().getInitParameter(INIT_PARAM_REPOSITORY_HOME);
- if (repHome==null) {
- log.error(INIT_PARAM_REPOSITORY_HOME + " missing.");
- throw new ServletException(INIT_PARAM_REPOSITORY_HOME + " missing.");
- }
- File repositoryHome;
- try {
- repositoryHome = new File(repHome).getCanonicalFile();
- } catch (IOException e) {
- log.error(INIT_PARAM_REPOSITORY_HOME + " invalid." + e.toString());
- throw new ServletException(INIT_PARAM_REPOSITORY_HOME + " invalid." + e.toString());
- }
- log.info(" repository-home = " + repositoryHome.getPath());
-
- // get repository config
- String repConfig = getServletConfig().getInitParameter(INIT_PARAM_REPOSITORY_CONFIG);
- if (repConfig==null) {
- log.error(INIT_PARAM_REPOSITORY_CONFIG + " missing.");
- throw new ServletException(INIT_PARAM_REPOSITORY_CONFIG + " missing.");
- }
- log.info(" repository-config = " + repConfig);
-
- InputStream in = getServletContext().getResourceAsStream(repConfig);
- if (in==null) {
- try {
- in = new FileInputStream(new File(repositoryHome, repConfig));
- } catch (FileNotFoundException e) {
- log.error(INIT_PARAM_REPOSITORY_CONFIG + " invalid." + e.toString());
- throw new ServletException(INIT_PARAM_REPOSITORY_CONFIG + " invalid." + e.toString());
- }
- }
-
- // get repository name
- repositoryName = getServletConfig().getInitParameter(INIT_PARAM_REPOSITORY_NAME);
- if (repositoryName==null) {
- repositoryName="default";
- }
- log.info(" repository-name = " + repositoryName);
-
- try {
- InputSource is = new InputSource(in);
- RepositoryConfig config = RepositoryConfig.create(is, repositoryHome.getAbsolutePath());
- repository = RepositoryImpl.create(config);
- } catch (RepositoryException e) {
- throw new ServletException("Error while creating repository", e);
- }
- }
-
- /**
- * Registers the repository in the JNDI context
- * @throws ServletException
- */
- private void registerJNDI() throws ServletException {
- // registering via jndi
- Properties env = new Properties();
- Enumeration names = getServletConfig().getInitParameterNames();
- while (names.hasMoreElements()) {
- String name = (String) names.nextElement();
- if (name.startsWith("java.naming.")) {
- env.put(name, getServletConfig().getInitParameter(name));
- log.info(" adding property to JNDI environment: " + name + "=" + env.getProperty(name));
- }
- }
- try {
- jndiContext = new InitialContext(env);
- jndiContext.bind(repositoryName, repository);
- } catch (NamingException e) {
- throw new ServletException(e);
- }
- log.info("Repository bound to JNDI with name: " + repositoryName);
- }
-
- /**
- * Unregisters the repository from the JNDI context
- */
- private void unregisterJNDI() {
- if (jndiContext != null) {
- try {
- jndiContext.unbind(repositoryName);
- } catch (NamingException e) {
- log("Error while unbinding repository from JNDI: " + e);
- }
- }
- }
-
- /**
- * Registers the repositroy to the RMI registry
- * @throws ServletException
- */
- private void registerRMI() throws ServletException {
- // check registering via RMI
- String rmiPortStr = getServletConfig().getInitParameter(INIT_PARAM_RMI_PORT);
- if (rmiPortStr != null) {
- int rmiPort = 0;
- try {
- rmiPort = Integer.parseInt(rmiPortStr);
- } catch (NumberFormatException e) {
- log.warn("Invalid port in rmi-port param: " + e);
- }
- if (rmiPort == 0) {
- rmiPort = Registry.REGISTRY_PORT;
- }
-
- // try to create remote repository
- Remote remote = null;
- try {
- Class clazz = Class.forName("org.apache.jackrabbit.server.RMIRemoteFactoryDelegater");
- RemoteFactoryDelegater rmf = (RemoteFactoryDelegater) clazz.newInstance();
- remote = rmf.createRemoteRepository(repository);
- } catch (RemoteException e) {
- throw new ServletException("Unable to create remote repository: " + e.toString(), e);
- } catch (NoClassDefFoundError e) {
- log.warn("Unable to create RMI repository. jcr-rmi.jar might be missing.: " + e.toString());
- return;
- } catch (Exception e) {
- log.warn("Unable to create RMI repository. jcr-rmi.jar might be missing.: " + e.toString());
- return;
- }
-
- try {
- System.setProperty("java.rmi.server.useCodebaseOnly", "true");
- try {
- // start registry
- LocateRegistry.createRegistry(rmiPort);
- } catch (RemoteException e) {
- // ignore
- }
- rmiURI = "//:" + rmiPort + "/" + repositoryName;
- Naming.bind(rmiURI, remote);
-
- log.info("Repository bound via RMI with name: " + rmiURI);
- } catch (MalformedURLException e) {
- throw new ServletException("Unable to bind repository via RMI: " + e.toString(), e);
- } catch (RemoteException e) {
- throw new ServletException("Unable to bind repository via RMI: " + e.toString(), e);
- } catch (AlreadyBoundException e) {
- throw new ServletException("Unable to bind repository via RMI: " + e.toString(), e);
- }
- }
- }
-
- /**
- * Unregisters the repository from the RMI registry
- */
- private void unregisterRMI() {
- if (rmiURI != null) {
- try {
- Naming.unbind(rmiURI);
- } catch (Exception e) {
- log("Error while unbinding repository from JNDI: " + e);
- }
- }
- }
-
-}
-
-/**
- * optional class for RMI, will only be used, if RMI server is present
- */
-abstract class RemoteFactoryDelegater {
-
- public abstract Remote createRemoteRepository(Repository repository)
- throws RemoteException;
-}
-/**
- * optional class for RMI, will only be used, if RMI server is present
- */
-class RMIRemoteFactoryDelegater extends RemoteFactoryDelegater {
-
- // only used to enforce linking upon Class.forName()
- static String FactoryClassName = ServerAdapterFactory.class.getName();
-
- public Remote createRemoteRepository(Repository repository)
- throws RemoteException {
- return new ServerAdapterFactory().getRemoteRepository(repository);
- }
-}
\ No newline at end of file
diff --git a/contrib/jcr-server/server/src/java/org/apache/jackrabbit/server/simple/WebdavServlet.java b/contrib/jcr-server/server/src/java/org/apache/jackrabbit/server/simple/WebdavServlet.java
deleted file mode 100644
index d9259539487..00000000000
--- a/contrib/jcr-server/server/src/java/org/apache/jackrabbit/server/simple/WebdavServlet.java
+++ /dev/null
@@ -1,226 +0,0 @@
-/*
- * 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.server.simple;
-
-import org.apache.jackrabbit.server.simple.dav.lock.SimpleLockManager;
-import org.apache.jackrabbit.server.simple.dav.ResourceFactoryImpl;
-import org.apache.jackrabbit.server.simple.dav.LocatorFactoryImpl;
-import org.apache.jackrabbit.server.simple.dav.DavSessionProviderImpl;
-
-import javax.servlet.http.*;
-import javax.servlet.*;
-import java.io.*;
-
-import org.apache.log4j.Logger;
-import org.apache.jackrabbit.server.AbstractWebdavServlet;
-import org.apache.jackrabbit.webdav.*;
-
-/**
- * WebdavServlet provides webdav support (level 1 and 2 complient) for repository
- * resources.
- */
-public class WebdavServlet extends AbstractWebdavServlet {
-
- /** the default logger */
- private static final Logger log = Logger.getLogger(WebdavServlet.class);
-
- /** init param name of the repository prefix */
- public static final String INIT_PARAM_RESOURCE_PATH_PREFIX = "resource-path-prefix";
-
- /**
- * Map used to remember any webdav lock created without being reflected
- * in the underlaying repository.
- * This is needed because some clients rely on a successful locking
- * mechanism in order to perform properly (e.g. mac OSX built-in dav client)
- */
- private SimpleLockManager lockManager;
-
- /** the resource factory */
- private DavResourceFactory resourceFactory;
-
- /** the locator factory */
- private DavLocatorFactory locatorFactory;
-
- /** the session provider */
- private DavSessionProvider sessionProvider;
-
- /** the repository prefix retrieved from config */
- private static String resourcePathPrefix;
-
- /**
- * Init this servlet
- *
- * @throws ServletException
- */
- public void init() throws ServletException {
- super.init();
-
- resourcePathPrefix = getInitParameter(INIT_PARAM_RESOURCE_PATH_PREFIX);
- if (resourcePathPrefix == null) {
- log.debug("Missing path prefix > setting to empty string.");
- resourcePathPrefix = "";
- } else if (resourcePathPrefix.endsWith("/")) {
- log.debug("Path prefix ends with '/' > removing trailing slash.");
- resourcePathPrefix = resourcePathPrefix.substring(0, resourcePathPrefix.length()-1);
- }
- log.info(INIT_PARAM_RESOURCE_PATH_PREFIX + " = '" + resourcePathPrefix + "'");
-
- lockManager = new SimpleLockManager();
- resourceFactory = new ResourceFactoryImpl(lockManager);
- locatorFactory = new LocatorFactoryImpl(resourcePathPrefix);
- }
-
- /**
- * Service the given request.
- *
- * @param request
- * @param response
- * @throws ServletException
- * @throws IOException
- */
- protected void service(HttpServletRequest request, HttpServletResponse response)
- throws ServletException, IOException {
-
- try {
- WebdavRequest webdavRequest = new WebdavRequestImpl(request, locatorFactory);
- WebdavResponse webdavResponse = new WebdavResponseImpl(response);
-
- // make sure there is a authenticated user
- getDavSessionProvider().acquireSession(webdavRequest);
- if (webdavRequest.getDavSession() == null) {
- return;
- }
-
- // check matching if=header for lock-token relevant operations
- DavResource resource = createResource(webdavRequest.getRequestLocator(), webdavRequest, webdavResponse);
- if (resource.exists() && !webdavRequest.matchesIfHeader(resource)) {
- webdavResponse.sendError(DavServletResponse.SC_PRECONDITION_FAILED);
- return;
- }
-
- /* set cache control headers in order to deal with non-dav complient
- * http1.1 or http1.0 proxies. >> see RFC2518 9.4.5 */
- webdavResponse.addHeader("Pragma", "No-cache"); // http1.0
- webdavResponse.addHeader("Cache-Control", "no-cache"); // http1.1
-
- int methodCode = DavMethods.getMethodCode(webdavRequest.getMethod());
- switch (methodCode) {
- case DavMethods.DAV_HEAD:
- case DavMethods.DAV_GET:
- doGet(webdavRequest, webdavResponse, resource);
- case DavMethods.DAV_OPTIONS:
- doOptions(webdavRequest, webdavResponse, resource);
- break;
- case DavMethods.DAV_PROPFIND:
- doPropFind(webdavRequest, webdavResponse, resource);
- break;
- case DavMethods.DAV_PROPPATCH:
- doPropPatch(webdavRequest, webdavResponse, resource);
- break;
- case DavMethods.DAV_PUT:
- case DavMethods.DAV_POST:
- doPut(webdavRequest, webdavResponse, resource);
- break;
- case DavMethods.DAV_DELETE:
- doDelete(webdavRequest, webdavResponse, resource);
- break;
- case DavMethods.DAV_COPY:
- doCopy(webdavRequest, webdavResponse, resource);
- break;
- case DavMethods.DAV_MOVE:
- doMove(webdavRequest, webdavResponse, resource);
- break;
- case DavMethods.DAV_MKCOL:
- doMkCol(webdavRequest, webdavResponse, resource);
- break;
- case DavMethods.DAV_LOCK:
- doLock(webdavRequest, webdavResponse, resource);
- break;
- case DavMethods.DAV_UNLOCK:
- doUnlock(webdavRequest, webdavResponse, resource);
- break;
- default:
- // GET, HEAD, TRACE......
- super.service(request, response);
- }
- getDavSessionProvider().releaseSession(webdavRequest);
-
- } catch (DavException e) {
- response.sendError(e.getErrorCode());
- }
- }
-
- /**
- * The MKCOL method
- *
- * @throws IOException
- */
- protected void doMkCol(WebdavRequest request, WebdavResponse response,
- DavResource resource) throws IOException, DavException {
- // mkcol request with request.body is not supported.
- if (request.getContentLength()>0 || request.getHeader("Transfer-Encoding") != null) {
- response.sendError(DavServletResponse.SC_UNSUPPORTED_MEDIA_TYPE);
- return;
- }
- super.doMkCol(request, response, resource);
- }
-
- /**
- * Build a DavResource
from the given path.
- * Please note, that the resource may not have a corresponding element in
- * the repository in which case, {@link DavResource#exists()} will return
- * false.
- *
- * @see AbstractWebdavServlet#createResource(org.apache.jackrabbit.webdav.DavResourceLocator, org.apache.jackrabbit.webdav.WebdavRequest, org.apache.jackrabbit.webdav.WebdavResponse)
- */
- protected DavResource createResource(DavResourceLocator locator, WebdavRequest request, WebdavResponse response)
- throws DavException {
- return resourceFactory.createResource(locator, request, response);
- }
-
- /**
- * Returns the configured path prefix
- *
- * @return resourcePathPrefix
- * @see #INIT_PARAM_RESOURCE_PATH_PREFIX
- */
- public static String getPathPrefix() {
- return resourcePathPrefix;
- }
-
- /**
- * Returns the DavSessionProvider
. If no session provider has
- * been set or created a new instance of {@link DavSessionProviderImpl} is
- * return.
- *
- * @return the session provider
- */
- public DavSessionProvider getDavSessionProvider() {
- if (sessionProvider == null) {
- sessionProvider = new DavSessionProviderImpl();
- }
- return sessionProvider;
- }
-
- /**
- * Set the session provider
- *
- * @param sessionProvider
- */
- public void setDavSessionProvider(DavSessionProvider sessionProvider) {
- this.sessionProvider = sessionProvider;
- }
-}
diff --git a/contrib/jcr-server/server/src/java/org/apache/jackrabbit/server/simple/dav/DavResourceImpl.java b/contrib/jcr-server/server/src/java/org/apache/jackrabbit/server/simple/dav/DavResourceImpl.java
deleted file mode 100644
index 28097a3711c..00000000000
--- a/contrib/jcr-server/server/src/java/org/apache/jackrabbit/server/simple/dav/DavResourceImpl.java
+++ /dev/null
@@ -1,659 +0,0 @@
-/*
- * 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.server.simple.dav;
-
-import javax.jcr.*;
-import javax.jcr.lock.Lock;
-import java.util.*;
-import java.io.*;
-
-import org.apache.jackrabbit.webdav.*;
-import org.apache.jackrabbit.webdav.util.Text;
-import org.apache.jackrabbit.webdav.spi.lock.JcrActiveLock;
-import org.apache.jackrabbit.webdav.spi.JcrDavException;
-import org.apache.jackrabbit.webdav.lock.*;
-import org.apache.jackrabbit.webdav.property.*;
-
-/**
- * DavResourceImpl imeplements a DavResource.
- */
-public class DavResourceImpl implements DavResource {
-
- private DavResourceFactory factory;
- private LockManager lockManager;
- private DavSession session;
- private Node node;
- private DavResourceLocator locator;
-
- private DavPropertySet properties;
- private boolean isCollection = true;
-
- /** is created on initProperties */
- private NodeResource nodeResource;
-
- /**
- * Create a new {@link DavResource}.
- *
- * @param locator
- * @param factory
- * @param session
- */
- public DavResourceImpl(DavResourceLocator locator, DavResourceFactory factory, DavSession session) {
- this.session = session;
- this.factory = factory;
- this.locator = locator;
- if (locator != null && locator.getResourcePath() != null) {
- try {
- init(session.getRepositorySession().getItem(locator.getResourcePath()));
- } catch (RepositoryException e) {
- // ignore: exists field evaluates to false
- }
- }
- }
-
- /**
- * Init the webdav resource and retrieve the relevant property.
- *
- * @param repositoryItem
- * @throws RepositoryException
- */
- private void init(Item repositoryItem) throws RepositoryException {
- if (repositoryItem == null || !repositoryItem.isNode()) {
- return;
- }
- node = (Node)repositoryItem;
-
- // define what is a resource in webdav
- if (node.isNodeType("nt:resource") || node.isNodeType("nt:file")) {
- isCollection = false;
- }
- }
-
- /**
- * @return DavResource#COMPLIANCE_CLASS
- * @see org.apache.jackrabbit.webdav.DavResource#getComplianceClass()
- */
- public String getComplianceClass() {
- return DavResource.COMPLIANCE_CLASS;
- }
-
- /**
- * @return DavResource#METHODS
- * @see org.apache.jackrabbit.webdav.DavResource#getSupportedMethods()
- */
- public String getSupportedMethods() {
- return DavResource.METHODS;
- }
-
- /**
- * @see DavResource#exists() )
- */
- public boolean exists() {
- return node != null;
- }
-
- /**
- * @see DavResource#isCollection()
- */
- public boolean isCollection() {
- return isCollection;
- }
-
- /**
- * @see org.apache.jackrabbit.webdav.DavResource#getLocator()
- */
- public DavResourceLocator getLocator() {
- return locator;
- }
-
- /**
- * @see DavResource#getResourcePath()
- */
- public String getResourcePath() {
- return locator.getResourcePath();
- }
-
- /**
- * @see DavResource#getHref()
- */
- public String getHref() {
- return locator.getHref(isCollection());
- }
-
- /**
- * @see DavResource#getDisplayName()
- */
- public String getDisplayName() {
- String name = null;
- if (exists()) {
- try {
- name = node.getName();
- } catch (RepositoryException e) {
- // ignore
- }
- }
- if (name == null && getResourcePath() != null) {
- name = Text.getLabel(getResourcePath());
- }
- return name;
- }
-
- /**
- * @see org.apache.jackrabbit.webdav.DavResource#getModificationTime()
- */
- public long getModificationTime() {
- initProperties();
- return nodeResource == null ? 0 : nodeResource.getModificationTime();
- }
-
- /**
- * @see org.apache.jackrabbit.webdav.DavResource#getStream()
- */
- public InputStream getStream() {
- initProperties();
- return nodeResource == null ? null : nodeResource.getStream();
- }
-
- /**
- * @see DavResource#getProperty(org.apache.jackrabbit.webdav.property.DavPropertyName)
- */
- public DavProperty getProperty(DavPropertyName name) {
- initProperties();
- return properties.get(name);
- }
-
- /**
- * @see DavResource#getProperties()
- */
- public DavPropertySet getProperties() {
- initProperties();
- return properties;
- }
-
- /**
- * @see DavResource#getPropertyNames()
- */
- public DavPropertyName[] getPropertyNames() {
- return getProperties().getPropertyNames();
- }
-
- /**
- * Fill the set of properties
- */
- private void initProperties() {
- if (properties == null && exists()) {
- properties = new DavPropertySet();
- try {
- nodeResource = new NodeResource(this, node);
- properties.add(new DefaultDavProperty(DavPropertyName.GETCONTENTLENGTH, nodeResource.getContentLength()+""));
- properties.add(new DefaultDavProperty(DavPropertyName.CREATIONDATE, nodeResource.getCreationDate()));
- properties.add(new DefaultDavProperty(DavPropertyName.GETLASTMODIFIED, nodeResource.getLastModified()));
- String contentType = nodeResource.getContentType();
- if (contentType != null) {
- properties.add(new DefaultDavProperty(DavPropertyName.GETCONTENTTYPE, contentType));
- }
- properties.add(new DefaultDavProperty(DavPropertyName.GETETAG, nodeResource.getETag()));
- } catch (RepositoryException e) {
- // should not occure....
- }
-
- if (getDisplayName() != null) {
- properties.add(new DefaultDavProperty(DavPropertyName.DISPLAYNAME, getDisplayName()));
- }
- if (isCollection()) {
- properties.add(new ResourceType(ResourceType.COLLECTION));
- // Windows XP support
- properties.add(new DefaultDavProperty(DavPropertyName.ISCOLLECTION, "1"));
- } else {
- properties.add(new ResourceType(ResourceType.DEFAULT_RESOURCE));
- // Windows XP support
- properties.add(new DefaultDavProperty(DavPropertyName.ISCOLLECTION, "0"));
- }
-
- /* set current lock information. If no lock is set to this resource,
- an empty lockdiscovery will be returned in the response. */
- properties.add(new LockDiscovery(getLock(Type.WRITE, Scope.EXCLUSIVE)));
-
- /* lock support information: all locks are lockable. */
- SupportedLock supportedLock = new SupportedLock();
- supportedLock.addEntry(Type.WRITE, Scope.EXCLUSIVE);
- properties.add(supportedLock);
- }
- }
-
- /**
- * @param property
- * @throws DavException
- * @see DavResource#setProperty(org.apache.jackrabbit.webdav.property.DavProperty)
- */
- public void setProperty(DavProperty property) throws DavException {
- if (isLocked(this)) {
- throw new DavException(DavServletResponse.SC_LOCKED);
- }
- throw new DavException(DavServletResponse.SC_METHOD_NOT_ALLOWED);
- }
-
- /**
- * @param propertyName
- * @throws DavException
- * @see DavResource#removeProperty(org.apache.jackrabbit.webdav.property.DavPropertyName)
- */
- public void removeProperty(DavPropertyName propertyName) throws DavException {
- if (isLocked(this)) {
- throw new DavException(DavServletResponse.SC_LOCKED);
- }
- throw new DavException(DavServletResponse.SC_METHOD_NOT_ALLOWED);
- }
-
- /**
- * @see DavResource#getCollection()
- */
- public DavResource getCollection() {
- DavResource parent = null;
- if (getResourcePath() != null && !getResourcePath().equals("/")) {
- String parentPath = Text.getRelativeParent(getResourcePath(), 1);
- if (parentPath.equals("")) {
- parentPath="/";
- }
- DavResourceLocator parentloc = locator.getFactory().createResourceLocator(locator.getPrefix(), locator.getWorkspacePath(), parentPath);
- try {
- parent = factory.createResource(parentloc, session);
- } catch (DavException e) {
- // should not occur
- }
- }
- return parent;
- }
-
- /**
- * @see DavResource#getMembers()
- */
- public DavResourceIterator getMembers() {
- ArrayList list = new ArrayList();
- if (exists() && isCollection()) {
- try {
- NodeIterator it = node.getNodes();
- while(it.hasNext()) {
- list.add(buildResourceFromItem(it.nextNode()));
- }
- } catch (RepositoryException e) {
- // should not occure
- } catch (DavException e) {
- // should not occure
- }
- }
- return new DavResourceIteratorImpl(list);
- }
-
- /**
- * @see DavResource#addMember(DavResource, InputStream)
- */
- public void addMember(DavResource member, InputStream in) throws DavException {
- if (!exists() || in == null) {
- throw new DavException(DavServletResponse.SC_BAD_REQUEST);
- }
- if (isLocked(this)) {
- throw new DavException(DavServletResponse.SC_LOCKED);
- }
-
- try {
- String fileName = member.getDisplayName();
- Node file;
- boolean makeVersionable = true; // todo: to be configurable somewhere
- if (node.hasNode(fileName)) {
- file = node.getNode(fileName);
- if (file.hasNode("jcr:content")) {
- // remove an existing repository entry for 'overwriting' is not possible
- file.getNode("jcr:content").remove();
- }
- } else {
- file = node.addNode(fileName, "nt:file");
- if (makeVersionable) {
- file.addMixin("mix:versionable");
- }
- }
-
- if (fileName.endsWith(".xml")) {
- importXml(file, in, "text/xml");
- } else {
- // todo: retrieve proper mimetype from filename
- importFile(file, in, "application/octet-stream");
- }
- session.getRepositorySession().save();
- } catch (ItemExistsException e) {
- // according to RFC 2518: MKCOL only possible on non-existing/deleted resource
- throw new JcrDavException(e, DavServletResponse.SC_METHOD_NOT_ALLOWED);
- } catch (RepositoryException e) {
- throw new JcrDavException(e);
- } catch (IOException e) {
- throw new DavException(DavServletResponse.SC_INTERNAL_SERVER_ERROR, e.getMessage());
- }
- }
-
- /**
- * Imports a xml into the repository
- * @param parentNode
- * @param in
- * @param contentType
- * @throws RepositoryException
- * @throws IOException
- */
- private void importXml(Node parentNode, InputStream in, String contentType)
- throws RepositoryException, IOException {
- Node content = parentNode.addNode("jcr:content", "nt:unstructured");
- content.setProperty("jcr:mimeType", contentType);
- content.setProperty("jcr:lastModified", Calendar.getInstance());
- session.getRepositorySession().importXML(content.getPath(), in);
- }
-
- /**
- * Imports a plain file to the repository
- * @param parentNode
- * @param in
- * @param contentType
- * @throws RepositoryException
- */
- private void importFile(Node parentNode, InputStream in, String contentType)
- throws RepositoryException {
- Node content = parentNode.addNode("jcr:content", "nt:resource");
- content.setProperty("jcr:mimeType", contentType);
- content.setProperty("jcr:encoding", "");
- content.setProperty("jcr:data", in);
- content.setProperty("jcr:lastModified", Calendar.getInstance());
- }
-
- /**
- * @see DavResource#addMember(DavResource)
- */
- public void addMember(DavResource member) throws DavException {
- if (!exists()) {
- throw new DavException(DavServletResponse.SC_CONFLICT);
- }
- if (isLocked(this)) {
- throw new DavException(DavServletResponse.SC_LOCKED);
- }
- try {
- node.addNode(member.getDisplayName(), "nt:folder");
- node.save();
- } catch (RepositoryException e) {
- throw new JcrDavException(e);
- }
- }
-
- /**
- * @see DavResource#removeMember(DavResource)
- */
- public void removeMember(DavResource member) throws DavException {
- if (!exists() || !member.exists()) {
- throw new DavException(DavServletResponse.SC_NOT_FOUND);
- }
- if (isLocked(this) || isLocked(member)) {
- throw new DavException(DavServletResponse.SC_LOCKED);
- }
-
- try {
- // make sure, non-jcr locks are removed.
- if (!isJsrLockable()) {
- ActiveLock lock = getLock(Type.WRITE, Scope.EXCLUSIVE);
- if (lock != null) {
- lockManager.releaseLock(lock.getToken(), member);
- }
- }
- ActiveLock lock = getLock(Type.WRITE, Scope.EXCLUSIVE);
- if (lock != null && lockManager.hasLock(lock.getToken(), member)) {
- lockManager.releaseLock(lock.getToken(), member);
- }
-
- Session s = session.getRepositorySession();
- Item memItem = s.getItem(member.getResourcePath());
- memItem.remove();
- s.save();
- } catch (RepositoryException e) {
- throw new JcrDavException(e);
- }
- }
-
- /**
- * @see DavResource#move(DavResource)
- */
- public void move(DavResource destination) throws DavException {
- if (!exists()) {
- throw new DavException(DavServletResponse.SC_NOT_FOUND);
- }
- if (isLocked(this)) {
- throw new DavException(DavServletResponse.SC_LOCKED);
- }
- try {
- session.getRepositorySession().getWorkspace().move(getResourcePath(), destination.getResourcePath());
- } catch (RepositoryException e) {
- throw new JcrDavException(e);
- }
- }
-
- /**
- * @see DavResource#copy(DavResource, boolean)
- */
- public void copy(DavResource destination, boolean shallow) throws DavException {
- if (!exists()) {
- throw new DavException(DavServletResponse.SC_NOT_FOUND);
- }
- if (isLocked(destination)) {
- throw new DavException(DavServletResponse.SC_LOCKED);
- }
- // TODO: support shallow and deep copy
- if (shallow) {
- throw new DavException(DavServletResponse.SC_FORBIDDEN, "Unable to perform shallow copy.");
- }
- try {
- session.getRepositorySession().getWorkspace().copy(getResourcePath(), destination.getResourcePath());
- } catch (PathNotFoundException e) {
- // according to rfc 2518: missing parent
- throw new DavException(DavServletResponse.SC_CONFLICT, e.getMessage());
- } catch (RepositoryException e) {
- throw new JcrDavException(e);
- }
- }
-
- /**
- * @param type
- * @param scope
- * @return true if type is {@link Type#WRITE} and scope is {@link Scope#EXCLUSIVE}
- * @see DavResource#isLockable(org.apache.jackrabbit.webdav.lock.Type, org.apache.jackrabbit.webdav.lock.Scope)
- */
- public boolean isLockable(Type type, Scope scope) {
- return Type.WRITE.equals(type) && Scope.EXCLUSIVE.equals(scope);
- }
-
- /**
- * @see DavResource#hasLock(org.apache.jackrabbit.webdav.lock.Type, org.apache.jackrabbit.webdav.lock.Scope)
- */
- public boolean hasLock(Type type, Scope scope) {
- return getLock(type, scope) != null;
- }
-
- /**
- * @see DavResource#getLock(Type, Scope)
- */
- public ActiveLock getLock(Type type, Scope scope) {
- ActiveLock lock = null;
- if (exists() && Type.WRITE.equals(type) && Scope.EXCLUSIVE.equals(scope)) {
- // try to retrieve the repository lock information first
- if (isJsrLockable()) {
- try {
- Lock jcrLock = node.getLock();
- if (jcrLock != null && jcrLock.isLive()) {
- lock = new JcrActiveLock(jcrLock);
- }
- } catch (RepositoryException e) {
- // LockException: no lock applies to this node >> ignore
- // RepositoryException, AccessDeniedException or another error >> ignore
- }
- } else {
- // not-jcr lockable >> check for webdav lock
- lock = lockManager.getLock(type, scope, this);
- }
- }
- return lock;
- }
-
- /**
- * @see org.apache.jackrabbit.webdav.DavResource#getLocks()
- */
- public ActiveLock[] getLocks() {
- return new ActiveLock[] {getLock(Type.WRITE, Scope.EXCLUSIVE)};
- }
-
- /**
- * @see DavResource#lock(LockInfo)
- */
- public ActiveLock lock(LockInfo lockInfo) throws DavException {
- ActiveLock lock = null;
- if (isLockable(lockInfo.getType(), lockInfo.getScope())) {
- if (isJsrLockable()) {
- try {
- // try to execute the lock operation
- Lock jcrLock = node.lock(lockInfo.isDeep(), false);
- if (jcrLock != null) {
- lock = new JcrActiveLock(jcrLock);
- }
- } catch (RepositoryException e) {
- throw new JcrDavException(e);
- }
- } else {
- // create a new lock which creates a random lock token
- lock = lockManager.createLock(lockInfo, this);
- }
- } else {
- throw new DavException(DavServletResponse.SC_PRECONDITION_FAILED, "Unsupported lock type or scope.");
- }
- return lock;
- }
-
- /**
- * @see DavResource#refreshLock(LockInfo, String)
- */
- public ActiveLock refreshLock(LockInfo lockInfo, String lockToken) throws DavException{
- if (!exists()) {
- throw new DavException(DavServletResponse.SC_NOT_FOUND);
- }
- /* since lock is always has infinite timeout >> no extra refresh needed
- return a lockdiscovery with the lock-info and the default scope and type */
- ActiveLock lock = getLock(lockInfo.getType(), lockInfo.getScope());
- if (lock == null) {
- throw new DavException(DavServletResponse.SC_PRECONDITION_FAILED, "No lock present on resource " + getResourcePath());
- } else if (lock.isLockedByToken(lockToken)) {
- if (lock instanceof JcrActiveLock) {
- try {
- // refresh JCR lock and return the original lock object.
- node.getLock().refresh();
- } catch (RepositoryException e) {
- throw new JcrDavException(e);
- }
- } else {
- lock = lockManager.refreshLock(lockInfo, lockToken, this);
- }
- } else {
- throw new DavException(DavServletResponse.SC_LOCKED);
- }
- return lock;
- }
-
- /**
- * @see DavResource#unlock(String)
- */
- public void unlock(String lockToken) throws DavException {
- ActiveLock lock = getLock(Type.WRITE, Scope.EXCLUSIVE);
- if (lock == null) {
- throw new DavException(DavServletResponse.SC_PRECONDITION_FAILED);
- } else if (lock.isLockedByToken(lockToken)) {
- if (lock instanceof JcrActiveLock) {
- try {
- node.unlock();
- } catch (RepositoryException e) {
- throw new JcrDavException(e);
- }
- } else {
- lockManager.releaseLock(lockToken, this);
- }
- } else {
- throw new DavException(DavServletResponse.SC_LOCKED);
- }
- }
-
- /**
- * @see DavResource#addLockManager(org.apache.jackrabbit.webdav.lock.LockManager)
- */
- public void addLockManager(LockManager lockMgr) {
- this.lockManager = lockMgr;
- }
-
- /**
- * @see org.apache.jackrabbit.webdav.DavResource#getFactory()
- */
- public DavResourceFactory getFactory() {
- return factory;
- }
-
- /**
- * Returns true, if this webdav resource allows for locking without checking
- * its current lock status.
- *
- * @return true if this resource is lockable.
- */
- private boolean isJsrLockable() {
- boolean lockable = false;
- if (exists()) {
- try {
- lockable = node.isNodeType("mix:lockable");
- } catch (RepositoryException e) {
- // not jcr-lockable
- }
- }
- return lockable;
- }
-
- /**
- * Return true if this resource cannot be modified due to a write lock
- * that is not owned by the given session.
- *
- * @return true if this resource cannot be modified due to a write lock
- */
- private boolean isLocked(DavResource res) {
- ActiveLock lock = res.getLock(Type.WRITE, Scope.EXCLUSIVE);
- if (lock == null) {
- return false;
- } else {
- String[] sLockTokens = session.getLockTokens();
- for (int i = 0; i < sLockTokens.length; i++) {
- if (sLockTokens[i].equals(lock.getToken())) {
- return false;
- }
- }
- return true;
- }
- }
-
- /**
- * @param item
- * @return
- * @throws DavException
- * @throws RepositoryException
- */
- private DavResource buildResourceFromItem(Item item) throws DavException, RepositoryException {
- DavResourceLocator parentloc = locator.getFactory().createResourceLocator(locator.getPrefix(), locator.getWorkspacePath(), item.getPath());
- return factory.createResource(parentloc, session);
- }
-}
diff --git a/contrib/jcr-server/server/src/java/org/apache/jackrabbit/server/simple/dav/DavSessionImpl.java b/contrib/jcr-server/server/src/java/org/apache/jackrabbit/server/simple/dav/DavSessionImpl.java
deleted file mode 100644
index c9b68142834..00000000000
--- a/contrib/jcr-server/server/src/java/org/apache/jackrabbit/server/simple/dav/DavSessionImpl.java
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- * 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.server.simple.dav;
-
-import javax.jcr.Session;
-import java.util.HashSet;
-
-import org.apache.jackrabbit.webdav.DavSession;
-
-/**
- * Simple implementation of the {@link DavSession} interface. Stores
- * lock tokens but does not yet store references.
- */
-public class DavSessionImpl implements DavSession {
-
- /** the underlaying jcr session */
- private final Session session;
-
- /** the lock tokens of this session */
- private final HashSet lockTokens = new HashSet();
-
- /**
- * Creates a new DavSession based on a jcr session
- * @param session
- */
- public DavSessionImpl(Session session) {
- this.session = session;
- }
-
- /**
- * @see DavSession#addReference(Object)
- */
- public void addReference(Object reference) {
- throw new UnsupportedOperationException("No yet implemented.");
- }
-
- /**
- * @see DavSession#removeReference(Object)
- */
- public void removeReference(Object reference) {
- throw new UnsupportedOperationException("No yet implemented.");
- }
-
- /**
- * @see DavSession#getRepositorySession()
- */
- public Session getRepositorySession() {
- return session;
- }
-
- /**
- * @see DavSession#addLockToken(String)
- */
- public void addLockToken(String token) {
- lockTokens.add(token);
- }
-
- /**
- * @see DavSession#getLockTokens()
- */
- public String[] getLockTokens() {
- return (String[]) lockTokens.toArray(new String[lockTokens.size()]);
- }
-
- /**
- * @see DavSession#removeLockToken(String)
- */
- public void removeLockToken(String token) {
- lockTokens.remove(token);
- }
-}
diff --git a/contrib/jcr-server/server/src/java/org/apache/jackrabbit/server/simple/dav/DavSessionProviderImpl.java b/contrib/jcr-server/server/src/java/org/apache/jackrabbit/server/simple/dav/DavSessionProviderImpl.java
deleted file mode 100644
index ae9297dce6e..00000000000
--- a/contrib/jcr-server/server/src/java/org/apache/jackrabbit/server/simple/dav/DavSessionProviderImpl.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * 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.server.simple.dav;
-
-import javax.jcr.*;
-import javax.servlet.ServletException;
-
-import org.apache.jackrabbit.webdav.*;
-import org.apache.jackrabbit.webdav.spi.JcrDavException;
-import org.apache.jackrabbit.client.RepositoryAccessServlet;
-
-/**
- * Simple implementation of the {@link DavSessionProvider}
- * interface that uses the {@link RepositoryAccessServlet} to locate
- * credentials in the request, log into the respository, and provide
- * a {@link DavSession} to the request.
- */
-public class DavSessionProviderImpl implements DavSessionProvider {
-
- /**
- * Acquires a DavSession. Upon success, the WebdavRequest will
- * reference that session.
- *
- * A session will not be available if credentials can not be found
- * in the request (meaning that the request has not been
- * authenticated).
- *
- * @param request
- * @throws DavException if a problem occurred while obtaining the
- * session
- * @see DavSessionProvider#acquireSession(org.apache.jackrabbit.webdav.WebdavRequest)
- */
- public void acquireSession(WebdavRequest request) throws DavException {
- try {
- Credentials creds = RepositoryAccessServlet.getCredentialsFromHeader(request.getHeader(DavConstants.HEADER_AUTHORIZATION));
- if (creds == null) {
- // generate anonymous login to gain write access
- creds = new SimpleCredentials("anonymous", "anonymous".toCharArray());
- }
- Session repSession = RepositoryAccessServlet.getRepository().login(creds);
- DavSession ds = new DavSessionImpl(repSession);
- request.setDavSession(ds);
- } catch (RepositoryException e) {
- throw new JcrDavException(e);
- } catch (ServletException e) {
- throw new DavException(DavServletResponse.SC_INTERNAL_SERVER_ERROR, e.getMessage());
- }
- }
-
- /**
- * Only removes the DavSession
object from the given request object.
- * No further actions required, since DavSessionImpl
does not
- * allow to keep track of references to it.
- *
- * @param request
- * @see DavSessionProvider#releaseSession(org.apache.jackrabbit.webdav.WebdavRequest)
- */
- public void releaseSession(WebdavRequest request) {
- request.setDavSession(null);
- }
-}
diff --git a/contrib/jcr-server/server/src/java/org/apache/jackrabbit/server/simple/dav/LocatorFactoryImpl.java b/contrib/jcr-server/server/src/java/org/apache/jackrabbit/server/simple/dav/LocatorFactoryImpl.java
deleted file mode 100644
index 9cb98d1ea32..00000000000
--- a/contrib/jcr-server/server/src/java/org/apache/jackrabbit/server/simple/dav/LocatorFactoryImpl.java
+++ /dev/null
@@ -1,140 +0,0 @@
-/*
- * 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.server.simple.dav;
-
-import org.apache.jackrabbit.webdav.*;
-import org.apache.log4j.Logger;
-
-/**
- * ResourceFactoryImpl implements a simple DavLocatorFactory
- *
- * @todo improve special handling of root item....
- */
-public class LocatorFactoryImpl implements DavLocatorFactory {
-
- /** the default logger */
- private static final Logger log = Logger.getLogger(LocatorFactoryImpl.class);
-
- private final String repositoryPrefix;
-
- public LocatorFactoryImpl(String repositoryPrefix) {
- this.repositoryPrefix = repositoryPrefix;
- }
-
- public DavResourceLocator createResourceLocator(String prefix, String requestHandle) {
- String rPrefix = prefix + repositoryPrefix;
- String rHandle = requestHandle;
- // remove the configured repository prefix from the path
- if (rHandle != null && rHandle.startsWith(repositoryPrefix)) {
- rHandle = rHandle.substring(repositoryPrefix.length());
- }
- // special treatment for root item, that has no name but '/' path.
- if (rHandle == null || "".equals(rHandle)) {
- rHandle = "/";
- }
- return new Locator(rPrefix, rHandle, this);
- }
-
- public DavResourceLocator createResourceLocator(String prefix, String workspacePath, String resourcePath) {
- return new Locator(prefix, resourcePath, this);
- }
-
- private class Locator implements DavResourceLocator {
-
- private final String prefix;
- private final String itemPath;
- private final DavLocatorFactory factory;
-
- private Locator(String prefix, String itemPath, DavLocatorFactory factory) {
- this.prefix = prefix;
- this.factory = factory;
- // remove trailing '/' that is not part of the itemPath except for the root item.
- if (itemPath.endsWith("/") && !"/".equals(itemPath)) {
- itemPath = itemPath.substring(0, itemPath.length()-1);
- }
- this.itemPath = itemPath;
- }
-
- public String getPrefix() {
- return prefix;
- }
-
- public String getResourcePath() {
- return itemPath;
- }
-
- public String getWorkspacePath() {
- return "";
- }
-
- public String getWorkspaceName() {
- return "";
- }
-
- public boolean isSameWorkspace(DavResourceLocator path) {
- return isSameWorkspace(path.getWorkspaceName());
- }
-
- public boolean isSameWorkspace(String workspaceName) {
- return getWorkspaceName().equals(workspaceName);
- }
-
- public String getHref(boolean isCollection) {
- // avoid doubled trainling '/' for the root item
- String suffix = (isCollection && !isRootLocation()) ? "/" : "";
- return prefix + itemPath + suffix;
- }
-
- public boolean isRootLocation() {
- return "/".equals(itemPath);
- }
-
- public DavLocatorFactory getFactory() {
- return factory;
- }
-
- /**
- * Computes the hash code using the prefix and the itemPath
- *
- * @return the hash code
- */
- public int hashCode() {
- int hashCode = prefix.hashCode();
- if (itemPath != null) {
- hashCode += itemPath.hashCode();
- }
- return hashCode % Integer.MAX_VALUE;
- }
-
- /**
- * Equality of path is achieved if the specified object is a DavResourceLocator
- * and the return values of the two getHref(boolean)
methods are
- * equal.
- *
- * @param obj the object to compare to
- * @return true
if the 2 objects are equal;
- * false
otherwise
- */
- public boolean equals(Object obj) {
- if (obj instanceof DavResourceLocator) {
- DavResourceLocator path = (DavResourceLocator) obj;
- this.getHref(true).equals(path.getHref(true));
- }
- return false;
- }
- }
-}
diff --git a/contrib/jcr-server/server/src/java/org/apache/jackrabbit/server/simple/dav/NodeResource.java b/contrib/jcr-server/server/src/java/org/apache/jackrabbit/server/simple/dav/NodeResource.java
deleted file mode 100644
index c5bcaf0c017..00000000000
--- a/contrib/jcr-server/server/src/java/org/apache/jackrabbit/server/simple/dav/NodeResource.java
+++ /dev/null
@@ -1,279 +0,0 @@
-/*
- * 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.server.simple.dav;
-
-import org.apache.log4j.Logger;
-import org.apache.jackrabbit.webdav.util.Text;
-
-import javax.jcr.*;
-import java.util.Date;
-import java.util.Locale;
-import java.io.*;
-import java.text.SimpleDateFormat;
-
-/**
- * The NodeResource
class wraps a jcr item in order to respond
- * to 'GET', 'HEAD', 'PROPFIND' or 'PROPPATCH' requests. If the item is a
- * {@link javax.jcr.Node} its primary property is determined. The value of the
- * primary property can be accessed by {@link #getStream()}. If possible other
- * required information (last modification date, content type...) is retrieved
- * from the property siblings.
- * If the requested item is a {@link javax.jcr.Property} it is treated accordingly.
- */
-public class NodeResource {
-
- /** the default logger */
- private static final Logger log = Logger.getLogger(NodeResource.class);
-
- /**
- * modificationDate date format per RFC 1123
- */
- public static SimpleDateFormat modificationDateFormat =
- new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss zzz", Locale.US);
-
- /**
- * Simple date format for the creation date ISO representation (partial).
- */
- public static SimpleDateFormat creationDateFormat =
- new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'");
-
- private static final String PROP_MIMETYPE = "jcr:mimeType";
- private static final String PROP_ENCODING = "jcr:encoding";
- private static final String PROP_LASTMODIFIED = "jcr:lastModified";
- private static final String PROP_CREATED = "jcr:created";
-
- private long creationTime = 0;
- private long modificationTime = new Date().getTime();
- private long contentLength = 0;
- private String contentType = null;
- private InputStream in = null;
-
- /**
- * Create a new NodeResource
that wraps a JSR170 item.
- *
- * @throws ItemNotFoundException
- * @throws RepositoryException
- * @throws IllegalArgumentException if the given item is null
- */
- public NodeResource(DavResourceImpl davResource, Node node) throws ItemNotFoundException, RepositoryException {
- try {
- if (davResource.isCollection()) {
- createDirListingContent(node);
- } else {
- if (node.hasProperty(PROP_CREATED)) {
- creationTime = node.getProperty(PROP_CREATED).getValue().getLong();
- }
- Node content = node.getPrimaryNodeType().getName().equals("nt:file")
- ? node.getNode("jcr:content")
- : node;
- if (content.getPrimaryNodeType().getName().equals("nt:resource")) {
- createPlainFileContent(content);
- } else {
- createDocViewContent(content);
- }
- }
- } catch (IOException e) {
- // ignore
- }
- }
-
- private void createPlainFileContent(Node content) throws IOException, RepositoryException {
- if (content.hasProperty(PROP_LASTMODIFIED)) {
- modificationTime = content.getProperty(PROP_LASTMODIFIED).getLong();
- }
- if (content.hasProperty(PROP_MIMETYPE)) {
- contentType = content.getProperty(PROP_MIMETYPE).getString();
- }
- if (content.hasProperty(PROP_ENCODING)) {
- String encoding = content.getProperty(PROP_ENCODING).getString();
- if (!encoding.equals("")) {
- contentType+="; charset=\"" + encoding + "\"";
- }
- }
- if (content.hasProperty("jcr:data")) {
- Property p = content.getProperty("jcr:data");
- contentLength = p.getLength();
- in = p.getStream();
- } else {
- contentLength = 0;
- }
- }
-
- private void createDocViewContent(Node node) throws IOException, RepositoryException {
- File tmpfile = File.createTempFile("__webdav", ".xml");
- FileOutputStream out = new FileOutputStream(tmpfile);
- node.getSession().exportDocView(node.getPath(), out, true, false);
- out.close();
- in = new FileInputStream(tmpfile);
- contentLength = tmpfile.length();
- modificationTime = tmpfile.lastModified();
- contentType = "text/xml";
- tmpfile.deleteOnExit();
- }
-
- private void createSysViewContent(Node node) throws IOException, RepositoryException {
- File tmpfile = File.createTempFile("__webdav", ".xml");
- FileOutputStream out = new FileOutputStream(tmpfile);
- node.getSession().exportSysView(node.getPath(), out, true, false);
- out.close();
- in = new FileInputStream(tmpfile);
- contentLength = tmpfile.length();
- modificationTime = tmpfile.lastModified();
- contentType = "text/xml";
- tmpfile.deleteOnExit();
- }
-
- private void createDirListingContent(Node node) throws IOException, RepositoryException {
- File tmpfile = File.createTempFile("__webdav", ".xml");
- FileOutputStream out = new FileOutputStream(tmpfile);
-
- String repName = node.getSession().getRepository().getDescriptor(Repository.REP_NAME_DESC);
- String repURL = node.getSession().getRepository().getDescriptor(Repository.REP_VENDOR_URL_DESC);
- String repVersion = node.getSession().getRepository().getDescriptor(Repository.REP_VERSION_DESC);
- PrintWriter writer = new PrintWriter(out);
- writer.print("");
- writer.print(node.getPath());
- writer.print("
");
- writer.print("
Powered by ");
- writer.print(repName);
- writer.print(" version ");
- writer.print(repVersion);
- writer.print("");
-
- writer.close();
- out.close();
- in = new FileInputStream(tmpfile);
- contentLength = tmpfile.length();
- modificationTime = tmpfile.lastModified();
- contentType = "text/html";
- tmpfile.deleteOnExit();
- }
-
- /**
- * Return the content length or '0'.
- * @return content Length or '0' if it could not be determined.
- */
- public long getContentLength() {
- return contentLength;
- }
-
- /**
- * Return the creation time or '0'.
- *
- * @return creation time or '0' if it could not be determined.
- */
- public long getCreationTime() {
- return creationTime;
- }
-
- /**
- * Return the last modification time. By default it is set to the current
- * time.
- *
- * @return time of last modification or the current time, if it could not
- * be determined.
- */
- public long getModificationTime() {
- return modificationTime;
- }
-
- /**
- * Return the last modification time as formatted string.
- *
- * @return last modification time as string.
- * @see NodeResource#modificationDateFormat
- */
- public String getLastModified() {
- if (modificationTime >= 0) {
- return modificationDateFormat.format(new Date(modificationTime));
- } else {
- return null;
- }
- }
-
- /**
- * Return the creation time as formatted string.
- *
- * @return creation time as string.
- * @see NodeResource#creationDateFormat
- */
- public String getCreationDate() {
- if (creationTime >= 0) {
- return creationDateFormat.format(new Date(creationTime));
- } else {
- return null;
- }
- }
-
- /**
- * Return the weak ETag
- *
- * @return weak ETag
- */
- public String getETag() {
- return "W/\"" + this.contentLength + "-" + this.modificationTime + "\"";
- }
-
- /**
- * Return the strong ETag or empty string if it cannot be determined.
- *
- * @return strong ETag
- */
- public String getStrongETag() {
- return "";
- }
-
- /**
- * Return the content type or null
if it could not be determined.
- *
- * @return content type
- */
- public String getContentType() {
- return contentType;
- }
-
- /**
- * Return a stream to the resource value.
- *
- * @return
- */
- public InputStream getStream() {
- return in;
- }
-}
diff --git a/contrib/jcr-server/server/src/java/org/apache/jackrabbit/server/simple/dav/ResourceFactoryImpl.java b/contrib/jcr-server/server/src/java/org/apache/jackrabbit/server/simple/dav/ResourceFactoryImpl.java
deleted file mode 100644
index e7cdb6d6d15..00000000000
--- a/contrib/jcr-server/server/src/java/org/apache/jackrabbit/server/simple/dav/ResourceFactoryImpl.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * 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.server.simple.dav;
-
-import org.apache.jackrabbit.webdav.*;
-import org.apache.jackrabbit.webdav.lock.LockManager;
-
-/**
- * ResourceFactoryImpl implements a simple DavResourceFactory
- */
-public class ResourceFactoryImpl implements DavResourceFactory {
-
- private final LockManager lockMgr;
-
- public ResourceFactoryImpl(LockManager lockMgr) {
- this.lockMgr = lockMgr;
- }
-
- public DavResource createResource(DavResourceLocator locator, DavServletRequest request,
- DavServletResponse response) throws DavException {
- return createResource(locator, request.getDavSession());
- }
-
- public DavResource createResource(DavResourceLocator locator, DavSession session) throws DavException {
- DavResource res = new DavResourceImpl(locator, this, session);
- res.addLockManager(lockMgr);
- return res;
- }
-}
diff --git a/contrib/jcr-server/server/src/java/org/apache/jackrabbit/server/simple/dav/lock/SimpleLockManager.java b/contrib/jcr-server/server/src/java/org/apache/jackrabbit/server/simple/dav/lock/SimpleLockManager.java
deleted file mode 100644
index 02232ca1a4b..00000000000
--- a/contrib/jcr-server/server/src/java/org/apache/jackrabbit/server/simple/dav/lock/SimpleLockManager.java
+++ /dev/null
@@ -1,197 +0,0 @@
-/*
- * 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.server.simple.dav.lock;
-
-import java.util.HashMap;
-import java.util.Iterator;
-
-import org.apache.jackrabbit.webdav.lock.*;
-import org.apache.jackrabbit.webdav.*;
-import org.apache.jackrabbit.webdav.util.Text;
-
-/**
- * Simple manager for webdav locks.
- * NOTE: the timeout requested is always replace by a infinite timeout and
- * expiration of locks is not checked.
- */
-public class SimpleLockManager implements LockManager {
-
- /** map of locks */
- private HashMap locks = new HashMap();
-
- /**
- *
- * @param lockToken
- * @param resource
- * @return
- * @see LockManager#hasLock(String, org.apache.jackrabbit.webdav.DavResource)
- */
- public boolean hasLock(String lockToken, DavResource resource) {
- ActiveLock lock = (ActiveLock) locks.get(resource.getResourcePath());
- if (lock != null && lock.getToken().equals(lockToken)) {
- return true;
- }
- return false;
- }
-
- /**
- * Returns the lock applying to the given resource or null
if
- * no lock can be found.
- *
- * @param type
- * @param scope
- * @param resource
- * @return lock that applies to the given resource or null
.
- */
- public ActiveLock getLock(Type type, Scope scope, DavResource resource) {
- if (!(Type.WRITE.equals(type) && Scope.EXCLUSIVE.equals(scope))) {
- return null;
- }
- String key = resource.getResourcePath();
- ActiveLock lock = (locks.containsKey(key)) ? (ActiveLock)locks.get(key) : null;
-
- // look for an inherited lock
- if (lock == null) {
- // cut path instead of retrieving the parent resource
- String parentPath = Text.getRelativeParent(key, 1);
- boolean found = false;
- /* stop as soon as parent lock is found:
- if the lock is deep or the parent is a collection the lock
- applies to the given resource. */
- while (!"/".equals(parentPath) && !(found = locks.containsKey(parentPath))) {
- parentPath = Text.getRelativeParent(parentPath, 1);
- }
- if (found) {
- ActiveLock parentLock = (ActiveLock)locks.get(parentPath);
- if (parentLock.isDeep()) {
- lock = parentLock;
- }
- }
- }
- // since locks have infinite timeout, check for expired lock is omitted.
- return lock;
- }
-
- /**
- * Adds the lock for the given resource, replacing any existing lock.
- *
- * @param lockInfo
- * @param resource being the lock holder
- */
- public synchronized ActiveLock createLock(LockInfo lockInfo, DavResource resource)
- throws DavException {
- if (lockInfo == null || resource == null) {
- throw new IllegalArgumentException("Neither lockInfo nor resource must be null.");
- }
-
- String resourcePath = resource.getResourcePath();
- // test if there is already a lock present on this resource
- if (locks.containsKey(resourcePath)) {
- throw new DavException(DavServletResponse.SC_LOCKED, "Resource '" + resource.getResourcePath() + "' already holds a lock.");
- }
- // test if the new lock would conflict with any lock inherited from the
- // collection or with a lock present on any member resource.
- Iterator it = locks.keySet().iterator();
- while (it.hasNext()) {
- String key = (String) it.next();
- // TODO: is check for lock on internal-member correct?
- if (Text.isDescendant(key, resourcePath)) {
- ActiveLock l = (ActiveLock) locks.get(key);
- if (l.isDeep() || (key.equals(Text.getRelativeParent(resourcePath, 1)) && !resource.isCollection())) {
- throw new DavException(DavServletResponse.SC_LOCKED, "Resource '" + resource.getResourcePath() + "' already inherits a lock by its collection.");
- }
- } else if (Text.isDescendant(resourcePath, key)) {
- if (lockInfo.isDeep() || isInternalMember(resource, key)) {
- throw new DavException(DavServletResponse.SC_LOCKED, "Resource '" + resource.getResourcePath() + "' cannot be locked due to a lock present on a member resource '" + key + "'.");
- }
-
- }
- }
- ActiveLock lock = new DefaultActiveLock(lockInfo);
- // Lazy: reset the timeout to 'Infinite', in order to omit the tests for
- // lock expiration.
- lock.setTimeout(DavConstants.INFINITE_TIMEOUT);
- locks.put(resource.getResourcePath(), lock);
- return lock;
- }
-
- /**
- *
- * @param lockInfo
- * @param lockToken
- * @param resource
- * @return
- * @throws DavException
- * @see DavResource#refreshLock(org.apache.jackrabbit.webdav.lock.LockInfo, String)
- */
- public ActiveLock refreshLock(LockInfo lockInfo, String lockToken, DavResource resource)
- throws DavException {
- // timeout is always infinite > no test for expiration or adjusting timeout needed.
- ActiveLock lock = (ActiveLock)locks.get(resource.getResourcePath());
- if (lock == null) {
- throw new DavException(DavServletResponse.SC_PRECONDITION_FAILED);
- } else if (!lock.getToken().equals(lockToken)) {
- throw new DavException(DavServletResponse.SC_LOCKED);
- }
- return lock;
- }
-
- /**
- * Remove the lock hold by the given resource.
- *
- * @param lockToken
- * @param resource that is the lock holder
- */
- public synchronized void releaseLock(String lockToken, DavResource resource)
- throws DavException {
- if (!locks.containsKey(resource.getResourcePath())) {
- throw new DavException(DavServletResponse.SC_PRECONDITION_FAILED);
- }
- // since locks have infinite timeout, check for expiration is omitted.
-
- ActiveLock lock = (ActiveLock) locks.get(resource.getResourcePath());
- if (lock.getToken().equals(lockToken)) {
- locks.remove(resource.getResourcePath());
- } else {
- throw new DavException(DavServletResponse.SC_LOCKED);
- }
- }
-
- /**
- * Return true, if the resource with the given memberPath is a internal
- * non-collection member of the given resource, thus affected by a
- * non-deep lock present on the resource.
- *
- * @param resource
- * @param memberPath
- * @return
- */
- private static boolean isInternalMember(DavResource resource, String memberPath) {
- if (resource.getResourcePath().equals(Text.getRelativeParent(memberPath, 1))) {
- // find the member with the given path
- DavResourceIterator it = resource.getMembers();
- while (it.hasNext()) {
- DavResource member = it.nextResource();
- if (member.getResourcePath().equals(memberPath)) {
- // return true if that member is not a collection
- return !member.isCollection();
- }
- }
- }
- return false;
- }
-}
-
diff --git a/contrib/jcr-server/server/src/java/org/apache/jackrabbit/webdav/spi/AbstractItemResource.java b/contrib/jcr-server/server/src/java/org/apache/jackrabbit/webdav/spi/AbstractItemResource.java
deleted file mode 100644
index c6201ccb9c2..00000000000
--- a/contrib/jcr-server/server/src/java/org/apache/jackrabbit/webdav/spi/AbstractItemResource.java
+++ /dev/null
@@ -1,363 +0,0 @@
-/*
- * 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.spi;
-
-import org.apache.log4j.Logger;
-import org.apache.jackrabbit.webdav.property.*;
-import org.apache.jackrabbit.webdav.*;
-import org.apache.jackrabbit.webdav.spi.search.SearchResourceImpl;
-import org.apache.jackrabbit.webdav.spi.version.report.NodeTypesReport;
-import org.apache.jackrabbit.webdav.spi.version.report.ExportViewReport;
-import org.apache.jackrabbit.webdav.spi.version.report.LocateByUuidReport;
-import org.apache.jackrabbit.webdav.spi.version.report.RegisteredNamespacesReport;
-import org.apache.jackrabbit.webdav.DavResource;
-import org.apache.jackrabbit.webdav.transaction.TxLockEntry;
-import org.apache.jackrabbit.webdav.version.report.SupportedReportSetProperty;
-import org.apache.jackrabbit.webdav.version.report.ReportType;
-import org.apache.jackrabbit.webdav.search.*;
-import org.apache.jackrabbit.webdav.util.Text;
-
-import javax.jcr.*;
-
-/**
- * AbstractItemResource
covers common functionality for the various
- * resources, that represent a repository item.
- */
-abstract class AbstractItemResource extends AbstractResource implements
- SearchResource, ItemResourceConstants {
-
- private static Logger log = Logger.getLogger(AbstractItemResource.class);
-
- protected final Item item;
-
- /**
- * Create a new AbstractItemResource
.
- *
- * @param locator
- * @param session
- */
- AbstractItemResource(DavResourceLocator locator, DavSession session, DavResourceFactory factory) {
- super(locator, session, factory);
- Item repositoryItem = null;
- if (locator != null) {
- try {
- repositoryItem = getRepositorySession().getItem(locator.getResourcePath());
- } catch (RepositoryException e) {
- // ignore: exists field evaluates to false
- log.info(e.getMessage());
- }
- }
- item = repositoryItem;
- }
-
- //----------------------------------------------< DavResource interface >---
- /**
- * @see org.apache.jackrabbit.webdav.DavResource#getComplianceClass()
- */
- public String getComplianceClass() {
- return ItemResourceConstants.COMPLIANCE_CLASS;
- }
-
- /**
- * @see org.apache.jackrabbit.webdav.DavResource#getSupportedMethods()
- */
- public String getSupportedMethods() {
- return ItemResourceConstants.METHODS;
- }
-
- /**
- * Returns true if there exists a {@link Item repository item} with the given
- * resource path, false otherwise.
- *
- * @see DavResource#exists()
- */
- public boolean exists() {
- return item != null;
- }
-
- /**
- * @see DavResource#getDisplayName() )
- */
- public String getDisplayName() {
- String name = null;
- if (exists()) {
- try {
- name = item.getName();
- } catch (RepositoryException e) {
- // ignore: should not occure
- log.warn(e.getMessage());
- }
- }
- String resPath = getResourcePath();
- if (name == null && resPath != null) {
- int pos = resPath.lastIndexOf('/');
- if (pos>=0) {
- name = resPath.substring(pos+1);
- } else {
- name = resPath;
- }
- // note: since index info is present only with existing resources
- // there is no need to check for any '[index]' suffix.
- }
- return name;
- }
-
- /**
- * Returns the resource representing the parent item of the repository item
- * represented by this resource. If this resoure represents the root item
- * a {@link RootCollection} is returned.
- *
- * @return the collection this resource is internal member of. Except for the
- * repository root, the returned collection always represent the parent
- * repository node.
- * @see DavResource#getCollection()
- */
- public DavResource getCollection() {
- DavResource collection = null;
-
- String resourcePath = getResourcePath();
- // No special treatment for the root-item needed, because this is
- // covered by the RootItemCollection itself.
- String parentResourcePath = Text.getRelativeParent(resourcePath, 1);
- String parentWorkspacePath = getLocator().getWorkspacePath();
-
- DavResourceLocator parentLoc = getLocator().getFactory().createResourceLocator(getLocator().getPrefix(), parentWorkspacePath, parentResourcePath);
- try {
- collection = createResourceFromLocator(parentLoc);
- } catch (DavException e) {
- log.error("Unexpected error while retrieving collection: " + e.getMessage());
- }
-
- return collection;
- }
-
- /**
- * Moves the underlaying repository item to the indicated destination.
- *
- * @param destination
- * @throws DavException
- * @see DavResource#move(DavResource)
- * @see Session#move(String, String)
- */
- public void move(DavResource destination) throws DavException {
- if (!exists()) {
- throw new DavException(DavServletResponse.SC_NOT_FOUND);
- }
- DavResourceLocator destPath = destination.getLocator();
- if (!getLocator().isSameWorkspace(destPath)) {
- throw new DavException(DavServletResponse.SC_FORBIDDEN);
- }
-
- try {
- getRepositorySession().move(getResourcePath(), destination.getResourcePath());
- complete();
-
- } catch (PathNotFoundException e) {
- // according to rfc 2518
- throw new DavException(DavServletResponse.SC_CONFLICT, e.getMessage());
- } catch (RepositoryException e) {
- throw new JcrDavException(e);
- }
- }
-
- /**
- * Copies the underlaying repository item to the indicated destination. If
- * the locator of the specified destination resource indicates a different
- * workspace, {@link Workspace#copy(String, String, String)} is used to perform
- * the copy operation, {@link Workspace#copy(String, String)} otherwise.
- *
- * Note, that this implementation does not support shallow copy.
- *
- * @param destination
- * @param shallow
- * @throws DavException
- * @see DavResource#copy(DavResource, boolean)
- * @see Workspace#copy(String, String)
- * @see Workspace#copy(String, String, String)
- */
- public void copy(DavResource destination, boolean shallow) throws DavException {
- if (!exists()) {
- throw new DavException(DavServletResponse.SC_NOT_FOUND);
- }
- // TODO: support shallow and deep copy is required by RFC 2518
- if (shallow) {
- throw new DavException(DavServletResponse.SC_FORBIDDEN, "Unable to perform shallow copy.");
- }
-
- if (!(destination instanceof AbstractItemResource)) {
- throw new DavException(DavServletResponse.SC_FORBIDDEN, "Cannot copy a resource that does not represent a repository item.");
- }
-
- try {
- AbstractItemResource destResource = (AbstractItemResource) destination;
- String destResourcePath = destResource.getResourcePath();
- Workspace workspace = getRepositorySession().getWorkspace();
- if (getLocator().isSameWorkspace(destination.getLocator())) {
- workspace.copy(getResourcePath(), destResourcePath);
- } else {
- Workspace destWorkspace = destResource.getRepositorySession().getWorkspace();
- destWorkspace.copy(workspace.getName(), getResourcePath(), destResourcePath);
- }
- } catch (PathNotFoundException e) {
- // according to RFC 2518, should not occur
- throw new DavException(DavServletResponse.SC_NOT_FOUND, e.getMessage());
- } catch (RepositoryException e) {
- throw new JcrDavException(e);
- }
- }
-
- //-------------------------------------------< SearchResource interface >---
- /**
- * @return
- * @see org.apache.jackrabbit.webdav.search.SearchResource#getQueryGrammerSet()
- */
- public QueryGrammerSet getQueryGrammerSet() {
- return new SearchResourceImpl(getLocator(), getSession()).getQueryGrammerSet();
- }
-
- /**
- * @param sRequest
- * @return
- * @throws DavException
- * @see SearchResource#search(org.apache.jackrabbit.webdav.search.SearchRequest)
- */
- public MultiStatus search(SearchRequest sRequest) throws DavException {
- return new SearchResourceImpl(getLocator(), getSession()).search(sRequest);
- }
-
- //--------------------------------------------------------------------------
- /**
- * Initialize the {@link org.apache.jackrabbit.webdav.lock.SupportedLock} property
- * with entries that are valid for any type item resources.
- *
- * @see org.apache.jackrabbit.webdav.lock.SupportedLock
- * @see org.apache.jackrabbit.webdav.transaction.TxLockEntry
- * @see AbstractResource#initLockSupport()
- */
- protected void initLockSupport() {
- if (exists()) {
- // add supportedlock entries for local and eventually for global transaction locks
- supportedLock.addEntry(new TxLockEntry(true));
- supportedLock.addEntry(new TxLockEntry(false));
- }
- }
-
- /**
- * Define the set of reports supported by this resource.
- *
- * @see org.apache.jackrabbit.webdav.version.report.SupportedReportSetProperty
- * @see AbstractResource#initSupportedReports()
- */
- protected void initSupportedReports() {
- if (exists()) {
- supportedReports = new SupportedReportSetProperty(new ReportType[] {
- ReportType.EXPAND_PROPERTY,
- NodeTypesReport.NODETYPES_REPORT,
- ExportViewReport.EXPORTVIEW_REPORT,
- LocateByUuidReport.LOCATE_BY_UUID_REPORT,
- RegisteredNamespacesReport.REGISTERED_NAMESPACES_REPORT
- });
- }
- }
-
- /**
- * Fill the property set for this resource.
- */
- protected void initProperties() {
- super.initProperties();
- if (exists()) {
- try {
- properties.add(new DefaultDavProperty(JCR_NAME, item.getName()));
- properties.add(new DefaultDavProperty(JCR_PATH, item.getPath()));
- properties.add(new DefaultDavProperty(JCR_DEPTH, String.valueOf(item.getDepth())));
- } catch (RepositoryException e) {
- log.error("Error while accessing jcr properties: " + e.getMessage());
- }
-
- // transaction resource additional protected properties
- if (item.isNew()) {
- properties.add(new DefaultDavProperty(JCR_ISNEW, null, true));
- } else if (item.isModified()) {
- properties.add(new DefaultDavProperty(JCR_ISMODIFIED, null, true));
- }
- }
- }
-
- /**
- * @return href of the workspace or null
if this resource
- * does not represent a repository item.
- *
- * @see AbstractResource#getWorkspaceHref()
- */
- protected String getWorkspaceHref() {
- String workspaceHref = null;
- DavResourceLocator locator = getLocator();
- if (locator != null && locator.getWorkspaceName() != null) {
- workspaceHref = locator.getHref(isCollection());
- if (locator.getResourcePath() != null) {
- workspaceHref = workspaceHref.substring(workspaceHref.indexOf(locator.getResourcePath()));
- }
- }
- log.info(workspaceHref);
- return workspaceHref;
- }
-
- /**
- * If this resource exists but does not contain a transaction id, complete
- * will try to persist any modifications prsent on the underlaying repository
- * item.
- *
- * @throws DavException if calling {@link Item#save()} fails
- */
- void complete() throws DavException {
- if (exists() && getTransactionId() == null) {
- try {
- if (item.isModified()) {
- item.save();
- }
- } catch (RepositoryException e) {
- // this includes LockException, ConstraintViolationException etc. not detected before
- log.error("Error while completing request: " + e.getMessage() +" -> reverting changes.");
- try {
- item.refresh(false);
- } catch (RepositoryException re) {
- log.error("Error while reverting changes: " + re.getMessage());
- }
- throw new JcrDavException(e);
- }
- }
- }
-
- /**
- * Build a new {@link DavResourceLocator} from the given repository item.
- *
- * @param repositoryItem
- * @return a new locator for the specified item.
- * @see #getLocatorFromResourcePath(String)
- */
- protected DavResourceLocator getLocatorFromItem(Item repositoryItem) {
- String itemPath = null;
- try {
- if (repositoryItem != null) {
- itemPath = repositoryItem.getPath();
- }
- } catch (RepositoryException e) {
- // ignore: should not occur
- log.warn(e.getMessage());
- }
- return getLocatorFromResourcePath(itemPath);
- }
-}
\ No newline at end of file
diff --git a/contrib/jcr-server/server/src/java/org/apache/jackrabbit/webdav/spi/AbstractResource.java b/contrib/jcr-server/server/src/java/org/apache/jackrabbit/webdav/spi/AbstractResource.java
deleted file mode 100644
index 903a4811ebd..00000000000
--- a/contrib/jcr-server/server/src/java/org/apache/jackrabbit/webdav/spi/AbstractResource.java
+++ /dev/null
@@ -1,648 +0,0 @@
-/*
- * 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.spi;
-
-import org.apache.log4j.Logger;
-import org.apache.jackrabbit.webdav.*;
-import org.apache.jackrabbit.webdav.transaction.TransactionResource;
-import org.apache.jackrabbit.webdav.transaction.TransactionInfo;
-import org.apache.jackrabbit.webdav.transaction.TransactionConstants;
-import org.apache.jackrabbit.webdav.transaction.TxLockManager;
-import org.apache.jackrabbit.webdav.spi.transaction.TxLockManagerImpl;
-import org.apache.jackrabbit.webdav.observation.*;
-import org.apache.jackrabbit.webdav.util.Text;
-import org.apache.jackrabbit.webdav.version.*;
-import org.apache.jackrabbit.webdav.version.report.Report;
-import org.apache.jackrabbit.webdav.version.report.ReportInfo;
-import org.apache.jackrabbit.webdav.version.report.ReportType;
-import org.apache.jackrabbit.webdav.version.report.SupportedReportSetProperty;
-import org.apache.jackrabbit.webdav.lock.*;
-import org.apache.jackrabbit.webdav.property.*;
-import org.apache.jackrabbit.webdav.property.ResourceType;
-
-import javax.jcr.Session;
-import java.io.InputStream;
-import java.util.*;
-
-/**
- * AbstractResource
provides functionality common to all
- * resources.
- */
-abstract class AbstractResource implements DavResource, ObservationResource,
- TransactionResource, DeltaVResource {
-
- private static Logger log = Logger.getLogger(AbstractResource.class);
-
- private final DavResourceLocator locator;
- private final DavSession session;
- private final DavResourceFactory factory;
-
- private SubscriptionManager subsMgr;
- private TxLockManagerImpl txMgr;
- private String transactionId;
-
- private long modificationTime = DavResource.UNDEFINED_MODIFICATIONTIME;
-
- protected boolean initedProps;
- protected DavPropertySet properties = new DavPropertySet();
- protected SupportedLock supportedLock = new SupportedLock();
- protected SupportedReportSetProperty supportedReports = new SupportedReportSetProperty();
-
- /**
- * Create a new AbstractResource
- *
- * @param locator
- * @param session
- */
- AbstractResource(DavResourceLocator locator, DavSession session, DavResourceFactory factory) {
- if (session == null) {
- throw new IllegalArgumentException("Creating AbstractItemResource: DavSession must not be null.");
- }
-
- this.locator = locator;
- this.session = session;
- this.factory = factory;
-
- // initialize the supported locks and reports
- initLockSupport();
- initSupportedReports();
- }
-
- /**
- * @see org.apache.jackrabbit.webdav.DavResource#getLocator()
- */
- public DavResourceLocator getLocator() {
- return locator;
- }
-
- /**
- * Returns the path of the underlaying repository item or the item to
- * be created (PUT/MKCOL). If the resource exists but does not represent
- * a repository item null
is returned.
- *
- * @return path of the underlaying repository item.
- * @see DavResource#getResourcePath()
- * @see org.apache.jackrabbit.webdav.DavResourceLocator#getResourcePath()
- */
- public String getResourcePath() {
- return locator.getResourcePath();
- }
-
- /**
- * @see DavResource#getHref()
- * @see DavResourceLocator#getHref(boolean)
- */
- public String getHref() {
- return locator.getHref(true);
- }
-
- /**
- * @see org.apache.jackrabbit.webdav.DavResource#getModificationTime()
- */
- public long getModificationTime() {
- return modificationTime;
- }
-
- /**
- * Set the modificationTime field and adds the {@link DavPropertyName.GETLASTMODIFIED}
- * property to the set of properties.
- * @param modificationTime
- */
- void setModificationTime(long modificationTime) {
- this.modificationTime = modificationTime;
- if (this.modificationTime >= 0) {
- properties.add(new DefaultDavProperty(DavPropertyName.GETLASTMODIFIED,
- DavConstants.modificationDateFormat.format(new Date(modificationTime))));
- }
- }
-
- /**
- * Returns null
- *
- * @return Always returns null
- * @see org.apache.jackrabbit.webdav.DavResource#getStream()
- */
- public InputStream getStream() {
- return null;
- }
-
- /**
- * @see org.apache.jackrabbit.webdav.DavResource#getPropertyNames()
- */
- public DavPropertyName[] getPropertyNames() {
- return getProperties().getPropertyNames();
- }
-
- /**
- * @see org.apache.jackrabbit.webdav.DavResource#getProperty(org.apache.jackrabbit.webdav.property.DavPropertyName)
- */
- public DavProperty getProperty(DavPropertyName name) {
- return getProperties().get(name);
- }
-
- /**
- * @see org.apache.jackrabbit.webdav.DavResource#getProperties()
- */
- public DavPropertySet getProperties() {
- if (!initedProps) {
- initProperties();
- }
- return properties;
- }
-
- /**
- * Throws {@link DavServletResponse#SC_METHOD_NOT_ALLOWED}
- *
- * @param property
- * @throws DavException Always throws {@link DavServletResponse#SC_METHOD_NOT_ALLOWED}
- * @see org.apache.jackrabbit.webdav.DavResource#setProperty(org.apache.jackrabbit.webdav.property.DavProperty)
- */
- public void setProperty(DavProperty property) throws DavException {
- throw new DavException(DavServletResponse.SC_METHOD_NOT_ALLOWED);
- }
-
- /**
- * Throws {@link DavServletResponse#SC_METHOD_NOT_ALLOWED}
- *
- * @param propertyName
- * @throws DavException Always throws {@link DavServletResponse#SC_METHOD_NOT_ALLOWED}
- * @see org.apache.jackrabbit.webdav.DavResource#removeProperty(org.apache.jackrabbit.webdav.property.DavPropertyName)
- */
- public void removeProperty(DavPropertyName propertyName) throws DavException {
- throw new DavException(DavServletResponse.SC_METHOD_NOT_ALLOWED);
- }
-
- /**
- * Throws {@link DavServletResponse#SC_METHOD_NOT_ALLOWED}
- *
- * @param destination
- * @throws DavException Always throws {@link DavServletResponse#SC_METHOD_NOT_ALLOWED}
- * @see DavResource#move(org.apache.jackrabbit.webdav.DavResource)
- */
- public void move(DavResource destination) throws DavException {
- throw new DavException(DavServletResponse.SC_METHOD_NOT_ALLOWED);
- }
-
- /**
- * Throws {@link DavServletResponse#SC_METHOD_NOT_ALLOWED}
- *
- * @param destination
- * @param shallow
- * @throws DavException Always throws {@link DavServletResponse#SC_METHOD_NOT_ALLOWED}
- * @see DavResource#copy(org.apache.jackrabbit.webdav.DavResource, boolean)
- */
- public void copy(DavResource destination, boolean shallow) throws DavException {
- throw new DavException(DavServletResponse.SC_METHOD_NOT_ALLOWED);
- }
-
-
- /**
- * Returns true, if the {@link SupportedLock} property contains an entry
- * with the given type and scope. By default resources allow for {@link org.apache.jackrabbit.webdav.transaction.TransactionConstants.XML_TRANSACTION
- * transaction} lock only.
- *
- * @param type
- * @param scope
- * @return true if this resource may be locked by the given type and scope.
- * @see DavResource#isLockable(org.apache.jackrabbit.webdav.lock.Type, org.apache.jackrabbit.webdav.lock.Scope)
- */
- public boolean isLockable(Type type, Scope scope) {
- return supportedLock.isSupportedLock(type, scope);
- }
-
- /**
- * Returns true if this resource has a lock applied with the given type and scope.
- *
- * @param type
- * @param scope
- * @return true if this resource has a lock applied with the given type and scope.
- * @see DavResource#hasLock(Type, Scope)
- */
- public boolean hasLock(Type type, Scope scope) {
- return getLock(type, scope) != null;
- }
-
- /**
- * @see DavResource#getLock(Type, Scope)
- */
- public ActiveLock getLock(Type type, Scope scope) {
- ActiveLock lock = null;
- if (TransactionConstants.TRANSACTION.equals(type)) {
- lock = txMgr.getLock(type, scope, this);
- }
- return lock;
- }
-
- /**
- * @see DavResource#getLocks()
- * todo improve....
- */
- public ActiveLock[] getLocks() {
- List locks = new ArrayList();
- // tx locks
- ActiveLock l = getLock(TransactionConstants.TRANSACTION, TransactionConstants.LOCAL);
- if (l != null) {
- locks.add(l);
- }
- l = getLock(TransactionConstants.TRANSACTION, TransactionConstants.GLOBAL);
- if (l != null) {
- locks.add(l);
- }
- // write lock (either exclusive or session-scoped).
- l = getLock(Type.WRITE, Scope.EXCLUSIVE);
- if (l != null) {
- locks.add(l);
- } else {
- l = getLock(Type.WRITE, ItemResourceConstants.EXCLUSIVE_SESSION);
- if (l != null) {
- locks.add(l);
- }
- }
- return (ActiveLock[]) locks.toArray(new ActiveLock[locks.size()]);
- }
-
- /**
- * @see DavResource#lock(org.apache.jackrabbit.webdav.lock.LockInfo)
- */
- public ActiveLock lock(LockInfo reqLockInfo) throws DavException {
- if (isLockable(reqLockInfo.getType(), reqLockInfo.getScope())) {
- return txMgr.createLock(reqLockInfo, this);
- } else {
- throw new DavException(DavServletResponse.SC_PRECONDITION_FAILED);
- }
- }
-
- /**
- * Only transaction lock may be available on this resource.
- *
- * @param info
- * @param lockToken
- * @throws DavException
- * @see DavResource#refreshLock(org.apache.jackrabbit.webdav.lock.LockInfo, String)
- */
- public ActiveLock refreshLock(LockInfo info, String lockToken) throws DavException {
- return txMgr.refreshLock(info, lockToken, this);
- }
-
- /**
- * Throws {@link DavServletResponse#SC_METHOD_NOT_ALLOWED} since only transaction
- * locks may be present on this resource, that need to be released by calling
- * {@link TransactionResource#unlock(String, org.apache.jackrabbit.webdav.transaction.TransactionInfo)}.
- *
- * @param lockToken
- * @throws DavException Always throws {@link DavServletResponse#SC_METHOD_NOT_ALLOWED}
- */
- public void unlock(String lockToken) throws DavException {
- throw new DavException(DavServletResponse.SC_PRECONDITION_FAILED);
- }
-
- /**
- * @see DavResource#addLockManager(org.apache.jackrabbit.webdav.lock.LockManager)
- */
- public void addLockManager(LockManager lockMgr) {
- if (lockMgr instanceof TxLockManagerImpl) {
- txMgr = (TxLockManagerImpl) lockMgr;
- }
- }
-
- /**
- * @see org.apache.jackrabbit.webdav.DavResource#getFactory()
- */
- public DavResourceFactory getFactory() {
- return factory;
- }
-
- //--------------------------------------------------------------------------
- /**
- * @see org.apache.jackrabbit.webdav.transaction.TransactionResource#getSession()
- * @see org.apache.jackrabbit.webdav.observation.ObservationResource#getSession()
- */
- public DavSession getSession() {
- return session;
- }
-
- //--------------------------------------< ObservationResource interface >---
- /**
- * @see ObservationResource#init(SubscriptionManager)
- */
- public void init(SubscriptionManager subsMgr) {
- this.subsMgr = subsMgr;
- }
-
- /**
- * @see ObservationResource#subscribe(org.apache.jackrabbit.webdav.observation.SubscriptionInfo, String)
- * @see SubscriptionManager#subscribe(org.apache.jackrabbit.webdav.observation.SubscriptionInfo, String, org.apache.jackrabbit.webdav.observation.ObservationResource)
- */
- public Subscription subscribe(SubscriptionInfo info, String subscriptionId)
- throws DavException {
- return subsMgr.subscribe(info, subscriptionId, this);
- }
-
- /**
- * @see ObservationResource#unsubscribe(String)
- * @see SubscriptionManager#unsubscribe(String, org.apache.jackrabbit.webdav.observation.ObservationResource)
- */
- public void unsubscribe(String subscriptionId) throws DavException {
- subsMgr.unsubscribe(subscriptionId, this);
- }
-
- /**
- * @see ObservationResource#poll(String)
- * @see SubscriptionManager#poll(String, org.apache.jackrabbit.webdav.observation.ObservationResource)
- */
- public EventDiscovery poll(String subscriptionId) throws DavException {
- return subsMgr.poll(subscriptionId, this);
- }
-
- //--------------------------------------< TransactionResource interface >---
- /**
- * @see TransactionResource#init(TxLockManager, String)
- */
- public void init(TxLockManager txMgr, String transactionId) {
- this.txMgr = (TxLockManagerImpl) txMgr;
- this.transactionId = transactionId;
- }
-
- /**
- * @see TransactionResource#unlock(String, org.apache.jackrabbit.webdav.transaction.TransactionInfo)
- */
- public void unlock(String lockToken, TransactionInfo tInfo) throws DavException {
- txMgr.releaseLock(tInfo, lockToken, this);
- }
-
- /**
- * @see TransactionResource#getTransactionId()
- */
- public String getTransactionId() {
- return transactionId;
- }
-
- //-------------------------------------------< DeltaVResource interface >---
- /**
- * @param optionsInfo
- * @return object to be used in the OPTIONS response body or null
- * @see DeltaVResource#getOptionResponse(org.apache.jackrabbit.webdav.version.OptionsInfo)
- */
- public OptionsResponse getOptionResponse(OptionsInfo optionsInfo) {
- OptionsResponse oR = null;
- if (optionsInfo != null) {
- oR = new OptionsResponse();
- // currently on DAV:version-history-collection-set and
- // DAV:workspace-collection-set is supported.
- if (optionsInfo.containsElement(DeltaVConstants.XML_VH_COLLECTION_SET, DeltaVConstants.NAMESPACE)) {
- String[] hrefs = new String[] { getLocatorFromResourcePath(ItemResourceConstants.VERSIONSTORAGE_PATH).getHref(true)};
- oR.addEntry(DeltaVConstants.XML_VH_COLLECTION_SET, DeltaVConstants.NAMESPACE, hrefs);
- } else if (optionsInfo.containsElement(DeltaVConstants.XML_WSP_COLLECTION_SET, DeltaVConstants.NAMESPACE)) {
- // workspaces cannot be created anywhere.
- oR.addEntry(DeltaVConstants.XML_WSP_COLLECTION_SET, DeltaVConstants.NAMESPACE, new String[0]);
- }
- }
- return oR;
- }
-
- /**
- * @param reportInfo
- * @return the requested report
- * @throws DavException
- * @see DeltaVResource#getReport(org.apache.jackrabbit.webdav.version.report.ReportInfo)
- */
- public Report getReport(ReportInfo reportInfo) throws DavException {
- if (reportInfo == null) {
- throw new DavException(DavServletResponse.SC_BAD_REQUEST, "A REPORT request must provide a valid XML request body.");
- }
- if (!exists()) {
- throw new DavException(DavServletResponse.SC_NOT_FOUND);
- }
-
- if (supportedReports.isSupportedReport(reportInfo)) {
- try {
- Report report = ReportType.getType(reportInfo).createReport();
- report.setInfo(reportInfo);
- report.setResource(this);
- return report;
- } catch (IllegalArgumentException e) {
- // should never occur.
- throw new DavException(DavServletResponse.SC_INTERNAL_SERVER_ERROR, e.getMessage());
- }
- } else {
- throw new DavException(DavServletResponse.SC_UNPROCESSABLE_ENTITY, "Unkown report "+ reportInfo.getReportElement().getNamespacePrefix() + reportInfo.getReportElement().getName() +"requested.");
- }
- }
-
- /**
- * The JCR api does not provide methods to create new workspaces. Calling
- * addWorkspace
on this resource will always fail.
- *
- * @param workspace
- * @throws DavException Always throws.
- * @see DeltaVResource#addWorkspace(org.apache.jackrabbit.webdav.DavResource)
- */
- public void addWorkspace(DavResource workspace) throws DavException {
- throw new DavException(DavServletResponse.SC_FORBIDDEN);
- }
-
- /**
- * Return an array of DavResource
objects that are referenced
- * by the property with the specified name.
- *
- * @param hrefPropertyName
- * @return array of DavResource
s
- * @throws DavException
- * @see DeltaVResource#getReferenceResources(org.apache.jackrabbit.webdav.property.DavPropertyName)
- */
- public DavResource[] getReferenceResources(DavPropertyName hrefPropertyName) throws DavException {
- DavProperty prop = getProperty(hrefPropertyName);
- if (prop == null || !(prop instanceof HrefProperty)) {
- throw new DavException(DavServletResponse.SC_CONFLICT, "Unknown Href-Property '"+hrefPropertyName+"' on resource "+getResourcePath());
- }
-
- List hrefs = ((HrefProperty)prop).getHrefs();
- DavResource[] refResources = new DavResource[hrefs.size()];
- Iterator hrefIter = hrefs.iterator();
- int i = 0;
- while (hrefIter.hasNext()) {
- refResources[i] = getResourceFromHref((String)hrefIter.next());
- i++;
- }
- return refResources;
- }
-
- /**
- * Retrieve the DavResource
object that is represented by
- * the given href String.
- *
- * @param href
- * @return DavResource
object
- */
- private DavResource getResourceFromHref(String href) throws DavException {
- // build a new locator: remove trailing prefix
- DavResourceLocator locator = getLocator();
- String prefix = locator.getPrefix();
- if (href.startsWith(prefix)) {
- href = href.substring(prefix.length());
- }
- DavResourceLocator loc = locator.getFactory().createResourceLocator(prefix, href);
-
- // create a new resource object
- DavResource res;
- if (getRepositorySession().itemExists(loc.getResourcePath())) {
- res = createResourceFromLocator(loc);
- } else {
- throw new DavException(DavServletResponse.SC_NOT_FOUND);
- }
- return res;
- }
-
- //--------------------------------------------------------------------------
- /**
- * Fill the set of default properties
- */
- protected void initProperties() {
- if (getDisplayName() != null) {
- properties.add(new DefaultDavProperty(DavPropertyName.DISPLAYNAME, getDisplayName()));
- }
- if (isCollection()) {
- properties.add(new ResourceType(ResourceType.COLLECTION));
- // Windows XP support
- properties.add(new DefaultDavProperty(DavPropertyName.ISCOLLECTION, "1"));
- } else {
- properties.add(new ResourceType(ResourceType.DEFAULT_RESOURCE));
- // Windows XP support
- properties.add(new DefaultDavProperty(DavPropertyName.ISCOLLECTION, "0"));
- }
- // todo: add etag
-
- // default last modified
- setModificationTime(new Date().getTime());
- // default creation time
- properties.add(new DefaultDavProperty(DavPropertyName.CREATIONDATE, DavConstants.creationDateFormat.format(new Date(0))));
-
- // supported lock property
- properties.add(supportedLock);
-
- // set current lock information. If no lock is applied to this resource,
- // an empty lockdiscovery will be returned in the response.
- properties.add(new LockDiscovery(getLocks()));
-
- // observation resource
- SubscriptionDiscovery subsDiscovery = subsMgr.getSubscriptionDiscovery(this);
- properties.add(subsDiscovery);
-
- properties.add(new SupportedMethodSetProperty(getSupportedMethods().split(",\\s")));
-
- // DeltaV properties
- properties.add(supportedReports);
- // creator-displayname, comment: not value available from jcr
- properties.add(new DefaultDavProperty(DeltaVConstants.CREATOR_DISPLAYNAME, null, true));
- properties.add(new DefaultDavProperty(DeltaVConstants.COMMENT, null, true));
-
- // 'workspace' property as defined by RFC 3253
- String workspaceHref = getWorkspaceHref();
- if (workspaceHref != null) {
- properties.add(new HrefProperty(DeltaVConstants.WORKSPACE, workspaceHref, true));
- }
- // TODO: required supported-live-property-set
- }
-
- /**
- * Create a new DavResource
from the given locator.
- * @param loc
- * @return new DavResource
- */
- protected DavResource createResourceFromLocator(DavResourceLocator loc)
- throws DavException {
- DavResource res = factory.createResource(loc, session);
- if (res instanceof AbstractResource) {
- ((AbstractResource)res).transactionId = this.transactionId;
- }
- return res;
- }
-
- /**
- * Build a DavResourceLocator
from the given resource path.
- *
- * @param resourcePath
- * @return a new DavResourceLocator
- * @see DavLocatorFactory#createResourceLocator(String, String, String)
- */
- protected DavResourceLocator getLocatorFromResourcePath(String resourcePath) {
- DavResourceLocator loc = locator.getFactory().createResourceLocator(locator.getPrefix(), locator.getWorkspacePath(), resourcePath);
- return loc;
- }
-
- /**
- * Retrieve the name/label of a repository item from the given href by
- * splitting of the part after the last slash. If the removeIndex
- * flag is set to true, any trailing index (e.g. '[1]') will be removed.
- *
- * @param resourceHref
- * @param removeIndex
- * @return the name of the item
- */
- protected static String getResourceName(String resourceHref, boolean removeIndex) {
- if (resourceHref == null) {
- return resourceHref;
- }
-
- // cut the extension
- int pos = resourceHref.lastIndexOf('.');
- if (pos > 0) {
- resourceHref = resourceHref.substring(pos+1);
- } else if (resourceHref.endsWith("/")) {
- resourceHref = resourceHref.substring(0, resourceHref.length()-1);
- }
-
- // retrieve the last part of the path
- String name = Text.getLabel(resourceHref);
- // remove index
- if (removeIndex) {
- if (name.endsWith("]")) {
- name = name.substring(0, name.lastIndexOf('['));
- }
- }
- return name;
- }
-
- /**
- * Shortcut for getSession().getRepositorySession()
- *
- * @return repository session present in the {@link #session}.
- */
- protected Session getRepositorySession() {
- return getSession().getRepositorySession();
- }
-
- /**
- * Define the set of locks supported by this resource.
- *
- * @see org.apache.jackrabbit.webdav.lock.SupportedLock
- */
- abstract protected void initLockSupport();
-
- /**
- * Define the set of reports supported by this resource.
- *
- * @see org.apache.jackrabbit.webdav.version.report.SupportedReportSetProperty
- */
- abstract protected void initSupportedReports();
-
- /**
- * Retrieve the href of the workspace the current session belongs to.
- *
- * @return href of the workspace
- */
- abstract protected String getWorkspaceHref();
-}
\ No newline at end of file
diff --git a/contrib/jcr-server/server/src/java/org/apache/jackrabbit/webdav/spi/DavLocatorFactoryImpl.java b/contrib/jcr-server/server/src/java/org/apache/jackrabbit/webdav/spi/DavLocatorFactoryImpl.java
deleted file mode 100644
index c32008f6275..00000000000
--- a/contrib/jcr-server/server/src/java/org/apache/jackrabbit/webdav/spi/DavLocatorFactoryImpl.java
+++ /dev/null
@@ -1,305 +0,0 @@
-/*
- * 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.spi;
-
-import org.apache.log4j.Logger;
-import org.apache.jackrabbit.webdav.DavResourceLocator;
-import org.apache.jackrabbit.webdav.DavLocatorFactory;
-
-/**
- * DavLocatorFactoryImpl
...
- */
-public class DavLocatorFactoryImpl implements DavLocatorFactory {
-
- private static Logger log = Logger.getLogger(DavLocatorFactoryImpl.class);
-
- private final String pathPrefix;
-
- /**
- * Create a new factory
- *
- * @param pathPrefix Prefix, that needs to be removed in order to retrieve
- * the path of the repository item from a given DavResourceLocator
.
- */
- public DavLocatorFactoryImpl(String pathPrefix) {
- this.pathPrefix = pathPrefix;
- }
-
- /**
- * Create a new DavResourceLocator
. Any leading
- * path-prefix (as defined with the constructor) and trailing '/' with
- * the request handle is removed. The first label of the remaining handle is
- * treated as workspace name. The remaining part of the given request handle
- * is said to be the resource handle ("/" if an empty string remains).
- * If the request handle does neither provide workspace name nor resource
- * handle both values are set to null
; the path object then
- * represents the root resource that has no corresponding item in the JCR
- * repository.
- *
- * @param prefix
- * @param requestHandle
- * @return a new DavResourceLocator
- * @throws IllegalArgumentException if the request handle is null
- */
- public DavResourceLocator createResourceLocator(String prefix, String requestHandle) {
- if (requestHandle == null) {
- throw new IllegalArgumentException("Request handle must not be null.");
- }
-
- StringBuffer b = new StringBuffer("");
- if (prefix != null) {
- b.append(prefix);
- if (pathPrefix != null && !prefix.endsWith(pathPrefix)) {
- b.append(pathPrefix);
- }
- }
- String rlPrefix = b.toString();
-
- // remove path-prefix defined with the servlet that may preceed the
- // the requestHandle
- if (pathPrefix != null && requestHandle.startsWith(pathPrefix)) {
- requestHandle = requestHandle.substring(pathPrefix.length());
- }
-
- // remove trailing "/" that is present with collections
- if (requestHandle.endsWith("/")) {
- requestHandle = requestHandle.substring(0, requestHandle.length()-1);
- }
-
- String resourcePath;
- String workspacePath;
-
- // an empty requestHandle (after removal of the "/") signifies a request
- // to the root that does not represent a repository item.
- if ("".equals(requestHandle)) {
- resourcePath = null;
- workspacePath = null;
- } else {
- // look for the first slash ignoring the leading one
- int pos = requestHandle.indexOf('/', 1);
- if (pos == -1) {
- // request to a 'workspace' resource that in the same time
- // represent the root node of the repository.
- workspacePath = requestHandle;
- resourcePath = ItemResourceConstants.ROOT_ITEM_PATH;
- } else {
- // separate the workspace name from the path of the repository
- // item.
- workspacePath = requestHandle.substring(0, pos);
- resourcePath = requestHandle.substring(pos);
- }
- }
-
- return new DavResourceLocatorImpl(rlPrefix, workspacePath, resourcePath, this);
- }
-
- /**
- * Create a new DavResourceLocator
from the specified prefix,
- * workspace path and resource path, whithout modifying the specified Strings.
- *
- * @param prefix
- * @param workspacePath
- * @param resourcePath
- * @return a new DavResourceLocator
- * @see DavLocatorFactory#createResourceLocator(String, String, String)
- */
- public DavResourceLocator createResourceLocator(String prefix, String workspacePath, String resourcePath) {
- return new DavResourceLocatorImpl(prefix, workspacePath, resourcePath, this);
- }
-
- /**
- * Private inner class DavResourceLocatorImpl
implementing
- * the DavResourceLocator
interface.
- */
- private class DavResourceLocatorImpl implements DavResourceLocator {
-
- private final String prefix;
- private final String workspacePath;
- private final String resourcePath;
- private final DavLocatorFactory factory;
-
- /**
- * Create a new DavResourceLocatorImpl
.
- *
- * @param prefix
- * @param workspacePath
- * @param resourcePath
- */
- DavResourceLocatorImpl(String prefix, String workspacePath, String resourcePath, DavLocatorFactory factory) {
- this.prefix = prefix;
- this.workspacePath = workspacePath;
- this.resourcePath = resourcePath;
- this.factory = factory;
- }
-
- /**
- * Return the prefix used to build the href String. This includes the initial
- * hrefPrefix as well a the path prefix.
- *
- * @return prefix String used to build the href.
- */
- public String getPrefix() {
- return prefix;
- }
-
- /**
- * Return the resource path of null
if this locator object
- * represents the '/' request handle. To a request handle specifying a
- * workspace name only the '/' resource path is assigned, which represents
- * the root node of the repository.
- *
- * @return resource path or null
- * @see org.apache.jackrabbit.webdav.DavResourceLocator#getResourcePath()
- */
- public String getResourcePath() {
- return resourcePath;
- }
-
- /**
- * Return the workspace path or null
if this locator object
- * represents the '/' request handle.
- *
- * @return workspace path or null
- * @see org.apache.jackrabbit.webdav.DavResourceLocator#getWorkspacePath()
- */
- public String getWorkspacePath() {
- return workspacePath;
- }
-
- /**
- * Return the workspace name or null
if this locator object
- * represents the '/' request handle.
- *
- * @return workspace name or null
- * @see org.apache.jackrabbit.webdav.DavResourceLocator#getWorkspaceName()
- */
- public String getWorkspaceName() {
- if (workspacePath != null) {
- return workspacePath.substring(1);
- }
- return null;
- }
-
- /**
- * Returns true if the specified locator object refers to a resource within
- * the same workspace.
- *
- * @param locator
- * @return true if the workspace name is equal to this workspace name.
- * @see DavResourceLocator#isSameWorkspace(org.apache.jackrabbit.webdav.DavResourceLocator)
- */
- public boolean isSameWorkspace(DavResourceLocator locator) {
- return (locator == null) ? false : isSameWorkspace(locator.getWorkspaceName());
- }
-
- /**
- * Returns true if the specified string equals to this workspace name or
- * if this workspace name is null.
- *
- * @param workspaceName
- * @return true if the workspace name is equal to this workspace name.
- * @see DavResourceLocator#isSameWorkspace(String)
- */
- public boolean isSameWorkspace(String workspaceName) {
- if (getWorkspaceName() == null) {
- return true;
- } else {
- return getWorkspaceName().equals(workspaceName);
- }
- }
-
- /**
- * Builds the 'href' from the prefix, the workspace name and the
- * resource path present and assures a trailing '/' in case the href
- * is used for collection.
- *
- * @param isCollection
- * @return href String representing the text of the href element
- * @see org.apache.jackrabbit.webdav.DavConstants#XML_HREF
- * @see DavResourceLocator#getHref(boolean)
- */
- public String getHref(boolean isCollection) {
- StringBuffer href = new StringBuffer(prefix);
- if (workspacePath != null) {
- href.append(workspacePath);
- }
- if (resourcePath != null) {
- href.append(resourcePath);
- }
- if (isCollection && href.charAt(href.length()-1) != '/') {
- href.append("/");
- }
- return href.toString();
- }
-
- /**
- * Returns true if the 'workspaceName' field is null
.
- *
- * @return true if the 'workspaceName' field is null
.
- * @see org.apache.jackrabbit.webdav.DavResourceLocator#isRootLocation()
- */
- public boolean isRootLocation() {
- return workspacePath == null;
- }
-
- /**
- * Return the factory that created this locator.
- *
- * @return factory
- * @see org.apache.jackrabbit.webdav.DavResourceLocator#getFactory()
- */
- public DavLocatorFactory getFactory() {
- return factory;
- }
-
- /**
- * Computes the hash code using the prefix, the workspace name and the
- * resource path.
- *
- * @return the hash code
- */
- public int hashCode() {
- int hashCode = prefix.hashCode();
- if (workspacePath != null) {
- hashCode += workspacePath.hashCode();
- }
- if (resourcePath != null) {
- hashCode += resourcePath.hashCode();
- }
- return hashCode % Integer.MAX_VALUE;
- }
-
- /**
- * Equality of locators is achieved if prefix and resource path
- * are equal.
- *
- * @param obj the object to compare to
- * @return true
if the 2 objects are equal;
- * false
otherwise
- */
- public boolean equals(Object obj) {
- if (obj instanceof DavResourceLocatorImpl) {
- DavResourceLocatorImpl locator = (DavResourceLocatorImpl) obj;
- boolean equalWsName = (workspacePath == null) ? locator.workspacePath == null : workspacePath.equals(locator.workspacePath);
- boolean equalRPath = (resourcePath == null) ? locator.resourcePath == null : resourcePath.equals(locator.resourcePath);
-
- return prefix.equals(locator.prefix) && equalWsName && equalRPath;
- }
- return false;
- }
- }
-}
-
diff --git a/contrib/jcr-server/server/src/java/org/apache/jackrabbit/webdav/spi/DavResourceFactoryImpl.java b/contrib/jcr-server/server/src/java/org/apache/jackrabbit/webdav/spi/DavResourceFactoryImpl.java
deleted file mode 100644
index 13907788470..00000000000
--- a/contrib/jcr-server/server/src/java/org/apache/jackrabbit/webdav/spi/DavResourceFactoryImpl.java
+++ /dev/null
@@ -1,202 +0,0 @@
-/*
- * 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.spi;
-
-import org.apache.log4j.Logger;
-import org.apache.jackrabbit.webdav.*;
-import org.apache.jackrabbit.webdav.transaction.TransactionResource;
-import org.apache.jackrabbit.webdav.transaction.TransactionDavServletRequest;
-import org.apache.jackrabbit.webdav.observation.SubscriptionManager;
-import org.apache.jackrabbit.webdav.observation.ObservationResource;
-import org.apache.jackrabbit.webdav.version.DeltaVServletRequest;
-import org.apache.jackrabbit.webdav.version.VersionControlledResource;
-import org.apache.jackrabbit.webdav.spi.version.VersionItemCollection;
-import org.apache.jackrabbit.webdav.spi.version.VersionHistoryItemCollection;
-import org.apache.jackrabbit.webdav.spi.transaction.TxLockManagerImpl;
-
-import javax.jcr.*;
-import javax.jcr.version.Version;
-import javax.jcr.version.VersionHistory;
-
-/**
- * DavResourceFactoryImpl
...
- */
-public class DavResourceFactoryImpl implements DavResourceFactory {
-
- private static Logger log = Logger.getLogger(DavResourceFactoryImpl.class);
-
- private final TxLockManagerImpl txMgr;
- private final SubscriptionManager subsMgr;
-
- /**
- * Create a new DavResourceFactoryImpl
.
- *
- * @param txMgr
- * @param subsMgr
- */
- public DavResourceFactoryImpl(TxLockManagerImpl txMgr, SubscriptionManager subsMgr) {
- this.txMgr = txMgr;
- this.subsMgr = subsMgr;
- }
-
- /**
- * Create a new DavResource
from the specified locator and request
- * objects. Note, that in contrast to
- * {@link #createResource(DavResourceLocator, DavSession)} the locator may
- * point to a non-existing resource.
- *
- * If the request contains a {@link org.apache.jackrabbit.webdav.version.DeltaVServletRequest#getLabel()
- * Label header}, the resource is build from the indicated
- * {@link org.apache.jackrabbit.webdav.version.VersionResource version} instead.
- *
- * @param locator
- * @param request
- * @param response
- * @return
- * @see DavResourceFactory#createResource(org.apache.jackrabbit.webdav.DavResourceLocator, org.apache.jackrabbit.webdav.DavServletRequest, org.apache.jackrabbit.webdav.DavServletResponse)
- */
- public DavResource createResource(DavResourceLocator locator,
- DavServletRequest request,
- DavServletResponse response) throws DavException {
-
- DavResource resource = null;
- DavSession session = request.getDavSession();
-
- if (locator.isRootLocation()) {
- resource = new RootCollection(locator, session, this);
- }
-
- if (resource == null) {
- try {
- resource = createResourceForItem(locator, session);
- } catch (RepositoryException e) {
- // create the default resources if no such item exists
-
- // MKCOL request forces a collection-resource even if there already
- // exists a repository-property with the given path. the MKCOL will
- // in that particular case fail with a 405 (method not allowed).
- if (DavMethods.getMethodCode(request.getMethod()) == DavMethods.DAV_MKCOL) {
- resource = new VersionControlledItemCollection(locator, session, this);
- } else {
- resource = new DefaultItemResource(locator, session, this);
- }
- }
-
- // if the created resource is version-controlled and the request
- // contains a Label header, the corresponding Version must be used
- // instead.
- if (request instanceof DeltaVServletRequest && isVersionControlled(resource)) {
- String labelHeader = ((DeltaVServletRequest)request).getLabel();
- if (labelHeader != null && DavMethods.isMethodAffectedByLabel(request.getMethod())) {
- try {
- Item item = session.getRepositorySession().getItem(locator.getResourcePath());
- Version v = ((Node)item).getVersionHistory().getVersionByLabel(labelHeader);
- DavResourceLocator vloc = locator.getFactory().createResourceLocator(locator.getPrefix(), locator.getWorkspacePath(), v.getPath());
- resource = new VersionItemCollection(vloc, session, this);
- } catch (RepositoryException e) {
- log.error("Failed to build version resource from "+locator.getHref(true)+" and label "+labelHeader);
- throw new JcrDavException(e);
- }
- }
- }
- }
-
- ((TransactionResource)resource).init(txMgr, ((TransactionDavServletRequest)request).getTransactionId());
- ((ObservationResource)resource).init(subsMgr);
-
- return resource;
- }
-
- /**
- * Create a new DavResource
from the given locator and session.
- *
- * @param locator
- * @param session
- * @return DavResource representing either a repository item or the {@link RootCollection}.
- * @throws DavException if the given locator does neither refer to a repository item
- * nor does represent the {@link org.apache.jackrabbit.webdav.DavResourceLocator#isRootLocation()
- * root location}.
- */
- public DavResource createResource(DavResourceLocator locator, DavSession session) throws DavException {
- DavResource resource;
- try {
- resource = createResourceForItem(locator, session);
- } catch (RepositoryException e) {
- log.info("Creating resource for non-existing repository item ...");
- if (locator.isRootLocation()) {
- resource = new RootCollection(locator, session, this);
- } else {
- // todo: is this correct?
- resource = new VersionControlledItemCollection(locator, session, this);
- }
- }
-
- resource.addLockManager(txMgr);
- ((ObservationResource)resource).init(subsMgr);
-
- return resource;
- }
-
- /**
- * Tries to retrieve the repository item defined by the locator's resource
- * path and build the corresponding WebDAV resource. The following distinction
- * is made between items: Version nodes, VersionHistory nodes, root node,
- * unspecified nodes and finally property items.
- *
- * @param locator
- * @param session
- * @return DavResource representing a repository item.
- * @throws RepositoryException if {@link Session#getItem(String)} fails.
- */
- private DavResource createResourceForItem(DavResourceLocator locator, DavSession session) throws RepositoryException {
- DavResource resource;
- Item item = session.getRepositorySession().getItem(locator.getResourcePath());
- if (item.isNode()) {
- // create special resources for Version and VersionHistory
- if (item instanceof Version) {
- resource = new VersionItemCollection(locator, session, this);
- } else if (item instanceof VersionHistory) {
- resource = new VersionHistoryItemCollection(locator, session, this);
- } else if (ItemResourceConstants.ROOT_ITEM_PATH.equals(locator.getResourcePath())) {
- resource = new RootItemCollection(locator, session, this);
- } else{
- resource = new VersionControlledItemCollection(locator, session, this);
- }
- } else {
- resource = new DefaultItemResource(locator, session, this);
- }
- return resource;
- }
-
- /**
- * Returns true, if the specified resource is a {@link VersionControlledResource}
- * and has a version history.
- *
- * @param resource
- * @return true if the specified resource is version-controlled.
- */
- private boolean isVersionControlled(DavResource resource) {
- boolean vc = false;
- if (resource instanceof VersionControlledResource) {
- try {
- vc = ((VersionControlledResource)resource).getVersionHistory() != null;
- } catch (DavException e) {
- log.debug("Resource '" + resource.getHref() + "' is not version-controlled.");
- }
- }
- return vc;
- }
-}
\ No newline at end of file
diff --git a/contrib/jcr-server/server/src/java/org/apache/jackrabbit/webdav/spi/DefaultItemCollection.java b/contrib/jcr-server/server/src/java/org/apache/jackrabbit/webdav/spi/DefaultItemCollection.java
deleted file mode 100644
index 438865eac8d..00000000000
--- a/contrib/jcr-server/server/src/java/org/apache/jackrabbit/webdav/spi/DefaultItemCollection.java
+++ /dev/null
@@ -1,729 +0,0 @@
-/*
- * 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.spi;
-
-import org.apache.log4j.Logger;
-import org.apache.jackrabbit.webdav.property.*;
-import org.apache.jackrabbit.webdav.*;
-import org.apache.jackrabbit.webdav.spi.lock.JcrActiveLock;
-import org.apache.jackrabbit.webdav.spi.nodetype.NodeTypeProperty;
-import org.apache.jackrabbit.webdav.*;
-import org.apache.jackrabbit.webdav.ordering.*;
-import org.apache.jackrabbit.webdav.util.Text;
-import org.apache.jackrabbit.webdav.lock.*;
-
-import javax.jcr.*;
-import javax.jcr.lock.Lock;
-import javax.jcr.nodetype.NodeType;
-import java.util.*;
-import java.io.*;
-
-/**
- * DefaultItemCollection
represents a JCR node item.
- */
-public class DefaultItemCollection extends AbstractItemResource
- implements OrderingResource {
-
- private static Logger log = Logger.getLogger(DefaultItemCollection.class);
-
- private InputStream in;
-
- /**
- * Create a new DefaultItemCollection
.
- *
- * @param locator
- * @param session
- */
- protected DefaultItemCollection(DavResourceLocator locator, DavSession session, DavResourceFactory factory) {
- super(locator, session, factory);
- if (exists() && !(item instanceof Node)) {
- throw new IllegalArgumentException("A collection resource can not be constructed from a Property item.");
- }
- }
-
- //----------------------------------------------< DavResource interface >---
- /**
- * @see org.apache.jackrabbit.webdav.DavResource#getComplianceClass()
- */
- public String getComplianceClass() {
- StringBuffer sb = new StringBuffer(super.getComplianceClass());
- sb.append(", ").append(OrderingResource.COMPLIANCE_CLASS);
- return sb.toString();
- }
-
- /**
- * @see org.apache.jackrabbit.webdav.DavResource#getSupportedMethods()
- */
- public String getSupportedMethods() {
- StringBuffer sb = new StringBuffer(super.getSupportedMethods());
- // Ordering
- if (isOrderable()) {
- sb.append(", ").append(OrderingResource.METHODS);
- }
- return sb.toString();
- }
-
- /**
- * Always returns true
- *
- * @return true
- * @see org.apache.jackrabbit.webdav.DavResource#isCollection()
- */
- public boolean isCollection() {
- return true;
- }
-
-
- /**
- * Returns an {@link java.io.InputStream} to the content of this collection.
- *
- * @return
- * @see org.apache.jackrabbit.webdav.DavResource#getStream()
- */
- public InputStream getStream() {
- initProperties();
- return in;
- }
-
- /**
- * This implementation of the DavResource
does only allow
- * to set the jcr:mixinnodetypes property. Please note that the existing list of
- * mixin nodetypes will be completely replaces.
- * In order to add / set any other repository property on the underlaying
- * {@link javax.jcr.Node} use addMember(DavResource)
or
- * addMember(DavResource, InputStream)
or modify the value
- * of the corresponding resource.
- *
- * @param property
- * @throws org.apache.jackrabbit.webdav.DavException
- * @see org.apache.jackrabbit.webdav.DavResource#setProperty(org.apache.jackrabbit.webdav.property.DavProperty)
- * @see #JCR_MIXINNODETYPES
- * @todo undo incomplete modifications...
- */
- public void setProperty(DavProperty property) throws DavException {
- if (!exists()) {
- throw new DavException(DavServletResponse.SC_NOT_FOUND);
- }
- if (property.getName().equals(JCR_MIXINNODETYPES)) {
- try {
- Node n = (Node)item;
- NodeType[] existingMixin = n.getMixinNodeTypes();
- NodeTypeProperty mix = new NodeTypeProperty(property);
- Set mixins = mix.getNodeTypeNames();
-
- for (int i = 0; i < existingMixin.length; i++) {
- String name = existingMixin[i].getName();
- if (mixins.contains(name)){
- // do not add existing mixins
- mixins.remove(name);
- } else {
- // remove mixin that are not contained in the new list
- n.removeMixin(name);
- }
- }
-
- // add the remaining mixing types that are not yet set
- Iterator it = mixins.iterator();
- while (it.hasNext()) {
- n.addMixin((String)it.next());
- }
- complete();
-
- } catch (RepositoryException e) {
- throw new JcrDavException(e);
- }
- } else {
- // all props except for mixinnodetypes are read-only
- throw new DavException(DavServletResponse.SC_CONFLICT);
- }
- }
-
- /**
- * This implementation of the DavResource
does only allow
- * to remove the jcr:mixinnodetypes property.
- *
- * @param propertyName
- * @throws org.apache.jackrabbit.webdav.DavException
- * @see org.apache.jackrabbit.webdav.DavResource#removeProperty(org.apache.jackrabbit.webdav.property.DavPropertyName)
- * @see #JCR_MIXINNODETYPES
- * @todo undo incomplete modifications...
- */
- public void removeProperty(DavPropertyName propertyName) throws DavException {
- if (!exists()) {
- throw new DavException(DavServletResponse.SC_NOT_FOUND);
- }
- if (JCR_MIXINNODETYPES.equals(propertyName)) {
- // remove all mixin nodetypes
- try {
- Node n = (Node)item;
- NodeType[] mixins = n.getMixinNodeTypes();
- for (int i = 0; i < mixins.length; i++) {
- n.removeMixin(mixins[i].getName());
- }
- complete();
-
- } catch (RepositoryException e) {
- // NoSuchNodeTypeException, ConstraintViolationException should never occur...
- throw new JcrDavException(e);
- }
- } else {
- // all props except for mixinnodetypes are read-only
- throw new DavException(DavServletResponse.SC_CONFLICT);
- }
- }
-
- /**
- * If the specified resource represents a collection, a new node is {@link Node#addNode(String)
- * added} to the item represented by this resource. If an input stream is specified
- * together with a collection resource {@link Session#importXML(String, java.io.InputStream)}
- * is called instead and this resource path is used as parentAbsPath
argument.
- *
- * However, if the specified resource is not of resource type collection a
- * new {@link Property} is set or an existing one is changed by modifying its
- * value.
- * NOTE: with the current implementation it is not possible to create or
- * modify multivalue JCR properties.
- * NOTE: if the JCR property represented by the specified resource has an
- * {@link PropertyType#UNDEFINED undefined} resource type, its value will be
- * changed/set to type {@link PropertyType#BINARY binary}.
- *
- * @param resource
- * @param in
- * @throws org.apache.jackrabbit.webdav.DavException
- * @see org.apache.jackrabbit.webdav.DavResource#addMember(org.apache.jackrabbit.webdav.DavResource, java.io.InputStream)
- * @see Node#addNode(String)
- * @see Node#setProperty(String, java.io.InputStream)
- */
- public void addMember(DavResource resource, InputStream in)
- throws DavException {
-
- /* RFC 2815 states that all 'parents' must exist in order all addition of members */
- if (!exists()) {
- throw new DavException(DavServletResponse.SC_CONFLICT);
- }
-
- try {
- Node n = (Node) item;
- if (resource.isCollection()) {
- if (in == null) {
- // MKCOL without a request body, try if a default-primary-type is defined.
- n.addNode(resource.getDisplayName());
- } else {
- // MKCOL, which is not allowed for existing resources
- getRepositorySession().importXML(getResourcePath(), in);
- }
- } else {
- if (in == null) {
- // PUT: not possible
- throw new DavException(DavServletResponse.SC_BAD_REQUEST, "Cannot create a new non-collection resource without request body.");
- } else {
- // TODO: find a way to create non-binary and multivalue properties
- // PUT : create new or overwrite existing property.
- // NOTE: will fail for multivalue properties.
- n.setProperty(getResourceName(resource.getResourcePath(), true), in);
- }
- }
- complete();
- } catch (ItemExistsException e) {
- // according to RFC 2518: MKCOL only possible on non-existing/deleted resource
- throw new JcrDavException(e, DavServletResponse.SC_METHOD_NOT_ALLOWED);
- } catch (RepositoryException e) {
- throw new JcrDavException(e);
- } catch (IOException e) {
- throw new DavException(DavServletResponse.SC_UNPROCESSABLE_ENTITY, e.getMessage());
- }
- }
-
- /**
- * @see org.apache.jackrabbit.webdav.DavResource#addMember(org.apache.jackrabbit.webdav.DavResource)
- */
- public void addMember(DavResource resource) throws DavException {
- addMember(resource, resource.getStream());
- }
-
- /**
- * @see org.apache.jackrabbit.webdav.DavResource#getMembers()
- */
- public DavResourceIterator getMembers() {
- ArrayList memberList = new ArrayList();
- if (exists()) {
- try {
- Node n = (Node)item;
- // add all node members
- NodeIterator it = n.getNodes();
- while (it.hasNext()) {
- Node node = it.nextNode();
- DavResourceLocator loc = getLocatorFromItem(node);
- memberList.add(createResourceFromLocator(loc));
- }
- // add all property members
- PropertyIterator propIt = n.getProperties();
- while (propIt.hasNext()) {
- Property prop = propIt.nextProperty();
- DavResourceLocator loc = getLocatorFromItem(prop);
- memberList.add(createResourceFromLocator(loc));
- }
- } catch (RepositoryException e) {
- // ignore
- log.error(e.getMessage());
- } catch (DavException e) {
- // should never occur.
- log.error(e.getMessage());
- }
- }
- return new DavResourceIteratorImpl(memberList);
- }
-
- /**
- * Removes the repository item represented by the specified member
- * resource.
- *
- * @throws DavException if this resource does not exist or if an error occurs
- * while deleting the underlaying item.
- * @see DavResource#removeMember(DavResource)
- * @see javax.jcr.Item#remove()
- */
- public void removeMember(DavResource member) throws DavException {
- Session session = getRepositorySession();
- if (!exists() || !session.itemExists(member.getResourcePath())) {
- throw new DavException(DavServletResponse.SC_NOT_FOUND);
- }
- if (!getResourcePath().equals(Text.getRelativeParent(member.getResourcePath(), 1))) {
- throw new DavException(DavServletResponse.SC_CONFLICT, member.getResourcePath() + "is not member of this resource (" + getResourcePath() + ")");
- }
- try {
- session.getItem(member.getResourcePath()).remove();
- complete();
- } catch (RepositoryException e) {
- throw new JcrDavException(e);
- }
- }
-
- /**
- * @param type
- * @param scope
- * @return true if a lock with the specified type and scope is present on
- * this resource, false otherwise. If retrieving the corresponding information
- * fails, false is returned.
- * @see org.apache.jackrabbit.webdav.DavResource#hasLock(org.apache.jackrabbit.webdav.lock.Type, org.apache.jackrabbit.webdav.lock.Scope)
- */
- public boolean hasLock(Type type, Scope scope) {
- if (isLockable(type, scope)) {
- if (Type.WRITE.equals(type)) {
- try {
- return ((Node) item).isLocked();
- } catch (RepositoryException e) {
- log.error(e.getMessage());
- }
- } else {
- return super.hasLock(type, scope);
- }
- }
- return false;
- }
-
- /**
- * Retrieve the lock with the specified type and scope.
- *
- * @param type
- * @param scope
- * @return lock with the specified type and scope is present on this
- * resource or null
. NOTE: If retrieving the write lock present
- * on the underlaying repository item fails, null
is return.
- * @see org.apache.jackrabbit.webdav.DavResource#getLock(org.apache.jackrabbit.webdav.lock.Type, org.apache.jackrabbit.webdav.lock.Scope)
- * @see javax.jcr.Node#getLock() for the write locks.
- */
- public ActiveLock getLock(Type type, Scope scope) {
- ActiveLock lock = null;
- if (isLockable(type, scope)) {
- if (Type.WRITE.equals(type)) {
- try {
- if (!exists()) {
- log.warn("Unable to retrieve lock: no item found at '" + getResourcePath() + "'");
- } else if (((Node) item).isLocked()) {
- Lock jcrLock = ((Node) item).getLock();
- // TODO: find out whether this lock is session-scoped or not!
- lock = new JcrActiveLock(jcrLock);
- }
- } catch (AccessDeniedException e) {
- log.error("Error while accessing resource lock: "+e.getMessage());
- } catch (UnsupportedRepositoryOperationException e) {
- log.error("Error while accessing resource lock: "+e.getMessage());
- } catch (RepositoryException e) {
- log.error("Error while accessing resource lock: "+e.getMessage());
- }
- } else {
- lock = super.getLock(type, scope);
- }
- }
- return lock;
- }
-
- /**
- * Creates a lock on this resource by locking the underlaying
- * {@link javax.jcr.Node node}. Except for the {@link org.apache.jackrabbit.webdav.lock.LockInfo#isDeep()} }
- * all information included in the LockInfo
object is ignored.
- * Lock timeout is defined by JCR implementation.
- *
- * @param reqLockInfo
- * @return lock object representing the lock created on this resource.
- * @throws org.apache.jackrabbit.webdav.DavException
- * @see org.apache.jackrabbit.webdav.DavResource#lock(org.apache.jackrabbit.webdav.lock.LockInfo)
- * @see Node#lock(boolean, boolean)
- */
- public ActiveLock lock(LockInfo reqLockInfo) throws DavException {
-
- if (!isLockable(reqLockInfo.getType(), reqLockInfo.getScope())) {
- throw new DavException(DavServletResponse.SC_PRECONDITION_FAILED);
- }
-
- if (Type.WRITE.equals(reqLockInfo.getType())) {
- if (!exists()) {
- log.warn("Cannot create a write lock for non-existing JCR node (" + getResourcePath() + ")");
- throw new DavException(DavServletResponse.SC_NOT_FOUND);
- }
- try {
- boolean sessionScoped = EXCLUSIVE_SESSION.equals(reqLockInfo.getScope());
- Lock jcrLock = ((Node)item).lock(reqLockInfo.isDeep(), sessionScoped);
- return new JcrActiveLock(jcrLock, sessionScoped);
-
- } catch (RepositoryException e) {
- // UnsupportedRepositoryOperationException should not occur...
- throw new JcrDavException(e);
- }
- } else {
- return super.lock(reqLockInfo);
- }
- }
-
- /**
- * Refreshes the lock on this resource. With this implementation the
- * {@link javax.jcr.lock lock} present on the underlaying {@link javax.jcr.Node node}
- * is refreshed. The timeout indicated by the LockInfo
- * object is ignored.
- *
- * @param reqLockInfo LockInfo as build from the request.
- * @param lockToken
- * @return the updated lock info object.
- * @throws org.apache.jackrabbit.webdav.DavException in case the lock could not be refreshed.
- * @see org.apache.jackrabbit.webdav.DavResource#refreshLock(org.apache.jackrabbit.webdav.lock.LockInfo, String)
- * @see javax.jcr.lock.Lock#refresh()
- */
- public ActiveLock refreshLock(LockInfo reqLockInfo, String lockToken)
- throws DavException {
-
- if (lockToken == null) {
- throw new DavException(DavServletResponse.SC_PRECONDITION_FAILED);
- }
-
- ActiveLock lock = getWriteLock();
- if (lock != null && lockToken.equals(lock.getToken())) {
- try {
- Lock jcrLock = ((Node) item).getLock();
- jcrLock.refresh();
- return new JcrActiveLock(jcrLock, EXCLUSIVE_SESSION.equals(lock.getScope()));
- } catch (RepositoryException e) {
- /*
- NOTE: LockException is only thrown by Lock.refresh()
- the lock exception thrown by Node.getLock() was circumvented
- by the init test if there is a lock applied...
- NOTE: UnsupportedRepositoryOperationException should not occur
- */
- throw new JcrDavException(e);
- }
- } else {
- return super.refreshLock(reqLockInfo, lockToken);
- }
- }
-
- /**
- * Remove the write lock from this resource by unlocking the underlaying
- * {@link javax.jcr.Node node}.
- *
- * @param lockToken
- * @throws org.apache.jackrabbit.webdav.DavException
- * @see org.apache.jackrabbit.webdav.DavResource#unlock(String)
- * @see javax.jcr.Node#unlock()
- */
- public void unlock(String lockToken) throws DavException {
- ActiveLock lock = getWriteLock();
- if (lock != null && lockToken.equals(lock.getToken())) {
- try {
- ((Node) item).unlock();
- } catch (RepositoryException e) {
- throw new JcrDavException(e);
- }
- } else {
- super.unlock(lockToken);
- }
- }
-
- /**
- * Returns the write lock present on this resource or null
if
- * no write lock exists. NOTE: that the scope of a write lock may either
- * be {@link org.apache.jackrabbit.webdav.lock.Scope#EXCLUSIVE} or {@link #EXCLUSIVE_SESSION}.
- *
- * @return write lock or null
- * @throws DavException if this resource does not represent a repository item.
- */
- private ActiveLock getWriteLock() throws DavException {
- if (!exists()) {
- throw new DavException(DavServletResponse.SC_NOT_FOUND, "Unable to retrieve write lock for non existing repository item (" + getResourcePath() + ")");
- }
- ActiveLock writeLock = getLock(Type.WRITE, Scope.EXCLUSIVE);
- if (writeLock == null) {
- writeLock = getLock(Type.WRITE, EXCLUSIVE_SESSION);
- }
- return writeLock;
- }
-
- //-----------------------------------------< OrderingResource interface >---
- /**
- * Returns true if this resource exists and the nodetype defining the
- * underlaying repository node allow to reorder this nodes children.
- *
- * @return true if {@link #orderMembers(OrderPatch)} can be called on this
- * resource.
- * @see org.apache.jackrabbit.webdav.ordering.OrderingResource#isOrderable()
- * @see javax.jcr.nodetype.NodeType#hasOrderableChildNodes()
- */
- public boolean isOrderable() {
- boolean orderable = false;
- if (exists()) {
- try {
- orderable = ((Node) item).getPrimaryNodeType().hasOrderableChildNodes();
- } catch (RepositoryException e) {
- log.warn(e.getMessage());
- }
- }
- return orderable;
- }
-
- /**
- * Reorder the child nodes of the repository item represented by this
- * resource as indicated by the specified {@link OrderPatch} object.
- *
- * @param orderPatch
- * @throws org.apache.jackrabbit.webdav.DavException
- * @see org.apache.jackrabbit.webdav.ordering.OrderingResource#orderMembers(org.apache.jackrabbit.webdav.ordering.OrderPatch)
- * @see Node#orderBefore(String, String)
- */
- public void orderMembers(OrderPatch orderPatch) throws DavException {
- if (!isOrderable()) {
- throw new DavException(DavServletResponse.SC_METHOD_NOT_ALLOWED);
- }
- // only custom ordering is allowed
- if (!OrderingConstants.ORDERING_TYPE_CUSTOM.equalsIgnoreCase(orderPatch.getOrderingType())) {
- throw new DavException(DavServletResponse.SC_UNPROCESSABLE_ENTITY,"Only DAV:custom ordering type supported.");
- }
-
- OrderPatch.Member[] instructions = orderPatch.getOrderInstructions();
- Node n = (Node)item;
- try {
- for (int i = 0; i < instructions.length; i++) {
- String srcRelPath = getResourceName(n.getPath() + instructions[i].getMemberHandle(), false);
- Position pos = instructions[i].getPosition();
- String destRelPath = getRelDestinationPath(pos, n.getNodes());
-
- n.orderBefore(srcRelPath, destRelPath);
- }
- } catch (RepositoryException e) {
- // UnsupportedRepositoryException should not occur
- throw new JcrDavException(e);
- }
- }
-
- /**
- * Retrieve the relative path of the child node that acts as destination.
- * A null
destination path is used to place the child node indicated
- * by the source path at the end of the list.
- *
- * @param position
- * @param childNodes
- * @return the relative path of the child node used as destination or null
- * if the source node should be placed at the last position.
- * @throws javax.jcr.RepositoryException
- */
- private String getRelDestinationPath(Position position, NodeIterator childNodes)
- throws RepositoryException {
-
- String destRelPath = null;
- if (position.getType() == Position.TYPE_FIRST) {
- while (childNodes.hasNext()) {
- Node firstChild = childNodes.nextNode();
- destRelPath = firstChild.getPath();
- }
- // no child nodes available > reordering to 'first' position fails.
- if (destRelPath == null) {
- throw new ItemNotFoundException("No 'first' item found for reordering.");
- }
- } else if (position.getType() == Position.TYPE_AFTER) {
- String afterRelPath = getResourceName(position.getSegment(), false);
- boolean found = false;
- while (childNodes.hasNext() && destRelPath == null) {
- String childPath = childNodes.nextNode().getPath();
- if (found) {
- destRelPath = childPath;
- } else {
- found = afterRelPath.equals(Text.getLabel(childPath));
- }
- }
- } else {
- destRelPath = position.getSegment();
- }
-
- if (destRelPath != null) {
- destRelPath = getResourceName(destRelPath, false);
- }
-
- return destRelPath;
- }
-
- //--------------------------------------------------------------------------
- /**
- * Extend the general {@link #supportedLock} field by lock entries specific for this
- * resource: write locks (exclusive or exclusive session-scoped) in case the underlaying
- * node has the node type mix:lockable.
- *
- * @see #MIX_LOCKABLE
- */
- protected void initLockSupport() {
- super.initLockSupport();
- // add exclusive write lock if allowed for the given node
- try {
- if (exists() && ((Node)item).isNodeType(MIX_LOCKABLE)) {
- supportedLock.addEntry(Type.WRITE, Scope.EXCLUSIVE);
- // TODO: do session-scoped lock properly (including session caching and proper scope discovery)
- //supportedLock.addEntry(new SessionScopedLockEntry());
- }
- } catch (RepositoryException e) {
- log.warn(e.getMessage());
- }
- }
-
- /**
- * Fill the property set for this resource.
- */
- protected void initProperties() {
- super.initProperties();
- if (exists()) {
- try {
- String prefix = "_tmp_" + item.getName();
- // create tmpFile in default system-tmp directory
- File tmpfile = File.createTempFile(prefix, null, null);
- tmpfile.deleteOnExit();
- FileOutputStream out = new FileOutputStream(tmpfile);
- getSession().getRepositorySession().exportSysView(item.getPath(), out, false, true);
- out.close();
- in = new FileInputStream(tmpfile);
-
- properties.add(new DefaultDavProperty(DavPropertyName.GETCONTENTLENGTH, new Long(tmpfile.length())));
- properties.add(new DefaultDavProperty(DavPropertyName.GETCONTENTTYPE, "text/xml"));
-
- } catch (IOException e) {
- log.error("Error while property initialization: "+e.getMessage());
- } catch (RepositoryException e) {
- log.error("Error while property initialization: "+e.getMessage());
- }
-
- Node n = (Node)item;
- // overwrite the default modificationtime if possible
- try {
- if (n.hasProperty(PROP_LASTMODIFIED)) {
- setModificationTime(n.getProperty(PROP_LASTMODIFIED).getLong());
- }
- } catch (RepositoryException e) {
- log.warn("Error while accessing jcr:lastModified property");
- }
- // overwrite the default creation date if possible
- try {
- if (n.hasProperty(PROP_CREATED)) {
- long creationTime = n.getProperty(PROP_CREATED).getValue().getLong();
- properties.add(new DefaultDavProperty(DavPropertyName.CREATIONDATE,
- DavConstants.creationDateFormat.format(new Date(creationTime))));
- }
- } catch (RepositoryException e) {
- log.warn("Error while accessing jcr:created property");
- }
-
- // add node-specific resource properties
- try {
- properties.add(new NodeTypeProperty(JCR_PRIMARYNODETYPE, n.getPrimaryNodeType(), false));
- properties.add(new NodeTypeProperty(JCR_MIXINNODETYPES, n.getMixinNodeTypes(), false));
- properties.add(new DefaultDavProperty(JCR_INDEX, new Integer(n.getIndex())));
- addHrefProperty(JCR_REFERENCES, n.getReferences(), false);
- } catch (RepositoryException e) {
- log.error("Failed to retrieve primary nodetype property: " + e.getMessage());
- }
- try {
- Item primaryItem = n.getPrimaryItem();
- addHrefProperty(JCR_PRIMARYITEM, new Item[] {primaryItem}, false);
- } catch (ItemNotFoundException e) {
- log.info("No primary item present on this node '" + getResourcePath() + "'");
- } catch (RepositoryException e) {
- log.error("Error while retrieving primary item: " + e.getMessage());
- }
-
- // property defined by RFC 3648: this resource always has custom ordering!
- if (isOrderable()) {
- properties.add(new OrderingType(OrderingConstants.ORDERING_TYPE_CUSTOM));
- }
- }
- }
-
- /**
- * Add a {@link org.apache.jackrabbit.webdav.property.HrefProperty} with the
- * specified property name and values. Each item present in the specified
- * values array is referenced in the resulting property.
- *
- * @param name
- * @param values
- * @param isProtected
- */
- protected void addHrefProperty(DavPropertyName name, Item[] values, boolean isProtected) {
- if (values == null) {
- return;
- }
- try {
- String[] pHref = new String[values.length];
- for (int i = 0; i < values.length; i++) {
- pHref[i] = this.getLocatorFromResourcePath(values[i].getPath()).getHref(true);
- }
- properties.add(new HrefProperty(name, pHref, isProtected));
- } catch (RepositoryException e) {
- e.getMessage();
- }
- }
-
- /**
- * Add a new {@link HrefProperty href property} to the property set, where
- * all items present in the specifed iterator are referenced in the
- * resulting property.
- *
- * @param name
- * @param itemIterator
- * @param isProtected
- * @see #addHrefProperty(DavPropertyName, Item[], boolean)
- */
- protected void addHrefProperty(DavPropertyName name, Iterator itemIterator,
- boolean isProtected) {
- ArrayList l = new ArrayList();
- while (itemIterator.hasNext()) {
- l.add(itemIterator.next());
- }
- addHrefProperty(name, (Item[]) l.toArray(new Item[l.size()]), isProtected);
- }
-}
\ No newline at end of file
diff --git a/contrib/jcr-server/server/src/java/org/apache/jackrabbit/webdav/spi/DefaultItemResource.java b/contrib/jcr-server/server/src/java/org/apache/jackrabbit/webdav/spi/DefaultItemResource.java
deleted file mode 100644
index 7a615991ad6..00000000000
--- a/contrib/jcr-server/server/src/java/org/apache/jackrabbit/webdav/spi/DefaultItemResource.java
+++ /dev/null
@@ -1,252 +0,0 @@
-/*
- * 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.spi;
-
-import org.apache.log4j.Logger;
-import org.apache.jackrabbit.webdav.property.*;
-import org.apache.jackrabbit.webdav.*;
-import org.apache.jackrabbit.webdav.DavResource;
-import org.apache.jackrabbit.webdav.DavResourceIterator;
-import org.apache.jackrabbit.webdav.DavResourceIteratorImpl;
-import org.apache.jackrabbit.webdav.spi.property.ValuesProperty;
-import org.apache.jackrabbit.webdav.spi.property.LengthsProperty;
-import org.apache.jackrabbit.webdav.lock.*;
-import org.apache.jackrabbit.core.util.ValueHelper;
-
-import javax.jcr.*;
-import java.io.*;
-import java.util.*;
-
-/**
- * DefaultItemResource
represents JCR property item.
- *
- * @see Property
- */
-public class DefaultItemResource extends AbstractItemResource {
-
- private static Logger log = Logger.getLogger(DefaultItemResource.class);
-
- /**
- * Create a new DefaultItemResource
.
- *
- * @param locator
- * @param session
- */
- public DefaultItemResource(DavResourceLocator locator, DavSession session, DavResourceFactory factory) {
- super(locator, session, factory);
- }
-
- //----------------------------------------------< DavResource interface >---
- /**
- * Returns false.
- *
- * @return false
- * @see DavResource#isCollection()
- */
- public boolean isCollection() {
- return false;
- }
-
- /**
- * In case an underlaying repository {@link Property property} exists the following
- * logic is applyed to obtain the stream:
- *
- *
- * @return
- * @see DavResource#getStream()
- */
- public InputStream getStream() {
- InputStream in = null;
- if (exists()) {
- try {
- // NOTE: stream cannot be obtained for multivalue properties
- if (!isMultiple()) {
- in = ((Property)item).getStream();
- }
- } catch (ValueFormatException e) {
- // should not occur
- log.error("Cannot obtain stream from resource: " + e.getMessage());
- } catch (RepositoryException e) {
- log.error("Cannot obtain stream from resource: " + e.getMessage());
- }
- }
- return in;
- }
-
- /**
- * Sets the given property. Note, that {@link #JCR_VALUE} and {@link #JCR_VALUES}
- * are the only resource properties that are allowed to be modified. Any other
- * property is read-only and will throw an exception ('Conflict').
- *
- * @param property
- * @throws DavException
- * @see DavResource#setProperty(org.apache.jackrabbit.webdav.property.DavProperty)
- * @todo undo incomplete modifications...
- */
- public void setProperty(DavProperty property) throws DavException {
- if (!exists()) {
- throw new DavException(DavServletResponse.SC_NOT_FOUND);
- }
- try {
- Property prop = (Property) item;
- int type = prop.getType();
- if (property.getName().equals(JCR_VALUE)) {
- Value val = ValueHelper.convert(String.valueOf(property.getValue()), type);
- prop.setValue(val);
- } else if (property.getName().equals(JCR_VALUES)) {
- prop.setValue(new ValuesProperty(property).getValues(prop.getType()));
- } else {
- throw new DavException(DavServletResponse.SC_CONFLICT);
- }
- complete();
-
- } catch (IllegalArgumentException e) {
- throw new DavException(DavServletResponse.SC_BAD_REQUEST, e.getMessage());
- } catch (RepositoryException e) {
- throw new JcrDavException(e);
- }
- }
-
- /**
- * Removing properties is not allowed, for a single-value JCR-property without
- * a value does not exist. For multivalue properties an empty {@link Value values array}
- * may be specified with by setting the {@link #JCR_VALUES 'values' webdav property}.
- *
- * @param propertyName
- * @throws DavException
- * @see org.apache.jackrabbit.webdav.DavResource#removeProperty(org.apache.jackrabbit.webdav.property.DavPropertyName)
- */
- public void removeProperty(DavPropertyName propertyName) throws DavException {
- if (!exists()) {
- throw new DavException(DavServletResponse.SC_NOT_FOUND);
- }
- throw new DavException(DavServletResponse.SC_FORBIDDEN);
- }
-
- /**
- * Method is not allowed.
- *
- * @see org.apache.jackrabbit.webdav.DavResource#addMember(org.apache.jackrabbit.webdav.DavResource, InputStream)
- */
- public void addMember(DavResource resource, InputStream in) throws DavException {
- throw new DavException(DavServletResponse.SC_METHOD_NOT_ALLOWED, "Cannot add members to a non-collection resource");
- }
-
- /**
- * Method is not allowed.
- *
- * @see DavResource#addMember(DavResource)
- */
- public void addMember(DavResource resource) throws DavException {
- throw new DavException(DavServletResponse.SC_METHOD_NOT_ALLOWED, "Cannot add members to a non-collection resource");
- }
-
- /**
- * Always returns an empty iterator for a non-collection resource might
- * not have internal members.
- *
- * @return an empty iterator
- * @see DavResource#getMembers()
- */
- public DavResourceIterator getMembers() {
- log.warn("A non-collection resource never has internal members.");
- return new DavResourceIteratorImpl(new ArrayList(0));
- }
-
- /**
- * Method is not allowed.
- *
- * @see DavResource#removeMember(DavResource)
- */
- public void removeMember(DavResource member) throws DavException {
- throw new DavException(DavServletResponse.SC_METHOD_NOT_ALLOWED, "Cannot remove members from a non-collection resource");
- }
-
- /**
- * {@link javax.jcr.Property JCR properties} are locked if their
- * parent node is locked; thus this method will always return the
- * {@link ActiveLock lock} object from the collection this resource is
- * internal member of.
- *
- * @param type
- * @param scope
- * @return lock present on this resource or null
if this resource
- * has no lock.
- * @see DavResource#getLock(Type, Scope)
- */
- public ActiveLock getLock(Type type, Scope scope) {
- if (Type.WRITE.equals(type)) {
- return getCollection().getLock(type, scope);
- } else {
- return super.getLock(type, scope);
- }
- }
-
- //--------------------------------------------------------------------------
- /**
- * Add resource specific properties.
- */
- protected void initProperties() {
- super.initProperties();
- if (exists()) {
- try {
- Property prop = (Property)item;
- int type = prop.getType();
-
- // set the content type
- String contentType;
- if (!isMultiple()) {
- contentType = (type == PropertyType.BINARY) ? "application/octet-stream" : "text/plain";
- properties.add(new DefaultDavProperty(DavPropertyName.GETCONTENTTYPE, contentType));
- } // else: no contenttype for multivalue properties
-
- // add jcr-specific resource properties
- properties.add(new DefaultDavProperty(JCR_TYPE, PropertyType.nameFromValue(type)));
- if (isMultiple()) {
- properties.add(new ValuesProperty(prop.getValues()));
- properties.add(new LengthsProperty(prop.getLengths()));
- } else {
- properties.add(new DefaultDavProperty(JCR_VALUE, prop.getString()));
- properties.add(new DefaultDavProperty(JCR_LENGTH, String.valueOf(prop.getLength())));
- }
- } catch (RepositoryException e) {
- log.error("Failed to retrieve resource properties: "+e.getMessage());
- }
- }
- }
-
- /**
- * Returns true if the JCR Property represented by this resource is a multi
- * value property. Note: if this resource does not exist or if the definition
- * could not be retrieved false is returned.
- *
- * @return true if the underlaying resource is a multi value property.
- */
- private boolean isMultiple() {
- try {
- if (exists() && ((Property)item).getDefinition().isMultiple()) {
- return true;
- }
- } catch (RepositoryException e) {
- log.error("Error while retrieving property definition: " + e.getMessage());
- }
- return false;
- }
-}
\ No newline at end of file
diff --git a/contrib/jcr-server/server/src/java/org/apache/jackrabbit/webdav/spi/ItemResourceConstants.java b/contrib/jcr-server/server/src/java/org/apache/jackrabbit/webdav/spi/ItemResourceConstants.java
deleted file mode 100644
index ab61ba606a6..00000000000
--- a/contrib/jcr-server/server/src/java/org/apache/jackrabbit/webdav/spi/ItemResourceConstants.java
+++ /dev/null
@@ -1,144 +0,0 @@
-/*
- * 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.spi;
-
-import org.jdom.Namespace;
-import org.apache.jackrabbit.webdav.property.DavPropertyName;
-import org.apache.jackrabbit.webdav.DavResource;
-import org.apache.jackrabbit.webdav.version.DeltaVResource;
-import org.apache.jackrabbit.webdav.lock.Scope;
-import org.apache.jackrabbit.webdav.search.SearchResource;
-import org.apache.jackrabbit.webdav.observation.ObservationResource;
-
-/**
- * ItemResourceConstants
provides constants for any resources
- * representing repository items.
- */
-public interface ItemResourceConstants {
-
- /**
- * Complience classes common to all item resources.
- */
- public static final String COMPLIANCE_CLASS = DavResource.COMPLIANCE_CLASS + ", " +ObservationResource.COMPLIANCE_CLASS + ", " + DeltaVResource.COMPLIANCE_CLASS;
-
- /**
- * 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 = "/";
-
- /**
- * The version storage item resource path.
- */
- public static final String VERSIONSTORAGE_PATH = "/jcr:system/jcr:versionStorage";
-
- /**
- * Constant for the mix:versionable node type name.
- */
- public static final String MIX_VERSIONABLE = "mix:versionable";
-
- /**
- * Constant for the mix:lockable node type name.
- */
- public static final String MIX_LOCKABLE = "mix:lockable";
-
- /**
- * The namespace for all jcr specific extensions.
- */
- public static final Namespace NAMESPACE = Namespace.getNamespace("jcr", "http://www.day.com/jcr/webdav/1.0");
-
- // xml element names
- public static final String XML_PRIMARYNODETYPE = "primarynodetype";
- public static final String XML_VALUE = "value";
- 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 review...
- public static final String XML_NAMESPACE = "namespace";
- public static final String XML_NSPREFIX = "nsPrefix";
- public static final String XML_NSURI = "nsURI";
-
- /**
- * Extension to the WebDAV 'exclusive' lock, that allows to distinguish
- * the session-scoped and open-scoped locks on a JCR node.
- *
- * @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";
-
- // 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_ISNEW = DavPropertyName.create("isnew", NAMESPACE);
- public static final DavPropertyName JCR_ISMODIFIED = DavPropertyName.create("ismodified", 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);
- 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 name for the jcr:created property present on Version items.
- */
- public static final DavPropertyName CREATED = DavPropertyName.create("created", ItemResourceConstants.NAMESPACE);
-
- // JCR property names
- public static final String PROP_LASTMODIFIED = "jcr:lastModified";
- public static final String PROP_CREATED = "jcr:created";
- public static final String PROP_BASEVERSION = "jcr:baseVersion";
- public static final String PROP_PREDECESSORS = "jcr:predecessors";
- public static final String PROP_MERGEFAILED = "jcr:mergeFailed";
-}
\ No newline at end of file
diff --git a/contrib/jcr-server/server/src/java/org/apache/jackrabbit/webdav/spi/JcrDavException.java b/contrib/jcr-server/server/src/java/org/apache/jackrabbit/webdav/spi/JcrDavException.java
deleted file mode 100644
index fbaa9e82073..00000000000
--- a/contrib/jcr-server/server/src/java/org/apache/jackrabbit/webdav/spi/JcrDavException.java
+++ /dev/null
@@ -1,130 +0,0 @@
-/*
- * 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.spi;
-
-import org.apache.log4j.Logger;
-import org.apache.jackrabbit.webdav.DavException;
-import org.apache.jackrabbit.webdav.DavServletResponse;
-import org.jdom.Element;
-
-import javax.jcr.*;
-import javax.jcr.query.InvalidQueryException;
-import javax.jcr.lock.LockException;
-import javax.jcr.version.VersionException;
-import javax.jcr.nodetype.*;
-
-/**
- * JcrDavException
extends the {@link DavException} in order to
- * wrap various repository exceptions.
- */
-public class JcrDavException extends DavException {
-
- private static Logger log = Logger.getLogger(JcrDavException.class);
-
- private Class exceptionClass;
-
- public JcrDavException(Exception e, int errorCode) {
- super(errorCode, e.getMessage());
- exceptionClass = e.getClass();
- }
-
- public JcrDavException(AccessDeniedException e) {
- this(e, DavServletResponse.SC_FORBIDDEN);
- }
-
- public JcrDavException(ConstraintViolationException e) {
- this(e, DavServletResponse.SC_CONFLICT);
- }
-
- public JcrDavException(InvalidItemStateException e) {
- this(e, DavServletResponse.SC_CONFLICT);
- }
-
- public JcrDavException(InvalidSerializedDataException e) {
- this(e, DavServletResponse.SC_BAD_REQUEST);
- }
-
- public JcrDavException(InvalidQueryException e) {
- this(e, DavServletResponse.SC_BAD_REQUEST);
- }
-
- public JcrDavException(ItemExistsException e) {
- this(e, DavServletResponse.SC_CONFLICT);
- }
-
- public JcrDavException(ItemNotFoundException e) {
- this(e, DavServletResponse.SC_FORBIDDEN);
- }
-
- public JcrDavException(LockException e) {
- this(e, DavServletResponse.SC_LOCKED);
- }
-
- public JcrDavException(MergeException e) {
- this(e, DavServletResponse.SC_CONFLICT);
- }
-
- public JcrDavException(NamespaceException e) {
- this(e, DavServletResponse.SC_CONFLICT);
- }
-
- public JcrDavException(NoSuchNodeTypeException e) {
- this(e, DavServletResponse.SC_CONFLICT);
- }
-
- public JcrDavException(NoSuchWorkspaceException e) {
- this(e, DavServletResponse.SC_CONFLICT);
- }
-
- public JcrDavException(PathNotFoundException e) {
- this(e, DavServletResponse.SC_CONFLICT);
- }
-
- public JcrDavException(ReferentialIntegrityException e) {
- this(e, DavServletResponse.SC_CONFLICT);
- }
-
- public JcrDavException(RepositoryException e) {
- this(e, DavServletResponse.SC_FORBIDDEN);
- }
-
- public JcrDavException(UnsupportedRepositoryOperationException e) {
- this(e, DavServletResponse.SC_NOT_IMPLEMENTED);
- }
-
- public JcrDavException(ValueFormatException e) {
- this(e, DavServletResponse.SC_CONFLICT);
- }
-
- public JcrDavException(VersionException e) {
- this(e, DavServletResponse.SC_CONFLICT);
- }
-
- /**
- * Returns a DAV:error Xml element containing the exceptions class and the
- * message as child elements.
- *
- * @return Xml representation of this exception.
- */
- public Element getError() {
- Element error = super.getError();
- Element excep = new Element("exception", ItemResourceConstants.NAMESPACE);
- excep.addContent(new Element("class", ItemResourceConstants.NAMESPACE).setText(exceptionClass.getName()));
- excep.addContent(new Element("message", ItemResourceConstants.NAMESPACE).setText(getMessage()));
- error.addContent(excep);
- return error;
- }
-}
\ No newline at end of file
diff --git a/contrib/jcr-server/server/src/java/org/apache/jackrabbit/webdav/spi/RootCollection.java b/contrib/jcr-server/server/src/java/org/apache/jackrabbit/webdav/spi/RootCollection.java
deleted file mode 100644
index 4ee1ad8ec4b..00000000000
--- a/contrib/jcr-server/server/src/java/org/apache/jackrabbit/webdav/spi/RootCollection.java
+++ /dev/null
@@ -1,202 +0,0 @@
-/*
- * 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.spi;
-
-import org.apache.log4j.Logger;
-import org.apache.jackrabbit.webdav.*;
-import org.apache.jackrabbit.webdav.spi.version.report.RegisteredNamespacesReport;
-import org.apache.jackrabbit.webdav.spi.version.report.NodeTypesReport;
-import org.apache.jackrabbit.webdav.version.report.SupportedReportSetProperty;
-import org.apache.jackrabbit.webdav.version.report.ReportType;
-
-import javax.jcr.RepositoryException;
-import javax.jcr.Session;
-import java.util.*;
-import java.io.InputStream;
-
-/**
- * RootCollection
represent the WebDAV root resource that does not
- * represent any repository item. A call to getMembers() returns a
- * DavResourceIterator
containing only RootItemCollection
- * resources, thus revealing the names of the accessable workspaces.
- */
-public class RootCollection extends AbstractResource implements DavResource {
-
- private static Logger log = Logger.getLogger(RootCollection.class);
-
- /**
- * Create a new RootCollection
.
- *
- * @param locator
- * @param session
- */
- protected RootCollection(DavResourceLocator locator, DavSession session, DavResourceFactory factory) {
- super(locator, session, factory);
- setModificationTime(new Date().getTime());
- }
-
- /**
- * Returns a string listing the complieance classes for this resource as it
- * is required for the DAV response header.
- *
- * @return string listing the compliance classes.
- * @see org.apache.jackrabbit.webdav.DavResource#getComplianceClass()
- */
- public String getComplianceClass() {
- return DavResource.COMPLIANCE_CLASS;
- }
-
- /**
- * Returns a string listing the METHODS for this resource as it
- * is required for the "Allow" response header.
- *
- * @return string listing the METHODS allowed
- * @see org.apache.jackrabbit.webdav.DavResource#getSupportedMethods()
- */
- public String getSupportedMethods() {
- StringBuffer sb = new StringBuffer(DavResource.METHODS);
- return sb.toString();
- }
-
- /**
- * Returns true
- *
- * @return true
- * @see org.apache.jackrabbit.webdav.DavResource#exists()
- */
- public boolean exists() {
- return true;
- }
-
- /**
- * Returns true
- *
- * @return true
- * @see org.apache.jackrabbit.webdav.DavResource#isCollection()
- */
- public boolean isCollection() {
- return true;
- }
-
- /**
- * Returns an empty string.
- *
- * @return empty string
- * @see org.apache.jackrabbit.webdav.DavResource#getDisplayName()
- */
- public String getDisplayName() {
- return "";
- }
-
- /**
- * Always returns null
- *
- * @return null
for the root resource is not internal member
- * of any resource.
- * @see org.apache.jackrabbit.webdav.DavResource#getCollection()
- */
- public DavResource getCollection() {
- return null;
- }
-
- /**
- * Throws exception: 403 Forbidden.
- * @see DavResource#addMember(DavResource, InputStream)
- */
- public void addMember(DavResource resource, InputStream in) throws DavException {
- throw new DavException(DavServletResponse.SC_FORBIDDEN);
- }
-
- /**
- * Throws exception: 403 Forbidden.
- * @see DavResource#addMember(org.apache.jackrabbit.webdav.DavResource)
- */
- public void addMember(DavResource resource) throws DavException {
- throw new DavException(DavServletResponse.SC_FORBIDDEN);
- }
-
- /**
- * Returns an iterator over the member resources, which are all
- * RootItemCollection
resources, revealing
- * the names of all available workspaces.
- *
- * @return members of this collection
- * @see org.apache.jackrabbit.webdav.DavResource#getMembers()
- */
- public DavResourceIterator getMembers() {
- List memberList = new ArrayList();
- try {
- String[] wsNames = getSession().getRepositorySession().getWorkspace().getAccessibleWorkspaceNames();
- for (int i = 0; i < wsNames.length; i++) {
- DavResourceLocator childLoc = getLocator().getFactory().createResourceLocator(getLocator().getPrefix(), "/"+wsNames[i], ItemResourceConstants.ROOT_ITEM_PATH);
- memberList.add(createResourceFromLocator(childLoc));
- }
- } catch (RepositoryException e) {
- log.error(e.getMessage());
- } catch (DavException e) {
- // should never occur
- log.error(e.getMessage());
- }
- return new DavResourceIteratorImpl(memberList);
- }
-
- /**
- * Throws exception: 403 Forbidden.
- * @see DavResource#removeMember(org.apache.jackrabbit.webdav.DavResource)
- */
- public void removeMember(DavResource member) throws DavException {
- throw new DavException(DavServletResponse.SC_FORBIDDEN);
- }
-
- //--------------------------------------------------------------------------
- /**
- * @see AbstractResource#initLockSupport()
- */
- protected void initLockSupport() {
- // no locking supported
- }
-
- /**
- * @see AbstractResource#initSupportedReports()
- */
- protected void initSupportedReports() {
- if (exists()) {
- supportedReports = new SupportedReportSetProperty(new ReportType[] {
- ReportType.EXPAND_PROPERTY,
- NodeTypesReport.NODETYPES_REPORT,
- RegisteredNamespacesReport.REGISTERED_NAMESPACES_REPORT
- });
- }
- }
-
- /**
- * Since the root resource does not represent a repository item and therefore
- * is not member of a workspace resource, the workspace href is calculated
- * from the workspace name retrieved from the underlaying repository session.
- *
- * @return workspace href build from workspace name.
- * @see AbstractResource#getWorkspaceHref()
- */
- protected String getWorkspaceHref() {
- Session session = this.getRepositorySession();
- if (session != null) {
- String workspaceName = session.getWorkspace().getName();
- DavResourceLocator loc = getLocator().getFactory().createResourceLocator(getLocator().getPrefix(), "/"+workspaceName, ItemResourceConstants.ROOT_ITEM_PATH);
- return loc.getHref(true);
- }
- return null;
- }
-}
\ No newline at end of file
diff --git a/contrib/jcr-server/server/src/java/org/apache/jackrabbit/webdav/spi/RootItemCollection.java b/contrib/jcr-server/server/src/java/org/apache/jackrabbit/webdav/spi/RootItemCollection.java
deleted file mode 100644
index 30219571ae1..00000000000
--- a/contrib/jcr-server/server/src/java/org/apache/jackrabbit/webdav/spi/RootItemCollection.java
+++ /dev/null
@@ -1,105 +0,0 @@
-/*
- * 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.spi;
-
-import org.apache.log4j.Logger;
-import org.apache.jackrabbit.webdav.*;
-import org.apache.jackrabbit.webdav.property.DefaultDavProperty;
-import org.apache.jackrabbit.webdav.property.DavProperty;
-import org.jdom.Element;
-
-import javax.jcr.NamespaceRegistry;
-import javax.jcr.RepositoryException;
-
-/**
- * RootItemCollection
represents the root node of the underlaying
- * repository. However, the display name the name of the workspace is returned
- * the root node is located.
- *
- * @todo currently the jcr root node is the same for all workspace resources... this is wrong...
- */
-public class RootItemCollection extends VersionControlledItemCollection {
-
- private static Logger log = Logger.getLogger(RootItemCollection.class);
-
- /**
- * Create a new RootItemCollection
.
- *
- * @param locator
- * @param session
- */
- protected RootItemCollection(DavResourceLocator locator, DavSession session, DavResourceFactory factory) {
- super(locator, session, factory);
- }
-
- //----------------------------------------------< DavResource interface >---
- /**
- * Returns the name of the workspace the underlaying root item forms part of.
- *
- * @return The workspace name
- * @see org.apache.jackrabbit.webdav.DavResource#getDisplayName()
- * @see javax.jcr.Workspace#getName()
- */
- public String getDisplayName() {
- return getLocator().getWorkspaceName();
- }
-
- /**
- * Retrieve the collection that has all root item / workspace collections
- * as internal members.
- *
- * @see org.apache.jackrabbit.webdav.DavResource#getCollection()
- */
- public DavResource getCollection() {
- DavResource collection = null;
- // create location with 'null' values for workspace-path and resource-path
- DavResourceLocator parentLoc = getLocator().getFactory().createResourceLocator(getLocator().getPrefix(), null, null);
- try {
- collection = createResourceFromLocator(parentLoc);
- } catch (DavException e) {
- log.error("Unexpected error while retrieving collection: " + e.getMessage());
- }
- return collection;
- }
-
- public void setProperty(DavProperty property) throws DavException {
- if (ItemResourceConstants.JCR_NAMESPACES.equals(property.getName())) {
- // todo: register and unregister namespaces
- } else {
- super.setProperty(property);
- }
- }
-
- //--------------------------------------------------------------------------
- protected void initProperties() {
- super.initProperties();
- try {
- // init workspace specific properties
- NamespaceRegistry nsReg = getRepositorySession().getWorkspace().getNamespaceRegistry();
- String[] prefixes = nsReg.getPrefixes();
- Element[] nsElems = new Element[prefixes.length];
- for (int i = 0; i < prefixes.length; i++) {
- Element elem = new Element(XML_NAMESPACE, NAMESPACE);
- elem.addContent(new Element(XML_NSPREFIX).setText(prefixes[i]));
- elem.addContent(new Element(XML_NSURI)).setText(nsReg.getURI(prefixes[i]));
- nsElems[i] = elem;
- }
- properties.add(new DefaultDavProperty(ItemResourceConstants.JCR_NAMESPACES, nsElems, false));
- } catch (RepositoryException e) {
- log.error("Failed to access NamespaceRegistry from the session/workspace: " + e.getMessage());
- }
- }
-}
\ No newline at end of file
diff --git a/contrib/jcr-server/server/src/java/org/apache/jackrabbit/webdav/spi/VersionControlledItemCollection.java b/contrib/jcr-server/server/src/java/org/apache/jackrabbit/webdav/spi/VersionControlledItemCollection.java
deleted file mode 100644
index 34f4ba11fa7..00000000000
--- a/contrib/jcr-server/server/src/java/org/apache/jackrabbit/webdav/spi/VersionControlledItemCollection.java
+++ /dev/null
@@ -1,582 +0,0 @@
-/*
- * 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.spi;
-
-import org.apache.log4j.Logger;
-import org.apache.jackrabbit.webdav.property.*;
-import org.apache.jackrabbit.webdav.*;
-import org.apache.jackrabbit.webdav.version.*;
-import org.apache.jackrabbit.webdav.version.report.*;
-
-import javax.jcr.*;
-import javax.jcr.observation.*;
-import javax.jcr.observation.EventListener;
-import javax.jcr.version.Version;
-import javax.jcr.version.VersionHistory;
-import java.util.List;
-
-/**
- * VersionControlledItemCollection
represents a JCR node item and
- * covers all functionality related to versioning of {@link Node}s.
- *
- * @see Node
- */
-public class VersionControlledItemCollection extends DefaultItemCollection
- implements VersionControlledResource {
-
- private static Logger log = Logger.getLogger(VersionControlledItemCollection.class);
-
- /**
- * Create a new VersionControlledItemCollection
.
- *
- * @param locator
- * @param session
- */
- public VersionControlledItemCollection(DavResourceLocator locator, DavSession session, DavResourceFactory factory) {
- super(locator, session, factory);
- if (exists() && !(item instanceof Node)) {
- throw new IllegalArgumentException("A collection resource can not be constructed from a Property item.");
- }
- }
-
- //----------------------------------------------< DavResource interface >---
- /**
- * Return a comma separated string listing the supported method names.
- *
- * @return the supported method names.
- * @see org.apache.jackrabbit.webdav.DavResource#getSupportedMethods()
- */
- public String getSupportedMethods() {
- StringBuffer sb = new StringBuffer(super.getSupportedMethods());
- // Versioning support
- sb.append(", ").append(VersionableResource.METHODS);
- if (this.isVersionControlled()) {
- try {
- if (((Node)item).isCheckedOut()) {
- sb.append(", ").append(VersionControlledResource.methods_checkedOut);
- } else {
- sb.append(", ").append(VersionControlledResource.methods_checkedIn);
- }
- } catch (RepositoryException e) {
- // should not occur.
- log.error(e.getMessage());
- }
- }
- return sb.toString();
- }
-
- //--------------------------------< VersionControlledResource interface >---
- /**
- * Adds version control to this resource. If the resource is already under
- * version control, this method has no effect.
- *
- * @throws org.apache.jackrabbit.webdav.DavException if this resource does not
- * exist yet or if an error occurs while making the underlaying node versionable.
- * @see org.apache.jackrabbit.webdav.version.VersionableResource#addVersionControl()
- */
- public void addVersionControl() throws DavException {
- if (!exists()) {
- throw new DavException(DavServletResponse.SC_NOT_FOUND);
- }
- if (!isVersionControlled()) {
- try {
- ((Node)item).addMixin(MIX_VERSIONABLE);
- item.save();
- } catch (RepositoryException e) {
- throw new JcrDavException(e);
- }
- } // else: is already version controlled -> ignore
- }
-
- /**
- * Calls {@link javax.jcr.Node#checkin()} on the underlaying repository node.
- *
- * @throws org.apache.jackrabbit.webdav.DavException
- * @see org.apache.jackrabbit.webdav.version.VersionControlledResource#checkin()
- */
- public String checkin() throws DavException {
- if (!exists()) {
- throw new DavException(DavServletResponse.SC_NOT_FOUND);
- }
- if (!isVersionControlled()) {
- throw new DavException(DavServletResponse.SC_METHOD_NOT_ALLOWED);
- }
- try {
- Version v = ((Node) item).checkin();
- DavResourceLocator loc = getLocator();
- String versionHref = loc.getFactory().createResourceLocator(loc.getPrefix(), loc.getWorkspacePath(), v.getPath()).getHref(true);
- return versionHref;
- } catch (RepositoryException e) {
- // UnsupportedRepositoryException should not occur
- throw new JcrDavException(e);
- }
- }
-
- /**
- * Calls {@link javax.jcr.Node#checkout()} on the underlaying repository node.
- *
- * @throws org.apache.jackrabbit.webdav.DavException
- * @see org.apache.jackrabbit.webdav.version.VersionControlledResource#checkout()
- */
- public void checkout() throws DavException {
- if (!exists()) {
- throw new DavException(DavServletResponse.SC_NOT_FOUND);
- }
- if (!isVersionControlled()) {
- throw new DavException(DavServletResponse.SC_METHOD_NOT_ALLOWED);
- }
- try {
- ((Node) item).checkout();
- } catch (RepositoryException e) {
- // UnsupportedRepositoryException should not occur
- throw new JcrDavException(e);
- }
- }
-
- /**
- * Not implemented. Always throws a DavException
with error code
- * {@link org.apache.jackrabbit.webdav.DavServletResponse#SC_NOT_IMPLEMENTED}.
- *
- * @throws org.apache.jackrabbit.webdav.DavException
- * @see org.apache.jackrabbit.webdav.version.VersionControlledResource#uncheckout()
- */
- public void uncheckout() throws DavException {
- throw new DavException(DavServletResponse.SC_NOT_IMPLEMENTED);
- }
-
- /**
- * Perform an update on this resource. Depending on the format of the updateInfo
- * this is translated to one of the following methods defined by the JCR API:
- *
- *
- *
MultiStatus
returned by this method
- * will not list any nodes that have been removed due to an Uuid conflict.
- *
- * @param updateInfo
- * @return
- * @throws org.apache.jackrabbit.webdav.DavException
- * @see org.apache.jackrabbit.webdav.version.VersionControlledResource#update(org.apache.jackrabbit.webdav.version.UpdateInfo)
- * @todo with jcr the node must not be versionable in order to perform Node.update.
- */
- public MultiStatus update(UpdateInfo updateInfo) throws DavException {
- if (updateInfo == null) {
- throw new DavException(DavServletResponse.SC_BAD_REQUEST, "Valid update request body required.");
- }
- if (!exists()) {
- throw new DavException(DavServletResponse.SC_NOT_FOUND);
- }
-
- MultiStatus ms = new MultiStatus();
- try {
- Node node = (Node)item;
- boolean removeExisting = updateInfo.getUpdateElement().getChild(XML_REMOVEEXISTING, NAMESPACE) != null;
-
- // register eventListener in order to be able to report the modified resources.
- EventListener el = new EListener(updateInfo.getPropertyNameSet(), ms);
- registerEventListener(el, node.getPath());
-
- // perform the update/restore according to the update info
- if (updateInfo.getVersionHref() != null) {
- VersionHistory vh = node.getVersionHistory();
- String[] hrefs = updateInfo.getVersionHref();
- Version[] versions = new Version[hrefs.length];
- for (int i = 0; i < hrefs.length; i++) {
- versions[i] = vh.getVersion(getResourceName(hrefs[i], true));
- }
- if (versions.length == 1) {
- String relPath = updateInfo.getUpdateElement().getChildText(XML_RELPATH, NAMESPACE);
- if (relPath == null) {
- node.restore(versions[0], removeExisting);
- } else {
- node.restore(versions[0], relPath, removeExisting);
- }
- } else {
- getRepositorySession().getWorkspace().restore(versions, removeExisting);
- }
- } else if (updateInfo.getLabelName() != null) {
- String[] labels = updateInfo.getLabelName();
- if (labels.length == 1) {
- node.restoreByLabel(labels[0], removeExisting);
- } else {
- Version[] vs = new Version[labels.length];
- VersionHistory vh = node.getVersionHistory();
- for (int i = 0; i < labels.length; i++) {
- vs[i] = vh.getVersionByLabel(labels[i]);
- }
- getRepositorySession().getWorkspace().restore(vs, removeExisting);
- }
- } else if (updateInfo.getWorkspaceHref() != null) {
- String workspaceName = getResourceName(updateInfo.getWorkspaceHref(), true);
- node.update(workspaceName);
- } else {
- throw new DavException(DavServletResponse.SC_BAD_REQUEST, "Invalid update request body.");
- }
-
- // unregister the event listener again
- unregisterEventListener(el);
-
- } catch (RepositoryException e) {
- throw new JcrDavException(e);
- }
- return ms;
- }
-
- /**
- * Merge the repository node represented by this resource according to the
- * information present in the given {@link MergeInfo} object.
- *
- * @param mergeInfo
- * @return MultiStatus
reccording all repository items affected
- * by this merge call.
- * @throws org.apache.jackrabbit.webdav.DavException
- * @see org.apache.jackrabbit.webdav.version.VersionControlledResource#merge(org.apache.jackrabbit.webdav.version.MergeInfo)
- * @see Node#merge(String, boolean)
- * @todo with jcr the node must not be versionable in order to perform Node.merge
- */
- public MultiStatus merge(MergeInfo mergeInfo) throws DavException {
- if (mergeInfo == null) {
- throw new DavException(DavServletResponse.SC_BAD_REQUEST);
- }
- if (!exists()) {
- throw new DavException(DavServletResponse.SC_NOT_FOUND);
- }
-
- MultiStatus ms = new MultiStatus();
- try {
- Node node = (Node)item;
-
- // register eventListener in order to be able to report the modifications.
- EventListener el = new EListener(mergeInfo.getPropertyNameSet(), ms);
- registerEventListener(el, node.getPath());
-
- String workspaceName = getResourceName(mergeInfo.getSourceHref(), true);
- node.merge(workspaceName, !mergeInfo.isNoAutoMerge());
-
- // unregister the event listener again
- unregisterEventListener(el);
-
- } catch (RepositoryException e) {
- throw new JcrDavException(e);
- }
-
- return ms;
- }
-
- /**
- * Resolve the merge conflicts according to the value of the {@link #AUTO_MERGE_SET DAV:auto-merge-set}
- * property present in the specified DavPropertySet
s.
- *
- * @param setProperties
- * @param removePropertyNames
- * @throws org.apache.jackrabbit.webdav.DavException
- * @see VersionControlledResource#resolveMergeConflict(DavPropertySet, DavPropertyNameSet)
- * @see Node#doneMerge(Version)
- * @see Node#cancelMerge(Version)
- */
- public void resolveMergeConflict(DavPropertySet setProperties,
- DavPropertyNameSet removePropertyNames) throws DavException {
-
- if (!exists()) {
- throw new DavException(DavServletResponse.SC_NOT_FOUND);
- }
- if (!isVersionControlled()) {
- throw new DavException(DavServletResponse.SC_METHOD_NOT_ALLOWED);
- }
-
- try {
- Node n = (Node)item;
- if (removePropertyNames.contains(AUTO_MERGE_SET)) {
- // retrieve the current jcr:mergeFailed property values
- if (!((Node)item).hasProperty(PROP_MERGEFAILED)) {
- throw new DavException(DavServletResponse.SC_CONFLICT, "Attempt to resolve non-existing merge conflicts.");
- }
- Value[] mergeFailed = ((Node)item).getProperty(PROP_MERGEFAILED).getValues();
-
- // resolve all remaining merge conflicts with 'cancel'
- for (int i = 0; i < mergeFailed.length; i++) {
- n.cancelMerge((Version)getRepositorySession().getNodeByUUID(mergeFailed[i].getString()));
- }
- // adjust removeProperty set
- removePropertyNames.remove(AUTO_MERGE_SET);
-
- } else if (setProperties.contains(AUTO_MERGE_SET) && setProperties.contains(PREDECESSOR_SET)){
- // retrieve the current jcr:mergeFailed property values
- if (!((Node)item).hasProperty(PROP_MERGEFAILED)) {
- throw new DavException(DavServletResponse.SC_CONFLICT, "Attempt to resolve non-existing merge conflicts.");
- }
- Value[] mergeFailed = ((Node)item).getProperty(PROP_MERGEFAILED).getValues();
-
-
- // check which mergeFailed entries have been removed from the
- // auto-merge-set (cancelMerge) and have been moved over to the
- // predecessor set (doneMerge)
- List mergeset = new HrefProperty(setProperties.get(AUTO_MERGE_SET)).getHrefs();
- List predecSet = new HrefProperty(setProperties.get(PREDECESSOR_SET)).getHrefs();
-
- Session session = getRepositorySession();
- for (int i = 0; i < mergeFailed.length; i++) {
- // build version-href from each entry in the jcr:mergeFailed property
- Version version = (Version) session.getNodeByUUID(mergeFailed[i].getString());
- String href = this.getLocatorFromItem(version).getHref(true);
-
- // Test if that version has been removed from the merge-set.
- // thus indicating that the merge-conflict needs to be resolved.
- if (!mergeset.contains(href)) {
- // Test if the 'href' has been moved over to the
- // predecessor-set (thus 'doneMerge' is appropriate) or
- // if it is not present in the predecessor set and the
- // the conflict is resolved by 'cancelMerge'.
- if (predecSet.contains(href)) {
- n.doneMerge(version);
- } else {
- n.cancelMerge(version);
- }
- }
- }
- // adjust setProperty set
- setProperties.remove(AUTO_MERGE_SET);
- setProperties.remove(PREDECESSOR_SET);
- } else {
- // setPropertySet and removePropertySet do not ask for resolving merge conflicts */
- log.debug("setProperties and removeProperties sets do not request for merge conflict resolution.");
- }
- } catch (RepositoryException e) {
- throw new JcrDavException(e);
- }
- }
-
- /**
- * Modify the labels present with the versions of this resource.
- *
- * @param labelInfo
- * @throws DavException
- * @see VersionHistory#addVersionLabel(String, String, boolean)
- * @see VersionHistory#removeVersionLabel(String)
- */
- public void label(LabelInfo labelInfo) throws DavException {
- if (labelInfo == null) {
- throw new DavException(DavServletResponse.SC_BAD_REQUEST, "Valid label request body required.");
- }
- if (!exists()) {
- throw new DavException(DavServletResponse.SC_NOT_FOUND);
- }
-
- try {
- if (!isVersionControlled() || ((Node)item).isCheckedOut()) {
- throw new DavException(DavServletResponse.SC_PRECONDITION_FAILED, "A LABEL request may only be applied to a version-controlled, checked-in resource.");
- }
- DavResource[] resArr = this.getReferenceResources(CHECKED_IN);
- if (resArr.length == 1 && resArr[0] instanceof VersionResource) {
- ((VersionResource)resArr[0]).label(labelInfo);
- } else {
- throw new DavException(DavServletResponse.SC_INTERNAL_SERVER_ERROR, "DAV:checked-in property on '" + getHref() + "' did not point to a single VersionResource.");
- }
- } catch (RepositoryException e) {
- throw new JcrDavException(e);
- }
- }
-
- /**
- * Returns the {@link VersionHistory} associated with the repository node.
- * If the node is not versionable an exception is thrown.
- *
- * @return the {@link VersionHistoryResource} associated with this resource.
- * @throws org.apache.jackrabbit.webdav.DavException
- * @see org.apache.jackrabbit.webdav.version.VersionControlledResource#getVersionHistory()
- * @see javax.jcr.Node#getVersionHistory()
- */
- public VersionHistoryResource getVersionHistory() throws DavException {
- if (!exists()) {
- throw new DavException(DavServletResponse.SC_NOT_FOUND);
- }
-
- try {
- VersionHistory vh = ((Node)item).getVersionHistory();
- DavResourceLocator loc = getLocatorFromItem(vh);
- return (VersionHistoryResource) createResourceFromLocator(loc);
- } catch (RepositoryException e) {
- throw new JcrDavException(e);
- }
- }
-
- //--------------------------------------------------------------------------
- /**
- * Define the set of reports supported by this resource.
- *
- * @see SupportedReportSetProperty
- */
- protected void initSupportedReports() {
- super.initSupportedReports();
- if (exists()) {
- supportedReports.addReportType(ReportType.LOCATE_BY_HISTORY);
- if (this.isVersionControlled()) {
- supportedReports.addReportType(ReportType.VERSION_TREE);
- }
- }
- }
-
- /**
- * Fill the property set for this resource.
- */
- protected void initProperties() {
- super.initProperties();
- if (exists()) {
- Node n = (Node)item;
- // properties defined by RFC 3253 for version-controlled resources
- if (isVersionControlled()) {
- // workspace property already set in AbstractResource.initProperties()
- try {
- // DAV:version-history (computed)
- String vhHref = getLocatorFromResourcePath(n.getVersionHistory().getPath()).getHref(true);
- properties.add(new HrefProperty(VERSION_HISTORY, vhHref, true));
-
- // DAV:auto-version property: there is no auto version, explicit CHECKOUT is required.
- properties.add(new DefaultDavProperty(AUTO_VERSION, null, false));
-
- String baseVHref = getLocatorFromResourcePath(n.getBaseVersion().getPath()).getHref(true);
- if (n.isCheckedOut()) {
- // DAV:checked-out property (protected)
- properties.add(new HrefProperty(CHECKED_OUT, baseVHref, true));
-
- // DAV:predecessors property
- if (n.hasProperty(PROP_PREDECESSORS)) {
- Value[] predec = n.getProperty(PROP_PREDECESSORS).getValues();
- addHrefProperty(PREDECESSOR_SET, predec, false);
- }
- // DAV:auto-merge-set property. NOTE: the DAV:merge-set
- // never occurs, because merging without bestEffort flag
- // being set results in an exception on failure.
- if (n.hasProperty(PROP_MERGEFAILED)) {
- ReferenceValue[] mergeFailed = (ReferenceValue[]) n.getProperty(PROP_MERGEFAILED).getValues();
- addHrefProperty(AUTO_MERGE_SET, mergeFailed, false);
- }
- // todo: checkout-fork, checkin-fork
- } else {
- // DAV:checked-in property (protected)
- properties.add(new HrefProperty(CHECKED_IN, baseVHref, true));
- }
- } catch (RepositoryException e) {
- log.error(e.getMessage());
- }
- }
- }
- }
-
- /**
- * Add a {@link org.apache.jackrabbit.webdav.property.HrefProperty} with the specified property name and values.
- *
- * @param name
- * @param values Array of {@link ReferenceValue}s.
- * @param isProtected
- * @throws javax.jcr.ValueFormatException
- * @throws IllegalStateException
- * @throws javax.jcr.RepositoryException
- */
- private void addHrefProperty(DavPropertyName name, Value[] values,
- boolean isProtected)
- throws ValueFormatException, IllegalStateException, RepositoryException {
- Node[] nodes = new Node[values.length];
- for (int i = 0; i < values.length; i++) {
- nodes[i] = getRepositorySession().getNodeByUUID(values[i].getString());
- }
- addHrefProperty(name, nodes, isProtected);
- }
-
- /**
- * @return true, if this resource represents an existing repository node
- * that has the mixin nodetype 'mix:versionable' set.
- */
- private boolean isVersionControlled() {
- boolean vc = false;
- if (exists()) {
- try {
- vc = ((Node) item).isNodeType("mix:versionable");
- } catch (RepositoryException e) {
- log.warn(e.getMessage());
- }
- }
- return vc;
- }
-
- /**
- * Register the specified event listener with the observation manager present
- * the repository session.
- *
- * @param listener
- * @param nodePath
- * @throws javax.jcr.RepositoryException
- */
- private void registerEventListener(EventListener listener, String nodePath) throws RepositoryException {
- getRepositorySession().getWorkspace().getObservationManager().addEventListener(listener, EListener.ALL_EVENTS, nodePath, true, null, null, false);
- }
-
- /**
- * Unregister the specified event listener with the observation manager present
- * the repository session.
- *
- * @param listener
- * @throws javax.jcr.RepositoryException
- */
- private void unregisterEventListener(EventListener listener) throws RepositoryException {
- getRepositorySession().getWorkspace().getObservationManager().removeEventListener(listener);
- }
-
- //------------------------------------------------------< inner classes >---
- /**
- * Simple EventListener that creates a new {@link org.apache.jackrabbit.webdav.MultiStatusResponse} object
- * for each event and adds it to the specified {@link org.apache.jackrabbit.webdav.MultiStatus}.
- */
- private class EListener implements EventListener {
-
- private static final int ALL_EVENTS = Event.NODE_ADDED | Event.NODE_REMOVED | Event.PROPERTY_ADDED | Event.PROPERTY_CHANGED | Event.PROPERTY_REMOVED;
-
- private final DavPropertyNameSet propNameSet;
- private MultiStatus ms;
-
- private EListener(DavPropertyNameSet propNameSet, MultiStatus ms) {
- this.propNameSet = propNameSet;
- this.ms = ms;
- }
-
- /**
- * @see EventListener#onEvent(javax.jcr.observation.EventIterator)
- */
- public void onEvent(EventIterator events) {
- while (events.hasNext()) {
- try {
- Event e = events.nextEvent();
- String itemPath = e.getPath();
- DavResourceLocator loc = getLocatorFromResourcePath(itemPath);
- DavResource res = createResourceFromLocator(loc);
- ms.addResponse(new MultiStatusResponse(res, propNameSet));
-
- } catch (DavException e) {
- // should not occur
- log.error("Error while building MultiStatusResponse from Event: " + e.getMessage());
- } catch (RepositoryException e) {
- // should not occur
- log.error("Error while building MultiStatusResponse from Event: " + e.getMessage());
- }
- }
- }
- }
-}
\ No newline at end of file
diff --git a/contrib/jcr-server/server/src/java/org/apache/jackrabbit/webdav/spi/lock/JcrActiveLock.java b/contrib/jcr-server/server/src/java/org/apache/jackrabbit/webdav/spi/lock/JcrActiveLock.java
deleted file mode 100644
index 78e3fbb662d..00000000000
--- a/contrib/jcr-server/server/src/java/org/apache/jackrabbit/webdav/spi/lock/JcrActiveLock.java
+++ /dev/null
@@ -1,172 +0,0 @@
-/*
- * 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.spi.lock;
-
-import org.apache.log4j.Logger;
-import org.apache.jackrabbit.webdav.DavConstants;
-import org.apache.jackrabbit.webdav.spi.ItemResourceConstants;
-import org.apache.jackrabbit.webdav.lock.*;
-
-import javax.jcr.lock.Lock;
-import javax.jcr.Node;
-import javax.jcr.RepositoryException;
-
-/**
- * JcrActiveLock
wraps a {@link Lock JCR lock} object.
- */
-public class JcrActiveLock extends AbstractActiveLock implements ActiveLock, DavConstants {
-
- private static Logger log = Logger.getLogger(JcrActiveLock.class);
-
- private final Lock lock;
- private final boolean sessionScoped;
-
- /**
- * Create a new ActiveLock
object with type '{@link Type#WRITE write}'
- * and scope '{@link Scope#EXCLUSIVE exclusive}'.
- *
- * @param lock
- */
- public JcrActiveLock(Lock lock) {
- this (lock, false);
- }
-
- /**
- * Create a new ActiveLock
object with type '{@link Type#WRITE write}'
- * and scope '{@link Scope#EXCLUSIVE exclusive}'.
- *
- * @param lock
- */
- public JcrActiveLock(Lock lock, boolean sessionScoped) {
- if (lock == null) {
- throw new IllegalArgumentException("Can not create a ActiveLock with a 'null' argument.");
- }
- this.lock = lock;
- this.sessionScoped = sessionScoped;
- }
-
- /**
- * Return true if the given lock token equals the token holding that lock.
- *
- * @param lockToken
- * @return true if the given lock token equals this locks token.
- * @see org.apache.jackrabbit.webdav.lock.ActiveLock#isLockedByToken(String)
- */
- public boolean isLockedByToken(String lockToken) {
- if (lockToken != null && lockToken.equals(getToken())) {
- return true;
- }
- return false;
- }
-
- /**
- * @see ActiveLock#isExpired()
- */
- public boolean isExpired() {
- return lock.isLive();
- }
-
- /**
- * Return the lock token if the {@link javax.jcr.Session} that optained the lock
- * is the lock token holder, null
otherwise.SessionScopedLockEntry
represents the 'session-scoped' write
- * lock as defined by JCR.
- */
-public class SessionScopedLockEntry extends AbstractLockEntry {
-
- private static Logger log = Logger.getLogger(SessionScopedLockEntry.class);
-
- /**
- * @return always returns {@link Type#WRITE write}.
- * @see LockEntry#getType()
- */
- public Type getType() {
- return Type.WRITE;
- }
-
- /**
- * @return returns {@link ItemResourceConstants#EXCLUSIVE_SESSION}.
- * @see LockEntry#getScope()
- */
- public Scope getScope() {
- return ItemResourceConstants.EXCLUSIVE_SESSION;
- }
-}
\ No newline at end of file
diff --git a/contrib/jcr-server/server/src/java/org/apache/jackrabbit/webdav/spi/nodetype/ItemDefImpl.java b/contrib/jcr-server/server/src/java/org/apache/jackrabbit/webdav/spi/nodetype/ItemDefImpl.java
deleted file mode 100644
index f6962c5421d..00000000000
--- a/contrib/jcr-server/server/src/java/org/apache/jackrabbit/webdav/spi/nodetype/ItemDefImpl.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * Copyright 2004 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.spi.nodetype;
-
-import org.apache.log4j.Logger;
-import org.jdom.Element;
-
-import javax.jcr.nodetype.ItemDef;
-import javax.jcr.nodetype.NodeType;
-import javax.jcr.version.OnParentVersionAction;
-
-/**
- * ItemDefImpl
...
- */
-abstract public class ItemDefImpl implements ItemDef, NodeTypeConstants {
-
- private static Logger log = Logger.getLogger(ItemDefImpl.class);
-
- private final String name;
- private NodeType declaringNodeType;
- private final boolean isAutoCreated;
- private final boolean isMandatory;
- private final boolean isProtected;
- private final int onParentVersion;
-
- ItemDefImpl(ItemDef definition) {
- if (definition == null) {
- throw new IllegalArgumentException("PropDef argument can not be null");
- }
-
- name = definition.getName();
- declaringNodeType = definition.getDeclaringNodeType();
- isAutoCreated = definition.isAutoCreate();
- isMandatory = definition.isMandatory();
- isProtected = definition.isProtected();
- onParentVersion = definition.getOnParentVersion();
- }
-
- public NodeType getDeclaringNodeType() {
- return declaringNodeType;
- }
-
- public String getName() {
- return name;
- }
-
- public boolean isAutoCreate() {
- return isAutoCreated;
- }
-
- public boolean isMandatory() {
- return isMandatory;
- }
-
- public int getOnParentVersion() {
- return onParentVersion;
- }
-
- public boolean isProtected() {
- return isProtected;
- }
-
- //-------------------------------------< implementation specific method >---
- /**
- * Returns the Xml representation of a {@link ItemDef} object.
- *
- * @return Xml representation of the specified {@link ItemDef def}.
- */
- public Element toXml() {
- Element elem = new Element(getElementName());
- elem.setAttribute(ATTR_NAME, getName());
- elem.setAttribute(ATTR_AUTOCREATE, Boolean.toString(isAutoCreate()));
- elem.setAttribute(ATTR_MANDATORY, Boolean.toString(isMandatory()));
- elem.setAttribute(ATTR_ONPARENTVERSION, OnParentVersionAction.nameFromValue(getOnParentVersion()));
- elem.setAttribute(ATTR_PROTECTED, Boolean.toString(isProtected()));
- return elem;
- }
-
- public abstract String getElementName();
-}
\ No newline at end of file
diff --git a/contrib/jcr-server/server/src/java/org/apache/jackrabbit/webdav/spi/nodetype/NodeDefImpl.java b/contrib/jcr-server/server/src/java/org/apache/jackrabbit/webdav/spi/nodetype/NodeDefImpl.java
deleted file mode 100644
index 84f8585f380..00000000000
--- a/contrib/jcr-server/server/src/java/org/apache/jackrabbit/webdav/spi/nodetype/NodeDefImpl.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * Copyright 2004 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.spi.nodetype;
-
-import org.apache.log4j.Logger;
-import org.jdom.Element;
-
-import javax.jcr.nodetype.NodeDef;
-import javax.jcr.nodetype.NodeType;
-
-/**
- * NodeDefImpl
...
- */
-public final class NodeDefImpl extends ItemDefImpl implements NodeDef {
-
- private static Logger log = Logger.getLogger(NodeDefImpl.class);
-
- private final NodeType[] requiredPrimaryTypes;
- private final NodeType defaultPrimaryType;
- private final boolean allowSameNameSibs;
-
- private NodeDefImpl(NodeDef definition) {
- super(definition);
-
- requiredPrimaryTypes = definition.getRequiredPrimaryTypes();
- defaultPrimaryType = definition.getDefaultPrimaryType();
- allowSameNameSibs = definition.allowSameNameSibs();
- }
-
- public static NodeDefImpl create(NodeDef definition) {
- if (definition instanceof NodeDefImpl) {
- return (NodeDefImpl) definition;
- } else {
- return new NodeDefImpl(definition);
- }
- }
-
- //--------------------------------------------------< NodeDef interface >---
- public NodeType[] getRequiredPrimaryTypes() {
- return requiredPrimaryTypes;
- }
-
- public NodeType getDefaultPrimaryType() {
- return defaultPrimaryType;
- }
-
- public boolean allowSameNameSibs() {
- return allowSameNameSibs;
- }
-
- //-------------------------------------< implementation specific method >---
- public Element toXml() {
- Element elem = super.toXml();
-
- elem.setAttribute(ATTR_SAMENAMESIBS, Boolean.toString(allowSameNameSibs()));
-
- // defaultPrimaryType can be 'null'
- NodeType defaultPrimaryType = getDefaultPrimaryType();
- if (defaultPrimaryType != null) {
- elem.setAttribute(ATTR_DEFAULTPRIMARYTYPE, defaultPrimaryType.getName());
- }
- // reqPrimaryTypes: minimal set is nt:base.
- NodeType[] nts = getRequiredPrimaryTypes();
- Element reqPrimaryTypes = new Element(XML_REQUIREDPRIMARYTYPES);
- for (int i = 0; i < nts.length; i++) {
- reqPrimaryTypes.addContent(new Element(XML_REQUIREDPRIMARYTYPE).setText(nts[i].getName()));
- }
- elem.addContent(reqPrimaryTypes);
-
- return elem;
- }
-
- public String getElementName() {
- return XML_CHILDNODEDEF;
- }
-}
\ No newline at end of file
diff --git a/contrib/jcr-server/server/src/java/org/apache/jackrabbit/webdav/spi/nodetype/NodeTypeConstants.java b/contrib/jcr-server/server/src/java/org/apache/jackrabbit/webdav/spi/nodetype/NodeTypeConstants.java
deleted file mode 100644
index 2450e30db2e..00000000000
--- a/contrib/jcr-server/server/src/java/org/apache/jackrabbit/webdav/spi/nodetype/NodeTypeConstants.java
+++ /dev/null
@@ -1,110 +0,0 @@
-/*
- * 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.spi.nodetype;
-
-import org.jdom.Namespace;
-import org.apache.jackrabbit.webdav.spi.ItemResourceConstants;
-
-/**
- * NodeTypeConstants
used to represent nodetype definitions in
- * Xml.
- *
- * @see javax.jcr.nodetype.NodeType
- * @todo intercaps only for consistency with jackrabbit... webdav rfcs never use intercaps.
- */
-public interface NodeTypeConstants {
-
- public static final Namespace NAMESPACE = ItemResourceConstants.NAMESPACE;
-
- public static final String XML_NODETYPENAME = "nodetypename";
-
- public static final String XML_REPORT_ALLNODETYPES = "allnodetypes";
- public static final String XML_REPORT_MIXINNODETYPES = "mixinnodetypes";
- public static final String XML_REPORT_PRIMARYNODETYPES = "primarynodetypes";
-
- // report response
- /** Name of the node type definition root element. */
- public static final String XML_NODETYPES = "nodeTypes";
-
- /** Name of the node type definition element. */
- public static final String XML_NODETYPE = "nodeType";
-
- /** Name of the isMixin
attribute. */
- public static final String ATTR_ISMIXIN = "isMixin";
-
- /** Name of the hasOrderableChildNodes
attribute. */
- public static final String ATTR_HASORDERABLECHILDNODES = "hasOrderableChildNodes";
-
- /** Name of the primary item name attribute. */
- public static final String ATTR_PRIMARYITEMNAME = "primaryItemName";
-
- /** Name of the supertypes element. */
- public static final String XML_SUPERTYPES = "supertypes";
-
- /** Name of the supertype element. */
- public static final String XML_SUPERTYPE = "supertype";
-
- /** Name of the child node definition element. */
- public static final String XML_CHILDNODEDEF = "childNodeDef";
-
- /** Name of the property definition element. */
- public static final String XML_PROPERTYDEF = "propertyDef";
-
- /** Name of the name
attribute. */
- public static final String ATTR_NAME = "name";
-
- /** Name of the autoCreate
attribute. */
- public static final String ATTR_AUTOCREATE = "autoCreate";
-
- /** Name of the mandatory
attribute. */
- public static final String ATTR_MANDATORY = "mandatory";
-
- /** Name of the onParentVersion
attribute. */
- public static final String ATTR_ONPARENTVERSION = "onParentVersion";
-
- /** Name of the protected
attribute. */
- public static final String ATTR_PROTECTED = "protected";
-
- /** Name of the required type attribute. */
- public static final String ATTR_REQUIREDTYPE = "requiredType";
-
- /** Name of the value constraints element. */
- public static final String XML_VALUECONSTRAINTS = "valueConstraints";
-
- /** Name of the value constraint element. */
- public static final String XML_VALUECONSTRAINT = "valueConstraint";
-
- /** Name of the default values element. */
- public static final String XML_DEFAULTVALUES = "defaultValues";
-
- /** Name of the default value element. */
- public static final String XML_DEFAULTVALUE = "defaultValue";
-
- /** Name of the multiple
attribute. */
- public static final String ATTR_MULTIPLE = "multiple";
-
- /** Name of the required primary types element. */
- public static final String XML_REQUIREDPRIMARYTYPES = "requiredPrimaryTypes";
-
- /** Name of the required primary type element. */
- public static final String XML_REQUIREDPRIMARYTYPE = "requiredPrimaryType";
-
- /** Name of the default primary type attribute. */
- public static final String ATTR_DEFAULTPRIMARYTYPE = "defaultPrimaryType";
-
- /** Name of the sameNameSibs
attribute. */
- public static final String ATTR_SAMENAMESIBS = "sameNameSibs";
-}
\ No newline at end of file
diff --git a/contrib/jcr-server/server/src/java/org/apache/jackrabbit/webdav/spi/nodetype/NodeTypeElement.java b/contrib/jcr-server/server/src/java/org/apache/jackrabbit/webdav/spi/nodetype/NodeTypeElement.java
deleted file mode 100644
index a3a77ab5faa..00000000000
--- a/contrib/jcr-server/server/src/java/org/apache/jackrabbit/webdav/spi/nodetype/NodeTypeElement.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * 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.spi.nodetype;
-
-import org.apache.log4j.Logger;
-import org.jdom.Element;
-
-import javax.jcr.nodetype.NodeType;
-
-/**
- * NodeTypeElement
...
- */
-public class NodeTypeElement extends Element implements NodeTypeConstants {
-
- private static Logger log = Logger.getLogger(NodeTypeElement.class);
-
- public NodeTypeElement(NodeType nt) {
- super(XML_NODETYPE, NodeTypeConstants.NAMESPACE);
- addNodeTypeNameElement(nt.getName());
- }
-
- public NodeTypeElement(Element ntElement) {
- super(XML_NODETYPE, NodeTypeConstants.NAMESPACE);
- if (!XML_NODETYPE.equals(ntElement.getName())) {
- throw new IllegalArgumentException("jcr:nodetype element expected.");
- }
- addNodeTypeNameElement(ntElement.getChildText(XML_NODETYPENAME, NodeTypeConstants.NAMESPACE));
- }
-
- private void addNodeTypeNameElement(String nodeTypeName) {
- if (nodeTypeName != null) {
- addContent(new Element(XML_NODETYPENAME, NodeTypeConstants.NAMESPACE).setText(nodeTypeName));
- }
- }
-
- public String getNodeTypeName() {
- return getChildText(XML_NODETYPENAME, NodeTypeConstants.NAMESPACE);
- }
-
- public static NodeTypeElement[] create(NodeType[] nts) {
- NodeTypeElement[] elems = new NodeTypeElement[nts.length];
- for (int i = 0; i < nts.length; i++) {
- elems[i] = new NodeTypeElement(nts[i]);
- }
- return elems;
- }
-}
\ No newline at end of file
diff --git a/contrib/jcr-server/server/src/java/org/apache/jackrabbit/webdav/spi/nodetype/NodeTypeProperty.java b/contrib/jcr-server/server/src/java/org/apache/jackrabbit/webdav/spi/nodetype/NodeTypeProperty.java
deleted file mode 100644
index bbb4edbb5bd..00000000000
--- a/contrib/jcr-server/server/src/java/org/apache/jackrabbit/webdav/spi/nodetype/NodeTypeProperty.java
+++ /dev/null
@@ -1,104 +0,0 @@
-/*
- * 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.spi.nodetype;
-
-import org.apache.log4j.Logger;
-import org.apache.jackrabbit.webdav.property.DavPropertyName;
-import org.apache.jackrabbit.webdav.property.DavProperty;
-import org.apache.jackrabbit.webdav.property.AbstractDavProperty;
-import org.jdom.Element;
-
-import javax.jcr.nodetype.NodeType;
-import java.util.*;
-
-/**
- * NodeTypeProperty
...
- */
-public class NodeTypeProperty extends AbstractDavProperty {
-
- private static Logger log = Logger.getLogger(NodeTypeProperty.class);
-
- private final NodeTypeElement[] value;
-
- public NodeTypeProperty(DavPropertyName name, NodeType nodeType, boolean isProtected) {
- super(name, isProtected);
- value = new NodeTypeElement[] {new NodeTypeElement(nodeType)};
- }
-
- public NodeTypeProperty(DavPropertyName name, NodeType[] nodeTypes, boolean isProtected) {
- super(name, isProtected);
- value = NodeTypeElement.create(nodeTypes);
- }
-
- /**
- * Create a new NodeTypeProperty
from the specified general
- * DavProperty object.
- *
- * @param property
- * @throws IllegalArgumentException if the content of the specified property
- * contains elements other than {@link NodeTypeConstants#XML_NODETYPE}.
- */
- public NodeTypeProperty(DavProperty property) {
- super(property.getName(), property.isProtected());
-
- if (property.getValue() instanceof List) {
- List ntElemList = new ArrayList();
- Iterator it = ((List) property.getValue()).iterator();
- while (it.hasNext()) {
- Object content = it.next();
- if (content instanceof Element) {
- ntElemList.add(new NodeTypeElement((Element)content));
- }
- }
- value = (NodeTypeElement[]) ntElemList.toArray(new NodeTypeElement[ntElemList.size()]);
- } else if (property.getValue() instanceof Element) {
- NodeTypeElement ntElem = new NodeTypeElement((Element)property.getValue());
- value = new NodeTypeElement [] {ntElem};
- } else {
- value = new NodeTypeElement[0];
- }
- }
-
- /**
- * Return a set of nodetype names present in this property.
- *
- * @return set of nodetype names
- */
- public Set getNodeTypeNames() {
- HashSet names = new HashSet();
- Object val = getValue();
- if (val instanceof NodeTypeElement[]) {
- NodeTypeElement[] elems = (NodeTypeElement[])val;
- for (int i = 0; i < elems.length; i++) {
- String ntName = elems[i].getNodeTypeName();
- if (ntName != null) {
- names.add(ntName);
- }
- }
- }
- return names;
- }
-
- /**
- * Returns the value of this property which is an array of {@link NodeTypeElement}
- * objects.
- *
- * @return an array of {@link NodeTypeElement}s
- */
- public Object getValue() {
- return value;
- }
-}
\ No newline at end of file
diff --git a/contrib/jcr-server/server/src/java/org/apache/jackrabbit/webdav/spi/nodetype/PropertyDefImpl.java b/contrib/jcr-server/server/src/java/org/apache/jackrabbit/webdav/spi/nodetype/PropertyDefImpl.java
deleted file mode 100644
index c96bce48171..00000000000
--- a/contrib/jcr-server/server/src/java/org/apache/jackrabbit/webdav/spi/nodetype/PropertyDefImpl.java
+++ /dev/null
@@ -1,107 +0,0 @@
-/*
- * Copyright 2004 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.spi.nodetype;
-
-import org.apache.log4j.Logger;
-import org.jdom.Element;
-
-import javax.jcr.nodetype.PropertyDef;
-import javax.jcr.Value;
-import javax.jcr.PropertyType;
-import javax.jcr.RepositoryException;
-
-/**
- * PropertyDefImpl
...
- */
-public final class PropertyDefImpl extends ItemDefImpl implements PropertyDef {
-
- private static Logger log = Logger.getLogger(PropertyDefImpl.class);
-
- private final int type;
- private final String[] valueConstraints;
- private final Value[] defaultValues;
- private final boolean isMultiple;
-
- private PropertyDefImpl(PropertyDef definition) {
- super(definition);
-
- type = definition.getRequiredType();
- valueConstraints = definition.getValueConstraints();
- defaultValues = definition.getDefaultValues();
- isMultiple = definition.isMultiple();
- }
-
- public static PropertyDefImpl create(PropertyDef definition) {
- if (definition instanceof PropertyDefImpl) {
- return (PropertyDefImpl)definition;
- } else {
- return new PropertyDefImpl(definition);
- }
- }
-
- public int getRequiredType() {
- return type;
- }
-
- public String[] getValueConstraints() {
- return valueConstraints;
- }
-
- public Value[] getDefaultValues() {
- return defaultValues;
- }
-
- public boolean isMultiple() {
- return isMultiple;
- }
-
- //-------------------------------------< implementation specific method >---
- public Element toXml() {
- Element elem = super.toXml();
-
- elem.setAttribute(ATTR_MULTIPLE, Boolean.toString(isMultiple()));
- elem.setAttribute(ATTR_REQUIREDTYPE, PropertyType.nameFromValue(getRequiredType()));
-
- // default values may be 'null'
- Value[] values = getDefaultValues();
- if (values != null) {
- Element dvElement = new Element(XML_DEFAULTVALUES);
- for (int i = 0; i < values.length; i++) {
- try {
- Element valElem = new Element(XML_DEFAULTVALUE).setText(values[i].getString());
- dvElement.addContent(valElem);
- } catch (RepositoryException e) {
- // should not occur
- log.error(e.getMessage());
- }
- }
- elem.addContent(dvElement);
- }
- // value constraints array is never null.
- Element constrElem = new Element(XML_VALUECONSTRAINTS);
- String[] constraints = getValueConstraints();
- for (int i = 0; i < constraints.length; i++) {
- constrElem.addContent(new Element(XML_VALUECONSTRAINT).setText(constraints[i]));
- }
- elem.addContent(constrElem);
-
- return elem;
- }
-
- public String getElementName() {
- return XML_PROPERTYDEF;
- }
-}
\ No newline at end of file
diff --git a/contrib/jcr-server/server/src/java/org/apache/jackrabbit/webdav/spi/observation/SubscriptionImpl.java b/contrib/jcr-server/server/src/java/org/apache/jackrabbit/webdav/spi/observation/SubscriptionImpl.java
deleted file mode 100644
index 7ceb4f474b1..00000000000
--- a/contrib/jcr-server/server/src/java/org/apache/jackrabbit/webdav/spi/observation/SubscriptionImpl.java
+++ /dev/null
@@ -1,316 +0,0 @@
-/*
- * 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.spi.observation;
-
-import org.apache.log4j.Logger;
-import org.apache.jackrabbit.webdav.DavResourceLocator;
-import org.apache.jackrabbit.webdav.DavConstants;
-import org.apache.jackrabbit.webdav.observation.*;
-import org.apache.jackrabbit.webdav.util.XmlUtil;
-import org.apache.jackrabbit.core.util.uuid.UUID;
-import org.jdom.Element;
-
-import javax.jcr.observation.*;
-import javax.jcr.observation.EventListener;
-import javax.jcr.RepositoryException;
-import java.util.*;
-
-/**
- * The Subscription
class encapsulates a single subscription with
- * the following responsibilities:Subscription
with the given {@link SubscriptionInfo}
- * and {@link org.apache.jackrabbit.webdav.observation.ObservationResource resource}.
- *
- * @param info
- * @param resource
- */
- public SubscriptionImpl(SubscriptionInfo info, ObservationResource resource) {
- setInfo(info);
- locator = resource.getLocator();
- }
-
- /**
- * Returns the id of this subscription.
- *
- * @return subscriptionId
- */
- public String getSubscriptionId() {
- return subscriptionId;
- }
-
- /**
- * Return the Xml representation of this Subscription
as required
- * for the {@link org.apache.jackrabbit.webdav.observation.SubscriptionDiscovery} webdav property that in included
- * in the response body of a sucessful SUBSCRIBE request or as part of a
- * PROPFIND response.
- *
- * @return Xml representation
- */
- public Element toXml() {
- Element subscr = new Element(XML_SUBSCRIPTION, NAMESPACE);
- Element[] elems = info.toXml();
- for (int i = 0; i < elems.length; i++) {
- subscr.addContent(elems[i]);
- }
-
- Element id = new Element(XML_SUBSCRIPTIONID);
- id.addContent(XmlUtil.hrefToXml(subscriptionId));
- subscr.addContent(id);
- return subscr;
- }
-
- /**
- * Modify the {@link SubscriptionInfo} for this subscription.
- *
- * @param info
- */
- void setInfo(SubscriptionInfo info) {
- this.info = info;
- // validate the timeout and adjust value, if it is invalid or missing
- long timeout = info.getTimeOut();
- if (timeout == DavConstants.UNDEFINED_TIMEOUT) {
- info.setTimeOut(DEFAULT_TIMEOUT);
- }
- }
-
- /**
- * @return JCR compliant integer representation of the event types defined
- * for this {@link SubscriptionInfo}.
- */
- int getEventTypes() {
- Iterator xmlTypes = info.getEventTypes().iterator();
- int eventTypes = 0;
- while (xmlTypes.hasNext()) {
- eventTypes |= nametoTypeConstant(((Element)xmlTypes.next()).getName());
- }
- return eventTypes;
- }
-
- /**
- * @return a String array with size > 0 or null
- */
- String[] getUuidFilters() {
- return info.getFilters(XML_UUID);
- }
-
- /**
- * @return a String array with size > 0 or null
- */
- String[] getNodetypeNameFilters() {
- return info.getFilters(XML_NODETYPE_NAME);
- }
-
- /**
- *
- * @return true if a {@link ObservationConstants#XML_NOLOCAL} element
- * is present in the {@link SubscriptionInfo}.
- */
- boolean isNoLocal() {
- return info.isNoLocal();
- }
-
- /**
- * @return true if this subscription is intended to be deep.
- */
- boolean isDeep() {
- return info.isDeep();
- }
-
- /**
- * @return the locator of the {@link ObservationResource resource} this
- * Subscription
was requested for.
- */
- DavResourceLocator getLocator() {
- return locator;
- }
-
- /**
- * Returns true if this Subscription
matches the given
- * resource.
- *
- * @param resource
- * @return true if this Subscription
matches the given
- * resource.
- */
- boolean isSubscribedToResource(ObservationResource resource) {
- return locator.equals(resource.getLocator());
- }
-
- /**
- * Returns true if this Subscription
is expired and therefore
- * stopped recording events.
- *
- * @return true if this Subscription
is expired
- */
- boolean isExpired() {
- return System.currentTimeMillis() > info.getTimeOut() + System.currentTimeMillis();
- }
-
- /**
- * Returns a {@link org.apache.jackrabbit.webdav.observation.EventDiscovery} object listing all events that were
- * recorded since the last call to this method and clears the list of event
- * bundles.
- *
- * @return object listing all events that were recorded.
- * @see #onEvent(EventIterator)
- */
- synchronized EventDiscovery discoverEvents() {
- EventDiscovery ed = new EventDiscovery();
- Iterator it = eventBundles.iterator();
- while (it.hasNext()) {
- EventBundle eb = (EventBundle) it.next();
- ed.addEventBundle(eb.toXml());
- }
- // clear list
- eventBundles.clear();
- return ed;
- }
-
- //--------------------------------------------< EventListener interface >---
- /**
- * Records the events passed as a new event bundle in order to make them
- * available with the next {@link #discoverEvents()} request.
- *
- * @param events to be recorded.
- * @see EventListener#onEvent(EventIterator)
- * @see #discoverEvents()
- */
- public synchronized void onEvent(EventIterator events) {
- // TODO: correct not to accept events after expiration? without unsubscribing?
- if (!isExpired()) {
- eventBundles.add(new EventBundle(events));
- }
- }
-
- //--------------------------------------------------------------------------
- /**
- * Static utility method in order to convert the types defined by
- * {@link javax.jcr.observation.Event} into their Xml representation.
- *
- * @param jcrEventType
- * @return Xml representation of the event type.
- */
- static Element typeConstantToXml(int jcrEventType) {
- String eventName;
- switch (jcrEventType) {
- case Event.NODE_ADDED:
- eventName = EVENT_NODEADDED;
- break;
- case Event.NODE_REMOVED:
- eventName = EVENT_NODEREMOVED;
- break;
- case Event.PROPERTY_ADDED:
- eventName = EVENT_PROPERTYADDED;
- break;
- case Event.PROPERTY_CHANGED:
- eventName = EVENT_PROPERTYCHANGED;
- break;
- default:
- //Event.PROPERTY_REMOVED:
- eventName = EVENT_PROPERTYREMOVED;
- break;
- }
- return new Element(eventName, NAMESPACE);
- }
-
- /**
- * Static utility method to convert an event type name as present in the
- * Xml request body into the corresponding constant defined by
- * {@link javax.jcr.observation.Event}.
- *
- * @param eventTypeName
- * @return event type as defined by {@link javax.jcr.observation.Event}.
- * @throws IllegalArgumentException if the given element cannot be translated
- * to any of the events defined by {@link javax.jcr.observation.Event}.
- */
- static int nametoTypeConstant(String eventTypeName) {
- int eType;
- if (EVENT_NODEADDED.equals(eventTypeName)) {
- eType = Event.NODE_ADDED;
- } else if (EVENT_NODEREMOVED.equals(eventTypeName)) {
- eType = Event.NODE_REMOVED;
- } else if (EVENT_PROPERTYADDED.equals(eventTypeName)) {
- eType = Event.PROPERTY_ADDED;
- } else if (EVENT_PROPERTYCHANGED.equals(eventTypeName)) {
- eType = Event.PROPERTY_CHANGED;
- } else if (EVENT_PROPERTYREMOVED.equals(eventTypeName)) {
- eType = Event.PROPERTY_REMOVED;
- } else {
- throw new IllegalArgumentException("Invalid event type: "+eventTypeName);
- }
- return eType;
- }
-
- /**
- * Inner class EventBundle
encapsulats an event bundle as
- * recorded {@link SubscriptionImpl#onEvent(EventIterator) on event} and
- * provides the possibility to retrieve the Xml representation of the
- * bundle and the events included in order to respond to a POLL request.
- *
- * @see SubscriptionImpl#discoverEvents()
- */
- private class EventBundle {
-
- private final EventIterator events;
-
- private EventBundle(EventIterator events) {
- this.events = events;
- }
-
- private Element toXml() {
- Element bundle = new Element(XML_EVENTBUNDLE, NAMESPACE);
- while (events.hasNext()) {
- Event event = events.nextEvent();
-
- Element eventElem = new Element(XML_EVENT, NAMESPACE);
- // href
- String eHref = "";
- try {
- boolean isCollection = (event.getType() == Event.NODE_ADDED || event.getType() == Event.NODE_REMOVED);
- eHref = locator.getFactory().createResourceLocator(locator.getPrefix(), locator.getWorkspacePath(), event.getPath()).getHref(isCollection);
- } catch (RepositoryException e) {
- // should not occur....
- log.error(e.getMessage());
- }
- eventElem.addContent(XmlUtil.hrefToXml(eHref));
- // eventtype
- Element eType = new Element(XML_EVENTTYPE, NAMESPACE).addContent(typeConstantToXml(event.getType()));
- eventElem.addContent(eType);
- // user id
- Element eUserId = new Element(XML_EVENTUSERID, NAMESPACE).setText(event.getUserId());
- eventElem.addContent(eUserId);
- }
- return bundle;
- }
- }
-}
\ No newline at end of file
diff --git a/contrib/jcr-server/server/src/java/org/apache/jackrabbit/webdav/spi/observation/SubscriptionManagerImpl.java b/contrib/jcr-server/server/src/java/org/apache/jackrabbit/webdav/spi/observation/SubscriptionManagerImpl.java
deleted file mode 100644
index 5048c9894fc..00000000000
--- a/contrib/jcr-server/server/src/java/org/apache/jackrabbit/webdav/spi/observation/SubscriptionManagerImpl.java
+++ /dev/null
@@ -1,251 +0,0 @@
-/*
- * 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.spi.observation;
-
-import org.apache.log4j.Logger;
-import org.apache.jackrabbit.webdav.*;
-import org.apache.jackrabbit.webdav.spi.JcrDavException;
-import org.apache.jackrabbit.webdav.observation.*;
-
-import javax.jcr.RepositoryException;
-import javax.jcr.observation.ObservationManager;
-import java.util.*;
-
-/**
- * SubscriptionManager
collects all subscriptions requested, handles
- * the subscription timeout and provides METHODS to discover subscriptions
- * present on a given resource as well as events for an specific subscription.
- *
- * @todo make sure all expired subscriptions are removed!
- */
-public class SubscriptionManagerImpl implements SubscriptionManager {
-
- private static Logger log = Logger.getLogger(SubscriptionManager.class);
-
- /**
- * Map containing all {@link org.apache.jackrabbit.webdav.observation.Subscription subscriptions}.
- */
- private final SubscriptionMap subscriptions = new SubscriptionMap();
-
- /**
- * Retrieve the {@link org.apache.jackrabbit.webdav.observation.SubscriptionDiscovery} object for the given
- * resource. Note, that the discovery object will be empty if there are
- * no subscriptions present.
- *
- * @param resource
- * @todo is it correct to return subscriptions made by another session?
- */
- public SubscriptionDiscovery getSubscriptionDiscovery(ObservationResource resource) {
- Subscription[] subsForResource = subscriptions.getByPath(resource.getLocator());
- return new SubscriptionDiscovery(subsForResource);
- }
-
- /**
- * Create a new Subscription
or update an existing Subscription
- * and add it as eventlistener to the {@link javax.jcr.observation.ObservationManager}.
- *
- * @param info
- * @param subscriptionId
- * @param resource
- * @return Subscription
that has been added to the {@link javax.jcr.observation.ObservationManager}
- * @throws DavException if the subscription fails
- */
- public Subscription subscribe(SubscriptionInfo info, String subscriptionId,
- ObservationResource resource)
- throws DavException {
-
- SubscriptionImpl subscription;
- DavSession session = resource.getSession();
- if (subscriptionId == null) {
- // new subscription
- subscription = new SubscriptionImpl(info, resource);
- registerSubscription(subscription, session);
-
- // ajust references to this subscription
- subscriptions.put(subscription.getSubscriptionId(), subscription);
- session.addReference(subscription.getSubscriptionId());
- } else {
- // refresh/modify existing one
- subscription = validate(subscriptionId, resource);
- subscription.setInfo(info);
- registerSubscription(subscription, session);
- }
- return subscription;
- }
-
- /**
- * Register the event listener defined by the given subscription to the
- * repository's observation manager.
- *
- * @param subscription
- * @param session
- * @throws DavException
- */
- private void registerSubscription(SubscriptionImpl subscription, DavSession session)
- throws DavException {
- try {
- ObservationManager oMgr = session.getRepositorySession().getWorkspace().getObservationManager();
- oMgr.addEventListener(subscription, subscription.getEventTypes(),
- subscription.getLocator().getResourcePath(), subscription.isDeep(),
- subscription.getUuidFilters(),
- subscription.getNodetypeNameFilters(),
- subscription.isNoLocal());
- } catch (RepositoryException e) {
- log.error("Unable to register eventlistener: "+e.getMessage());
- throw new JcrDavException(e);
- }
- }
-
- /**
- * Unsubscribe the Subscription
with the given id and remove it
- * from the {@link javax.jcr.observation.ObservationManager} as well as
- * from the internal map.
- *
- * @param subscriptionId
- * @param resource
- * @throws DavException
- */
- public void unsubscribe(String subscriptionId, ObservationResource resource)
- throws DavException {
-
- SubscriptionImpl subs = validate(subscriptionId, resource);
- unregisterSubscription(subs, resource.getSession());
- }
-
- /**
- * Remove the event listener defined by the specified subscription from
- * the repository's observation manager.
- *
- * @param subscription
- * @param session
- * @throws DavException
- */
- private void unregisterSubscription(SubscriptionImpl subscription,
- DavSession session) throws DavException {
- try {
- session.getRepositorySession().getWorkspace().getObservationManager().removeEventListener(subscription);
- String sId = subscription.getSubscriptionId();
-
- // clean up any references
- subscriptions.remove(sId);
- session.removeReference(sId);
-
- } catch (RepositoryException e) {
- log.error("Unable to remove eventlistener: "+e.getMessage());
- throw new JcrDavException(e);
- }
- }
-
- /**
- * Retrieve all event bundles accumulated since for the subscription specified
- * by the given id.
- *
- * @param subscriptionId
- * @param resource
- * @return object encapsulating the events.
- */
- public EventDiscovery poll(String subscriptionId, ObservationResource resource)
- throws DavException {
-
- SubscriptionImpl subs = validate(subscriptionId, resource);
- return subs.discoverEvents();
- }
-
- /**
- * Validate the given subscription id. The validation will fail under the following
- * conditions:Subscription
with the given id.
- * @throws DavException if an error occured while retrieving the Subscription
- */
- private SubscriptionImpl validate(String subscriptionId, ObservationResource resource)
- throws DavException {
-
- SubscriptionImpl subs;
- if (subscriptions.contains(subscriptionId)) {
- subs = (SubscriptionImpl) subscriptions.get(subscriptionId);
- if (!subs.isSubscribedToResource(resource)) {
- throw new DavException(DavServletResponse.SC_PRECONDITION_FAILED, "Attempt to operate on subscription with invalid resource path.");
- }
- if (subs.isExpired()) {
- unregisterSubscription(subs, resource.getSession());
- throw new DavException(DavServletResponse.SC_PRECONDITION_FAILED, "Attempt to operate on expired subscription.");
- }
- return subs;
- } else {
- throw new DavException(DavServletResponse.SC_PRECONDITION_FAILED, "Attempt to modify or to poll for non-existing subscription.");
- }
- }
-
- /**
- * Private inner class SubscriptionMap
that allows for quick
- * access by resource path as well as by subscription id.
- */
- private class SubscriptionMap {
-
- private HashMap subscriptions = new HashMap();
- private HashMap paths = new HashMap();
-
- private boolean contains(String subscriptionId) {
- return subscriptions.containsKey(subscriptionId);
- }
-
- private Subscription get(String subscriptionId) {
- return (Subscription) subscriptions.get(subscriptionId);
- }
-
- private void put(String subscriptionId, SubscriptionImpl subscription) {
- subscriptions.put(subscriptionId, subscription);
- DavResourceLocator key = subscription.getLocator();
- Set idSet;
- if (paths.containsKey(key)) {
- idSet = (Set) paths.get(key);
- } else {
- idSet = new HashSet();
- paths.put(key, idSet);
- }
- if (!idSet.contains(subscriptionId)) {
- idSet.add(subscriptionId);
- }
- }
-
- private void remove(String subscriptionId) {
- SubscriptionImpl sub = (SubscriptionImpl) subscriptions.remove(subscriptionId);
- ((Set)paths.get(sub.getLocator())).remove(subscriptionId);
- }
-
- private Subscription[] getByPath(DavResourceLocator locator) {
- Set idSet = (Set) paths.get(locator);
- if (idSet != null && !idSet.isEmpty()) {
- Iterator idIterator = idSet.iterator();
- Subscription[] subsForResource = new Subscription[idSet.size()];
- int i = 0;
- while (idIterator.hasNext()) {
- subsForResource[i] = (Subscription) subscriptions.get(idIterator.next());
- }
- return subsForResource;
- } else {
- return new Subscription[0];
- }
- }
- }
-}
\ No newline at end of file
diff --git a/contrib/jcr-server/server/src/java/org/apache/jackrabbit/webdav/spi/package.html b/contrib/jcr-server/server/src/java/org/apache/jackrabbit/webdav/spi/package.html
deleted file mode 100644
index 17e97edbf40..00000000000
--- a/contrib/jcr-server/server/src/java/org/apache/jackrabbit/webdav/spi/package.html
+++ /dev/null
@@ -1,3 +0,0 @@
-
-Contains JCR specific implementations.
-
\ No newline at end of file
diff --git a/contrib/jcr-server/server/src/java/org/apache/jackrabbit/webdav/spi/property/LengthsProperty.java b/contrib/jcr-server/server/src/java/org/apache/jackrabbit/webdav/spi/property/LengthsProperty.java
deleted file mode 100644
index 7984f7cecb9..00000000000
--- a/contrib/jcr-server/server/src/java/org/apache/jackrabbit/webdav/spi/property/LengthsProperty.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
-* Copyright 2004 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.spi.property;
-
-import org.apache.jackrabbit.webdav.property.AbstractDavProperty;
-import org.apache.jackrabbit.webdav.spi.ItemResourceConstants;
-import org.jdom.Element;
-
-/**
- * LengthsProperty
extends {@link org.apache.jackrabbit.webdav.property.DavProperty} providing
- * utilities to handle the multiple lengths of the property item represented
- * by this resource.
- */
-public class LengthsProperty extends AbstractDavProperty implements ItemResourceConstants {
-
- private final Element[] value;
-
- /**
- * Create a new LengthsProperty
from the given long array.
- *
- * @param lengths as retrieved from the JCR property
- */
- public LengthsProperty(long[] lengths) {
- super(JCR_LENGTHS, false);
-
- Element[] elems = new Element[lengths.length];
- for (int i = 0; i < lengths.length; i++) {
- elems[i] = new Element(XML_LENGTH, ItemResourceConstants.NAMESPACE);
- elems[i].addContent(String.valueOf(lengths[i]));
- }
- this.value = elems;
- }
-
- /**
- * Returns an array of {@link Element}s representing the value of this
- * property.
- *
- * @return an array of {@link Element}s
- */
- public Object getValue() {
- return value;
- }
-}
\ No newline at end of file
diff --git a/contrib/jcr-server/server/src/java/org/apache/jackrabbit/webdav/spi/property/ValuesProperty.java b/contrib/jcr-server/server/src/java/org/apache/jackrabbit/webdav/spi/property/ValuesProperty.java
deleted file mode 100644
index c580b89bd1f..00000000000
--- a/contrib/jcr-server/server/src/java/org/apache/jackrabbit/webdav/spi/property/ValuesProperty.java
+++ /dev/null
@@ -1,120 +0,0 @@
-/*
-* Copyright 2004 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.spi.property;
-
-import org.apache.jackrabbit.webdav.property.AbstractDavProperty;
-import org.apache.jackrabbit.webdav.property.DavProperty;
-import org.apache.jackrabbit.webdav.spi.ItemResourceConstants;
-import org.apache.jackrabbit.core.util.ValueHelper;
-import org.jdom.Element;
-
-import javax.jcr.Value;
-import javax.jcr.ValueFormatException;
-import javax.jcr.RepositoryException;
-import java.util.List;
-import java.util.Iterator;
-import java.util.ArrayList;
-
-/**
- * ValuesProperty
extends {@link org.apache.jackrabbit.webdav.property.DavProperty} providing
- * utilities to handle the multiple values of the property item represented
- * by this resource.
- */
-public class ValuesProperty extends AbstractDavProperty implements ItemResourceConstants {
-
- private final Element[] value;
-
- /**
- * Wrap the specified DavProperty
in a new ValuesProperty
.
- *
- * @param property
- */
- public ValuesProperty(DavProperty property) {
- super(JCR_VALUES, false);
-
- if (!JCR_VALUES.equals(property.getName())) {
- throw new IllegalArgumentException("ValuesProperty may only be created with a property that has name="+JCR_VALUES.getName());
- }
-
- Element[] elems = new Element[0];
- if (property.getValue() instanceof List) {
- Iterator elemIt = ((List)property.getValue()).iterator();
- ArrayList valueElements = new ArrayList();
- while (elemIt.hasNext()) {
- Object el = elemIt.next();
- /* make sure, only Elements with name 'value' are used for
- * the 'value' field. any other content (other elements, text,
- * comment etc.) is ignored. NO bad-request/conflict error is
- * thrown.
- */
- if (el instanceof Element && "value".equals(((Element)el).getName())) {
- valueElements.add(el);
- }
- }
- /* fill the 'value' with the valid 'value' elements found before */
- elems = (Element[])valueElements.toArray(new Element[valueElements.size()]);
- } else {
- new IllegalArgumentException("ValuesProperty may only be created with a property that has a list of 'value' elements as content.");
- }
- // finally set the value to the DavProperty
- value = elems;
- }
-
- /**
- * Create a new ValuesProperty
from the given {@link javax.jcr.Value Value
- * array}.
- *
- * @param values Array of Value objects as obtained from the JCR property.
- */
- public ValuesProperty(Value[] values) throws ValueFormatException, RepositoryException {
- super(JCR_VALUES, false);
-
- Element[] propValue = new Element[values.length];
- for (int i = 0; i < values.length; i++) {
- propValue[i] = new Element(XML_VALUE, ItemResourceConstants.NAMESPACE);
- propValue[i].addContent(values[i].getString());
- }
- // finally set the value to the DavProperty
- value = propValue;
- }
-
- /**
- * Converts the value of this property to a {@link javax.jcr.Value value array}.
- * Please note, that the convertion is done by using the {@link org.apache.jackrabbit.core.util.ValueHelper}
- * class that is not part of the JSR170 API.
- *
- * @return Array of Value objects
- * @throws RepositoryException
- */
- public Value[] getValues(int propertyType) throws ValueFormatException, RepositoryException {
- Element[] propValue = (Element[])getValue();
- Value[] values = new Value[propValue.length];
- for (int i = 0; i < propValue.length; i++) {
- values[i] = ValueHelper.convert(propValue[i].getText(), propertyType);
- }
- return values;
- }
-
- /**
- * Returns an array of {@link Element}s representing the value of this
- * property.
- *
- * @return an array of {@link Element}s
- */
- public Object getValue() {
- return value;
- }
-}
\ No newline at end of file
diff --git a/contrib/jcr-server/server/src/java/org/apache/jackrabbit/webdav/spi/search/SearchResourceImpl.java b/contrib/jcr-server/server/src/java/org/apache/jackrabbit/webdav/spi/search/SearchResourceImpl.java
deleted file mode 100644
index c9c26228946..00000000000
--- a/contrib/jcr-server/server/src/java/org/apache/jackrabbit/webdav/spi/search/SearchResourceImpl.java
+++ /dev/null
@@ -1,164 +0,0 @@
-/*
- * 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.spi.search;
-
-import org.apache.log4j.Logger;
-import org.apache.jackrabbit.webdav.*;
-import org.apache.jackrabbit.webdav.search.SearchResource;
-import org.apache.jackrabbit.webdav.search.QueryGrammerSet;
-import org.apache.jackrabbit.webdav.search.SearchRequest;
-import org.apache.jackrabbit.webdav.spi.JcrDavException;
-import org.apache.jackrabbit.webdav.spi.ItemResourceConstants;
-
-import javax.jcr.*;
-import javax.jcr.query.*;
-
-/**
- * SearchResourceImpl
...
- */
-public class SearchResourceImpl implements SearchResource, ItemResourceConstants {
-
- private static Logger log = Logger.getLogger(SearchResourceImpl.class);
-
- private final DavSession session;
- private final DavResourceLocator locator;
-
- public SearchResourceImpl(DavResourceLocator locator, DavSession session) {
- this.session = session;
- this.locator = locator;
- }
-
- //-------------------------------------------< SearchResource interface >---
- /**
- * @see SearchResource#getQueryGrammerSet()
- */
- public QueryGrammerSet getQueryGrammerSet() {
- QueryGrammerSet qgs;
- try {
- QueryManager qMgr = session.getRepositorySession().getWorkspace().getQueryManager();
- String[] langs = qMgr.getSupportedQueryLanguages();
- qgs = new QueryGrammerSet(langs);
- } catch (RepositoryException e) {
- qgs = new QueryGrammerSet(new String[0]);
- }
- return qgs;
- }
-
- /**
- * Execute the query defined by the given sRequest
.
- *
- * @see SearchResource#search(org.apache.jackrabbit.webdav.search.SearchRequest)
- */
- public MultiStatus search(SearchRequest sRequest) throws DavException {
- try {
- Query q = getQuery(sRequest);
- QueryResult qR = q.execute();
- return queryResultToMultiStatus(qR);
-
- } catch (RepositoryException e) {
- throw new JcrDavException(e);
- }
- }
-
- /**
- * Create a query from the information present in the sRequest
- * object.Query
object.
- * @throws InvalidQueryException if the query defined by sRequest
is invalid
- * @throws RepositoryException the query manager cannot be accessed or if
- * another error occurs.
- * @throws DavException if sRequest
is null
and
- * the underlaying repository item is not an nt:query node or if an error
- * occurs when calling {@link Query#save(String)}/
- */
- private Query getQuery(SearchRequest sRequest)
- throws InvalidQueryException, RepositoryException, DavException {
-
- Node rootNode = session.getRepositorySession().getRootNode();
- QueryManager qMgr = session.getRepositorySession().getWorkspace().getQueryManager();
- String resourcePath = locator.getResourcePath();
-
- // test if query is defined by requested repository node
- if (!rootNode.getPath().equals(resourcePath)) {
- String qNodeRelPath = resourcePath.substring(1);
- if (rootNode.hasNode(qNodeRelPath)) {
- Node qNode = rootNode.getNode(qNodeRelPath);
- if (qNode.isNodeType("nt:query")) {
- return qMgr.getQuery(qNode);
- }
- }
- }
-
- Query q;
- if (sRequest != null) {
- q = qMgr.createQuery(sRequest.getQuery(), sRequest.getLanguageName());
- } else {
- throw new DavException(DavServletResponse.SC_BAD_REQUEST, resourcePath + " is not a nt:query node -> searchRequest body required.");
- }
-
- /* test if resource path does not exist -> thus indicating that
- the query must be made persistent by calling Query.save(String) */
- if (!session.getRepositorySession().itemExists(resourcePath)) {
- try {
- q.save(resourcePath);
- } catch (RepositoryException e) {
- // ItemExistsException should never occur.
- new JcrDavException(e);
- }
- }
- return q;
- }
-
- /**
- * Build a MultiStatus
object from the specified query result.
- *
- * @param qResult QueryResult
as obtained from {@link javax.jcr.query.Query#execute()}.
- * @return MultiStatus
object listing the query result in
- * Webdav compatible form.
- * @throws RepositoryException
- */
- private MultiStatus queryResultToMultiStatus(QueryResult qResult)
- throws RepositoryException {
- MultiStatus ms = new MultiStatus();
-
- String[] propertyNames = qResult.getPropertyNames();
- RowIterator rowIter = qResult.getRows();
- while (rowIter.hasNext()) {
- Row row = rowIter.nextRow();
- Value[] values = row.getValues();
- String nodePath = values[0].getString();
-
- // create a new ms-response for each row of the result set
- DavResourceLocator loc = locator.getFactory().createResourceLocator(locator.getPrefix(), locator.getWorkspacePath(), nodePath);
- String nodeHref = loc.getHref(true);
- MultiStatusResponse resp = new MultiStatusResponse(nodeHref);
- // add a search-result-property for each value column
- for (int i = 0; i < values.length; i++) {
- resp.add(new SearchResultProperty(propertyNames[i], values[i]));
- }
- ms.addResponse(resp);
- }
- return ms;
- }
-}
\ No newline at end of file
diff --git a/contrib/jcr-server/server/src/java/org/apache/jackrabbit/webdav/spi/search/SearchResultProperty.java b/contrib/jcr-server/server/src/java/org/apache/jackrabbit/webdav/spi/search/SearchResultProperty.java
deleted file mode 100644
index a45b2fdc41f..00000000000
--- a/contrib/jcr-server/server/src/java/org/apache/jackrabbit/webdav/spi/search/SearchResultProperty.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * 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.spi.search;
-
-import org.apache.log4j.Logger;
-import org.apache.jackrabbit.webdav.property.DavPropertyName;
-import org.apache.jackrabbit.webdav.property.DefaultDavProperty;
-import org.apache.jackrabbit.webdav.spi.ItemResourceConstants;
-import org.jdom.Element;
-
-import javax.jcr.Value;
-import javax.jcr.RepositoryException;
-
-/**
- * SearchResultProperty
...
- */
-public class SearchResultProperty extends DefaultDavProperty {
-
- private static Logger log = Logger.getLogger(SearchResultProperty.class);
-
- public static final DavPropertyName SEARCH_RESULT_PROPERTY = DavPropertyName.create("search-result-property", ItemResourceConstants.NAMESPACE);
-
- private final String propertyName;
-
- /**
- * Creates a new WebDAV property with the given namespace, name and value.
- * If the property is intended to be protected the isProtected flag must
- * be set to true.
- *
- * @param propertyName JCR property name
- * @param value String representation of the property
- */
- public SearchResultProperty(String propertyName, Value value) {
- super(SEARCH_RESULT_PROPERTY, value, true);
- this.propertyName = propertyName;
- }
-
- /**
- * Return the Xml representation.
- * - * - * new SearchResultProperty("bli", new StringValue("blivalue")).toXml() - * - * returns an element with the following form: - * - * <jcr:search-result-property> - * <jcr:name>bli<jcr:name/> - * <jcr:value>blivalue<jcr:value/> - * </jcr:search-result-property> - *- * - * @return the Xml representation - * @see org.apache.jackrabbit.webdav.property.DavProperty#toXml() - */ - public Element toXml() { - Element elem = getName().toXml(); - elem.addContent(ItemResourceConstants.JCR_NAME.toXml().setText(propertyName)); - String valueStr = ""; - if (getValue() != null) { - Value value = (Value) getValue(); - try { - valueStr = value.getString(); - } catch (RepositoryException e) { - log.error(e.getMessage()); - } - } - elem.addContent(ItemResourceConstants.JCR_VALUE.toXml().setText(valueStr)); - return elem; - } -} \ No newline at end of file diff --git a/contrib/jcr-server/server/src/java/org/apache/jackrabbit/webdav/spi/transaction/TxLockManagerImpl.java b/contrib/jcr-server/server/src/java/org/apache/jackrabbit/webdav/spi/transaction/TxLockManagerImpl.java deleted file mode 100644 index 8e42d7afeac..00000000000 --- a/contrib/jcr-server/server/src/java/org/apache/jackrabbit/webdav/spi/transaction/TxLockManagerImpl.java +++ /dev/null @@ -1,666 +0,0 @@ -/* - * Copyright 2004 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.spi.transaction; - -import org.apache.log4j.Logger; -import org.apache.jackrabbit.webdav.*; -import org.apache.jackrabbit.webdav.spi.*; -import org.apache.jackrabbit.webdav.transaction.*; -import org.apache.jackrabbit.webdav.util.Text; -import org.apache.jackrabbit.webdav.lock.*; -import org.apache.jackrabbit.core.XASession; - -import javax.jcr.*; -import javax.transaction.xa.XAResource; -import javax.transaction.xa.XAException; -import javax.transaction.xa.Xid; -import java.util.*; - -/** - *
TxLockManagerImpl
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 class TxLockManagerImpl implements TxLockManager {
-
- private static Logger log = Logger.getLogger(TxLockManagerImpl.class);
-
- private TransactionMap map = new TransactionMap();
-
- /**
- * Create a new lock.
- *
- * @param lockInfo as present in the request body.
- * @param resource
- * @return the lock
- * @throws DavException if the lock could not be obtained.
- * @throws IllegalArgumentException if the resource is null
or
- * does not implement {@link TransactionResource} interface.
- * @see LockManager#createLock(org.apache.jackrabbit.webdav.lock.LockInfo, org.apache.jackrabbit.webdav.DavResource)
- */
- public ActiveLock createLock(LockInfo lockInfo, DavResource resource)
- throws DavException {
- if (resource == null || !(resource instanceof TransactionResource)) {
- throw new IllegalArgumentException("Invalid resource");
- }
- return createLock(lockInfo, (TransactionResource)resource);
- }
-
- /**
- * Create a new lock.
- *
- * @param lockInfo
- * @param resource
- * @return the lock
- * @throws DavException if the request lock has the wrong lock type or if
- * the lock could not be obtained for any reason.
- */
- private synchronized ActiveLock createLock(LockInfo lockInfo, TransactionResource resource)
- throws DavException {
- if (!lockInfo.isDeep() || !TransactionConstants.TRANSACTION.equals(lockInfo.getType())) {
- throw new DavException(DavServletResponse.SC_PRECONDITION_FAILED);
- }
-
- ActiveLock existing = getLock(lockInfo.getType(), lockInfo.getScope(), resource);
- if (existing != null) {
- throw new DavException(DavServletResponse.SC_LOCKED);
- }
- // TODO: check for locks on member resources is required as well for lock is always deep!
-
- Transaction tx = createTransaction(resource.getLocator(), lockInfo);
- tx.start(resource);
-
- // keep references to this lock
- addReferences(tx, getMap(resource), resource);
-
- return tx.getLock();
- }
-
- /**
- * Build the transaction object associated by the lock.
- *
- * @param locator
- * @param lockInfo
- * @return
- */
- private Transaction createTransaction(DavResourceLocator locator, LockInfo lockInfo) {
- if (TransactionConstants.GLOBAL.equals(lockInfo.getScope())) {
- return new GlobalTransaction(locator, new TxActiveLock(lockInfo));
- } else {
- return new LocalTransaction(locator, new TxActiveLock(lockInfo));
- }
- }
-
- /**
- * Refresh the lock indentified by the given lock token.
- *
- * @param lockInfo
- * @param lockToken
- * @param resource
- * @return the lock
- * @throws DavException
- * @throws IllegalArgumentException if the resource is null
or
- * does not implement {@link TransactionResource} interface.
- * @see LockManager#refreshLock(org.apache.jackrabbit.webdav.lock.LockInfo, String, org.apache.jackrabbit.webdav.DavResource)
- */
- public ActiveLock refreshLock(LockInfo lockInfo, String lockToken,
- DavResource resource) throws DavException {
- if (resource == null || !(resource instanceof TransactionResource)) {
- throw new IllegalArgumentException("Invalid resource");
- }
- return refreshLock(lockInfo, lockToken, (TransactionResource)resource);
- }
-
- /**
- * Reset the timeout of the lock identified by the given lock token.
- *
- * @param lockInfo
- * @param lockToken
- * @param resource
- * @return
- * @throws DavException if the lockdid not exist or is expired.
- */
- private synchronized ActiveLock refreshLock(LockInfo lockInfo, String lockToken,
- TransactionResource resource) throws DavException {
-
- TransactionMap responsibleMap = getMap(resource);
- Transaction tx = responsibleMap.get(lockToken);
- if (tx == null) {
- throw new DavException(DavServletResponse.SC_PRECONDITION_FAILED, "No valid transaction lock found for resource '" + resource.getResourcePath()+ "'");
- } else if (tx.getLock().isExpired()) {
- removeExpired(tx, responsibleMap, resource);
- throw new DavException(DavServletResponse.SC_PRECONDITION_FAILED, "Transaction lock for resource '" + resource.getResourcePath()+ "' was already expired.");
- } else {
- tx.getLock().setTimeout(lockInfo.getTimeout());
- }
- return tx.getLock();
- }
-
- /**
- * Throws UnsupportedOperationException.
- *
- * @param lockToken
- * @param resource
- * @throws DavException
- * @see LockManager#releaseLock(String, org.apache.jackrabbit.webdav.DavResource)
- */
- public void releaseLock(String lockToken, DavResource resource)
- throws DavException {
- throw new UnsupportedOperationException("A transaction lock can only be release with a TransactionInfo object and a lock token.");
- }
-
- /**
- * Release the lock identified by the given lock token.
- *
- * @param lockInfo
- * @param lockToken
- * @param resource
- * @throws DavException
- */
- public synchronized void releaseLock(TransactionInfo lockInfo, String lockToken,
- TransactionResource resource) throws DavException {
- if (resource == null) {
- throw new IllegalArgumentException("Resource must not be null.");
- }
- TransactionMap responsibleMap = getMap(resource);
- Transaction tx = responsibleMap.get(lockToken);
-
- if (tx == null) {
- throw new DavException(DavServletResponse.SC_PRECONDITION_FAILED, "No transaction lock found for resource '" + resource.getResourcePath()+ "'");
- } else if (tx.getLock().isExpired()) {
- removeExpired(tx, responsibleMap, resource);
- throw new DavException(DavServletResponse.SC_PRECONDITION_FAILED, "Transaction lock for resource '" + resource.getResourcePath()+ "' was already expired.");
- } else {
- if (TransactionConstants.XML_COMMIT.equals(lockInfo.getStatus())) {
- tx.commit(resource);
- } else {
- tx.rollback(resource);
- }
- removeReferences(tx, responsibleMap, resource);
- }
- }
-
- /**
- * Always returns null
- *
- * @param type
- * @param scope
- * @param resource
- * @return null
- * @see #getLock(Type, Scope, TransactionResource)
- * @see 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, DavResource resource) {
- return null;
- }
-
- /**
- * Return the lock applied to the given resource or null
- *
- * @param type
- * @param scope
- * @param resource
- * @return lock applied to the given resource or null
- * @see LockManager#getLock(Type, Scope, DavResource)
- * todo: is it correct to return one that specific lock, the current session is token-holder of?
- */
- public ActiveLock getLock(Type type, Scope scope, TransactionResource resource) {
- ActiveLock lock = null;
- if (TransactionConstants.TRANSACTION.equals(type)) {
- String[] sessionTokens = resource.getSession().getRepositorySession().getLockTokens();
- int i = 0;
- while (lock == null && i < sessionTokens.length) {
- String lockToken = sessionTokens[i];
- lock = getLock(lockToken, scope, resource);
- i++;
- }
- }
- return lock;
- }
-
- /**
- * @param lockToken
- * @param resource
- * @return
- */
- private ActiveLock getLock(String lockToken, Scope scope, DavResource resource) {
- if (!(resource instanceof TransactionResource)) {
- log.info("");
- return null;
- }
-
- ActiveLock lock = null;
- Transaction tx = null;
- TransactionMap m = map;
- // check if main-map contains that txId
- if (m.containsKey(lockToken)) {
- tx = m.get(lockToken);
- } else {
- // look through all the nested tx-maps (i.e. global txs) for the given txId
- Iterator it = m.values().iterator();
- while (it.hasNext() && tx == null) {
- Transaction txMap = (Transaction) it.next();
- if (!txMap.isLocal()) {
- m = ((TransactionMap)txMap);
- if (m.containsKey(lockToken)) {
- tx = ((TransactionMap)txMap).get(lockToken);
- }
- }
- }
- }
-
- if (tx != null) {
- if (tx.getLock().isExpired()) {
- removeExpired(tx, m, (TransactionResource)resource);
- } else if (tx.appliesToResource(resource) && (scope == null || tx.getLock().getScope().equals(scope))) {
- lock = tx.getLock();
- }
- }
- return lock;
- }
-
- /**
- * Returns true if the given lock token belongs to a lock that applies to
- * the given resource, false otherwise. The token may either be retrieved
- * from the {@link DavConstants#HEADER_LOCK_TOKEN Lock-Token header} or
- * from the {@link TransactionConstants#HEADER_TRANSACTIONID TransactionId header}.
- *
- * @param token
- * @param resource
- * @return
- * @see LockManager#hasLock(String token, DavResource resource)
- */
- public boolean hasLock(String token, DavResource resource) {
- return getLock(token, null, resource) != null;
- }
-
- /**
- * Return the map that may contain a transaction lock for the given resource.
- * In case the resource provides a transactionId, the map must be a
- * repository transaction that is identified by the given id and which in
- * turn can act as map.
- *
- * @param resource
- * @return responsible map.
- * @throws DavException if no map could be retrieved.
- */
- private TransactionMap getMap(TransactionResource resource)
- throws DavException {
-
- String txKey = resource.getTransactionId();
- if (txKey == null) {
- return map;
- } else {
- if (!map.containsKey(txKey)) {
- throw new DavException(DavServletResponse.SC_PRECONDITION_FAILED, "Transaction map '" + map + " does not contain a transaction with TransactionId '" + txKey + "'.");
- }
- Transaction tx = map.get(txKey);
- if (tx.isLocal()) {
- throw new DavException(DavServletResponse.SC_PRECONDITION_FAILED, "TransactionId '" + txKey + "' points to a local transaction, that cannot act as transaction map");
- } else if (tx.getLock() != null && tx.getLock().isExpired()) {
- removeExpired(tx, map, resource);
- throw new DavException(DavServletResponse.SC_PRECONDITION_FAILED, "Attempt to retrieve an expired global transaction.");
- }
- // tx is a global transaction that acts as map as well.
- return (TransactionMap)tx;
- }
- }
-
- /**
- * Rollbacks the specified transaction and releases the lock. This includes
- * the removal of all references.
- *
- * @param tx
- * @param responsibleMap
- * @param resource
- */
- private static void removeExpired(Transaction tx, TransactionMap responsibleMap,
- TransactionResource resource) {
- log.info("Removing expired transaction lock " + tx);
- try {
- tx.rollback(resource);
- removeReferences(tx, responsibleMap, resource);
- } catch (DavException e) {
- log.error("Error while removing expired transaction lock: " + e.getMessage());
- }
- }
-
- /**
- * Create the required references to the new transaction specified by tx.
- *
- * @param tx
- * @param responsibleMap
- * @param resource
- * @throws DavException
- */
- private static void addReferences(Transaction tx, TransactionMap responsibleMap,
- TransactionResource resource) throws DavException {
- log.info("Adding transactionId '" + tx.getId() + "' as session lock token.");
- resource.getSession().getRepositorySession().addLockToken(tx.getId());
-
- responsibleMap.put(tx.getId(), tx);
- resource.getSession().addReference(tx.getId());
- }
-
- /**
- * Remove all references to the specified transaction.
- *
- * @param tx
- * @param responsibleMap
- * @param resource
- */
- private static void removeReferences(Transaction tx, TransactionMap responsibleMap,
- TransactionResource resource) {
- log.info("Removing transactionId '" + tx.getId() + "' from session lock tokens.");
- resource.getSession().getRepositorySession().removeLockToken(tx.getId());
-
- responsibleMap.remove(tx.getId());
- resource.getSession().removeReference(tx.getId());
- }
- //------------------------------------------< inner classes, interfaces >---
- /**
- * Internal Transaction
interface
- */
- private interface Transaction {
-
- TxActiveLock getLock();
-
- /**
- * @return the id of this transaction.
- */
- String getId();
-
- /**
- * @return path of the lock holding resource
- */
- String getResourcePath();
-
- /**
- * @param resource
- * @return true if the lock defined by this transaction applies to the
- * given resource, either due to the resource holding that lock or due
- * to a deep lock hold by any ancestor resource.
- */
- boolean appliesToResource(DavResource resource);
-
- /**
- * @return true if this transaction is used to allow for transient changes
- * on the underlaying repository, that may be persisted with the final
- * UNLOCK request only.
- */
- boolean isLocal();
-
- /**
- * Start this transaction.
- *
- * @param resource
- * @throws DavException if an error occurs.
- */
- void start(TransactionResource resource) throws DavException ;
-
- /**
- * Commit this transaction
- *
- * @param resource
- * @throws DavException if an error occurs.
- */
- void commit(TransactionResource resource) throws DavException ;
-
- /**
- * Rollback this transaction.
- *
- * @param resource
- * @throws DavException if an error occurs.
- */
- void rollback(TransactionResource resource) throws DavException ;
- }
-
- /**
- * Abstract transaction covering functionally to both implementations.
- */
- private abstract static class AbstractTransaction extends TransactionMap implements Transaction {
-
- private final DavResourceLocator locator;
- private final TxActiveLock lock;
-
- private AbstractTransaction(DavResourceLocator locator, TxActiveLock lock) {
- this.locator = locator;
- this.lock = lock;
- }
-
- /**
- * @see #getLock()
- */
- public TxActiveLock getLock() {
- return lock;
- }
-
- /**
- * @see #getId()
- */
- public String getId() {
- return lock.getToken();
- }
-
- /**
- * @see #getResourcePath()
- */
- public String getResourcePath() {
- return locator.getResourcePath();
- }
-
- /**
- * @see #appliesToResource(DavResource)
- */
- public boolean appliesToResource(DavResource resource) {
- if (locator.isSameWorkspace(resource.getLocator())) {
- String lockResourcePath = getResourcePath();
- String resPath = resource.getResourcePath();
-
- while (!"".equals(resPath)) {
- if (lockResourcePath.equals(resPath)) {
- return true;
- }
- resPath = Text.getRelativeParent(resPath, 1);
- }
- }
- return false;
- }
- }
-
- /**
- *
- */
- private final static class LocalTransaction extends AbstractTransaction {
-
- private LocalTransaction(DavResourceLocator locator, TxActiveLock lock) {
- super(locator, lock);
- }
-
- public boolean isLocal() {
- return true;
- }
-
- public void start(TransactionResource resource) throws DavException {
- // make sure, the given resource represents an existing repository item
- if (!resource.getSession().getRepositorySession().itemExists(getResourcePath())) {
- throw new DavException(DavServletResponse.SC_CONFLICT, "Unable to start local transaction: no repository item present at "+getResourcePath());
- }
- }
-
- public void commit(TransactionResource resource) throws DavException {
- try {
- DavSession session = resource.getSession();
- session.getRepositorySession().getItem(getResourcePath()).save();
- } catch (RepositoryException e) {
- throw new JcrDavException(e);
- }
- }
-
- public void rollback(TransactionResource resource) throws DavException {
- try {
- DavSession session = resource.getSession();
- session.getRepositorySession().getItem(getResourcePath()).refresh(false);
- } catch (RepositoryException e) {
- throw new JcrDavException(e);
- }
- }
-
- public Transaction put(String key, Transaction value) throws DavException {
- throw new DavException(WebdavResponse.SC_PRECONDITION_FAILED, "Attempt to nest a new transaction into a local one.");
- }
- }
-
- /**
- *
- */
- private static class GlobalTransaction extends AbstractTransaction {
-
- private Xid xid;
-
- private GlobalTransaction(DavResourceLocator locator, TxActiveLock lock) {
- super(locator, lock);
- xid = new XidImpl(lock.getToken());
- }
-
- public boolean isLocal() {
- return false;
- }
-
- public void start(TransactionResource resource) throws DavException {
- XAResource xaRes = getXAResource(resource);
- try {
- xaRes.setTransactionTimeout((int)getLock().getTimeout()/1000);
- xaRes.start(xid, XAResource.TMNOFLAGS);
- } catch (XAException e) {
- throw new DavException(DavServletResponse.SC_FORBIDDEN, e.getMessage());
- }
- }
-
- public void commit(TransactionResource resource) throws DavException {
- XAResource xaRes = getXAResource(resource);
- try {
- xaRes.commit(xid, false);
- removeLocalTxReferences(resource);
- } catch (XAException e) {
- throw new DavException(DavServletResponse.SC_FORBIDDEN, e.getMessage());
- }
- }
-
- public void rollback(TransactionResource resource) throws DavException {
- XAResource xaRes = getXAResource(resource);
- try {
- xaRes.rollback(xid);
- removeLocalTxReferences(resource);
- } catch (XAException e) {
- throw new DavException(DavServletResponse.SC_FORBIDDEN, e.getMessage());
- }
- }
-
- private XAResource getXAResource(TransactionResource resource) throws DavException {
- Session session = resource.getSession().getRepositorySession();
- if (session instanceof XASession) {
- return ((XASession)session).getXAResource();
- } else {
- throw new DavException(DavServletResponse.SC_FORBIDDEN);
- }
- }
-
- private void removeLocalTxReferences(TransactionResource resource) {
- Iterator it = values().iterator();
- while (it.hasNext()) {
- Transaction tx = (Transaction) it.next();
- removeReferences(tx, this, resource);
- }
- }
-
- public Transaction put(String key, Transaction value) throws DavException {
- if (!(value instanceof LocalTransaction)) {
- throw new DavException(WebdavResponse.SC_PRECONDITION_FAILED, "Attempt to nest global transaction into a global one.");
- }
- return (Transaction) super.put(key, value);
- }
- }
-
- /**
- *
- */
- private static class TransactionMap extends HashMap {
-
- public Transaction get(String key) {
- Transaction tx = null;
- if (containsKey(key)) {
- tx = (Transaction) super.get(key);
- }
- return tx;
- }
-
- public Transaction put(String key, Transaction value) throws DavException {
- // any global an local transactions allowed.
- return (Transaction) super.put(key, value);
- }
- }
-
- /**
- * Private class implementing Xid interface.
- */
- private static class XidImpl implements Xid {
-
- private final String id;
-
- /**
- * Create a new Xid
- *
- * @param id
- */
- private XidImpl(String id) {
- this.id = id;
- }
-
- /**
- * @return 1
- * @see javax.transaction.xa.Xid#getFormatId()
- */
- public int getFormatId() {
- // todo: define reasonable format id
- return 1;
- }
-
- /**
- * @return an empty byte array.
- * @see javax.transaction.xa.Xid#getBranchQualifier()
- */
- public byte[] getBranchQualifier() {
- return new byte[0];
- }
-
- /**
- * @return id as byte array
- * @see javax.transaction.xa.Xid#getGlobalTransactionId()
- */
- public byte[] getGlobalTransactionId() {
- return id.getBytes();
- }
- }
-}
diff --git a/contrib/jcr-server/server/src/java/org/apache/jackrabbit/webdav/spi/version/VersionControlledItemCollection.java b/contrib/jcr-server/server/src/java/org/apache/jackrabbit/webdav/spi/version/VersionControlledItemCollection.java
deleted file mode 100644
index a4c7c82b144..00000000000
--- a/contrib/jcr-server/server/src/java/org/apache/jackrabbit/webdav/spi/version/VersionControlledItemCollection.java
+++ /dev/null
@@ -1,584 +0,0 @@
-/*
- * 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.spi.version;
-
-import org.apache.log4j.Logger;
-import org.apache.jackrabbit.webdav.property.*;
-import org.apache.jackrabbit.webdav.*;
-import org.apache.jackrabbit.webdav.spi.JcrDavException;
-import org.apache.jackrabbit.webdav.spi.DefaultItemCollection;
-import org.apache.jackrabbit.webdav.version.*;
-import org.apache.jackrabbit.webdav.version.report.*;
-
-import javax.jcr.*;
-import javax.jcr.observation.*;
-import javax.jcr.observation.EventListener;
-import javax.jcr.version.Version;
-import javax.jcr.version.VersionHistory;
-import java.util.List;
-
-/**
- * VersionControlledItemCollection
represents a JCR node item and
- * covers all functionality related to versioning of {@link Node}s.
- *
- * @see Node
- */
-public class VersionControlledItemCollection extends DefaultItemCollection
- implements VersionControlledResource {
-
- private static Logger log = Logger.getLogger(VersionControlledItemCollection.class);
-
- /**
- * Create a new VersionControlledItemCollection
.
- *
- * @param locator
- * @param session
- */
- public VersionControlledItemCollection(DavResourceLocator locator, DavSession session, DavResourceFactory factory) {
- super(locator, session, factory);
- if (exists() && !(item instanceof Node)) {
- throw new IllegalArgumentException("A collection resource can not be constructed from a Property item.");
- }
- }
-
- //----------------------------------------------< DavResource interface >---
- /**
- * Return a comma separated string listing the supported method names.
- *
- * @return the supported method names.
- * @see org.apache.jackrabbit.webdav.DavResource#getSupportedMethods()
- */
- public String getSupportedMethods() {
- StringBuffer sb = new StringBuffer(super.getSupportedMethods());
- // Versioning support
- sb.append(", ").append(VersionableResource.METHODS);
- if (this.isVersionControlled()) {
- try {
- if (((Node)item).isCheckedOut()) {
- sb.append(", ").append(VersionControlledResource.methods_checkedOut);
- } else {
- sb.append(", ").append(VersionControlledResource.methods_checkedIn);
- }
- } catch (RepositoryException e) {
- // should not occur.
- log.error(e.getMessage());
- }
- }
- return sb.toString();
- }
-
- //--------------------------------< VersionControlledResource interface >---
- /**
- * Adds version control to this resource. If the resource is already under
- * version control, this method has no effect.
- *
- * @throws org.apache.jackrabbit.webdav.DavException if this resource does not
- * exist yet or if an error occurs while making the underlaying node versionable.
- * @see org.apache.jackrabbit.webdav.version.VersionableResource#addVersionControl()
- */
- public void addVersionControl() throws DavException {
- if (!exists()) {
- throw new DavException(DavServletResponse.SC_NOT_FOUND);
- }
- if (!isVersionControlled()) {
- try {
- ((Node)item).addMixin(MIX_VERSIONABLE);
- item.save();
- } catch (RepositoryException e) {
- throw new JcrDavException(e);
- }
- } // else: is already version controlled -> ignore
- }
-
- /**
- * Calls {@link javax.jcr.Node#checkin()} on the underlaying repository node.
- *
- * @throws org.apache.jackrabbit.webdav.DavException
- * @see org.apache.jackrabbit.webdav.version.VersionControlledResource#checkin()
- */
- public String checkin() throws DavException {
- if (!exists()) {
- throw new DavException(DavServletResponse.SC_NOT_FOUND);
- }
- if (!isVersionControlled()) {
- throw new DavException(DavServletResponse.SC_METHOD_NOT_ALLOWED);
- }
- try {
- Version v = ((Node) item).checkin();
- DavResourceLocator loc = getLocator();
- String versionHref = loc.getFactory().createResourceLocator(loc.getPrefix(), loc.getWorkspacePath(), v.getPath()).getHref(true);
- return versionHref;
- } catch (RepositoryException e) {
- // UnsupportedRepositoryException should not occur
- throw new JcrDavException(e);
- }
- }
-
- /**
- * Calls {@link javax.jcr.Node#checkout()} on the underlaying repository node.
- *
- * @throws org.apache.jackrabbit.webdav.DavException
- * @see org.apache.jackrabbit.webdav.version.VersionControlledResource#checkout()
- */
- public void checkout() throws DavException {
- if (!exists()) {
- throw new DavException(DavServletResponse.SC_NOT_FOUND);
- }
- if (!isVersionControlled()) {
- throw new DavException(DavServletResponse.SC_METHOD_NOT_ALLOWED);
- }
- try {
- ((Node) item).checkout();
- } catch (RepositoryException e) {
- // UnsupportedRepositoryException should not occur
- throw new JcrDavException(e);
- }
- }
-
- /**
- * Not implemented. Always throws a DavException
with error code
- * {@link org.apache.jackrabbit.webdav.DavServletResponse#SC_NOT_IMPLEMENTED}.
- *
- * @throws org.apache.jackrabbit.webdav.DavException
- * @see org.apache.jackrabbit.webdav.version.VersionControlledResource#uncheckout()
- */
- public void uncheckout() throws DavException {
- throw new DavException(DavServletResponse.SC_NOT_IMPLEMENTED);
- }
-
- /**
- * Perform an update on this resource. Depending on the format of the updateInfo
- * this is translated to one of the following methods defined by the JCR API:
- * MultiStatus
returned by this method
- * will not list any nodes that have been removed due to an Uuid conflict.
- *
- * @param updateInfo
- * @return
- * @throws org.apache.jackrabbit.webdav.DavException
- * @see org.apache.jackrabbit.webdav.version.VersionControlledResource#update(org.apache.jackrabbit.webdav.version.UpdateInfo)
- * @todo with jcr the node must not be versionable in order to perform Node.update.
- */
- public MultiStatus update(UpdateInfo updateInfo) throws DavException {
- if (updateInfo == null) {
- throw new DavException(DavServletResponse.SC_BAD_REQUEST, "Valid update request body required.");
- }
- if (!exists()) {
- throw new DavException(DavServletResponse.SC_NOT_FOUND);
- }
-
- MultiStatus ms = new MultiStatus();
- try {
- Node node = (Node)item;
- boolean removeExisting = updateInfo.getUpdateElement().getChild(XML_REMOVEEXISTING, NAMESPACE) != null;
-
- // register eventListener in order to be able to report the modified resources.
- EventListener el = new EListener(updateInfo.getPropertyNameSet(), ms);
- registerEventListener(el, node.getPath());
-
- // perform the update/restore according to the update info
- if (updateInfo.getVersionHref() != null) {
- VersionHistory vh = node.getVersionHistory();
- String[] hrefs = updateInfo.getVersionHref();
- Version[] versions = new Version[hrefs.length];
- for (int i = 0; i < hrefs.length; i++) {
- versions[i] = vh.getVersion(getResourceName(hrefs[i], true));
- }
- if (versions.length == 1) {
- String relPath = updateInfo.getUpdateElement().getChildText(XML_RELPATH, NAMESPACE);
- if (relPath == null) {
- node.restore(versions[0], removeExisting);
- } else {
- node.restore(versions[0], relPath, removeExisting);
- }
- } else {
- getRepositorySession().getWorkspace().restore(versions, removeExisting);
- }
- } else if (updateInfo.getLabelName() != null) {
- String[] labels = updateInfo.getLabelName();
- if (labels.length == 1) {
- node.restoreByLabel(labels[0], removeExisting);
- } else {
- Version[] vs = new Version[labels.length];
- VersionHistory vh = node.getVersionHistory();
- for (int i = 0; i < labels.length; i++) {
- vs[i] = vh.getVersionByLabel(labels[i]);
- }
- getRepositorySession().getWorkspace().restore(vs, removeExisting);
- }
- } else if (updateInfo.getWorkspaceHref() != null) {
- String workspaceName = getResourceName(updateInfo.getWorkspaceHref(), true);
- node.update(workspaceName);
- } else {
- throw new DavException(DavServletResponse.SC_BAD_REQUEST, "Invalid update request body.");
- }
-
- // unregister the event listener again
- unregisterEventListener(el);
-
- } catch (RepositoryException e) {
- throw new JcrDavException(e);
- }
- return ms;
- }
-
- /**
- * Merge the repository node represented by this resource according to the
- * information present in the given {@link MergeInfo} object.
- *
- * @param mergeInfo
- * @return MultiStatus
reccording all repository items affected
- * by this merge call.
- * @throws org.apache.jackrabbit.webdav.DavException
- * @see org.apache.jackrabbit.webdav.version.VersionControlledResource#merge(org.apache.jackrabbit.webdav.version.MergeInfo)
- * @see Node#merge(String, boolean)
- * @todo with jcr the node must not be versionable in order to perform Node.merge
- */
- public MultiStatus merge(MergeInfo mergeInfo) throws DavException {
- if (mergeInfo == null) {
- throw new DavException(DavServletResponse.SC_BAD_REQUEST);
- }
- if (!exists()) {
- throw new DavException(DavServletResponse.SC_NOT_FOUND);
- }
-
- MultiStatus ms = new MultiStatus();
- try {
- Node node = (Node)item;
-
- // register eventListener in order to be able to report the modifications.
- EventListener el = new EListener(mergeInfo.getPropertyNameSet(), ms);
- registerEventListener(el, node.getPath());
-
- String workspaceName = getResourceName(mergeInfo.getSourceHref(), true);
- node.merge(workspaceName, !mergeInfo.isNoAutoMerge());
-
- // unregister the event listener again
- unregisterEventListener(el);
-
- } catch (RepositoryException e) {
- throw new JcrDavException(e);
- }
-
- return ms;
- }
-
- /**
- * Resolve the merge conflicts according to the value of the {@link #AUTO_MERGE_SET DAV:auto-merge-set}
- * property present in the specified DavPropertySet
s.
- *
- * @param setProperties
- * @param removePropertyNames
- * @throws org.apache.jackrabbit.webdav.DavException
- * @see VersionControlledResource#resolveMergeConflict(DavPropertySet, DavPropertyNameSet)
- * @see Node#doneMerge(Version)
- * @see Node#cancelMerge(Version)
- */
- public void resolveMergeConflict(DavPropertySet setProperties,
- DavPropertyNameSet removePropertyNames) throws DavException {
-
- if (!exists()) {
- throw new DavException(DavServletResponse.SC_NOT_FOUND);
- }
- if (!isVersionControlled()) {
- throw new DavException(DavServletResponse.SC_METHOD_NOT_ALLOWED);
- }
-
- try {
- Node n = (Node)item;
- if (removePropertyNames.contains(AUTO_MERGE_SET)) {
- // retrieve the current jcr:mergeFailed property values
- if (!((Node)item).hasProperty(PROP_MERGEFAILED)) {
- throw new DavException(DavServletResponse.SC_CONFLICT, "Attempt to resolve non-existing merge conflicts.");
- }
- Value[] mergeFailed = ((Node)item).getProperty(PROP_MERGEFAILED).getValues();
-
- // resolve all remaining merge conflicts with 'cancel'
- for (int i = 0; i < mergeFailed.length; i++) {
- n.cancelMerge((Version)getRepositorySession().getNodeByUUID(mergeFailed[i].getString()));
- }
- // adjust removeProperty set
- removePropertyNames.remove(AUTO_MERGE_SET);
-
- } else if (setProperties.contains(AUTO_MERGE_SET) && setProperties.contains(PREDECESSOR_SET)){
- // retrieve the current jcr:mergeFailed property values
- if (!((Node)item).hasProperty(PROP_MERGEFAILED)) {
- throw new DavException(DavServletResponse.SC_CONFLICT, "Attempt to resolve non-existing merge conflicts.");
- }
- Value[] mergeFailed = ((Node)item).getProperty(PROP_MERGEFAILED).getValues();
-
-
- // check which mergeFailed entries have been removed from the
- // auto-merge-set (cancelMerge) and have been moved over to the
- // predecessor set (doneMerge)
- List mergeset = new HrefProperty(setProperties.get(AUTO_MERGE_SET)).getHrefs();
- List predecSet = new HrefProperty(setProperties.get(PREDECESSOR_SET)).getHrefs();
-
- Session session = getRepositorySession();
- for (int i = 0; i < mergeFailed.length; i++) {
- // build version-href from each entry in the jcr:mergeFailed property
- Version version = (Version) session.getNodeByUUID(mergeFailed[i].getString());
- String href = this.getLocatorFromItem(version).getHref(true);
-
- // Test if that version has been removed from the merge-set.
- // thus indicating that the merge-conflict needs to be resolved.
- if (!mergeset.contains(href)) {
- // Test if the 'href' has been moved over to the
- // predecessor-set (thus 'doneMerge' is appropriate) or
- // if it is not present in the predecessor set and the
- // the conflict is resolved by 'cancelMerge'.
- if (predecSet.contains(href)) {
- n.doneMerge(version);
- } else {
- n.cancelMerge(version);
- }
- }
- }
- // adjust setProperty set
- setProperties.remove(AUTO_MERGE_SET);
- setProperties.remove(PREDECESSOR_SET);
- } else {
- // setPropertySet and removePropertySet do not ask for resolving merge conflicts */
- log.debug("setProperties and removeProperties sets do not request for merge conflict resolution.");
- }
- } catch (RepositoryException e) {
- throw new JcrDavException(e);
- }
- }
-
- /**
- * Modify the labels present with the versions of this resource.
- *
- * @param labelInfo
- * @throws DavException
- * @see VersionHistory#addVersionLabel(String, String, boolean)
- * @see VersionHistory#removeVersionLabel(String)
- */
- public void label(LabelInfo labelInfo) throws DavException {
- if (labelInfo == null) {
- throw new DavException(DavServletResponse.SC_BAD_REQUEST, "Valid label request body required.");
- }
- if (!exists()) {
- throw new DavException(DavServletResponse.SC_NOT_FOUND);
- }
-
- try {
- if (!isVersionControlled() || ((Node)item).isCheckedOut()) {
- throw new DavException(DavServletResponse.SC_PRECONDITION_FAILED, "A LABEL request may only be applied to a version-controlled, checked-in resource.");
- }
- DavResource[] resArr = this.getReferenceResources(CHECKED_IN);
- if (resArr.length == 1 && resArr[0] instanceof VersionResource) {
- ((VersionResource)resArr[0]).label(labelInfo);
- } else {
- throw new DavException(DavServletResponse.SC_INTERNAL_SERVER_ERROR, "DAV:checked-in property on '" + getHref() + "' did not point to a single VersionResource.");
- }
- } catch (RepositoryException e) {
- throw new JcrDavException(e);
- }
- }
-
- /**
- * Returns the {@link VersionHistory} associated with the repository node.
- * If the node is not versionable an exception is thrown.
- *
- * @return the {@link VersionHistoryResource} associated with this resource.
- * @throws org.apache.jackrabbit.webdav.DavException
- * @see org.apache.jackrabbit.webdav.version.VersionControlledResource#getVersionHistory()
- * @see javax.jcr.Node#getVersionHistory()
- */
- public VersionHistoryResource getVersionHistory() throws DavException {
- if (!exists()) {
- throw new DavException(DavServletResponse.SC_NOT_FOUND);
- }
-
- try {
- VersionHistory vh = ((Node)item).getVersionHistory();
- DavResourceLocator loc = getLocatorFromItem(vh);
- return (VersionHistoryResource) createResourceFromLocator(loc);
- } catch (RepositoryException e) {
- throw new JcrDavException(e);
- }
- }
-
- //--------------------------------------------------------------------------
- /**
- * Define the set of reports supported by this resource.
- *
- * @see SupportedReportSetProperty
- */
- protected void initSupportedReports() {
- super.initSupportedReports();
- if (exists()) {
- supportedReports.addReportType(ReportType.LOCATE_BY_HISTORY);
- if (this.isVersionControlled()) {
- supportedReports.addReportType(ReportType.VERSION_TREE);
- }
- }
- }
-
- /**
- * Fill the property set for this resource.
- */
- protected void initProperties() {
- super.initProperties();
- if (exists()) {
- Node n = (Node)item;
- // properties defined by RFC 3253 for version-controlled resources
- if (isVersionControlled()) {
- // workspace property already set in AbstractResource.initProperties()
- try {
- // DAV:version-history (computed)
- String vhHref = getLocatorFromResourcePath(n.getVersionHistory().getPath()).getHref(true);
- properties.add(new HrefProperty(VERSION_HISTORY, vhHref, true));
-
- // DAV:auto-version property: there is no auto version, explicit CHECKOUT is required.
- properties.add(new DefaultDavProperty(AUTO_VERSION, null, false));
-
- String baseVHref = getLocatorFromResourcePath(n.getBaseVersion().getPath()).getHref(true);
- if (n.isCheckedOut()) {
- // DAV:checked-out property (protected)
- properties.add(new HrefProperty(CHECKED_OUT, baseVHref, true));
-
- // DAV:predecessors property
- if (n.hasProperty(PROP_PREDECESSORS)) {
- Value[] predec = n.getProperty(PROP_PREDECESSORS).getValues();
- addHrefProperty(PREDECESSOR_SET, predec, false);
- }
- // DAV:auto-merge-set property. NOTE: the DAV:merge-set
- // never occurs, because merging without bestEffort flag
- // being set results in an exception on failure.
- if (n.hasProperty(PROP_MERGEFAILED)) {
- ReferenceValue[] mergeFailed = (ReferenceValue[]) n.getProperty(PROP_MERGEFAILED).getValues();
- addHrefProperty(AUTO_MERGE_SET, mergeFailed, false);
- }
- // todo: checkout-fork, checkin-fork
- } else {
- // DAV:checked-in property (protected)
- properties.add(new HrefProperty(CHECKED_IN, baseVHref, true));
- }
- } catch (RepositoryException e) {
- log.error(e.getMessage());
- }
- }
- }
- }
-
- /**
- * Add a {@link org.apache.jackrabbit.webdav.property.HrefProperty} with the specified property name and values.
- *
- * @param name
- * @param values Array of {@link ReferenceValue}s.
- * @param isProtected
- * @throws javax.jcr.ValueFormatException
- * @throws IllegalStateException
- * @throws javax.jcr.RepositoryException
- */
- private void addHrefProperty(DavPropertyName name, Value[] values,
- boolean isProtected)
- throws ValueFormatException, IllegalStateException, RepositoryException {
- Node[] nodes = new Node[values.length];
- for (int i = 0; i < values.length; i++) {
- nodes[i] = getRepositorySession().getNodeByUUID(values[i].getString());
- }
- addHrefProperty(name, nodes, isProtected);
- }
-
- /**
- * @return true, if this resource represents an existing repository node
- * that has the mixin nodetype 'mix:versionable' set.
- */
- private boolean isVersionControlled() {
- boolean vc = false;
- if (exists()) {
- try {
- vc = ((Node) item).isNodeType("mix:versionable");
- } catch (RepositoryException e) {
- log.warn(e.getMessage());
- }
- }
- return vc;
- }
-
- /**
- * Register the specified event listener with the observation manager present
- * the repository session.
- *
- * @param listener
- * @param nodePath
- * @throws javax.jcr.RepositoryException
- */
- private void registerEventListener(EventListener listener, String nodePath) throws RepositoryException {
- getRepositorySession().getWorkspace().getObservationManager().addEventListener(listener, EListener.ALL_EVENTS, nodePath, true, null, null, false);
- }
-
- /**
- * Unregister the specified event listener with the observation manager present
- * the repository session.
- *
- * @param listener
- * @throws javax.jcr.RepositoryException
- */
- private void unregisterEventListener(EventListener listener) throws RepositoryException {
- getRepositorySession().getWorkspace().getObservationManager().removeEventListener(listener);
- }
-
- //------------------------------------------------------< inner classes >---
- /**
- * Simple EventListener that creates a new {@link org.apache.jackrabbit.webdav.MultiStatusResponse} object
- * for each event and adds it to the specified {@link org.apache.jackrabbit.webdav.MultiStatus}.
- */
- private class EListener implements EventListener {
-
- private static final int ALL_EVENTS = Event.NODE_ADDED | Event.NODE_REMOVED | Event.PROPERTY_ADDED | Event.PROPERTY_CHANGED | Event.PROPERTY_REMOVED;
-
- private final DavPropertyNameSet propNameSet;
- private MultiStatus ms;
-
- private EListener(DavPropertyNameSet propNameSet, MultiStatus ms) {
- this.propNameSet = propNameSet;
- this.ms = ms;
- }
-
- /**
- * @see EventListener#onEvent(javax.jcr.observation.EventIterator)
- */
- public void onEvent(EventIterator events) {
- while (events.hasNext()) {
- try {
- Event e = events.nextEvent();
- String itemPath = e.getPath();
- DavResourceLocator loc = getLocatorFromResourcePath(itemPath);
- DavResource res = createResourceFromLocator(loc);
- ms.addResponse(new MultiStatusResponse(res, propNameSet));
-
- } catch (DavException e) {
- // should not occur
- log.error("Error while building MultiStatusResponse from Event: " + e.getMessage());
- } catch (RepositoryException e) {
- // should not occur
- log.error("Error while building MultiStatusResponse from Event: " + e.getMessage());
- }
- }
- }
- }
-}
\ No newline at end of file
diff --git a/contrib/jcr-server/server/src/java/org/apache/jackrabbit/webdav/spi/version/VersionHistoryItemCollection.java b/contrib/jcr-server/server/src/java/org/apache/jackrabbit/webdav/spi/version/VersionHistoryItemCollection.java
deleted file mode 100644
index 3bb743be380..00000000000
--- a/contrib/jcr-server/server/src/java/org/apache/jackrabbit/webdav/spi/version/VersionHistoryItemCollection.java
+++ /dev/null
@@ -1,136 +0,0 @@
-/*
- * 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.spi.version;
-
-import org.apache.log4j.Logger;
-import org.apache.jackrabbit.webdav.version.*;
-import org.apache.jackrabbit.webdav.property.HrefProperty;
-import org.apache.jackrabbit.webdav.spi.ItemResourceConstants;
-import org.apache.jackrabbit.webdav.spi.JcrDavException;
-import org.apache.jackrabbit.webdav.spi.DefaultItemCollection;
-import org.apache.jackrabbit.webdav.*;
-
-import javax.jcr.RepositoryException;
-import javax.jcr.version.VersionHistory;
-import javax.jcr.version.VersionIterator;
-import java.util.ArrayList;
-
-/**
- * VersionHistoryItemCollection
represents a JCR version history.
- *
- * @see VersionHistory
- */
-public class VersionHistoryItemCollection extends DefaultItemCollection
- implements VersionHistoryResource {
-
- private static Logger log = Logger.getLogger(VersionHistoryItemCollection.class);
-
- /**
- * Create a new VersionHistoryItemCollection
resource.
- *
- * @param resourcePath
- * @param session
- * @param factory
- */
- public VersionHistoryItemCollection(DavResourceLocator resourcePath, DavSession session, DavResourceFactory factory) {
- super(resourcePath, session, factory);
- if (item == null || !(item instanceof VersionHistory)) {
- throw new IllegalArgumentException("VersionHistory item expected.");
- }
- }
-
- //----------------------------------------------< DavResource interface >---
- /**
- * @see org.apache.jackrabbit.webdav.DavResource#getSupportedMethods()
- */
- public String getSupportedMethods() {
- StringBuffer sb = new StringBuffer(ItemResourceConstants.METHODS);
- sb.append(", ").append(VersionHistoryResource.METHODS);
- return sb.toString();
- }
-
- /**
- * Removing a version resource is achieved by calling removeVersion
- * on the versionhistory item this version belongs to.
- *
- * @throws DavException if the version does not exist or if an error occurs
- * while deleting.
- * @see DavResource#removeMember(org.apache.jackrabbit.webdav.DavResource)
- */
- public void removeMember(DavResource member) throws DavException {
- if (exists()) {
- VersionHistory versionHistory = (VersionHistory) item;
- try {
- versionHistory.removeVersion(getResourceName(member.getHref(), true));
- } catch (RepositoryException e) {
- throw new JcrDavException(e);
- }
- } else {
- throw new DavException(DavServletResponse.SC_NOT_FOUND);
- }
- }
- //-----------------------------------< VersionHistoryResource interface >---
- /**
- * Return an array of {@link VersionResource}s representing all versions
- * present in the underlaying JCR version history.
- *
- * @return array of {@link VersionResource}s representing all versions
- * present in the underlaying JCR version history.
- * @throws DavException
- * @see org.apache.jackrabbit.webdav.version.VersionHistoryResource#getVersions()
- */
- public VersionResource[] getVersions() throws DavException {
- try {
- VersionIterator vIter = ((VersionHistory)item).getAllVersions();
- ArrayList l = new ArrayList();
- while (vIter.hasNext()) {
- DavResourceLocator versionLoc = getLocatorFromItem(vIter.nextVersion());
- DavResource vr = createResourceFromLocator(versionLoc);
- l.add(vr);
- }
- return (VersionResource[]) l.toArray(new VersionResource[l.size()]);
- } catch (RepositoryException e) {
- throw new JcrDavException(e);
- }
- }
-
- //--------------------------------------------------------------------------
- /**
- * Fill the property set for this resource.
- */
- protected void initProperties() {
- super.initProperties();
-
- // change resourcetype defined by default item collection
- properties.add(new ResourceType(ResourceType.VERSION_HISTORY));
-
- // required root-version property for version-history resource
- try {
- String rootVersionResourcePath = ((VersionHistory)item).getRootVersion().getPath();
- properties.add(new HrefProperty(VersionHistoryResource.ROOT_VERSION, getLocatorFromResourcePath(rootVersionResourcePath).getHref(true), true));
- } catch (RepositoryException e) {
- log.error(e.getMessage());
- }
-
- // required, protected version-set property for version-history resource
- try {
- VersionIterator vIter = ((VersionHistory)item).getAllVersions();
- addHrefProperty(VersionHistoryResource.VERSION_SET, vIter, true);
- } catch (RepositoryException e) {
- log.error(e.getMessage());
- }
- }
-}
\ No newline at end of file
diff --git a/contrib/jcr-server/server/src/java/org/apache/jackrabbit/webdav/spi/version/VersionItemCollection.java b/contrib/jcr-server/server/src/java/org/apache/jackrabbit/webdav/spi/version/VersionItemCollection.java
deleted file mode 100644
index fba927dbbef..00000000000
--- a/contrib/jcr-server/server/src/java/org/apache/jackrabbit/webdav/spi/version/VersionItemCollection.java
+++ /dev/null
@@ -1,202 +0,0 @@
-/*
- * 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.spi.version;
-
-import org.apache.log4j.Logger;
-import org.apache.jackrabbit.webdav.spi.JcrDavException;
-import org.apache.jackrabbit.webdav.spi.ItemResourceConstants;
-import org.apache.jackrabbit.webdav.spi.DefaultItemCollection;
-import org.apache.jackrabbit.webdav.*;
-import org.apache.jackrabbit.webdav.property.*;
-import org.apache.jackrabbit.webdav.version.*;
-import org.apache.jackrabbit.webdav.version.report.ReportType;
-import org.jdom.Element;
-
-import javax.jcr.*;
-import javax.jcr.version.Version;
-import javax.jcr.version.VersionHistory;
-import java.util.List;
-import java.util.ArrayList;
-
-/**
- * VersionItemCollection
represents a JCR version.
- *
- * @see Version
- */
-public class VersionItemCollection extends DefaultItemCollection
- implements VersionResource {
-
- private static Logger log = Logger.getLogger(VersionItemCollection.class);
-
- /**
- * Create a new VersionItemCollection
.
- *
- * @param locator
- * @param session
- * @param factory
- */
- public VersionItemCollection(DavResourceLocator locator, DavSession session, DavResourceFactory factory) {
- super(locator, session, factory);
- if (item == null || !(item instanceof Version)) {
- throw new IllegalArgumentException("Version item expected.");
- }
- }
-
- //----------------------------------------------< DavResource interface >---
- /**
- * @see org.apache.jackrabbit.webdav.DavResource#getSupportedMethods()
- */
- public String getSupportedMethods() {
- StringBuffer sb = new StringBuffer(ItemResourceConstants.METHODS);
- sb.append(", ").append(VersionResource.METHODS);
- return sb.toString();
- }
-
- //------------------------------------------< VersionResource interface >---
- /**
- * Modify the labels defined for the underlaying repository version.
- *
- * @param labelInfo
- * @throws DavException
- * @see VersionResource#label(org.apache.jackrabbit.webdav.version.LabelInfo)
- * @see VersionHistory#addVersionLabel(String, String, boolean)
- * @see VersionHistory#removeVersionLabel(String)
- */
- public void label(LabelInfo labelInfo) throws DavException {
- if (labelInfo == null) {
- throw new DavException(DavServletResponse.SC_BAD_REQUEST, "Valid label request body required.");
- }
- if (!exists()) {
- throw new DavException(DavServletResponse.SC_NOT_FOUND);
- }
- try {
- VersionHistory vh = getVersionHistoryItem();
- if (labelInfo.getType() == LabelInfo.TYPE_REMOVE) {
- vh.removeVersionLabel(labelInfo.getLabelName());
- } else if (labelInfo.getType() == LabelInfo.TYPE_ADD) {
- // ADD: only add if not yet existing
- vh.addVersionLabel(item.getName(), labelInfo.getLabelName(), false);
- } else {
- // SET: move label if already existing
- vh.addVersionLabel(item.getName(), labelInfo.getLabelName(), true);
- }
- } catch (RepositoryException e) {
- throw new JcrDavException(e);
- }
- }
-
- /**
- * Returns the {@link VersionHistory} associated with the repository version.
- * Note: in contrast to a versionable node, the version history of a version
- * item is always represented by its nearest ancestor.
- *
- * @return the {@link VersionHistoryResource} associated with this resource.
- * @throws org.apache.jackrabbit.webdav.DavException
- * @see org.apache.jackrabbit.webdav.version.VersionResource#getVersionHistory()
- * @see javax.jcr.Item#getParent()
- */
- public VersionHistoryResource getVersionHistory() throws DavException {
- if (!exists()) {
- throw new DavException(DavServletResponse.SC_NOT_FOUND);
- }
-
- try {
- VersionHistory vh = getVersionHistoryItem();
- DavResourceLocator loc = getLocatorFromItem(vh);
- return (VersionHistoryResource) createResourceFromLocator(loc);
- } catch (RepositoryException e) {
- throw new JcrDavException(e);
- }
- }
-
- /**
- * Return the nearest ancestor of the underlaying repository item.
- *
- * @return nearest ancestor of the underlaying repository item.
- * @throws RepositoryException
- */
- private VersionHistory getVersionHistoryItem() throws RepositoryException {
- return (VersionHistory) item.getParent();
- }
-
- //--------------------------------------------------------------------------
- /**
- * Define the set of reports supported by this resource.
- *
- * @see org.apache.jackrabbit.webdav.version.report.SupportedReportSetProperty
- */
- protected void initSupportedReports() {
- super.initSupportedReports();
- if (exists()) {
- supportedReports.addReportType(ReportType.VERSION_TREE);
- }
- }
-
- /**
- * Fill the property set for this resource.
- */
- protected void initProperties() {
- super.initProperties();
-
- if (exists()) {
- Version v = (Version)item;
- // created and creationDate properties
- try {
- String creationDate = DavConstants.creationDateFormat.format(v.getCreated().getTime());
- // jcr specific 'created' property
- properties.add(new DefaultDavProperty(CREATED, creationDate));
- // replace dummy creation date from default collection
- properties.add(new DefaultDavProperty(DavPropertyName.CREATIONDATE, creationDate));
-
- // required, protected DAV:version-name property
- properties.add(new DefaultDavProperty(VERSION_NAME, v.getName(), true));
-
- // required, protected DAV:label-name-set property
- String[] labels = getVersionHistoryItem().getVersionLabels(v);
- Element[] labelElems = new Element[labels.length];
- for (int i = 0; i < labels.length; i++) {
- labelElems[i] = new Element(DeltaVConstants.XML_LABEL_NAME, NAMESPACE).setText(labels[i]);
- }
- properties.add(new DefaultDavProperty(LABEL_NAME_SET, labelElems, true));
-
- // required DAV:predecessor-set (protected) and DAV:successor-set (computed) properties
- addHrefProperty(VersionResource.PREDECESSOR_SET, v.getPredecessors(), true);
- addHrefProperty(SUCCESSOR_SET, v.getSuccessors(), true);
-
- // required DAV:version-history (computed) property
- String vhPath = getVersionHistoryItem().getPath();
- properties.add(new HrefProperty(VersionResource.VERSION_HISTORY, getLocatorFromResourcePath(vhPath).getHref(true), true));
-
- // required DAV:checkout-set (computed) property
- PropertyIterator it = v.getReferences();
- List nodeList = new ArrayList();
- while (it.hasNext()) {
- Property p = it.nextProperty();
- if (PROP_BASEVERSION.equals(p.getName())) {
- Node n = p.getParent();
- if (n.isCheckedOut()) {
- nodeList.add(n);
- }
- }
- }
- addHrefProperty(CHECKOUT_SET, (Node[]) nodeList.toArray(new Node[nodeList.size()]), true);
-
- } catch (RepositoryException e) {
- log.error(e.getMessage());
- }
- }
- }
-}
\ No newline at end of file
diff --git a/contrib/jcr-server/server/src/java/org/apache/jackrabbit/webdav/spi/version/package.html b/contrib/jcr-server/server/src/java/org/apache/jackrabbit/webdav/spi/version/package.html
deleted file mode 100644
index aeea3f616a8..00000000000
--- a/contrib/jcr-server/server/src/java/org/apache/jackrabbit/webdav/spi/version/package.html
+++ /dev/null
@@ -1,9 +0,0 @@
-
-Contains JCR specific implementations for the following interfaces:
-ExportViewReport
handles REPORT requests for the 'exportview'
- * report. The 'exportview' report is used to export
- * {@link Session#exportDocView(String, java.io.OutputStream, boolean, boolean) DocView}
- * and {@link Session#exportSysView(String, java.io.OutputStream, boolean, boolean) SysView}
- * of the {@link javax.jcr.Item item} represented by the requested resource.
- *
- * The request body must contain a jcr:exportview element:
- * - * <!ELEMENT exportview ( (sysview | docview)?, skipbinary?, norecurse ) > - * <!ELEMENT sysview EMPTY > - * <!ELEMENT docview EMPTY > - * <!ELEMENT skipbinary EMPTY > - * <!ELEMENT norecurse EMPTY > - *- * If no view type is specified the DocView is generated. - */ -public class ExportViewReport implements Report { - - private static Logger log = Logger.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); - - private String absPath; - private Session session; - private ReportInfo info; - - /** - * Returns {@link #EXPORTVIEW_REPORT} report type. - * - * @return {@link #EXPORTVIEW_REPORT} - * @see org.apache.jackrabbit.webdav.version.report.Report#getType() - */ - public ReportType getType() { - return EXPORTVIEW_REPORT; - } - - /** - * @param resource The resource this report is generated from. NOTE: the - * {@link org.apache.jackrabbit.webdav.DavResource#getResourcePath() resource path} - * of the resource is used as 'absPath' argument for exporting the specified - * view. - * @throws IllegalArgumentException if the resource is
null
or
- * if the session object provided with the resource is null
.
- * @see Report#setResource(org.apache.jackrabbit.webdav.version.DeltaVResource)
- */
- public void setResource(DeltaVResource resource) {
- if (resource == null) {
- throw new IllegalArgumentException("Resource must not be null.");
- }
- DavSession davSession = resource.getSession();
- if (davSession == null || davSession.getRepositorySession() == null) {
- throw new IllegalArgumentException("The resource must provide a non-null session object in order to create the jcr:nodetypes report.");
- }
- session = davSession.getRepositorySession();
- absPath = resource.getResourcePath();
- }
-
- /**
- * @param info
- * @throws IllegalArgumentException if the specified {@link ReportInfo info}
- * object does not contain a jcr:exportview element.
- * @see Report#setInfo(org.apache.jackrabbit.webdav.version.report.ReportInfo)
- */
- public void setInfo(ReportInfo info) {
- if (info == null || !REPORT_NAME.equals(info.getReportElement().getName())) {
- throw new IllegalArgumentException("jcr:exportview element expected.");
- }
- this.info = info;
- }
-
- /**
- * Creates a Xml document from the generated view.
- *
- * @return Xml document representing the output of the specified view.
- * @throws DavException if the report document could not be created.
- * @see org.apache.jackrabbit.webdav.version.report.Report#toXml()
- */
- public Document toXml() throws DavException {
- Element reportElem = info.getReportElement();
- boolean skipBinary = reportElem.getChild("skipbinary", ItemResourceConstants.NAMESPACE) != null;
- boolean noRecurse = reportElem.getChild("norecurse", ItemResourceConstants.NAMESPACE) != null;
-
- try {
- // create tmpFile in default system-tmp directory
- String prefix = "_tmp_" + Text.getLabel(absPath);
- File tmpfile = File.createTempFile(prefix, null, null);
- tmpfile.deleteOnExit();
- FileOutputStream out = new FileOutputStream(tmpfile);
-
- if (reportElem.getChild("sysview", ItemResourceConstants.NAMESPACE) != null) {
- session.exportSysView(absPath, out, skipBinary, noRecurse);
- } else {
- // default is docview
- session.exportDocView(absPath, out, skipBinary, noRecurse);
- }
- out.close();
-
- SAXBuilder builder = new SAXBuilder(false);
- InputStream in = new FileInputStream(tmpfile);
- return builder.build(in);
-
- } catch (FileNotFoundException e) {
- throw new DavException(DavServletResponse.SC_INTERNAL_SERVER_ERROR);
- } catch (IOException e) {
- throw new DavException(DavServletResponse.SC_INTERNAL_SERVER_ERROR);
- } catch (PathNotFoundException e) {
- throw new DavException(DavServletResponse.SC_NOT_FOUND);
- } catch (RepositoryException e) {
- throw new JcrDavException(e);
- } catch (JDOMException e) {
- throw new DavException(DavServletResponse.SC_INTERNAL_SERVER_ERROR);
- }
- }
-}
\ No newline at end of file
diff --git a/contrib/jcr-server/server/src/java/org/apache/jackrabbit/webdav/spi/version/report/LocateByUuidReport.java b/contrib/jcr-server/server/src/java/org/apache/jackrabbit/webdav/spi/version/report/LocateByUuidReport.java
deleted file mode 100644
index 08eeee149e9..00000000000
--- a/contrib/jcr-server/server/src/java/org/apache/jackrabbit/webdav/spi/version/report/LocateByUuidReport.java
+++ /dev/null
@@ -1,122 +0,0 @@
-/*
- * 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.spi.version.report;
-
-import org.apache.log4j.Logger;
-import org.apache.jackrabbit.webdav.version.report.*;
-import org.apache.jackrabbit.webdav.version.DeltaVResource;
-import org.apache.jackrabbit.webdav.spi.ItemResourceConstants;
-import org.apache.jackrabbit.webdav.spi.JcrDavException;
-import org.apache.jackrabbit.webdav.*;
-import org.apache.jackrabbit.webdav.property.DavPropertyNameSet;
-import org.jdom.Document;
-
-import javax.jcr.Node;
-import javax.jcr.RepositoryException;
-
-/**
- * LocateByUuidReport
handles REPORT requests for the 'locate-by-uuid'
- * report.
- *
- * The request body must be a 'jcr:locate-by-uuid' XML element:
- * - * <!ELEMENT locate-by-uuid ( href , prop? ) > - *- * The response to a successful report request will be a Multi-Status response. - */ -public class LocateByUuidReport implements Report { - - private static Logger log = Logger.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); - - private DeltaVResource resource; - private ReportInfo info; - - /** - * Returns {@link #LOCATE_BY_UUID_REPORT} report type. - * - * @return {@link #LOCATE_BY_UUID_REPORT} - * @see org.apache.jackrabbit.webdav.version.report.Report#getType() - */ - public ReportType getType() { - return LOCATE_BY_UUID_REPORT; - } - - /** - * @param resource - * @throws IllegalArgumentException if the resource is
null
or
- * if the session object provided with the resource is null
.
- * @see Report#setResource(org.apache.jackrabbit.webdav.version.DeltaVResource)
- */
- public void setResource(DeltaVResource resource) {
- if (resource == null) {
- throw new IllegalArgumentException("Resource must not be null.");
- }
- DavSession davSession = resource.getSession();
- if (davSession == null || davSession.getRepositorySession() == null) {
- throw new IllegalArgumentException("The resource must provide a non-null session object in order to create the jcr:nodetypes report.");
- }
- this.resource = resource;
- }
-
- /**
- * @param info
- * @throws IllegalArgumentException if the specified {@link ReportInfo info}
- * object does not contain a jcr:exportview element.
- * @see Report#setInfo(org.apache.jackrabbit.webdav.version.report.ReportInfo)
- */
- public void setInfo(ReportInfo info) {
- if (info == null || !REPORT_NAME.equals(info.getReportElement().getName())) {
- throw new IllegalArgumentException("jcr:locate-by-uuid element expected.");
- }
- this.info = info;
- }
-
- /**
- * Creates a Xml document from the generated view.
- *
- * @return Xml document representing the output of the specified view.
- * @throws DavException if the report document could not be created.
- * @see org.apache.jackrabbit.webdav.version.report.Report#toXml()
- */
- public Document toXml() throws DavException {
- String uuid = info.getReportElement().getChildText(DavConstants.XML_HREF, DavConstants.NAMESPACE);
- DavPropertyNameSet propNameSet = info.getPropertyNameSet();
-
- try {
- DavSession session = resource.getSession();
- DavResourceLocator resourceLoc = resource.getLocator();
-
- Node n = session.getRepositorySession().getNodeByUUID(uuid);
-
- DavResourceLocator loc = resourceLoc.getFactory().createResourceLocator(resourceLoc.getPrefix(), resourceLoc.getWorkspacePath(), n.getPath());
- DavResource res = resource.getFactory().createResource(loc, session);
-
- MultiStatus ms = new MultiStatus();
- ms.addResourceProperties(res, propNameSet, 0);
- return ms.toXml();
-
- } catch (RepositoryException e) {
- throw new JcrDavException(e);
- }
- }
-}
\ No newline at end of file
diff --git a/contrib/jcr-server/server/src/java/org/apache/jackrabbit/webdav/spi/version/report/NodeTypesReport.java b/contrib/jcr-server/server/src/java/org/apache/jackrabbit/webdav/spi/version/report/NodeTypesReport.java
deleted file mode 100644
index 1258a128aa0..00000000000
--- a/contrib/jcr-server/server/src/java/org/apache/jackrabbit/webdav/spi/version/report/NodeTypesReport.java
+++ /dev/null
@@ -1,215 +0,0 @@
-/*
- * 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.spi.version.report;
-
-import org.apache.log4j.Logger;
-import org.apache.jackrabbit.webdav.version.report.*;
-import org.apache.jackrabbit.webdav.version.DeltaVResource;
-import org.apache.jackrabbit.webdav.DavException;
-import org.apache.jackrabbit.webdav.DavServletResponse;
-import org.apache.jackrabbit.webdav.DavSession;
-import org.apache.jackrabbit.webdav.spi.nodetype.NodeTypeConstants;
-import org.apache.jackrabbit.webdav.spi.nodetype.PropertyDefImpl;
-import org.apache.jackrabbit.webdav.spi.nodetype.NodeDefImpl;
-import org.apache.jackrabbit.webdav.spi.JcrDavException;
-import org.apache.jackrabbit.core.util.IteratorHelper;
-import org.jdom.Document;
-import org.jdom.Element;
-
-import javax.jcr.nodetype.*;
-import javax.jcr.*;
-import java.util.*;
-
-/**
- * NodeTypesReport
allows to retrieve the definition of a single
- * or multiple node types. The request body must be a 'jcr:nodetypes' element:
- * - * <!ELEMENT nodetypes ( nodetype+ | all-nodetypes | mixin-nodetypes | primary-nodetypes ) > - * - * <!ELEMENT nodetype ( nodetype-name ) > - * <!ELEMENT nodetype-name (#PCDATA) > - * - * <!ELEMENT all-nodetypes EMPTY > - * <!ELEMENT mixin-nodetypes EMPTY > - * <!ELEMENT primary-nodetypes EMPTY > - *- * - * @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. - * @todo no namespace definition with response (> jackrabbit)... and nodetype element has same name as the one used with dav-properties - */ -public class NodeTypesReport implements Report, NodeTypeConstants { - - private static Logger log = Logger.getLogger(NodeTypesReport.class); - - /** - * The registered type of this report. - */ - public static final ReportType NODETYPES_REPORT = ReportType.register("nodetypes", NodeTypeConstants.NAMESPACE, NodeTypesReport.class); - - private NodeTypeManager ntMgr; - private ReportInfo info; - - /** - * Returns {@link #NODETYPES_REPORT} type. - * @return {@link #NODETYPES_REPORT} - * @see org.apache.jackrabbit.webdav.version.report.Report#getType() - */ - public ReportType getType() { - return NODETYPES_REPORT; - } - - /** - * @param resource - * @throws IllegalArgumentException if the resource or the session retrieved - * from the specified resource is
null
- * @see Report#setResource(org.apache.jackrabbit.webdav.version.DeltaVResource)
- */
- public void setResource(DeltaVResource resource) {
- if (resource == null) {
- throw new IllegalArgumentException("Resource must not be null.");
- }
- try {
- DavSession session = resource.getSession();
- if (session == null || session.getRepositorySession() == null) {
- throw new IllegalArgumentException("The resource must provide a non-null session object in order to create the jcr:nodetypes report.");
- }
- ntMgr = session.getRepositorySession().getWorkspace().getNodeTypeManager();
- } catch (RepositoryException e) {
- log.error(e.getMessage());
- }
- }
-
- /**
- * @param info
- * @throws IllegalArgumentException if the specified info does not contain
- * a jcr:nodetypes element.
- * @see Report#setInfo(org.apache.jackrabbit.webdav.version.report.ReportInfo)
- */
- public void setInfo(ReportInfo info) {
- if (info == null || !"nodetypes".equals(info.getReportElement().getName())) {
- throw new IllegalArgumentException("jcr:nodetypes element expected.");
- }
- this.info = info;
- }
-
- /**
- * Returns a Xml representation of the node type definition(s) according
- * to the info object.
- *
- * @return Xml representation of the node type definition(s)
- * @throws DavException if the specified nodetypes are not known or if another
- * error occurs while retrieving the nodetype definitions.
- * @see org.apache.jackrabbit.webdav.version.report.Report#toXml()
- */
- public Document toXml() throws DavException {
- if (info == null || ntMgr == null) {
- throw new DavException(DavServletResponse.SC_INTERNAL_SERVER_ERROR, "Error while running jcr:nodetypes report");
- }
- try {
- Element report = new Element(XML_NODETYPES);
- NodeTypeIterator ntIter = getNodeTypes();
- while (ntIter.hasNext()) {
- NodeType nt = ntIter.nextNodeType();
- Element ntDef = new Element(XML_NODETYPE);
- ntDef.setAttribute(ATTR_NAME, nt.getName());
- ntDef.setAttribute(ATTR_ISMIXIN, Boolean.toString(nt.isMixin()));
- ntDef.setAttribute(ATTR_HASORDERABLECHILDNODES, Boolean.toString(nt.hasOrderableChildNodes()));
-
- // declared supertypes
- NodeType[] snts = nt.getDeclaredSupertypes();
- Element supertypes = new Element(XML_SUPERTYPES);
- for (int i = 0; i < snts.length; i++) {
- supertypes.addContent(new Element(XML_SUPERTYPE).setText(snts[i].getName()));
- }
- ntDef.addContent(supertypes);
-
- // declared childnode defs
- NodeDef[] cnd = nt.getChildNodeDefs();
- for (int i = 0; i < cnd.length; i++) {
- if (cnd[i].getDeclaringNodeType().getName().equals(nt.getName())) {
- ntDef.addContent(NodeDefImpl.create(cnd[i]).toXml());
- }
- }
-
- // declared propertyDefs
- PropertyDef[] pd = nt.getPropertyDefs();
- for (int i = 0; i < pd.length; i++) {
- if (pd[i].getDeclaringNodeType().getName().equals(nt.getName())) {
- ntDef.addContent(PropertyDefImpl.create(pd[i]).toXml());
- }
- }
-
- String primaryItemName = nt.getPrimaryItemName();
- if (primaryItemName != null) {
- ntDef.setAttribute(ATTR_PRIMARYITEMNAME, primaryItemName);
- }
- report.addContent(ntDef);
- }
-
- Document reportDoc = new Document(report);
- return reportDoc;
- } catch (RepositoryException e) {
- throw new JcrDavException(e);
- }
- }
-
- /**
- * Parse the Xml element in the info object an return an interator over
- * the specified node types.
- *
- * @return
- * @throws RepositoryException
- * @throws DavException
- */
- private NodeTypeIterator getNodeTypes() throws RepositoryException, DavException {
- NodeTypeIterator ntIter = null;
- Iterator it = info.getReportElement().getChildren().iterator();
- while (it.hasNext() && ntIter == null) {
- Element elem = (Element) it.next();
- if (elem.getNamespace().equals(NAMESPACE)) {
- String name = elem.getName();
- if (XML_REPORT_ALLNODETYPES.equals(name)) {
- ntIter = ntMgr.getAllNodeTypes();
- } else if (XML_REPORT_MIXINNODETYPES.equals(name)) {
- ntIter = ntMgr.getMixinNodeTypes();
- } else if (XML_REPORT_PRIMARYNODETYPES.equals(name)) {
- ntIter = ntMgr.getPrimaryNodeTypes();
- }
- }
- }
- // None of the simple types. test if a report for individual nodetypes
- // was request. If not, the request body is not valid.
- if (ntIter == null) {
- List ntList = new ArrayList();
- List elemList = info.getReportElement().getChildren(XML_NODETYPE, NAMESPACE);
- if (elemList.isEmpty()) {
- // throw exception if the request body does not contain a single jcr:nodetype element
- throw new DavException(DavServletResponse.SC_BAD_REQUEST, "NodeTypes report: request body has invalid format.");
- }
- Iterator elemIter = elemList.iterator();
- while (elemIter.hasNext()) {
- String nodetypeName = ((Element)elemIter.next()).getChildText(XML_NODETYPENAME, NAMESPACE);
- if (nodetypeName != null) {
- ntList.add(ntMgr.getNodeType(nodetypeName));
- }
- }
- ntIter = new IteratorHelper(Collections.unmodifiableCollection(ntList));
- }
-
- return ntIter;
- }
-}
\ No newline at end of file
diff --git a/contrib/jcr-server/server/src/java/org/apache/jackrabbit/webdav/spi/version/report/RegisteredNamespacesReport.java b/contrib/jcr-server/server/src/java/org/apache/jackrabbit/webdav/spi/version/report/RegisteredNamespacesReport.java
deleted file mode 100644
index 0ed8fee63f4..00000000000
--- a/contrib/jcr-server/server/src/java/org/apache/jackrabbit/webdav/spi/version/report/RegisteredNamespacesReport.java
+++ /dev/null
@@ -1,131 +0,0 @@
-/*
- * 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.spi.version.report;
-
-import org.apache.log4j.Logger;
-import org.apache.jackrabbit.webdav.version.report.*;
-import org.apache.jackrabbit.webdav.version.DeltaVResource;
-import org.apache.jackrabbit.webdav.DavException;
-import org.apache.jackrabbit.webdav.DavServletResponse;
-import org.apache.jackrabbit.webdav.DavSession;
-import org.apache.jackrabbit.webdav.spi.JcrDavException;
-import org.apache.jackrabbit.webdav.spi.ItemResourceConstants;
-import org.jdom.Document;
-import org.jdom.Element;
-
-import javax.jcr.*;
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * NodeTypesReport
allows to retrieve the definition of a single
- * or multiple node types. The request body must be a 'jcr:nodetypes' element:
- * - * <!ELEMENT nodetypes ( nodetype+ | all-nodetypes | mixin-nodetypes | primary-nodetypes ) > - * - * <!ELEMENT nodetype ( nodetype-name ) > - * <!ELEMENT nodetype-name (#PCDATA) > - * - * <!ELEMENT all-nodetypes EMPTY > - * <!ELEMENT mixin-nodetypes EMPTY > - * <!ELEMENT primary-nodetypes EMPTY > - *- */ -public class RegisteredNamespacesReport implements Report, ItemResourceConstants { - - private static Logger log = Logger.getLogger(RegisteredNamespacesReport.class); - - /** - * The registered type of this report. - */ - public static final ReportType REGISTERED_NAMESPACES_REPORT = ReportType.register("registerednamespaces", ItemResourceConstants.NAMESPACE, RegisteredNamespacesReport.class); - - private NamespaceRegistry nsReg; - private ReportInfo info; - - /** - * Returns {@link #REGISTERED_NAMESPACES_REPORT} type. - * @return {@link #REGISTERED_NAMESPACES_REPORT} - * @see org.apache.jackrabbit.webdav.version.report.Report#getType() - */ - public ReportType getType() { - return REGISTERED_NAMESPACES_REPORT; - } - - /** - * @param resource - * @throws IllegalArgumentException if the resource or the session retrieved - * from the specified resource is
null
- * @see org.apache.jackrabbit.webdav.version.report.Report#setResource(org.apache.jackrabbit.webdav.version.DeltaVResource)
- */
- public void setResource(DeltaVResource resource) {
- if (resource == null) {
- throw new IllegalArgumentException("Resource must not be null.");
- }
- try {
- DavSession session = resource.getSession();
- if (session == null || session.getRepositorySession() == null) {
- throw new IllegalArgumentException("The resource must provide a non-null session object in order to create the jcr:nodetypes report.");
- }
- nsReg = session.getRepositorySession().getWorkspace().getNamespaceRegistry();
- } catch (RepositoryException e) {
- log.error(e.getMessage());
- }
- }
-
- /**
- * @param info
- * @throws IllegalArgumentException if the specified info does not contain
- * a jcr:nodetypes element.
- * @see org.apache.jackrabbit.webdav.version.report.Report#setInfo(org.apache.jackrabbit.webdav.version.report.ReportInfo)
- */
- public void setInfo(ReportInfo info) {
- if (info == null || !"registerednamespaces".equals(info.getReportElement().getName())) {
- throw new IllegalArgumentException("jcr:registerednamespaces element expected.");
- }
- this.info = info;
- }
-
- /**
- * Returns a Xml representation of the node type definition(s) according
- * to the info object.
- *
- * @return Xml representation of the node type definition(s)
- * @throws org.apache.jackrabbit.webdav.DavException if the specified nodetypes are not known or if another
- * error occurs while retrieving the nodetype definitions.
- * @see org.apache.jackrabbit.webdav.version.report.Report#toXml()
- */
- public Document toXml() throws DavException {
- if (info == null || nsReg == null) {
- throw new DavException(DavServletResponse.SC_INTERNAL_SERVER_ERROR, "Error while running jcr:registerednamespaces report");
- }
- try {
- String[] prefixes = nsReg.getPrefixes();
- List namespaceList = new ArrayList();
- for (int i = 0; i < prefixes.length; i++) {
- Element elem = new Element(XML_NAMESPACE, NAMESPACE);
- elem.addContent(new Element(XML_NSPREFIX, NAMESPACE).setText(prefixes[i]));
- elem.addContent(new Element(XML_NSURI, NAMESPACE).setText(nsReg.getURI(prefixes[i])));
- namespaceList.add(elem);
- }
- Element report = new Element("registerednamespaces-report", NAMESPACE).addContent(namespaceList);
- Document reportDoc = new Document(report);
- return reportDoc;
- } catch (RepositoryException e) {
- throw new JcrDavException(e);
- }
- }
-}
\ No newline at end of file
diff --git a/contrib/jcr-server/server/src/java/org/apache/jackrabbit/webdav/spi/version/report/package.html b/contrib/jcr-server/server/src/java/org/apache/jackrabbit/webdav/spi/version/report/package.html
deleted file mode 100644
index 92f14280488..00000000000
--- a/contrib/jcr-server/server/src/java/org/apache/jackrabbit/webdav/spi/version/report/package.html
+++ /dev/null
@@ -1,3 +0,0 @@
-
-Contains JCR specific reports.
-
\ No newline at end of file
diff --git a/contrib/jcr-server/todo.txt b/contrib/jcr-server/todo.txt
deleted file mode 100644
index 46114e6ddf5..00000000000
--- a/contrib/jcr-server/todo.txt
+++ /dev/null
@@ -1,90 +0,0 @@
--------------------------------------------------------------------
-todo webdav package
--------------------------------------------------------------------
-
-- usage of jdom....
-
--------------------------------------------------------------------
-todo webdav/version package
--------------------------------------------------------------------
-
-- review: compliance to deltaV
-- reflecting feature-sets
-- baseline/activity not respected yet.
-
--------------------------------------------------------------------
-todo webdav/transaction package
--------------------------------------------------------------------
-
-- review naming of the lock scopes. 'global','local' are not correct in
- this context.
-- repository transactions ('global') are only possible with jackrabbit, where
- the session represents the XAResource itself.
- since j2ee explicitely requires any usertransaction to be completed
- upon the end of the servletes service method.
- general review necessary....
-
--------------------------------------------------------------------
-todo webdav/search package
--------------------------------------------------------------------
-
-- SearchResource should extend DavResource
-- basicquery as defined by the internet draft not respected
- currently.
-
--------------------------------------------------------------------
-todo spi / servlets
--------------------------------------------------------------------
-
-general
-
-- undo incomplete changes in case of exception
-- review GET/PUT for JCR properties
-- etag property on resources
-- use strong etag for comparison in ifHeader!
-- multistatus fuer lock, copy, move, delete, proppatch wherever required.
-- DAV:supported-live-property-set
-- timeout: remove expired locks/subscriptions
-- improve definition methods/compliance-class
-- methods/compliance-class auf der root resoure vs *
-- OPTIONS to *-request-uri (according to RFC 2616)
-
-ordering
-
-- respect Position header with creation of new collection members by
- PUT, COPY, MKCOL requests
-
-lock
-
-- implement session-scoped locks. this includes:
- > uncommenting supported-locks entry
- > build caching mechanism for session in case of session-scoped locks.
- > retrieval of cached sessions (currently not possible from IfHeader).
- > open issue in JCR: scope of lock cannot be retrieved.
-
-- JCR lock-token currently not checked for compliance with RFC2518. If the
- token is modified accordingly, setting the lock-token to the subsequent
- session (currently in the WebdavRequestImpl) must be aware of that change....
-
-- transaction locks
- - lock returned upon lock-discovery
- - remove after timeout (>> releasing cached sessions)
- - define reasonable timeout or make timeout configurable
- - createLock must respect existing locks in the subtree, for lock is always deep.
-
-observation
-
-- make sure all expired subscriptions are removed.
-- subscription: reasonable default/max timeout make it configurable...
-
-versioning
-
-- VersionItemResource. review regarding definition of a version resource
- rfc3253: 'A "version resource", or simply "version", is a resource
- that contains a copy of a particular state (content and dead properties) of a
- version-controlled resource. A version is created by "checking in" a checked-out
- resource. The server allocates a distinct new URL for each new version, and
- this URL will never be used to identify any resource other than that version.
- The content and dead properties of a version never change.'
-
-- Additional VERSION-CONTROL Semantics with workspace not implemented.
diff --git a/contrib/jcr-server/webapp/maven.xml b/contrib/jcr-server/webapp/maven.xml
deleted file mode 100644
index 85eef13d69c..00000000000
--- a/contrib/jcr-server/webapp/maven.xml
+++ /dev/null
@@ -1,27 +0,0 @@
-
-
-DavConstants
provide constants for request and response
- * headers, Xml elements and property names defined by
- * RFC 2518. In addition
- * common date formats (creation date and modification time) are included.
- */
-public interface DavConstants {
-
- /**
- * Request and response headers and some value constants
- */
- //-------------------------------------------------------------- Headers ---
- public static final String HEADER_DAV = "DAV";
- public static final String HEADER_DESTINATION = "Destination";
- public static final String HEADER_IF = "If";
- public static final String HEADER_AUTHORIZATION = "Authorization";
-
- //---------------------------------------------------- Lock-Token header ---
- public static final String HEADER_LOCK_TOKEN = "Lock-Token";
- public static final String OPAQUE_LOCK_TOKEN_PREFIX = "opaquelocktoken:";
-
- //------------------------------------------------------- Timeout header ---
- public static final String HEADER_TIMEOUT = "Timeout";
- public static final String TIMEOUT_INFINITE = "Infinite";
- public static final long INFINITE_TIMEOUT = Long.MAX_VALUE;
- public static final long UNDEFINED_TIMEOUT = Long.MIN_VALUE;
-
- //----------------------------------------------------- Overwrite header ---
- public static final String HEADER_OVERWRITE = "Overwrite";
- public static final String NO_OVERWRITE = "T";
-
- //--------------------------------------------------------- Depth header ---
- public static final String HEADER_DEPTH = "Depth";
- public static final String DEPTH_INFINITY_S = "infinity";
- public static final int DEPTH_INFINITY = Integer.MAX_VALUE;
- public static final int DEPTH_0 = 0;
- public static final int DEPTH_1 = 1;
-
- /**
- * Default Namespace constant
- */
- public static final Namespace NAMESPACE = Namespace.getNamespace("D", "DAV:");
-
- /**
- * Xml element names used for response and request body
- */
- public static final String XML_ALLPROP = "allprop";
- public static final String XML_COLLECTION = "collection";
- public static final String XML_DST = "dst";
- public static final String XML_HREF = "href";
- public static final String XML_KEEPALIVE = "keepalive";
- public static final String XML_LINK = "link";
- public static final String XML_MULTISTATUS = "multistatus";
- public static final String XML_OMIT = "omit";
- public static final String XML_PROP = "prop";
- public static final String XML_PROPERTYBEHAVIOR = "propertybehavior";
- public static final String XML_PROPERTYUPDATE = "propertyupdate";
- public static final String XML_PROPFIND = "propfind";
- public static final String XML_PROPNAME = "propname";
- public static final String XML_PROPSTAT = "propstat";
- public static final String XML_REMOVE = "remove";
- public static final String XML_RESPONSE = "response";
- public static final String XML_RESPONSEDESCRIPTION = "responsedescription";
- public static final String XML_SET = "set";
- public static final String XML_SOURCE = "source";
- public static final String XML_STATUS = "status";
-
- /**
- * XML element names related to locking
- */
- public static final String XML_ACTIVELOCK = "activelock";
- public static final String XML_DEPTH = "depth";
- public static final String XML_LOCKTOKEN = "locktoken";
- public static final String XML_TIMEOUT = "timeout";
- public static final String XML_LOCKSCOPE = "lockscope";
- public static final String XML_EXCLUSIVE = "exclusive";
- public static final String XML_SHARED = "shared";
- public static final String XML_LOCKENTRY = "lockentry";
- public static final String XML_LOCKINFO = "lockinfo";
- public static final String XML_LOCKTYPE = "locktype";
- public static final String XML_WRITE = "write";
- public static final String XML_OWNER = "owner";
-
- /**
- * Webdav property names as defined by RFC 2518DavException
extends the {@link Exception} class in order
- * to simplify handling of exceptional situations occuring during processing
- * of WebDAV requests and provides possibility to retrieve an Xml representation
- * of the error.
- */
-public class DavException extends Exception {
-
- private static Logger log = Logger.getLogger(DavException.class);
- private static Properties statusPhrases = new Properties();
- static {
- try {
- statusPhrases.load(DavException.class.getResourceAsStream("statuscode.properties"));
- } catch (IOException e) {
- log.error("Failed to load status properties: "+ e.getMessage());
- }
- }
-
- private static final String XML_ERROR = "error";
-
- private int errorCode = DavServletResponse.SC_INTERNAL_SERVER_ERROR;
- private Element conditionElement;
-
- /**
- * Create a new DavException
.
- *
- * @param errorCode integer specifying any of the status codes defined by
- * {@link DavServletResponse}.
- * @param message Human readable error message.
- */
- public DavException(int errorCode, String message) {
- super(message);
- this.errorCode = errorCode;
- log.debug("DavException: (" + errorCode + ") " + message);
- }
-
- /**
- * Create a new DavException
.
- *
- * @param errorCode integer specifying any of the status codes defined by
- * {@link DavServletResponse}.
- */
- public DavException(int errorCode) {
- this(errorCode, statusPhrases.getProperty(String.valueOf(errorCode)));
- }
-
- /**
- * Create a new DavException
.
- *
- * @param errorCode integer specifying any of the status codes defined by
- * {@link DavServletResponse}.
- * @param message
- * @param conditionElement
- */
- public DavException(int errorCode, String message, Element conditionElement) {
- this(errorCode, message);
- this.conditionElement = conditionElement;
- log.debug("DavException: (" + errorCode + ") " + conditionElement.toString());
- }
-
- /**
- * Return the error code attached to this DavException
.
- *
- * @return errorCode
- */
- public int getErrorCode() {
- return errorCode;
- }
-
- /**
- * Returns the Xml representation of this DavException
. In case
- * no {@link Element} has been passed to the constructor, an empty DAV:error
- * element is returned.
- *
- * @return Xml representation of this exception.
- */
- public Element getError() {
- Element error = new Element(XML_ERROR, DavConstants.NAMESPACE);
- if (conditionElement != null) {
- error.addContent(conditionElement);
- }
- return error;
- }
-
- /**
- * Return the status phrase corresponding to the error code attached to
- * this DavException
.
- *
- * @return status phrase corresponding to the error code.
- * @see #getErrorCode()
- */
- public String getStatusPhrase() {
- return getStatusPhrase(errorCode);
- }
-
- /**
- * Returns the status phrase for the given error code.
- *
- * @param errorCode
- * @return status phrase corresponding to the given error code.
- */
- public static String getStatusPhrase(int errorCode) {
- return statusPhrases.getProperty(errorCode+"");
- }
-}
\ No newline at end of file
diff --git a/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/DavLocatorFactory.java b/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/DavLocatorFactory.java
deleted file mode 100644
index fd1217045fa..00000000000
--- a/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/DavLocatorFactory.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * 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;
-
-/**
- * DavLocatorFactory
...
- */
-public interface DavLocatorFactory {
-
- /**
- * Create a new DavResourceLocator
.
- *
- * @param prefix
- * @param requestHandle
- * @return
- */
- public DavResourceLocator createResourceLocator(String prefix, String requestHandle);
-
- /**
- * Create a new DavResourceLocator
.
- *
- * @param prefix
- * @param workspacePath
- * @param resourcePath
- * @return
- */
- public DavResourceLocator createResourceLocator(String prefix, String workspacePath, String resourcePath);
-}
\ No newline at end of file
diff --git a/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/DavMethods.java b/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/DavMethods.java
deleted file mode 100644
index 2cc0e4ca831..00000000000
--- a/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/DavMethods.java
+++ /dev/null
@@ -1,300 +0,0 @@
-/*
- * 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;
-
-import org.apache.log4j.Logger;
-
-import java.util.HashMap;
-
-/**
- * DavMethods
defines constants for the WebDAV METHODS.
- */
-public class DavMethods {
-
- private static Logger log = Logger.getLogger(DavMethods.class);
-
- /**
- * A hashmap of webdav METHODS
- */
- private static HashMap methodMap = new HashMap();
-
- /**
- * An array of method codes that are affected by a Label header
- * @see org.apache.jackrabbit.webdav.version.DeltaVConstants#HEADER_LABEL
- */
- private static int[] labelMethods;
-
- /**
- * The webdav OPTIONS method and public constant
- */
- public static final int DAV_OPTIONS = 1;
- public static final String METHOD_OPTIONS = "OPTIONS";
-
- /**
- * The webdav GET method and public constant
- */
- public static final int DAV_GET = DAV_OPTIONS + 1;
- public static final String METHOD_GET = "GET";
-
- /**
- * The webdav HEAD method and public constant
- */
- public static final int DAV_HEAD = DAV_GET + 1;
- public static final String METHOD_HEAD = "HEAD";
-
-
- /**
- * The webdav POST method and public constant
- */
- public static final int DAV_POST = DAV_HEAD + 1;
- private static final String METHOD_POST = "POST";
-
-
- /** The webdav DELETE method and public constant */
- public static final int DAV_DELETE = DAV_POST + 1;
- public static final String METHOD_DELETE = "DELETE";
-
-
- /** The webdav PUT method and public constant */
- public static final int DAV_PUT = DAV_DELETE + 1;
- public static final String METHOD_PUT = "PUT";
-
-
- /**
- * The webdav PROPFIND method and public constant as defined by
- * RFC 2518.
- */
- public static final int DAV_PROPFIND = DAV_PUT + 1;
- public static final String METHOD_PROPFIND = "PROPFIND";
-
-
- /**
- * The webdav PROPPATCH method and public constant as defined by
- * RFC 2518
- */
- public static final int DAV_PROPPATCH = DAV_PROPFIND + 1;
- public static final String METHOD_PROPPATCH = "PROPPATCH";
-
-
- /**
- * The webdav MKCOL (make collection) method and public constant as defined by
- * RFC 2518
- */
- public static final int DAV_MKCOL = DAV_PROPPATCH + 1;
- public static final String METHOD_MKCOL = "MKCOL";
-
-
- /**
- * The webdav COPY method and public constant as defined by
- * RFC 2518
- */
- public static final int DAV_COPY = DAV_MKCOL + 1;
- public static final String METHOD_COPY = "COPY";
-
-
- /**
- * The webdav MOVE method and public constant as defined by
- * RFC 2518
- */
- public static final int DAV_MOVE = DAV_COPY + 1;
- public static final String METHOD_MOVE = "MOVE";
-
-
- /**
- * The webdav LOCK method and public constant as defined by
- * RFC 2518
- */
- public static final int DAV_LOCK = DAV_MOVE + 1;
- public static final String METHOD_LOCK = "LOCK";
-
-
- /**
- * The webdav UNLOCK method and public constant as defined by
- * RFC 2518
- */
- public static final int DAV_UNLOCK = DAV_LOCK + 1;
- public static final String METHOD_UNLOCK = "UNLOCK";
-
-
- /**
- * The webdav ORDERPATCH method and public constant
- * defined by RFC 3648.
- */
- public static final int DAV_ORDERPATCH = DAV_UNLOCK + 1;
- public static final String METHOD_ORDERPATCH = "ORDERPATCH";
-
-
- /**
- * The webdav SUBSCRIBE method and public constant.DavResource
provides standard WebDAV functionality as specified
- * by RFC 2518.
- */
-public interface DavResource {
-
- /**
- * Constant for WebDAV 1 and 2 compliance class as is represented by this
- * resource.
- */
- public static final String COMPLIANCE_CLASS = "1, 2";
-
- /**
- * String constant representing the WebDAV 1 and 2 method set.
- */
- public static final String METHODS = "OPTIONS, GET, HEAD, POST, TRACE, PROPFIND, PROPPATCH, COPY, PUT, DELETE, MOVE, LOCK, UNLOCK";
-
- /**
- * Constant indicating the undefined modification time.
- */
- public static final long UNDEFINED_MODIFICATIONTIME = -1;
-
- /**
- * Returns a comma separted list of all compliance classes the given
- * resource is fulfilling.
- *
- * @return compliance classes
- */
- public String getComplianceClass();
-
- /**
- * Returns a comma separated list of all METHODS supported by the given
- * resource.
- *
- * @return METHODS supported by this resource.
- */
- public String getSupportedMethods();
-
- /**
- * Returns true if this webdav resource represents an existing repository item.
- *
- * @return true, if the resource represents an existing repository item.
- */
- public boolean exists();
-
- /**
- * Returns true if this webdav resource has the resourcetype 'collection'.
- *
- * @return true if the resource represents a collection resource.
- */
- public boolean isCollection();
-
- /**
- * Returns the display name of this resource.
- *
- * @return display name.
- */
- public String getDisplayName();
-
- /**
- * Returns the {@link DavResourceLocator locator} object for this webdav resource,
- * which encapsulates the information for building the complete 'href'.
- *
- * @return the locator for this resource.
- * @see #getResourcePath()
- * @see #getHref()
- */
- public DavResourceLocator getLocator();
-
- /**
- * Returns the path of the hierarchy element defined by this DavResource
.
- * This method is a shortcut for DavResource.getLocator().getResourcePath()
.
- *
- * @return path of the element defined by this DavResource
.
- */
- public String getResourcePath();
-
- /**
- * Returns the absolute href of this resource as returned in the
- * multistatus response body.
- *
- * @return href
- */
- public String getHref();
-
- /**
- * Return the time of the last modification or -1 if the modification time
- * could not be retrieved.
- *
- * @return time of last modification or -1.
- */
- public long getModificationTime();
-
- /**
- * Returns a stream to the resource content in order to respond to a 'GET'
- * request.
- *
- * @return stream to the resource content.
- */
- public InputStream getStream();
-
- /**
- * Returns an array of all {@link DavPropertyName property names} available
- * on this resource.
- *
- * @return an array of property names.
- */
- public DavPropertyName[] getPropertyNames();
-
- /**
- * Return the webdav property with the specified name.
- *
- * @param name name of the webdav property
- * @return the {@link DavProperty} with the given name or null
- * if the property does not exist.
- */
- public DavProperty getProperty(DavPropertyName name);
-
- /**
- * Returns all webdav properties present on this resource.
- *
- * @return a {@link DavPropertySet} containing all webdav property
- * of this resource.
- */
- public DavPropertySet getProperties();
-
- /**
- * Add/Set the specified property on this resource.
- *
- * @param property
- * @throws DavException if an error occurs
- */
- public void setProperty(DavProperty property) throws DavException;
-
- /**
- * Remove the specified property from this resource.
- *
- * @param propertyName
- * @throws DavException if an error occurs
- */
- public void removeProperty(DavPropertyName propertyName) throws DavException;
-
- /**
- * Retrieve the resource this resource is internal member of.
- *
- * @return resource this resource is an internal member of. In case this resource
- * is the root null
is returned.
- */
- public DavResource getCollection();
-
- /**
- * Add the given resource as an internal member to this resource.
- *
- * @param resource {@link DavResource} to be added as internal member.
- * @param in {@link java.io.InputStream} providing the content for the
- * internal member.
- * @throws DavException
- */
- public void addMember(DavResource resource, InputStream in)
- throws DavException;
-
- /**
- * Add the given resource as an internal member to this resource.
- *
- * @param resource webdav resource to be added as member.
- * @throws DavException
- */
- public void addMember(DavResource resource) throws DavException;
-
- /**
- * Returns an iterator over all internal members.
- *
- * @return a {@link DavResourceIterator) over all internal members.
- */
- public DavResourceIterator getMembers();
-
- /**
- * Removes the specified member from this resource.
- *
- * @throws DavException
- */
- public void removeMember(DavResource member) throws DavException;
-
- /**
- * Move this DavResource to the given destination resource
- *
- * @param destination
- * @throws DavException
- */
- public void move(DavResource destination) throws DavException;
-
- /**
- * Copy this DavResource to the given destination resource
- *
- * @param destination
- * @param shallow
- * @throws DavException
- */
- public void copy(DavResource destination, boolean shallow) throws DavException;
-
- /**
- * Returns true, if the this resource allows locking. NOTE, that this method
- * does not define, whether a lock/unlock can be successfully executed.
- *
- * @return true, if this resource supports any locking.
- * @param type
- * @param scope
- */
- public boolean isLockable(Type type, Scope scope);
-
- /**
- * Returns true if a lock applies to this resource. This may be either a
- * lock on this resource itself or a deep lock inherited from a collection
- * above this resource.null
- * if the resource is either not locked or not lockable at all. Note, that
- * a resource may have a lock that is inherited by a deep lock inforced on
- * one of its 'parent' resources.
- *
- * @return lock information of this resource or null
if this
- * resource has no lock applying it. If an error occurs while retrieving the
- * lock information null
is returned as well.
- * @param type
- */
- public ActiveLock getLock(Type type, Scope scope) ;
-
- /**
- * Returns an array of all locks applied to the given resource.
- *
- * @return array of locks. The array is empty if there are no locks applied
- * to this resource.
- */
- public ActiveLock[] getLocks();
-
- /**
- * Lock this webdav resource with the information retrieve from the request
- * and return the resulting lockdiscovery object.
- *
- * @param reqLockInfo lock info as retrieved from the request.
- * @return lockdiscovery object to be returned in the response. If the lock
- * could not be obtained a DavException
is thrown.
- * @throws DavException if the lock could not be obtained.
- */
- public ActiveLock lock(LockInfo reqLockInfo) throws DavException;
-
- /**
- * Refresh an existing lock by resetting the timeout.
- *
- * @param reqLockInfo lock info as retrieved from the request.
- * @param lockToken identifying the lock to be refreshed.
- * @return lockdiscovery object to be returned in the response body. If the lock
- * could not be refreshed a DavException
is thrown.
- * @throws DavException if the lock could not be refreshed.
- */
- public ActiveLock refreshLock(LockInfo reqLockInfo, String lockToken) throws DavException;
-
- /**
- * Remove the lock indentified by the included lock token from this resource.
- * This method will return false if the unlocking did not succeed.
- *
- * @param lockToken indentifying the lock to be removed.
- * @throws DavException if the lock could not be removed.
- */
- public void unlock(String lockToken) throws DavException;
-
- /**
- * Add an external {@link LockManager} to this resource. This method may
- * throw {@link UnsupportedOperationException} if the resource does handle
- * locking itself.
- *
- * @param lockmgr
- * @see LockManager
- */
- public void addLockManager(LockManager lockmgr);
-
- /**
- * Return the DavResourceFactory
that created this resource.
- *
- * @return the factory that created this resource.
- */
- public DavResourceFactory getFactory();
-}
-
diff --git a/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/DavResourceFactory.java b/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/DavResourceFactory.java
deleted file mode 100644
index 74f43b9bd16..00000000000
--- a/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/DavResourceFactory.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * 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;
-
-/**
- * DavResourceFactory
interface defines a single method for creating
- * {@link DavResource} objects.
- */
-public interface DavResourceFactory {
-
- /**
- * Create a {@link DavResource} object from the given locator, request and response
- * objects.
- *
- * @param locator locator of the resource
- * @param request
- * @param response
- * @return a new DavResource
object.
- * @throws DavException
- */
- public DavResource createResource(DavResourceLocator locator, DavServletRequest request, DavServletResponse response) throws DavException;
-
- /**
- * Create a new {@link DavResource} object from the given locator and session.
- *
- * @param locator
- * @param session
- * @return a new DavResource
object.
- * @throws DavException
- */
- public DavResource createResource(DavResourceLocator locator, DavSession session) throws DavException;
-}
\ No newline at end of file
diff --git a/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/DavResourceIterator.java b/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/DavResourceIterator.java
deleted file mode 100644
index 2d337b8816e..00000000000
--- a/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/DavResourceIterator.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * 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;
-
-import java.util.Iterator;
-
-/**
- * DavResourceIterator extends the Iterator
interface. Additional
- * METHODS allow to retrieve the next {@link DavResource} from the iterator
- * and the iterators size.
- */
-public interface DavResourceIterator extends Iterator {
-
- /**
- * Returns the next {@link DavResource} in the iterator
- * @return the next {@link DavResource}
- */
- public DavResource nextResource();
-
- /**
- * Return the number of {@link DavResource}s in the iterator.
- * @return number of elements in the iterator.
- */
- public int size();
-}
diff --git a/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/DavResourceIteratorImpl.java b/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/DavResourceIteratorImpl.java
deleted file mode 100644
index d99edb031fa..00000000000
--- a/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/DavResourceIteratorImpl.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- * 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;
-
-import org.apache.log4j.Logger;
-
-import java.util.Iterator;
-import java.util.List;
-
-/**
- * DavResourceIteratorImpl
implementation of the {@link DavResourceIterator}
- * interface.DavResourceLocator
...
- */
-public interface DavResourceLocator {
-
- /**
- * Return the prefix used to build the complete href of the resource as
- * required for the {@link DavConstants#XML_HREF href Xml} element.
- * This includes scheme and host information as well as constant prefixes.
- * However, this must not include workspace prefix.
- *
- * @return prefix needed in order to build the href from a resource path.
- * @see #getResourcePath()
- */
- public String getPrefix();
-
- /**
- * Return the resource path.
- *
- * @return resource path
- */
- public String getResourcePath();
-
- /**
- * Return the path of the workspace the resource identified by this
- * locator is member of.
- *
- * @return path of the workspace
- */
- public String getWorkspacePath();
-
- /**
- * Return the name of the workspace the resource identified by this
- * locator is member of.
- *
- * @return workspace name
- */
- public String getWorkspaceName();
-
- /**
- * Returns true if the specified locator refers to a resource within the
- * same workspace.
- *
- * @param locator
- * @return true if both paths are in the same workspace.
- */
- public boolean isSameWorkspace(DavResourceLocator locator);
-
- /**
- * Returns true if the specified workspace name equals to the workspace
- * name defined with this locator.
- *
- * @param workspaceName
- * @return true if workspace names are equal.
- */
- public boolean isSameWorkspace(String workspaceName);
-
- /**
- * Return the 'href' representation of this locator object.
- *
- * @param isCollection
- * @return 'href' representation of this path
- * @see DavConstants#XML_HREF
- * @see DavResource#getHref()
- */
- public String getHref(boolean isCollection);
-
- /**
- * Returns true if this DavResourceLocator
represents the root
- * locator that would be requested with 'hrefPrefix'+'pathPrefix' with or
- * without a trailing '/'.
- *
- * @return true if this locator object belongs to the root resource.
- */
- public boolean isRootLocation();
-
- /**
- * Return the locator factory that created this locator.
- *
- * @return the locator factory
- */
- public DavLocatorFactory getFactory();
-}
\ No newline at end of file
diff --git a/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/DavServletRequest.java b/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/DavServletRequest.java
deleted file mode 100644
index 5223d4e49f1..00000000000
--- a/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/DavServletRequest.java
+++ /dev/null
@@ -1,201 +0,0 @@
-/*
- * 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;
-
-import org.apache.jackrabbit.webdav.property.DavPropertySet;
-import org.apache.jackrabbit.webdav.property.DavPropertyNameSet;
-import org.apache.jackrabbit.webdav.lock.LockInfo;
-import org.jdom.Document;
-
-import javax.servlet.http.HttpServletRequest;
-
-/**
- * DavServletRequest
extends the HttpServletRequest by Webdav
- * specific METHODS.
- */
-public interface DavServletRequest extends HttpServletRequest {
-
- /**
- * Sets the DavSession
to this request.
- *
- * @param session
- */
- public void setDavSession(DavSession session);
-
- /**
- * Returns the {@link DavSession} created for this request.
- *
- * @return session for this resource
- */
- public DavSession getDavSession();
-
- /**
- * Return the locator of the requested {@link DavResource resource}.
- *
- * @return locator of the requested {@link DavResource resource}.
- */
- public DavResourceLocator getRequestLocator();
-
- /**
- * Parse the {@link DavConstants#HEADER_DESTINATION Destination header}
- * and return the locator of the corresponding {@link DavResource resource}.
- *
- * @return locator of the resource specified with the Destination header.
- * @see DavConstants#HEADER_DESTINATION
- */
- public DavResourceLocator getDestinationLocator();
-
- /**
- * Returns true if the {@link DavConstants#HEADER_OVERWRITE Overwrite header}
- * is set to 'T' thus instructing the server to overwrite the state of a
- * non-null destination resource during a COPY or MOVE. A Overwrite header
- * value of 'F' will return false.
- *
- * @return true if the Overwrite header is set to 'T', false if it is set
- * to 'F'.
- * @see DavConstants#HEADER_OVERWRITE
- */
- public boolean isOverwrite();
-
- /**
- * Return the integer representation of the given {@link DavConstants#HEADER_DEPTH
- * Depth header}. 'Infinity' is represented by {@link DavConstants#DEPTH_INFINITY}.
- *
- * @return integer representation of the {@link DavConstants#HEADER_DEPTH
- * Depth header}.
- * @see DavConstants#HEADER_DEPTH
- */
- public int getDepth();
-
- /**
- * Returns the integer representation of the {@link DavConstants#HEADER_DEPTH
- * Depth header} or the given defaultValue, if the Depth header is missing.
- *
- * @param defaultValue to be returned if no Depth header is present.
- * @return integer representation of the {@link DavConstants#HEADER_DEPTH
- * Depth header} or the given defaultValue.
- * @see DavConstants#HEADER_DEPTH
- */
- public int getDepth(int defaultValue);
-
- /**
- * Returns the token present in the {@link DavConstants#HEADER_LOCK_TOKEN
- * Lock-Token Header} or null
if no such header is available.long
. The representation of the
- * 'Infinite' timeout is left to the implementation.
- *
- * @return long value representation of the Timeout header.
- * @see DavConstants#HEADER_TIMEOUT
- * @see DavConstants#TIMEOUT_INFINITE
- */
- public long getTimeout();
-
- /**
- * Parse the Xml request body and return a {@link org.jdom.Document}.
- * If the request body can not be parsed null
is returned.
- *
- * @return Document representing the Xml request body or null
.
- */
- public Document getRequestDocument();
-
- /**
- * Return the type of PROPFIND request as indicated by the PROPFIND request
- * body.
- *
- * @return type of PROPFIND request
- * @see DavConstants#PROPFIND_ALL_PROP
- * @see DavConstants#PROPFIND_BY_PROPERTY
- * @see DavConstants#PROPFIND_PROPERTY_NAMES
- */
- public int getPropFindType();
-
- /**
- * Return the set of properties the client requested with a PROPFIND request
- * or an empty set if the type of PROPFIND request was {@link DavConstants#PROPFIND_ALL_PROP}
- * or {@link DavConstants#PROPFIND_PROPERTY_NAMES}.
- *
- * @return set of properties the client requested with a PROPFIND request
- */
- public DavPropertyNameSet getPropFindProperties();
-
- /**
- * Return the set of properties the client wanted to modify / create with a
- * PROPPATCH request, i.e. all entries in the <propertyupdate> element
- * of the request body with name <set>.
- *
- * @return set of properties the client wanted to modify / create with a
- * PROPPATCH request.
- */
- public DavPropertySet getPropPatchSetProperties();
-
- /**
- * Return the set of property names the client wanted to remove with a
- * PROPPATCH request, i.e. all entries in the <propertyupdate> element
- * of the request body with name <remove>.DavPropertyNameSet
is returned and not a DavPropertySet
- *
- * @return set of property names the client wanted to remove with a
- * PROPPATCH request.
- */
- public DavPropertyNameSet getPropPatchRemoveProperties();
-
- /**
- * Return the parsed 'lockinfo' request body, the {@link DavConstants#HEADER_TIMEOUT
- * Timeout header} and the {@link DavConstants#HEADER_DEPTH Depth header}
- * of a LOCK request as LockInfo
object.
- *
- * @return LockInfo
object encapsulating the information
- * present in the LOCK request.
- * @see DavConstants#HEADER_TIMEOUT
- * @see DavConstants#HEADER_DEPTH
- * @see DavConstants#XML_LOCKINFO
- */
- public LockInfo getLockInfo();
-
- /**
- * Returns true, if the {@link DavConstants#HEADER_IF If header} present
- * with the request matches the given resource.
- *
- * @param resource
- * @return true, if the test is successful, false otherwise.
- */
- public boolean matchesIfHeader(DavResource resource);
-
- /**
- * Returns true, if the {@link DavConstants#HEADER_IF If header} present
- * with the request matches to the given href, token and eTag.
- *
- * @param href
- * @param token
- * @param eTag
- * @return true, if the test is successful, false otherwise.
- */
- public boolean matchesIfHeader(String href, String token, String eTag);
-}
\ No newline at end of file
diff --git a/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/DavServletResponse.java b/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/DavServletResponse.java
deleted file mode 100644
index 5266e4dcd38..00000000000
--- a/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/DavServletResponse.java
+++ /dev/null
@@ -1,124 +0,0 @@
-/*
- * 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;
-
-import org.apache.jackrabbit.webdav.lock.ActiveLock;
-import org.jdom.Document;
-
-import javax.servlet.http.HttpServletResponse;
-import java.io.IOException;
-
-/**
- * WebdavResponse
extends the HttpServletResponse by
- * Webdav specific status codes and METHODS.
- */
-public interface DavServletResponse extends HttpServletResponse {
-
- /**
- * The 102 (Processing) status code is an interim response used to
- * inform the client that the server has accepted the complete request,
- * but has not yet completed it.
- */
- int SC_PROCESSING = 102;
-
- /**
- * Status code (207) indicating that the response requires
- * providing status for multiple independent operations.
- */
- int SC_MULTI_STATUS = 207;
-
- /**
- * Status code (422) indicating the entity body submitted with
- * the PATCH method was not understood by the resource.
- */
- int SC_UNPROCESSABLE_ENTITY = 422;
-
- /**
- * Status code (423) indicating the destination resource of a
- * method is locked, and either the request did not contain a
- * valid Lock-Info header, or the Lock-Info header identifies
- * a lock held by another principal.
- */
- int SC_LOCKED = 423;
-
- /**
- * Status code (424) incidating that the method could not be
- * performed on the resource, because the requested action depended
- * on another action which failed.
- */
- int SC_FAILED_DEPENDENCY = 424;
-
- /**
- * Status code (507) indicating that the resource does not have
- * sufficient space to record the state of the resource after the
- * execution of this method.
- */
- int SC_INSUFFICIENT_SPACE_ON_RESOURCE = 507;
-
- /**
- * Send a response body given more detailed information about the error
- * occured.
- *
- * @param error
- * @throws IOException
- */
- public void sendErrorResponse(DavException error) throws IOException;
-
- /**
- * Send the multistatus response to the client. A multistatus response
- * is returned in response to a successful PROPFIND and PROPPATCH request.
- * In addition multistatus response is required response in case a COPY,
- * MOVE, DELETE, LOCK or PROPPATCH request fails.
- *
- * @param multistatus
- * @throws IOException
- * @see #SC_MULTI_STATUS
- */
- public void sendMultiStatusResponse(MultiStatus multistatus) throws IOException;
-
- /**
- * Send the lock response for a successful LOCK request. The given ActiveLock
- * object is included in the lockdiscovery property of the response
- * body as required by RFC 2518.
- *
- * @param lock
- * @throws IOException
- * @see DavConstants#PROPERTY_LOCKDISCOVERY
- */
- public void sendLockResponse(ActiveLock lock) throws IOException;
-
- /**
- * Send the lock response for a successful LOCK request, that was intended
- * to refresh an existing lock. The locks array must contain at least
- * a single element; the ActiveLock
objects are then
- * included in the lockdiscovery property of the response body as required
- * by RFC 2518.
- *
- * @param locks
- * @throws IOException
- * @see DavConstants#PROPERTY_LOCKDISCOVERY
- */
- public void sendRefreshLockResponse(ActiveLock[] locks) throws IOException;
-
- /**
- * Generic method to return an Xml response body.
- *
- * @param xmlDoc Xml document representing the response body.
- * @param status Status code to be used with {@link #setStatus(int)}.
- * @throws IOException
- */
- public void sendXmlResponse(Document xmlDoc, int status) throws IOException;
-}
\ No newline at end of file
diff --git a/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/DavSession.java b/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/DavSession.java
deleted file mode 100644
index 78d8e672689..00000000000
--- a/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/DavSession.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * 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;
-
-import javax.jcr.Session;
-
-/**
- * DavSession
wraps a {@link Session repository session}
- * object, that is obtained on
- * {@link javax.jcr.Repository#login(javax.jcr.Credentials, String) login} to
- * the underlaying repository.
- */
-public interface DavSession {
-
- /**
- * Adds a reference to this DavSession
indicating that
- * the underlaying {@link Session} object is needed for actions spanning over
- * multiple requests.
- *
- * @param reference to be added.
- */
- public void addReference(Object reference);
-
- /**
- * Releasing a reference to this DavSession
. If no more
- * references are present, the underlaying {@link Session} may be discarded
- * (e.g by calling {@link Session#logout()}.
- *
- * @param reference to be removed.
- */
- public void removeReference(Object reference);
-
- /**
- * Unwrap the {@link Session repository session} object.
- *
- * @return the session object wrapped by this DavSession
- */
- public Session getRepositorySession();
-
- /**
- * Adds a lock token to this DavSession
.
- *
- * @param token
- */
- public void addLockToken(String token);
-
- /**
- * Returns the lock tokens of this DavSession
.
- *
- * @return
- */
- public String[] getLockTokens();
-
- /**
- * Removes a lock token from this DavSession
.
- *
- * @param token
- */
- public void removeLockToken(String token);
-
-}
\ No newline at end of file
diff --git a/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/DavSessionProvider.java b/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/DavSessionProvider.java
deleted file mode 100644
index 7d02360dcfe..00000000000
--- a/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/DavSessionProvider.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * 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;
-
-/**
- * DavSessionProvider
is an interface for components that
- * can initiate and complete {@link DavSession}s. A provider is
- * responsible for supplying references from a {@link WebdavRequest}
- * to a {@link DavSession} when acquired and removing the references
- * when released.
-
- */
-public interface DavSessionProvider {
-
- /**
- * Acquires a DavSession. Upon success, the WebdavRequest will
- * reference that session.
- *
- * A session will not be available if credentials can not be found
- * in the request (meaning that the request has not been
- * authenticated).
- *
- * @param request
- * @throws DavException if a problem occurred while obtaining the
- * session
- */
- public void acquireSession(WebdavRequest request) throws DavException;
-
- /**
- * Releases the reference from the request to the session.
- *
- * @param request
- */
- public void releaseSession(WebdavRequest request);
-}
diff --git a/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/MultiStatus.java b/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/MultiStatus.java
deleted file mode 100644
index 861b6a0e525..00000000000
--- a/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/MultiStatus.java
+++ /dev/null
@@ -1,110 +0,0 @@
-/*
- * 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;
-
-import org.jdom.Document;
-import org.jdom.Element;
-import org.apache.jackrabbit.webdav.property.DavPropertyNameSet;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-
-/**
- * MultiStatus representing the content of a multistatus response body and
- * allows to retrieve the Xml representation.
- */
-public class MultiStatus {
-
- private ArrayList responses = new ArrayList();
-
- /**
- * Add response(s) to this multistatus, in order to build a multistatus for
- * responding to a PROPFIND request.
- *
- * @param resource The resource to add property from
- * @param propNameSet The requested property names of the PROPFIND request
- * @param propFindType
- * @param depth
- */
- public void addResourceProperties(DavResource resource, DavPropertyNameSet propNameSet,
- int propFindType, int depth) {
- addResponse(new MultiStatusResponse(resource, propNameSet, propFindType));
- if (depth > 0) {
- DavResourceIterator iter = resource.getMembers();
- while (iter.hasNext()) {
- addResourceProperties(iter.nextResource(), propNameSet, propFindType, depth-1);
- }
- }
- }
-
- /**
- * Add response(s) to this multistatus, in order to build a multistatus e.g.
- * in order to respond to a PROPFIND request. Please note, that in terms
- * of PROPFIND, this method would correspond to a
- * {@link DavConstants#PROPFIND_BY_PROPERTY} propfind type.
- *
- * @param resource The resource to add property from
- * @param propNameSet The requested property names of the PROPFIND request
- * @param depth
- * @see #addResourceProperties(DavResource, DavPropertyNameSet, int, int) for
- * the corresponding method that allows to specify the type explicitely.
- */
- public void addResourceProperties(DavResource resource, DavPropertyNameSet propNameSet,
- int depth) {
- addResourceProperties(resource, propNameSet, DavConstants.PROPFIND_BY_PROPERTY, depth);
- }
-
- /**
- * Add response(s) to this multistatus, in order to build a multistatus
- * as returned for failed COPY, MOVE, LOCK or DELETE requests
- *
- * @param resource
- * @param status
- * @param depth
- */
- public void addResourceStatus(DavResource resource, int status, int depth) {
- addResponse(new MultiStatusResponse(resource.getHref(), status));
- if (depth > 0) {
- DavResourceIterator iter = resource.getMembers();
- while (iter.hasNext()) {
- addResourceStatus(iter.nextResource(), status, depth-1);
- }
- }
- }
-
- /**
- * Add a MultiStatusResponse
element to this MultiStatus
- *
- * @param response
- */
- public void addResponse(MultiStatusResponse response) {
- responses.add(response);
- }
-
- /**
- * Return the Xml representation of this MultiStatus
.
- *
- * @return Xml document
- */
- public Document toXml() {
- Element multistatus = new Element(DavConstants.XML_MULTISTATUS, DavConstants.NAMESPACE);
- Iterator it = responses.iterator();
- while(it.hasNext()) {
- multistatus.addContent(((MultiStatusResponse)it.next()).toXml());
- }
- return new Document(multistatus);
- }
-}
diff --git a/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/MultiStatusResponse.java b/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/MultiStatusResponse.java
deleted file mode 100644
index 601cb18cb68..00000000000
--- a/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/MultiStatusResponse.java
+++ /dev/null
@@ -1,246 +0,0 @@
-/*
- * 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;
-
-import org.jdom.Element;
-import org.apache.jackrabbit.webdav.property.*;
-import org.apache.jackrabbit.webdav.util.XmlUtil;
-
-import java.util.HashMap;
-import java.util.Iterator;
-
-/**
- * The WebdavMultistatusResponse
class implements a structure that
- * hold a WebDAV multistatus response. Properties can be added to this response
- * with the respective error/status code.
- */
-public class MultiStatusResponse implements DavConstants {
-
- /**
- * The content the 'href' element for this response
- */
- private final String href;
-
- /**
- * The '200' set (since this is used very often)
- */
- private final Element status200;
-
- /**
- * The '404' set (since this is used very often)
- */
- private final Element status404;
-
- /**
- * Hashmap containing all status
- */
- private final HashMap statusMap = new HashMap();
-
- /**
- * An optional response description.
- */
- private String responseDescription;
-
- /**
- * Constructs an empty WebDAV multistatus response
- */
- public MultiStatusResponse(String href) {
- this.href = href;
- status200 = new Element(XML_PROP, NAMESPACE);
- status404 = new Element(XML_PROP, NAMESPACE);
- statusMap.put(new Integer(DavServletResponse.SC_OK), status200);
- statusMap.put(new Integer(DavServletResponse.SC_NOT_FOUND), status404);
- }
-
- /**
- * Constucts a WebDAV multistatus response and retrieves the resource properties
- * according to the given DavPropertyNameSet
.
- *
- * @param resource
- * @param propNameSet
- */
- public MultiStatusResponse(DavResource resource, DavPropertyNameSet propNameSet) {
- this(resource, propNameSet, PROPFIND_BY_PROPERTY);
- }
-
- /**
- * Constucts a WebDAV multistatus response and retrieves the resource properties
- * according to the given DavPropertyNameSet
. It adds all known
- * property to the '200' set, while unknown properties are added to the '404' set.
- *
- * Note, that the set of property names is ignored in case of a {@link #PROPFIND_ALL_PROP}
- * and {@link #PROPFIND_PROPERTY_NAMES} propFindType.
- *
- * @param resource The resource to retrieve the property from
- * @param propNameSet The property name set as obtained from the request body.
- * @param propFindType any of the following values: {@link #PROPFIND_ALL_PROP},
- * {@link #PROPFIND_BY_PROPERTY}, {@link #PROPFIND_PROPERTY_NAMES}
- */
- public MultiStatusResponse(DavResource resource, DavPropertyNameSet propNameSet,
- int propFindType) {
- this(resource.getHref());
-
- // only property names requested
- if (propFindType == PROPFIND_PROPERTY_NAMES) {
- DavPropertyName[] propNames = resource.getPropertyNames();
- for (int i = 0; i < propNames.length; i++) {
- status200.addContent(propNames[i].toXml());
- }
- // all or a specified set of property and their values requested.
- } else {
- // clone set of property, since several resources could use this again
- propNameSet = new DavPropertyNameSet(propNameSet);
- // Add requested properties or all non-protected properties
- DavPropertyIterator iter = resource.getProperties().iterator();
- while (iter.hasNext()) {
- DavProperty wdp = iter.nextProperty();
- if ((propFindType == PROPFIND_ALL_PROP && !wdp.isProtected()) || propNameSet.remove(wdp.getName())) {
- status200.addContent(wdp.toXml());
- }
- }
-
- if (propFindType != PROPFIND_ALL_PROP) {
- Iterator iter1 = propNameSet.iterator();
- while (iter1.hasNext()) {
- DavPropertyName propName = (DavPropertyName) iter1.next();
- status404.addContent(propName.toXml());
- }
- }
- }
- }
-
- /**
- * Constructs an WebDAV multistatus response for a given resource. This
- * would be used by COPY, MOVE, DELETE, LOCK, UNLOCK that require a multistatus
- * in case of failure.
- */
- public MultiStatusResponse(String href, int status) {
- this(href);
- statusMap.put(new Integer(status), new Element(null));
- }
-
- /**
- * Adds a JDOM element to this response
- *
- * @param prop the property to add
- * @param status the status of the response set to select
- */
- private void add(Element prop, int status) {
- Integer statusKey = new Integer(status);
- Element propsContainer = (Element) statusMap.get(statusKey);
- if (propsContainer == null) {
- propsContainer = new Element(XML_PROP, NAMESPACE);
- statusMap.put(statusKey, propsContainer);
- }
- propsContainer.addContent(prop);
- }
-
- /**
- * Adds a property to this response '200' propstat set.
- *
- * @param prop the property to add
- */
- public void add(DavProperty prop) {
- status200.addContent(prop.toXml());
- }
-
- /**
- * Adds a property name to this response '200' propstat set.
- *
- * @param name the property name to add
- */
- public void add(DavPropertyName name) {
- status200.addContent(name.toXml());
- }
-
- /**
- * Adds a property to this response
- *
- * @param prop the property to add
- * @param status the status of the response set to select
- */
- public void add(DavProperty prop, int status) {
- add(prop.toXml(), status);
- }
-
- /**
- * Adds a property name to this response
- *
- * @param name the property name to add
- * @param status the status of the response set to select
- */
- public void add(DavPropertyName name, int status) {
- add(name.toXml(), status);
- }
-
- /**
- * Set the content of the optional response description element, which is
- * intended to contain a message that can be displayed to the user
- * explaining the nature of this response.
- *
- * @param responseDescription
- */
- public void setResponseDescription(String responseDescription) {
- this.responseDescription = responseDescription;
- }
-
- /**
- * Creates the JDOM element for this reponse.
- *
- * @return A JDOM element of this response
- */
- public Element toXml() {
- // don't create empty 'href' responses
- if ("".equals(href)) {
- return null;
- }
-
- Element response= new Element(XML_RESPONSE, NAMESPACE);
-
- // add 'WebdavRequest
interface collects the functionality
- * defined by {@link org.apache.jackrabbit.webdav.DavServletRequest} encapsulting
- * the core Webdav specification (RFC 2518) as well as the various extensions
- * used for observation and transaction support, ordering of collections, search
- * and versioning.
- */
-public interface WebdavRequest extends DavServletRequest,
- ObservationDavServletRequest, OrderingDavServletRequest,
- TransactionDavServletRequest, DeltaVServletRequest {
-}
\ No newline at end of file
diff --git a/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/WebdavRequestImpl.java b/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/WebdavRequestImpl.java
deleted file mode 100644
index 1f7ec9df5c1..00000000000
--- a/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/WebdavRequestImpl.java
+++ /dev/null
@@ -1,908 +0,0 @@
-/*
- * 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;
-
-import org.apache.log4j.Logger;
-import org.apache.jackrabbit.webdav.util.Text;
-import org.apache.jackrabbit.webdav.lock.LockInfo;
-import org.apache.jackrabbit.webdav.lock.Type;
-import org.apache.jackrabbit.webdav.lock.Scope;
-import org.apache.jackrabbit.webdav.property.*;
-import org.apache.jackrabbit.webdav.transaction.*;
-import org.apache.jackrabbit.webdav.observation.*;
-import org.apache.jackrabbit.webdav.version.*;
-import org.apache.jackrabbit.webdav.version.report.ReportInfo;
-import org.apache.jackrabbit.webdav.ordering.*;
-import org.apache.jackrabbit.webdav.header.DepthHeader;
-import org.jdom.input.SAXBuilder;
-import org.jdom.JDOMException;
-import org.jdom.Document;
-import org.jdom.Element;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.Cookie;
-import javax.servlet.http.HttpSession;
-import javax.servlet.ServletInputStream;
-import javax.servlet.RequestDispatcher;
-import java.io.InputStream;
-import java.io.IOException;
-import java.io.UnsupportedEncodingException;
-import java.io.BufferedReader;
-import java.util.*;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.security.Principal;
-
-/**
- * WebdavRequestImpl
...
- */
-public class WebdavRequestImpl implements WebdavRequest, DavConstants {
-
- private static Logger log = Logger.getLogger(WebdavRequestImpl.class);
-
- private final HttpServletRequest httpRequest;
- private final DavLocatorFactory factory;
- private final IfHeader ifHeader;
- private final String hrefPrefix;
-
- private DavSession session;
-
- private int propfindType = PROPFIND_ALL_PROP;
- private DavPropertyNameSet propfindProps;
- private DavPropertySet proppatchSet;
- private DavPropertyNameSet proppatchRemove;
-
- /**
- * Creates a new DavServletRequest
with the given parameters.
- *
- * @param httpRequest
- * @param factory
- */
- public WebdavRequestImpl(HttpServletRequest httpRequest, DavLocatorFactory factory) {
- this.httpRequest = httpRequest;
- this.factory = factory;
- this.ifHeader = new IfHeader(httpRequest);
-
- String host = getHeader("Host");
- String scheme = getScheme();
- hrefPrefix = scheme + "://" + host + getContextPath();
- }
-
- /**
- * Sets the session field and adds all lock tokens present with either the
- * Lock-Token header or the If header to the given session object.
- *
- * @param session
- * @see DavServletRequest#setDavSession(DavSession)
- */
- public void setDavSession(DavSession session) {
- this.session = session;
- // set lock-tokens from header to the current session
- if (session != null && session.getRepositorySession() != null) {
- String lt = getLockToken();
- if (lt != null) {
- session.addLockToken(lt);
- }
- // add all token present in the the If header to the session as well.
- Iterator it = ifHeader.getAllTokens();
- while (it.hasNext()) {
- String ifHeaderToken = (String)it.next();
- session.addLockToken(ifHeaderToken);
- }
- }
- }
-
- /**
- * @see DavServletRequest#getDavSession()
- */
- public DavSession getDavSession() {
- return session;
- }
-
- /**
- * Return a DavResourceLocator
representing the request handle.
- *
- * @return locator of the requested resource
- * @see DavServletRequest#getRequestLocator()
- */
- public DavResourceLocator getRequestLocator() {
- String path = getPathInfo();
- if (path == null) {
- path = getServletPath();
- }
- return factory.createResourceLocator(hrefPrefix, path);
- }
-
- /**
- * Parse the destination header field and return the path of the destination
- * resource.
- *
- * @return path of the destination resource.
- * @see #HEADER_DESTINATION
- * @see DavServletRequest#getDestinationLocator
- */
- public DavResourceLocator getDestinationLocator() {
- String destination = httpRequest.getHeader(HEADER_DESTINATION);
- if (destination != null) {
- try {
- URI uri = new URI(destination);
- if (uri.getAuthority().equals(httpRequest.getHeader("Host"))) {
- destination = Text.unescape(uri.getPath());
- }
- } catch (URISyntaxException e) {
- log.debug("Destination is path is not a valid URI ("+e.getMessage()+".");
- int pos = destination.lastIndexOf(":");
- if (pos > 0) {
- destination = destination.substring(destination.indexOf("/",pos));
- log.debug("Tried to retrieve resource destination path from invalid URI: "+destination);
- }
- }
-
- // cut off the context path
- String contextPath = httpRequest.getContextPath();
- if (destination.startsWith(contextPath)) {
- destination = destination.substring(contextPath.length());
- }
- }
- return factory.createResourceLocator(hrefPrefix, destination);
- }
-
- /**
- * Return true if the overwrite header does not inhibit overwriting.
- *
- * @return true if the overwrite header requests 'overwriting'
- * @see #HEADER_OVERWRITE
- * @see DavServletRequest#isOverwrite()
- */
- public boolean isOverwrite() {
- boolean doOverwrite = true;
- String overwriteHeader = httpRequest.getHeader(HEADER_OVERWRITE);
- if (overwriteHeader != null && !overwriteHeader.equalsIgnoreCase(NO_OVERWRITE)){
- doOverwrite = false;
- }
- return doOverwrite;
- }
-
- /**
- * @see DavServletRequest#getDepth(int)
- */
- public int getDepth(int defaultValue) {
- return DepthHeader.parse(httpRequest.getHeader(HEADER_DEPTH), defaultValue).getDepth();
- }
-
- /**
- * @see DavServletRequest#getDepth()
- */
- public int getDepth() {
- return getDepth(DEPTH_INFINITY);
- }
-
- /**
- * Parse the request timeout header and convert the timeout value
- * into a long indicating the number of milliseconds until expiration time
- * is reached.null
if an error occured while
- * parsing the request body.
- * @see DavServletRequest#getLockInfo()
- */
- public LockInfo getLockInfo() {
- LockInfo lockInfo = null;
- boolean isDeep = (getDepth(DEPTH_INFINITY) == DEPTH_INFINITY);
- Document requestDocument = getRequestDocument();
- // check if XML request body is present. It SHOULD have one for
- // 'create Lock' request and missing for a 'refresh Lock' request
- if (requestDocument != null) {
- Element root = requestDocument.getRootElement();
- if (root.getName().equals(XML_LOCKINFO)) {
- lockInfo = new LockInfo(root, getTimeout(), isDeep);
- } else {
- log.debug("Lock-Request has no null
or if
- * the resource has not applied an exclusive write lock the preconditions are met.
- * If in contrast the lock applied to the given resource returns a
- * null
lock token (e.g. for security reasons) or a lock token
- * that does not match, the method will return false.
- *
- * @param resource Webdav resources being operated on
- * @return true if the test is successful and the preconditions for the
- * request processing are fulfilled.
- * @param resource
- * @return
- * @see DavServletRequest#matchesIfHeader(DavResource)
- * @see IfHeader#matches(String, String, String)
- * @see DavResource#hasLock(org.apache.jackrabbit.webdav.lock.Type, org.apache.jackrabbit.webdav.lock.Scope)
- * @see org.apache.jackrabbit.webdav.lock.ActiveLock#getToken()
- */
- public boolean matchesIfHeader(DavResource resource) {
- // no ifheader, no resource or no write lock on resource
- // >> preconditions ok so far
- if (ifHeader == null || resource == null || !resource.hasLock(Type.WRITE, Scope.EXCLUSIVE)) {
- return true;
- }
-
- boolean isMatching = false;
- String lockToken = resource.getLock(Type.WRITE, Scope.EXCLUSIVE).getToken();
- if (lockToken != null) {
- // TODO: strongETag is missing
- isMatching = matchesIfHeader(resource.getHref(), lockToken, "");
- } // else: lockToken is null >> the if-header will not match.
-
- return isMatching;
- }
-
- /**
- * @see DavServletRequest#matchesIfHeader(String, String, String)
- * @see IfHeader#matches(String, String, String)
- */
- public boolean matchesIfHeader(String href, String token, String eTag) {
- return ifHeader.matches(href, token, eTag);
- }
-
- /**
- * Retrieve the header with the given header name and parse the CodedURL
- * value included.
- *
- * @param headerName
- * @return token present in the CodedURL header or null
if
- * the header is not present.
- */
- private String getCodedURLHeader(String headerName) {
- String headerValue = null;
- String header = httpRequest.getHeader(headerName);
- if (header != null) {
- int p1 = header.indexOf('<');
- if (p1<0) {
- throw new IllegalArgumentException("Invalid CodedURL header value:"+header);
- }
- int p2 = header.indexOf('>', p1);
- if (p2<0) {
- throw new IllegalArgumentException("Invalid CodedURL header value:"+header);
- }
- headerValue = header.substring(p1+1, p2);
- }
- return headerValue;
- }
-
- //-----------------------------< TransactionDavServletRequest Interface >---
- /**
- *
- * @return
- * @see org.apache.jackrabbit.webdav.transaction.TransactionDavServletRequest#getTransactionId()
- */
- public String getTransactionId() {
- return getCodedURLHeader(TransactionConstants.HEADER_TRANSACTIONID);
- }
-
- /**
- *
- * @return
- * @see org.apache.jackrabbit.webdav.transaction.TransactionDavServletRequest#getTransactionInfo()
- */
- public TransactionInfo getTransactionInfo() {
- Document requestDocument = getRequestDocument();
- if (requestDocument != null) {
- try {
- return new TransactionInfo(requestDocument.getRootElement());
- } catch (IllegalArgumentException e) {
- log.error(e.getMessage());
- }
- }
- return null;
- }
-
- //-----------------------------< ObservationDavServletRequest Interface >---
- /**
- *
- * @return
- * @see org.apache.jackrabbit.webdav.observation.ObservationDavServletRequest#getSubscriptionId()
- */
- public String getSubscriptionId() {
- return getCodedURLHeader(ObservationConstants.HEADER_SUBSCRIPTIONID);
- }
-
- /**
- *
- * @return
- * @see org.apache.jackrabbit.webdav.observation.ObservationDavServletRequest#getSubscriptionInfo()
- */
- public SubscriptionInfo getSubscriptionInfo() {
- Document requestDocument = getRequestDocument();
- if (requestDocument != null) {
- Element root = requestDocument.getRootElement();
- if (ObservationConstants.XML_SUBSCRIPTIONINFO.equals(root.getName())) {
- int depth = getDepth(DEPTH_0);
- return new SubscriptionInfo(root, getTimeout(), depth == DEPTH_INFINITY);
- }
- }
- return null;
- }
-
- //--------------------------------< OrderingDavServletRequest Interface >---
- /**
- *
- * @return
- * @see org.apache.jackrabbit.webdav.ordering.OrderingDavServletRequest#getOrderingType()
- */
- public String getOrderingType() {
- return getHeader(OrderingConstants.HEADER_ORDERING_TYPE);
- }
-
- /**
- *
- * @return
- * @see org.apache.jackrabbit.webdav.ordering.OrderingDavServletRequest#getPosition()
- */
- public Position getPosition() {
- String h = getHeader(OrderingConstants.HEADER_POSITION);
- Position pos = null;
- if (h != null) {
- String[] typeNSegment = h.split("\\s");
- if (typeNSegment.length == 2) {
- try {
- pos = new Position(typeNSegment[0], typeNSegment[1]);
- } catch (IllegalArgumentException e) {
- log.error("Cannot parse Position header: "+e.getMessage());
- }
- }
- }
- return pos;
- }
-
- /**
- *
- * @return OrderPatch
object representing the orderpatch request
- * body or null
if the
- * @see org.apache.jackrabbit.webdav.ordering.OrderingDavServletRequest#getOrderPatch()
- */
- public OrderPatch getOrderPatch() {
- OrderPatch op = null;
- Document requestDocument = getRequestDocument();
- if (requestDocument != null) {
- Element root = requestDocument.getRootElement();
- if (!OrderingConstants.XML_ORDERPATCH.equals(root.getName()) ||
- root.getChild(OrderingConstants.XML_ORDERING_TYPE) == null) {
- log.error("ORDERPATH request body must start with an 'orderpatch' element, which must contain an 'ordering-type' child element.");
- return op;
- }
-
- try {
- op = new OrderPatch(root);
- } catch (IllegalArgumentException e) {
- log.error(e.getMessage());
- }
- } else {
- log.error("Error while building xml document from ORDERPATH request body.");
- }
- return op;
- }
-
- //-------------------------------------< DeltaVServletRequest interface >---
- /**
- * @see org.apache.jackrabbit.webdav.version.DeltaVServletRequest#getLabel()
- */
- public String getLabel() {
- String label = getHeader(DeltaVConstants.HEADER_LABEL);
- if (label != null) {
- label = Text.unescape(label);
- }
- return label;
- }
-
- /**
- * @see org.apache.jackrabbit.webdav.version.DeltaVServletRequest#getLabelInfo()
- */
- public LabelInfo getLabelInfo() {
- LabelInfo lInfo = null;
- Document requestDocument = getRequestDocument();
- if (requestDocument != null) {
- Element root = requestDocument.getRootElement();
- int depth = getDepth(DEPTH_0);
- try {
- lInfo = new LabelInfo(root, depth);
- } catch (IllegalArgumentException e) {
- log.error(e.getMessage());
- }
- }
- return lInfo;
- }
-
- /**
- * @see org.apache.jackrabbit.webdav.version.DeltaVServletRequest#getMergeInfo()
- */
- public MergeInfo getMergeInfo() {
- MergeInfo mInfo = null;
- Document requestDocument = getRequestDocument();
- if (requestDocument != null) {
- try {
- mInfo = new MergeInfo(requestDocument.getRootElement());
- } catch (IllegalArgumentException e) {
- log.error(e.getMessage());
- }
- }
- return mInfo;
- }
-
- /**
- * @see org.apache.jackrabbit.webdav.version.DeltaVServletRequest#getUpdateInfo()
- */
- public UpdateInfo getUpdateInfo() {
- UpdateInfo uInfo = null;
- Document requestDocument = getRequestDocument();
- if (requestDocument != null) {
- try {
- uInfo = new UpdateInfo(requestDocument.getRootElement());
- } catch (IllegalArgumentException e) {
- log.error(e.getMessage());
- }
- }
- return uInfo;
- }
-
- /**
- * @see org.apache.jackrabbit.webdav.version.DeltaVServletRequest#getReportInfo()
- */
- public ReportInfo getReportInfo() {
- ReportInfo rInfo = null;
- Document requestDocument = getRequestDocument();
- if (requestDocument != null) {
- rInfo = new ReportInfo(requestDocument.getRootElement(), getDepth(DEPTH_0));
- }
- return rInfo;
- }
-
- /**
- * @see org.apache.jackrabbit.webdav.version.DeltaVServletRequest#getOptionsInfo()
- */
- public OptionsInfo getOptionsInfo() {
- OptionsInfo info = null;
- Document requestDocument = getRequestDocument();
- if (requestDocument != null) {
- info = new OptionsInfo(requestDocument.getRootElement());
- }
- return info;
- }
-
- //---------------------------------------< HttpServletRequest interface >---
- public String getAuthType() {
- return httpRequest.getAuthType();
- }
-
- public Cookie[] getCookies() {
- return httpRequest.getCookies();
- }
-
- public long getDateHeader(String s) {
- return httpRequest.getDateHeader(s);
- }
-
- public String getHeader(String s) {
- return httpRequest.getHeader(s);
- }
-
- public Enumeration getHeaders(String s) {
- return httpRequest.getHeaders(s);
- }
-
- public Enumeration getHeaderNames() {
- return httpRequest.getHeaderNames();
- }
-
- public int getIntHeader(String s) {
- return httpRequest.getIntHeader(s);
- }
-
- public String getMethod() {
- return httpRequest.getMethod();
- }
-
- public String getPathInfo() {
- return httpRequest.getPathInfo();
- }
-
- public String getPathTranslated() {
- return httpRequest.getPathTranslated();
- }
-
- public String getContextPath() {
- return httpRequest.getContextPath();
- }
-
- public String getQueryString() {
- return httpRequest.getQueryString();
- }
-
- public String getRemoteUser() {
- return httpRequest.getRemoteUser();
- }
-
- public boolean isUserInRole(String s) {
- return httpRequest.isUserInRole(s);
- }
-
- public Principal getUserPrincipal() {
- return httpRequest.getUserPrincipal();
- }
-
- public String getRequestedSessionId() {
- return httpRequest.getRequestedSessionId();
- }
-
- public String getRequestURI() {
- return httpRequest.getRequestURI();
- }
-
- public StringBuffer getRequestURL() {
- return httpRequest.getRequestURL();
- }
-
- public String getServletPath() {
- return httpRequest.getServletPath();
- }
-
- public HttpSession getSession(boolean b) {
- return httpRequest.getSession(b);
- }
-
- public HttpSession getSession() {
- return httpRequest.getSession();
- }
-
- public boolean isRequestedSessionIdValid() {
- return httpRequest.isRequestedSessionIdValid();
- }
-
- public boolean isRequestedSessionIdFromCookie() {
- return httpRequest.isRequestedSessionIdFromCookie();
- }
-
- public boolean isRequestedSessionIdFromURL() {
- return httpRequest.isRequestedSessionIdFromURL();
- }
-
- public boolean isRequestedSessionIdFromUrl() {
- return httpRequest.isRequestedSessionIdFromUrl();
- }
-
- public Object getAttribute(String s) {
- return httpRequest.getAttribute(s);
- }
-
- public Enumeration getAttributeNames() {
- return httpRequest.getAttributeNames();
- }
-
- public String getCharacterEncoding() {
- return httpRequest.getCharacterEncoding();
- }
-
- public void setCharacterEncoding(String s) throws UnsupportedEncodingException {
- httpRequest.setCharacterEncoding(s);
- }
-
- public int getContentLength() {
- return httpRequest.getContentLength();
- }
-
- public String getContentType() {
- return httpRequest.getContentType();
- }
-
- public ServletInputStream getInputStream() throws IOException {
- return httpRequest.getInputStream();
- }
-
- public String getParameter(String s) {
- return httpRequest.getParameter(s);
- }
-
- public Enumeration getParameterNames() {
- return httpRequest.getParameterNames();
- }
-
- public String[] getParameterValues(String s) {
- return httpRequest.getParameterValues(s);
- }
-
- public Map getParameterMap() {
- return httpRequest.getParameterMap();
- }
-
- public String getProtocol() {
- return httpRequest.getProtocol();
- }
-
- public String getScheme() {
- return httpRequest.getScheme();
- }
-
- public String getServerName() {
- return httpRequest.getServerName();
- }
-
- public int getServerPort() {
- return httpRequest.getServerPort();
- }
-
- public BufferedReader getReader() throws IOException {
- return httpRequest.getReader();
- }
-
- public String getRemoteAddr() {
- return httpRequest.getRemoteAddr();
- }
-
- public String getRemoteHost() {
- return httpRequest.getRemoteHost();
- }
-
- public void setAttribute(String s, Object o) {
- httpRequest.setAttribute(s, o);
- }
-
- public void removeAttribute(String s) {
- httpRequest.removeAttribute(s);
- }
-
- public Locale getLocale() {
- return httpRequest.getLocale();
- }
-
- public Enumeration getLocales() {
- return httpRequest.getLocales();
- }
-
- public boolean isSecure() {
- return httpRequest.isSecure();
- }
-
- public RequestDispatcher getRequestDispatcher(String s) {
- return httpRequest.getRequestDispatcher(s);
- }
-
- public String getRealPath(String s) {
- return httpRequest.getRealPath(s);
- }
-}
\ No newline at end of file
diff --git a/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/WebdavResponse.java b/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/WebdavResponse.java
deleted file mode 100644
index 815fb04892c..00000000000
--- a/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/WebdavResponse.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * 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;
-
-import org.apache.jackrabbit.webdav.observation.ObservationDavServletResponse;
-
-/**
- * The empty WebdavResponse
interface collects the functionality
- * defined by {@link org.apache.jackrabbit.webdav.DavServletResponse} encapsulting
- * for the core WebDAV specification (RFC 2518) as well as the various extensions
- * used for observation and transaction support, ordering of collections, search
- * and versioning.
- */
-public interface WebdavResponse extends DavServletResponse,
- ObservationDavServletResponse {
-}
\ No newline at end of file
diff --git a/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/WebdavResponseImpl.java b/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/WebdavResponseImpl.java
deleted file mode 100644
index 284e2cfdda8..00000000000
--- a/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/WebdavResponseImpl.java
+++ /dev/null
@@ -1,281 +0,0 @@
-/*
- * 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;
-
-import org.jdom.Element;
-import org.jdom.Document;
-import org.jdom.output.XMLOutputter;
-import org.jdom.output.Format;
-import org.apache.log4j.Logger;
-import org.apache.jackrabbit.webdav.lock.*;
-import org.apache.jackrabbit.webdav.observation.*;
-
-import javax.servlet.http.HttpServletResponse;
-import javax.servlet.http.Cookie;
-import javax.servlet.ServletOutputStream;
-import java.io.IOException;
-import java.io.ByteArrayOutputStream;
-import java.io.PrintWriter;
-import java.util.Locale;
-
-/**
- * WebdavResponseImpl implements the WebdavResponse
interface.
- */
-public class WebdavResponseImpl implements WebdavResponse {
-
- private static Logger log = Logger.getLogger(WebdavResponseImpl.class);
-
- private HttpServletResponse httpResponse;
-
- /**
- * Create a new WebdavResponse
- *
- * @param httpResponse
- */
- public WebdavResponseImpl(HttpServletResponse httpResponse) {
- this.httpResponse = httpResponse;
-
- /* set cache control headers in order to deal with non-webdav complient
- * http1.1 or http1.0 proxies. >> see RFC2518 9.4.5 */
- addHeader("Pragma", "No-cache"); // http1.0
- addHeader("Cache-Control", "no-cache"); // http1.1
- }
-
- /**
- *
- * @param exception
- * @throws IOException
- * @see DavServletResponse#sendErrorResponse(org.apache.jackrabbit.webdav.DavException)
- */
- public void sendErrorResponse(DavException exception) throws IOException {
- Element errorElem = exception.getError();
- if (errorElem == null || errorElem.getChildren().size() == 0) {
- httpResponse.sendError(exception.getErrorCode(), exception.getStatusPhrase());
- } else {
- sendXmlResponse(new Document(exception.getError()), exception.getErrorCode());
- }
- }
-
- /**
- * Send a multistatus response.
- *
- * @param multistatus
- * @throws IOException
- * @see DavServletResponse#sendMultiStatusResponse(org.apache.jackrabbit.webdav.MultiStatus)
- */
- public void sendMultiStatusResponse(MultiStatus multistatus) throws IOException {
- sendXmlResponse(multistatus.toXml(), SC_MULTI_STATUS);
- }
-
- /**
- * Send response body for a lock request intended to create a new lock.
- *
- * @param lock
- * @throws java.io.IOException
- * @see DavServletResponse#sendLockResponse(org.apache.jackrabbit.webdav.lock.ActiveLock)
- */
- public void sendLockResponse(ActiveLock lock) throws IOException {
- httpResponse.setHeader(DavConstants.HEADER_LOCK_TOKEN, "<" + lock.getToken() + ">");
-
- Element propElem = new Element(DavConstants.XML_PROP, DavConstants.NAMESPACE);
- propElem.addContent(new LockDiscovery(lock).toXml());
- sendXmlResponse(new Document(propElem), SC_OK);
- }
-
- /**
- * Send response body for a lock request that was intended to refresh one
- * or several locks.
- *
- * @param locks
- * @throws java.io.IOException
- * @see DavServletResponse#sendRefreshLockResponse(org.apache.jackrabbit.webdav.lock.ActiveLock[])
- */
- public void sendRefreshLockResponse(ActiveLock[] locks) throws IOException {
- Element propElem = new Element(DavConstants.XML_PROP, DavConstants.NAMESPACE);
- propElem.addContent(new LockDiscovery(locks).toXml());
- sendXmlResponse(new Document(propElem), SC_OK);
- }
-
- /**
- * Send Xml response body.
- *
- * @param xmlDoc
- * @param status
- * @throws IOException
- * @see DavServletResponse#sendXmlResponse(Document, int);
- */
- public void sendXmlResponse(Document xmlDoc, int status) throws IOException {
- httpResponse.setStatus(status);
- if (xmlDoc != null) {
- ByteArrayOutputStream out = new ByteArrayOutputStream();
- // Write dom tree into byte array output stream
- XMLOutputter xmli = new XMLOutputter(Format.getRawFormat());
- xmli.output(xmlDoc, out);
- byte[] bytes = out.toByteArray();
- httpResponse.setContentType("text/xml; charset=UTF-8");
- httpResponse.setContentLength(bytes.length);
- httpResponse.getOutputStream().write(bytes);
- out.close();
- out.flush();
- }
- }
-
- //----------------------------< ObservationDavServletResponse Interface >---
- /**
- *
- * @param subscription
- * @throws IOException
- * @see org.apache.jackrabbit.webdav.observation.ObservationDavServletResponse#sendSubscriptionResponse(org.apache.jackrabbit.webdav.observation.Subscription)
- */
- public void sendSubscriptionResponse(Subscription subscription) throws IOException {
- Element propElem = new Element(DavConstants.XML_PROP, DavConstants.NAMESPACE);
- propElem.addContent(new SubscriptionDiscovery(subscription).toXml());
- Document doc = new Document(propElem);
- sendXmlResponse(doc, SC_OK);
- }
-
- /**
- *
- * @param eventDiscovery
- * @throws IOException
- * @see org.apache.jackrabbit.webdav.observation.ObservationDavServletResponse#sendPollResponse(org.apache.jackrabbit.webdav.observation.EventDiscovery)
- */
- public void sendPollResponse(EventDiscovery eventDiscovery) throws IOException {
- Document pollDoc = new Document(eventDiscovery.toXml());
- sendXmlResponse(pollDoc, SC_OK);
- }
-
- //--------------------------------------< HttpServletResponse interface >---
- public void addCookie(Cookie cookie) {
- httpResponse.addCookie(cookie);
- }
-
- public boolean containsHeader(String s) {
- return httpResponse.containsHeader(s);
- }
-
- public String encodeURL(String s) {
- return httpResponse.encodeRedirectURL(s);
- }
-
- public String encodeRedirectURL(String s) {
- return httpResponse.encodeRedirectURL(s);
- }
-
- public String encodeUrl(String s) {
- return httpResponse.encodeUrl(s);
- }
-
- public String encodeRedirectUrl(String s) {
- return httpResponse.encodeRedirectURL(s);
- }
-
- public void sendError(int i, String s) throws IOException {
- httpResponse.sendError(i, s);
- }
-
- public void sendError(int i) throws IOException {
- httpResponse.sendError(i);
- }
-
- public void sendRedirect(String s) throws IOException {
- httpResponse.sendRedirect(s);
- }
-
- public void setDateHeader(String s, long l) {
- httpResponse.setDateHeader(s, l);
- }
-
- public void addDateHeader(String s, long l) {
- httpResponse.addDateHeader(s, l);
- }
-
- public void setHeader(String s, String s1) {
- httpResponse.setHeader(s, s1);
- }
-
- public void addHeader(String s, String s1) {
- httpResponse.addHeader(s, s1);
- }
-
- public void setIntHeader(String s, int i) {
- httpResponse.setIntHeader(s, i);
- }
-
- public void addIntHeader(String s, int i) {
- httpResponse.addIntHeader(s, i);
- }
-
- public void setStatus(int i) {
- httpResponse.setStatus(i);
- }
-
- public void setStatus(int i, String s) {
- httpResponse.setStatus(i, s);
- }
-
- public String getCharacterEncoding() {
- return httpResponse.getCharacterEncoding();
- }
-
- public ServletOutputStream getOutputStream() throws IOException {
- return httpResponse.getOutputStream();
- }
-
- public PrintWriter getWriter() throws IOException {
- return httpResponse.getWriter();
- }
-
- public void setContentLength(int i) {
-
- }
-
- public void setContentType(String s) {
- httpResponse.setContentType(s);
- }
-
- public void setBufferSize(int i) {
- httpResponse.setBufferSize(i);
- }
-
- public int getBufferSize() {
- return httpResponse.getBufferSize();
- }
-
- public void flushBuffer() throws IOException {
- httpResponse.flushBuffer();
- }
-
- public void resetBuffer() {
- httpResponse.resetBuffer();
- }
-
- public boolean isCommitted() {
- return httpResponse.isCommitted();
- }
-
- public void reset() {
- httpResponse.reset();
- }
-
- public void setLocale(Locale locale) {
- httpResponse.setLocale(locale);
- }
-
- public Locale getLocale() {
- return httpResponse.getLocale();
- }
-}
diff --git a/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/header/DepthHeader.java b/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/header/DepthHeader.java
deleted file mode 100644
index ad26d892c8a..00000000000
--- a/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/header/DepthHeader.java
+++ /dev/null
@@ -1,110 +0,0 @@
-/*
- * Copyright 2004 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.header;
-
-import org.apache.log4j.Logger;
-import org.apache.jackrabbit.webdav.DavConstants;
-
-/**
- * DepthHeader
...
- */
-public class DepthHeader implements DavConstants {
-
- private static Logger log = Logger.getLogger(DepthHeader.class);
-
- private final int depth;
-
- /**
- * Create a new DepthHeader
from the given integer.
- *
- * @param depth
- */
- public DepthHeader(int depth) {
- if (depth == DavConstants.DEPTH_0 || depth == DavConstants.DEPTH_1 || depth == DavConstants.DEPTH_INFINITY) {
- this.depth = depth;
- } else {
- throw new IllegalArgumentException("Invalid depth: " + depth);
- }
- }
-
- /**
- * @return integer representation of the depth indicated by the given header.
- */
- public int getDepth() {
- return depth;
- }
-
- /**
- * Return {@link DavConstants#HEADER_DEPTH Depth}
- *
- * @return {@link DavConstants#HEADER_DEPTH Depth}
- * @see DavConstants#HEADER_DEPTH
- */
- public String getHeaderName() {
- return DavConstants.HEADER_DEPTH;
- }
-
- /**
- * Returns the header value.
- *
- * @return header value
- */
- public String getHeaderValue() {
- if (depth == DavConstants.DEPTH_0 || depth == DavConstants.DEPTH_1) {
- return depth + "";
- } else {
- return DavConstants.DEPTH_INFINITY_S;
- }
- }
-
- /**
- * Parse the given header value or use the defaultValue if the header
- * string is empty or null
.
- *
- * @param headerValue
- * @param defaultValue
- * @return a new DepthHeader
- */
- public static DepthHeader parse(String headerValue, int defaultValue) {
- if (headerValue == null || "".equals(headerValue)) {
- return new DepthHeader(defaultValue);
- } else {
- return new DepthHeader(depthToInt(headerValue));
- }
- }
-
- /**
- * Convert the String depth value to an integer.
- *
- * @param depth
- * @return integer representation of the given depth String
- * @throws IllegalArgumentException if the String does not represent a valid
- * depth.
- */
- private static int depthToInt(String depth) {
- int d;
- if (depth.equalsIgnoreCase(DavConstants.DEPTH_INFINITY_S)) {
- d = DavConstants.DEPTH_INFINITY;
- } else if (depth.equals(DavConstants.DEPTH_0+"")) {
- d = DavConstants.DEPTH_0;
- } else if (depth.equals(DavConstants.DEPTH_1+"")) {
- d = DavConstants.DEPTH_1;
- } else {
- throw new IllegalArgumentException("Invalid depth value: " + depth);
- }
- return d;
- }
-}
\ No newline at end of file
diff --git a/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/lock/AbstractActiveLock.java b/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/lock/AbstractActiveLock.java
deleted file mode 100644
index 48513015917..00000000000
--- a/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/lock/AbstractActiveLock.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * 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.lock;
-
-import org.apache.jackrabbit.webdav.DavConstants;
-import org.apache.jackrabbit.webdav.util.XmlUtil;
-import org.jdom.Element;
-
-/**
- * AbstractActiveLock
...
- */
-public abstract class AbstractActiveLock implements ActiveLock, DavConstants {
-
- /**
- * Returns the default Xml representation of the 'activelock' element
- * as defined by RFC 2518.
- *
- * @return Xml representation
- */
- public Element toXml() {
- Element activeLock = new Element(XML_ACTIVELOCK, NAMESPACE);
-
- // locktype property
- Element property = new Element(XML_LOCKTYPE, NAMESPACE);
- property.addContent(getType().toXml());
- activeLock.addContent(property);
-
- // lockscope property
- property = new Element(XML_LOCKSCOPE, NAMESPACE);
- property.addContent(getScope().toXml());
- activeLock.addContent(property);
-
- // depth
- activeLock.addContent(XmlUtil.depthToXml(isDeep()));
- // timeout
- long timeout = getTimeout();
- if (!isExpired() && timeout != UNDEFINED_TIMEOUT) {
- activeLock.addContent(XmlUtil.timeoutToXml(getTimeout()));
- }
-
- // owner
- if (getOwner() != null) {
- property = new Element(XML_OWNER, NAMESPACE);
- property.setText(getOwner());
- activeLock.addContent(property);
- }
-
- // locktoken
- if (getToken() != null) {
- property = new Element(XML_LOCKTOKEN, NAMESPACE);
- Element href = new Element(XML_HREF, NAMESPACE);
- href.setText(getToken());
- property.addContent(href);
- activeLock.addContent(property);
- }
- return activeLock;
- }
-}
\ No newline at end of file
diff --git a/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/lock/AbstractLockEntry.java b/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/lock/AbstractLockEntry.java
deleted file mode 100644
index 20693cad536..00000000000
--- a/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/lock/AbstractLockEntry.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * 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.lock;
-
-import org.apache.log4j.Logger;
-import org.apache.jackrabbit.webdav.DavConstants;
-import org.jdom.Element;
-
-/**
- * AbstractLockEntry
provides the generic {@link #toXml} method.
- */
-public abstract class AbstractLockEntry implements LockEntry, DavConstants {
-
- private static Logger log = Logger.getLogger(AbstractLockEntry.class);
-
- /**
- * Returns the Xml representation of this LockEntry
.
- *
- * @return Xml representation
- */
- public Element toXml() {
- Element entry = new Element(XML_LOCKENTRY, NAMESPACE);
- Element prop = new Element(XML_LOCKSCOPE, NAMESPACE);
- prop.addContent(getScope().toXml());
- entry.addContent(prop);
- prop = new Element(XML_LOCKTYPE, NAMESPACE);
- prop.addContent(getType().toXml());
- entry.addContent(prop);
- return entry;
- }
-}
\ No newline at end of file
diff --git a/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/lock/ActiveLock.java b/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/lock/ActiveLock.java
deleted file mode 100644
index 08e1cd2ef4a..00000000000
--- a/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/lock/ActiveLock.java
+++ /dev/null
@@ -1,114 +0,0 @@
-/*
- * 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.lock;
-
-import org.jdom.Element;
-
-/**
- * ActiveLock
encapsulates the lock information for a
- * {@link org.apache.jackrabbit.webdav.DavResource}.
- */
-public interface ActiveLock {
-
- /**
- * Return true, if the given token matches the lock token present in this
- * lock thus indicating that any lock relevant operation should not fail
- * due to a lock.
- *
- * @param lockToken to be checked
- * @return true if the given lock token matches.
- */
- public boolean isLockedByToken(String lockToken);
-
- /**
- * Returns true, if this lock is already expired.
- *
- * @return true if the lock is expired
- */
- public boolean isExpired();
-
- /**
- * Return the lock token.
- *
- * @return token string representing the lock token.
- */
- public String getToken();
-
- /**
- * Return the name (or id) of the lock owner.
- *
- * @return name (or id) of the lock owner.
- */
- public String getOwner();
-
- /**
- * Set the name (or id) of the lock owner
- *
- * @param owner
- */
- public void setOwner(String owner);
-
- /**
- * Return the number of milliseconds the lock will live until it is expired
- * or -1 if the timeout is not available (or the client is not allowed
- * to retrieve it).
- *
- * @return
- */
- public long getTimeout();
-
- /**
- * Defines the number of milliseconds until the timeout is reached.
- *
- * @param timeout
- */
- public void setTimeout(long timeout);
-
- /**
- * Return true if the lock is deep.
- *
- * @return true if the lock is deep.
- */
- public boolean isDeep();
-
- /**
- * Set the lock deepness.
- *
- * @param isDeep
- */
- public void setIsDeep(boolean isDeep);
-
- /**
- * Return the type of this lock.
- *
- * @return type
- */
- public Type getType();
-
- /**
- * Return the scope of this lock.
- *
- * @return scope
- */
- public Scope getScope();
-
- /**
- * Return the Xml representation of this lock.
- *
- * @return Xml representation of this lock
- */
- public Element toXml();
-}
diff --git a/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/lock/LockDiscovery.java b/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/lock/LockDiscovery.java
deleted file mode 100644
index a9e2f57da67..00000000000
--- a/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/lock/LockDiscovery.java
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
- * 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.lock;
-
-import org.jdom.Element;
-import org.apache.jackrabbit.webdav.property.DavPropertyName;
-import org.apache.jackrabbit.webdav.property.AbstractDavProperty;
-
-import java.util.List;
-import java.util.ArrayList;
-import java.util.Iterator;
-
-/**
- * The LockDiscovery
class encapsulates the webdav lock discovery
- * property that is sent in the request body (PROPFIND and LOCK) and received
- * in a LOCK response body.
- */
-public class LockDiscovery extends AbstractDavProperty {
-
- /**
- * Listing of existing locks applied to the resource this discovery was
- * requested for. Each entry reveals, who has a lock, what type of lock he has,
- * the timeout type and the time remaining on the timeout, and the lock-type.
- * NOTE, that any of the information listed may be not availble for the
- * server is free to withhold any or all of this information.
- */
- private List activeLocks = new ArrayList();
-
- /**
- * Creates a new empty LockDiscovery property
- */
- public LockDiscovery() {
- super(DavPropertyName.LOCKDISCOVERY, false);
- }
-
- /**
- * Create a new LockDiscovery property
- *
- * @param lock
- */
- public LockDiscovery(ActiveLock lock) {
- super(DavPropertyName.LOCKDISCOVERY, false);
- addActiveLock(lock);
- }
-
- /**
- * Create a new LockDiscovery property
- *
- * @param locks
- */
- public LockDiscovery(ActiveLock[] locks) {
- super(DavPropertyName.LOCKDISCOVERY, false);
- for (int i = 0; i < locks.length; i++) {
- addActiveLock(locks[i]);
- }
- }
-
- private void addActiveLock(ActiveLock lock) {
- if (lock != null) {
- activeLocks.add(lock);
- }
- }
-
- /**
- * Creates a JDOM <lockdiscovery>
element in order to respond to a LOCK
- * request or to the lockdiscovery property of a PROPFIND request.<lockdiscovery/>
)
- * @return A JDOM element of the <active> lock tag.
- */
- public Element toXml() {
- Element lockdiscovery = getName().toXml();
- Iterator it = activeLocks.iterator();
- while (it.hasNext()) {
- ActiveLock lock = (ActiveLock) it.next();
- lockdiscovery.addContent(lock.toXml());
- }
- return lockdiscovery;
- }
-
- /**
- * Returns the list of active locks.
- *
- * @return list of active locks
- * @see org.apache.jackrabbit.webdav.property.DavProperty#getValue()
- */
- public Object getValue() {
- return activeLocks;
- }
-}
diff --git a/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/lock/LockEntry.java b/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/lock/LockEntry.java
deleted file mode 100644
index 49b90d6fb12..00000000000
--- a/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/lock/LockEntry.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * 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.lock;
-
-import org.jdom.Element;
-
-/**
- * LockEntry
...
- */
-public interface LockEntry {
-
- /**
- * Returns the type of this lock entry
- *
- * @return type of this lock entry.
- */
- public Type getType();
-
- /**
- * Returns the scope of this lock entry.
- *
- * @return scope of this lock entry.
- */
- public Scope getScope();
-
- /**
- * Returns the Xml representation of this entry.
- *
- * @return Xml representation
- */
- public Element toXml();
-}
\ No newline at end of file
diff --git a/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/lock/LockInfo.java b/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/lock/LockInfo.java
deleted file mode 100644
index 6847d413c15..00000000000
--- a/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/lock/LockInfo.java
+++ /dev/null
@@ -1,171 +0,0 @@
-/*
- * 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.lock;
-
-import org.apache.jackrabbit.webdav.DavConstants;
-import org.jdom.Element;
-
-import java.util.List;
-import java.util.Iterator;
-
-/**
- * LockInfo
is a simple utility class encapsulating the information
- * passed with a LOCK request. It combines both the request body (which if present
- * is required to by a 'lockinfo' Xml element) and the lock relevant request
- * headers '{@link DavConstants#HEADER_TIMEOUT Timeout}' and
- * '{@link DavConstants#HEADER_DEPTH Depth}'.LockInfo
object from the given information. If
- * liElement
is null
this lockinfo is assumed to
- * be issued from a 'Refresh Lock' request.
- *
- * @param liElement 'lockinfo' element present in the request body of a LOCK request
- * or null
if the request was intended to refresh an existing lock.
- * @param timeout Requested timespan until the lock should expire. A LOCK
- * request MUST contain a '{@link DavConstants#HEADER_TIMEOUT Timeout}'
- * according to RFC 2518.
- * @param isDeep boolean value indicating whether the lock should be applied
- * with depth infinity or only to the requested resource.
- * @throws IllegalArgumentException if the liElement
is not
- * null but does not start with an 'lockinfo' element.
- */
- public LockInfo(Element liElement, long timeout, boolean isDeep) {
- this.timeout = timeout;
- this.isDeep = isDeep;
-
- if (liElement != null) {
- if (!DavConstants.XML_LOCKINFO.equals(liElement.getName())) {
- throw new IllegalArgumentException("Element must have name 'lockinfo'.");
- }
-
- List childList = liElement.getChildren();
- for (int i = 0; i < childList.size(); i++) {
- Element child = (Element) childList.get(i);
- String nodeName = child.getName();
- if (DavConstants.XML_LOCKTYPE.equals(nodeName)) {
- Element typeElement = getFirstChildElement(child);
- type = Type.create(typeElement);
- } else if (DavConstants.XML_LOCKSCOPE.equals(nodeName)) {
- Element scopeElement = getFirstChildElement(child);
- scope = Scope.create(scopeElement);
- } else if (DavConstants.XML_OWNER.equals(nodeName)) {
- owner = child.getChildTextTrim(DavConstants.XML_HREF);
- if (owner==null) {
- // check if child is a text element
- owner = child.getTextTrim();
- }
- }
- }
- isRefreshLock = false;
- } else {
- isRefreshLock = true;
- }
- }
-
- /**
- * Retrieve the first element from the content list of the specified Xml element.
- *
- * @param elem
- * @return
- */
- private static Element getFirstChildElement(Element elem) {
- if (elem.getContentSize() > 0) {
- Iterator it = elem.getContent().iterator();
- while (it.hasNext()) {
- Object content = it.next();
- if (content instanceof Element) {
- return (Element) content;
- }
- }
- }
- return null;
- }
-
- /**
- * Returns the lock type or null if no 'lockinfo' element was
- * passed to the constructor or did not contain an 'type' element.
- *
- * @return type or null
- */
- public Type getType() {
- return type;
- }
-
- /**
- * Return the lock scope or null if no 'lockinfo' element was
- * passed to the constructor or did not contain an 'scope' element.
- *
- * @return scope or null
- */
- public Scope getScope() {
- return scope;
- }
-
- /**
- * Return the owner indicated by the corresponding child element from the
- * 'lockinfo' element or null if no 'lockinfo' element was
- * passed to the constructor or did not contain an 'owner' element.
- *
- * @return owner or null
- */
- public String getOwner() {
- return owner;
- }
-
- /**
- * Returns true if the lock must be applied with depth infinity.
- *
- * @return true if a deep lock must be created.
- */
- public boolean isDeep() {
- return isDeep;
- }
-
- /**
- * Returns the time until the lock is requested to expire.
- *
- * @return time until the lock should expire.
- */
- public long getTimeout() {
- return timeout;
- }
-
- /**
- * Returns true if this LockInfo
was created for a LOCK
- * request intended to refresh an existing lock rather than creating a
- * new one.
- *
- * @return true if the corresponding LOCK request was intended to refresh
- * an existing lock.
- */
- public boolean isRefreshLock() {
- return isRefreshLock;
- }
-}
\ No newline at end of file
diff --git a/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/lock/LockManager.java b/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/lock/LockManager.java
deleted file mode 100644
index 3f415af8784..00000000000
--- a/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/lock/LockManager.java
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- * 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.lock;
-
-import org.apache.jackrabbit.webdav.DavException;
-import org.apache.jackrabbit.webdav.DavResource;
-
-/**
- * The LockManager
interface.
- */
-public interface LockManager {
-
- /**
- * Create a new lock for the given {@link org.apache.jackrabbit.webdav.DavResource resource}.
- *
- * @param lockInfo
- * @param resource
- * @return
- * @throws DavException
- */
- public ActiveLock createLock(LockInfo lockInfo, DavResource resource)
- throws DavException;
-
- /**
- * Refresh the lock identified by the given lockToken and initially created
- * on the specified resouce. The update information can be retrieved from
- * the lockInfo object passes.
- *
- * @param lockInfo
- * @param lockToken
- * @param resource
- * @return
- * @throws DavException
- */
- public ActiveLock refreshLock(LockInfo lockInfo, String lockToken, DavResource resource)
- throws DavException;
-
- /**
- * Release the lock identified by the given lockToken and initially created
- * on the specified resouce.
- *
- * @param lockToken
- * @param resource
- * @throws DavException
- */
- public void releaseLock(String lockToken, DavResource resource)
- throws DavException;
-
- /**
- * Retrieve the lock with the given type and scope that is applied to the
- * given resource. The lock may be either initially created on this resource
- * or might be inherited from an ancestor resource that hold a deep lock.
- * If no such lock applies to the given resource null
must be
- * returned.
- *
- * @param type
- * @param scope
- * @param resource
- * @return lock with the given type and scope applied to the resource or
- * null
if no lock applies.
- */
- public ActiveLock getLock(Type type, Scope scope, DavResource resource);
-
- /**
- * Returns true, if the the manager contains a lock for the given
- * resource, that is hold by the specified token.
- *
- * @param lockToken
- * @param resource
- * @return true if the resource is locked by the specified token.
- */
- public boolean hasLock(String lockToken, DavResource resource);
-}
\ No newline at end of file
diff --git a/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/lock/Scope.java b/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/lock/Scope.java
deleted file mode 100644
index 0bd516ef624..00000000000
--- a/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/lock/Scope.java
+++ /dev/null
@@ -1,106 +0,0 @@
-/*
- * 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.lock;
-
-import org.jdom.Element;
-import org.jdom.Namespace;
-import org.apache.jackrabbit.webdav.DavConstants;
-
-import java.util.*;
-
-/**
- * The Scope
class abstracts the lock scope as defined by RFC 2518.
- */
-public class Scope {
-
- private static final Map scopes = new HashMap();
-
- public static final Scope EXCLUSIVE = Scope.create(DavConstants.XML_EXCLUSIVE, DavConstants.NAMESPACE);
- public static final Scope SHARED = Scope.create(DavConstants.XML_SHARED, DavConstants.NAMESPACE);
-
- private final String name;
- private final Namespace namespace;
-
- /**
- * Private constructor
- *
- * @param name
- * @param namespace
- */
- private Scope(String name, Namespace namespace) {
- this.name = name;
- this.namespace = namespace;
- }
-
- /**
- * Return the Xml representation of the lock scope object as present in
- * the LOCK request and response body and in the {@link LockDiscovery}.
- *
- * @return Xml representation
- */
- public Element toXml() {
- return new Element(name, namespace);
- }
-
- /**
- * Create a Scope
object from the given Xml element.
- *
- * @param lockScope
- * @return Scope object.
- */
- public static Scope create(Element lockScope) {
- if (lockScope == null) {
- throw new IllegalArgumentException("'null' is not valid lock scope entry.");
- }
- return create(lockScope.getName(), lockScope.getNamespace());
- }
-
- /**
- * Create a Scope
object from the given name and namespace.
- *
- * @param name
- * @param namespace
- * @return Scope object.
- */
- public static Scope create(String name, Namespace namespace) {
- String key = "{" + namespace.getURI() + "}" + name;
- if (scopes.containsKey(key)) {
- return (Scope) scopes.get(key);
- } else {
- Scope scope = new Scope(name, namespace);
- scopes.put(key, scope);
- return scope;
- }
- }
-
- /**
- * Returns true
if this Scope is equal to the given one.
- *
- * @param obj
- * @return
- */
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
- if (obj instanceof Scope) {
- Scope other = (Scope) obj;
- return name.equals(other.name) && namespace.equals(other.namespace);
- }
- return false;
- }
-
-}
\ No newline at end of file
diff --git a/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/lock/Type.java b/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/lock/Type.java
deleted file mode 100644
index 24d0d8892f4..00000000000
--- a/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/lock/Type.java
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
- * 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.lock;
-
-import org.jdom.Element;
-import org.jdom.Namespace;
-import org.apache.jackrabbit.webdav.DavConstants;
-
-import java.util.*;
-
-/**
- * The Type
class encapsulates the lock type as defined by RFC 2518.
- */
-public class Type {
-
- private static Map types = new HashMap();
-
- public static final Type WRITE = Type.create(DavConstants.XML_WRITE, DavConstants.NAMESPACE);
-
- private final String name;
- private final Namespace namespace;
-
- /**
- * Private constructor.
- *
- * @param name
- * @param namespace
- */
- private Type(String name, Namespace namespace) {
- this.name = name;
- this.namespace = namespace;
- }
-
- /**
- * Returns the Xml representation of this lock Type
.
- *
- * @return Xml representation
- */
- public Element toXml() {
- return new Element(name, namespace);
- }
-
- /**
- * Create a Type
object from the given Xml element.
- *
- * @param lockType
- * @return Type
object.
- */
- public static Type create(Element lockType) {
- if (lockType == null) {
- throw new IllegalArgumentException("'null' is not valid lock type entry.");
- }
- return create(lockType.getName(), lockType.getNamespace());
- }
-
- /**
- * Create a Type
object from the given name and namespace.
- *
- * @param name
- * @param namespace
- * @return Type
object.
- */
- public static Type create(String name, Namespace namespace) {
- String key = "{" + namespace.getURI() + "}" + name;
- if (types.containsKey(key)) {
- return (Type) types.get(key);
- } else {
- Type type = new Type(name, namespace);
- types.put(key, type);
- return type;
- }
- }
-
- /**
- * Returns true
if this Type is equal to the given one.
- *
- * @param obj
- * @return
- */
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
- if (obj instanceof Type) {
- Type other = (Type) obj;
- return name.equals(other.name) && namespace.equals(other.namespace);
- }
- return false;
- }
-}
\ No newline at end of file
diff --git a/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/lock/package.html b/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/lock/package.html
deleted file mode 100644
index b189cbfafd4..00000000000
--- a/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/lock/package.html
+++ /dev/null
@@ -1,3 +0,0 @@
-
-Provides interfaces and classes for locking related issues.
-
\ No newline at end of file
diff --git a/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/observation/EventDiscovery.java b/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/observation/EventDiscovery.java
deleted file mode 100644
index cc08afaf24e..00000000000
--- a/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/observation/EventDiscovery.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * 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.observation;
-
-import org.apache.log4j.Logger;
-import org.jdom.Element;
-
-import java.util.List;
-import java.util.ArrayList;
-
-/**
- * EventDiscovery
represents the request body of a successfull
- * POLL request. It reveals all events that occured since the last POLL. The
- * definition what events that particular subscription is interested in was
- * specified with the initial SUBSCRIPTION that started the event listening.
- */
-public class EventDiscovery implements ObservationConstants {
-
- private static Logger log = Logger.getLogger(EventDiscovery.class);
-
- private List bundles = new ArrayList();
-
- /**
- * Add the Xml representation of an single 'eventBundle' listing the
- * events that resulted from a change in the server, filtered by the
- * restrictions present in the corresponding subscription.
- *
- * @param eventBundle
- * @see Subscription
- */
- public void addEventBundle(Element eventBundle) {
- if (eventBundle != null) {
- bundles.add(eventBundle);
- }
- }
-
- /**
- * Returns the Xml representation of this EventDiscovery
as
- * being present in the POLL response body.
- *
- * @return Xml representation
- */
- public Element toXml() {
- Element ed = new Element(XML_EVENTDISCOVERY, NAMESPACE);
- ed.addContent(bundles);
- return ed;
- }
-}
\ No newline at end of file
diff --git a/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/observation/ObservationConstants.java b/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/observation/ObservationConstants.java
deleted file mode 100644
index b7db08f79b1..00000000000
--- a/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/observation/ObservationConstants.java
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
- * 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.observation;
-
-import org.jdom.Namespace;
-import org.apache.jackrabbit.webdav.property.DavPropertyName;
-
-/**
- * ObservationConstants
interface provide constants for request
- * and response headers, Xml elements and property names used for handling
- * observation over WebDAV. There exists no public standard for this
- * functionality.
- */
-public interface ObservationConstants {
-
- /**
- * The namespace
- */
- public static final Namespace NAMESPACE = Namespace.getNamespace("jcr", "http://www.day.com/jcr/webdav/1.0");
-
- /**
- * The SubscriptionId request header
- */
- public static final String HEADER_SUBSCRIPTIONID = "SubscriptionId";
-
- /**
- * subscription Xml element
- * Mandatory element inside the {@link #SUBSCRIPTIONDISCOVERY subscriptiondiscovery}
- * property indicating the event listeners present for this session.
- * NOTE, that this will not reveal any subscription made by another session.
- */
- public static final String XML_SUBSCRIPTION = "subscription";
-
- /**
- * Xml elements
- */
- public static final String XML_SUBSCRIPTIONINFO = "subscriptioninfo";
-
- public static final String XML_EVENTTYPE = "eventtype";
- public static final String XML_NOLOCAL = "nolocal";
- public static final String XML_FILTER = "filter";
- public static final String XML_SUBSCRIPTIONID = "subscriptionid";
- public static final String XML_UUID = "uuid";
- public static final String XML_NODETYPE_NAME = "nodetype-name";
-
- public static final String XML_EVENTDISCOVERY = "eventdiscovery";
- public static final String XML_EVENTBUNDLE = "eventbundle";
- public static final String XML_EVENT = "event";
- public static final String XML_EVENTUSERID = "eventuserid";
-
- /**
- * Element representing the 'nodeadded' event type.
- * @see javax.jcr.observation.Event#NODE_ADDED
- */
- public static final String EVENT_NODEADDED = "nodeadded";
-
- /**
- * Element representing the 'noderemoved' event type.
- * @see javax.jcr.observation.Event#NODE_REMOVED
- */
- public static final String EVENT_NODEREMOVED = "noderemoved";
-
- /**
- * Element representing the 'propertyadded' event type.
- * @see javax.jcr.observation.Event#PROPERTY_ADDED
- */
- public static final String EVENT_PROPERTYADDED = "propertyadded";
-
- /**
- * Element representing the 'propertyremoved' event type.
- * @see javax.jcr.observation.Event#PROPERTY_REMOVED
- */
- public static final String EVENT_PROPERTYREMOVED = "propertyremoved";
-
- /**
- * Element representing the 'propertychanged' event type.
- * @see javax.jcr.observation.Event#PROPERTY_CHANGED
- */
- public static final String EVENT_PROPERTYCHANGED = "propertychanged";
-
- /**
- * The protected subscription discovery property is used to find out about
- * existing subscriptions present on the specified resource.
- */
- public static final DavPropertyName SUBSCRIPTIONDISCOVERY = DavPropertyName.create("subscriptiondiscovery", NAMESPACE);
-}
\ No newline at end of file
diff --git a/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/observation/ObservationDavServletRequest.java b/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/observation/ObservationDavServletRequest.java
deleted file mode 100644
index f6c5377623e..00000000000
--- a/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/observation/ObservationDavServletRequest.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * 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.observation;
-
-import org.apache.jackrabbit.webdav.DavServletRequest;
-
-/**
- * ObservationDavServletRequest
provides extensions to the
- * {@link DavServletRequest} interface used for dealing with observation.
- */
-public interface ObservationDavServletRequest extends DavServletRequest {
-
- /**
- * Return the {@link ObservationConstants#HEADER_SUBSCRIPTIONID SubscriptionId header}
- * or null
if no such header is present.
- *
- * @return the {@link ObservationConstants#HEADER_SUBSCRIPTIONID SubscriptionId header}
- */
- public String getSubscriptionId();
-
- /**
- * Return a {@link SubscriptionInfo} object representing the subscription
- * info present in the SUBSCRIBE request body or null
if
- * retrieving the subscription info fails.
- *
- * @return subscription info object encapsulating the SUBSCRIBE request body
- * or null
if the subscription info cannot be built.
- */
- public SubscriptionInfo getSubscriptionInfo();
-}
\ No newline at end of file
diff --git a/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/observation/ObservationDavServletResponse.java b/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/observation/ObservationDavServletResponse.java
deleted file mode 100644
index 8a68b97a509..00000000000
--- a/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/observation/ObservationDavServletResponse.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * 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.observation;
-
-import org.apache.jackrabbit.webdav.DavServletResponse;
-
-import java.io.IOException;
-
-/**
- * ObservationDavServletResponse
provides extensions to the
- * {@link DavServletResponse} interface used for dealing with observation.
- */
-public interface ObservationDavServletResponse extends DavServletResponse {
-
- /**
- * Send the response to a successful SUBSCRIBE request.
- *
- * @param subsription that needs to be represented in the response body.
- * @throws IOException
- */
- public void sendSubscriptionResponse(Subscription subsription) throws IOException;
-
- /**
- * Send the response to a sucessful POLL request.
- *
- * @param eventdiscovery {@link EventDiscovery} object to be returned in
- * the response body.
- * @throws IOException
- */
- public void sendPollResponse(EventDiscovery eventdiscovery) throws IOException;
-}
\ No newline at end of file
diff --git a/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/observation/Subscription.java b/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/observation/Subscription.java
deleted file mode 100644
index 0b7debd7640..00000000000
--- a/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/observation/Subscription.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * 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.observation;
-
-import org.jdom.Element;
-
-/**
- * Subscription
represents public representation of the event
- * listener created (or modified) by a successful SUBSCRIBE request.
- */
-public interface Subscription {
-
- /**
- * Returns the id of this subscription, that must be used for unsubscribing
- * as well as for event discovery later on.
- *
- * @return subscriptionId
- */
- public String getSubscriptionId();
-
- /**
- * Return the Xml representation of this Subscription
that is
- * returned in the response to a successful SUBSCRIBE request as well
- * as in a PROPFIND request. In both cases the subscription is packed into
- * a {@link SubscriptionDiscovery} property object.
- *
- * @return Xml representation
- */
- public Element toXml();
-
-}
\ No newline at end of file
diff --git a/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/observation/SubscriptionDiscovery.java b/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/observation/SubscriptionDiscovery.java
deleted file mode 100644
index 58c9a51bc2b..00000000000
--- a/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/observation/SubscriptionDiscovery.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * 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.observation;
-
-import org.apache.jackrabbit.webdav.property.AbstractDavProperty;
-import org.jdom.Element;
-
-/**
- * SubscriptionDiscovery
encapsulates the 'subscriptiondiscovery'
- * property of a webdav resource.
- */
-public class SubscriptionDiscovery extends AbstractDavProperty {
-
- Subscription[] subscriptions = new Subscription[0];
-
- /**
- * Create a new SubscriptionDiscovery
that lists the given
- * subscriptions.
- *
- * @param subscriptions
- */
- public SubscriptionDiscovery(Subscription[] subscriptions) {
- super(ObservationConstants.SUBSCRIPTIONDISCOVERY, true);
- if (subscriptions != null) {
- this.subscriptions = subscriptions;
- }
- }
-
- /**
- * Create a new SubscriptionDiscovery
that contains a single
- * subscription entry.
- *
- * @param subscription
- */
- public SubscriptionDiscovery(Subscription subscription) {
- super(ObservationConstants.SUBSCRIPTIONDISCOVERY, true);
- if (subscription != null) {
- this.subscriptions = new Subscription[]{subscription};
- }
- }
-
- /**
- * Returns the Xml representation of the subscription discovery.
- *
- * @return Xml representation
- * @see org.apache.jackrabbit.webdav.property.DavProperty#toXml()
- */
- public Element toXml() {
- Element elem = getName().toXml();
- for (int i = 0; i < subscriptions.length; i++) {
- elem.addContent(subscriptions[i].toXml());
- }
- return elem;
- }
-
- /**
- * Returns an array of {@link Subscription}s.
- *
- * @return an array of {@link Subscription}s
- * @see org.apache.jackrabbit.webdav.property.DavProperty#getValue()
- */
- public Object getValue() {
- return subscriptions;
- }
-}
\ No newline at end of file
diff --git a/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/observation/SubscriptionInfo.java b/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/observation/SubscriptionInfo.java
deleted file mode 100644
index d9f1719c8b3..00000000000
--- a/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/observation/SubscriptionInfo.java
+++ /dev/null
@@ -1,148 +0,0 @@
-/*
- * 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.observation;
-
-import org.apache.log4j.Logger;
-import org.apache.jackrabbit.webdav.util.XmlUtil;
-import org.jdom.Element;
-
-import java.util.List;
-
-/**
- * SubscriptionInfo
class encapsulates the subscription info
- * that forms the request body of a SUBSCRIBE request.
- * @see ObservationConstants#XML_SUBSCRIPTIONINFO
- */
-public class SubscriptionInfo implements ObservationConstants {
-
- private static Logger log = Logger.getLogger(SubscriptionInfo.class);
-
- private Element info;
- private List eventTypes;
- private long timeout;
- private boolean isDeep;
-
- /**
- * Create a new SubscriptionInfo
- *
- * @param reqInfo Xml element present in the request body.
- * @param timeout as defined by the {@link org.apache.jackrabbit.webdav.DavConstants#HEADER_TIMEOUT timeout header}.
- * @param isDeep as defined by the {@link org.apache.jackrabbit.webdav.DavConstants#HEADER_DEPTH depth header}.
- * @throws IllegalArgumentException if the reqInfo element does not contain the mandatory elements.
- */
- public SubscriptionInfo(Element reqInfo, long timeout, boolean isDeep) {
- if (!XML_SUBSCRIPTIONINFO.equals(reqInfo.getName())) {
- throw new IllegalArgumentException("Element with name 'subscriptioninfo' expected");
- }
- if (reqInfo.getChild(XML_EVENTTYPE, NAMESPACE) == null ) {
- throw new IllegalArgumentException("'subscriptioninfo' must contain an 'eventtype' child element.");
- }
-
- eventTypes = reqInfo.getChild(XML_EVENTTYPE, NAMESPACE).getChildren();
- if (eventTypes.size() == 0) {
- throw new IllegalArgumentException("'subscriptioninfo' must at least indicate a single event type.");
- }
-
- // detach the request info, in order to remove the reference to the parent
- this.info = (Element)reqInfo.detach();
- this.isDeep = isDeep;
- setTimeOut(timeout);
- }
-
- /**
- * Return list of event types Xml elements present in the subscription info.
- * NOTE: the elements need to be detached in order to be added as content
- * to any other Xml element.
- *
- * @return List of Xml elements defining which events this subscription should
- * listen to.
- *
- */
- public List getEventTypes() {
- return eventTypes;
- }
-
- /**
- * Return array of filters with the specified name.
- *
- * @param name the filter elments must provide.
- * @return array containing the text of the filter elements with the given
- * name.
- */
- public String[] getFilters(String name) {
- String[] filters = null;
- Element filter = info.getChild(XML_FILTER);
- if (filter != null) {
- List li = filter.getChildren(name);
- if (!li.isEmpty()) {
- filters = new String[li.size()];
- for (int i = 0; i < filters.length; i++) {
- filters[i] = ((Element)li.get(i)).getText();
- }
- }
- }
- return filters;
- }
-
- /**
- * Returns true if the {@link #XML_NOLOCAL} element is present in this
- * subscription info.
- *
- * @return if {@link #XML_NOLOCAL} element is present.
- */
- public boolean isNoLocal() {
- return info.getChild(XML_NOLOCAL, NAMESPACE) != null;
- }
-
- /**
- * Returns true if the {@link org.apache.jackrabbit.webdav.DavConstants#HEADER_DEPTH
- * depths header} defined a depth other than '0'.
- *
- * @return true if this subscription info was created with isDeep
- * true.
- */
- public boolean isDeep() {
- return isDeep;
- }
-
- /**
- * Return the timeout as retrieved from the request.
- *
- * @return timeout.
- */
- public long getTimeOut() {
- return timeout;
- }
-
- /**
- * Set the timeout. NOTE: no validation is made.
- *
- * @param timeout as defined by the {@link org.apache.jackrabbit.webdav.DavConstants#HEADER_TIMEOUT}.
- */
- public void setTimeOut(long timeout) {
- this.timeout = timeout;
- }
-
- /**
- * Xml representation of this SubscriptionInfo
.
- *
- * @return Xml representation
- */
- public Element[] toXml() {
- Element[] elems = { info, XmlUtil.depthToXml(isDeep), XmlUtil.timeoutToXml(timeout)};
- return elems;
- }
-}
\ No newline at end of file
diff --git a/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/observation/SubscriptionManager.java b/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/observation/SubscriptionManager.java
deleted file mode 100644
index 71d0a4ea890..00000000000
--- a/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/observation/SubscriptionManager.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * 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.observation;
-
-import org.apache.jackrabbit.webdav.DavException;
-
-/**
- * SubscriptionManager
interface.
- */
-public interface SubscriptionManager {
-
- /**
- * Retrieve the {@link org.apache.jackrabbit.webdav.observation.SubscriptionDiscovery} object for the given
- * resource. Note, that the discovery object will be empty if there are
- * no subscriptions present.
- *
- * @param resource
- */
- public SubscriptionDiscovery getSubscriptionDiscovery(ObservationResource resource);
-
- /**
- * Create a new Subscription
or update an existing Subscription
..
- *
- * @param info
- * @param subscriptionId
- * @param resource
- * @return Subscription
that has been created or updated
- * @throws DavException if the subscription fails
- */
- public Subscription subscribe(SubscriptionInfo info, String subscriptionId,
- ObservationResource resource)
- throws DavException;
-
- /**
- * Unsubscribe the Subscription
with the given id.
- *
- * @param subscriptionId
- * @param resource
- * @throws DavException
- */
- public void unsubscribe(String subscriptionId, ObservationResource resource)
- throws DavException;
-
- /**
- * Retrieve the list of events that occured since the last poll.
- *
- * @param subscriptionId indentifier for the subscription
- * @param resource
- * @return
- */
- public EventDiscovery poll(String subscriptionId, ObservationResource resource)
- throws DavException;
-}
\ No newline at end of file
diff --git a/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/observation/package.html b/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/observation/package.html
deleted file mode 100644
index 7ab068095ba..00000000000
--- a/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/observation/package.html
+++ /dev/null
@@ -1,4 +0,0 @@
-
-Contains interfaces and classes related to observation, which is not covered
-by the WebDAV protocol.
-
\ No newline at end of file
diff --git a/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/ordering/OrderPatch.java b/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/ordering/OrderPatch.java
deleted file mode 100644
index 7f006697876..00000000000
--- a/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/ordering/OrderPatch.java
+++ /dev/null
@@ -1,152 +0,0 @@
-/*
- * 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.ordering;
-
-import org.apache.log4j.Logger;
-import org.apache.jackrabbit.webdav.DavConstants;
-import org.jdom.Element;
-
-import java.util.List;
-import java.util.Iterator;
-import java.util.ArrayList;
-
-/**
- * OrderPatch
represents the mandatory request body of an
- * ORDERPATCH request. RFC 3648 defines the following structure for it:
- *
- * <!ELEMENT orderpatch (ordering-type?, order-member*) >
- * <!ELEMENT order-member (segment, position) >
- * <!ELEMENT position (first | last | before | after) >
- * <!ELEMENT segment (#PCDATA) >
- * <!ELEMENT first EMPTY >
- * <!ELEMENT last EMPTY >
- * <!ELEMENT before segment >
- * <!ELEMENT after segment >
- *
- */
-public class OrderPatch implements OrderingConstants{
-
- private static Logger log = Logger.getLogger(OrderPatch.class);
-
- private Member[] instructions;
- private String orderingType;
-
- /**
- * Create a new OrderPath
object.
- *
- * @param orderPatchElement
- * @throws IllegalArgumentException if the specified Xml element was not valid.
- */
- public OrderPatch(Element orderPatchElement) {
- if (!OrderingConstants.XML_ORDERPATCH.equals(orderPatchElement.getName()) ||
- orderPatchElement.getChild(OrderingConstants.XML_ORDERING_TYPE) == null) {
- throw new IllegalArgumentException("ORDERPATH request body must start with an 'orderpatch' element, which must contain an 'ordering-type' child element.");
- }
- // retrieve the orderingtype element
- orderingType = orderPatchElement.getChild(OrderingConstants.XML_ORDERING_TYPE).getChildText(DavConstants.XML_HREF);
-
- // set build the list of ordering instructions
- List oMembers = orderPatchElement.getChildren(OrderingConstants.XML_ORDER_MEMBER, DavConstants.NAMESPACE);
- Iterator it = oMembers.iterator();
- int cnt = 0;
- List tmpInst = new ArrayList();
- while (it.hasNext()) {
- Element member = (Element) it.next();
- try {
- String segment = member.getChildText(OrderingConstants.XML_SEGMENT);
- Position pos = new Position(member.getChild(OrderingConstants.XML_POSITION));
- Member om = new Member(segment, pos);
- tmpInst.add(om);
- cnt++;
- } catch (IllegalArgumentException e) {
- log.error("Invalid element in 'orderpatch' request body: " + e.getMessage());
- }
- }
- instructions = (Member[]) tmpInst.toArray(new Member[cnt]);
- }
-
- /**
- * Create a new OrderPath
object.
- *
- * @param orderingType
- * @param instructions
- */
- public OrderPatch(String orderingType, Member[] instructions) {
- this.orderingType = orderingType;
- this.instructions = instructions;
- }
-
- /**
- * Return the ordering type.
- *
- * @return ordering type
- */
- public String getOrderingType() {
- return orderingType;
- }
-
- /**
- * Return an array of {@link Member} objects defining the re-ordering
- * instructions to be applied to the requested resource.
- *
- * @return ordering instructions.
- */
- public Member[] getOrderInstructions() {
- return instructions;
- }
-
- //--------------------------------------------------------------------------
- /**
- * Internal class Member
represents the 'Order-Member' children
- * elements of an 'OrderPatch' request body present in the ORDERPATCH request.
- */
- public class Member {
-
- private String memberHandle;
- private Position position;
-
- /**
- * Create a new Member
object.
- *
- * @param memberHandle
- * @param position
- */
- public Member(String memberHandle, Position position) {
- this.memberHandle = memberHandle;
- this.position = position;
- }
-
- /**
- * Return the handle of the internal member to be reordered.
- *
- * @return handle of the internal member.
- */
- public String getMemberHandle() {
- return memberHandle;
- }
-
- /**
- * Return the position where the internal member identified by the
- * member handle should be placed.
- *
- * @return position for the member after the request.
- * @see #getMemberHandle()
- */
- public Position getPosition() {
- return position;
- }
- }
-}
\ No newline at end of file
diff --git a/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/ordering/OrderingType.java b/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/ordering/OrderingType.java
deleted file mode 100644
index 3f3af1ca1ea..00000000000
--- a/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/ordering/OrderingType.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * 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.ordering;
-
-import org.jdom.Element;
-import org.apache.jackrabbit.webdav.property.DefaultDavProperty;
-import org.apache.jackrabbit.webdav.util.XmlUtil;
-
-/**
- * OrderingType
represents the {@link #ORDERING_TYPE
- * DAV:ordering-type} property as defined by
- * RFC 3648. This property is
- * protected cannot be set using PROPPATCH. Its value may only be set by
- * including the Ordering-Type header with a MKCOL request or by submitting an
- * ORDERPATCH request.
- *
- * @see org.apache.jackrabbit.webdav.property.DavProperty#isProtected()
- */
-public class OrderingType extends DefaultDavProperty implements OrderingConstants {
-
- /**
- * Create an OrderingType with the given ordering.
- * NOTE: the ordering-type property is defined to be protected.
- *
- * @param href
- * @see org.apache.jackrabbit.webdav.property.DavProperty#isProtected()
- */
- public OrderingType(String href) {
- super(ORDERING_TYPE, href, true);
- }
-
- /**
- * Returns the Xml representation of this property. If the property has
- * a null
value, the default ({@link #ORDERING_TYPE_UNORDERED
- * DAV:unordered}) is assumed.
- *
- * @return Xml representation
- */
- public Element toXml() {
- Element elem = getName().toXml();
- // spec requires that the default is 'DAV:unordered'
- String href = (getValue() != null) ? getValue().toString() : ORDERING_TYPE_UNORDERED;
- XmlUtil.hrefToXml(href);
- return elem;
- }
-}
\ No newline at end of file
diff --git a/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/ordering/Position.java b/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/ordering/Position.java
deleted file mode 100644
index 46833fcc85b..00000000000
--- a/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/ordering/Position.java
+++ /dev/null
@@ -1,155 +0,0 @@
-/*
- * 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.ordering;
-
-import org.apache.log4j.Logger;
-import org.jdom.Element;
-
-import java.util.HashMap;
-
-/**
- * Position
encapsulates the position in ordering information
- * contained in a Webdav request. This includes both the
- * {@link OrderingConstants#HEADER_POSITION Position header} and the position
- * Xml element present in the request body of an ORDERPATCH request.
- *
- * @see OrderingConstants#HEADER_POSITION
- * @see OrderingConstants#XML_POSITION
- * @see OrderPatch
- */
-public class Position implements OrderingConstants {
-
- private static Logger log = Logger.getLogger(Position.class);
-
- public static final int TYPE_FIRST = 1;
- public static final int TYPE_LAST = 2;
- public static final int TYPE_BEFORE = 4;
- public static final int TYPE_AFTER = 8;
-
- private static final HashMap xmlTypeMap = new HashMap(4);
- static {
- xmlTypeMap.put(XML_FIRST, new Integer(TYPE_FIRST));
- xmlTypeMap.put(XML_LAST, new Integer(TYPE_LAST));
- xmlTypeMap.put(XML_BEFORE, new Integer(TYPE_BEFORE));
- xmlTypeMap.put(XML_AFTER, new Integer(TYPE_AFTER));
- }
-
- private int type;
- private String segment;
-
- /**
- * Create a new Position
object with the specified type.
- * Since any type except for {@link #XML_FIRST first} and {@link #XML_LAST last}
- * must be combined with a segment, only the mentioned types are valid
- * arguments.
- *
- * @param type {@link #XML_FIRST first} or {@link #XML_LAST last}
- * @throws IllegalArgumentException if the given type is other than {@link #XML_FIRST}
- * or {@link #XML_LAST}.
- */
- public Position(String type) {
- if (!(XML_FIRST.equals(type) || XML_LAST.equals(type))) {
- throw new IllegalArgumentException("If type is other than 'first' or 'last' a segment must be specified");
- }
- setType(type);
- }
-
- /**
- * Create a new Position
object from the specified position
- * element. The element must fulfill the following structure:
- *
- * <!ELEMENT position (first | last | before | after) >
- * <!ELEMENT segment (#PCDATA) >
- * <!ELEMENT first EMPTY >
- * <!ELEMENT last EMPTY >
- * <!ELEMENT before segment >
- * <!ELEMENT after segment >
- *
- *
- * @param position Xml element defining the position.
- * @throws IllegalArgumentException if the given Xml element is not valid.
- */
- public Position(Element position) {
- if (position.getChildren().size() != 1) {
- throw new IllegalArgumentException("The 'position' element must contain exactly a single child indicating the type.");
- }
- Element typeElem = (Element)position.getChildren().get(0);
- String type = typeElem.getName();
- String segmentText = null;
- if (typeElem.getChildren().size() > 0) {
- segmentText = typeElem.getChildText(XML_SEGMENT);
- }
- init(type, segmentText);
- }
-
- /**
- * Create a new Position
object with the specified type and
- * segment.
- *
- * @param type
- * @param segment
- * @throws IllegalArgumentException if the specified type and segment do not
- * form a valid pair.
- */
- public Position(String type, String segment) {
- init(type, segment);
- }
-
- /**
- * Initialize the internal fields.
- *
- * @param type
- * @param segment
- */
- private void init(String type, String segment) {
- if ((XML_AFTER.equals(type) || XML_BEFORE.equals(type)) && (segment == null || "".equals(segment))) {
- throw new IllegalArgumentException("If type is other than 'first' or 'last' a segment must be specified");
- }
- setType(type);
- this.segment = segment;
- }
-
- /**
- * Return the type of this Position
object, which may be any
- * of the following valid types: {@link #XML_FIRST first},
- * {@link #XML_LAST last}, {@link #XML_AFTER after}, {@link #XML_BEFORE before}
- *
- * @return type
- */
- public int getType() {
- return type;
- }
-
- /**
- * Set the type.
- *
- * @param xmlType
- */
- private void setType(String xmlType) {
- type = ((Integer)xmlTypeMap.get(xmlType)).intValue();
- }
-
- /**
- * Returns the segment used to create this Position
object or
- * null
if no segment is present with the type.
- *
- * @return segment or null
- * @see #getType()
- */
- public String getSegment() {
- return segment;
- }
-}
\ No newline at end of file
diff --git a/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/ordering/package.html b/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/ordering/package.html
deleted file mode 100644
index d59cfbeb8d6..00000000000
--- a/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/ordering/package.html
+++ /dev/null
@@ -1,5 +0,0 @@
-
-Contains interfaces and classes used to cover the functionality defined by the
-RFC 3648: Web Distributed Authoring
-and Versioning (WebDAV) Ordered Collections Protocol .
-
\ No newline at end of file
diff --git a/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/property/AbstractDavProperty.java b/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/property/AbstractDavProperty.java
deleted file mode 100644
index 80da6498fd9..00000000000
--- a/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/property/AbstractDavProperty.java
+++ /dev/null
@@ -1,139 +0,0 @@
-/*
- * 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.property;
-
-import org.apache.log4j.Logger;
-import org.jdom.Element;
-
-import java.util.Arrays;
-import java.util.List;
-
-/**
- * AbstractDavProperty
provides generic METHODS used by various
- * implementations of the {@link DavProperty} interface.
- */
-public abstract class AbstractDavProperty implements DavProperty {
-
- private static Logger log = Logger.getLogger(AbstractDavProperty.class);
-
- private final DavPropertyName name;
- private final boolean isProtected;
-
- /**
- * Create a new AbstractDavProperty
with the given {@link DavPropertyName}
- * and a boolean flag indicating whether this property is protected.
- *
- * @param name
- * @param isProtected
- */
- public AbstractDavProperty(DavPropertyName name, boolean isProtected) {
- this.name = name;
- this.isProtected = isProtected;
- }
-
- /**
- * Computes the hash code using this propertys name and value.
- *
- * @return the hash code
- */
- public int hashCode() {
- int hashCode = getName().hashCode();
- if (getValue() != null) {
- hashCode += getValue().hashCode();
- }
- return hashCode % Integer.MAX_VALUE;
- }
-
- /**
- * Checks if this property has the same {@link DavPropertyName name}
- * and value as the given one.
- *
- * @param obj the object to compare to
- * @return true
if the 2 objects are equal;
- * false
otherwise
- */
- public boolean equals(Object obj) {
- if (obj instanceof DavProperty) {
- DavProperty prop = (DavProperty) obj;
- boolean equalName = getName().equals(prop.getName());
- boolean equalValue = (getValue() == null) ? prop.getValue() == null : getValue().equals(prop.getValue());
- return equalName && equalValue;
- }
- return false;
- }
-
-
- /**
- * Return a JDOM element representation of this property. The value of the
- * property will be added as text or as child element.
- *
- * new DavProperty("displayname", "WebDAV Directory").toXml()
- * gives a element like:
- * <D:displayname>WebDAV Directory</D:displayname>
- *
- * new DavProperty("resourcetype", new Element("collection")).toXml()
- * gives a element like:
- * <D:resourcetype><D:collection/></D:resourcetype>
- *
- * Element[] customVals = { new Element("bla", customNamespace), new Element("bli", customNamespace) };
- * new DavProperty("custom-property", customVals, customNamespace).toXml()
- * gives an element like
- * <Z:custom-property>
- * <Z:bla/>
- * <Z:bli/>
- * </Z:custom-property>
- *
- *
- * @return a JDOM element of this property
- * @see DavProperty#toXml()
- */
- public Element toXml() {
- Element elem = getName().toXml();
- Object value = getValue();
- if (value != null) {
- if (value instanceof Element) {
- elem.addContent((Element) value);
- } else if (value instanceof Element[]) {
- elem.addContent(Arrays.asList((Element[])value));
- } else if (value instanceof List) {
- elem.addContent((List)value);
- } else {
- elem.setText(value.toString());
- }
- }
- return elem;
- }
-
- /**
- * Returns the name of this property.
- *
- * @return name
- * @see DavProperty#getName()
- */
- public DavPropertyName getName() {
- return name;
- }
-
- /**
- * Returns true if this property is protected or computed.
- *
- * @return true if this is a protected (or computed) property.
- * @see org.apache.jackrabbit.webdav.property.DavProperty#isProtected()
- */
- public boolean isProtected() {
- return isProtected;
- }
-}
\ No newline at end of file
diff --git a/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/property/DavProperty.java b/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/property/DavProperty.java
deleted file mode 100644
index 700dc790feb..00000000000
--- a/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/property/DavProperty.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * 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.property;
-
-import org.jdom.Element;
-import org.apache.jackrabbit.webdav.DavConstants;
-
-/**
- * The Property
class represents a Property of a WebDAV
- * resource. The {@link #hashCode()} and {@link #equals(Object)} METHODS are
- * overridden in a way, that the name and value of the property are
- * respected. this means, an property is equal to another, if the names
- * and values are equal.
- */
-public interface DavProperty extends DavConstants {
-
- /**
- * Return a JDOM element representation of this property. The value of the
- * property will be added as text or as child element.
- *
- * new DavProperty("displayname", "WebDAV Directory").toXml()
- * gives a element like:
- * <D:displayname>WebDAV Directory</D:displayname>
- *
- * new DavProperty("resourcetype", new Element("collection")).toXml()
- * gives a element like:
- * <D:resourcetype><D:collection/></D:resourcetype>
- *
- * Element[] customVals = { new Element("bla", customNamespace), new Element("bli", customNamespace) };
- * new DavProperty("custom-property", customVals, customNamespace).toXml()
- * gives an element like
- * <Z:custom-property>
- * <Z:bla/>
- * <Z:bli/>
- * </Z:custom-property>
- *
- *
- * @return a JDOM element of this property
- */
- public Element toXml();
-
- /**
- * Returns the name of this property
- *
- * @return the name of this property
- */
- public DavPropertyName getName();
-
- /**
- * Returns the value of this property
- *
- * @return the value of this property
- */
- public Object getValue();
-
- /**
- * Return true if this property is protected. A protected property
- * will not be returned in a {@link DavConstants#PROPFIND_ALL_PROP DAV:allprop}
- * PROPFIND request and cannot be set/removed with a PROPPATCH request.
- *
- * @return true, if this property is protected.
- */
- public boolean isProtected();
-}
diff --git a/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/property/DavPropertyIterator.java b/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/property/DavPropertyIterator.java
deleted file mode 100644
index 042836220d7..00000000000
--- a/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/property/DavPropertyIterator.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * 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.property;
-
-import java.util.Iterator;
-import java.util.NoSuchElementException;
-
-/**
- * The DavPropertyIterator
extends the Iterator
by
- * a property specific next()
method.
- */
-public interface DavPropertyIterator extends Iterator {
- /**
- * Returns the next Property
in the interation.
- *
- * @return the next Property
in the iteration.
- * @throws java.util.NoSuchElementException if iteration has no more elements.
- */
- public DavProperty nextProperty() throws NoSuchElementException;
-}
diff --git a/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/property/DavPropertyName.java b/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/property/DavPropertyName.java
deleted file mode 100644
index 97b36529c02..00000000000
--- a/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/property/DavPropertyName.java
+++ /dev/null
@@ -1,197 +0,0 @@
-/*
- * 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.property;
-
-import org.jdom.Namespace;
-import org.jdom.Element;
-import org.apache.jackrabbit.webdav.DavConstants;
-
-import java.util.HashMap;
-
-/**
- * The DavPropertyName
class reflects a Webdav property name. It
- * holds together the actualy name of the property and its namespace.
- */
-public class DavPropertyName implements DavConstants {
-
- /** internal 'cache' of created property names */
- private static final HashMap cache = new HashMap();
-
- /* some standard webdav property (that have #PCDATA) */
- public static final DavPropertyName CREATIONDATE = DavPropertyName.create(PROPERTY_CREATIONDATE);
- public static final DavPropertyName DISPLAYNAME = DavPropertyName.create(PROPERTY_DISPLAYNAME);
- public static final DavPropertyName GETCONTENTLANGUAGE = DavPropertyName.create(PROPERTY_GETCONTENTLANGUAGE);
- public static final DavPropertyName GETCONTENTLENGTH = DavPropertyName.create(PROPERTY_GETCONTENTLENGTH);
- public static final DavPropertyName GETCONTENTTYPE = DavPropertyName.create(PROPERTY_GETCONTENTTYPE);
- public static final DavPropertyName GETETAG = DavPropertyName.create(PROPERTY_GETETAG);
- public static final DavPropertyName GETLASTMODIFIED = DavPropertyName.create(PROPERTY_GETLASTMODIFIED);
-
- /* some standard webdav property (that have other elements) */
- public static final DavPropertyName LOCKDISCOVERY = DavPropertyName.create(PROPERTY_LOCKDISCOVERY);
- public static final DavPropertyName RESOURCETYPE = DavPropertyName.create(PROPERTY_RESOURCETYPE);
- public static final DavPropertyName SOURCE = DavPropertyName.create(PROPERTY_SOURCE);
- public static final DavPropertyName SUPPORTEDLOCK = DavPropertyName.create(PROPERTY_SUPPORTEDLOCK);
-
- /* property use by microsoft that are not specified in the RFC 2518 */
- public static final DavPropertyName ISCOLLECTION = DavPropertyName.create("iscollection");
-
- /** the name of the property */
- private final String name;
-
- /** the namespace of the property */
- private final Namespace namespace;
-
- /**
- * Creates a new DavPropertyName
with the given name and
- * Namespace.
- *
- * @param name The local name of the new property name
- * @param namespace The namespace of the new property name
- *
- * @return The WebDAV property name
- */
- public synchronized static DavPropertyName create(String name, Namespace namespace) {
-
- // get (or create) map for the given namespace
- HashMap map = (HashMap) cache.get(namespace);
- if (map == null) {
- map = new HashMap();
- cache.put(namespace, map);
- }
- // get (or create) property name object
- DavPropertyName ret = (DavPropertyName) map.get(name);
- if (ret == null) {
- if (namespace.equals(NAMESPACE)) {
- // ensure prefix for default 'DAV:' namespace
- namespace = NAMESPACE;
- }
- ret = new DavPropertyName(name, namespace);
- map.put(name, ret);
- }
- return ret;
- }
-
- /**
- * Creates a new DavPropertyName
with the given local name
- * and the default WebDAV {@link DavConstants#NAMESPACE namespace}.
- *
- * @param name The local name of the new property name
- *
- * @return The WebDAV property name
- */
- public synchronized static DavPropertyName create(String name) {
- return create(name, NAMESPACE);
- }
-
- /**
- * Create a new DavPropertyName
with the name and namespace
- * of the given Xml element.
- *
- * @param nameElement
- * @return DavPropertyName
instance
- */
- public synchronized static DavPropertyName createFromXml(Element nameElement) {
- if (nameElement == null) {
- throw new IllegalArgumentException("Cannot build DavPropertyName from a 'null' element.");
- }
- Namespace ns = nameElement.getNamespace();
- if (ns == null) {
- return create(nameElement.getName());
- } else {
- return create(nameElement.getName(), ns);
- }
- }
-
- /**
- * Creates a new DavPropertyName
with the given name and
- * Namespace.
- *
- * @param name The local name of the new property name
- * @param namespace The namespace of the new property name
- */
- private DavPropertyName(String name, Namespace namespace) {
- if (name == null || namespace == null) {
- throw new IllegalArgumentException("Name and namespace must not be 'null' for a DavPropertyName.");
- }
- this.name = name;
- this.namespace = namespace;
- }
-
- /**
- * Return the name of this DavPropertyName
.
- *
- * @return name
- */
- public String getName() {
- return name;
- }
-
- /**
- * Return the namespace of this DavPropertyName
.
- *
- * @return namespace
- */
- public Namespace getNamespace() {
- return namespace;
- }
-
-
- /**
- * Computes the hash code using this propertys name and namespace.
- *
- * @return the hash code
- */
- public int hashCode() {
- return (name.hashCode() + namespace.hashCode()) % Integer.MAX_VALUE;
- }
-
- /**
- * Checks if this property has the same name and namespace as the
- * given one.
- *
- * @param obj the object to compare to
- *
- * @return true
if the 2 objects are equal;
- * false
otherwise
- */
- public boolean equals(Object obj) {
- if (obj instanceof DavPropertyName) {
- DavPropertyName propName = (DavPropertyName) obj;
- return name.equals(propName.name) && namespace.equals(propName.namespace);
- }
- return false;
- }
-
- /**
- * Returns a string representation of this property suitable for debugging
- *
- * @return a human readable string representation
- */
- public String toString() {
- return "{" + namespace.getURI() + "}" + name;
- }
-
- /**
- * Creates a JDOM element with the name and namespace of this
- * DavPropertyName.
- *
- * @return A JDOM Element.
- */
- public Element toXml() {
- return new Element(name, namespace);
- }
-}
-
diff --git a/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/property/DavPropertyNameSet.java b/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/property/DavPropertyNameSet.java
deleted file mode 100644
index 50e52fd4220..00000000000
--- a/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/property/DavPropertyNameSet.java
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
- * 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.property;
-
-import org.apache.log4j.Logger;
-import org.apache.jackrabbit.webdav.DavConstants;
-import org.jdom.Element;
-
-import java.util.HashSet;
-import java.util.Collection;
-import java.util.List;
-
-/**
- * DavPropertyNameSet
represents a Set of {@link DavPropertyName}
- * objects.
- */
-public class DavPropertyNameSet extends HashSet {
-
- private static Logger log = Logger.getLogger(DavPropertyNameSet.class);
-
- /**
- * Create a new empty set.
- * @see HashSet()
- */
- public DavPropertyNameSet() {
- super();
- }
-
- /**
- * Create a new set from the given collection.
- * @param c
- * @see HashSet(Collection)
- */
- public DavPropertyNameSet(Collection c) {
- super(c);
- }
-
- /**
- * Create a new DavPropertyNameSet
from the given DAV:prop
- * element.
- *
- * @param propElement
- * @throws IllegalArgumentException if the specified element is null
- * or is not a DAV:prop element.
- */
- public DavPropertyNameSet(Element propElement) {
- super();
- if (propElement == null || !propElement.getName().equals(DavConstants.XML_PROP)) {
- throw new IllegalArgumentException("'DAV:prop' element expected.");
- }
-
- // fill the set
- List props = propElement.getChildren();
- for (int j = 0; j < props.size(); j++) {
- Element prop = (Element) props.get(j);
- String propName = prop.getName();
- if (propName != null && !"".equals(propName)) {
- add(DavPropertyName.create(propName, prop.getNamespace()));
- }
- }
- }
-
- /**
- * Adds the specified {@link DavPropertyName} object to this
- * set if it is not already present.
- *
- * @param propertyName element to be added to this set.
- * @return true if the set did not already contain the specified
- * element.
- */
- public boolean add(DavPropertyName propertyName) {
- return super.add(propertyName);
- }
-
- /**
- * Add the given object to this set. In case the object is not a {@link DavPropertyName}
- * this method returns false.
- *
- * @param o
- * @return true if adding the object was successful.
- * @see #add(DavPropertyName)
- */
- public boolean add(Object o) {
- if (o instanceof DavPropertyName) {
- return add((DavPropertyName) o);
- } else {
- return false;
- }
- }
-}
\ No newline at end of file
diff --git a/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/property/DavPropertySet.java b/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/property/DavPropertySet.java
deleted file mode 100644
index b48fa113ce2..00000000000
--- a/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/property/DavPropertySet.java
+++ /dev/null
@@ -1,271 +0,0 @@
-/*
- * 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.property;
-
-import org.jdom.Namespace;
-import org.apache.jackrabbit.webdav.DavConstants;
-
-import java.util.*;
-
-/**
- * The DavPropertySet
class represents a set of WebDAV
- * property.
- */
-public class DavPropertySet {
-
- /**
- * the set of property
- */
- private final HashMap map = new HashMap();
-
- /**
- * Adds a new property to this set.
- *
- * @param property The property to add
- *
- * @return The previously assigned property or null
.
- */
- public DavProperty add(DavProperty property) {
- return (DavProperty) map.put(property.getName(), property);
- }
-
- /**
- *
- * @param pset Properties to add
- */
- public void addAll(DavPropertySet pset) {
- map.putAll(pset.map);
- }
-
- /**
- * Retrieves the property with the specified name
and the
- * default WebDAV {@link org.apache.jackrabbit.webdav.DavConstants#NAMESPACE namespace}.
- *
- * @param name The name of the property to retrieve
- *
- * @return The desired property or null
- */
- public DavProperty get(String name) {
- return get(DavPropertyName.create(name));
- }
-
- /**
- * Retrieves the property with the specified name
and
- * namespace
.
- *
- * @param name The name of the property to retrieve
- * @param namespace The namespace of the property to retrieve
- *
- * @return The desired property or null
- */
- public DavProperty get(String name, Namespace namespace) {
- return get(DavPropertyName.create(name, namespace));
- }
-
- /**
- * Retrieves the property with the specified name
- *
- * @param name The webdav property name of the property to retrieve
- *
- * @return The desired property or null
- */
- public DavProperty get(DavPropertyName name) {
- return (DavProperty) map.get(name);
- }
-
-
- /**
- * Removes the indicated property from this set.
- *
- * @param name The webdav property name to remove
- *
- * @return The removed property or null
- */
- public DavProperty remove(DavPropertyName name) {
- return (DavProperty) map.remove(name);
- }
-
- /**
- * Removes the property with the specified name
and the
- * default WebDAV {@link org.apache.jackrabbit.webdav.DavConstants#NAMESPACE namespace}.
- *
- * @param name The name of the property to remove
- *
- * @return The removed property or null
- */
- public DavProperty remove(String name) {
- return remove(DavPropertyName.create(name));
- }
-
- /**
- * Removes the property with the specified name
and
- * namespace
from this set.
- *
- * @param name The name of the property to remove
- * @param namespace The namespace of the property to remove
- *
- * @return The removed property or null
- */
- public DavProperty remove(String name, Namespace namespace) {
- return remove(DavPropertyName.create(name, namespace));
- }
-
- /**
- * Returns an iterator over all property in this set.
- *
- * @return An iterator over {@link DavProperty}.
- */
- public DavPropertyIterator iterator() {
- return new PropIter();
- }
-
- /**
- * Returns an iterator over all those property in this set, that have the
- * indicated namespace
.
- *
- * @param namespace The namespace of the property in the iteration.
- *
- * @return An iterator over {@link DavProperty}.
- */
- public DavPropertyIterator iterator(Namespace namespace) {
- return new PropIter(namespace);
- }
-
- /**
- * Checks if this set contains the property with the specified name.
- *
- * @param name The name of the property
- *
- * @return true
if this set contains the property;
- * false
otherwise.
- */
- public boolean contains(DavPropertyName name) {
- return map.containsKey(name);
- }
-
- /**
- * Checks if this set contains the property with the specified name and the
- * default WebDAV {@link org.apache.jackrabbit.webdav.DavConstants#NAMESPACE namespace}.
- *
- * @param name The name of the property
- *
- * @return true
if this set contains the property;
- * false
otherwise.
- */
- public boolean contains(String name) {
- return contains(DavPropertyName.create(name, DavConstants.NAMESPACE));
- }
-
- /**
- * Return true if this property set is empty.
- *
- * @return true if the internal map contains no elements.
- */
- public boolean isEmpty() {
- return map.isEmpty();
- }
-
- /**
- * Return the names of all properties present in this set.
- *
- * @return array of {@link DavPropertyName property names} present in this set.
- */
- public DavPropertyName[] getPropertyNames() {
- Set keySet = map.keySet();
- return (DavPropertyName[]) keySet.toArray(new DavPropertyName[keySet.size()]);
- }
-
- //---------------------------------------------------------- Inner class ---
- /**
- * Implementation of a DavPropertyIterator that returns webdav property.
- * Additionally, it can only return property with the given namespace.
- */
- private class PropIter implements DavPropertyIterator {
-
- /** the namespace to match agains */
- private final Namespace namespace;
-
- /** the internal iterator */
- private final Iterator iterator;
-
- /** the next property to return */
- private DavProperty next;
-
- /**
- * Creates a new property iterator.
- */
- private PropIter() {
- this(null);
- }
-
- /**
- * Creates a new iterator with the given namespace
- * @param namespace The namespace to match against
- */
- private PropIter(Namespace namespace) {
- this.namespace = namespace;
- iterator = map.values().iterator();
- seek();
- }
-
- /**
- * @see DavPropertyIterator#nextProperty();
- */
- public DavProperty nextProperty() throws NoSuchElementException {
- if (next==null) {
- throw new NoSuchElementException();
- }
- DavProperty ret = next;
- seek();
- return ret;
- }
-
- /**
- * @see DavPropertyIterator#hasNext();
- */
- public boolean hasNext() {
- return next!=null;
- }
-
- /**
- * @see DavPropertyIterator#next();
- */
- public Object next() {
- return nextProperty();
- }
-
- /**
- * @see DavPropertyIterator#remove();
- */
- public void remove() {
- throw new UnsupportedOperationException();
- }
-
- /**
- * Seeks for the next valid property
- */
- private void seek() {
- while (iterator.hasNext()) {
- next = (DavProperty) iterator.next();
- if (namespace == null || namespace.equals(next.getName().getNamespace())) {
- return;
- }
- }
- next = null;
- }
- }
-}
-
diff --git a/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/property/DefaultDavProperty.java b/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/property/DefaultDavProperty.java
deleted file mode 100644
index ff533d5a741..00000000000
--- a/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/property/DefaultDavProperty.java
+++ /dev/null
@@ -1,140 +0,0 @@
-/*
- * 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.property;
-
-import org.apache.log4j.Logger;
-import org.jdom.Namespace;
-import org.jdom.Element;
-import org.jdom.Content;
-import org.jdom.Text;
-
-/**
- * DefaultDavProperty
...
- */
-public class DefaultDavProperty extends AbstractDavProperty {
-
- private static Logger log = Logger.getLogger(DefaultDavProperty.class);
-
- /**
- * the value of the property
- */
- private final Object value;
-
- /**
- * Creates a new WebDAV property with the given namespace, name and value.
- * If the property is intended to be protected the isProtected flag must
- * be set to true.
- *
- * @param name the name of the property
- * @param value the value of the property
- * @param namespace the namespace of the property
- * @param isProtected A value of true, defines this property to be protected.
- * It will not be returned in a {@link org.apache.jackrabbit.webdav.DavConstants#PROPFIND_ALL_PROP DAV:allprop}
- * PROPFIND request and cannot be set/removed with a PROPPATCH request.
- */
- public DefaultDavProperty(String name, Object value, Namespace namespace, boolean isProtected) {
- super(DavPropertyName.create(name, namespace), isProtected);
- this.value = value;
- }
-
- /**
- * Creates a new non-protected WebDAV property with the given namespace, name
- * and value.
- *
- * @param name the name of the property
- * @param value the value of the property
- * @param namespace the namespace of the property
- */
- public DefaultDavProperty(String name, Object value, Namespace namespace) {
- this(name, value, namespace, false);
- }
-
- /**
- * Creates a new WebDAV property with the given DavPropertyName
- * and value. If the property is meant to be protected the 'isProtected'
- * flag must be set to true.
- *
- * @param name the name of the property
- * @param value the value of the property
- * @param isProtected A value of true, defines this property to be protected.
- * It will not be returned in a {@link org.apache.jackrabbit.webdav.DavConstants#PROPFIND_ALL_PROP DAV:allprop}
- * PROPFIND request and cannot be set/removed with a PROPPATCH request.
- */
- public DefaultDavProperty(DavPropertyName name, Object value, boolean isProtected) {
- super(name, isProtected);
- this.value = value;
- }
-
- /**
- * Creates a new non- protected WebDAV property with the given
- * DavPropertyName
and value.
- *
- * @param name the name of the property
- * @param value the value of the property
- */
- public DefaultDavProperty(DavPropertyName name, Object value) {
- this(name, value, false);
- }
-
- /**
- * Returns the value of this property
- *
- * @return the value of this property
- */
- public Object getValue() {
- return value;
- }
-
- /**
- * Create a new DefaultDavProperty
instance from the given Xml
- * element. Name and namespace of the element are building the {@link DavPropertyName},
- * while the element's content forms the property value. The following logic
- * is applied:
- *
- * - empty Element -> null
value
- * - single Text content -> String
value
- * - single non-Text content -> Element.getContent(0) is used as value
- * - other: List obtained from Element.getContent() is used as value
- *
- *
- * @param propertyElement
- * @return
- */
- public static DefaultDavProperty createFromXml(Element propertyElement) {
- if (propertyElement == null) {
- throw new IllegalArgumentException("Cannot create a new DavProperty from a 'null' element.");
- }
- DavPropertyName name = DavPropertyName.createFromXml(propertyElement);
- Object value;
- int size = propertyElement.getContentSize();
- switch (size) {
- case 0:
- value = null;
- break;
- case 1:
- Content c = propertyElement.getContent(0);
- if (c instanceof Text) {
- value = ((Text)c).getText();
- } else {
- value = c;
- }
- break;
- default:
- value = propertyElement.getContent();
- }
- return new DefaultDavProperty(name, value, false);
- }
-}
\ No newline at end of file
diff --git a/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/property/HrefProperty.java b/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/property/HrefProperty.java
deleted file mode 100644
index ee9c5c5cbf4..00000000000
--- a/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/property/HrefProperty.java
+++ /dev/null
@@ -1,150 +0,0 @@
-/*
- * 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.property;
-
-import org.apache.log4j.Logger;
-import org.apache.jackrabbit.webdav.util.XmlUtil;
-import org.jdom.Element;
-
-import java.util.List;
-import java.util.Iterator;
-import java.util.ArrayList;
-import java.util.Arrays;
-
-/**
- * HrefProperty
is an extension to the common {@link DavProperty}.
- * The String representation of the property value is always displayed as text
- * inside an extra 'href' element. If the value is a String array each array
- * element is added as text to a separate 'href' element.
- *
- * @see org.apache.jackrabbit.webdav.DavConstants#XML_HREF
- * @see org.apache.jackrabbit.webdav.property.DavProperty#getValue()
- */
-public class HrefProperty extends AbstractDavProperty {
-
- private static Logger log = Logger.getLogger(HrefProperty.class);
-
- private final String[] value;
-
- /**
- * Creates a new WebDAV property with the given DavPropertyName
- *
- * @param name the name of the property
- * @param value the value of the property
- * @param isProtected A value of true, defines this property to be protected.
- * It will not be returned in a {@link org.apache.jackrabbit.webdav.DavConstants#PROPFIND_ALL_PROP DAV:allprop}
- * PROPFIND request and cannot be set/removed with a PROPPATCH request.
- */
- public HrefProperty(DavPropertyName name, String value, boolean isProtected) {
- super(name, isProtected);
- this.value = new String[]{value};
- }
-
- /**
- * Creates a new WebDAV property with the given DavPropertyName
- *
- * @param name the name of the property
- * @param value the value of the property
- * @param isProtected A value of true, defines this property to be protected.
- * It will not be returned in a {@link org.apache.jackrabbit.webdav.DavConstants#PROPFIND_ALL_PROP DAV:allprop}
- * PROPFIND request and cannot be set/removed with a PROPPATCH request.
- */
- public HrefProperty(DavPropertyName name, String[] value, boolean isProtected) {
- super(name, isProtected);
- this.value = value;
- }
-
- /**
- * Create a new HrefProperty
from the specified property.
- * Please note, that the property must have a List
value
- * object, consisting of {@link #XML_HREF href} Element
entries.
- *
- * @param prop
- * @throws IllegalArgumentException if the property {@link DavProperty#getValue() value}
- * is not a List
.
- */
- public HrefProperty(DavProperty prop) {
- super(prop.getName(), prop.isProtected());
- if (! (prop.getValue() instanceof List)) {
- throw new IllegalArgumentException("Expected a property with a List value object.");
- }
- Iterator it = ((List)prop.getValue()).iterator();
- ArrayList hrefList = new ArrayList();
- while (it.hasNext()) {
- Object o = it.next();
- if (o instanceof Element) {
- String href = ((Element)o).getChildText(XML_HREF, NAMESPACE);
- if (href != null) {
- hrefList.add(href);
- } else {
- log.warn("Valid DAV:href element expected instead of " + o.toString());
- }
- } else {
- log.warn("DAV: href element expected in the content of " + getName().toString());
- }
- }
- value = (String[]) hrefList.toArray(new String[hrefList.size()]);
- }
-
- /**
- * Returns an Xml element with the following form:
- *
- * <Z:name>
- * <DAV:href>value</DAV:href/>
- * </Z:name>
- *
- * where Z: represents the prefix of the namespace defined with the initial
- * webdav property name.
- *
- * @return Xml representation
- * @see XmlUtil#hrefToXml(String)
- */
- public Element toXml() {
- Element elem = getName().toXml();
- Object value = getValue();
- if (value != null) {
- if (value instanceof String[]) {
- String[] hrefs = (String[]) value;
- for (int i = 0; i < hrefs.length; i++) {
- elem.addContent(XmlUtil.hrefToXml(hrefs[i]));
- }
- } else {
- elem.addContent(XmlUtil.hrefToXml(value.toString()));
- }
- }
- return elem;
- }
-
- /**
- * Returns an array of String.
- *
- * @return an array of String.
- * @see DavProperty#getValue()
- */
- public Object getValue() {
- return value;
- }
-
- /**
- * Return an array of String containg the text of those DAV:href elements
- * that would be returned as child elements of this property on {@link #toXml()}
- *
- * @return
- */
- public List getHrefs() {
- return (value != null) ? Arrays.asList(value) : new ArrayList();
- }
-}
\ No newline at end of file
diff --git a/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/property/ResourceType.java b/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/property/ResourceType.java
deleted file mode 100644
index 224e9943dde..00000000000
--- a/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/property/ResourceType.java
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- * 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.property;
-
-import org.jdom.Element;
-
-/**
- * The ResourceType
class represents the webdav resource
- * type property. Valid resource types are '{@link #COLLECTION collection}',
- * {@link #DEFAULT_RESOURCE}.
- */
-public class ResourceType extends AbstractDavProperty {
-
- /**
- * The default resource type
- */
- public static final int DEFAULT_RESOURCE = 0;
-
- /**
- * The collection resource type
- */
- public static final int COLLECTION = DEFAULT_RESOURCE + 1;
-
- private int resourceType = DEFAULT_RESOURCE;
-
- /**
- * Create a resource type property
- */
- public ResourceType(int resourceType) {
- super(DavPropertyName.RESOURCETYPE, false);
- if (!isValidResourceType(resourceType)) {
- throw new IllegalArgumentException("Invalid resource type '"+ resourceType +"'.");
- }
- this.resourceType = resourceType;
- }
-
- /**
- * Return the JDOM element representation of this resource type
- *
- * @return a JDOM element
- */
- public Element toXml() {
- Element elem = getName().toXml();
- if (getValue() != null) {
- elem.addContent((Element)getValue());
- }
- return elem;
- }
-
- /**
- * Returns the Xml representation of this resource type.
- *
- * @return Xml representation of this resource type.
- * @see DavProperty#getValue()
- */
- public Object getValue() {
- return (resourceType == COLLECTION) ? new Element(XML_COLLECTION, NAMESPACE) : null;
- }
-
- /**
- * Returns the resource type specified with the constructor.
- *
- * @return resourceType
- */
- public int getResourceType() {
- return resourceType;
- }
-
- /**
- * Validates the specified resourceType.
- *
- * @param resourceType
- * @return true if the specified resourceType is valid.
- */
- public boolean isValidResourceType(int resourceType) {
- if (resourceType < DEFAULT_RESOURCE || resourceType > COLLECTION) {
- return false;
- }
- return true;
- }
-}
diff --git a/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/property/package.html b/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/property/package.html
deleted file mode 100644
index 5794344d36d..00000000000
--- a/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/property/package.html
+++ /dev/null
@@ -1,3 +0,0 @@
-
-Interfaces and classes related to WebDAV properties.
-
\ No newline at end of file
diff --git a/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/search/QueryGrammerSet.java b/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/search/QueryGrammerSet.java
deleted file mode 100644
index 252d808b878..00000000000
--- a/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/search/QueryGrammerSet.java
+++ /dev/null
@@ -1,111 +0,0 @@
-/*
- * 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;
-
-/**
- * QueryGrammerSet
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 QueryGrammerSet
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
diff --git a/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/search/SearchConstants.java b/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/search/SearchConstants.java
deleted file mode 100644
index fe2ef5451fe..00000000000
--- a/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/search/SearchConstants.java
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * 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;
-
-/**
- * SearchConstants
interface provide constants for request
- * and response headers, Xml elements and property names used for WebDAV
- * search.
- */
-public interface SearchConstants {
-
- /**
- * Namespace definition.
- * 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
- * Internet Draft WebDAV Search
- * 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:
- *
- * <!ELEMENT supported-query-grammar-set (supported-query-grammar*)>
- * <!ELEMENT supported-query-grammar grammar>
- * <!ELEMENT grammar ANY>
- *
- */
- public static final DavPropertyName QUERY_GRAMMER_SET = DavPropertyName.create("supported-query-grammar-set", NAMESPACE);
-}
\ No newline at end of file
diff --git a/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/search/SearchRequest.java b/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/search/SearchRequest.java
deleted file mode 100644
index 1aa792fea07..00000000000
--- a/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/search/SearchRequest.java
+++ /dev/null
@@ -1,105 +0,0 @@
-/*
- * 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.*;
-
-/**
- * SearchRequest
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.
- * 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.
- *
- *
- * Example of a valid 'searchrequest' body
- *
- * <d:searchrequest xmlns:d="DAV:" jcr:="http://www.day.com/jcr/webdav/1.0" >
- * <jcr:xpath>//sv:node[@sv:name='myapp:paragraph'][1]</jcr:xpath>
- * </d:searchrequest>
- *
- *
- * Would return the following values:
- *
- * getLanguageName() -> xpath
- * getQuery() -> //sv:node[@sv:name='myapp:paragraph'][1]
- *
- *
- */
-public class SearchRequest implements SearchConstants {
-
- private static Logger log = Logger.getLogger(SearchRequest.class);
-
- private final Element language;
-
- /**
- * Create a new SearchRequest
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 SearchRequest
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
diff --git a/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/search/SearchResource.java b/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/search/SearchResource.java
deleted file mode 100644
index 1ac328f0210..00000000000
--- a/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/search/SearchResource.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * 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;
-
-/**
- * SearchResource
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
- * DavResource.getProperty(SearchConstants.QUERY_GRAMMER_SET)
.
- *
- * @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 SearchRequest
element encapsulating the SEARCH
- * request body.
- * @return MultiStatus
object listing the results.
- * @throws DavException
- */
- public MultiStatus search(SearchRequest sRequest) throws DavException;
-}
\ No newline at end of file
diff --git a/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/search/package.html b/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/search/package.html
deleted file mode 100644
index a42961cb3af..00000000000
--- a/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/search/package.html
+++ /dev/null
@@ -1,5 +0,0 @@
-
-Contains interfaces and classes used to cover the functionality defined by the
-Internet
-Draft WebDAV Search.
-
\ No newline at end of file
diff --git a/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/statuscode.properties b/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/statuscode.properties
deleted file mode 100644
index 94a5e6e40bc..00000000000
--- a/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/statuscode.properties
+++ /dev/null
@@ -1,47 +0,0 @@
-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
diff --git a/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/transaction/TransactionConstants.java b/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/transaction/TransactionConstants.java
deleted file mode 100644
index 5e0ea71d745..00000000000
--- a/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/transaction/TransactionConstants.java
+++ /dev/null
@@ -1,141 +0,0 @@
-/*
- * 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;
-
-/**
- * TransactionConstants
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
- * 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
- * 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
- * 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
- * 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
- * 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
- * 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
- * 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
diff --git a/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/transaction/TransactionDavServletRequest.java b/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/transaction/TransactionDavServletRequest.java
deleted file mode 100644
index 22cc8c68584..00000000000
--- a/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/transaction/TransactionDavServletRequest.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * 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;
-
-/**
- * TransactionDavServletRequest
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) null
is returned.
- *
- * @return TransactionInfo
object encapsulating the 'transactioninfo'
- * Xml element present in the request body or 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 null
.
- */
- public String getTransactionId();
-}
\ No newline at end of file
diff --git a/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/transaction/TransactionInfo.java b/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/transaction/TransactionInfo.java
deleted file mode 100644
index d35a4b4d41a..00000000000
--- a/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/transaction/TransactionInfo.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- * 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;
-
-/**
- * TransactionInfo
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 TransactionInfo
object from the given 'transactionInfo'
- * element. The 'transactionInfo' must have the following form:
- *
- *
- * <!ELEMENT transactioninfo (transactionstatus) >
- * <!ELEMENT transactionstatus ( commit | rollback ) >
- * <!ELEMENT commit EMPTY >
- * <!ELEMENT rollback EMPTY >
- *
- * @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
diff --git a/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/transaction/TxLockEntry.java b/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/transaction/TxLockEntry.java
deleted file mode 100644
index 0fb612b28e3..00000000000
--- a/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/transaction/TxLockEntry.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * 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;
-
-/**
- * TxLockEntry
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
diff --git a/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/transaction/TxLockManager.java b/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/transaction/TxLockManager.java
deleted file mode 100644
index c9eff6a161b..00000000000
--- a/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/transaction/TxLockManager.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * 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.*;
-
-/**
- * TxLockManager
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 null
- *
- * @param type
- * @param scope
- * @param resource
- * @return lock applied to the given resource or null
- * @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);
-
-
-}
diff --git a/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/transaction/package.html b/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/transaction/package.html
deleted file mode 100644
index a552dc6ab13..00000000000
--- a/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/transaction/package.html
+++ /dev/null
@@ -1,3 +0,0 @@
-
-Contains interfaces and classes related to transaction locks.
-
\ No newline at end of file
diff --git a/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/util/Text.java b/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/util/Text.java
deleted file mode 100644
index 4c7e07c2de2..00000000000
--- a/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/util/Text.java
+++ /dev/null
@@ -1,2042 +0,0 @@
-/*
- * 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.util;
-
-import java.io.ByteArrayOutputStream;
-import java.io.UnsupportedEncodingException;
-import java.math.BigDecimal;
-import java.security.NoSuchAlgorithmException;
-import java.text.ParseException;
-import java.text.SimpleDateFormat;
-import java.util.*;
-
-/**
- * This class holds a collection of string utility operations.
- */
-public final class Text extends org.apache.jackrabbit.core.util.Text {
-
- /**
- * The default format pattern used in strftime() if no pattern
- * parameter has been supplied. This is the default format used to format
- * dates in Communiqué 2
- */
- public static final String DEFAULT_DATE_FORMAT_PATTERN = "dd.MM.yyyy HH:mm:ss";
-
- /**
- * Common used DateFormat implementation. When the supplied formatting
- * pattern has been translated it is applied to this formatter and then
- * executed. Both steps occur in a synchronized section, such that no
- * two threads disturb each other.
- *
- * - A single instance of the formatter is used to prevent the object
- * creation overhead. But then how much is this ?
- *
- Using one static formatter for each thread may prove to give even
- * more overhead given all those synchronized blocks waiting for each
- * other during real formatting. But then how knows ?
- *
- *
- * This formatter must always be used synchronized as follows :
- *
- synchronized (dateFormatter) {
- dateFormatter.applyPattern( ... );
- dateFormatter.setTimezone( ... );
- String result = dateFormatter.format( ... );
- }
- *
- *
- * To parse date and time strings , the formatter is used as follows :
- *
- synchronized (dateFormatter) {
- dateFormatter.applyPattern( ... );
- dateFormatter.setTimezone( ... );
- try {
- Date result = dateFormatter.parse(dateString);
- } catch (ParseException pe) {
- // handle exception
- }
- }
- *
- *
- */
- private static final SimpleDateFormat dateFormatter = new SimpleDateFormat();
-
- /**
- * The UTC timezone
- */
- public static final TimeZone TIMEZONE_UTC = TimeZone.getTimeZone("UTC");
-
- /** format for RFC 1123 date string -- "Sun, 06 Nov 1994 08:49:37 GMT" */
- private final static SimpleDateFormat rfc1123Format =
- new SimpleDateFormat("EEE, dd MMM yyyyy HH:mm:ss z", Locale.US);
-
- static {
- rfc1123Format.setTimeZone(TIMEZONE_UTC);
- }
-
- /**
- * The local timezone
- */
- public static final TimeZone TIMEZONE_LOCAL = TimeZone.getDefault();
-
- /**
- * Empty result
- */
- private final static String[] empty = new String[0];
-
- /**
- * avoid instantiation
- */
- private Text() {
- }
-
- /**
- * returns an array of strings decomposed of the original string, split at
- * every occurance of 'ch'. if 2 'ch' follow each other with no intermediate
- * characters, empty "" entries are avoided.
- *
- * @param str the string to decompose
- * @param ch the character to use a split pattern
- * @return an array of strings
- */
- public static String[] explode(String str, int ch) {
- return explode(str,ch,false);
- }
-
- /**
- * returns an array of strings decomposed of the original string, split at
- * every occurance of 'ch'.
- * @param str the string to decompose
- * @param ch the character to use a split pattern
- * @param respectEmpty if true
, empty elements are generated
- * @return an array of strings
- */
- public static String[] explode(String str, int ch, boolean respectEmpty) {
- if (str == null) {
- return empty;
- }
-
- Vector strings = new Vector();
- int pos = 0;
- int lastpos = 0;
-
- // add snipples
- while ((pos = str.indexOf(ch, lastpos)) >= 0) {
- if (pos-lastpos>0 || respectEmpty)
- strings.add(str.substring(lastpos, pos));
- lastpos = pos+1;
- }
- // add rest
- if (lastpos < str.length()) {
- strings.add(str.substring(lastpos));
- } else if (respectEmpty && lastpos==str.length()) {
- strings.add("");
- }
-
- // return stringarray
- return (String[]) strings.toArray(new String[strings.size()]);
- }
-
- public static String implode(String[] arr, String delim) {
- StringBuffer buf = new StringBuffer();
- for (int i=0; i0) {
- buf.append(delim);
- }
- buf.append(arr[i]);
- }
- return buf.toString();
- }
-
- /**
- * compares to handles lexigographically with one exception: the '/'
- * character is always considered smaller than all other chars. this results
- * in a ordering, in which the parent pages come first (it's about 6 times
- * slower than the string impl. of compareTo).
- * example (normal string compare):
- * - /foo
- *
- /foo-bar
- *
- /foo/bar
- *
- * example (this handle compare):
- * - /foo
- *
- /foo/bar
- * - /foo-bar
- *
- *
- * @param h1 the first handle
- * @param h2 the second handle
- * @return the return is positive, if the first handle is bigger than the
- * second; negative, if the first handle is smaller than the second;
- * and zero, if the two handles are equal.
- */
- public static int comparePaths(String h1, String h2) {
- char[] ca1=h1.toCharArray(); // this is faster, than a .charAt everytime
- char[] ca2=h2.toCharArray();
- int n= ca1.length < ca2.length ? ca1.length : ca2.length;
- int i=0;
- while (iparent as parent directory rather than a base
- * handle. if further respects full qualified uri's.
- *
examples:
- *
- * parent | path | result
- * ----------+----------+------------
- * "" | "" | /
- * /foo | "" | /foo
- * "" | /foo | /foo
- * "." | foo | foo
- * /foo/bar | bla | /foo/bar/bla
- * /foo/bar | /bla | /bla
- * /foo/bar | ../bla | /foo/bla
- * /foo/bar | ./bla | /foo/bar/bla
- * foo | bar | foo/bar
- * c:/bla | gurk | c:/bla/gurk
- * /foo | c:/bar | c:/bar
- *
- *
- * @param parent the base handle
- * @param path the path
- */
- public static String fullFilePath(String parent, String path) {
- if (parent==null) parent="";
- if (path==null) path="";
-
- // compose source string
- StringBuffer source;
- if (path.equals("") || (path.charAt(0)!='/' && path.indexOf(':')<0)) {
- // relative
- source = new StringBuffer(parent);
- if (!path.equals("")) {
- source.append("/./");
- source.append(path);
- }
- } else {
- // absolute
- source = new StringBuffer(path==null?"":path);
- }
- return makeCanonicalPath(source);
- }
-
- /**
- * returns a full path.
- * if base is empty, '/' is assumed
- * if base and path are relative, a relative path will be generated.
- *
examples:
- *
- * base | path | result
- * ----------+----------+------------
- * "" | "" | /
- * /foo | "" | /foo
- * "" | /foo | /foo
- * "." | foo | foo
- * /foo/bar | bla | /foo/bla
- * /foo/bar | /bla | /bla
- * /foo/bar | ../bla | /bla
- * /foo/bar | ./bla | /foo/bla
- * foo | bar | bar
- *
- *
- * @param base the base handle
- * @param path the path
- */
- public static String fullPath(String base, String path) {
- if (base==null) base="";
- if (path==null) path="";
-
- // compose source string
- StringBuffer source;
- if (path.equals("") || path.charAt(0)!='/') {
- // relative
- source = new StringBuffer(base);
- if (!path.equals("")) {
- source.append("/../");
- source.append(path);
- }
- } else {
- // absolute
- source = new StringBuffer(path==null?"":path);
- }
- return makeCanonicalPath(source);
- }
-
- /**
- * Make a path canonical. This is a shortcut for
- *
- * Text.makeCanonicalPath(new StringBuffer(path));
- *
- * @param path path to make canonical
- */
- public static String makeCanonicalPath(String path) {
- return makeCanonicalPath(new StringBuffer(path));
- }
-
- /**
- * make a cannonical path. removes all /./ and /../ and multiple slashes.
- * @param source the input source
- * @return a string containing the cannonical path
- */
- public static String makeCanonicalPath(StringBuffer source) {
- // remove/resolve .. and .
- int dst=0, pos=0, slash=0, dots=0, last=0, len=source.length();
- int[] slashes=new int[1024];
- slashes[0]=source.charAt(0)=='/' ? 0 : -1;
- while (pos=0) source.setCharAt(dst, (char) (last=ch));
- dst++;
- }
- // check dots again
- if (dots == 1) {
- dst = slashes[slash];
- } else if (dots == 2) {
- if (slash > 0) {
- slash--;
- }
- dst = slashes[slash];
- }
-
- // truncate result
- if (dst>0) source.setLength(dst);
- return dst==0 ? "/" : source.toString();
- }
-
- /**
- * Determines, if two handles are sister-pages, that meens, if they
- * represent the same hierarchic level and share the same parent page.
- * @param h1 first handle
- * @param h2 second handle
- * @return true if on same level, false otherwise
- */
- public static boolean isSibling(String h1, String h2) {
- int pos1 = h1.lastIndexOf('/');
- int pos2 = h2.lastIndexOf('/');
- return (pos1==pos2 && pos1>=0 && h1.regionMatches(0,h2,0,pos1));
- }
-
- /**
- * Determines if the descendant
handle is hierarchical a
- * descendant of handle
.
- *
- * /content/playground/en isDescendantOf /content/playground
- * /content/playground/en isDescendantOf /content
- * /content/playground/en isNOTDescendantOf /content/designground
- * /content/playground/en isNOTDescendantOf /content/playground/en
- *
- *
- * @param handle the current handle
- * @param descendant the potential descendant
- * @return true
if the descendant
is a descendant;
- * false
otherwise.
- * @since gumbear
- */
- public static boolean isDescendant(String handle, String descendant) {
- return !handle.equals(descendant) &&
- descendant.startsWith(handle) &&
- descendant.charAt(handle.length())=='/';
- }
-
- /**
- * Determines if the descendant
handle is hierarchical a
- * descendant of handle
or equal to it.
- *
- * /content/playground/en isDescendantOrEqualOf /content/playground
- * /content/playground/en isDescendantOrEqualOf /content
- * /content/playground/en isDescendantOrEqualOf /content/playground/en
- * /content/playground/en isNOTDescendantOrEqualOf /content/designground
- *
- *
- * @param path the path to check
- * @param descendant the potential descendant
- * @return true
if the descendant
is a descendant
- * or equal; false
otherwise.
- * @since gumbear
- */
- public static boolean isDescendantOrEqual(String path, String descendant) {
- if (path.equals(descendant)) {
- return true;
- } else {
- String pattern = path.endsWith("/") ? path : path + "/";
- return descendant.startsWith(pattern);
- }
- }
-
- /**
- * Returns the label of a handle
- * @param handle the handle
- * @return the label
- */
- public static String getLabel(String handle) {
- int pos=handle.lastIndexOf('/');
- return pos>=0 ? handle.substring(pos+1) : "";
- }
-
- /**
- * Returns the label of a string
- * @param handle the string
- * @param delim the delimiter
- * @return the label
- */
- public static String getLabel(String handle, char delim) {
- int pos=handle.lastIndexOf(delim);
- return pos>=0 ? handle.substring(pos+1) : "";
- }
-
- /**
- * Digest the plain string using the given algorithm.
- *
- * @param algorithm The alogrithm for the digest. This algorithm must be
- * supported by the MessageDigest class.
- * @param data The plain text String to be digested.
- *
- * @return The digested plain text String represented as Hex digits.
- *
- * @throws NoSuchAlgorithmException if the desired algorithm is not supported by
- * the MessageDigest class.
- *
- * @deprecated since echidna, use {@link #digest(String, String, String)}
- */
- public static String digest(String algorithm, String data)
- throws NoSuchAlgorithmException {
-
- return digest(algorithm, data.getBytes());
- }
-
- /**
- * Returns the nth relative parent of the handle, where n=level.
- * Example:
- *
- * Text.getRelativeParent("/en/home/index/about", 1) == "/en/home/index"
- *
- *
- * @param handle the handle of the page
- * @param level the level of the parent
- */
- public static String getRelativeParent(String handle, int level) {
- int idx = handle.length();
- while (level > 0) {
- idx = handle.lastIndexOf('/',idx-1);
- if (idx < 0) {
- return "";
- }
- level--;
- }
- return (idx == 0) ? "/" : handle.substring(0,idx);
- }
-
- /**
- * Returns the nth absolute parent of the handle, where n=level.
- *
Example:
- *
- * Text.getAbsoluteParent("/en/home/index/about", 1) == "/en/home"
- *
- *
- * @param handle the handle of the page
- * @param level the level of the parent
- */
- public static String getAbsoluteParent(String handle, int level) {
- int idx = 0;
- int len = handle.length();
- while (level >= 0 && idx=0 ? "" : handle.substring(0,idx);
- }
-
- /**
- * The list of characters that are not encoded by the escape()
- * and unescape()
METHODS. They contains the characters as
- * defined 'unreserved' in section 2.3 of the RFC 2396 'URI genric syntax':
- *
- *
- * unreserved = alphanum | mark
- * mark = "-" | "_" | "." | "!" | "~" | "*" | "'" | "(" | ")"
- *
- */
- public static BitSet URISave;
-
- /**
- * Same as {@link #URISave} but also contains the '/'
- */
- public static BitSet URISaveEx;
-
- static {
- URISave = new BitSet(256);
- int i;
- for (i = 'a'; i <= 'z'; i++) {
- URISave.set(i);
- }
- for (i = 'A'; i <= 'Z'; i++) {
- URISave.set(i);
- }
- for (i = '0'; i <= '9'; i++) {
- URISave.set(i);
- }
- URISave.set('-');
- URISave.set('_');
- URISave.set('.');
- URISave.set('!');
- URISave.set('~');
- URISave.set('*');
- URISave.set('\'');
- URISave.set('(');
- URISave.set(')');
-
- URISaveEx = (BitSet) URISave.clone();
- URISaveEx.set('/');
- }
-
- /**
- * Does an URL encoding of the string
using the
- * escape
character. The characters that don't need encoding
- * are those defined 'unreserved' in section 2.3 of the 'URI genric syntax'
- * RFC 2396, but without the escape character.
- *
- * @param string the string to encode.
- * @param escape the escape character.
- * @return the escaped string
- *
- * @throws NullPointerException if string
is null
.
- */
- public static String escape(String string, char escape) {
- return escape(string, escape, false);
- }
-
- /**
- * Does an URL encoding of the string
using the
- * escape
character. The characters that don't need encoding
- * are those defined 'unreserved' in section 2.3 of the 'URI genric syntax'
- * RFC 2396, but without the escape character. If isPath
is
- * true
, additionally the slash '/' is ignored, too.
- *
- * @param string the string to encode.
- * @param escape the escape character.
- * @param isPath if true
, the string is treated as path
- *
- * @return the escaped string
- *
- * @throws NullPointerException if string
is null
.
- */
- public static String escape(String string, char escape, boolean isPath) {
- try {
- BitSet validChars = isPath ? URISaveEx : URISave;
- byte[] bytes = string.getBytes("utf-8");
- StringBuffer out = new StringBuffer(bytes.length);
- for (int i = 0; i < bytes.length; i++) {
- int c = bytes[i]&0xff;
- if (validChars.get(c) && c!=escape) {
- out.append((char)c);
- } else {
- out.append(escape);
- out.append(hexTable[(c>>4) & 0x0f]);
- out.append(hexTable[(c ) & 0x0f]);
- }
- }
- return out.toString();
- } catch (UnsupportedEncodingException e) {
- throw new InternalError(e.toString());
- }
- }
-
- /**
- * Does a URL encoding of the string
. The characters that
- * don't need encoding are those defined 'unreserved' in section 2.3 of
- * the 'URI genric syntax' RFC 2396.
- *
- * @param string the string to encode
- * @return the escaped string
- *
- * @throws NullPointerException if string
is null
.
- */
- public static String escape(String string) {
- return escape(string, '%');
- }
-
- /**
- * Does a URL encoding of the path
. The characters that
- * don't need encoding are those defined 'unreserved' in section 2.3 of
- * the 'URI genric syntax' RFC 2396. In contrast to the
- * {@link #escape(String)} method, not the entire path string is escaped,
- * but every individual part (i.e. the slashes are not escaped).
- *
- * @param path the path to encode
- * @return the escaped path
- *
- * @throws NullPointerException if path
is null
.
- */
- public static String escapePath(String path) {
- return escape(path, '%', true);
- }
-
- /**
- * Does a URL decoding of the string
using the
- * escape
character. Please note that in opposite to the
- * {@link java.net.URLDecoder} it does not transform the + into spaces.
- * @param string the string to decode
- * @param escape the escape character
- * @return the decoded string
- *
- * @throws NullPointerException if string
is null
.
- * @throws ArrayIndexOutOfBoundsException if not enough character follow an
- * escape character
- * @throws IllegalArgumentException if the 2 characters following the escape
- * character do not represent a hex-number.
- */
- public static String unescape(String string, char escape) {
- ByteArrayOutputStream out = new ByteArrayOutputStream(string.length());
- for (int i=0; istring
. Please note that in
- * opposite to the {@link java.net.URLDecoder} it does not transform the +
- * into spaces.
- *
- * @param string the string to decode
- * @return the decoded string
- *
- * @throws NullPointerException if string
is null
.
- * @throws ArrayIndexOutOfBoundsException if not enough character follow an
- * escape character
- * @throws IllegalArgumentException if the 2 characters following the escape
- * character do not represent a hex-number.
- */
- public static String unescape(String string) {
- return unescape(string, '%');
- }
-
- /**
- * Returns a stringified date accoring to the date format specified in
- * RTF1123. this is of the form: "Sun, 06 Nov 1994 08:49:37 GMT"
- */
- public static String dateToRfc1123String(Date date) {
- synchronized (rfc1123Format) {
- return rfc1123Format.format(date);
- }
- }
-
- /**
- * Implements a date formatting routine supporting (a subset) of the POSIX
- * strftime()
function.
- *
- * @param date The date value to be formatted
- * @param formatPattern The pattern used to format the date. This pattern
- * supports a subset of the pattern characters of the POSIX
- * strftime()
function. If this pattern is empty or
- * null
the default pattern
- * dd.MM.yyyy HH:mm:ss
is used.
- * @param zone Defines for which time zone the date should be outputted. If
- * this parameter is null
, then the local time zone is taken.
- *
- * @return the formatted date as a String.
- */
- public static final String strftime(Date date, String formatPattern, TimeZone zone) {
- // Check whether to apply default format
- if (formatPattern == null || formatPattern.length() == 0) {
- formatPattern = DEFAULT_DATE_FORMAT_PATTERN;
- } else {
- formatPattern = convertFormat(formatPattern);
- }
-
- // check zone
- if (zone == null) zone = TIMEZONE_LOCAL;
-
- // Reuse the global SimpleDateFormat synchronizing on it to prevent
- // multiple tasks from interfering with each other
- synchronized(dateFormatter) {
- dateFormatter.applyPattern(formatPattern);
- dateFormatter.setTimeZone(zone);
- return dateFormatter.format(date);
- }
- }
-
- /**
- * Implements a date formatting routine supporting (a subset) of the POSIX
- * strftime()
function.
- *
- * @param date The date value to be formatted
- * @param formatPattern The pattern used to format the date. This pattern
- * supports a subset of the pattern characters of the POSIX
- * strftime()
function. If this pattern is empty or
- * null
the default pattern
- * dd.MM.yyyy HH:mm:ss
is used.
- * @param asUTC Defines whether to interpret the date as belong to the UTC
- * time zone or the local time zone.
- */
- public static final String strftime(Date date, String formatPattern, boolean asUTC) {
- return strftime(date, formatPattern, asUTC ? TIMEZONE_UTC : TIMEZONE_LOCAL);
- }
-
- /**
- * Implements a date formatting routine supporting (a subset) of the POSIX
- * strftime()
function. The default pattern
- * dd.MM.yyyy HH:mm:ss
is used to format the date.
- *
- * @param date The date value to be formatted
- * @param asUTC Defines whether to interpret the date as belong to the UTC
- * time zone or the local time zone.
- */
- public static final String strftime(Date date, boolean asUTC) {
- return strftime(date, null, asUTC);
- }
-
- /**
- * Implements a date formatting routine supporting (a subset) of the POSIX
- * strftime()
function. The default pattern
- * dd.MM.yyyy HH:mm:ss
is used to format the date, which is
- * interpreted to be in the local time zone.
- *
- * @param date The date value to be formatted
- */
- public static final String strftime(Date date) {
- return strftime(date, null, false);
- }
-
- /**
- * Parses the date string based on the format pattern which is in the
- * format used by the Java platfrom SimpleDateFormat class.
- *
- * @param dateString The date string to be parsed
- * @param formatPattern the pattern to use for parsing. If null
- * or empty, the same default pattern is used as with
- * {@link #strftime(Date, String, boolean)}, namely
- * dd.MM.yyyy HH:mm:ss
.
- *
- * @throws ParseException if the date string cannot be parsed accordinung
- * to the format pattern.
- */
- public static final Date parseDate(String dateString, String formatPattern)
- throws ParseException {
-
- return parseDate(dateString, formatPattern, false);
- }
-
- /**
- * Parses the date string based on the format pattern which is in the
- * format used by the Java platfrom SimpleDateFormat class.
- *
- * @param dateString The date string to be parsed
- * @param formatPattern the pattern to use for parsing. If null
- * or empty, the same default pattern is used as with
- * {@link #strftime(Date, String, boolean)}, namely
- * dd.MM.yyyy HH:mm:ss
.
- * @param isUTC if true
the date string is considered in UTC,
- * otherwise the default timezone of the host is used.
- *
- * @throws ParseException if the date string cannot be parsed accordinung
- * to the format pattern.
- */
- public static final Date parseDate(String dateString, String formatPattern,
- boolean isUTC)
- throws ParseException {
-
- synchronized (dateFormatter) {
- dateFormatter.applyPattern(formatPattern);
- if (isUTC) {
- dateFormatter.setTimeZone(TIMEZONE_UTC);
- } else {
- dateFormatter.setTimeZone(TimeZone.getDefault());
- }
- return dateFormatter.parse(dateString);
- }
- }
-
- /**
- * Parses the date string based on the format pattern which is in the
- * default format dd.MM.yyyy HH:mm:ss
.
- *
- * @param dateString The date string to be parsed
- *
- * @throws ParseException if the date string cannot be parsed accordinung
- * to the format pattern.
- */
- public static final Date parseDate(String dateString) throws ParseException {
- return parseDate(dateString, DEFAULT_DATE_FORMAT_PATTERN, false);
- }
-
- /**
- * Parses the date string based on the format pattern which is in the
- * default format dd.MM.yyyy HH:mm:ss
.
- *
- * @param dateString The date string to be parsed
- * @param isUTC if true
the date string is considered in UTC,
- * otherwise the default timezone of the host is used.
- *
- *
- * @throws ParseException if the date string cannot be parsed accordinung
- * to the format pattern.
- */
- public static final Date parseDate(String dateString, boolean isUTC)
- throws ParseException {
- return parseDate(dateString, DEFAULT_DATE_FORMAT_PATTERN, isUTC);
- }
-
- //--------- sprintf() formatting constants ---------------------------------
-
- /** left justified - '-' flag */
- private static final int FLAG_LJ = 1;
-
- /** always show sign - '+' flag */
- private static final int FLAG_SI = 2;
-
- /** space placeholder for omitted plus sign - ' ' flag, ignore if SI */
- private static final int FLAG_SP = 3;
-
- /** zero padded if right aligned - '0' flag, ignore if LJ */
- private static final int FLAG_ZE = 4;
-
- /**
- * alternate format - '#' flag :
- * SI - incr. precision to have zero as first char
- * x - prefix '0x'
- * X - prefix '0X'
- * eEf - always show decimal point, omit trailing zeroes
- * gG - always show decimal point, show trailing zeroes
- */
- private static final int FLAG_AL = 5;
-
- /** interpret ints as short - 'h' size */
- private static final int FLAG_SHORT = 8;
-
- /** interpret ints as long - 'l' size */
- private static final int FLAG_LONG = 9;
-
- /** waiting for format */
- private static final int PARSE_STATE_NONE = 0;
-
- /** parsing flags */
- private static final int PARSE_STATE_FLAGS = 1;
-
- /** parsing wdth */
- private static final int PARSE_STATE_WIDTH = 2;
-
- /** parsing precision */
- private static final int PARSE_STATE_PRECISION = 3;
-
- /** parsing size */
- private static final int PARSE_STATE_SIZE = 4;
-
- /** parsing type */
- private static final int PARSE_STATE_TYPE = 5;
-
- /** parsing finished */
- private static final int PARSE_STATE_END = 6;
-
- /** incomplete pattern at end of format string, throw error */
- private static final int PARSE_STATE_ABORT = 7;
-
- /** end of format string during plain text */
- private static final int PARSE_STATE_TERM = 8;
-
- /**
- * This method implements the famous and ubiquituous sprintf
- * formatter in Java. The arguments to the method are the formatting string
- * and the list of arguments defined by the formatting instructions
- * contained in the formatting string.
- *
- * Each element in the argument array is either a Number
object
- * or any other Object
type. Whenever the formatting string
- * stipulates the corresponding argument to be numeric, it is assumed this
- * array element to be a Number
. If this is not the case an
- * IllegalArgumentException
is thrown. If a String
- * argument is stipulated by the formatting string, a simple call to the
- * toString()
method of the object yields the
- * String
required.
- *
- * SPECIFICATION
- *
- * sprintf
accepts a series of arguments, applies to each a
- * format specifier from format
, and stores the formatted data
- * to the result Strint
. The method throws an
- * IllegalArgumentException
if either the format
- * is incorrect, there are not enough arguments for the format
- * or if any of the argument's type is wrong. sprintf
returns
- * when it reaches the end of the format string. If there are more
- * arguments than the format requires, excess arguments are ignored.
- *
- * format
is a String
containing two types of
- * objects: ordinary characters (other than %
), which
- * are copied unchanged to the output, and conversion specifications,
- * each of which is introduced by %
. (To include
- * %
in the output, use %%
in the format
- * string.) A conversion specification has the following form:
- *
- *
- * [ flags ] [ width ] [ "." prec ] [ size ]
- * type
- *
- *
- *
- * The fields of the conversion specification have the following meanings:
- *
- *
- * - flags
- *
- an optional sequence of characters which control output
- * justification, numeric signs, decimal points, trailing zeroes, and
- * octal and hex prefixes. The flag characters are minus (
-
),
- * plus (+
), space ("
"), zero (0
),
- * and sharp (#
). They can appear in any combination.
- *
- *
- *
- * -
- * The result of the conversion is left justified, and the right
- * is padded with blanks. If you do not use this flag, the result
- * is right justified, and padded on the left.
- *
- *
- * +
- * The result of a signed conversion (as determined by type)
- * will always begin with a plus or minus sign. (If you do not use
- * this flag, positive values do not begin with a plus sign.)
- *
- *
- * "
" (space)
- * If the first character of a signed conversion specification is
- * not a sign, or if a signed conversion results in no characters,
- * the result will begin with a space. If the space
- * (
) flag and the plus (+
) flag both
- * appear, the space flag is ignored.
- *
- *
- * 0
- * If the type is d
, i
,
- * o
, u
, x
, X
,
- * e
, E
, f
, g
,
- * or G
: leading zeroes, are used to pad the field
- * width (following any indication of sign or base); no spaces
- * are used for padding. If the zero (0
) and minus
- * (-
) flags both appear, the zero (0
)
- * flag will be ignored. For d
, i
,
- * o
, u
, x
, X
- * conversions, if a precision prec is specified, the zero
- * (0
) flag is ignored.
- *
- * Note that 0 is interpreted as a flag, not as the
- * beginning of a field width.
- *
- *
- * #
- * The result is to be converted to an alternative form, according
- * to the type character:
- *
- * o
- * - Increases precision to force the first digit of the result
- * to be a zero.
- *
- *
x
- * A non-zero result will have a 0x
prefix.
- *
- * X
- * A non-zero result will have a 0X
prefix.
- *
- * e
, E
, or f
- * The result will always contain a decimal point even if no
- * digits follow the point. (Normally, a decimal point appears
- * only if a digit follows it.) Trailing zeroes are removed.
- *
- * g
or G
- * Same as e
or E
, but trailing
- * zeroes arenot removed.
- *
- * - all others
- *
- Undefined.
- *
- *
- *
- *
- * - width
- *
- width is an optional minimum field width. You can either
- * specify it directly as a decimal integer, or indirectly by using instead
- * an asterisk (
*
), in which case an integral numeric argument
- * is used as the field width. Negative field widths are not supported; if
- * you attempt to specify a negative field width, it is interpreted as a
- * minus (i
) flag followed by a positive field width.
- *
- * - prec
- *
- an optional field; if present, it is introduced with
- * `
.
' (a period). This field gives the maximum number of
- * characters to print in a conversion; the minimum number of digits of an
- * integer to print, for conversions with type d
,
- * i
, o
, u
, x
, and
- * X
; the maximum number of significant digits, for the
- * g
and G
conversions; or the number of digits
- * to print after the decimal point, for e
, E
,
- * and f
conversions. You can specify the precision either
- * directly as a decimal integer or indirectly by using an asterisk
- * (*
), in which case an integral numeric argument is used as
- * the precision. Supplying a negative precision is equivalent to
- * omitting the precision. If only a period is specified the precision
- * is zero. If a precision appears with any other conversion type
- * than those listed here, the behavior is undefined.
- *
- * - size
- *
h
, l
, and L
are optional size
- * characters which override the default way that sprintf
- * interprets the data type of the corresponding argument.
- * h
forces the following d
, i
,
- * o
, u
, x
, or X
- * conversion type to apply to a short
or unsigned
- * short
. Similarily, an l
forces the following
- * d
, i
, o
, u
,
- * x
, or X
conversion type to apply to
- * a long
or unsigned long
. If an h
- * or an l
appears with another conversion specifier, the
- * behavior is undefined. L
forces a following
- * e
, E
, f
, g
, or
- * G
conversion type to apply to a long
- * double
argument. If L
appears with any other
- * conversion type, the behavior is undefined.
- *
- * - type
- *
- type specifies what kind of conversion
sprintf
- * performs. Here is a table of these:
- *
- *
- * %
- * - prints the percent character (
%
)
- *
- * c
- * - prints arg as single character. That is the argument is
- * converted to a
String
of which only the first
- * character is printed.
- *
- * s
- * - Prints characters until precision is reached or the
- *
String
ends; takes any Object
whose
- * toString()
method is called to get the
- * String
to print.
- *
- * d
- * - prints a signed decimal integer; takes a
Number
(same
- * as i
)
- *
- * d
- * - prints a signed decimal integer; takes a
Number
(same
- * as d
)
- *
- * d
- * - prints a signed octal integer; takes a
Number
- *
- * u
- * - prints a unsigned decimal integer; takes a
Number
.
- * This conversion is not supported correctly by the Java
- * implementation and is really the same as i
.
- *
- * x
- * - prints an unsigned hexadecimal integer (using abcdef as
- * digits beyond 9; takes a
Number
- *
- * X
- * - prints an unsigned hexadecimal integer (using ABCDEF as
- * digits beyond 9; takes a
Number
- *
- * f
- * - prints a signed value of the form [-]9999.9999; takes a
- *
Number
- *
- * e
- * - prints a signed value of the form [-]9.9999e[+|-]999; takes
- * a
Number
- *
- * E
- * - prints the same way as
e
, but using E to
- * introduce the exponent; takes a Number
- *
- * g
- * - prints a signed value in either
f
or e
- * form, based on given value and precision &emdash; trailing zeros
- * and the decimal point are printed only if necessary; takes a
- * Number
- *
- * G
- * - prints the same way as
g
, but using E
- * for the exponent if an exponent is needed; takes a
- * Number
- *
- * n
- * - Not supported in the Java implementation, throws an
- *
IllegalArgumentException
if used.
- *
- * p
- * - Not supported in the Java implementation, throws an
- *
IllegalArgumentException
if used.
- *
- *
- *
- *
- *
- * IMPLEMENTATION NOTES
- *
- * Due to the nature of the Java programming language, neither pointer
- * conversions, nor unsigned
and long double
- * conversions are supported.
- *
- * Also the Java implementation only distinguishes between
- * Number
and other Object
arguments. If a
- * numeric argument is expected as per the format
- * String
, the current argument must be a Number
- * object that is converted to a basic type as expected. If a
- * String
or char
argument is expected, any
- * Object is valid, whose toString()
method is used to convert
- * to a String
.
- *
- * @param format The format string as known from the POSIX sprintf()
- * C function.
- * @param args The list of arguments to accomodate the format string. This
- * argument list is supposed to contain at least as much entries as
- * there are formatting options in the format string. If for a
- * numeric option, the entry is not a number an
- * IllegalArgumentException
is thrown.
- *
- * @return The formatted String
. An empty String
- * is only returned if the format
String
- * is empty. A null
value is never returned.
- *
- * @throws NullPointerException if the formatting string or any of the
- * argument values is null
.
- * @throws IllegalArgumentException if the formatting string has wrong
- * format tags, if the formatting string has an incomplete
- * formatting pattern at the end of the string, if the argument
- * vector has not enough values to satisfy the formatting string
- * or if an argument's type does not match the requirements of the
- * format string.
- *
- */
- public static String sprintf(String format, Object[] args) {
-
- // Return immediately if we have no arguments ....
- if (format == null) {
- throw new NullPointerException("format");
- }
-
- if (format.length() == 0) {
- return "";
- }
-
- // Get the format string
- char[] s = format.toCharArray();
-
- // prepare the result, initial size has no sound basis
- StringBuffer res = new StringBuffer( s.length * 3 / 2 );
-
- for (int i=0,j=0, length=format.length(); i < length; ) {
-
- int parse_state = PARSE_STATE_NONE;
- BitSet flags = new BitSet(16);
- int width = 0;
- int precision = -1;
- char fmt = ' ';
-
- // find a start of a formatting ...
- while (parse_state == PARSE_STATE_NONE) {
- if (i >= length) parse_state = PARSE_STATE_TERM;
- else if (s[i] == '%') {
- if (i < length - 1) {
- if (s[i + 1] == '%') {
- res.append('%');
- i++;
- } else {
- parse_state = PARSE_STATE_FLAGS;
- }
- } else {
- throw new java.lang.IllegalArgumentException(
- "Incomplete format at end of format string");
- }
- } else {
- res.append(s[i]);
- }
- i++;
- }
-
- // Get flags, if any
- while (parse_state == PARSE_STATE_FLAGS) {
- if (i >= length) parse_state = PARSE_STATE_ABORT;
- else if (s[i] == ' ') flags.set(FLAG_SP);
- else if (s[i] == '-') flags.set(FLAG_LJ);
- else if (s[i] == '+') flags.set(FLAG_SI);
- else if (s[i] == '0') flags.set(FLAG_ZE);
- else if (s[i] == '#') flags.set(FLAG_AL);
- else {
- parse_state = PARSE_STATE_WIDTH;
- i--;
- }
- i++;
- }
-
- // Get width specification
- while (parse_state == PARSE_STATE_WIDTH) {
- if (i >= length) {
-
- parse_state = PARSE_STATE_ABORT;
-
- } else if ('0' <= s[i] && s[i] <= '9') {
-
- width = width * 10 + s[i] - '0';
- i++;
-
- } else {
- // finished with digits or none at all
-
- // if width is a '*' take width from arg
- if (s[i] == '*') {
- // Check whether we have an argument
- if (j >= args.length) {
- throw new IllegalArgumentException("Missing " +
- "argument for the width");
- }
- try {
- width = ((Number)(args[j++])).intValue();
- } catch (ClassCastException cce) {
- // something wrong with the arg
- throw new IllegalArgumentException("Width " +
- "argument is not numeric");
- }
- i++;
- }
-
- // if next is a dot, then we have a precision, else a size
- if (s[i] == '.') {
- parse_state = PARSE_STATE_PRECISION;
- precision = 0;
- i++;
- } else {
- parse_state = PARSE_STATE_SIZE;
- }
-
- }
- }
-
- // Get precision
- while (parse_state == PARSE_STATE_PRECISION) {
-
- if (i >= length) {
-
- parse_state = PARSE_STATE_ABORT;
-
- } else if ('0' <= s[i] && s[i] <= '9') {
-
- precision = precision * 10 + s[i] - '0';
- i++;
-
- } else {
- // finished with digits or none at all
-
- // if width is a '*' take precision from arg
- if (s[i] == '*') {
- // Check whether we have an argument
- if (j >= args.length) {
- throw new IllegalArgumentException("Missing " +
- "argument for the precision");
- }
- try {
- width = ((Number)(args[j++])).intValue();
- } catch (ClassCastException cce) {
- // something wrong with the arg
- throw new IllegalArgumentException("Precision " +
- "argument is not numeric");
- }
- i++;
- }
-
- parse_state = PARSE_STATE_SIZE;
-
- }
-
- }
-
- // Get size character
- if (parse_state == PARSE_STATE_SIZE) {
- if (i >= length) parse_state = 6;
- else {
- if (s[i] == 'h') {
- flags.set(FLAG_SHORT);
- i++;
- } else if (s[i] == 'l' || s[i] == 'L') {
- flags.set(FLAG_LONG);
- i++;
- }
- parse_state = PARSE_STATE_TYPE;
- }
- }
-
- // Get format character
- if (parse_state == PARSE_STATE_TYPE) {
- if (i >= length) parse_state = PARSE_STATE_ABORT;
- else {
- fmt = s[i];
- i++;
- parse_state = PARSE_STATE_END;
- }
- }
-
- // Now that we have anything, format it ....
- if (parse_state == PARSE_STATE_END) {
-
- // Check whether we have an argument
- if (j >= args.length) {
- throw new IllegalArgumentException("Not enough parameters for the format string");
- }
-
- try {
-
- // Convert the argument according to the flag
- switch (fmt) {
- case 'd': // decimal - fall through
- case 'i': // integral - fall through
- case 'x': // hexadecimal, lower case - fall through
- case 'X': // hexadecimal, upper case - fall through
- case 'o': // octal - fall through
- case 'u': // unsigned (not really supported)
- format(res, (Number)args[j], fmt, width, precision,
- flags);
- break;
-
- case 'f': // float - fall through
- case 'e': // exponential, lower case - fall through
- case 'E': // exponential, upper case - fall through
- case 'g': // float or exp., lower case - fall through
- case 'G': // float or exp., upper case - fall through
- format(res, ((Number)args[j]).doubleValue(), fmt,
- width, precision, flags);
- break;
-
- case 'c': // character
- precision = 1;
- // fall through
-
- case 's': // string
-
- String val = args[j].toString();
- if (val.length() > precision && precision > 0) {
- val = val.substring(0, precision);
- }
-
- flags.clear(FLAG_ZE);
- format(res, val, "", width, flags);
- break;
-
- default : // unknown format
-
- throw new IllegalArgumentException("Unknown " +
- "conversion type " + fmt);
-
- }
-
- } catch (ClassCastException cce) {
- // something wrong with the arg
- throw new IllegalArgumentException("sprintf: Argument #" +
- j + " of type " + args[j].getClass().getName() +
- " does not match format " + fmt);
- }
-
- // goto the next argument
- j++;
- }
-
- // if the format string is not complete
- if (parse_state == PARSE_STATE_ABORT) {
- throw new java.lang.IllegalArgumentException(
- "Incomplete format at end of format string");
- }
-
- } // while i
-
- return res.toString();
- }
-
- /**
- * Formats a string according to format and argument. This method only
- * supports string formats. See {@link #sprintf(String, Object[])} for details.
- *
- * @param format The format string
- * @param a0 The single parameter
- *
- * @return the result from sprintf(format, new Object[]{ a0 })
.
- *
- * @throws IllegalArgumentException from {@link #sprintf(String, Object[])}.
- */
- public static String sprintf(String format, Object a0) {
- return sprintf(format, new Object[]{a0});
- }
-
- /**
- * Formats a string according to format and argument. This method only
- * supports string formats. See {@link #sprintf(String, Object[])} for details.
- *
- * @param format The format string
- * @param a0 The first parameter
- * @param a1 The second parameter
- *
- * @return the result from sprintf(format, new Object[]{ ... })
.
- *
- * @throws IllegalArgumentException from {@link #sprintf(String, Object[])}.
- */
- public static String sprintf(String format, Object a0, Object a1) {
- return sprintf(format, new Object[]{a0, a1});
- }
-
- /**
- * Formats a string according to format and argument. This method only
- * supports string formats. See {@link #sprintf(String, Object[])} for details.
- *
- * @param format The format string
- * @param a0 The first parameter
- * @param a1 The second parameter
- * @param a2 The thrid parameter
- *
- * @return the result from sprintf(format, new Object[]{ ... })
.
- *
- * @throws IllegalArgumentException from {@link #sprintf(String, Object[])}.
- */
- public static String sprintf(String format, Object a0, Object a1,
- Object a2) {
-
- return sprintf(format, new Object[]{a0, a1, a2});
- }
-
- /**
- * Formats a string according to format and argument. This method only
- * supports string formats. See {@link #sprintf(String, Object[])} for details.
- *
- * @param format The format string
- * @param a0 The first parameter
- * @param a1 The second parameter
- * @param a2 The thrid parameter
- * @param a3 The fourth parameter
- *
- * @return the result from sprintf(format, new Object[]{ ... })
.
- *
- * @throws IllegalArgumentException from {@link #sprintf(String, Object[])}.
- */
- public static String sprintf(String format, Object a0, Object a1,
- Object a2, Object a3) {
-
- return sprintf(format, new Object[]{a0, a1, a2, a3});
- }
-
- /**
- * Formats a string according to format and argument. This method only
- * supports string formats. See {@link #sprintf(String, Object[])} for details.
- *
- * @param format The format string
- * @param a0 The first parameter
- * @param a1 The second parameter
- * @param a2 The thrid parameter
- * @param a3 The fourth parameter
- * @param a4 The fifth parameter
- *
- * @return the result from sprintf(format, new Object[]{ ... })
.
- *
- * @throws IllegalArgumentException from {@link #sprintf(String, Object[])}.
- */
- public static String sprintf(String format, Object a0, Object a1,
- Object a2, Object a3, Object a4) {
- return sprintf(format, new Object[]{a0, a1, a2, a3, a4});
- }
-
- //---------- internal ------------------------------------------------------
-
- /**
- * Convert a Date formatting string in POSIX strftime() format to the
- * pattern format used by the Java SimpleDateFormat class.
- *
- * These are the symbols used in SimpleDateFormat to which we convert
- * our strftime() symbols.
- *
- *
- * Symbol Meaning Presentation Example
- * G era designator (Text) AD
- * y year (Number) 1996
- * M month in year (Text & Number) July & 07
- * d day in month (Number) 10
- * h hour in am/pm (1~12) (Number) 12
- * H hour in day (0~23) (Number) 0
- * m minute in hour (Number) 30
- * s second in minute (Number) 55
- * S millisecond (Number) 978
- * E day in week (Text) Tuesday
- * D day in year (Number) 189
- * F day of week in month (Number) 2 (2nd Wed in July)
- * w week in year (Number) 27
- * W week in month (Number) 2
- * a am/pm marker (Text) PM
- * k hour in day (1~24) (Number) 24
- * K hour in am/pm (0~11) (Number) 0
- * z time zone (Text) Pacific Standard Time
- * ' escape for text (Delimiter)
- * '' single quote (Literal) '
- *
- *
- * @param posixFormat The formatting pattern in POSIX strftime() format.
- * @return The Date formatting pattern in SimpleDateFormat pattern format.
- *
- * todo: Check for the more or less complete support of all pattern tags.
- */
- private static String convertFormat(String posixFormat) {
- char[] format = posixFormat.toCharArray();
- StringBuffer jFormat = new StringBuffer(format.length);
- boolean inString = false;
-
- for (int i=0; isprintf()
method, that is, this method handles d, i, o, u,
- * x, and X formatting characters.
- *
- * @param buf The formatted number is appended to this string buffer
- * @param num The number object to format
- * @param fmt The format character defining the radix of the number
- * @param width The minimum field width for the number
- * @param precision The minimum number of digits to print for the number,
- * this does not include any signs or prefix characters
- * @param flags The flags governing the formatting. This is a combination
- * of the FLAG_* constants above.
- *
- * @return The formatted string
- *
- * @see sprintf()
- */
- private static StringBuffer format(StringBuffer buf, Number num,
- char fmt, int width, int precision, BitSet flags) {
-
- String numStr;
- String prefStr = "";
- boolean toUpper = (fmt == 'X');
-
- // Check precision and make default
- if (precision >= 0) {
- flags.clear(FLAG_ZE);
- } else {
- precision = 1;
- }
-
- // Get the value and adjust size interpretation
- long val;
- long sizeMask;
- if (flags.get(FLAG_SHORT)) {
- val = num.shortValue();
- sizeMask = 0xffffL;
- } else if (flags.get(FLAG_LONG)) {
- val = num.longValue();
- sizeMask = 0xffffffffffffffffL;
- } else {
- val = num.intValue();
- sizeMask = 0xffffffffL;
- }
-
- // check formatting type
- if (fmt == 'x' || fmt == 'X') {
-
- numStr = Long.toHexString(val & sizeMask);
-
- if (toUpper) {
- numStr = numStr.toUpperCase();
- }
-
- if (flags.get(FLAG_AL)) {
- prefStr = toUpper ? "0X" : "0x";
- }
-
- } else if (fmt == 'o') {
-
- numStr = Long.toOctalString(val & sizeMask);
-
- if (flags.get(FLAG_AL) && val != 0 && precision <= numStr.length()) {
- precision = numStr.length() + 1;
- }
-
- } else {
-
- numStr = Long.toString(val);
-
- // move sign to prefix if negative, or set '+'
- if (val < 0) {
- prefStr = "-";
- numStr = numStr.substring(1);
- } else if (flags.get(FLAG_SI)) {
- prefStr = "+";
- }
-
-
- }
-
- // prefix 0 for precision
- if (precision > numStr.length()) {
- StringBuffer tmp = new StringBuffer(precision);
- for (precision -= numStr.length(); precision > 0; precision--) {
- tmp.append('0');
- }
- numStr = tmp.append(numStr).toString();
- }
-
- return format(buf, numStr, prefStr, width, flags);
- }
-
- /**
- * Implements the floating point number formatting part of the
- * sprintf()
method, that is, this method handles f, e, E, g,
- * and G formatting characters.
- *
- * @param buf The formatted number is appended to this string buffer
- * @param num The numeric value to format
- * @param fmt The format character defining the floating point format
- * @param width The minimum field width for the number
- * @param precision Depending on fmt
either the number of
- * digits after the decimal point or the number of significant
- * digits.
- * @param flags The flags governing the formatting. This is a combination
- * of the FLAG_* constants above.
- *
- * @return The formatted string
- *
- * @see sprintf()
- */
- private static StringBuffer format(StringBuffer buf, double num,
- char fmt, int width, int precision, BitSet flags) {
-
- BigDecimal val = new BigDecimal(num).abs();
-
- // the exponent character, will be defined if exponent is needed
- char expChar = 0;
-
- // the exponent value
- int exp;
- if (fmt != 'f') {
- exp = val.unscaledValue().toString().length() - val.scale() - 1;
- } else {
- exp = 0;
- }
-
- // force display of the decimal dot, if otherwise omitted
- boolean needDot = (precision == 0 && flags.get(FLAG_AL));
-
- // for fmt==g|G : treat trailing 0 and decimal dot specially
- boolean checkTrails = false;
-
- // get a sensible precision value
- if (precision < 0) {
- precision = 6;
- }
-
- switch (fmt) {
- case 'G': // fall through
- case 'g':
- // decrement precision, to simulate significance
- if (precision > 0) {
- precision--;
- }
-
- // we have to check trailing zeroes later
- checkTrails = true;
-
- // exponent does not stipulate exp notation, break here
- if (exp <= precision) {
- precision -= exp;
- break;
- }
-
- // fall through for exponent handling
-
- case 'E': // fall through
- case 'e':
- // place the dot after the first decimal place
- val = val.movePointLeft(exp);
-
- // define the exponent character
- expChar = (fmt == 'e' || fmt == 'g') ? 'e' : 'E';
-
- break;
- }
-
- // only rescale if the precision is positive, may be negative
- // for g|G
- if (precision >= 0) {
- val = val.setScale(precision, BigDecimal.ROUND_HALF_UP);
- }
-
- // convert the number to a string
- String numStr = val.toString();
-
- // for g|G : check trailing zeroes
- if (checkTrails) {
-
- if (flags.get(FLAG_AL)) {
-
- // need a dot, if not existing for alternative format
- needDot |= (numStr.indexOf('.') < 0);
-
- } else {
- // remove trailing dots and zeros
- int dot = numStr.indexOf('.');
- if (dot >= 0) {
- int i;
- for (i=numStr.length()-1; i>=dot && numStr.charAt(i)=='0';
- i--);
- // if stopped at dot, remove it
- if (i > dot) {
- i++;
- }
- numStr = numStr.substring(0, i);
- }
- }
- }
-
- // Get a buffer with the number up to now
- StringBuffer numBuf = new StringBuffer(numStr);
-
- // if we need a decimal dot, add it
- if (needDot) {
- numBuf.append('.');
- }
-
- // we have an exponent to add
- if (expChar != 0) {
- numBuf.append(expChar);
- numBuf.append(exp < 0 ? '-' : '+');
- if (exp < 10) {
- numBuf.append('0');
- }
- numBuf.append(exp);
- }
-
- // define the number's sign as the prefix for later formatting
- String prefStr;
- if (num < 0) {
- prefStr = "-";
- } else if (flags.get(FLAG_SI)) {
- prefStr = "+";
- } else {
- prefStr = "";
- }
-
- // now format it and up we go
- return format(buf, numBuf.toString(), prefStr, width, flags);
- }
-
- /**
- * Formats the String
appending to the
- * StringBuffer
at least the String
and
- * justifying according to the flags.
- *
- * The flags will be interpreted as follows :
- * * if {@link #FLAG_LJ} is set, append blanks for left justification
- * * else if {@link #FLAG_ZE} is set, insert zeroes between prefStr and str
- * * else prepend blanks for right justification
- *
- * @param buf The StringBuffer
to append the formatted result
- * to.
- * @param str The String
to be appended with surrounding
- * blanks, zeroes and prefStr
depending on the
- * flags
. This is usually the real string to print
- * like "ape" or "4.5E99".
- * @param prefStr An optional prefix String
to be appended
- * in front of the String
. This is usually the prefix
- * string for numeric str
values, for example
- * "-", "0x", or "+". The reason for this separation is that the
- * {@link #FLAG_ZE} flag will insert zeroes between the prefix and
- * the string itself to fill the field to the width.
- * @param width The minimal field width. If the field width is larger than
- * the sum of the lengths of str
and
- * prefStr
, blanks or zeroes will be prepended or
- * appended according to the flags value.
- * @param flags The flags indicating where blanks or zeroes will be filled.
- * See above for the interpretation of flags.
- *
- * @throws NullPointerException if any of buf
,
- * str
, prefStr
or flags
- * is null
.
- */
- private static StringBuffer format(StringBuffer buf, String str,
- String prefStr, int width, BitSet flags) {
-
- int numFill = width - prefStr.length() - str.length();
- int preZero = 0;
- int preBlank = 0;
- int postBlank = 0;
-
- if (flags.get(FLAG_LJ)) {
- postBlank = numFill;
- } else if (flags.get(FLAG_ZE)) {
- preZero = numFill;
- } else {
- preBlank = numFill;
- }
-
- for ( ; preBlank > 0; preBlank--) buf.append(' ');
- buf.append(prefStr);
- for ( ; preZero > 0; preZero--) buf.append('0');
- buf.append(str);
- for ( ; postBlank > 0; postBlank--) buf.append(' ');
-
- return buf;
- }
-}
\ No newline at end of file
diff --git a/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/util/XmlUtil.java b/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/util/XmlUtil.java
deleted file mode 100644
index 56dc01bbe0d..00000000000
--- a/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/util/XmlUtil.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * 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.util;
-
-import org.apache.log4j.Logger;
-import org.apache.jackrabbit.webdav.DavConstants;
-import org.jdom.Element;
-
-/**
- * XmlUtil
provides utility METHODS for building Xml representation.
- */
-public class XmlUtil implements DavConstants {
-
- private static Logger log = Logger.getLogger(XmlUtil.class);
-
- /**
- * Converts the given timeout (long value defining the number of milli-
- * second until timeout is reached) to its Xml representation as defined
- * by RTF 2518.
- *
- * @param timeout number of milli-seconds until timeout is reached.
- * @return 'timeout' JDOM element
- */
- public static Element timeoutToXml(long timeout) {
- // TODO: check if 'infinite' would be better to return for infinite timeout.
- String expString = "Second-"+ timeout/1000;
- Element exp = new Element(XML_TIMEOUT, NAMESPACE);
- exp.setText(expString);
- return exp;
- }
-
- /**
- * Returns the Xml representation of a boolean isDeep, where false
- * presents a depth value of '0', true a depth value of 'infinity'.
- *
- * @param isDeep
- * @return Xml representation
- */
- public static Element depthToXml(boolean isDeep) {
- return depthToXml(isDeep? "infinity" : "0");
- }
-
- /**
- * Returns the Xml representation of a depth String. Webdav defines the
- * following valid values for depths: 0, 1, infinity
- *
- * @param depth
- * @return 'deep' JDOM element
- */
- public static Element depthToXml(String depth) {
- Element dElem = new Element(XML_DEPTH, NAMESPACE);
- dElem.setText(depth);
- return dElem;
- }
-
- /**
- * Builds a 'href' Xml element from the given String
- *
- * @param href String representing the text of the 'href' Xml element
- * @return Xml representation of a 'href' according to RFC 2518.
- */
- public static Element hrefToXml(String href) {
- return new Element(XML_HREF, NAMESPACE).setText(href);
- }
-}
\ No newline at end of file
diff --git a/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/util/package.html b/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/util/package.html
deleted file mode 100644
index 8b8b2f978eb..00000000000
--- a/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/util/package.html
+++ /dev/null
@@ -1,3 +0,0 @@
-
-Utility classes used for Text handling and creation of common Xml elements.
-
\ No newline at end of file
diff --git a/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/version/DeltaVConstants.java b/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/version/DeltaVConstants.java
deleted file mode 100644
index 89cb94a235c..00000000000
--- a/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/version/DeltaVConstants.java
+++ /dev/null
@@ -1,314 +0,0 @@
-/*
- * 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.version;
-
-import org.apache.jackrabbit.webdav.property.DavPropertyName;
-import org.apache.jackrabbit.webdav.DavConstants;
-import org.jdom.Namespace;
-
-/**
- * DeltaVConstants
defines the following headers and properties
- * required for any resource that is complient to
- * RFC 3253:
- *
- * Headers:
- *
- * Label
- *
- *
- * Properties:
- *
- * DAV:comment
- * DAV:creator-displayname
- * DAV:supported-method-set
- * DAV:supported-live-property-set
- * DAV:supported-report-set
- * DAV:workspace
- *
- */
-public interface DeltaVConstants {
-
- /**
- * The DAV: namespace.
- */
- public static final Namespace NAMESPACE = DavConstants.NAMESPACE;
-
- /**
- * For certain METHODS, if the request-URL identifies a version-controlled
- * resource, a label can be specified in a LabelInfo request header to cause the
- * method to be applied to the version selected by that label.
- * LabelInfo header MUST have no effect on a request whose request-URL does not
- * identify a version-controlled resource. In particular, it MUST have no
- * effect on a request whose request-URL identifies a version or a version
- * history.
- */
- public static final String HEADER_LABEL = "Label";
-
- /**
- * Location header as defined by
- * RFC 2616. In the versioning
- * context it is used to indicate the location of the new version created by a
- * successful checkin in the response.
- * From RFC 2616:
- * The Location response-header field is used to redirect the recipient to a
- * location other than the Request-URI for completion of the request or
- * identification of a new resource.
- * For 201 (Created) responses, the Location is that of the new resource
- * which was created by the request.
- */
- public static final String HEADER_LOCATION = "Location";
-
- /**
- * The "DAV:comment" property is used to track a brief comment about a resource that is
- * suitable for presentation to a user. The DAV:comment of a version can be
- * used to indicate why that version was created.
- */
- public static final DavPropertyName COMMENT = DavPropertyName.create("comment", NAMESPACE);
-
- /**
- * The "DAV:creator-displayname" property contains a description of the creator of
- * the resource that is suitable for presentation to a user. The
- * DAV:creator-displayname of a version can be used to indicate who created
- * that version.
- */
- public static final DavPropertyName CREATOR_DISPLAYNAME = DavPropertyName.create("creator-displayname", NAMESPACE);
-
- /**
- * Required protected live property for any resources being complient with
- * RFC 3253. Clients should classify a resource by examing the values of the
- * DAV:supported-method-set and DAV:supported-live-property-set
- * properties of that resource.
- * Property structure:
- *
- * <!ELEMENT supported-method-set (supported-method*)>
- * <!ELEMENT supported-method ANY>
- * <!ATTLIST supported-method name NMTOKEN #REQUIRED>
- * name value: a method name
- *
- *
- * @see #SUPPORTED_LIVE_PROPERTY_SET
- */
- public static final DavPropertyName SUPPORTED_METHOD_SET = DavPropertyName.create("supported-method-set", NAMESPACE);
-
- /**
- * Required protected live property for any resources being complient with
- * RFC 3253. Clients should classify a resource by examing the values of the
- * DAV:supported-method-set and DAV:supported-live-property-set
- * properties of that resource.
- * Property structure:
- *
- * <!ELEMENT supported-live-property-set (supported-live-property*)>
- * <!ELEMENT supported-live-property name>
- * <!ELEMENT prop ANY>
- * ANY value: a property element type
- *
- *
- * @see #SUPPORTED_METHOD_SET
- */
- public static final DavPropertyName SUPPORTED_LIVE_PROPERTY_SET = DavPropertyName.create("supported-live-property-set", NAMESPACE);
-
- /**
- * Protected "supported-report-set" property identifies the reports that are
- * supported by the resource.
- *
- * @see #SUPPORTED_REPORT_SET
- */
- public static final DavPropertyName SUPPORTED_REPORT_SET = DavPropertyName.create("supported-report-set", NAMESPACE);
-
- /**
- * Protected "workspace" property indicating the workspace of a resource.
- *
- * @see #WORKSPACE
- */
- public static final DavPropertyName WORKSPACE = DavPropertyName.create("workspace", NAMESPACE);
-
-
- //--------------------------------------------------------------------------
- /**
- * Xml elements
- */
- public static final String XML_ACTIVITY = "activity";
- public static final String XML_BASELINE = "baseline";
-
- public static final String XML_SUPPORTED_METHOD = "supported-method";
- public static final String XML_VERSION_HISTORY = "version-history";
- public static final String XML_VERSION = "version";
- public static final String XML_WORKSPACE = "workspace";
-
- // options
- /**
- * If the OPTIONS request contains a body, i must start with an DAV:options
- * element.
- *
- * @see OptionsInfo
- * @see #XML_VH_COLLECTION_SET
- * @see #XML_WSP_COLLECTION_SET
- * @see #XML_ACTIVITY_COLLECTION_SET
- */
- public static final String XML_OPTIONS = "options";
-
- /**
- * If an XML response body for a successful request is included, it must be
- * a DAV:options-response XML element.
- *
- * @see OptionsResponse
- */
- public static final String XML_OPTIONS_RESPONSE = "options-response";
-
- /**
- * A DAV:version-history-collection-set element may be included in the OPTIONS
- * request body to identify collections that may contain version history
- * resources.
- * The response body for a successful request must in consequence contain a
- * DAV:version-history-collection-set element identifying collections that
- * may contain version histories. An identified collection may be the root
- * collection of a tree of collections, all of which may contain version
- * histories.
- *
- *
- * <!ELEMENT version-history-collection-set (href*)>
- *
- */
- public static final String XML_VH_COLLECTION_SET = "version-history-collection-set";
-
- /**
- * A DAV:workspace-collection-set element may be included in the OPTIONS request
- * body to identify collections that may contain workspace resources.
- * The response body for a successful request must contain a
- * DAV:workspace-collection-set element identifying collections that may
- * contain workspaces. An identified collection may be the root collection
- * of a tree of collections, all of which may contain workspaces.
- *
- *
- * <!ELEMENT workspace-collection-set (href*)>
- *
- */
- public static final String XML_WSP_COLLECTION_SET = "workspace-collection-set";
-
- /**
- * A DAV:workspace-collection-set element may be included in the OPTIONS request
- * body to identify collections that may contain activity resources.
- * The response body for a successful request must contain a
- * DAV:workspace-collection-set element identifying collections that may
- * contain activity resources. An identified collection may be the root collection
- * of a tree of collections, all of which may contain activity resources.
- *
- *
- * <!ELEMENT activity-collection-set (href*)>
- *
- */
- public static final String XML_ACTIVITY_COLLECTION_SET = "activity-collection-set";
-
- /**
- * Name of Xml element contained in the {@link #SUPPORTED_REPORT_SET} property.
- *
- * @see #SUPPORTED_REPORT_SET
- * @see org.apache.jackrabbit.webdav.version.report.SupportedReportSetProperty
- */
- public static final String XML_SUPPORTED_REPORT = "supported-report";
-
- /**
- * Name of Xml child elements of {@link #XML_SUPPORTED_REPORT}.
- *
- * @see org.apache.jackrabbit.webdav.version.report.SupportedReportSetProperty
- */
- public static final String XML_REPORT = "report";
-
- /**
- * Top element for the 'DAV:version-tree' report
- */
- public static final String XML_VERSION_TREE = "version-tree";
-
- /**
- * Top element for the 'DAV:expand-property' report
- */
- public static final String XML_EXPAND_PROPERTY = "expand-property";
-
- /**
- * 'DAV:property' element to be used inside the 'DAV:expand-property' element.
- *
- * @see #XML_EXPAND_PROPERTY
- */
- public static final String XML_PROPERTY = "property";
-
- /**
- * 'DAV:name' attribute for the property element
- *
- * @see #XML_PROPERTY
- */
- public static final String ATTR_NAME = "name";
-
- /**
- * 'DAV:namespace' attribute for the property element
- *
- * @see #XML_PROPERTY
- */
- public static final String ATTR_NAMESPACE = "namespace";
-
- /**
- * Top element for the 'DAV:locate-by-history' report
- */
- public static final String XML_LOCATE_BY_HISTORY = "locate-by-history";
-
- /**
- * 'DAV:version-history-set' to be used inside the 'DAV:locate-by-history'
- * element
- *
- * @see #XML_LOCATE_BY_HISTORY
- */
- public static final String XML_VERSION_HISTORY_SET = "version-history-set";
-
-
- /**
- * Xml element representing the mandatory root element of a LABEL request
- * body.
- *
- * @see #XML_LABEL_NAME
- * @see #XML_LABEL_ADD
- * @see #XML_LABEL_REMOVE
- * @see #XML_LABEL_SET
- * @see LabelInfo
- */
- public static final String XML_LABEL = "label";
- public static final String XML_LABEL_NAME = "label-name";
- public static final String XML_LABEL_ADD = "add";
- public static final String XML_LABEL_REMOVE = "remove";
- public static final String XML_LABEL_SET = "set";
-
- /**
- * Xml element defining the top element in the UPDATE request body. RFC 3253
- * defines the following structure for the 'update' element.
- *
- * <!ELEMENT update ANY>
- * ANY value: A sequence of elements with at most one DAV:version element
- * and at most one DAV:prop element.
- * <!ELEMENT version (href)>
- * prop: see RFC 2518, Section 12.11
- *
- */
- public static final String XML_UPDATE = "update";
-
- // auto-version
- public static final String XML_CHECKOUT_CHECKIN = "checkin-checkout";
- public static final String XML_CHECKOUT_UNLOCK_CHECKIN = "checkout-unlocked-checkin";
- public static final String XML_CHECKOUT = "checkout";
- public static final String XML_LOCKED_CHECKIN = "locked-checkout";
-
- // merge
- public static final String XML_MERGE = "merge";
- public static final String XML_N0_AUTO_MERGE = "no-auto-merge";
- public static final String XML_N0_CHECKOUT = "no-checkout";
-}
\ No newline at end of file
diff --git a/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/version/DeltaVServletRequest.java b/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/version/DeltaVServletRequest.java
deleted file mode 100644
index 8a9f9f6ae4d..00000000000
--- a/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/version/DeltaVServletRequest.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * 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.version;
-
-import org.apache.jackrabbit.webdav.DavServletRequest;
-import org.apache.jackrabbit.webdav.version.report.ReportInfo;
-
-/**
- * DeltaVServletRequest
provides extension useful for functionality
- * related to RFC 3253.
- */
-public interface DeltaVServletRequest extends DavServletRequest {
-
- /**
- * Returns the Label header or null
- *
- * @return label header or null
- * @see DeltaVConstants#HEADER_LABEL
- */
- public String getLabel();
-
- /**
- * Return the request body as LabelInfo
object or null
- * if parsing the request body or the creation of the label info failed.
- *
- * @return LabelInfo
object or null
- */
- public LabelInfo getLabelInfo();
-
- /**
- * Return the request body as MergeInfo
object or null
- * if the creation failed due to invalid format.
- *
- * @return MergeInfo
object or null
- */
- public MergeInfo getMergeInfo();
-
- /**
- * Parses the UPDATE request body a build the corresponding UpdateInfo
- * object. If the request body is missing or does not of the required format
- * null
is returned.
- *
- * @return the parsed update request body or null
- */
- public UpdateInfo getUpdateInfo();
-
- /**
- * Returns the request body and the Depth header as ReportInfo
- * object. The default depth, if no {@link org.apache.jackrabbit.webdav.DavConstants#HEADER_DEPTH
- * Depth header}, is {@link org.apache.jackrabbit.webdav.DavConstants#DEPTH_0}.
- * If the requuest body could not be parsed into an {@link org.jdom.Element}
- * null
is returned.
- *
- * @return ReportInfo
or null
- */
- public ReportInfo getReportInfo();
-
- /**
- * Returns the {@link OptionsInfo} present with the request or null
.
- *
- * @return {@link OptionsInfo} or null
- */
- public OptionsInfo getOptionsInfo();
-}
\ No newline at end of file
diff --git a/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/version/LabelInfo.java b/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/version/LabelInfo.java
deleted file mode 100644
index 8a1f6ca6974..00000000000
--- a/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/version/LabelInfo.java
+++ /dev/null
@@ -1,159 +0,0 @@
-/*
- * 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.version;
-
-import org.apache.log4j.Logger;
-import org.jdom.Element;
-
-import java.util.Iterator;
-
-/**
- * LabelInfo
encapsulates the request body of a LABEL request
- * used to add, set or remove a label from the requested version resource or
- * from that version specified with the Label header in case the requested resource
- * is a version-controlled resource.
- * The request body (thus the 'labelElement' passed to the constructore must be
- * a DAV:label element:
- *
- * <!ELEMENT label ANY>
- * ANY value: A sequence of elements with at most one DAV:add,
- * DAV:set, or DAV:remove element.
- * <!ELEMENT add (label-name)>
- * <!ELEMENT set (label-name)>
- * <!ELEMENT remove (label-name)>
- * <!ELEMENT label-name (#PCDATA)>
- * PCDATA value: string
- *
- */
-public class LabelInfo implements DeltaVConstants {
-
- private static Logger log = Logger.getLogger(LabelInfo.class);
-
- public static final int TYPE_SET = 0;
- public static final int TYPE_REMOVE = 1;
- public static final int TYPE_ADD = 2;
-
- private final Element labelElement;
- private final int depth;
-
- private int type;
- private String labelName;
-
- /**
- * Create a new LabelInfo
from the given element and depth
- * integer. If the specified Xml element does have a {@link DeltaVConstants#XML_LABEL}
- * root element or no label name is specified with the action to perform
- * the creation will fail.
- *
- * @param labelElement
- * @param depth
- * @throws IllegalArgumentException if the specified element does not
- * start with a {@link DeltaVConstants#XML_LABEL} element or if the DAV:label
- * element contains illegal instructions e.g. contains multiple DAV:add, DAV:set
- * or DAV:remove elements.
- */
- public LabelInfo(Element labelElement, int depth) {
- if (labelElement == null || !labelElement.getName().equals(DeltaVConstants.XML_LABEL)) {
- throw new IllegalArgumentException("label element expected");
- }
-
- this.labelElement = (Element) labelElement.detach();
-
- Iterator childrenIter = labelElement.getChildren().iterator();
- while (childrenIter.hasNext()) {
- Element child = (Element) childrenIter.next();
- if (!NAMESPACE.equals(child.getNamespace())) {
- continue;
- }
- String name = child.getName();
- if (XML_LABEL_ADD.equals(name)) {
- type = TYPE_ADD;
- setLabelName(child);
- } else if (XML_LABEL_REMOVE.equals(name)) {
- type = TYPE_REMOVE;
- setLabelName(child);
- } else if (XML_LABEL_SET.equals(name)) {
- type = TYPE_SET;
- setLabelName(child);
- }
- }
- this.depth = depth;
- }
-
- /**
- * Create a new LabelInfo
from the given element. As depth
- * the default value 0 is assumed.
- *
- * @param labelElement
- * @throws IllegalArgumentException
- * @see #LabelInfo(org.jdom.Element, int)
- */
- public LabelInfo(Element labelElement) {
- this(labelElement, 0);
- }
-
- /**
- * Return the 'label-name' or null
- *
- * @return 'label-name' or null
- */
- public String getLabelName() {
- return labelName;
- }
-
- /**
- * Retrieve the text of the 'label-name' child element of the specified
- * parent element.
- *
- * @param parent the is intended to contain a valid 'label-name' child.
- * @throws IllegalArgumentException if the labelName has been set before.
- */
- private void setLabelName(Element parent) {
- // test if any label name is present
- if (labelName != null) {
- throw new IllegalArgumentException("The DAV:label element may contain at most one DAV:add, DAV:set, or DAV:remove element");
- }
- labelName = parent.getChildText(XML_LABEL_NAME, NAMESPACE);
- }
-
- /**
- * Return the type of the LABEL request. This might either be {@link #TYPE_SET},
- * {@link #TYPE_ADD} or {@link #TYPE_REMOVE}.
- *
- * @return type
- */
- public int getType() {
- return type;
- }
-
- /**
- * Return the depth
- *
- * @return depth
- */
- public int getDepth() {
- return depth;
- }
-
- /**
- * Return the DAV:label element
- *
- * @return the DAV:label element
- */
- public Element getLabelElement() {
- return labelElement;
- }
-}
\ No newline at end of file
diff --git a/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/version/MergeInfo.java b/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/version/MergeInfo.java
deleted file mode 100644
index e9cb7b78f1e..00000000000
--- a/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/version/MergeInfo.java
+++ /dev/null
@@ -1,117 +0,0 @@
-/*
- * 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.version;
-
-import org.apache.log4j.Logger;
-import org.apache.jackrabbit.webdav.DavConstants;
-import org.apache.jackrabbit.webdav.property.DavPropertyNameSet;
-import org.jdom.Element;
-
-/**
- * MergeInfo
encapsulates the information present in the DAV:merge
- * element, that forms the mandatory request body of a MERGE request.
- * The DAV:merge element is specified to have the following form.
- *
- * <!ELEMENT merge ANY>
- * ANY value: A sequence of elements with one DAV:source element, at most one
- * DAV:no-auto-merge element, at most one DAV:no-checkout element, at most one
- * DAV:prop element, and any legal set of elements that can occur in a DAV:checkout
- * element.
- * <!ELEMENT source (href+)>
- * <!ELEMENT no-auto-merge EMPTY>
- * <!ELEMENT no-checkout EMPTY>
- * prop: see RFC 2518, Section 12.11
- *
- */
-public class MergeInfo implements DeltaVConstants {
-
- private static Logger log = Logger.getLogger(MergeInfo.class);
-
- private Element mergeElement;
-
- /**
- * Create a new MergeInfo
- *
- * @param mergeElement
- * @throws IllegalArgumentException if the mergeElement is null
- * or not a DAV:merge element.
- */
- public MergeInfo(Element mergeElement) {
- if (mergeElement == null || !mergeElement.getName().equals(XML_MERGE)) {
- throw new IllegalArgumentException("'DAV:merge' element expected");
- }
- this.mergeElement = (Element) mergeElement.detach();
- }
-
- /**
- * Returns the URL specified with the DAV:source element or null
- * if no such child element is present in the DAV:merge element.
- *
- * @return href present in the DAV:source child element or null
.
- */
- public String getSourceHref() {
- Element source = mergeElement.getChild(DavConstants.XML_SOURCE, DavConstants.NAMESPACE);
- if (source != null) {
- return source.getChildText(DavConstants.XML_HREF, DavConstants.NAMESPACE);
- }
- return null;
- }
-
- /**
- * Returns true if the DAV:merge element contains a DAV:no-auto-merge child element.
- *
- * @return true if the DAV:merge element contains a DAV:no-auto-merge child.
- */
- public boolean isNoAutoMerge() {
- return mergeElement.getChild(XML_N0_AUTO_MERGE, NAMESPACE) != null;
- }
-
- /**
- * Returns true if the DAV:merge element contains a DAV:no-checkout child element.
- *
- * @return true if the DAV:merge element contains a DAV:no-checkout child
- */
- public boolean isNoCheckout() {
- return mergeElement.getChild(XML_N0_CHECKOUT, NAMESPACE) != null;
- }
-
- /**
- * Returns a {@link DavPropertyNameSet}. If the DAV:merge element contains
- * a DAV:prop child element the properties specified therein are included
- * in the set. Otherwise an empty set is returned.
- *
- * @return set listing the properties specified in the DAV:prop element indicating
- * those properties that must be reported in the response body.
- */
- public DavPropertyNameSet getPropertyNameSet() {
- Element propElement = mergeElement.getChild(DavConstants.XML_PROP, DavConstants.NAMESPACE);
- if (propElement != null) {
- return new DavPropertyNameSet(propElement);
- } else {
- return new DavPropertyNameSet();
- }
- }
-
- /**
- * Returns the DAV:merge element used to create this MergeInfo
- * object.
- *
- * @return DAV:merge element
- */
- public Element getMergeElement() {
- return mergeElement;
- }
-}
\ No newline at end of file
diff --git a/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/version/OptionsInfo.java b/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/version/OptionsInfo.java
deleted file mode 100644
index ca2c90d68a9..00000000000
--- a/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/version/OptionsInfo.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * 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.version;
-
-import org.apache.log4j.Logger;
-import org.jdom.Element;
-import org.jdom.Namespace;
-
-import java.util.List;
-
-/**
- * OptionsInfo
represents the Xml request body, that may be present
- * with a OPTIONS request.
- *
- * The DAV:options element is specified to have the following form.
- *
- *
- * <!ELEMENT options ANY>
- * ANY value: A sequence of elements each at most onces.
- *
- *
- * @see DeltaVConstants#XML_VH_COLLECTION_SET
- * @see DeltaVConstants#XML_WSP_COLLECTION_SET
- * @see DeltaVConstants#XML_ACTIVITY_COLLECTION_SET
- */
-public class OptionsInfo {
-
- private static Logger log = Logger.getLogger(OptionsInfo.class);
-
- private final Element optionsElement;
-
- /**
- * Create a new UpdateInfo
object.
- *
- * @param optionsElement
- * @throws IllegalArgumentException if the updateElement is null
- * or not a DAV:update element or if the element does not match the required
- * structure.
- */
- public OptionsInfo(Element optionsElement) {
- if (optionsElement == null || !optionsElement.getName().equals(DeltaVConstants.XML_OPTIONS)) {
- throw new IllegalArgumentException("DAV:options element expected");
- }
- this.optionsElement = (Element) optionsElement.detach();
- }
-
- /**
- * Returns the set of elements present in the {@link DeltaVConstants#XML_OPTIONS DAV:options}
- * element. These elements define the information the client wishes to retrieve
- * the OPTIONS request.
- *
- * @return set of child elements
- */
- public List getElements() {
- return optionsElement.getChildren();
- }
-
- /**
- * Returns true if a child element with the given name and namespace is present.
- *
- * @param name
- * @param namespace
- * @return true if such a child element exists in the options element.
- */
- public boolean containsElement(String name, Namespace namespace) {
- return optionsElement.getChild(name, namespace) != null;
- }
-}
\ No newline at end of file
diff --git a/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/version/OptionsResponse.java b/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/version/OptionsResponse.java
deleted file mode 100644
index 1c49fc3549e..00000000000
--- a/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/version/OptionsResponse.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * 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.version;
-
-import org.apache.log4j.Logger;
-import org.apache.jackrabbit.webdav.util.XmlUtil;
-import org.jdom.Document;
-import org.jdom.Element;
-import org.jdom.Namespace;
-
-/**
- * OptionsResponse
encapsulates the DAV:options-response element
- * present in the response body of a successful OPTIONS request (with body).
- *
- * The DAV:options-response element is defined to have the following format.
- *
- *
- * <!ELEMENT options-response ANY>
- * ANY value: A sequence of elements
- *
- */
-public class OptionsResponse implements DeltaVConstants {
-
- private static Logger log = Logger.getLogger(OptionsResponse.class);
-
- private final Element optionsResponse = new Element(XML_OPTIONS_RESPONSE, NAMESPACE);
-
- /**
- * Add a new entry to this OptionsResponse
- *
- * @param elem
- */
- public void addEntry(Element elem) {
- optionsResponse.addContent(elem.detach());
- }
-
- /**
- * Add a new entry to this OptionsResponse
and make each
- * href present in the String array being a separate {@link org.apache.jackrabbit.webdav.DavConstants#XML_HREF DAV:href}
- * element within the entry.
- *
- * @param name
- * @param namespace
- * @param hrefs
- */
- public void addEntry(String name, Namespace namespace, String[] hrefs) {
- Element elem = new Element(name, namespace);
- for (int i = 0; i < hrefs.length; i++) {
- elem.addContent(XmlUtil.hrefToXml(hrefs[i]));
- }
- optionsResponse.addContent(elem);
- }
-
- /**
- * Return the Xml representation.
- *
- * @return Xml representation.
- */
- public Document toXml() {
- return new Document(optionsResponse);
- }
-}
\ No newline at end of file
diff --git a/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/version/ResourceType.java b/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/version/ResourceType.java
deleted file mode 100644
index 36d1aae4eb6..00000000000
--- a/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/version/ResourceType.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * 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.version;
-
-import org.apache.log4j.Logger;
-import org.jdom.Element;
-
-/**
- * The ResourceType
extends the {@link org.apache.jackrabbit.webdav.property.ResourceType}
- * by DeltaV specific types.
- */
-public class ResourceType extends org.apache.jackrabbit.webdav.property.ResourceType
- implements DeltaVConstants {
-
- private static Logger log = Logger.getLogger(ResourceType.class);
-
- /**
- * The version-history resource type
- */
- public static final int VERSION_HISTORY = COLLECTION + 1;
-
- /**
- * The activity resource type
- */
- public static final int ACTIVITY = VERSION_HISTORY + 1;
-
- /**
- * The baseline resource type
- */
- public static final int BASELINE = ACTIVITY + 1;
-
- /**
- * Array containing all possible resourcetype elements
- */
- private static final String[] ELEMENT_NAMES = {
- null,
- XML_COLLECTION,
- XML_VERSION_HISTORY,
- XML_ACTIVITY,
- XML_BASELINE
- };
-
-
- /**
- * Create a resource type property
- *
- * @param resourceType
- */
- public ResourceType(int resourceType) {
- super(resourceType);
- }
-
- /**
- * Return the resource type as Xml element.
- *
- * @return Xml element representing the internal type or null
- * if the resource has no element name assigned (default resource type).
- */
- public Object getValue() {
- String name = ELEMENT_NAMES[getResourceType()];
- return (name != null) ? new Element(name, DeltaVConstants.NAMESPACE) : null;
- }
-
- /**
- * Returns true if the given integer defines a valid resource type.
- *
- * @param resourceType to be validated.
- * @return true if this is a known resource type.
- */
- public boolean isValidResourceType(int resourceType) {
- if (resourceType < DEFAULT_RESOURCE || resourceType > BASELINE) {
- return false;
- }
- return true;
- }
-}
\ No newline at end of file
diff --git a/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/version/SupportedMethodSetProperty.java b/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/version/SupportedMethodSetProperty.java
deleted file mode 100644
index 3a0dd817ff9..00000000000
--- a/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/version/SupportedMethodSetProperty.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * 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.version;
-
-import org.apache.log4j.Logger;
-import org.apache.jackrabbit.webdav.property.DefaultDavProperty;
-import org.jdom.Element;
-
-/**
- * The SupportedMethodSetProperty
- */
-public class SupportedMethodSetProperty extends DefaultDavProperty implements DeltaVConstants {
-
- private static Logger log = Logger.getLogger(SupportedMethodSetProperty.class);
-
- /**
- * Create a new SupportedMethodSetProperty
property.
- *
- * @param methods that are supported by the resource having this property.
- */
- public SupportedMethodSetProperty(String[] methods) {
- super(DeltaVConstants.SUPPORTED_METHOD_SET, new Element[methods.length], true);
-
- // fill the array with the proper elements
- Element[] value = (Element[]) getValue();
- for (int i = 0; i < methods.length; i++) {
- Element methodElem = new Element(DeltaVConstants.XML_SUPPORTED_METHOD, DeltaVConstants.NAMESPACE);
- methodElem.setAttribute("name",methods[i], DeltaVConstants.NAMESPACE);
- value[i] = methodElem;
- }
- }
-}
\ No newline at end of file
diff --git a/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/version/UpdateInfo.java b/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/version/UpdateInfo.java
deleted file mode 100644
index a75e4f256f2..00000000000
--- a/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/version/UpdateInfo.java
+++ /dev/null
@@ -1,146 +0,0 @@
-/*
- * 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.version;
-
-import org.apache.log4j.Logger;
-import org.apache.jackrabbit.webdav.property.DavPropertyNameSet;
-import org.apache.jackrabbit.webdav.DavConstants;
-import org.jdom.Element;
-
-import java.util.List;
-import java.util.Iterator;
-
-/**
- * UpdateInfo
encapsulates the request body of an UPDATE request.
- * RFC 3253 defines the request body as follows:
- *
- * <!ELEMENT update ANY>
- * ANY value: A sequence of elements with at most one DAV:version element and at
- * most one DAV:prop element.
- * <!ELEMENT version (href)>
- * prop: see RFC 2518, Section 12.11
- *
- *
- * In order to reflect the complete range of version restoring and updating
- * of nodes defined by JSR170 the definition has been extended:
- *
- * <!ELEMENT update ( (version+ | label-name | workspace ) , (prop)?, (removeExisting)? ) >
- * <!ELEMENT version (href) >
- * <!ELEMENT label-name (#PCDATA) >
- * <!ELEMENT workspace (href) >
- * <!ELEMENT prop ANY >
- * <!ELEMENT removeExisting EMPTY >
- *
- */
-public class UpdateInfo implements DeltaVConstants {
-
- private static Logger log = Logger.getLogger(UpdateInfo.class);
-
- private final Element updateElement;
- private String[] versionHref;
- private String[] labelName;
- private String workspaceHref;
-
- /**
- * Create a new UpdateInfo
object.
- *
- * @param updateElement
- * @throws IllegalArgumentException if the updateElement is null
- * or not a DAV:update element or if the element does not match the required
- * structure.
- */
- public UpdateInfo(Element updateElement) {
- if (updateElement == null || !updateElement.getName().equals(DeltaVConstants.XML_UPDATE)) {
- throw new IllegalArgumentException("DAV:update element expected");
- }
-
- List targetList;
- if (!(targetList = updateElement.getChildren(XML_VERSION, NAMESPACE)).isEmpty()) {
- Iterator it = targetList.iterator();
- versionHref = new String[targetList.size()];
- int i = 0;
- while (it.hasNext()) {
- Element versionElem = (Element) it.next();
- versionHref[i] = versionElem.getChildText(DavConstants.XML_HREF, NAMESPACE);
- i++;
- }
- } else if (!(targetList = updateElement.getChildren(XML_LABEL_NAME, NAMESPACE)).isEmpty()) {
- Iterator it = targetList.iterator();
- labelName = new String[targetList.size()];
- int i = 0;
- while (it.hasNext()) {
- Element labelNameElem = (Element) it.next();
- labelName[i] = labelNameElem.getText();
- i++;
- }
- } else if (updateElement.getChild(XML_WORKSPACE, NAMESPACE) != null) {
- workspaceHref = updateElement.getChild(XML_WORKSPACE, NAMESPACE).getChildText(DavConstants.XML_HREF, NAMESPACE);
- } else {
- throw new IllegalArgumentException("DAV:update element must contain either DAV:version, DAV:label-name or DAV:workspace child element.");
- }
-
- this.updateElement = (Element) updateElement.detach();
- }
-
- /**
- *
- * @return
- */
- public String[] getVersionHref() {
- return versionHref;
- }
-
- /**
- *
- * @return
- */
- public String[] getLabelName() {
- return labelName;
- }
-
- /**
- *
- * @return
- */
- public String getWorkspaceHref() {
- return workspaceHref;
- }
-
- /**
- * Returns a {@link DavPropertyNameSet}. If the DAV:update element contains
- * a DAV:prop child element the properties specified therein are included
- * in the set. Otherwise an empty set is returned.
- *
- * @return set listing the properties specified in the DAV:prop element indicating
- * those properties that must be reported in the response body.
- */
- public DavPropertyNameSet getPropertyNameSet() {
- Element propElement = updateElement.getChild(DavConstants.XML_PROP, DavConstants.NAMESPACE);
- if (propElement != null) {
- return new DavPropertyNameSet(propElement);
- } else {
- return new DavPropertyNameSet();
- }
- }
-
- /**
- *
- * @return
- */
- public Element getUpdateElement() {
- return updateElement;
- }
-}
\ No newline at end of file
diff --git a/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/version/VersionControlledResource.java b/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/version/VersionControlledResource.java
deleted file mode 100644
index 0cc5e926f2d..00000000000
--- a/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/version/VersionControlledResource.java
+++ /dev/null
@@ -1,283 +0,0 @@
-/*
- * 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.version;
-
-import org.apache.jackrabbit.webdav.DavException;
-import org.apache.jackrabbit.webdav.MultiStatus;
-import org.apache.jackrabbit.webdav.property.DavPropertyName;
-import org.apache.jackrabbit.webdav.property.DavPropertySet;
-import org.apache.jackrabbit.webdav.property.DavPropertyNameSet;
-
-/**
- * The VersionControlledResource
represents in contrast to the
- * VersionableResource
a resource, that has already been put
- * under version-control. This resource can be checked-in, checked-out and
- * has its on {@link javax.jcr.version.VersionHistory version history}.
- *
- * RFC 3253 defines the following required properties for a
- * version-controlled resource (vc-resource):
- *
- * - DAV:auto-version
- * - DAV:version-history (version-history)
- * - DAV:workspace (workspace)
- * - DAV:version-controlled-configuration (baseline)
- * - all DeltaV-compliant resource properties.
- *
- *
- * checked-in vc-resource:
- *
- * - DAV:checked-in
- *
- *
- * checked-out vc-resource:
- *
- * - DAV:checked-out
- * - DAV:predecessor-set
- * - DAV:checkout-fork (in-place-checkout or working resource)
- * - DAV:checkin-fork (in-place-checkout or working resource)
- * - DAV:merge-set (merge)
- * - DAV:auto-merge-set (merge)
- * - DAV:unreserved (activity)
- * - DAV:activity-set (activity)
- *
- *
- * In addition a version-controlled resource must support the following METHODS:
- *
- * - VERSION-CONTROL
- * - MERGE (merge)
- * - all DeltaV-compliant resource METHODS.
- *
- *
- * checked-in vc-resource:
- *
- * - CHECKOUT (checkout-in-place)
- * - UPDATE (update)
- * - all version-controlled resource METHODS.
- *
- *
- * checked-out vc-resource:
- *
- * - CHECKIN (checkout-in-place or working-resource)
- * - UNCHECKOUT (checkout-in-place)
- * - all DeltaV-compliant resource METHODS.
- *
- *
- * @see DeltaVResource
- * @see VersionableResource
- */
-public interface VersionControlledResource extends VersionableResource {
-
- /**
- * Methods defined for a checked-in version-controlled resource: CHECKOUT, UNCHECHKOUT, UPDATE, MERGE, LABEL
- */
- public String methods_checkedIn = "CHECKOUT, UNCHECHKOUT, UPDATE, MERGE, LABEL";
- /**
- * Methods defined for a checked-out version-controlled resource: CHECKIN, MERGE
- */
- public String methods_checkedOut = "CHECKIN, MERGE";
-
- /**
- * The DAV:auto-version property determines how it responds to a method that
- * attempts to modify its content or dead properties. Possible responses
- * include various combinations of automated checkout, write lock and checkin
- * as well as failure until the resource is explicitely checked-out.
- * See RFC 3253 for a detailed
- * description.
- */
- public static final DavPropertyName AUTO_VERSION = DavPropertyName.create("auto-version", DeltaVConstants.NAMESPACE);
-
- /**
- * The computed property DAV:version-history identifies the version history
- * resource for the DAV:checked-in or DAV:checked-out version of this
- * version-controlled resource.
- * The property is defined to have the following format:
- *
- * <!ELEMENT version-history (href)>
- *
- */
- public static final DavPropertyName VERSION_HISTORY = DavPropertyName.create("version-history", DeltaVConstants.NAMESPACE);
-
- /**
- * The DAV:checked-in property appears on a checked-in version-controlled
- * resource, and identifies the base version of this version-controlled
- * resource. This property is removed when the resource is checked out, and
- * then added back (identifying a new version) when the resource is checked
- * back in.
- * This property is defined to have the following format:
- *
- * <!ELEMENT checked-in (href)>
- *
- */
- public static final DavPropertyName CHECKED_IN = DavPropertyName.create("checked-in", DeltaVConstants.NAMESPACE);
-
- /**
- * The DAV:checked-out property identifies the base version of this resource.
- * It is the same that was identified by the DAV:checked-in property at the
- * time the resource was checked out. This property is removed when the
- * resource is checked in.
- * This property is defined to have the following format:
- *
- * <!ELEMENT checked-out (href)>
- *
- *
- * @see #CHECKED_IN
- */
- public static final DavPropertyName CHECKED_OUT = DavPropertyName.create("checked-out", DeltaVConstants.NAMESPACE);
-
- /**
- * The DAV:predecessor-set property of a version-controlled resource points
- * to those version resources, that are scheduled to become the predecessors
- * of this resource when it is back checked-in. This property is not
- * protected, however a server may reject attempts to modify the
- * DAV:predecessor-set of a version-controlled resource.
- * This property is defined to have the following format:
- *
- * <!ELEMENT predecessor-set (href+)>
- *
- *
- * @see #checkin()
- * @see VersionResource#PREDECESSOR_SET
- */
- public static final DavPropertyName PREDECESSOR_SET = DavPropertyName.create("predecessor-set", DeltaVConstants.NAMESPACE);
-
- /**
- * This property determines the DAV:checkin-fork property of the version
- * that results from checking in this resource.
- */
- public static final DavPropertyName CHECKIN_FORK = DavPropertyName.create("checkin-fork", DeltaVConstants.NAMESPACE);
-
- /**
- * This property determines the DAV:checkout-fork property of the version
- * that results from checking in this resource.
- */
- public static final DavPropertyName CHECKOUT_FORK = DavPropertyName.create("checkout-fork", DeltaVConstants.NAMESPACE);
-
- /**
- * This property identifies each version that is to be merged into this
- * checked-out resource. This property is set, whenever a MERGE request
- * with the DAV:no-auto-merge flag succeeded. The client then must confirm
- * each single merge by removing the version from the DAV:merge-set or
- * moving it the the versions DAV:predecessor-set.
- * This property is defined to have the following format:
- *
- * <!ELEMENT merge-set (href*)>
- *
- *
- * @see #merge(MergeInfo)
- * @see #resolveMergeConflict(DavPropertySet, DavPropertyNameSet)
- */
- public static final DavPropertyName MERGE_SET = DavPropertyName.create("merge-set", DeltaVConstants.NAMESPACE);
-
- /**
- * The DAV:auto-merge-set property identifies each version that the server
- * has merged into this checked-out resource. The client should confirm that
- * the merge has been performed correctly before moving a URL from the
- * DAV:auto-merge-set to the DAV:predecessor-set of a checked-out resource.
- * This property is defined to have the following format:
- *
- * <!ELEMENT auto-merge-set (href*)>
- *
- *
- * @see #merge(MergeInfo)
- * @see #resolveMergeConflict(DavPropertySet, DavPropertyNameSet)
- */
- public static final DavPropertyName AUTO_MERGE_SET = DavPropertyName.create("auto-merge-set", DeltaVConstants.NAMESPACE);
-
- /**
- * Perform a checkin on the version controlled resource.
- *
- * @return String representing the location of the version created by the
- * checkin.
- * @throws DavException if an error occurs.
- */
- public String checkin() throws DavException;
-
- /**
- * Perform a checkout on the version controlled resource.
- *
- * @throws DavException
- */
- public void checkout() throws DavException;
-
- /**
- * Perform an uncheckout on the version controlled resource.
- *
- * @throws DavException
- */
- public void uncheckout() throws DavException;
-
- /**
- * Perform an update on this resource using the specified {@link UpdateInfo}.
- *
- * @param updateInfo
- * @return MultiStatus
containing the list of resources that
- * have been modified by this update call.
- * @throws DavException
- */
- public MultiStatus update(UpdateInfo updateInfo) throws DavException;
-
- /**
- * Perform a merge on this resource using the specified {@link MergeInfo}.
- *
- * @param mergeInfo
- * @return MultiStatus
containing the list of resources that
- * have been modified.
- * @throws DavException
- */
- public MultiStatus merge(MergeInfo mergeInfo) throws DavException;
-
- /**
- * Resolve one or multiple merge conflicts present on this resource. Please
- * note that the 'setProperties' or 'removeProperties' set my contain additional
- * resource properties, that need to be changed. Those properties are left
- * untouched, whereas the {@link #AUTO_MERGE_SET}, {@link #MERGE_SET} and
- * the {@link #PREDECESSOR_SET} are removed from the list upon successful
- * resolution of a merge conflict.
- * If the removeProperties or setProperties set do not contain any of the
- * mentioned resource properties or if the value of those properties do
- * not allow for a resolution of an existing merge conflict, this METHODS
- * returns silently.
- *
- * @param setProperties
- * @param removePropertyNames
- * @throws DavException the set or remove property sets attempt to resolve
- * a non-existing merge conflict of if another error occurs while resolving
- * an existing conflict.
- */
- public void resolveMergeConflict(DavPropertySet setProperties, DavPropertyNameSet removePropertyNames) throws DavException;
-
- /**
- * Modify the labels of the version referenced by the DAV:checked-in property
- * of this checked-in version-controlled resource. If the resource is not
- * checked-in the request must fail.
- *
- * @param labelInfo
- * @throws org.apache.jackrabbit.webdav.DavException
- * @see LabelInfo
- * @see VersionResource#label(LabelInfo) for the pre- and postcondition of
- * a successful LABEL request.
- */
- public void label(LabelInfo labelInfo) throws DavException;
-
- /**
- * Returns the VersionHistoryResource
, that is referenced in the
- * '{@link #VERSION_HISTORY version-history}' property.
- *
- * @return
- * @throws DavException
- */
- public VersionHistoryResource getVersionHistory() throws DavException;
-}
\ No newline at end of file
diff --git a/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/version/VersionResource.java b/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/version/VersionResource.java
deleted file mode 100644
index b1d7a964ef9..00000000000
--- a/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/version/VersionResource.java
+++ /dev/null
@@ -1,167 +0,0 @@
-/*
- * 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.version;
-
-import org.apache.jackrabbit.webdav.property.DavPropertyName;
-import org.apache.jackrabbit.webdav.DavException;
-
-/**
- * VersionResource
is a resource that contains a copy of a particular
- * state of a version-controlled resource. A new version resource is created whenever
- * a checked-out version-controlled resource is checked-in. The server allocates
- * a distinct new URL for each new version, and this URL will never be used to
- * identify any resource other than that version. The content and dead properties
- * of a version never change.
- *
- * RFC 3253 defines the following required properties for a version resource:
- *
- * - DAV:predecessor-set (protected)
- * - DAV:successor-set (computed)
- * - DAV:checkout-set
- * - DAV:version-name
- * - DAV:checkout-fork (in-place-checkout or working resource)
- * - DAV:checkin-fork (in-place-checkout or working resource)
- * - DAV:version-history (version-history)
- * - DAV:label-name-set (label)
- * - DAV:activity-set (activity)
- * - all DeltaV-compliant resource properties.
- *
- *
- * In addition a version resource must support the following METHODS:
- *
- * - LABEL (label)
- * - CHECKOUT (working-resource)
- * - all DeltaV-compliant resource METHODS.
- *
- *
- * @see DeltaVResource
- */
-public interface VersionResource extends DeltaVResource {
-
- /**
- * The version resource defines one additional method LABEL.
- *
- * @see DeltaVResource#METHODS
- * @see org.apache.jackrabbit.webdav.DavResource#METHODS
- */
- public String METHODS = "LABEL";
-
- /**
- * Required protected property 'DAV:label-name-set' for a version of a webdav
- * resource introduced with the 'LabelInfo' feature.
- * This property contains the labels that currently select this version.
- * Property structure is defined as follows:
- *
- * <!ELEMENT label-name-set (label-name*)>
- * <!ELEMENT label-name (#PCDATA)>
- * PCDATA value: string
- *
- */
- public static final DavPropertyName LABEL_NAME_SET = DavPropertyName.create("label-name-set", DeltaVConstants.NAMESPACE);
-
- /**
- * The protected DAV:predecessor property identifies each predecessor of
- * this version. Except for the root version, which has no predecessors,
- * each version has at least one predecessor.
- * The property is defined to have the following format:
- *
- * <!ELEMENT predecessor-set (href*)>
- *
- */
- public static final DavPropertyName PREDECESSOR_SET = DavPropertyName.create("predecessor-set", DeltaVConstants.NAMESPACE);
-
- /**
- * The computed property DAV:successor-set identifies each version whose
- * DAV:predecessor-set identifies this version.
- * The property is defined to have the following format:
- *
- * <!ELEMENT successor-set (href*)>
- *
- *
- */
- public static final DavPropertyName SUCCESSOR_SET = DavPropertyName.create("successor-set", DeltaVConstants.NAMESPACE);
-
- /**
- * The computed property DAV:checkout-set identifies each checked-out
- * resource whose DAV:checked-out property identifies this version.
- * The property is defined to have the following format:
- *
- * <!ELEMENT checkout-set (href*)>
- *
- *
- * @see VersionControlledResource#CHECKED_OUT
- */
- public static final DavPropertyName CHECKOUT_SET = DavPropertyName.create("checkout-set", DeltaVConstants.NAMESPACE);
-
- /**
- * The protected property DAV:version-name defines a human readable id for
- * this version. The id defined to be unique within the version-history this
- * version belongs to.
- * The property is defined to have the following format:
- *
- * <!ELEMENT version-name (#PCDATA)>
- * PCDATA value: string
- *
- */
- public static final DavPropertyName VERSION_NAME = DavPropertyName.create("version-name", DeltaVConstants.NAMESPACE);
-
- /**
- * The computed property DAV:version-history identifies the version history
- * that contains this version.
- * The property is defined to have the following format:
- *
- * <!ELEMENT version-history (href)>
- *
- */
- public static final DavPropertyName VERSION_HISTORY = DavPropertyName.create("version-history", DeltaVConstants.NAMESPACE);
-
- /**
- * This property controls the behavior of CHECKOUT when a version already
- * is checked out or has a successor.
- */
- public static final DavPropertyName CHECKOUT_FORK = DavPropertyName.create("checkout-fork", DeltaVConstants.NAMESPACE);
-
- /**
- * This property controls the behavior of CHECKIN when a version already
- * has a successor.
- */
- public static final DavPropertyName CHECKIN_FORK = DavPropertyName.create("checkin-fork", DeltaVConstants.NAMESPACE);
-
- /**
- * Modify the labels of this version resource. The modifications (SET, ADD or
- * REMOVE) are listed in the specified LabelInfo
object.
- * The case of a label name must be preserved when it is stored and retrieved.
- *
If the type of modification is ADD, then the label must not yet occur on
- * any other version within the same version history. In contrast a SET
- * modification will move the indicated label to this version, if it existed
- * with another version before. After a successful LABEL request the label
- * must not appear with any other version in the same version history.
- *
- * @param labelInfo
- * @throws org.apache.jackrabbit.webdav.DavException
- * @see LabelInfo
- */
- public void label(LabelInfo labelInfo) throws DavException;
-
- /**
- * Returns the VersionHistoryResource
, that is referenced in the
- * {@link #VERSION_HISTORY DAV:version-history} property.
- *
- * @return
- * @throws DavException
- */
- public VersionHistoryResource getVersionHistory() throws DavException;
-}
\ No newline at end of file
diff --git a/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/version/package.html b/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/version/package.html
deleted file mode 100644
index d384267c86c..00000000000
--- a/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/version/package.html
+++ /dev/null
@@ -1,4 +0,0 @@
-
-Interfaces and classes used to cover functionality defined by
-RFC 3253: Versioning Extensions to WebDAV.
-
\ No newline at end of file
diff --git a/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/version/report/ExpandPropertyReport.java b/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/version/report/ExpandPropertyReport.java
deleted file mode 100644
index d54c05a4d06..00000000000
--- a/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/version/report/ExpandPropertyReport.java
+++ /dev/null
@@ -1,230 +0,0 @@
-/*
- * 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.version.report;
-
-import org.apache.log4j.Logger;
-import org.apache.jackrabbit.webdav.*;
-import org.apache.jackrabbit.webdav.property.DavProperty;
-import org.apache.jackrabbit.webdav.property.DavPropertyName;
-import org.apache.jackrabbit.webdav.property.HrefProperty;
-import org.apache.jackrabbit.webdav.property.AbstractDavProperty;
-import org.apache.jackrabbit.webdav.version.DeltaVConstants;
-import org.apache.jackrabbit.webdav.version.DeltaVResource;
-import org.jdom.Element;
-import org.jdom.Attribute;
-import org.jdom.Namespace;
-import org.jdom.Document;
-
-import java.util.*;
-
-/**
- * ExpandPropertyReport
encapsulates the DAV:expand-property report,
- * that provides a mechanism for retrieving in one request the properties from
- * the resources identified by those DAV:href elements. It should be supported by
- * all resources that support the REPORT method.
- *
- * RFC 3253 specifies the following required format for the request body:
- *
- * <!ELEMENT expand-property (property*)>
- * <!ELEMENT property (property*)>
- * <!ATTLIST property name NMTOKEN #REQUIRED>
- * name value: a property element type
- * <!ATTLIST property namespace NMTOKEN "DAV:">
- * namespace value: an XML namespace
- *
- * NOTE: any DAV:property elements defined in the request body, that does not
- * represent {@link HrefProperty} is treated as in a common PROPFIND request.
- *
- * @see DeltaVConstants#XML_EXPAND_PROPERTY
- * @see DeltaVConstants#XML_PROPERTY
- */
-public class ExpandPropertyReport implements Report, DeltaVConstants {
-
- private static Logger log = Logger.getLogger(ExpandPropertyReport.class);
-
- private DeltaVResource resource;
- private ReportInfo info;
- private List properties;
-
- /**
- * Returns {@link ReportType#EXPAND_PROPERTY}.
- *
- * @return
- * @see Report#getType()
- */
- public ReportType getType() {
- return ReportType.EXPAND_PROPERTY;
- }
-
- /**
- * Set the target resource.
- *
- * @param resource
- * @throws IllegalArgumentException if the specified resource is null
- * @see Report#setResource(org.apache.jackrabbit.webdav.version.DeltaVResource)
- */
- public void setResource(DeltaVResource resource) throws IllegalArgumentException {
- if (resource == null) {
- throw new IllegalArgumentException("The resource specified must not be null.");
- }
- this.resource = resource;
- }
-
- /**
- * Set the ReportInfo
.
- *
- * @param info
- * @throws IllegalArgumentException if the given ReportInfo
- * does not contain a DAV:expand-property element.
- * @see Report#setInfo(ReportInfo)
- */
- public void setInfo(ReportInfo info) throws IllegalArgumentException {
- if (info == null || !XML_EXPAND_PROPERTY.equals(info.getReportElement().getName())) {
- throw new IllegalArgumentException("DAV:expand-property element expected.");
- }
- this.info = info;
- properties = info.getReportElement().getChildren(XML_PROPERTY, NAMESPACE);
- }
-
- /**
- * Run the report
- *
- * @return Xml Document
as defined by
- * RFC 2518
- * @throws DavException
- * @see Report#toXml()
- */
- public Document toXml() throws DavException {
- if (info == null || resource == null) {
- throw new DavException(DavServletResponse.SC_INTERNAL_SERVER_ERROR, "Error while running DAV:version-tree report");
- }
-
- MultiStatus ms = new MultiStatus();
- buildMultiStatus(resource, info.getDepth(), ms);
- return ms.toXml();
- }
-
- /**
- * Fills the specified MultiStatus
object by generating a
- * MultiStatusResponse
for the given resource (and
- * its member according to the depth value).
- *
- * @param res
- * @param depth
- * @param ms
- * @throws DavException
- * @see #getResponse(DavResource, List)
- */
- private void buildMultiStatus(DavResource res, int depth, MultiStatus ms)
- throws DavException {
- MultiStatusResponse response = getResponse(res, properties);
- ms.addResponse(response);
- if (depth > 0) {
- DavResourceIterator it = res.getMembers();
- while (it.hasNext()) {
- buildMultiStatus(it.nextResource(), depth-1, ms);
- }
- }
- }
-
- /**
- * Builds a MultiStatusResponse
for the given resource respecting
- * the properties specified. Any property that represents a {@link HrefProperty}
- * is expanded: It's name equals the name of a valid {@link HrefProperty}.
- * However the value of that given property (consisting of one or multiple DAV:href elements)
- * is replaced by the Xml representation of a separate
- * {@link MultiStatusResponse multistatus responses} for the
- * resource referenced by the given DAV:href elements. The responses may
- * themselves have properties, which are defined by the separate list.
- *
- * @param res
- * @param propertyList
- * @return MultiStatusResponse
for the given resource.
- * @see ExpandProperty
- */
- private MultiStatusResponse getResponse(DavResource res, List propertyList) {
- MultiStatusResponse resp = new MultiStatusResponse(res.getHref());
- Iterator propIter = propertyList.iterator();
- while (propIter.hasNext()) {
- Element propertyElem = (Element) propIter.next();
- Attribute nameAttr = propertyElem.getAttribute(ATTR_NAME);
- if (nameAttr == null) {
- // NOTE: this is not valid according to the DTD
- continue;
- }
- Attribute namespaceAttr = propertyElem.getAttribute(ATTR_NAMESPACE);
-
- String name = nameAttr.getValue();
- Namespace namespace = (namespaceAttr != null) ? Namespace.getNamespace(namespaceAttr.getValue()) : NAMESPACE;
-
- DavPropertyName propName = DavPropertyName.create(name, namespace);
- DavProperty p = res.getProperty(propName);
- if (p != null) {
- if (p instanceof HrefProperty && res instanceof DeltaVResource) {
- resp.add(new ExpandProperty((DeltaVResource)res, (HrefProperty)p, propertyElem.getChildren(XML_PROPERTY, NAMESPACE)));
- } else {
- resp.add(p);
- }
- } else {
- resp.add(propName, DavServletResponse.SC_NOT_FOUND);
- }
- }
- return resp;
- }
-
- //--------------------------------------------------------< inner class >---
- /**
- * ExpandProperty
extends DavProperty
. It's name
- * equals the name of a valid {@link HrefProperty}. However the value of
- * that given property (consisting of one or multiple DAV:href elements)
- * is replaced by the Xml representation of a separate
- * {@link MultiStatusResponse multistatus responses} for the
- * resource referenced to by the given DAV.:href elements. The responses may
- * themselves have properties, which are defined by the separate list.
- */
- private class ExpandProperty extends AbstractDavProperty {
-
- private List valueList = new ArrayList();
-
- /**
- * Create a new ExpandProperty
.
- *
- * @param hrefProperty
- * @param propertyList
- */
- private ExpandProperty(DeltaVResource deltaVResource, HrefProperty hrefProperty, List propertyList) {
- super(hrefProperty.getName(), hrefProperty.isProtected());
- try {
- DavResource[] refResource = deltaVResource.getReferenceResources(hrefProperty.getName());
- for (int i = 0; i < refResource.length; i++) {
- MultiStatusResponse resp = getResponse(refResource[i], propertyList);
- valueList.add(resp.toXml());
- }
- } catch (DavException e) {
- // invalid references or unknown property
- log.error(e.getMessage());
- }
- }
-
- /**
- * Returns
- * @return
- */
- public Object getValue() {
- return valueList;
- }
- }
-}
\ No newline at end of file
diff --git a/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/version/report/LocateByHistoryReport.java b/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/version/report/LocateByHistoryReport.java
deleted file mode 100644
index f10da0dc5c1..00000000000
--- a/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/version/report/LocateByHistoryReport.java
+++ /dev/null
@@ -1,161 +0,0 @@
-/*
- * 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.version.report;
-
-import org.apache.log4j.Logger;
-import org.apache.jackrabbit.webdav.*;
-import org.apache.jackrabbit.webdav.property.DavPropertyNameSet;
-import org.apache.jackrabbit.webdav.version.DeltaVConstants;
-import org.apache.jackrabbit.webdav.version.VersionControlledResource;
-import org.apache.jackrabbit.webdav.version.VersionHistoryResource;
-import org.apache.jackrabbit.webdav.version.DeltaVResource;
-import org.jdom.Element;
-import org.jdom.Document;
-
-import java.util.List;
-import java.util.HashSet;
-import java.util.Iterator;
-
-/**
- * LocateByHistoryReport
encapsulates the DAV:locate-by-hisotry
- * report, that may be used to locate a version-controlled resource for that
- * version history. The DAV:locate-by-history report can be applied to a collection
- * to locate the collection member that is a version-controlled resource for a
- * specified version history resource.
- *
- *
- * <!ELEMENT locate-by-history (version-history-set, prop)>
- * <!ELEMENT version-history-set (href+)>
- *
- */
-public class LocateByHistoryReport implements Report, DeltaVConstants {
-
- private static Logger log = Logger.getLogger(LocateByHistoryReport.class);
-
- private ReportInfo info;
- private HashSet vhHrefSet = new HashSet();
- private DeltaVResource resource;
-
- /**
- *
- * @return
- * @see Report#getType()
- */
- public ReportType getType() {
- return ReportType.LOCATE_BY_HISTORY;
- }
-
- /**
- * Set the DeltaVResource.
- *
- * @param resource
- * @throws IllegalArgumentException if the specified resource is not a {@link VersionControlledResource}.
- * @see Report#setResource(org.apache.jackrabbit.webdav.version.DeltaVResource)
- */
- public void setResource(DeltaVResource resource) throws IllegalArgumentException {
- if (resource instanceof VersionControlledResource) {
- this.resource = resource;
- } else {
- throw new IllegalArgumentException("DAV:version-tree report can only be created for version-controlled resources and version resources.");
- }
- }
-
- /**
- * Set the ReportInfo
- *
- * @param info
- * @throws IllegalArgumentException if the given ReportInfo
- * does not contain a DAV:version-tree element.
- * @see Report#setInfo(ReportInfo)
- */
- public void setInfo(ReportInfo info) throws IllegalArgumentException {
- if (info == null || !XML_LOCATE_BY_HISTORY.equals(info.getReportElement().getName())) {
- throw new IllegalArgumentException("DAV:locate-by-history element expected.");
- }
- Element versionHistorySet = info.getReportElement().getChild(XML_VERSION_HISTORY_SET, NAMESPACE);
- if (versionHistorySet == null) {
- throw new IllegalArgumentException("The DAV:locate-by-history element must contain a DAV:version-history-set child.");
- }
-
- List l = versionHistorySet.getChildren(DavConstants.XML_HREF, DavConstants.NAMESPACE);
- if (l != null && !l.isEmpty()) {
- Iterator it = l.iterator();
- while (it.hasNext()) {
- String href = ((Element)it.next()).getText();
- if (href != null) {
- vhHrefSet.add(href);
- }
- }
- }
- this.info = info;
- }
-
- /**
- * Run the report.
- *
- * @return Xml Document
representing the report in the required
- * format.
- * @throws DavException
- * @see Report#toXml()
- */
- public Document toXml() throws DavException {
- if (info == null || resource == null) {
- throw new DavException(DavServletResponse.SC_INTERNAL_SERVER_ERROR, "Error while running DAV:locate-by-history report");
- }
-
- MultiStatus ms = new MultiStatus();
- buildResponse(resource, info.getPropertyNameSet(), info.getDepth(), ms);
- return ms.toXml();
- }
-
- /**
- * Fill the MultiStatus
with the MultiStatusResponses
- * generated for the specified resource and its members according to the
- * depth value.
- *
- * @param res
- * @param propNameSet
- * @param depth
- * @param ms
- * @throws DavException
- */
- private void buildResponse(DavResource res, DavPropertyNameSet propNameSet,
- int depth, MultiStatus ms) throws DavException {
- // loop over members first, since this report only list members
- DavResourceIterator it = res.getMembers();
- while (!vhHrefSet.isEmpty() && it.hasNext()) {
- DavResource childRes = it.nextResource();
- if (childRes instanceof VersionControlledResource) {
- try {
- VersionHistoryResource vhr = ((VersionControlledResource)childRes).getVersionHistory();
- if (vhHrefSet.remove(vhr.getHref())) {
- if (propNameSet.isEmpty()) {
- ms.addResourceStatus(childRes, DavServletResponse.SC_OK, 0);
- } else {
- ms.addResourceProperties(childRes, propNameSet, 0);
- }
- }
- } catch (DavException e) {
- log.info(e.getMessage());
- }
- }
- // traverse subtree
- if (depth > 0) {
- buildResponse(it.nextResource(), propNameSet, depth-1, ms);
- }
- }
- }
-}
\ No newline at end of file
diff --git a/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/version/report/Report.java b/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/version/report/Report.java
deleted file mode 100644
index eaf3501095b..00000000000
--- a/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/version/report/Report.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * 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.version.report;
-
-import org.apache.jackrabbit.webdav.DavException;
-import org.apache.jackrabbit.webdav.version.DeltaVResource;
-import org.jdom.Document;
-
-/**
- * The Report
interface defines METHODS needed in order to respond
- * to a REPORT request. The REPORT method is a required feature to all
- * DeltaV resources.
- *
- * @see DeltaVResource#getReport(ReportInfo)
- */
-public interface Report {
-
- /**
- * Returns the registered type of this report.
- *
- * @return the type of this report.
- */
- public ReportType getType();
-
- /**
- * Set the DeltaVResource
for which this report was requested.
- *
- * @param resource
- */
- public void setResource(DeltaVResource resource);
-
- /**
- * Set the ReportInfo
as specified by the REPORT request body,
- * that defines the details for this report.
- *
- * @param info providing in detail requirements for this report.
- */
- public void setInfo(ReportInfo info);
-
- /**
- * Returns the report {@link Document Xml document} defined by the this
- * ReportType
. The document will be returned in the response
- * body.
- *
- * @return Xml Document
object representing the generated report
- * in the proper format.
- * @throws DavException if an error occurs while running the report or
- * creating the Document
.
- */
- public Document toXml() throws DavException;
-}
\ No newline at end of file
diff --git a/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/version/report/ReportInfo.java b/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/version/report/ReportInfo.java
deleted file mode 100644
index 134274e9b81..00000000000
--- a/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/version/report/ReportInfo.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * 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.version.report;
-
-import org.apache.log4j.Logger;
-import org.apache.jackrabbit.webdav.property.DavPropertyNameSet;
-import org.apache.jackrabbit.webdav.DavConstants;
-import org.jdom.Element;
-
-/**
- * The ReportInfo
class encapsulates the body of a REPORT request.
- * RFC 3253 the top Xml element
- * being the name of the requested report. In addition a Depth header may
- * be present (default value: {@link DavConstants#DEPTH_0}).
- */
-public class ReportInfo {
-
- private static Logger log = Logger.getLogger(ReportInfo.class);
-
- private final Element reportElement;
- private final int depth;
-
- /**
- * Create a new ReportInfo
object.
- *
- * @param reportElement
- * @param depth Depth value as retrieved from the {@link DavConstants#HEADER_DEPTH}.
- */
- public ReportInfo(Element reportElement, int depth) {
- this.reportElement = reportElement;
- this.depth = depth;
- }
-
- /**
- * Returns the Xml element specifying the requested report.
- *
- * @return reportElement
- */
- public Element getReportElement() {
- return reportElement;
- }
-
- /**
- * Returns the depth field. The request must be applied separately to the
- * collection itself and to all members of the collection that satisfy the
- * depth value.
- *
- * @return depth
- */
- public int getDepth() {
- return depth;
- }
-
- /**
- * Returns a DavPropertyNameSet
providing the property names present
- * in an eventual {@link DavConstants#XML_PROP} child element. If no such
- * child element is present an empty set is returned.
- *
- * @return {@link DavPropertyNameSet} providing the property names present
- * in an eventual {@link DavConstants#XML_PROP DAV:prop} child element or an empty set.
- */
- public DavPropertyNameSet getPropertyNameSet() {
- Element propElement = reportElement.getChild(DavConstants.XML_PROP, DavConstants.NAMESPACE);
- if (propElement != null) {
- return new DavPropertyNameSet(propElement);
- } else {
- return new DavPropertyNameSet();
- }
- }
-}
\ No newline at end of file
diff --git a/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/version/report/ReportType.java b/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/version/report/ReportType.java
deleted file mode 100644
index 3d21bd948ea..00000000000
--- a/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/version/report/ReportType.java
+++ /dev/null
@@ -1,169 +0,0 @@
-/*
-* Copyright 2004 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.version.report;
-
-import org.apache.log4j.Logger;
-import org.apache.jackrabbit.webdav.version.DeltaVConstants;
-import org.apache.jackrabbit.webdav.DavException;
-import org.apache.jackrabbit.webdav.DavServletResponse;
-import org.jdom.Element;
-import org.jdom.Namespace;
-
-import java.util.HashMap;
-
-/**
- * ReportType
...
- */
-public class ReportType implements DeltaVConstants {
-
- private static Logger log = Logger.getLogger(ReportType.class);
-
- private static final HashMap types = new HashMap();
-
- public static final ReportType VERSION_TREE = register(XML_VERSION_TREE, NAMESPACE, VersionTreeReport.class);
- public static final ReportType EXPAND_PROPERTY = register(XML_EXPAND_PROPERTY, NAMESPACE, ExpandPropertyReport.class);
- public static final ReportType LOCATE_BY_HISTORY = register(XML_LOCATE_BY_HISTORY, NAMESPACE, LocateByHistoryReport.class);
-
- private final String name;
- private final Namespace namespace;
- private final Class reportClass;
-
- /**
- * Private constructor
- *
- * @see #register(String, Namespace, Class)
- */
- private ReportType(String name, Namespace namespace, Class reportClass) {
- this.name = name;
- this.namespace = namespace;
- this.reportClass = reportClass;
- }
-
- /**
- * Creates a new {@link Report} with this type.
- *
- * @return
- * @throws DavException
- */
- public Report createReport() throws DavException {
- try {
- return (Report) reportClass.getConstructor(new Class[0]).newInstance(new Object[0]);
- } catch (Exception e) {
- // should never occur
- throw new DavException(DavServletResponse.SC_INTERNAL_SERVER_ERROR, "Failed to register Report.");
- }
- }
-
- /**
- * Returns an Xml element representing this report type
- *
- * @return Xml representation
- */
- public Element toXml() {
- return new Element(name, namespace);
- }
-
- /**
- * Returns true if this ReportType
is requested by the given
- * ReportInfo
- *
- * @param reqInfo
- * @return
- */
- public boolean isRequestedReportType(ReportInfo reqInfo) {
- if (reqInfo != null) {
- Element elem = reqInfo.getReportElement();
- if (elem != null) {
- return name.equals(elem.getName()) && namespace.equals(elem.getNamespace());
- }
- }
- return false;
- }
-
- /**
- * Register the report type with the given name, namespace and class, that can
- * run that report.
- *
- * @param name
- * @param namespace
- * @param reportClass
- * @return
- * @throws IllegalArgumentException if either parameter is null
or
- * if the given class does not implement the {@link Report} interface or if
- * it does not provide an empty constructor.
- */
- public static ReportType register(String name, Namespace namespace, Class reportClass) {
- if (name == null || namespace == null || reportClass == null) {
- throw new IllegalArgumentException("A ReportType cannot be registered with a null name, namespace or report class");
- }
-
- String key = buildKey(namespace, name);
- if (types.containsKey(key)) {
- return (ReportType) types.get(key);
- } else {
- // test if this report class has an empty constructor and implements Report interface
- boolean isValidClass = false;
- Class[] interfaces = reportClass.getInterfaces();
- for (int i = 0; i < interfaces.length && !isValidClass; i++) {
- isValidClass = (interfaces[i] == Report.class);
- }
- if (!isValidClass) {
- throw new IllegalArgumentException("The specified report class must implement the Report interface.");
- }
-
- try {
- reportClass.getConstructor(new Class[0]);
- } catch (NoSuchMethodException e) {
- throw new IllegalArgumentException("The specified report class must provide a default constructor.");
- }
-
- ReportType type = new ReportType(name, namespace, reportClass);
- types.put(key, type);
- return type;
- }
- }
-
- /**
- * Return the ReportType
requested by the given report info object.
- *
- * @param reportInfo
- * @return the requested ReportType
- * @throws IllegalArgumentException if the reportInfo is null
or
- * if the requested report type has not been registered yet.
- */
- public static ReportType getType(ReportInfo reportInfo) {
- if (reportInfo == null) {
- throw new IllegalArgumentException("ReportInfo must not be null.");
- }
- String key = buildKey(reportInfo.getReportElement().getNamespace(), reportInfo.getReportElement().getName());
- if (types.containsKey(key)) {
- return (ReportType) types.get(key);
- } else {
- throw new IllegalArgumentException("The request report '"+key+"' has not been registered yet.");
- }
- }
-
- /**
- * Build the key from the given namespace and name.
- *
- * @param namespace
- * @param name
- * @return key identifying the report with the given namespace and name
- */
- private static String buildKey(Namespace namespace, String name) {
- return "{" + namespace.getURI() + "}" + name;
- }
-}
diff --git a/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/version/report/SupportedReportSetProperty.java b/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/version/report/SupportedReportSetProperty.java
deleted file mode 100644
index edd4ab4b448..00000000000
--- a/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/version/report/SupportedReportSetProperty.java
+++ /dev/null
@@ -1,115 +0,0 @@
-/*
- * 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.version.report;
-
-import org.apache.log4j.Logger;
-import org.apache.jackrabbit.webdav.version.DeltaVConstants;
-import org.apache.jackrabbit.webdav.property.AbstractDavProperty;
-import org.jdom.Element;
-
-import java.util.HashSet;
-import java.util.Iterator;
-
-/**
- * SupportedReportSetProperty
represents the DAV:supported-report-set
- * property defined by RFC 3253. It identifies the reports that are supported by
- * the given resource.
- *
- * <!ELEMENT supported-report-set (supported-report*)>
- * <!ELEMENT supported-report report>
- * <!ELEMENT report ANY>
- * ANY value: a report element type
- *
- */
-public class SupportedReportSetProperty extends AbstractDavProperty {
-
- private static Logger log = Logger.getLogger(SupportedReportSetProperty.class);
-
- private final HashSet reportTypes = new HashSet();
-
- /**
- * Create a new empty SupportedReportSetProperty
.
- */
- public SupportedReportSetProperty() {
- super(DeltaVConstants.SUPPORTED_REPORT_SET, true);
- }
-
- /**
- * Create a new SupportedReportSetProperty
property.
- *
- * @param reportTypes that are supported by the resource having this property.
- */
- public SupportedReportSetProperty(ReportType[] reportTypes) {
- super(DeltaVConstants.SUPPORTED_REPORT_SET, true);
- for (int i = 0; i < reportTypes.length; i++) {
- addReportType(reportTypes[i]);
- }
- }
-
- /**
- * Add an additional report type to this property's value.
- *
- * @param reportType
- */
- public void addReportType(ReportType reportType) {
- reportTypes.add(reportType);
- }
-
- /**
- * Returns true if the report type indicated in the specified RequestInfo
- * object is included in the supported reports.
- *
- * @param reqInfo
- * @return true if the requested report is supported.
- */
- public boolean isSupportedReport(ReportInfo reqInfo) {
- Iterator it = reportTypes.iterator();
- while (it.hasNext()) {
- ReportType rt = (ReportType)it.next();
- if (rt.isRequestedReportType(reqInfo)) {
- return true;
- }
- }
- return false;
- }
-
- /**
- * Returns the Xml representation of this property.
- *
- * @return Xml representation listing all supported reports
- * @see org.apache.jackrabbit.webdav.property.DavProperty#toXml()
- */
- public Element toXml() {
- Element elem = getName().toXml();
- Iterator it = reportTypes.iterator();
- while (it.hasNext()) {
- Element sr = new Element(DeltaVConstants.XML_SUPPORTED_REPORT, DeltaVConstants.NAMESPACE);
- Element r = new Element(DeltaVConstants.XML_REPORT, DeltaVConstants.NAMESPACE);
- elem.addContent(sr.addContent(r.addContent(((ReportType)it.next()).toXml())));
- }
- return elem;
- }
-
- /**
- * Returns a set of report types.
- *
- * @return set of {@link ReportType}.
- * @see org.apache.jackrabbit.webdav.property.DavProperty#getValue()
- */
- public Object getValue() {
- return reportTypes;
- }
-}
\ No newline at end of file
diff --git a/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/version/report/VersionTreeReport.java b/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/version/report/VersionTreeReport.java
deleted file mode 100644
index 46e14a25f49..00000000000
--- a/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/version/report/VersionTreeReport.java
+++ /dev/null
@@ -1,139 +0,0 @@
-/*
- * 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.version.report;
-
-import org.apache.log4j.Logger;
-import org.apache.jackrabbit.webdav.*;
-import org.apache.jackrabbit.webdav.property.DavPropertyNameSet;
-import org.apache.jackrabbit.webdav.version.*;
-import org.jdom.Document;
-
-/**
- * VersionTreeReport
encapsulates the DAV:version-tree report.
- * It describes the requested properties of all the versions in the version
- * history of a version. The DAV:version-tree report must be supported by all
- * version resources and all version-controlled resources.
- */
-public class VersionTreeReport implements Report, DeltaVConstants {
-
- private static Logger log = Logger.getLogger(VersionTreeReport.class);
-
- private ReportInfo info;
- private DeltaVResource resource;
-
- public ReportType getType() {
- return ReportType.VERSION_TREE;
- }
-
- /**
- * Set the DeltaVResource
used to register this report.
- *
- * @param resource
- * @throws IllegalArgumentException if the given resource is neither
- * {@link VersionControlledResource} nor {@link VersionResource}.
- * @see Report#setResource(org.apache.jackrabbit.webdav.version.DeltaVResource)
- */
- public void setResource(DeltaVResource resource) throws IllegalArgumentException {
- if (resource instanceof VersionControlledResource || resource instanceof VersionResource) {
- this.resource = resource;
- } else {
- throw new IllegalArgumentException("DAV:version-tree report can only be created for version-controlled resources and version resources.");
- }
- }
-
- /**
- * Set the ReportInfo
as specified by the REPORT request body,
- * that defines the details for this report.
- *
- * @param info
- * @throws IllegalArgumentException if the given ReportInfo
- * does not contain a DAV:version-tree element.
- * @see Report#setInfo(ReportInfo)
- */
- public void setInfo(ReportInfo info) throws IllegalArgumentException {
- if (info == null || !XML_VERSION_TREE.equals(info.getReportElement().getName())) {
- throw new IllegalArgumentException("DAV:version-tree element expected.");
- }
- this.info = info;
- }
-
- /**
- * Runs the DAV:version-tree report.
- *
- * @return Xml Document
representing the report in the required
- * format.
- * @throws DavException if the resource or the info field are null
- * or if any other error occurs.
- * @see Report#toXml()
- */
- public Document toXml() throws DavException {
- if (info == null || resource == null) {
- throw new DavException(DavServletResponse.SC_INTERNAL_SERVER_ERROR, "Error while running DAV:version-tree report");
- }
-
- MultiStatus ms = new MultiStatus();
- buildResponse(resource, info.getPropertyNameSet(), info.getDepth(), ms);
- return ms.toXml();
- }
-
- /**
- *
- * @param res
- * @param propNameSet
- * @param depth
- * @param ms
- * @throws DavException
- */
- private void buildResponse(DavResource res, DavPropertyNameSet propNameSet,
- int depth, MultiStatus ms) throws DavException {
- VersionResource[] versions = getVersions(res);
- for (int i = 0; i < versions.length; i++) {
- if (propNameSet.isEmpty()) {
- ms.addResourceStatus(versions[i], DavServletResponse.SC_OK, 0);
- } else {
- ms.addResourceProperties(versions[i], propNameSet, 0);
- }
- }
- if (depth > 0) {
- DavResourceIterator it = res.getMembers();
- while (it.hasNext()) {
- buildResponse(it.nextResource(), propNameSet, depth-1, ms);
- }
- }
- }
-
- /**
- * Retrieve all versions from the version history associated with the given
- * resource. If the versions cannot be retrieved from the given resource
- * an exception is thrown.
- *
- * @param res
- * @return array of {@link VersionResource}s or an empty array if the versions
- * could not be retrieved.
- * @throws DavException if the version history could not be retrieved from
- * the given resource or if an error occurs while accessing the versions
- * from the version history resource.
- */
- private static VersionResource[] getVersions(DavResource res) throws DavException {
- VersionResource[] versions = new VersionResource[0];
- if (res instanceof VersionControlledResource) {
- versions = ((VersionControlledResource)res).getVersionHistory().getVersions();
- } else if (res instanceof VersionResource) {
- versions = ((VersionResource)res).getVersionHistory().getVersions();
- }
- return versions;
- }
-}
\ No newline at end of file
diff --git a/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/version/report/package.html b/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/version/report/package.html
deleted file mode 100644
index 25f787c1ca7..00000000000
--- a/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/version/report/package.html
+++ /dev/null
@@ -1,3 +0,0 @@
-
-Report interface and inplementation for default reports defined by RFC 3253.
-
\ No newline at end of file
diff --git a/contrib/orm-persistence/HEADER.txt b/contrib/orm-persistence/HEADER.txt
deleted file mode 100644
index 1c669de7240..00000000000
--- a/contrib/orm-persistence/HEADER.txt
+++ /dev/null
@@ -1,16 +0,0 @@
-/*
- * Copyright 2004-2005 The Apache Software Foundation or its licensors,
- * as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
\ No newline at end of file
diff --git a/contrib/orm-persistence/LICENSE.txt b/contrib/orm-persistence/LICENSE.txt
deleted file mode 100644
index d6456956733..00000000000
--- a/contrib/orm-persistence/LICENSE.txt
+++ /dev/null
@@ -1,202 +0,0 @@
-
- Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
- 7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
- 8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
- 9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
-
- END OF TERMS AND CONDITIONS
-
- APPENDIX: How to apply the Apache License to your work.
-
- To apply the Apache License to your work, attach the following
- boilerplate notice, with the fields enclosed by brackets "[]"
- replaced with your own identifying information. (Don't include
- the brackets!) The text should be enclosed in the appropriate
- comment syntax for the file format. We also recommend that a
- file or class name and description of purpose be included on the
- same "printed page" as the copyright notice for easier
- identification within third-party archives.
-
- Copyright [yyyy] [name of copyright owner]
-
- 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.
diff --git a/contrib/orm-persistence/README.txt b/contrib/orm-persistence/README.txt
deleted file mode 100644
index 04b663d5a3b..00000000000
--- a/contrib/orm-persistence/README.txt
+++ /dev/null
@@ -1,114 +0,0 @@
-ORM persistence managers for Jackrabbit README
-----------------------------------------------
-
-License (see also LICENSE.txt)
-------------------------------
-
-Copyright 2004-2005 The Apache Software Foundation or its licensors,
- as applicable.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-
-Introduction
-------------
-
-This sub-project of Jackrabbit providers two ORM-based persistence manager
-implementation.
-- OJB (http://db.apache.org/ojb) -based persistence manager
-- Hibernate (http://www.hibernate.org) -based persistence manager
-
-This also means that Jackrabbit can now store all content in a database.
-
-Requirements
-------------
-
-This project assumes that you have already successfully compiled and
-installed the parent project Jackrabbit into your maven repository. If
-this is not the case, go back to the root project and launch :
- maven jar:install
-
-For running the full tests, you will require a rather large amount of
-free memory, as the default setup with HSQLDB requires a lot of memory
-when handling large BLOB files.
-
-Existing limitations
---------------------
-
-- Values (including multi-values) are stored in a single database column
- in this implementation, limiting the length of values to the length
- defines in the SQL schema and the mapping files (there is no hard-coded
- limitation in the Java implementation though).
-
-Running
--------
-
-By default the package comes configured to run against an embedded HSQLDB
-database. In order for the tests and the benchmark to run, you must first
-run :
-
- maven clean
-
-The above resets the database, and clean the whole environment to run the
-tests and/or the benchmark. You can then launch
-
- maven start.test.server
-
-This launches the database in server mode (full embedded mode was not
-possible to implement because it doesn't finalize properly). Note that
-your shell is now blocked while running the database (CTRL+C to stop it)
-and you will need a second shell to run the tests/benchmarks
-
-From a second shell, you can now run
-
- maven
-
-This will run the tests. Please note that the tests may take a while
-to run (1 minute on a P4 3.0Ghz).
-
-If you just want to build the project without the tests :
-
- maven -Dmaven.test.skip=true
-
-Recycling HSQLDB
-----------------
-
-If you want to restart a test session, here is the quick procedure to do so:
-
-1. In the shell that launched the database, press CTRL+C
-2. In the other shell, type : maven clean (this resets the database to an
- empty schema by copying a file, so don't do it while HSQLDB is running !)
-3. Relaunch the database in it's shell by typing : maven start.test.server
-That's it !
-
-Using MySQL
------------
-
-The ORM persistence managers have also been tested against a MySQL database.
-In order to configure the persistence managers to use MySQL instead of HSQLDB
-you need to change the following files, depending on whether you want to use
-the OJB or Hibernate implementation :
-
-For OJB : applications/test/ojb/repository_database.xml
-For Hibernate : applications/test/hibernate.properties
-
-This project also contains a database initialization script that contains the
-DB schema :
-
- create_db_mysql.sql
-
-Also available is a batch script for Windows, that initializes a MySQL database
-called "jackrabbit", and recycles it if it already exists :
-
- reset_db_mysql.bat
-
-Enjoy !
\ No newline at end of file
diff --git a/contrib/orm-persistence/applications/test/OJB.properties b/contrib/orm-persistence/applications/test/OJB.properties
deleted file mode 100644
index 8dd50980e99..00000000000
--- a/contrib/orm-persistence/applications/test/OJB.properties
+++ /dev/null
@@ -1,453 +0,0 @@
-#
-# OJB.properties -- configuration of the OJB runtime environment
-# Version: 1.0
-# (c) 2001, 2002, 2003 Apache Software Foundation
-# Author: Thomas Mahler and many others
-# @version $Id: OJB.properties,v 1.75 2004/06/27 23:36:23 arminw Exp $
-#
-#----------------------------------------------------------------------------------------
-# repository file settings
-#----------------------------------------------------------------------------------------
-# The repositoryFile entry tells OJB to use this file as as its standard mapping
-# repository. The file is looked up from the classpath.
-#
-repositoryFile=ojb/repository.xml
-#
-# If the useSerializedRepository entry is set to true, OJB tries to load a
-# serialized version of the repository for performance reasons.
-# if set to false, OJB always loads the xml file.
-# Setting this flag to true will accelerate the startup sequence of OJB.
-# If set to true changes to the repository.xml file will only be detected
-# after maually deleting the repository.xml.serialized file.
-useSerializedRepository=false
-#
-# If Repository serialization is used the entry serializedRepositoryPath defines the
-# directory where the Repository is written to and read from.
-# this entry is used only when the useSerializedRepository flag is set to true
-#
-serializedRepositoryPath=.
-#
-#----------------------------------------------------------------------------------------
-# PersistenceBrokerFactory / PersistenceBroker
-#----------------------------------------------------------------------------------------
-# The PersistenceBrokerFactoryClass entry decides which concrete
-# PersistenceBrokerFactory implemention is to be used.
-PersistenceBrokerFactoryClass=org.apache.ojb.broker.core.PersistenceBrokerFactoryDefaultImpl
-# If in managed environment *only* the PB-api was used it's recommended to use this factory
-# to enable the PersistenceBroker instances to participate in the JTA transaction. This makes
-# e.g. PBStateListener work properly in managed environments.
-#PersistenceBrokerFactoryClass=org.apache.ojb.broker.core.PersistenceBrokerFactorySyncImpl
-#
-#
-# The PersistenceBrokerClass entry decides which concrete PersistenceBroker
-# implementation is to be served by the PersistenceBrokerFactory.
-# This is the singlevm implementation:
-PersistenceBrokerClass=org.apache.ojb.broker.core.PersistenceBrokerImpl
-#
-# This is an implementation that uses Prevayler (prevayler.sf.net) as the persistent storage.
-# Using this implementation OJB works as a simple OODBMS
-#PersistenceBrokerClass=org.apache.ojb.broker.prevayler.PBPrevaylerImpl
-#
-#----------------------------------------------------------------------------------------
-# PersistenceBroker pool
-#----------------------------------------------------------------------------------------
-# PersistenceBroker pool configuration
-# This pool uses the jakarta-commons-pool api.
-# There you can find things described in detail.
-#
-# maximum number of brokers that can be borrowed from the
-# pool at one time. When non-positive, there is no limit.
-maxActive=100
-#
-# controls the maximum number of brokers that can sit idle in the
-# pool (per key) at any time. When non-positive, there is no limit
-maxIdle=-1
-#
-# max time block to get broker instance from pool, after that exception is thrown.
-# When non-positive, block till last judgement
-maxWait=2000
-#
-# indicates how long the eviction thread should sleep before "runs" of examining
-# idle objects. When non-positive, no eviction thread will be launched.
-timeBetweenEvictionRunsMillis=-1
-#
-# specifies the minimum amount of time that an broker may sit idle
-# in the pool before it is eligable for eviction due to idle time.
-# When non-positive, no object will be dropped from the pool due
-# to idle time alone (depends on timeBetweenEvictionRunsMillis > 0)
-minEvictableIdleTimeMillis=1000000
-#
-# specifies the behaviour of the pool when broker capacity is
-# exhausted (see maxActive above)
-# 0 - fail
-# 1 - block
-# 2 - grow
-whenExhaustedAction=0
-#
-#
-#----------------------------------------------------------------------------------------
-# ConnectionFactory / Default ConnectionPool
-#----------------------------------------------------------------------------------------
-# The ConnectionFactoryClass entry determines which kind of ConnectionFactory
-# is to be used within org.apache.ojb as connection factory.
-# A ConnectionFactory is responsible for creating
-# JDBC Connections. Current version ships four implementations:
-#
-# 1. ConnectionFactoryNotPooledImpl
-# No pooling, no playing around.
-# Every connection request returns a new connection,
-# every connection release close the connection.
-# 2. ConnectionFactoryPooledImpl
-# This implementation supports connection pooling.
-# 3. ConnectionFactoryDBCPImpl
-# Using the jakarta-DBCP api for connection management, support
-# connection- and prepared statement-pooling, abandoned connection handling.
-# 4. ConnectionFactoryManagedImpl
-# Connection factory for use within managed environments - e.g. JBoss.
-# Every obtained DataSource was wrapped within OJB (and ignore
-# e.g. con.commit() calls within OJB).
-# Use this implementation e.g if you use Datasources from an application server.
-#
-# Use the OJB performance tests to decide, which implementation is best for you.
-# The proper way of obtaining a connection is configured in
-# JDBCConnectionDescriptor entries in the repository.xml file.
-# If want a more fine grained control of each connection pool used by OJB,
-# take a look at the repository.dtd, there was a possibility to override
-# this default connection factory entry in each JDBCConnectionDescriptor.
-#
-ConnectionFactoryClass=org.apache.ojb.broker.accesslayer.ConnectionFactoryPooledImpl
-#ConnectionFactoryClass=org.apache.ojb.broker.accesslayer.ConnectionFactoryNotPooledImpl
-#ConnectionFactoryClass=org.apache.ojb.broker.accesslayer.ConnectionFactoryManagedImpl
-#ConnectionFactoryClass=org.apache.ojb.broker.accesslayer.ConnectionFactoryDBCPImpl
-#
-#
-#----------------------------------------------------------------------------------------
-# ConnectionManager
-#----------------------------------------------------------------------------------------
-# The ConnectionManagerClass entry defines the ConnectionManager implemementation to be used
-ConnectionManagerClass=org.apache.ojb.broker.accesslayer.ConnectionManagerImpl
-#
-#
-#----------------------------------------------------------------------------------------
-# SqlGenerator
-#----------------------------------------------------------------------------------------
-# The SqlGeneratorClass entry defines the SqlGenerator implemementation to be used
-SqlGeneratorClass=org.apache.ojb.broker.accesslayer.sql.SqlGeneratorDefaultImpl
-#
-#
-#----------------------------------------------------------------------------------------
-# IndirectionHandler
-#----------------------------------------------------------------------------------------
-# The IndirectionHandlerClass entry defines the class to be used by OJB's proxies to
-# handle method invocations
-#
-IndirectionHandlerClass=org.apache.ojb.broker.core.proxy.IndirectionHandlerDefaultImpl
-#
-#----------------------------------------------------------------------------------------
-# ListProxy
-#----------------------------------------------------------------------------------------
-# The ListProxyClass entry defines the proxy class to be used for collections that
-# implement the java.util.List interface.
-#
-ListProxyClass=org.apache.ojb.broker.core.proxy.ListProxyDefaultImpl
-#
-#----------------------------------------------------------------------------------------
-# SetProxy
-#----------------------------------------------------------------------------------------
-# The SetProxyClass entry defines the proxy class to be used for collections that
-# implement the java.util.Set interface.
-#
-SetProxyClass=org.apache.ojb.broker.core.proxy.SetProxyDefaultImpl
-#
-#----------------------------------------------------------------------------------------
-# CollectionProxy
-#----------------------------------------------------------------------------------------
-# The CollectionProxyClass entry defines the proxy class to be used for collections that
-# do not implement java.util.List or java.util.Set.
-#
-CollectionProxyClass=org.apache.ojb.broker.core.proxy.CollectionProxyDefaultImpl
-#
-#----------------------------------------------------------------------------------------
-# StatementManager
-#----------------------------------------------------------------------------------------
-# The StatementManagerClass entry defines the StatementManager implemementation to be used
-StatementManagerClass=org.apache.ojb.broker.accesslayer.StatementManager
-#
-#
-#----------------------------------------------------------------------------------------
-# StatementsForClass
-#----------------------------------------------------------------------------------------
-# The StatementsForClassClass entry defines the StatementsForClass implemementation to be used
-# to implement cached statements.
-StatementsForClassClass=org.apache.ojb.broker.accesslayer.StatementsForClassImpl
-#
-#
-#----------------------------------------------------------------------------------------
-# JdbcAccess
-#----------------------------------------------------------------------------------------
-# The JdbcAccessClass entry defines the JdbcAccess implemementation to be used
-JdbcAccessClass=org.apache.ojb.broker.accesslayer.JdbcAccessImpl
-#
-#
-#----------------------------------------------------------------------------------------
-# RowReader
-#----------------------------------------------------------------------------------------
-# Set the standard RowReader implementation. It is also possible to specify the
-# RowReader on class-descriptor level.
-RowReaderDefaultClass=org.apache.ojb.broker.accesslayer.RowReaderDefaultImpl
-#
-#----------------------------------------------------------------------------------------
-# Object cache
-#----------------------------------------------------------------------------------------
-# The ObjectCacheClass entry tells OJB which concrete ObjectCache
-# implementation is to be used as standard cache.
-# Its also possible to override this entry adding object-cache elements
-# on jdbc-connection-descriptor level and
-# per class-descriptor in repository file. More info see documentation.
-#
-ObjectCacheClass=org.apache.ojb.broker.cache.ObjectCacheDefaultImpl
-#ObjectCacheClass=org.apache.ojb.broker.cache.ObjectCacheEmptyImpl
-#ObjectCacheClass=org.apache.ojb.broker.cache.ObjectCachePerBrokerImpl
-#ObjectCacheClass=org.apache.ojb.broker.cache.ObjectCacheJCSPerClassImpl
-#ObjectCacheClass=org.apache.ojb.broker.cache.ObjectCachePerClassImpl
-#
-#
-# This property is only relevant if the per class-descriptor object-cache
-# declaration was used in conjunction with metadata runtime changes.
-# If set 'flase' the class name of the object is used
-# to find a per class ObjectCache implementation.
-# If set 'true' the ObjectCacheDescriptor instance is used as key to
-# find a per class ObjectCache, this enables to use different ObjectCache
-# instances for the same class.
-descriptorBasedCaches=false
-#
-#
-# Use CacheFilters to do filter operations before caching methods were
-# called. Build your own filter class by implementing org.apache.ojb.cache.CacheFilter.
-# It is possible to use a arbitrary number of CacheFilters, but this slows
-# down the performance of the cache, thus handle with care.
-#
-# - org.apache.ojb.broker.cache.CacheFilterClassImpl
-# allows filtering of classes
-# - org.apache.ojb.broker.cache.CacheFilterPackageImpl
-# allows filtering of packages
-# More info see Javadoc of the according classes.
-# Set a comma separated list of CacheFilter.
-#ObjectCacheFilter=org.apache.ojb.broker.cache.CacheFilterClassImpl,org.apache.ojb.broker.cache.CacheFilterPackageImpl
-#
-#----------------------------------------------------------------------------------------
-# Locking
-#----------------------------------------------------------------------------------------
-# The LockManagerClass entry tells OJB which concrete LockManager
-# implementation is to be used.
-LockManagerClass=org.apache.ojb.odmg.locking.LockManagerDefaultImpl
-#
-# The LockMapClass entry tells OJB which concrete LockMap
-# implementation is to be used.
-# If OJB is running on multiple concurrent clients it is recommended
-# to use the RemoteLockMapImpl. It guarantees to provide
-# Lockmanagement across multiple JVMs.
-# This Implemenation relies on a Servlet based Lockserver. To use it you have to
-# deploy the ojb-lockserver.war into a Servlet engine.
-# and you have to set the Property LockServletUrl to point to this servlet.
-# (see LockServletUrl section below).
-# If OJB is running in a single JVM (e.g. in a desktop app, or in a servlet
-# engine) it is save to use the InMemoryLockMapImpl. Using it will result
-# in a large performance gain.
-#LockMapClass=org.apache.ojb.odmg.locking.RemoteLockMapImpl
-LockMapClass=org.apache.ojb.odmg.locking.InMemoryLockMapImpl
-#
-# The LockTimeout entry defines the maximum time in milliseconds
-# that a lock may be hold. Defaults to 60000 = 1 minute
-LockTimeout=60000
-#
-# The ImplicitLocking entry defines if implicit lock acquisition is
-# to be used. If set to true OJB implicitely locks objects to ODMG
-# transactions after performing OQL queries.
-# If implicit locking is used locking objects is recursive, that is
-# associated objects are also locked.
-# If ImplicitLocking is set to false, no locks are obtained in OQL
-# queries and there is also no recursive locking.
-ImplicitLocking=true
-#ImplicitLocking=false
-#
-#
-# The LockServletUrl entry points to the Lockserver servlet.
-# This Servlet is addressed by all distributed JVMs if the RemoteLockMapImpl
-# is used.
-LockServletUrl=http://127.0.0.1:8080/ojb-lockserver
-#
-#
-# The LockAssociations entry defines the behaviour for the OJB
-# implicit locking feature. If set to WRITE (default) acquiring a write-
-# lock on a given object x implies write locks on all objects associated
-# to x. If set to READ implicit read-locks are acquired.
-# Acquiring a read-lock on x thus allways results in implicit read-locks
-# on all associated objects.
-#LockAssociations=READ
-LockAssociations=WRITE
-#
-#
-#----------------------------------------------------------------------------------------
-# OQL / SQL settings
-#----------------------------------------------------------------------------------------
-# The OqlCollectionClass entry defines the collection type returned
-# from OQL queries. By default this value is set to DListImpl.
-# This will be good for most situations as DList allows maximum flexibility
-# in a ODMG environment. See also section 'ODMG settings'.
-# Using DLists for large resultsets may be bad for application performance.
-# For these scenarios you can use ArrayLists or Vectors.
-# Important note: the collections class to be used MUST implement the
-# interface org.apache.ojb.broker.ManageableCollection.
-#
-OqlCollectionClass=org.apache.ojb.odmg.collections.DListImpl_2
-# OqlCollectionClass=org.apache.ojb.broker.util.collections.ManageableArrayList
-# OqlCollectionClass=org.apache.ojb.broker.util.ManageableVector
-#
-# The SqlInLimit entry limits the number of values in IN-sql statement,
-# -1 for no limits. This hint is used in Criteria.
-SqlInLimit=200
-#
-#
-#----------------------------------------------------------------------------------------
-# ODMG settings
-#----------------------------------------------------------------------------------------
-# Specify the used base class for ODMG API
-# - ImplementationDefaultImpl is the default class
-# - ImplementationJTAImpl is for use in managed environments like J2EE conform
-# Application Server
-#
-ImplementationClass=org.apache.ojb.odmg.ImplementationImpl
-#ImplementationClass=org.apache.ojb.odmg.ImplementationJTAImpl
-#
-#
-# Specify the used tx handling.
-# - LocalTxManager use if you want the transaction to be associated by a thread
-# - JTATxManager use if you want the transaction to be associated via the Transaction
-# manager that is in your application server.
-#
-OJBTxManagerClass=org.apache.ojb.odmg.LocalTxManager
-#OJBTxManagerClass=org.apache.ojb.odmg.JTATxManager
-#
-#
-# Used ODMG collection implementation classes
-# (e.g. when do a Implementation#newDlist() call)
-#
-# org.odmg.DList implementation class
-DListClass=org.apache.ojb.odmg.collections.DListImpl_2
-#DListClass=org.apache.ojb.odmg.collections.DListImpl
-#
-# org.odmg.DArray implementation class
-DArrayClass=org.apache.ojb.odmg.collections.DListImpl_2
-#DArrayClass=org.apache.ojb.odmg.collections.DListImpl
-#
-# org.odmg.DMap implementation class
-DMapClass=org.apache.ojb.odmg.collections.DMapImpl
-#
-# org.odmg.DBag implementation class
-DBagClass=org.apache.ojb.odmg.collections.DBagImpl
-#
-# org.odmg.DSet implementation class
-DSetClass=org.apache.ojb.odmg.collections.DSetImpl
-#
-#
-#----------------------------------------------------------------------------------------
-# Meta data / mapping settings
-#----------------------------------------------------------------------------------------
-# The PersistentFieldClass property defines the implementation class
-# for PersistentField attributes used in the OJB MetaData layer.
-# By default the best performing attribute/refection based implementation
-# is selected (PersistentFieldDirectAccessImpl).
-#
-# - PersistentFieldDirectAccessImpl
-# is a high-speed version of the access strategies.
-# It does not cooperate with an AccessController,
-# but accesses the fields directly. Persistent
-# attributes don't need getters and setters
-# and don't have to be declared public or protected
-# - PersistentFieldPrivilegedImpl
-# Same as above, but does cooperate with AccessController and do not
-# suppress the java language access check (but is slow compared with direct access).
-# - PersistentFieldIntrospectorImpl
-# uses JavaBeans compliant calls only to access persistent attributes.
-# No Reflection is needed. But for each attribute xxx there must be
-# public getXxx() and setXxx() methods.
-# - PersistentFieldDynaBeanAccessImpl
-# implementation used to access a property from a
-# org.apache.commons.beanutils.DynaBean.
-# - PersistentFieldAutoProxyImpl
-# for each field determines upon first access how to access this particular field
-# (directly, as a bean, as a dyna bean) and then uses that strategy
-#
-#PersistentFieldClass=org.apache.ojb.broker.metadata.fieldaccess.PersistentFieldDirectAccessImpl
-#PersistentFieldClass=org.apache.ojb.broker.metadata.fieldaccess.PersistentFieldPrivilegedImpl
-#PersistentFieldClass=org.apache.ojb.broker.metadata.fieldaccess.PersistentFieldIntrospectorImpl
-#PersistentFieldClass=org.apache.ojb.broker.metadata.fieldaccess.PersistentFieldDynaBeanAccessImpl
-#PersistentFieldClass=org.apache.ojb.broker.metadata.fieldaccess.PersistentFieldAutoProxyImpl
-#
-# Here are the new upcoming PersistentField implementations. These classes will replace the
-# 'old' ones on next release. They pass the test-suite, but should be tested by community too.
-# The new implementations are about 50 times faster in handling nested fields.
-PersistentFieldClass=org.apache.ojb.broker.metadata.fieldaccess.PersistentFieldDirectAccessImplNew
-#PersistentFieldClass=org.apache.ojb.broker.metadata.fieldaccess.PersistentFieldPrivilegedImplNew
-#PersistentFieldClass=org.apache.ojb.broker.metadata.fieldaccess.PersistentFieldIntrospectorImplNew
-#PersistentFieldClass=org.apache.ojb.broker.metadata.fieldaccess.PersistentFieldAutoProxyImpl
-#PersistentFieldClass=org.apache.ojb.broker.metadata.fieldaccess.PersistentFieldDynaBeanImplNew
-#(DynaBean implementation does not support nested fields)
-#
-#----------------------------------------------------------------------------------------
-# Component Intercepting for Profiling and Tracing
-#----------------------------------------------------------------------------------------
-# By enabling an InterceptorClass all OJB components will use
-# this Interceptor. Interceptors allow advanced tracing and Profiling
-# of all component method calls.
-# This is currently an experimental feature useful only for OJB kernel developers.
-#
-#InterceptorClass=org.apache.ojb.broker.util.interceptor.TracingInterceptor
-#
-#----------------------------------------------------------------------------------------
-# Transaction Management and assocation
-#----------------------------------------------------------------------------------------
-# (optional, only used when OJB runs within managed environments)
-# To praticipate in JTA transaction OJB needs access to the underlying transaction manager.
-# The TransactionManager is acquired in different ways dependent on the application server.
-# The JTATransactionManagerClass property allows you to specify the class that implements
-# the proper behaviour for finding the transaction manager. Only use when OJBTxManagerClass
-# is set to a factory that uses the application server transaction manager
-# (org.apache.ojb.odmg.JTATxManager)
-#
-# JBoss Transaction Manager Factory
-JTATransactionManagerClass=org.apache.ojb.broker.transaction.tm.JBossTransactionManagerFactory
-# Weblogic Transaction Manager Factory
-#JTATransactionManagerClass=org.apache.ojb.broker.transaction.tm.WeblogicTransactionManagerFactory
-# WebSphere transaction manager factory
-#JTATransactionManagerClass=org.apache.ojb.broker.transaction.tm.WebSphereTransactionManagerFactory
-# Orion transaction manager factory
-#JTATransactionManagerClass=org.apache.ojb.broker.transaction.tm.OrionTransactionManagerFactory
-# SunOne transaction manager factory
-#JTATransactionManagerClass=org.apache.ojb.broker.transaction.tm.SunOneTransactionManagerFactory
-# JOnAs transaction manager factory
-#JTATransactionManagerClass=org.apache.ojb.broker.transaction.tm.JOnASTransactionManagerFactory
-#
-#
-#----------------------------------------------------------------------------------------
-# Logging settings are now in their own file, OJB-logging.properties
-#----------------------------------------------------------------------------------------
-#----------------------------------------------------------------------------------------
-# End of OJB.properties file
-#----------------------------------------------------------------------------------------
diff --git a/contrib/orm-persistence/applications/test/ehcache.xml b/contrib/orm-persistence/applications/test/ehcache.xml
deleted file mode 100644
index ede25912550..00000000000
--- a/contrib/orm-persistence/applications/test/ehcache.xml
+++ /dev/null
@@ -1,121 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- -->
-
-
-
-
-
-
-
-
diff --git a/contrib/orm-persistence/applications/test/hibernate.cfg.xml b/contrib/orm-persistence/applications/test/hibernate.cfg.xml
deleted file mode 100644
index c68bc7a6b96..00000000000
--- a/contrib/orm-persistence/applications/test/hibernate.cfg.xml
+++ /dev/null
@@ -1,33 +0,0 @@
-
-
-
-
-
-
-
-
- false
-
-
-
-
-
-
-
diff --git a/contrib/orm-persistence/applications/test/hibernate.properties b/contrib/orm-persistence/applications/test/hibernate.properties
deleted file mode 100644
index 5794e81b19a..00000000000
--- a/contrib/orm-persistence/applications/test/hibernate.properties
+++ /dev/null
@@ -1,418 +0,0 @@
-# Copyright 2003-2005 The Apache Software Foundation or its licensors,
-# as applicable
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-######################
-### Query Language ###
-######################
-
-## define query language constants / function names
-
-hibernate.query.substitutions true 1, false 0, yes 'Y', no 'N'
-
-
-
-#################
-### Platforms ###
-#################
-
-## JNDI Datasource
-
-#hibernate.connection.datasource jdbc/test
-#hibernate.connection.username db2
-#hibernate.connection.password db2
-
-
-## HypersonicSQL
-
-hibernate.dialect net.sf.hibernate.dialect.HSQLDialect
-hibernate.connection.driver_class org.hsqldb.jdbcDriver
-hibernate.connection.username sa
-hibernate.connection.password
-hibernate.connection.url jdbc:hsqldb:hsql://localhost
-#hibernate.connection.url jdbc:hsqldb:test
-#hibernate.connection.url jdbc:hsqldb:.
-
-
-## PostgreSQL
-
-#hibernate.dialect net.sf.hibernate.dialect.PostgreSQLDialect
-#hibernate.connection.driver_class org.postgresql.Driver
-#hibernate.connection.url jdbc:postgresql:template1
-#hibernate.connection.username pg
-#hibernate.connection.password
-#hibernate.query.substitutions yes 'Y', no 'N'
-
-
-## DB2
-
-#hibernate.dialect net.sf.hibernate.dialect.DB2Dialect
-#hibernate.connection.driver_class COM.ibm.db2.jdbc.app.DB2Driver
-#hibernate.connection.url jdbc:db2:test
-#hibernate.connection.username db2
-#hibernate.connection.password db2
-
-
-## DB2/400
-
-#hibernate.dialect net.sf.hibernate.dialect.DB2400Dialect
-#hibernate.connection.username user
-#hibernate.connection.password password
-
-## Native driver
-#hibernate.connection.driver_class COM.ibm.db2.jdbc.app.DB2Driver
-#hibernate.connection.url jdbc:db2://systemname
-
-## Toolbox driver
-#hibernate.connection.driver_class com.ibm.as400.access.AS400JDBCDriver
-#hibernate.connection.url jdbc:as400://systemname
-
-
-## MySQL
-
-#hibernate.dialect net.sf.hibernate.dialect.MySQLDialect
-#hibernate.connection.driver_class org.gjt.mm.mysql.Driver
-#hibernate.connection.driver_class com.mysql.jdbc.Driver
-#hibernate.connection.url jdbc:mysql:///jackrabbit
-#hibernate.connection.username root
-#hibernate.connection.password
-
-
-## Oracle
-
-#hibernate.dialect net.sf.hibernate.dialect.Oracle9Dialect
-#hibernate.dialect net.sf.hibernate.dialect.OracleDialect
-#hibernate.connection.driver_class oracle.jdbc.driver.OracleDriver
-#hibernate.connection.username ora
-#hibernate.connection.password ora
-#hibernate.connection.url jdbc:oracle:thin:@localhost:1521:test
-
-
-## Sybase
-
-#hibernate.dialect net.sf.hibernate.dialect.SybaseDialect
-#hibernate.connection.driver_class com.sybase.jdbc2.jdbc.SybDriver
-#hibernate.connection.username sa
-#hibernate.connection.password sasasa
-#hibernate.connection.url jdbc:sybase:Tds:co3061835-a:5000/tempdb
-
-
-## Mckoi SQL
-
-#hibernate.dialect net.sf.hibernate.dialect.MckoiDialect
-#hibernate.connection.driver_class com.mckoi.JDBCDriver
-#hibernate.connection.url jdbc:mckoi:///
-#hibernate.connection.url jdbc:mckoi:local://C:/mckoi1.00/db.conf
-#hibernate.connection.username admin
-#hibernate.connection.password nimda
-
-
-## SAP DB
-
-#hibernate.dialect net.sf.hibernate.dialect.SAPDBDialect
-#hibernate.connection.driver_class com.sap.dbtech.jdbc.DriverSapDB
-#hibernate.connection.url jdbc:sapdb://localhost/TST
-#hibernate.connection.username TEST
-#hibernate.connection.password TEST
-#hibernate.query.substitutions yes 'Y', no 'N'
-
-
-## MS SQL Server
-
-#hibernate.dialect net.sf.hibernate.dialect.SQLServerDialect
-#hibernate.connection.username sa
-#hibernate.connection.password sa
-
-## JSQL Driver
-#hibernate.connection.driver_class com.jnetdirect.jsql.JSQLDriver
-#hibernate.connection.url jdbc:JSQLConnect://1E1/test
-
-## JTURBO Driver
-#hibernate.connection.driver_class com.newatlanta.jturbo.driver.Driver
-#hibernate.connection.url jdbc:JTurbo://1E1:1433/test
-
-## WebLogic Driver
-#hibernate.connection.driver_class weblogic.jdbc.mssqlserver4.Driver
-#hibernate.connection.url jdbc:weblogic:mssqlserver4:1E1:1433
-
-## Microsoft Driver (not recommended!)
-#hibernate.connection.driver_class com.microsoft.jdbc.sqlserver.SQLServerDriver
-#hibernate.connection.url jdbc:microsoft:sqlserver://1E1;DatabaseName=test;SelectMethod=cursor
-
-## jTDS (since version 0.9)
-#hibernate.connection.driver_class net.sourceforge.jtds.jdbc.Driver
-#hibernate.connection.url jdbc:jtds:sqlserver://1E1/test
-
-## Interbase
-
-#hibernate.dialect net.sf.hibernate.dialect.InterbaseDialect
-#hibernate.connection.username sysdba
-#hibernate.connection.password masterkey
-
-## DO NOT specify hibernate.connection.sqlDialect
-
-## InterClient
-
-#hibernate.connection.driver_class interbase.interclient.Driver
-#hibernate.connection.url jdbc:interbase://localhost:3060/C:/firebird/test.gdb
-
-## Pure Java
-
-#hibernate.connection.driver_class org.firebirdsql.jdbc.FBDriver
-#hibernate.connection.url jdbc:firebirdsql:localhost/3050:/firebird/test.gdb
-
-
-## Pointbase
-
-#hibernate.dialect net.sf.hibernate.dialect.PointbaseDialect
-#hibernate.connection.driver_class com.pointbase.jdbc.jdbcUniversalDriver
-#hibernate.connection.url jdbc:pointbase:embedded:sample
-#hibernate.connection.username PBPUBLIC
-#hibernate.connection.password PBPUBLIC
-
-
-
-#################################
-### Hibernate Connection Pool ###
-#################################
-
-hibernate.connection.pool_size 10
-
-
-
-###########################
-### C3P0 Connection Pool###
-###########################
-
-#hibernate.c3p0.max_size 2
-#hibernate.c3p0.min_size 2
-#hibernate.c3p0.timeout 5000
-#hibernate.c3p0.max_statements 100
-#hibernate.c3p0.idle_test_period 3000
-#hibernate.c3p0.acquire_increment 2
-##hibernate.c3p0.validate false
-
-
-
-###################################
-### Apache DBCP Connection Pool ###
-###################################
-
-## connection pool
-
-hibernate.dbcp.maxActive 100
-hibernate.dbcp.whenExhaustedAction 1
-hibernate.dbcp.maxWait 120000
-hibernate.dbcp.maxIdle 10
-
-## prepared statement cache
-
-hibernate.dbcp.ps.maxActive 100
-hibernate.dbcp.ps.whenExhaustedAction 1
-hibernate.dbcp.ps.maxWait 120000
-hibernate.dbcp.ps.maxIdle 10
-
-## optional query to validate pooled connections:
-
-#hibernate.dbcp.validationQuery select 1 from dual
-#hibernate.dbcp.testOnBorrow true
-#hibernate.dbcp.testOnReturn false
-
-
-
-##############################
-### Proxool Connection Pool###
-##############################
-
-## Properties for external configuration of Proxool
-
-hibernate.proxool.pool_alias pool1
-
-## Only need one of the following
-
-#hibernate.proxool.existing_pool true
-#hibernate.proxool.xml proxool.xml
-#hibernate.proxool.properties proxool.properties
-
-
-
-#################################
-### Plugin ConnectionProvider ###
-#################################
-
-## use a custom ConnectionProvider (if not set, Hibernate will choose a built-in ConnectionProvider using hueristics)
-
-#hibernate.connection.provider_class net.sf.hibernate.connection.DriverManagerConnectionProvider
-#hibernate.connection.provider_class net.sf.hibernate.connection.DatasourceConnectionProvider
-#hibernate.connection.provider_class net.sf.hibernate.connection.C3P0ConnectionProvider
-hibernate.connection.provider_class net.sf.hibernate.connection.DBCPConnectionProvider
-#hibernate.connection.provider_class net.sf.hibernate.connection.ProxoolConnectionProvider
-
-
-
-#######################
-### Transaction API ###
-#######################
-
-## the Transaction API abstracts application code from the underlying JTA or JDBC transactions
-
-#hibernate.transaction.factory_class net.sf.hibernate.transaction.JTATransactionFactory
-hibernate.transaction.factory_class net.sf.hibernate.transaction.JDBCTransactionFactory
-
-
-## to use JTATransactionFactory, Hibernate must be able to locate the UserTransaction in JNDI
-## default is java:comp/UserTransaction
-## you do NOT need this setting if you specify hibernate.transaction.manager_lookup_class
-
-#jta.UserTransaction jta/usertransaction
-#jta.UserTransaction javax.transaction.UserTransaction
-#jta.UserTransaction UserTransaction
-
-
-## to use JCS caching with JTA, Hibernate must be able to obtain the JTA TransactionManager
-
-#hibernate.transaction.manager_lookup_class net.sf.hibernate.transaction.JBossTransactionManagerLookup
-#hibernate.transaction.manager_lookup_class net.sf.hibernate.transaction.WeblogicTransactionManagerLookup
-#hibernate.transaction.manager_lookup_class net.sf.hibernate.transaction.WebSphereTransactionManagerLookup
-#hibernate.transaction.manager_lookup_class net.sf.hibernate.transaction.OrionTransactionManagerLookup
-#hibernate.transaction.manager_lookup_class net.sf.hibernate.transaction.ResinTransactionManagerLookup
-
-
-
-##############################
-### Miscellaneous Settings ###
-##############################
-
-## print all generated SQL to the console
-
-#hibernate.show_sql true
-
-
-## auto schema export
-
-#hibernate.hbm2ddl.auto create-drop
-#hibernate.hbm2ddl.auto create
-hibernate.hbm2ddl.auto update
-
-
-## specify a JDBC isolation level
-
-#hibernate.connection.isolation 4
-
-
-## set the JDBC fetch size
-
-hibernate.jdbc.fetch_size 25
-
-
-## set the maximum JDBC 2 batch size (a nonzero value enables batching)
-
-hibernate.jdbc.batch_size 20
-
-## use JDBC batching for versioned data
-
-hibernate.jdbc.batch_versioned_data true
-
-## enable use of JDBC 2 scrollable ResultSets (specifying a Dialect will cause Hibernate to use a sensible default)
-
-#hibernate.jdbc.use_scrollable_resultset true
-
-
-## use streams when writing binary types to / from JDBC
-
-hibernate.jdbc.use_streams_for_binary true
-
-
-## use JDBC 3 PreparedStatement.getGeneratedKeys to get the identifier of an inserted row
-
-#hibernate.jdbc.use_get_generated_keys true
-
-
-## specify a default schema for unqualified tablenames
-
-#hibernate.default_schema test
-
-
-## use a custom stylesheet for XML generation (if not specified, hibernate-default.xslt will be used)
-
-#hibernate.xml.output_stylesheet C:/Hibernate/net/sf/hibernate/hibernate-default.xslt
-
-
-## enable outerjoin fetching (specifying a Dialect will cause Hibernate to use sensible default)
-
-#hibernate.use_outer_join false
-
-
-## set the maximum depth of the outer join fetch tree
-
-hibernate.max_fetch_depth 1
-
-
-## enable CGLIB reflection optimizer (enabled by default)
-
-hibernate.cglib.use_reflection_optimizer true
-
-
-
-##########################
-### Second-level Cache ###
-##########################
-
-## optimize chache for minimal "puts" instead of minimal "gets" (good for clustered cache)
-
-#hibernate.cache.use_minimal_puts true
-
-
-## set a prefix for cache region names
-
-hibernate.cache.region_prefix hibernate.test
-
-
-## enable the query cache
-
-hibernate.cache.use_query_cache true
-
-
-## choose a cache implementation
-
-hibernate.cache.provider_class net.sf.hibernate.cache.EhCacheProvider
-#hibernate.cache.provider_class net.sf.hibernate.cache.EmptyCacheProvider
-#hibernate.cache.provider_class net.sf.hibernate.cache.HashtableCacheProvider
-#hibernate.cache.provider_class net.sf.hibernate.cache.TreeCacheProvider
-#hibernate.cache.provider_class net.sf.hibernate.cache.OSCacheProvider
-#hibernate.cache.provider_class net.sf.hibernate.cache.JCSCacheProvider
-#hibernate.cache.provider_class net.sf.hibernate.cache.SwarmCacheProvider
-
-
-
-############
-### JNDI ###
-############
-
-## specify a JNDI name for the SessionFactory
-
-#hibernate.session_factory_name hibernate/session_factory
-
-
-## Hibernate uses JNDI to bind a name to a SessionFactory and to look up the JTA UserTransaction;
-## if hibernate.jndi.* are not specified, Hibernate will use the default InitialContext() which
-## is the best approach in an application server
-
-#file system
-#hibernate.jndi.class com.sun.jndi.fscontext.RefFSContextFactory
-#hibernate.jndi.url file:/
-
-#WebSphere
-#hibernate.jndi.class com.ibm.websphere.naming.WsnInitialContextFactory
-#hibernate.jndi.url iiop://localhost:900/
\ No newline at end of file
diff --git a/contrib/orm-persistence/applications/test/hibernate/jackrabbit.hbm.xml b/contrib/orm-persistence/applications/test/hibernate/jackrabbit.hbm.xml
deleted file mode 100644
index 7a6abb8dd60..00000000000
--- a/contrib/orm-persistence/applications/test/hibernate/jackrabbit.hbm.xml
+++ /dev/null
@@ -1,147 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/contrib/orm-persistence/applications/test/import.xml b/contrib/orm-persistence/applications/test/import.xml
deleted file mode 100644
index befdf01c30b..00000000000
--- a/contrib/orm-persistence/applications/test/import.xml
+++ /dev/null
@@ -1,732 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- EHC/Hôpital de Morges/C. Vandenbulcke, Responsable hygiène/octobre 2003
-
-
-
-
-
diff --git a/contrib/orm-persistence/applications/test/largeimport.xml b/contrib/orm-persistence/applications/test/largeimport.xml
deleted file mode 100644
index 302a2f74fe6..00000000000
--- a/contrib/orm-persistence/applications/test/largeimport.xml
+++ /dev/null
@@ -1,8742 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Capgemini
-
-
-
- (version du 01/06/2004)
-
-
-
- Il est rappelé que la proposition définitive fournie après l
-'
- audition fera office de CCTP pour le projet. Elle doit donc prendre en compte toutes les remarques, observations ou compléments échangés pendant la phase d
-'
- évaluation. Elle doit lever les éventuelles ambiguïtés sur le périmètre de la prestation : il est donc nécessaire de supprimer les mentions à des prestations optionnelles qui ne sont pas prévues dans le cadre du marché. Supprimer systématiquement les formes conditionnelles dans l
-'
- offre (pourrait, serait) lorsque les termes de la condition ne sont pas explicites. Préférer des formes au présent ou au futur. Un effort, devra notamment être fait sur le cadre de réponse
-
-
- Les réponses aux questions écrites transmises en mai devront être annexées à la nouvelle proposition commerciale. Si des éléments sont contradictoires avec la nouvelle proposition commerciale il convient alors de le mentionner.
-
-
-
- Les réponses aux questions posées lors de l’audition doivent apparaître clairement dans la nouvelle proposition commerciale.
-
-
-
-
-
-
-
- 1
-
-
- ère
-
-
- partie : présentation du candidat et de son organisation, reformulation du projet et compréhension du contexte (1 heure). Questions / réponses entre les membres de la commission et le candidat (30 min.).
-
-
-
-
-
-
-
- Démarrage anticipé : est-il prévu de commencer les développements sur des plateformes mises à disposition par le prestataire dans ses locaux.
-
-
-
-
-
-
- De T0 à T0+9 semaines, il est simplement demandé des postes de travail J2EE (windows, 1 Go de mémoire).
-
-
-
- Les travaux peuvent donc se réaliser dans les locaux de la DPMA dès le T0 sur ces postes de travail.
-
-
-
-
-
-
- Les candidats doivent préciser quelles seront les ressources humaines que les éditeurs mettront à la disposition de l
-'
- intégrateur pendant la réalisation du projet. Ces ressources doivent avoir une expérience d’au moins un projet de gestion de contenu et de portail. L
-'
- implication des éditeurs tout au long du projet sera un plus pour le Minefi.
-
-
-
-
-
- Codeva est intégré à hauteur de 80 jours durant la phase de développement des éléments génériques au titre du développement collaboratif.
-
-
- Clément Hegger, chef de projet Codeva, assiste Capgemini tout au long du projet.
-
-
-
-
-
-
- Ressources allouées au projet : La réalisation du prototype a-t-elle permis de dégager de nouveaux éléments techniques ou fonctionnels qui pourraient être mis en commun entre les espaces : sites alize,
-
-
- www.minefi.gouv.fr
-
-
- et leurs sous-sites?
-
-
-
-
-
- Les éléments techniques et fonctionnels transverses aux différents sites sont soit présents dans Jahia, soit déjà prévus dans les développements collaboratifs.
-
-
-
-
-
- Les prestataires devront préciser des URL de deux projets réalisés sur Internet si
-
- possible par eux et/ou avec les outils proposés. Ces projets doivent être le plus
-
- représentatifs possibles des attentes du Minefi notamment au travers de la personnalisation des portails.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Adresse URL
-
-
-
-
- Référence
-
-
-
-
- Portail
-
-
-
-
- Gestion de contenu
-
-
-
-
- Personnalisation
-
-
-
-
- Technologies
-
-
-
-
-
-
-
-
- http://Unil.ch
-
-
-
-
-
-
- Codeva
-
-
-
-
- O
-
-
-
-
- O
-
-
-
-
- MyUnil (constitution d’un bureau personnalisé).
-
-
-
-
- Jahia
-
-
-
-
-
-
-
-
- http://www.edfentreprise.com
-
-
-
-
-
-
- Capgemini
-
-
-
-
- O
-
-
-
-
- O
-
-
-
-
- Espace client propre à son profil + données personnelles
-
-
-
-
- BEA Portal /
-
- Documentum
-
-
-
-
-
-
-
-
-
- http://barcelona.com
-
-
-
-
-
-
- Codeva
-
-
-
-
- O
-
-
-
-
- O
-
-
-
-
- N
-
-
-
-
- Jahia
-
-
-
-
-
-
-
-
- http://monagence.edf.fr
-
-
-
-
-
-
- Capgemini
-
-
-
-
- O
-
-
-
-
- O
-
-
-
-
- O (données personnelles)
-
-
-
-
- Weblogic
-
-
-
-
-
-
-
-
- http://www.culture.fr
-
-
-
-
-
-
- Capgemini
-
-
-
-
- O
-
-
-
-
- O
-
-
-
-
- N
-
-
-
-
- Zope/CPS
-
-
-
-
-
-
-
-
-
- Définition fonctionnelle
-
-
-
-
- Dans la phase à dominante fonctionnelle (telle que le cadrage fonctionnel ou l’étude différentielle) est-il prévu de faire intervenir des personnes dont le profil est fonctionnel, c’est à dire des personnes qui ont l’habitude de gérer du contenu et de piloter des chantiers de portail, y compris dans leur dimension ergonomique et graphique ?
-
-
- Ou les interventions prévues se limitent-elles à des profils de type « expert technique » (programmeur, analyste, …) ?
-
-
-
-
- Le chef de projet pressenti, Sandrine Dalbègue, a travaillé sur différents portails :
-
-
-
- www.cci.fr
-
-
-
- ,
-
-
-
- www.culture.fr
-
-
-
- , ArchipelRH (portail RH d’EDF). Sandrine a également participé aux différentes évaluations techniques et fonctionnelles de Jahia.
-
-
-
-
-
-
-
- Définition fonctionnelle des modules développés en mode collaboratif
-
-
-
-
- Confirmer que les fonctionnalités développées en mode collaboratif seront étudiées de façon autonome par le prestataire sans que le Minefi soit sollicité pour établir les spécifications fonctionnelles et techniques. La DPMA souhaite uniquement être informée lors de l’avancement des travaux. Préciser les moyens d
-'
- études et les livrables intermédiaires prévus pour ces travaux.
-
-
- Fournir des engagements clairs concernant le plan de développement du produit JAHIA indépendamment du projet du Ministère.
-
-
-
-
- Sont financées actuellement les évolutions et devraient être disponibles cet été :
-
-
-
-
-
- gestion des champs obligatoires,
-
-
-
-
- Support JSR 168.
-
-
-
-
-
-
- Sont prévues (notamment en fonction du choix de la DPMA) :
-
-
-
-
-
- Support des métadonnées Dublin Core standard,
-
-
-
-
-
- Réplication multi-site,
-
-
-
-
-
- Gestion d’un statut archivé,
-
-
-
-
-
- Gestion multi LDAP.
-
-
-
-
-
-
- Est réalisé par un client de Jahia (date non fournie) :
-
-
-
-
- Gestion de formulaires.
-
-
-
-
-
-
-
-
- 2
-
-
- ème
-
-
- partie : présentation de l’offre technique et financière du candidat (1 heure 30). Questions / réponses entre les membres de la commission et le candidat (30 min.).
-
-
-
-
-
-
- Les sociétés doivent s
-'
- engager dans la francisation des libellés, des messages, des commandes et la documentation de l
-'
- ensemble des outils nécessaires au fonctionnement et au paramétrage du système livré. Il est à noter que pour les utilisateurs (intra/internautes et gestionnaires de contenu déconcentrés) cette demande est indispensable ; pour les administrateurs (de contenu Alize/Sircom et système); cette demande est souhaitable, mais n
-'
- est probablement pas une contrainte.
-
-
-
-
-
- La documentation de la version 4 est en cours de francisation.
-
-
- Le produit est déjà francisé.
-
-
-
- Capgemini et Codeva s’engagent sur la francisation des libellés, des messages, des commandes, de Lucene et la documentation de l
-'
- ensemble des outils nécessaires au fonctionnement et au paramétrage du système livré.
-
-
-
-
-
-
-
- Moteur de recherche (performance
-&
- intégration)
-
-
-
-
-
- Les moteurs de recherche proposés ne semblent pas atteindre les performances demandées dans le PFD.
-
-
- On rappelle que les performances des moteurs demandées au PFD doivent :
-
-
-
-
- offrir de meilleures performances (dictionnaire, synonymie, lemmatisation avancée, correcteur orthographique..)
-
-
-
-
- offrir une meilleure concaténation des résultats entre les recherches effectuées sur les différents sites portées sur la plateforme et les recherches effectuées sur les sites externes au système. Y-aura-t-il des mises en commun des éventuels dictionnaires mis en œuvre ?
-
-
-
-
-
- Le Minefi a réalisé un inventaire à partir d’information disponible sur internet pour déterminer les fonctionnalités des moteurs de recherche.
-
-
-
- Syntaxe de recherche
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Recherche floue
-
-
-
-
- Phonétisation
-
-
-
-
- Masque de recherche
-
-
-
-
- Troncature
-
-
-
-
- Correction orthographique
-
-
-
-
- Lémmatisation
-
-
-
-
- Opérateurs booléens
-
-
-
-
-
-
- Lucène : interne (Cap Gemini)
-
-
-
-
- oui
-
-
-
-
- oui
-
-
-
-
- Oui (*1)
-
-
-
-
- Oui
-
-
-
-
- Oui (*2)
-
-
-
-
- oui
-
-
-
-
- oui
-
-
-
-
-
-
- Nutch : externe (Cap Gemini)
-
-
-
-
- oui
-
-
-
-
- oui
-
-
-
-
- Oui (*1)
-
-
-
-
- Oui
-
-
-
-
- Oui (*2)
-
-
-
-
- oui
-
-
-
-
- oui
-
-
-
-
-
-
-
- Personnalisation
-
-
-
-
-
-
-
-
-
-
-
- Adjonction de thésaurus / dictionnaire
-
-
-
-
- Recherche sur champs / corpus spécifiques
-
-
-
-
-
-
- Lucène : interne (Cap Gemini)
-
-
-
-
- Option (*3)
-
-
-
-
- oui
-
-
-
-
-
-
- Nutch : externe (Cap Gemini)
-
-
-
-
- Même option (*3)
-
-
-
-
- oui
-
-
-
-
-
-
- Pondération des résultats
-
-
-
-
-
-
-
-
-
-
-
-
- Adéquation requête / document
-
-
-
-
- Surpondération (champ / terme)
-
-
-
-
- Indice de popularité
-
-
-
-
-
-
- Lucène : interne (Cap Gemini)
-
-
-
-
- oui
-
-
-
-
- oui
-
-
-
-
- non
-
-
-
-
-
-
- Nutch : externe (Cap Gemini)
-
-
-
-
- oui
-
-
-
-
- oui
-
-
-
-
- non
-
-
-
-
-
-
-
-
-
-
-
- (*1) : Masque de recherche :
-
-
- Lucene supporte les recherches par jokers : *, ? comme :
-
-
- Test*, Te*t, Te ?t.
-
-
-
-
- (*2) : Recherche orthographique.
-
-
- Cette fonctionnalité permet lorsque l’utilisateur déclenche sa recherche de :
-
-
-
-
- Déclencher le moteur de recherche avec la saisie de l’utilisateur
-
-
-
-
- Présenter une correction orthographique de ce qui a été saisi pour permettre à l’utilisateur de re-lancer une recherche sur les termes corrigés.
-
-
-
-
-
- Ce scénario correspond exactement au mécanisme du moteur de recherche Google :
-
-
-
-
-
-
-
- Capgemini propose de réaliser cette fonctionnalité au travers du composant Open Source JTextCheck (
-
-
-
- http://linux.org.mt/projects/jtextcheck/index.html
-
-
-
- ).
-
-
-
-
-
-
- Corriger ce tableau, en fonction de ce qui sera disponible dans Jahia et/ou développer dans le cadre de la prestation.
-
-
-
-
-
- L’outil prend-il en compte l’intégration et gestion d’un thésaurus
-
-
-
-
-
-
- gestion d’un thésaurus (création/modification/imports/exports),
-
-
-
-
- d’utilisation du thésaurus lors de la recherche plein texte.
-
-
-
-
- Si la réponse est négative, il convient de le prévoir (cf. paragraphe 6.5.3 du PFD). Si cette fonctionnalité engendre un surcoût, celui-ci doit être intégré dans les options
-"
- moteur de recherche, offre optionnelle
-"
- (total 13 et total 14).
-
-
-
- (*3) : Thésaurus.
-
-
- Le thésaurus est un dictionnaire particulier réalisant des liens (de type spécialisation, généralisation) entre les mots.
-
-
-
- Cet outil est une aide à l’élaboration des critères de recherches :
-
-
-
-
- L’utilisateur saisi ses mots de recherche
-
-
-
-
- Pour chaque mot,
-
- le thésaurus lui présente les mots liés qu’il ajoute ou réfute
-
-
-
-
- Le moteur de recherche est alors lancé avec l’ensemble de ces critères.
-
-
-
-
-
-
-
-
-
- Capgemini propose de développer ce thésaurus qui permet :
-
-
-
-
-
- L’import (resp. l’export) des mots du thésaurus depuis (resp. vers) un fichier texte conforme à la norme ISO 2788 et AFNOR NFZ-47100
-
-
-
-
-
- Assister l’utilisateur dans la saisie de ses critères de recherche.
-
-
-
-
-
- L’alimentation du fichier est réalisée par la DPMA en fonction des concepts manipulés.
-
-
-
-
-
-
- Prise en compte des meta-données
-
-
-
-
- L’outil de gestion de contenu doit prendre en compte les meta-données tels que définis par le Minefi notamment au travers des formulaires de gestion des documents publiés. (cf.
-
-
- En annexe le « Tableau de synthèse Méta-données
-
- »
-
- qui décrit les travaux en cours par le Minefi.
-
-
-
- Date de révision : pris en compte dans la solution.
-
-
-
- La date de fin de publication n’est pas une méta-données du document, puisque sa valeur peut être différentes en fonction de la rubrique où le document est publié.
-
-
-
- Capgemini propose de développer un workflow gérant cette date de fin de publication.
-
-
- Le responsable de la rubrique avant la validation de la publication détermine à quelle date la page doit disparaître.
-
-
-
- Par contre, pour les documents saisis en mode edit/publish, la date de fin de publication ne peut être rattachée qu’au document. L’information est alors ‘dépubliée’ dans toutes les rubriques en même temps.
-
-
-
-
-
-
- Consolidation des résultats par le moteur de recherche
-
-
-
-
- Si un document est à la fois sur intranet, Internet et extranet, et si le moteur de recherche indexe ces trois espaces, est-ce qu’alors le document apparaît trois fois dans la liste des résultats lors d’une recherche sur ces trois espaces ?
-
-
- Le comportement est-il identique si le document est publié dans plusieurs rubriques d
-'
- un même espace?
-
-
-
- Il est important que le document apparaisse (même si c’est le même) à chaque endroit où il est publié. Qu’il s’agisse d’un document publié sur différents portails, ou d’un document publié plusieurs fois sur le même portail.
-
-
- Lorsqu’un utilisateur réalise une recherche sur un site, il s’attend à retrouver les documents publiés sur le site.
-
-
-
- Du point de vue ergonomique, si le portail propose une recherche multi-site, il est essentiel que l’utilisateur maîtrise la recherche qui est effectuée tout en gardant la simplicité d’utilisation.
-
-
- Pour réaliser ce double objectif, la méthode la plus couramment utilisée est d’accompagner le champ de saisie d’un boite déroulante permettant à l’internaute de spécifier en plus des critères de recherche la cible :
-
-
-
-
-
-
-
-
- Le traitement de la recherche peut également être réalisée au travers une fonction de recherche avancée. La fonctionnalité de recherche avancée présente les différents critères de recherches et cibles de recherches.
-
-
-
-
- Dans le cas de cette recherche avancée, il est possible de solliciter les différents moteurs de recherche et de re-trier les informations rendues pour fusionner les différents résultats. Cette mise en œuvre nécessite :
-
-
-
-
-
- un coût d’intégration plus élevé,
-
-
-
-
- une plus grande expertise des utilisateurs.
-
-
-
-
-
- A la demande de la DPMA, Capgemini peut intégrer ce module de recherche avancée.
-
-
-
-
-
-
- Poids des pages html gérées par les outils
-
-
-
-
- Les outils de portail introduisent-ils des éléments qui pourraient augmenter le poids des pages html ?
-
-
-
-
- La notion de portlet commune à tous les portails induit implicitement des poids de page légèrement augmenté : il n’est plus possible d’optimiser la syntaxe HTML dans l’ensemble de la page.
-
-
-
- Il n’est pas possible réellement d’estimer ce surcoût.
-
-
-
-
-
-
- Reprise des pages d
-'
- accueil Alizé et Minefi.gouv.fr.
-
-
-
-
- Le candidat est-il en mesure de s
-'
- engager à ce que les pages d
-'
- accueil Internet et intranet soient reprises dans les portails proposés avec un niveau de complexité (graphique et ergonomique) similaire à celui des pages actuelles. Notamment il est nécessaire que ces pages d
-'
- accueil puissent adresser une dizaine d
-'
- espaces et une cinquantaine de liens. A titre d
-'
- exemple, il faudra valider que le système fourni pourra supporter les chartes graphiques et ergonomiques des pages d
-'
- accueil des sites Internet (www.minefi.gouv.fr)
-
- et intranet (alize) actuelles ainsi que la proposition en cours de réalisation pour Alize.
-
-
- A contrario, le candidat peut-il indiquer des limites (ou des contraintes) à prendre en compte lors de l
-'
- élaboration de la charte graphique et ergonomique. Une liste d
-'
- exemples de difficultés rencontrées sur d
-'
- autres projets est satisfaisante.
-
-
-
- Capgemini préconise pour des aspects ergonomiques et techniques d’exclure les frames pour les documents gérés avec Jahia.
-
-
-
- Pour le reste, la solution de Capgemini supporte les pages d’accueil Alizé et Minefi.gouv.fr.
-
-
-
-
-
-
-
-
-
-
- Accessibilité
-
-
-
-
- Il est nécessaire que le système permette à l
-'
- administration de respecter au plus près les 55 critères du label Bronze accessiweb (voir
-
-
- http://www.accessiweb.org/fr/Label_Accessibilite/criteres_accessiweb/55_accessiweb_bronze/
-
-
- ). Préciser quels sont les critères qui seront gérés par le système. A minima, il est souhaité que les champs d
-'
- information complémentaires (alt, title des liens…) soient saisis dans la gestion de contenu et correctement gérés par le système. Indiquer les solutions éventuelles pour gérer les attributs nécessaires à l
-'
- accessibilité des tableaux, des cadres, des formulaires.
-
-
-
- Capgemini s’engage à respecter les 55 critères du label Bronze Accessiweb.
-
-
-
- Le tableau ci-dessous regroupe les éléments automatisables pour ces critères, regroupés par catégories :
-
-
-
- Eléments graphiques :
-
-
-
-
-
-
-
-
-
- Critères
-
-
-
-
- Niveau
-
-
-
-
- Description
-
-
-
-
- Solution
-
-
-
-
-
-
- 1.1
-
-
-
-
- Bronze
-
-
-
-
- Chaque élément graphique figurant dans une page web doit posséder une alternative textuelle.
-
-
-
-
- Pour les éléments graphiques devant être ajouter ou modifier sur une page, nous ajouterons un champ obligatoire permettant de saisir l’alternative.
-
-
- Pour les éléments graphiques ajoutés dans le « mini word », nous ajouterons automatiquement des alternatives vides, que l’utilisateur pourra renseigner par la suite en éditant le contenu html
-
-
-
-
-
-
- 1.4
-
-
-
-
- Bronze
-
-
-
-
- Pour chacun des éléments graphiques contenus dans la page, le texte de l’alternative doit faire un maximum de 60 caractères.
-
-
-
-
- Avec le mécanisme décrit pour le critère 1.1, nous ajouterons une vérification de la longueur du texte. Si le texte est trop long, le contributeur en sera averti.
-
-
-
-
-
-
- Cadres :
-
-
-
-
-
-
-
-
-
- Critères
-
-
-
-
- Niveau
-
-
-
-
- Description
-
-
-
-
- Solution
-
-
-
-
-
-
- 2.1
-
-
-
-
- Bronze
-
-
-
-
- Chaque cadre composant une page web doit être nommé.
-
-
-
-
- Les cadres sont créés au sein des fichiers jsp. La page contenant les cadres possédera un ensemble de champ (nom, alternative, titre) correspondant à chacun des cadres, ainsi qu’un champ de description définissant l’interaction entre les cadres, permettant ainsi la modification par un contributeur.
-
-
-
-
-
-
- 2.3
-
-
-
-
- Bronze
-
-
-
-
- Une alternative doit être proposée lorsqu’une page web est construite avec des cadres.
-
-
-
-
- Même réponse que le point 2.1 pour l’alternative.
-
-
-
-
-
-
- 2.5
-
-
-
-
- Bronze
-
-
-
-
- En plus de posséder un nom explicite, chaque cadre doit être décrite de manière plus précise.
-
-
-
-
- Même réponse que le point 2.1 pour le titre.
-
-
-
-
-
-
- 2.9
-
-
-
-
- Bronze
-
-
-
-
- Il doit y avoir un maximum de trois cadres dans la page.
-
-
-
-
- La construction des cadres est défini au sein des templates jsp, et dépend de la charte graphique du site.
-
-
-
-
-
-
- 2.10
-
-
-
-
- Bronze
-
-
-
-
- Lorsqu’il y a des cadres, le défilement (« scrolling » en
-
- anglais) doit être automatique.
-
-
-
-
- Cette propriété sera mise sur chaque cadre au sein des templates jsp.
-
-
-
-
-
-
- Liens :
-
-
-
-
-
-
-
-
-
- Critères
-
-
-
-
- Niveau
-
-
-
-
- Description
-
-
-
-
- Solution
-
-
-
-
-
-
- 6.1
-
-
-
-
- Bronze
-
-
-
-
- L’intitulé des liens doit faire un maximum de 80 caractères.
-
-
-
-
- Nous ajouterons une vérification de la longueur des intitulés des liens dans les écrans de saisies de nouveaux liens, ainsi que dans le « mini Word ».
-
-
-
-
-
-
- 6.3
-
-
-
-
- Bronze
-
-
-
-
- Lorsque c’est nécessaire, un lien doit être commenté et ce commentaire doit comporter un maximum de 80 caractères.
-
-
-
-
- Ce point concerne les liens de téléchargement de fichiers. Par conséquent, nous ajouterons un champ de saisie obligatoire permettant de décrire le fichier.
-
-
-
-
-
-
- 6.5
-
-
-
-
- Bronze
-
-
-
-
- Chaque intitulé de lien identique doit amener vers une seule et même destination.
-
-
-
-
- ??????????
-
-
-
-
-
-
- Eléments obligatoires :
-
-
-
-
-
-
-
-
-
- Critères
-
-
-
-
- Niveau
-
-
-
-
- Description
-
-
-
-
- Solution
-
-
-
-
-
-
- 8.1
-
-
-
-
- Bronze
-
-
-
-
- Le type du document électronique consulté dans un navigateur doit être spécifié.
-
-
-
-
- Le type du document html étant défini par la balise DOCTYPE, nous ajouterons dans les templates cette balise afin de respecter ce critère.
-
-
-
-
-
-
- 8.2
-
-
-
-
- Bronze
-
-
-
-
- La langue utilisée dans un document électronique doit être clairement identifiée.
-
-
-
-
- La langue utilisée dans les pages doit être mise, au sein du template, sur l’attribut « lang » de la balise
-<
- html
->
- . Nous ajouterons cet attribut au sein des templates et en correspondance avec la langue en cours de visualisation.
-
-
-
-
-
-
- 8.4
-
-
-
-
- Bronze
-
-
-
-
- Le titre d’une page web doit être clairement identifié.
-
-
-
-
- Le titre de la page sera présent dans l’ensemble des templates grâce à la balise
-<
- TITLE
->
- . Le titre de la page peut être renseigné par le contributeur à partir des attributs de la page.
-
-
-
-
-
-
- 8.6
-
-
-
-
- Bronze
-
-
-
-
- Le titre d’une page web doit être unique
-
-
-
-
- ????????????
-
-
-
-
-
-
- Présentation de l’information :
-
-
-
-
-
-
-
-
-
- Critères
-
-
-
-
- Niveau
-
-
-
-
- Description
-
-
-
-
- Solution
-
-
-
-
-
-
- 10.1
-
-
-
-
- Bronze
-
-
-
-
- Le contenu d’une page web doit être séparé de sa présentation spécifique.
-
-
-
-
- La mise en forme des pages (polices, couleurs, alignement,…) est externalisé dans des feuilles de style CSS.
-
-
-
-
-
-
- Contenus accessibles :
-
-
-
-
-
-
-
-
-
- Critères
-
-
-
-
- Niveau
-
-
-
-
- Description
-
-
-
-
- Solution
-
-
-
-
-
-
- 13.2
-
-
-
-
- Bronze
-
-
-
-
- Si une redirection automatique est présente, elle ne doit pas s’effectuer par l’intermédiaire d’un script.
-
-
-
-
- L’ensemble des redirections automatiques sera réalisé sur le serveur.
-
-
-
-
-
-
- 13.4
-
-
-
-
- Bronze
-
-
-
-
- Une alternative équivalente au script qui déclenche l’ouverture de nouvelles fenêtres doit être prévue.
-
-
-
-
- Au sein des templates, nous ajouterons des liens permettant d’accéder à la nouvelle fenêtre.
-
-
-
-
-
-
-
-
-
-
- Cohérence des référentiels
-
-
-
-
- Est-il prévu des traitements permettant de garantir la cohérence des référentiels de données entre le portail et la gestion de contenu ?
-
-
-
-
- Les référentiels Portail et gestion de contenu sont communs dans Jahia. Il n’est pas nécessaire de prévoir des mécanismes d’intégrations particuliers.
-
-
-
-
-
-
-
-
- Republication partielle ou totale de contenu par rapport à un ou deux sites :
-
-
-
-
- L’administrateur des sites (webmestres) disposera-t-il de commandes lui permettant de lancer des synchros partielles ou totales de sites ? Ces commandes seront-elles déclenchées à partir d’un navigateur ?
-
-
- Existera-il des commandes du type :
-
-
- -
-
- relancer la synchro totale de tous les documents publiés sur l’Internet ?
-
-
- -
-
- lancer une synchro partielle limitée aux seuls documents modifiés depuis 24 heures ?
-
-
-
-
- synchroniser de manière immédiate les rubriques de la page d’accueil en priorité par rapport aux autres traitements de synchronisation actuellement en cours ou programmés ?
-
-
-
-
-
-
-
- Capgemini et Codeva proposent :
-
-
-
-
- Un développement collaboratif permettant la réplication des éléments saisis depuis l’environnement Intranet (Back-Office) vers le site Internet.
-
-
-
- La réplication porte sur :
-
-
-
-
-
- Un ‘site virtuel’ (sous-site) : contenu, conteneurs d’un site, groupes jahia.
-
-
-
-
-
- L’arbre des catégories.
-
-
-
-
-
- Pour que la réplication fonctionne, tous les sites comprennent l’ensemble des templates Jahia.
-
-
-
- Cette fonctionnalité de réplication offre des fonctionnalités de :
-
-
-
-
- Réplication totale – initialisation ou ré-initialisation totale,
-
-
-
-
-
- Réplication incrémentale – mise à jour par delta. A chaque export, les données validées depuis le dernier export sont mises en paquet. Le paquet est numéroté (numéro de version v) et envoyé vers le serveur cible. Le serveur cible reçoit ce paquet et vérifie qu’il a bien déjà importé le paquet v-1. Ce mécanisme permet de garantir les mises à jours incrémentales ont bien été réalisées dans le bon ordre.
-
-
-
-
-
-
- Cette fonction de réplication peut être déclenchée, par site virtuel :
-
-
-
-
- de façon automatique,
-
-
-
-
-
- manuellement via une interface Web pour l’utilisateur ‘root’,
-
-
-
-
-
-
-
-
- Si certaines données (actualités de la page d’accueil) par exemple, doivent être mises à jour de façon régulières, il est possible de déclencher manuellement la réplication du site virtuel ‘Internet’, ce qui permet de mettre en ligne tous les documents qui font parti du lot validé et notamment ceux qui doivent être publié en urgence.
-
-
-
-
-
-
-
-
-
-
- Aspect architecture : en cours d’élaboration
-
- (nouvelle rubrique)
-
-
-
-
-
-
- 1°) Intranet AdER
-
-
- Au vu des éléments techniques montrés techniques dans les prototypes, le MINEFI propose l
-'
- architecture suivante :
-
-
-
-
-
-
- la gestion de contenu de l
-'
- intranet AdER pourra être un site cloisonné logiquement sur la gestion de contenu Intranet.
-
-
-
-
- le portail de publication de l
-'
- intranet AdER pourra être un site cloisonné logiquement sur la gestion de contenu Intranet.
-
-
-
-
-
-
- Il n
-'
- est donc plus nécessaire d
-'
- isoler des éléments matériels ou logiciels sur le réseau AdER
-
-
-
- Pris en compte.
-
-
-
- 2°) optimisation du nombre de serveurs
-
-
- a) Le candidat proposera une optimisation de son architecture actuelle en fonction du nouvel élément lié
-
- à AdER.
-
-
-
-
- (nouveau)
-
-
- Le Minefi prendra à sa charge l
-'
- acquisition des boîtiers alteon ou autres systèmes de répartition de charge préconisés par le candidat. Le candidat mettra en oeuvre ces outils.
-
-
-
-
-
- Pris en compte.
-
-
-
- Plusieurs optimisations ont été réalisées :
-
-
-
-
-
-
- La fusion ADER/Intranet.
-
-
-
-
-
- Une étude des coûts détaillés nous a permis d’optimiser le coût de la plate-forme Internet. Les 2 quadri-processeurs sont remplacés de avantageusement par 5 bi-processeurs.
-
-
-
-
-
-
-
-
- Au démarrage du projet, la DPMA indiquera à Capgemini si la solution retenue est un altéon ou un serveur sous LVS.
-
-
-
- b) De plus, le candidat proposera
-
- une architecture alternative basée sur des clusters et des SAN.
-
-
- Le stockage intranet et le stockage Internet sera mutualisé sur des SAN (les SAN en ISCSI sont conseillés).
-
-
-
- Pris en compte.
-
-
-
-
- Il devra s
-'
- engager à implémenter ses solutions sur les serveurs en cluster et l
-'
- archivage en SAN.
-
-
-
- Pris en compte.
-
-
-
-
- Si une des deux solutions induit un surcoût celui-ci devra être proposé en variante.
-
- Le Minefi choisira au moment du lancement du projet l
-'
- architecture définitive parmi ces deux solutions.
-
-
-
-
- Il n’y a pas de différence de coût, pour la mise en œuvre des sites, entre les 2 solutions.
-
-
-
-
-
-
- Outils de partage de charge : Fournir et mettre en œuvre les outils de partage de charge (en cours d’élaboration)
-
-
-
-
-
-
-
-
- Sécurité des accès et des données et respect des flux déterminés par le Minefi
-
-
-
-
- Les sociétés doivent s’engager de manière explicite dans le CCTP à ce que:
-
-
-
-
-
-
- aucune donnée de type intranet (contenu, index, login, …) ne soit disponible sur l’internet (sauf si publication volontaire)
-
-
-
-
- les solutions techniques fonctionnent sans nécessiter de flux d’internet vers intranet. Dans le sens internet vers intranet les réseaux intranet et internet doivent être considérés comme physiquement séparés.
-
-
-
-
-
-
- Les sociétés doivent s’engager à ce que leur solution respecte les flux admis par le Minefi entre l’Intranet et l’Internet (cf PFD paragraphe 10).
-
-
- Si une de ces conditions n
-'
- était pas respectée, les candidats s’engagent à trouver une solution de contournement.
-
-
-
-
-
- Oui : aucune donnée de type intranet (contenu, index, login, …) ne soit disponible sur l’Internet (sauf si publication volontaire)
-
-
-
-
-
- Les solutions techniques fonctionnent sans nécessiter de flux d’Internet vers intranet. Dans le sens Internet vers intranet les réseaux intranet et Internet doivent être considérés comme physiquement séparés.
-
-
-
-
-
-
-
-
-
- Contrôle d’intégrité des données :
-
-
-
-
- Le Minefi rappelle qu’il souhaite un contrôle de l’intégrité des données. La solution mise en œuvre doit au moins être du
-
- niveau de TripWire. Il convient d’intégrer cette demande dans la réponse.
-
-
-
- Le logiciel TripWire permet le contrôle
-
- d’intégrité des fichiers stockés sur les disques d’un serveur.
-
-
-
- Capgemini propose l’intégration de la version Open source de Tripwire (
-
-
-
- http://www.tripwire.org/
-
-
-
- ). L’intégration de TripWire permet de vérifier que le système de fichier n’est pas modifié.
-
-
-
-
-
- Les contenus publiés par Jahia ne sont pas stockés dans un système de fichier mais dans la base de données PostGres. Tripwire ne permet pas de vérifier l’intégrité de la base de données.
-
-
-
-
-
- De plus, la solution proposée par Capgemini positionne le serveur Apache derrière le pare-feu. Il s’agirait donc pour un ‘hacker’ de pénétrer le pare-feu puis d’accéder au serveur Apache, puis d’accéder au serveur d’application, puis d’accéder au serveur PostGres. Chaque accès (Serveur linux supportant Apache, Serveur linux supportant PostGres, Serveur Postgres) possède ses propres mécanismes d’authentification et de sécurité :
-
-
-
-
-
-
-
-
- L’accès au serveur Linux supportant Apache est fortement restreint : durcissement du système d’exploitation.
-
-
-
-
-
-
- L’accès au serveur Linux supportant le serveur d’application est restreint : durcissement du système d’exploitation , TcpWrapper (préconisé) n’autorisant les communications qu’avec le serveur Apache et le serveur de base de données.
-
-
-
-
-
- L’accès au serveur Linux supportant le serveur Postgres est restreint : durcissement du système d’exploitation, TcpWrapper (préconisé) n’autorisant les communications qu’avec le serveur d’application.
-
-
-
-
-
- L’accès au serveur Postgres est réalisé au travers d’un login/mot de passe crypté lors de l’échange.
-
-
-
-
-
-
-
-
-
- Enfin, si ces niveaux de sécurité ne sont pas suffisants, il est également possible d’ajouter un pare-feu supplémentaire entre le serveur Apache et le serveur d’application. Des solutions basées sur Linux permettent la mise en œuvre peu coûteuse de pare-feux.
-
-
-
-
- Capgemini propose de réaliser un dossier sécurité durant la phase de conception.
-
-
-
-
-
-
-
-
- Instance Jahia sur Internet :
-
-
-
-
- Préciser si les outils d’administration des portails Jahia seront désactivés sur l’instance sur internet. Dans le cas contraire préciser les mécanismes qui permettent d’éviter les accès non désirés aux outils d’administration.
-
-
-
-
- L’instance Jahia sur Internet ne possède pas les différentes engines
-
-
-
-
- 1
-
-
-
-
- Fonction de type assistant pour Jahia.
-
-
-
-
-
- d’administration et de contribution. Si un utilisateur malveillant réussit à faire appel à ces fonctions, il obtiendra une erreur Java.
-
-
-
-
-
- De plus, Capgemini propose d’intégrer une étude sécurité permettant de lister tous les points mis en place (serveurs, réseaux, application) permettant de relever les enjeux de sécurité de la DPMA.
-
-
-
-
-
-
- Utilisation du protocole WebDAV
-
-
-
-
- Entre le client et Jahia : l’utilisation de WebDav est-elle obligatoire pour publier les documents. Si deux publieurs sont responsables d’une rubrique : l’un des deux peut-il utiliser webDav et l’autre pas ?
-
-
-
- L’utilisation de WebDav n’est pas obligatoire.
-
-
- L’utilisation combinée pour une même rubrique est tout à fait possible.
-
-
-
- Entre les instances java intranet et internet : le protocole WebDav passe-t-il les firewall de la DPMA (pare-feux filtre de paquets et pare-feux applicatif) situés entre la zone intranet et la zone internet. Il est rappelé que pendant la réalisation des prototypes ce protocole n’était pas ouvert. Décrire les conditions qui permettront d’ouvrir ce protocole au travers des firewall (ouverture d’un port particulier, reconnaissance d’ordre http, …) ?
-
-
- Si cela nécessite l
-'
- ajout d
-'
- un composant sur les pare-feux, la fourniture est à la charge du prestataire.
-
-
-
-
- A priori, le protocole WebDav est construit pour passer les pare-feux.
-
-
-
-
- Les équipes de DPMA/2C estime que webdav pourrait passer en https pour qu
-'
- il n
-'
- y ait pas analyse de protocole. Le HTTPS chiffre les données, avantage donc en termes de sécurité (les données confidentielles à publier ne passent pas en clair). L’inconvénient majeur pourrait alors porter sur le niveau des performances.
-
-
-
-
- Le flux WebDav peut être encrypté. Il n’y a pas impact sur les performances au sens fonctionnel du terme, la phase de synchronisation entre le back office intranet et le front office Internet se découpe en 4 phases :
-
-
-
- 1/ Export des documents du back-office
-
-
- 2/ Transport des informations vers le front office
-
-
- 3/ Import des documents dans le front office.
-
-
-
-
- Le front office est uniquement perturbé à la phase 3. Cette phase doit être limitée dans le temps :
-
-
-
-
-
-
-
- mise en place de la réplication incrémentale,
-
-
-
-
- garantie de performance : 20000 pages par heure.
-
-
-
-
-
-
-
-
- Le surcoût du transport n’a donc pas d’incidence sur l’objectif de performance qui porte sur les phases 3.
-
-
-
-
-
-
-
- Gestion de contenu multisite (spécifications)
-
-
-
-
- Préciser le degré d‘engagement pour transformer Jahia en outil de gestion de contenu multi-sites.
-
-
- Préciser les spécifications générales et l
-'
- architecture fonctionnelle du module de gestion de contenu dans sa version multisites.
-
-
-
- Introduction
-
-
- Le module de gestion de contenu de Jahia permet, dès aujourd’hui, la mise en œuvre de 2 types de contribution :
-
-
-
-
- « Edit/Publish » : dans se mode, le contributeur produit un document Web et le publie selon plusieurs axes (catégories). Le portail transforme ces catégories sous formes de rubriques.
-
-
-
-
-
-
- « Edit in place » : dans ce mode le contributeur se positionne au sein du portail là où le document doit être affiché pour le saisir (ou le récupérer dans le cas ou le document est déjà publié).
-
-
-
-
-
-
- Le mode ‘Edit/Publish’
-
-
- La contribution est réalisée dans des templates Jahia dédiés. Chaque document est associé à :
-
-
-
-
- 1 fonction ‘back office’ réalisée par :
-
-
-
-
-
-
-
-
- 1 page permettant de lister ou de rechercher 1 document de ce type depuis le site de contribution.
-
-
-
-
- 1 page de saisie permettant la consultation, la saisie et la modification.
-
-
-
-
- 1 à n catégories : l’arbre des catégories de Jahia.
-
-
-
-
-
-
-
-
- 1 fonction ‘front office’ réalisée par :
-
-
-
-
-
-
-
-
- La page de consultation précédente.
-
-
-
-
- 1 page dédiée à la navigation au sein du portail (liste ou recherche).
-
-
-
-
-
-
-
-
- Le site contient des rubriques construites sur l’extraction de documents rattachés à des catégories.
-
-
-
-
-
-
- Pour un document, la validation est globale à toutes les catégories auxquelles il est rattaché.
-
-
-
-
-
- Le prototype ‘Concours’ présente ce modèle de contribution :
-
-
-
-
- Une page permettant la recherche multi critères des concours en liste.
-
-
-
-
- Une page permettant la saisie du document concours.
-
-
-
-
-
-
- Publication multi-site :
-
-
-
- Dans ce mode, l’arbre des catégories est découpé en branches portant les catégories de chaque site (Alizé, Internet). Chaque portail présente les documents validés et attribués aux documents catégorie de son site.
-
-
-
- Le mode ‘Edit in place’
-
-
- La contribution est réalisée directement à l’endroit où le document est publié.
-
-
-
-
-
- Les fonctions ‘back office’ et ‘front office’ sont indifférenciées :
-
-
-
-
-
-
-
-
- 1 page permet la consultation, la modification et la création d’un nouveau document.
-
-
-
-
- au sein du portail.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- NB : Cela ne signifie pas que les modifications sont réalisées sur le site en ligne (Internet par exemple) mais bien sur une instance en ‘back office’.
-
-
-
- Publication multi-site :
-
-
-
- Dans le cadre du mode de contribution
-
- ‘edit in place’. La contribution multi-site est une simple extension du fonctionnement actuel qui permet à un même document d’être publié dans plusieurs rubriques.
-
-
-
-
-
-
- Dans le mode edit in place – l’activité est centrée sur le portail :
-
-
-
-
-
-
-
-
- Un document a été créé dans une page du portail Intranet (par exemple). Un workflow propre à la page a alors été déclenché.
-
-
-
-
- Un contributeur ‘Internet’ décide de publier ce document.
-
-
-
-
-
-
-
- Il se positionne sur le portail Internet, choisit l’option d’inclure un contenu externe.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Un assistant permet de recherche le contenu à inclure. Cet assistant permet plusieurs modes de recherche :
-
-
-
- Par catégorie, Auteur, par date
-
- En suivant le plan des sites
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Par recherche, résultat
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Par ‘recopie’ d’une URL du site.
-
-
-
-
-
-
-
-
-
- Synthèse
-
-
-
- La solution de Capgemini intègre ces 2 modes :
-
-
-
-
-
-
- Le mode ‘edit/publish’ doit être utilisé pour les documents publiés sous forme de catalogue ou de listes qui sont généralement saisis par des contributeurs dédiés à ce type de document de type documentaliste.
-
-
-
-
-
-
- C’est ainsi le cas pour les documents agenda, actualités, ressources documentaires, courrier du ministère, la liste des services en ligne, concours, les catalogues de l’action sociale, fiches de poste.
-
-
-
-
-
-
- Le mode ‘edit in place’ doit être utilisé pour les documents de type communication et pour des contributeurs qui gèrent une information riche, avec une vision transverse du portail de type webmestre et responsable éditorial.
-
-
-
-
-
-
-
- Au sein du ‘back office’ on retrouve donc :
-
-
-
-
-
-
- Le portail tel qu’il sera publié pour permettre la mise à jour du site ‘edit in place’.
-
-
-
-
- Un menu particulier donnant l’accès à la production des documents ‘edit/publish’
-
-
-
-
- Le tout intégré du point de vue de la gestion des droits.
-
-
-
-
-
-
-
-
- Préciser notamment la granularité des objets gérés par le système : une page peut-elle afficher plusieurs documents publiés séparément dans différentes rubriques (indépendance des documents par rapport à leurs instances de publication au sein des pages)
-
-
-
-
- Oui :
-
-
-
-
-
-
- Dans le mode ‘Edit/Publish’,
-
- c’est le portail qui décide (de façon programmée) quelles catégories de documents positionner dans ses pages.
-
-
-
-
-
-
- Dans le mode ‘Edit in place’, l’utilisateur reste totalement libre de positionner tout contenu provenant de tout site sur sa page.
-
-
-
-
-
-
- Un document pourra-t-il être rédigé et validé sans être publié ?
-
-
-
- Oui :
-
-
- En fonction de ce que représentent du point de vue organisationnel les termes ‘rédigé’ et ‘validé’.
-
-
-
- Par défaut, Jahia gère 3 états :
-
-
-
-
-
-
-
-
- En cours.
-
-
-
-
- Terminé.
-
-
-
-
- Publié.
-
-
-
-
-
-
-
-
-
-
- Si l’état ‘terminé’ signifie : rédigé et validé par le contributeur. Il reste effectivement stocké dans Jahia sans qu’il ne soit publié.
-
-
-
-
-
-
- Si par contre, la DPMA souhaite pour certains types de documents une validation par un tiers du document avant sa publication, Capgemini propose la mise en place d’un workflow à 4 états :
-
-
-
-
- En cours
-
-
-
-
- Rédigé
-
-
-
-
- Validé rédaction
-
-
-
-
- Publié.
-
-
-
-
-
- La proposition de Capgemini intègre la mise en œuvre de 3 workflows.
-
-
-
-
-
- Pourra-t-on avoir un document contenu à la fois dans l’outil Jahia et publié sur aucun site ?
-
-
- Oui.
-
-
- En complément de la question précédente.
-
-
- Un document peut être dans le référentiel documentaire et pas encore publié.
-
-
-
-
- Il peut également rester dans le référentiel et ne plus être publié : cette possibilité est simplement réalisée en utilisant la gestion des droits. Si l’on souhaite qu’un document dé-publié
-
- reste dans le référentiel documentaire, il faut simplement changer les droits d’accès au document. Un document publié sur un site est ouvert en lecture au profil ‘guest’. Dé-publié ce document revient à attribuer un profil de type contributeur pour qu’il ne soit plus accessible sur le site.
-
-
-
-
- Préciser si tous les aspects d’une gestion de contenu multi-sites seront pris en compte dans les développements à venir :
-
-
-
-
- contraintes liées aux documents,
-
-
-
-
- contraintes sur le workflow (ex : un document est publié selon une règle de validation sur l’intranet et doit l
-'
- être selon une autre règle de validation sur l’internet)
-
-
-
-
- contrainte sur le moteur de recherche
-
-
-
-
-
- Hypothèse : un document est créé à partir d’un site Internet Jahia (portail Internet) puis il est publié sur un site intranet. Que ce passe-t-il si le document est dé-publié du portail Internet.
-
-
-
-
- Ce que l’on veut pour de mode « edit in place » :
-
-
-
-
-
- Scénario 1 : on souhaite qu’un document partagé ait le même cycle de vie entre l’Internet et l’intranet.
-
-
-
-
- Il s’agit de rubriques partagées entre l’intranet et l’Internet (même si ces rubriques sont positionnées différemment sur chaque site).
-
-
-
- L’équipe éditoriale est la même : les rubriques sont les mêmes.
-
-
-
- Le document est géré dans un espace mixte entre l’Internet et l’intranet.
-
-
-
-
- Il est validé, et dé-publié de façon partagée entre les 2 sites.
-
-
-
-
- Scénario 2 : on souhaite qu’un document partagé ait des cycles de vies différentes entre L’Internet et l’intranet.
-
-
- Il s’agit de rubriques différentes.
-
-
-
- L’équipe éditoriale de la rubrique intranet (resp. Internet) produit le document. Au travers d’un comité éditorial transverse ce document est identifié comme devant également être également publié sur Internet (resp. intranet).
-
-
-
-
- Chaque rubrique possède son propre cycle de contribution, de validation, de péremption.
-
-
-
-
- Repréciser clairement l’impact de l’utilisation des dossiers privés à un site et l’impact de l’utilisation des dossiers publics ? N’y a-t-il pas un risque que le choix d’un dossier privé implique des contraintes (voir des impossibilités) de publication vers d’autres portails ?
-
-
-
-
- Les dossiers privés ne sont utilisés, normalement, que lors de son élaboration collaborative. Lorsqu’un contributeur veut publier un document privé, un message d’avertissement le prévient de cette incohérence potentielle. Si le contributeur le publie néanmoins, il peut :
-
-
-
-
-
-
-
- soit modifier les droits pour qu’il soit accessible de tous,
-
-
-
-
- conserver ses droits. Il est alors visible de tous mais ne peut être récupéré que par les utilisateurs autorisés.
-
-
-
-
-
-
-
-
-
- Ergonomie
-
-
-
-
- L
-'
- ergonomie actuelle de Jahia
-"
- edit in place
-"
- nécessite que le contributeur se positionne dans un endroit d’un portail puis crée un document. Préciser si l’ergonomie suivante sera réalisée : création d’un document dans la gestion de contenu indépendamment de toute publication, puis publication vers un ou plusieurs portails.
-
-
-
-
- (nouveau)
-
-
- Préciser si dans le
-
- mode
-"
- edit in place
-"
- , il sera possible de publier à partir du site où l
-'
- on se trouve dans d’autres sites (intranet ou internet), sans avoir à se positionner sur chacun des sites cibles. Autrement dit le mode
-"
- edit in place
-"
- prend-il en compte la gestion en multi-sites attendue.
-
-
-
- Multi-site appliqué
-
-
- Le mode « edit in place » permet la publication multi-site telle qu’attendue par la DPMA.
-
-
-
- Dans un premier temps il faut distinguer :
-
-
-
-
-
-
-
- les informations « chaudes » - informations mises à jours régulièrement (jour, semaine) – des articles par exemple.
-
-
-
-
-
-
- des informations « froide » - informations mises à jours rarement (mois) – des dossiers par exemple.
-
-
-
-
-
-
-
-
-
- Les informations « chaudes » sont en général nombreuses et doivent être renseignées rapidement. Elles sont fortement candidates au mode « edit/publish » : des contributeurs sont dévolus à ces tâches répétitives. L’interface de contribution devient alors un outil de saisie basé sur des formulaires. L’alimentation du portail devient automatique. Les étapes de validation et de publication sont raccourcies au maximum.
-
-
-
-
-
- Les informations « froides » sont en général
-
- plus complexes (plus riches), leur disposition dans le portail est moins prédictible, les étapes de construction, validation plus complexes. Ces informations doivent utiliser le mode « edit in place ».
-
-
-
-
-
-
-
-
-
- Il s’agit pour l’organisation éditoriale des informations froides d’accompagner l’organisation du site. De façon traditionnelle on retrouve 2 types de partages d’information entre l’intranet et l’Internet :
-
-
-
-
-
-
- Partage de rubriques – un ensemble d’informations proposé sur un site se retrouve à l’identique sur un autre site. Il convient à chaque site de positionner cette rubrique au bon niveau dans sa propre arborescence.
-
-
-
-
-
-
- Partages de contenus (dossiers) – une information particulière est partagée.
-
-
-
-
-
-
- Partage de rubriques
-
-
- Dans cette configuration, une équipe éditoriale anime la rubrique, qu’elle soit publiée sur l’intranet ou l’Internet.
-
-
-
- Cette rubrique est alors simplement réalisée en mode « edit in place » dans un espace mixte (site virtuel mixte) qui est publié à la fois sur l’intranet et l’Internet.
-
-
-
-
- La validation et la publication sont alors communes à chaque site, les contributeurs/valideurs travaillent de façon unique au sein du site mixte.
-
-
-
- Chaque portail (intranet, Internet) :
-
-
-
-
-
-
- intègre les rubriques mixtes au sein de son arborescence.
-
-
-
-
- intègre ses gabarits (templates Jahia) permettant d’appliquer sa charte graphique au contenu des rubriques partagées.
-
-
-
-
-
-
- Partage de contenus
-
-
-
- Dans cette configuration, les contenus sont publiés dans leurs espaces propres. L’équipe éditoriale d’une rubrique Internet (resp. intranet) identifie qu’un contenu publié sur l’intranet (resp. Internet) doit être repris.
-
-
-
-
- Le mode « edit in place » permet à l’équipe Internet (resp. intranet) de récupérer ce contenu pour le publier.
-
-
-
-
-
- La validation et publication peuvent suivre des cycles totalement différents. Les contributeurs/valideurs travaillent de façons dissociées sur chaque site.
-
-
-
-
- Cas d’utilisation
-
-
- Contenu chaud ou de type catalogue
-
-
- Problématique :
-
-
- Un type de contenu est saisi en masse : soit souvent, soit en grande quantité
-
-
- Souvent – contenus chauds :
-
-
- Le cycle de vie du document est très raccourcis : contribution =
->
- publication rapide.
-
-
- Grande quantité – données structurée de type catalogues nécessitant des outils de recherche, de filtre développés sur le portail.
-
-
- Des contributeurs spécialisés, dédiés à la production de ces contenus.
-
-
- Solution : Edit/Publish
-
-
- Impacts :
-
-
-
-
- l’arbre des catégories est segmenté en zone Internet, intranet.
-
-
-
-
- le cycle de vie du contenu est porté par le contenu indépendamment du site sur lequel il est présenté.
-
-
-
-
- Contenu froid propre à un site
-
-
- Problématique :
-
-
- Il s’agit de faire simplement la mise à jour du site : contenu, rubriques, …
-
-
-
- Solution : Edit in place
-
-
- Impacts :
-
-
-
-
- aucun
-
-
-
-
-
- Contenu froid partagés par 2 sites réalisés dans des rubriques séparées
-
-
- Problématique :
-
-
- Des équipes éditoriales différentes travaillent sur des rubriques différentes de sites différents.
-
-
- Un document peut néanmoins être partagé entre les 2 sites.
-
-
-
- Solution: Edit in place.
-
- Jahia proposera un assistant (« content sourcing ») permettant de récupérer un contenu existant pour le publier.
-
-
- Impacts :
-
-
-
-
- Chaque contribution correspond à un cycle de vie différent qui est fonction de la page dans laquelle le contenu est produit ou récupéré.
-
-
-
-
- Tous les gabarits doivent intégrer les 2 chartes graphiques intranet et Internet. Pour pouvoir être intégré de façon harmonieuse tout contenu doit pouvoir être proposé sur l’intranet et l’Internet.
-
-
-
-
-
- Contenu froid partagés par 2 sites réalisés dans des rubriques mixtes
-
-
- Problématique :
-
-
- L’organisation éditoriale sur site Internet et du site intranet possèdent des similitudes : des rubriques sont partagées entre les 2 sites (même si ces rubriques ne sont pas disposées au même endroit.
-
-
- Solution : Edit in place et site virtuel mixte. Un site mixte est mis en place (techniquement) permettant de gérer ces rubriques partagées entre le site Internet et le site intranet.
-
-
- Impacts :
-
-
-
-
- Chaque portail (Internet, intranet) référence ces rubriques.
-
-
-
-
- Le cycle de vie du contenu est unique : contribution, notification, validation.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Une rubrique mixte devient propre à l’intranet (resp. l’Internet).
-
-
-
-
- Problématique :
-
-
- Une rubrique partagée se restreint à un site.
-
-
- Solution immédiate (cas d’une restriction temporaire) :
-
-
- Il suffit de retirer le lien sur le site Internet (resp. intranet) vers cette rubrique.
-
-
-
- Impact de la solution rapide :
-
-
-
-
- Les contenus continuent à être répliqués vers le site Internet (resp. intranet) même s’ils ne sont plus accessibles.
-
-
-
-
- De point de vue de la sécurité, ces documents étaient publiés juste avant la modification et gardent intrinsèquement leurs niveaux d’accessibilité ‘public’.
-
-
-
-
-
- Solution court terme :
-
-
- Les contenus sont recopiés (manuellement) depuis le site mixte vers le site intranet (resp. Internet). Il s’agit bien ici des back-offices de chaque site.
-
-
-
- Impact de la solution court terme :
-
-
-
-
- La recopie des contenus utilise la fonction de ‘content sourcing’ entre le site mixte et le site intranet (resp. Internet).
-
-
-
-
-
- Un contenu d’une rubrique mixte doit subir un embargo pour ne plus être accessible sur Internet.
-
-
- Problématique :
-
-
- Un contenu publié dans une rubrique mixte peut subir un embargo (temporaire ou définitif)
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Définir les outils (et les fonctions associées) permettant aux différents contributeurs d
-'
- administrer et de gérer la (les) base(s) de contenu indépendamment des accès via la navigation sur les sites de publication. (point 84 du cadre de réponse à détailler)
-
-
-
-
- Jahia propose en standard un outil permettant d’explorer les contenus indépendamment des accès via la navigation sur les sites de publication.
-
-
-
-
- Concernant les contenus réalisés en mode « edit/publish » une interface dédiée à la contribution et à la gestion est développée.
-
-
-
-
- Concernant les contenus réalisés en mode « edit in place », Capgemini propose d’intégrer un agent de la DPMA (transfert de compétence) qui durant le projet aura la charge de spécifier et de développer ces outils.
-
-
-
-
-
- Concernant les contenus non publiés ou en cours d
-'
- édition, décrire les outils, pour permettre aux utilisateurs du système (contributeur, éditeur, superviseurs) de modifier, publier ou de piloter le travail d
-'
- édition. (La notion de corbeille sera-t-elle étendue aux documents en cours de préparation, si oui, comment ?)
-
-
-
- Jahia propose un outil permettant aux différents utilisateurs (contributeurs, valideurs, administrateurs) de suivre les contenus.
-
-
-
-
-
-
-
- Zone de commentaires.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Contenu publié.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Contenu terminé en attente de validation.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Contenu en cours de rédaction.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Lors de la révision d
-'
- un document, est-ce que toutes ses instances de publication (internet et intranet) seront modifiées ?
-
-
-
- Les 2 cas sont possibles :
-
-
-
-
-
-
-
- Les contenus créés en mode « edit /publish » et les contenus mixtes sont modifiés au même moment sur tous les sites.
-
-
-
-
-
- Les autres contenus ont des cycles de vies différents – chaque contenu doit être validé dans chaque rubrique de chaque site.
-
-
-
-
-
-
-
-
-
- Norme JSR 170
-
-
-
-
- Le développement proposé s
-'
- appuie en grande partie sur la norme JSR 170 en cours de validation. Préciser l
-'
- état d
-'
- avancement de la norme à ce jour, les acteurs industriels associés, les points restant à définir, les risques et les enjeux de cette norme. Donner des exemples de travaux ou de projets réalisés s
-'
- appuyant ou exploitant les prémices ou quelques caractéristiques de cette norme. Indiquer quelle est la responsabilité effective de Jahia dans l
-'
- élaboration de cette norme
-
-
- Indiquer les éléments de la norme qui seront utilisés dans le projet et le rôle fonctionnel porté par chacun de ces éléments.
-
-
- Dans le cas où cette norme ne serait pas finalisée avant le démarrage du projet, préciser les solutions alternatives qui seraient retenus pour y palier
-
-
-
-
- Le draft publique de la JSR est publié.
-
-
-
-
- Jahia attend que la spécification soit adoptée. Une étude a été réalisée par Codeva permettant de vérifier que tous les concepts de Jahia entrent dans les concepts de la JSR.
-
-
-
-
- Le standard permet à Jahia à minima de standardiser l’export XML réalisé pour la synchro pour répondre à la structure CMS demandées par la JSR.
-
-
- L’implémentation de la JSR 170 n’est pas indispensable pour le projet de la DPMA.
-
-
-
-
-
-
- Poste de travail
-
-
-
-
- Indiquer si webdav n’est pas obligatoire pour ajouter des documents dans la gestion de contenu. Dans le cas où on publie sans Webdav, les postes de travail peuvent-ils être sous windows 95, ou windows 2000 ?
-
-
- Un poste équipé d’Open Office 1.2
-
- peut-il publier sans webdav ?
-
-
- Un poste équipé d’Open Office 1.2 peut-il publier avec webdav ?
-
-
-
- L’utilisation de webdav n’est pas une obligation pour mettre à disposition des fichiers sur le site. Webdav permet de simplifier la publication de fichiers car il fonctionne, sur le poste du contributeur, de la même manière qu’un répertoire partagé. Ainsi, le contributeur peut ajouter très rapidement sur le site un grand nombre de fichiers, ou restructurer l’arborescence des répertoires.
-
-
- Concernant les contributeurs ne disposant pas d’accès webdav, ils peuvent également « uploader » de fichiers sur le site en utilisant les fonctions disponibles sur le site. Dans ce cas, ils ne peuvent mettre à disposition qu’un seul fichier à la fois.
-
-
- Les postes équipés d’Open Office, pourront publier sans webdav à partir du site web, comme décrit ci-dessus. Pour une publication avec webdav, Open Office ne supporte pas l’implémentation fournit par Microsoft, par conséquent, il est nécessaire d’utiliser un outil externe tel que WebDrive permettant de simuler un lecteur réseau. La fourniture d’un tel outil n’est pas incluse dans l’offre de Capgemini.
-
-
-
-
-
-
-
-
-
- Gestion des utilisateurs déclarés
-
-
-
-
- Décrire les outils fournis pour administrer les utilisateurs qui sont déclarés pour bénéficier de la personnalisation (mesurer l
-'
- activité, identifier les centres d
-'
- intérêt déclarés, identifier les erreurs d
-'
- adresses courriel)
-
-
-
- Mesurer l’activité.
-
-
-
- Le suivi de l’activité peut être réalisé en utilisant Xiti et les logs produits par Apache et travaillés avec Awstat.
-
-
-
- Pour un suivi plus fin, Capgemini propose d’utiliser Log4J. Ce composant permet de lever des traces dans les templates Jahia, permettant de suivre : l’utilisateur/groupe, la page demandée. Ce suivi est réalisé dans un fichier (journal).
-
-
-
- La DPMA récupère les différents journaux sur les différents serveurs pour les analyser avec Excel par exemple.
-
-
-
-
- Identifier les centres d’intérêt déclarés.
-
-
- A la demande de la DPMA, Capgemini peut intégrer un développement spécifique permettant d’interroger les données de personnalisation et produire un fichier Excel.
-
-
-
-
- Identifier les erreurs d’adresses courriel.
-
-
-
-
- Le logiciel Sympa reçoit les mails en erreur lorsque l’adresse courriel est erronée. Le portail n’a pas d’action sur ces adresses.
-
-
-
-
-
- Par expérience, il est difficile de prévoir à priori les statistiques utiles au site. Il devient donc difficile de prévoir les bons points de mesures qui permettront de produire les statistiques.
-
-
-
-
- La solution de Capgemini intègre une technologie permettant de réaliser ces points de mesures. Une première mise en œuvre est prévue qui permet de valider les principes et les fonctionnements.
-
-
-
-
- Lors du transfert de compétence, ce point est notamment traité et permettra à la DPMA de positionner de nouveaux points de mesures et d’affiner les statistiques utiles.
-
-
-
-
-
-
-
- Moteur de Workflow Sensei
-
-
-
-
- Sensei n
-'
- ayant pas été intégré dans le prototype, fournir une description détaillé de cet outil (règles de fonctionnement et d
-'
- administration, ergonomie fonctionnelle).
-
-
- Sensei est-il inclus dans la proposition ?.
-
-
- Dans le paragraphe 3.3.1, il est précisé que la livraison comprend trois workflow type. Le schéma qui suit ne prend pas en compte la gestion de la multi-publication. Il convient de préciser que les 3 workflow proposés prendront en compte la publication-multi-sites.
-
-
-
-
-
-
-
- Sensei est un
-
- moteur de gestion de process (BPMS - Business Process Management System) et d’orchestration de Webservices.
-
-
-
-
-
- Sensei va donc permettre de mettre en relation des systèmes hétérogènes par l’échange de messages standardisés (xml / soap) organisés selon un schéma (process) directeur défini lui aussi de façon standard (bpml).
-
-
-
-
-
- Sensei est un logiciel fondé sur la philosophie du développement collaboratif :
-
-
-
-
-
- Licence collaborative (vous ne payez pas les logiciels que vous contribuez à faire évoluer)
-
-
-
-
-
-
-
- Sources ouvertes
-
-
-
-
-
-
-
- Faible coût d’acquisition vs fonctionnalités
-
-
-
-
-
-
-
- Fédération des développements au sein de la communauté des utilisateurs
-
-
-
-
-
-
-
- Basé uniquement sur des standards : J2EE, JDO, Webservices, BPML
-
-
-
-
-
-
-
-
-
- Sensei est basé sur des standards ouverts :
-
-
-
-
-
- WSDL pour la définition des interfaces Soap / Webservices (Universalité applicative : J2EE / .NET / PHP)
-
-
-
-
- BPML pour la définition des process
-
-
-
-
- Exécution des process réalisés entièrement par Webservices (Soap et XML) mais pouvant être étendus par l’utilisation d’autres connecteurs (JMS,…)
-
-
-
-
- Architecturé sur les technologies J2EE (Sun ©) via des composants Servlet.
-
-
-
-
-
-
-
-
- Schéma de l
-'
- architecture :
-
-
-
-
-
-
-
-
-
-
- Intégrant Sensei, la version « Enterprise » de Jahia va permettre l’ajout de processus complexes de publication définis par un fichier XML standardisé (BPML) en interaction totale avec Jahia (étapes de publication, notifications, verrouillage des objets de contenu, date de début de publication, etc…).
-
-
-
- Par ailleurs, Sensei va permettre, au-delà de la gestion des workflow complexes de publication, de mettre en place des applications métiers au travers des templates de Jahia ou dans le cadre d’une application web déployée dans Jahia. La Webapps métier utilisera alors Sensei pour gérer des process spécifiques, sans aucun lien avec le process de publication.
-
-
-
-
- La gestion des workflow complexes de publication
-
-
-
- Jahia propose en version standard un workflow de publication à 2 étapes : l’auteur notifie une version de contenu sur lequel il travaille à un validateur qui acceptera ou refusera cette nouvelle version. Le contenu sera disponible en ligne, une fois validé.
-
-
-
- La version « Entreprise » de Jahia permet, grâce à Sensei, de définir des workflow complexes de publication à plusieurs étapes.
-
-
-
- Jahia va par ailleurs gérer les héritages de workflow : on peut à tout moment définir un process de publication différent de la page parente du contenu publié ou, inversement, avoir (option par défaut) le même workflow de publication que la page parente.
-
-
-
- Par exemple, l’utilisateur créée une page et sélectionne sur le bouton « modifier les propriétés » :
-
-
-
-
-
-
-
-
- Il va pouvoir sélectionner dans l’onglet « workflow de publication », le type de workflow souhaité (hérité, standard, aucun workflow, externe) :
-
-
-
-
-
-
-
- En sélectionnant le workflow externe, il va pouvoir choisir parmi les process de publication importés dans Sensei.
-
-
-
- Par exemple, si l’utilisateur choisit le workflow à 3 étapes, il devra alors définir les personnes en charges de chacune des étapes :
-
-
-
-
-
-
-
-
- Les actions possibles et leurs conséquences à chaque étapes sont gérées par Sensei selon le schéma directeur défini dans le fichier BPML : notification, choix à la disposition de la personne en charge de l’étape (par exemple définir ou non une date de début de publication), verrouillage des objets de contenus etc…
-
-
- Application métier : Gestion de demandes
-
-
-
-
-
- L’application de gestion des demandes est une véritable application basée sur Jahia, livrée avec la version « Entreprise ».
-
-
-
-
- Elle a été développé sur base du système de template de Jahia (une webapp / portlet déployée dans Jahia était une alternative) afin de bénéficier des fonctionnalités (indexation, personnalisation, gestion des fichiers) et de la souplesse de modifications des gabarits de Jahia.
-
-
-
- Elle a été développée à la demande du Parlement Européen et redistribuée à la communauté.
-
-
-
- Cette application permet à une personne de solliciter l’avis d’un groupe d’expert afin de répondre à une requête. Dans le cadre du projet du Parlement Européen, cette requête prend la forme d’une demande de support et de préconisation autour d’un projet informatique piloté par la Direction Informatique.
-
-
-
- La personne va donc créer une demande et solliciter un groupe d’expert ou un expert particulier (le « dispatcher ») si elle n’est pas certaine du domaine concerné par sa demande.
-
-
-
- Le groupe d’expert sera prévenu de cette demande et un membre du groupe devra prendre en charge cette demande sans quoi, sous 24h, le « dispatcher » sera prévenu par notification mail afin d’éventuellement désigner un responsable.
-
-
-
- Le responsable de la demande constituera alors sont groupe de travail.
-
-
- Le groupe travaillera de façon collaborative sur la page de la demande (créée automatiquement par le système) en publiant des informations et documents publics (visibles par le demandeur) ou privés (visibles par le groupe de travail).
-
-
-
- La page de la demande présente donc l’historique complet du travail effectué et des évènements survenus lors du déroulement du processus de traitement de la requête.
-
-
-
-
- Chaque demandeur et participant à une demande voit dans la liste personnalisée que le système présente de façon personnalisé, les demandes le concernant, son rôle et leur état d’avancement.
-
-
-
-
- La composition du groupe de travail et le responsable de la demande sont modifiables à tous moment, Sensei gérant l’ensemble des conséquences issues de ces évènements.
-
-
-
- La publication de la réponse va mettre la demande en état « clôturé », personne ne pouvant plus y participer, à moins que le demandeur ré - ouvre sa requête, non satisfait de la réponse.
-
-
-
- Comme le montre le schéma ci-dessous, les actions issues du déroulement de l’application (création de la demande, création de la page présentant son historique, gestion des accès et des droits sur la demande, notifications mails etc…) sont gérés par Sensei selon le schéma défini en BPML en interaction avec deux Webservices :
-
-
-
-
-
- Jahia Management Webservice : en charge du contrôle de Jahia (création des pages, modifications des droits, etc…)
-
-
-
-
-
-
-
- Notifier Webservice : gestion des notifications, différentes selon les nombreux évènements provenant du déroulement du process vers le serveur SMTP
-
-
-
-
-
-
-
-
-
-
-
-
-
- Illustrons les fonctionnalités et la valeur ajoutée apportée par l’utilisation de Sensei au travers du scénario suivant :
-
-
-
-
-
- Une personne se connecte, le «
-
-
-
- demandeur
-
-
-
- 1 » et
-
-
-
- va créer
-
-
-
- une
-
-
-
- demande
-
-
-
- destinée
-
-
-
- au
-
-
-
- domaine
-
-
- «
-
-
- A »
-
-
- de compétence.
-
-
-
-
-
- La
-
-
-
- demande
-
-
-
- apparaît
-
-
-
- dans
-
-
-
- le
-
-
-
- tablea
-
-
- u
-
-
- en
-
-
-
- état
-
-
-
- «
-
-
-
- Initialisation
-
-
-
- ».
-
-
-
-
-
-
-
-
-
-
- En
-
-
-
- cliquan
-
-
- t
-
-
-
- sur
-
-
-
- la
-
-
-
- de
-
-
- m
-
-
- ande,
-
-
-
- le
-
-
-
- demandeur
-
-
- 1
-
-
-
- peut
-
-
-
- vérifier
-
-
-
- les
-
-
-
- données
-
-
-
- de
-
-
-
- sa
-
-
-
- demande mais
-
-
-
- peut
-
-
-
- effectuer
-
-
-
- une
-
-
-
- seule
-
-
-
- a
-
-
- c
-
-
- tion
-
-
-
- :
-
-
-
-
-
-
-
- «
-
-
-
- Poster
-
-
-
- un
-
-
-
- commentaire
-
-
-
- public
-
-
-
- »
-
-
-
-
-
-
-
-
-
-
- Il
-
-
-
- peut
-
-
-
- ain
-
-
- s
-
-
- i
-
-
-
- préciser
-
-
-
- s
-
-
- a
-
-
-
- demande
-
-
-
- de
-
-
-
- faço
-
-
- n
-
-
-
- plus
-
-
-
- complè
-
-
- t
-
-
- e,
-
-
-
- par
-
-
-
- exemple
-
-
-
- en
-
-
-
- mettant
-
-
-
- à dispo
-
-
- s
-
-
- ition
-
-
-
- un
-
-
-
- fichier
-
-
-
- de
-
-
-
- référence.
-
-
-
-
-
- Les
-
-
-
- membres
-
-
-
- du
-
-
-
- domaine
-
-
-
- A
-
-
-
- on
-
-
- t
-
-
-
- reçu
-
-
-
- u
-
-
- n
-
-
-
- mail
-
-
-
- d
-
-
- e
-
-
-
- no
-
-
- t
-
-
- ificatio
-
-
- n
-
-
-
- c
-
-
- o
-
-
- ncernant cette
-
-
-
- nouvelle
-
-
-
- demande.
-
-
-
-
-
- C
-
-
- ette
-
-
-
- demande
-
-
-
- sera prise
-
-
-
- en
-
-
-
- charge
-
-
-
- par
-
-
-
- l’expert
-
-
-
- 1
-
-
-
- de
-
-
-
- c
-
-
- e
-
-
- groupe
-
-
-
- de
-
-
-
- compétence
-
-
-
- A
-
-
-
- (expert1domA).
-
-
-
-
-
- L’expert1domA
-
-
-
- puis
-
-
-
- all
-
-
- e
-
-
- r
-
-
-
- sur
-
-
-
- la
-
-
-
- liste
-
-
-
- des
-
-
-
- demandes
-
-
-
- et
-
-
-
- cliq
-
-
- u
-
-
- er sur
-
-
-
- la
-
-
-
- demande
-
-
-
- (ou
-
-
-
- c
-
-
- liquer
-
-
-
- sur
-
-
-
- le
-
-
-
- lien
-
-
-
- pré
-
-
- s
-
-
- enté
-
-
-
- dans
-
-
-
- le
-
-
-
- mail
-
-
-
- de
-
-
-
- notification
-
-
-
- et
-
-
-
- se
-
-
- connecter avec ce profil).
-
-
-
-
-
-
- L’expert1domA
-
-
-
- peut
-
-
-
- alors
-
-
-
- se
-
-
-
- désigne
-
-
- r
-
-
-
- comme
-
-
-
- responsable
-
-
-
- de
-
-
-
- cette
-
-
-
- demande.
-
-
-
-
-
-
-
-
-
-
-
-
-
- L’expert1domA peut alors :
-
-
-
-
-
-
- Modifier
-
-
-
-
- son
-
-
-
-
- groupe
-
-
-
-
- de
-
-
-
-
- travail
-
-
-
-
- (gr
-
-
- oupe
-
-
-
-
-
-
- qu’il
-
-
-
-
-
-
- constitue et destiné
-
-
-
-
-
-
- à
-
-
-
-
-
-
- l’aide
-
-
- r
-
-
-
-
-
-
- à répondre
-
-
-
- à
-
-
-
- cette
-
-
-
- demande)
-
-
-
-
-
-
-
-
-
- Ajouter
-
-
-
- un
-
-
-
- commentaire
-
-
-
- public
-
-
-
- ou
-
-
-
- privé
-
-
-
-
-
-
-
-
-
- Ajouter
-
-
-
-
- une
-
-
-
-
- réponse
-
-
-
-
- afin
-
-
-
-
-
- de
-
-
-
-
- clôturer
-
-
-
-
- à
-
-
-
-
- tout
-
-
-
-
- m
-
-
- oment
-
-
-
-
-
-
- cette
-
-
-
-
-
-
- demande
-
-
-
-
-
-
- et répondre
-
-
-
- au
-
-
-
- demandeur.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Not
-
-
- e
-
-
- :
-
-
-
- L’historique
-
-
-
- de
-
-
-
- la
-
-
-
- demande
-
-
-
- fai
-
-
- t
-
-
-
-
-
- apparaître
-
-
-
- un
-
-
-
- bloc
-
-
-
- bleu
-
-
-
- (message
-
-
-
- public)
-
-
- signifiant la date et l’évènement (
-
-
- «
-
-
-
- Un
-
-
-
- responsable
-
-
-
- s’est
-
-
-
- désigné
-
-
-
- »)
-
-
-
-
-
-
- L’expert1domA
-
-
-
- va
-
-
-
- créer
-
-
-
- son
-
-
-
- groupe
-
-
-
- de
-
-
-
- trav
-
-
- a
-
-
- il
-
-
-
- en
-
-
-
- c
-
-
- liquant
-
-
-
- sur
-
-
-
- le
-
-
-
- bouton
-
-
-
-
-
- «
-
-
- Modifier
-
-
-
- le groupe
-
-
-
- de
-
-
-
- travail
-
-
-
- ».
-
-
-
-
-
- Il
-
-
-
- verra
-
-
-
- apparaître
-
-
-
- dans
-
-
-
- la
-
-
-
- c
-
-
- olonne
-
-
-
- d
-
-
- e
-
-
-
- gauche
-
-
-
- l’ensemble
-
-
-
- d
-
-
- e
-
-
- s
-
-
-
- utilisateurs
-
-
-
- du
-
-
- groupe
-
-
-
- «
-
-
-
- demandes
-
-
-
- » et sélectionne les personnes susceptibles de l’aider à répondre à cette demande
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Pour
-
-
-
- valider,
-
-
-
- cliquer
-
-
-
- sur
-
-
-
- «
-
-
-
- Soumettre
-
-
-
- la
-
-
-
- requête
-
-
-
- ».
-
-
-
-
-
-
- Not
-
-
- e
-
-
- :
-
-
-
-
-
-
- L’historique
-
-
-
-
-
-
- de
-
-
-
-
-
-
- la
-
-
-
-
-
-
- demande
-
-
-
-
-
-
- fai
-
-
- t
-
-
-
-
-
- apparaître
-
-
-
-
-
-
- un
-
-
-
-
-
-
- blo
-
-
- c
-
-
-
-
- v
-
-
- ert
-
-
-
-
-
-
- (message
-
-
-
-
-
-
- privé)
-
-
- signifiant la date et l’évènement (
-
-
- «
-
-
-
- Le groupe de travail a été modifié
-
-
-
- »)
-
-
-
-
-
- Les personnes concernées reçoivent alors un
-
-
-
- mail
-
-
-
- leur notifiant
-
-
-
- le
-
-
-
- fait
-
-
-
- que
-
-
-
- le
-
-
-
- g
-
-
- r
-
-
- oupe
-
-
-
- de
-
-
-
- travail
-
-
-
- a
-
-
-
- été
-
-
-
- con
-
-
- s
-
-
- titu
-
-
- é
-
-
-
-
-
- et
-
-
-
- qu’ils
-
-
-
- sont
-
-
-
- in
-
-
- v
-
-
- ités
-
-
-
- à
-
-
-
- y
-
-
- participer.
-
-
-
-
-
- Chaque
-
-
-
- membre
-
-
-
- du
-
-
-
- groupe
-
-
-
- peut poster des commentaires
-
-
-
- privés
-
-
-
- et
-
-
-
- publics afin de faire avancer la réponse à la demande de façon collaborative.
-
-
-
-
-
- L’expert1domA
-
-
-
- poste
-
-
-
- la
-
-
-
- réponse à la demande dès qu’il estime que cette dernière est prête :
-
-
-
-
-
-
-
-
- Le demandeur est alors prévenu et peut décider de ré-ouvrir la demande si il n’est pas satisfait de la réponse. Passé un délai de 1 mois, la demande passe en état « archive » :
-
-
-
-
-
-
-
-
-
-
- Exemples d’interfaces
-
-
-
- Mise en action / en suspens des process déclarés vers l’application de destination :
-
-
-
-
-
-
-
-
-
-
-
-
- Interface de monitoring
-
-
-
-
-
-
-
-
-
- Monitoring d’un process sélectionné
-
-
-
-
-
-
-
-
-
-
-
- Export BPML
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Gestion des formulaires sur les portails (type formulaire d’enquête)
-
-
-
-
- Décrire précisément la solution qui sera retenue pour générer, paramétrer et publier des formulaires, y compris dans l
-'
- exploitation des données qui seront saisies par les utilisateurs.
-
-
- La proposition de Capgemini n’intègre pas de composants permettant de gérer des formulaires. Néanmoins, cette fonctionnalité est prévue dans Jahia. Un client développe en mode collaboratif ce composant.
-
-
-
-
-
-
- Gestion des droits des internautes sur le portail
-
-
-
-
- Pourra-t-on auditer les droits (et éventuellement les accès) des utilisateurs déclarés sur le portail?
-
-
- Capgemini intègre un export des droits d’un site (utilisateur/droits).
-
-
-
-
-
-
- Administration des portails Jahia sur Internet
-
-
-
-
- Le portail est administrable à travers le protocole http.
-
-
- Néanmoins, l
-'
- instance installée sur Internet reste-t-elle administrable à partir de l’Internet ? Dans le prototype, l’accès aux outils d’administration du portail est réalisé à partir d’un contrôle de login / mot de passe. Ce type de contrôle est insuffisant en production.
-
-
- Comment l’intégrateur est-il en mesure de garantir que les outils d’administration des outils ne seront pas attaqués ? Est-il prévu des contrôles autre que des accès protégés par login / mot de passe (accès par adresse et port TCP/IP séparée) ?
-
-
- Il est
-
- demandé au prestataire de préciser les moyens empêchant l
-'
- accès via Internet aux interfaces d
-'
- administration.
-
-
-
-
- Les fonctions d’administrations sont retirées de l’instance Jahia sur Internet (voir question 21).
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Gestion du portail Internet
-
-
-
-
- La modification de structure est-elle faite par l’outil d’administration du portail Internet en s’adressant à la bonne instance de portail ou est-elle faite à partir du portail intranet ?
-
-
-
- La modification de structure n’est pas faite uniquement par l’outil d’administration.
-
-
-
-
- Les modifications de structures qui sont réalisées sur le portail intranet sont répliquées sur le portail Internet automatiquement : nouvelle page, nouvelle rubrique, nouveau sous site, nouveau groupe, nouvelle catégorie …
-
-
-
-
-
- Les modifications de structures qui nécessitent la mise à jour du logiciel (corrections Java, nouveau template – JSP, nouvelle application Java) sont réalisées grâce à un processus traditionnel de livraison d’un patch en pré production puis en production.
-
-
-
-
- Question complémentaire : si la modification de structure est faite à partir de l’outil d’administration du portail Internet et que le ‘rubriquage’ est en partie géré dans la gestion de contenu intranet, comment se fait la synchronisation entre la structure définie sur le portail Internet et la gestion de contenu qui se trouve sur intranet (sachant que les flux entrants de l’Internet sont interdits).
-
-
-
- Les modifications de structures ne sont pas faites à partir de l’outil d’administration du portail Internet.
-
-
-
-
-
-
-
-
-
- Flux IZ2
-
-
-
-
-
-
-
-
- Y a-t-il des flux directs pour gérer le portail ?
-
-
-
-
- Lesquels ? pour faire quoi
-
-
-
-
-
-
-
-
- Il convient de préciser s’il existe des flux dans la zone Internet sur le portail et pour faire quoi.
-
-
-
- Toutes les actions
-
- de gestion du portail Internet et de sites associés sont-elles réalisées à partir de l’instance Jahia intranet ? Si non préciser, les limites ?
-
-
-
-
- Les actions de gestion du portail Internet sont réalisées depuis l’intranet à l’exception des :
-
-
-
-
-
- modifications de structures qui nécessitent la mise à jour du logiciel (corrections Java, nouveau template – JSP, nouvelle application Java) sont réalisées grâce à un processus traditionnel de livraison d’un patch en pré-production puis en production.
-
-
-
-
- actions d’administrations (sauvegardes, purges).
-
-
-
-
-
-
-
-
-
-
-
- (nouveau)
-
- Préciser par rapport au calendrier du projet la date de début de la période de maintenance annuelle des progiciels et notamment par rapport à la VSR du projet.
-
-
-
-
-
- Effectivement les coûts de maintenances de Jahia sont prévus à l’issue de la VSR.
-
-
-
- Durant la phase de développement du projet, le support de Jahia est directement réalisé au travers de l’intégration au projet en temps que sous-traitant.
-
-
- Le poste 12 utile au projet du bordereau de prix est modifié en conséquence.
-
-
-
-
-
-
- (nouveau)
-
-
- Le Minefi fournira des explications sur la définition des syntaxes de recherche (cf annexe)
-
-
-
-
-
- Cap Gemini indiquera s’il peut s
-'
- engager à accompagner le Minefi dans le domaine fonctionnel de la mise en place des moteurs de recherche.
-
-
-
-
- Le moteur Lucerne accompagné du Thésaurus permet une grande souplesse de mise en œuvre.
-
- Capgemini propose qu’à l’issue de la mise en place des portails une enquête soit réalisée permettant de modifier le paramétrage du moteur de recherche en fonction des retours des utilisateurs.
-
-
-
-
-
-
-
-
-
-
-
- (nouveau)
-
-
- Le tableau des prix des unités d’œuvre du paragraphe 5.3.1.1 est modifié par l
-'
- ajout de 3 colonnes (10 pages, 50 pages, 200 pages). Il devient :
-
-
-
-
-
-
-
-
-
-
-
-
- Reprise d’un site statique
-
-
-
-
-
-
-
-
-
- Coût unitaire (Euros HT)
-
-
-
-
-
-
-
-
- Pour 10 pages
-
-
-
-
- Pour 50 pages
-
-
-
-
- Pour 200 pages
-
-
-
-
-
-
-
-
-
-
-
- Page simple : uniquement de l’information
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Page complexe : information, 8 images ou liens relatifs au maximum
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Page très complexe : information, plus de 8 images ou liens relatifs au maximum
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Intégré.
-
-
-
-
-
-
-
-
- (nouveau)
-
-
- décrire les outils de back office pour la gestion et/ ou les portails qui seront proposés (exemple : rechercher les documents qui ne publiés dans aucun site, rechercher les documents qui ont plus de deux ans.
-
-
-
-
-
-
-
- Capgemini propose d’intégrer un agent de la DPMA qui peut développer ces fonctionnalités d’exploration des contenus de Jahia.
-
-
-
-
-
- Annexes
-
-
-
-
-
-
-
-
- Tableau de synthèse Méta-données
-
-
- (document non validé)
-
-
-
-
-
-
-
-
-
-
- Méta-données
-
-
-
-
- Obligatoire/facultatif
-
-
-
-
- commentaires
-
-
-
-
-
-
- Date de création
-
-
-
-
-
-
- Obligatoire
-
-
-
-
-
-
-
-
-
- Date de publication
-
-
-
-
- Obligatoire
-
-
-
-
- cette date sera affichée par défaut avec la date du jour, modifiable par le contributeur. Cette date pourra être utilisée comme date prévisionnelle de publication
-
-
-
-
-
-
- Date de modification
-
-
-
-
- Obligatoire
-
-
-
-
- cette date sera renseignée par défaut par la date système. Elle devra être modifiable par le contributeur. Le fait d’afficher cette date sur la page devra être spécifiée (case à cocher) par le contributeur.
-
-
-
-
-
-
-
- Date de fin de publication
-
-
-
-
- Facultatif/obligatoire
-
-
-
-
- tout ce qui est événementielle comme par exemple « le printemps des poètes , la déclaration de l’impôt.. » auront une date de fin de publication facile à définir.
-
-
- Pour toutes les autres rubriques , ce sera le responsable éditorial qui devra gérer cette fin de publication .
-
-
-
-
- La
-
- date de fin de publication sera attachée non pas au document mais à la rubrique .En effet un document budgétaire peut être publié soit dans l’actualité (événement) soit dans une rubrique budget. En fonction de la rubrique, la date de fin de publication est donc différente. La date de fin de publication sera affichée par défaut modifiable par le responsable éditorial
-
-
-
-
-
-
-
-
- Date de révision
-
-
-
-
- Facultative/obligatoire
-
-
-
-
-
-
- une date de prochaine révision
-
- sera obligatoire pour tous les documents sauf pour les événements . Elle sera
-
- affichée par défaut (même date suivant la typologie des documents). Cette date sera une alerte pour le responsable éditorial qui pourra consulter tous les documents devant être « révisés c’est à dire doit il rester en ligne ? si non mettre une date de fin de publication )
-
-
-
-
-
-
-
-
-
- Date de soumission
-
-
-
-
-
-
-
-
- Non retenue
-
-
-
-
-
-
-
- -title
-
-
-
-
- obligatoire
-
-
-
-
-
- Il a été décidé de faire remplir directement par le rédacteur à partir du formulaire de l’outil de gestion de contenu, une zone
-"
- Title
-"
- différenciée de la rubrique titre du document. Une règle de gestion a été définie : la zone title affichera par défaut le titre du document préalablement saisi, la date de création du document et la typologie du document.
-
-
-
-
-
-
-
- Description
-
-
-
-
-
- obligatoire en fonction typologies des documents
-
-
-
-
-
- elle sera obligatoire en fonction de la typologie du document (une brève pas de résumé , un rapport obligatoire).
-
-
-
-
-
-
-
- Mots clés
-
-
-
-
- Obligatoire
-
-
-
-
- les thésaurus ne seront pas utilisés . les mots clés seront automatiquement créés à partir du plan de classement (cumul de toutes les arborescences)
-
-
-
-
-
-
-
- Typologie des documents
-
-
-
-
- Obligatoire
-
-
-
-
- Normalement une typologie
-
- correspond à un gabarit . En fonction de la liste où environ 50 typologies sont prévues , une étude sur la portée sémantique devra être réalisée pour regrouper plusieurs typologies à un formulaire de saisie.
-
-
-
-
-
-
- Créateur/auteur
-
-
-
-
- Facultatif
-
-
-
-
- cela correspond au nom de la personne ou propriétaire à l’origine de l’information. Sur Internet le Sircom ne souhaite pas avoir cette information là. Sur Intranet, cette information pourrait être affichée dans la page
-
-
-
-
-
-
- Méta langage
-
-
-
-
- Obligatoire
-
-
-
-
- Il est décidé de mettre par défaut « Français » avec possibilité de modifier la valeur.
-
-
-
-
-
-
-
- Méta droits
-
-
-
-
- Obligatoire
-
-
-
-
-
- Pour tous les documents qu’ils soient sur Intranet/Internet, seront renseignés automatiquement avec un copy right.
-
-
-
-
-
-
-
-
- Méta couverture
-
-
-
-
- ?
-
-
-
-
- Deux possibilités ont été présentées :
-
-
- La saisie dans le formulaire de la couverture géographique
-
- sera renseignée
-
- mais il s’afficherait dans les métas - keyword
-
-
-
-
- La saisie se ferait dans une zone méta-couverture spécifique
-
-
-
-
-
-
-
- Editeur
-
-
-
-
- Facultatif
-
-
-
-
- personne qui publie. Sur l’internet dans tous les cas il faudra renseigner par défaut : éditeur = minéfi-Sircom ; pour intranet cette information n’est pas utile
-
-
-
-
-
-
-
-
-
- Syntaxe d
-'
- interrogation
-
-
-
-
-
-
-
- Recherche approchée / recherche floue
-
-
-
-
- Recherche élargie :
-"
- adminstration
-"
- cherche
-"
- Administration
-"
-
-
-
-
-
-
- Recherche phonétique
-
-
-
-
-"
- contrefasson
-"
- cherche
-"
- contrefaçon
-"
-
-
-
-
-
-
- Expressions exacte
-
-
-
-
-
-
-
-
-
- Masque de recherche
-
-
-
-
-"
- ele.*t cherche les mots commençant par ele et finissant par t
-
-
-
-
-
-
- Troncature limitée / illimitée
-
-
-
-
-"
- Impo?
-"
- cherche
-"
- Impot
-"
-
-
-"
- Cors*
-"
- cherche
-"
- Corse
-"
- ,
-"
- Corsica
-"
- ,
-"
- Corsaire
-"
- …
-
-
-
-
-
-
- Correction orthographique
-
-
-
-
- Proposition d
-'
- une orthographe alternative
-
-
-
-
-
-
- Lemmatisation
-
-
-
-
- Analyse de la racine des termes :
-"
- cheval
-"
- cherche
-"
- chevaux
-"
-
-
-
-
-
-
- Combinaison des fonctionnalités
-
-
-
-
- Recherche phonétique approchée, Recherche par masque approchée, recherche par masque + troncature
-
-
-
-
-
-
- Personnalisation
-
-
-
-
-
-
-
- Thesaurus / dictionnaires
-
-
-
-
- Addition à la recherche plein texte
-
-
-
-
-
-
- Recherche sur champs
-
-
-
-
- Recherche sur des champs spécifiques (champs auteur, résumé, mots-clefs, titre…)
-
-
-
-
-
-
- Pondération des résultats
-
-
-
-
-
-
-
- Adéquation requête / document
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Opérateur de proximité par défaut
-
- : les documents qui contiennent les mots de la requête les plus proches les uns des autres sont favorisés
-
-
-
-
-
-
- Les formes exactes sont favorisées par rapport aux formes lemmatisées
-
-
-
-
-
-
- Définition d
-'
- un espacement maximum entre les mots de la requête
-
-
-
-
-
-
-
-
-
- Champs sur-pondérés
-
-
-
-
-
-
-
-
-
-
-
-
- Les champs dont la pondération est supérieure à celle du texte sont paramétrables (par défaut : titre)
-
-
-
-
-
-
- Indice de popularité (ranking)
-
-
-
-
-
-
-
-
-
-
-
-
- Classement des documents en fonction du nombre de lien pointant vers la page.
-
-
-
-
-
-
-
diff --git a/contrib/orm-persistence/applications/test/log4j.xml b/contrib/orm-persistence/applications/test/log4j.xml
deleted file mode 100644
index 89d2701d02d..00000000000
--- a/contrib/orm-persistence/applications/test/log4j.xml
+++ /dev/null
@@ -1,59 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/contrib/orm-persistence/applications/test/ojb/repository.dtd b/contrib/orm-persistence/applications/test/ojb/repository.dtd
deleted file mode 100644
index 6a2d4668417..00000000000
--- a/contrib/orm-persistence/applications/test/ojb/repository.dtd
+++ /dev/null
@@ -1,950 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/contrib/orm-persistence/applications/test/ojb/repository.xml b/contrib/orm-persistence/applications/test/ojb/repository.xml
deleted file mode 100644
index 43c4c535fe3..00000000000
--- a/contrib/orm-persistence/applications/test/ojb/repository.xml
+++ /dev/null
@@ -1,59 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-]>
-
-
-
-
-
- &database;
-
-
- &internal;
-
-
- &user;
-
-
diff --git a/contrib/orm-persistence/applications/test/ojb/repository_database.xml b/contrib/orm-persistence/applications/test/ojb/repository_database.xml
deleted file mode 100644
index d7a1f19a148..00000000000
--- a/contrib/orm-persistence/applications/test/ojb/repository_database.xml
+++ /dev/null
@@ -1,203 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/contrib/orm-persistence/applications/test/ojb/repository_internal.xml b/contrib/orm-persistence/applications/test/ojb/repository_internal.xml
deleted file mode 100644
index f7ff25a49fc..00000000000
--- a/contrib/orm-persistence/applications/test/ojb/repository_internal.xml
+++ /dev/null
@@ -1,362 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/contrib/orm-persistence/applications/test/ojb/repository_user.xml b/contrib/orm-persistence/applications/test/ojb/repository_user.xml
deleted file mode 100644
index 973d09db87d..00000000000
--- a/contrib/orm-persistence/applications/test/ojb/repository_user.xml
+++ /dev/null
@@ -1,285 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/contrib/orm-persistence/applications/test/repository.xml b/contrib/orm-persistence/applications/test/repository.xml
deleted file mode 100644
index 04d3cf4582d..00000000000
--- a/contrib/orm-persistence/applications/test/repository.xml
+++ /dev/null
@@ -1,187 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-]>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/contrib/orm-persistence/applications/test/repository/nodetypes/custom_nodetypes.xml b/contrib/orm-persistence/applications/test/repository/nodetypes/custom_nodetypes.xml
deleted file mode 100644
index 430a328bd66..00000000000
--- a/contrib/orm-persistence/applications/test/repository/nodetypes/custom_nodetypes.xml
+++ /dev/null
@@ -1,70 +0,0 @@
-
-
-
-
-
- mix:versionable
- nt:base
-
-
-
-
-
-
-
-
-
-
- nt:base
-
-
-
-
- nt:base
-
-
-
-
- nt:base
-
-
-
-
- nt:base
-
-
-
-
- nt:base
-
-
-
-
- nt:base
-
-
-
-
- nt:base
-
-
-
-
-
diff --git a/contrib/orm-persistence/applications/test/repositoryStubImpl.properties b/contrib/orm-persistence/applications/test/repositoryStubImpl.properties
deleted file mode 100644
index 37b115e1460..00000000000
--- a/contrib/orm-persistence/applications/test/repositoryStubImpl.properties
+++ /dev/null
@@ -1,109 +0,0 @@
-# Copyright 2003-2005 The Apache Software Foundation or its licensors,
-# as applicable
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-# This is the configuration file for the jackrabbit repository test stub.
-#
-
-# Stub implementation class
-javax.jcr.tck.repository_stub_impl=org.apache.jackrabbit.test.JackrabbitRepositoryStub
-
-# credential configuration
-javax.jcr.tck.superuser.name=superuser
-javax.jcr.tck.superuser.pwd=
-javax.jcr.tck.readwrite.name=user
-javax.jcr.tck.readwrite.pwd=
-javax.jcr.tck.readonly.name=anonymous
-javax.jcr.tck.readonly.pwd=
-
-# global test configuration
-javax.jcr.tck.testroot=/testroot
-javax.jcr.tck.nodetype=nt:unstructured
-javax.jcr.tck.nodename1=foo
-javax.jcr.tck.nodename2=bar
-javax.jcr.tck.nodename3=foobar
-javax.jcr.tck.nodename4=myname
-javax.jcr.tck.propertyname1=prop1
-javax.jcr.tck.propertyname2=prop2
-javax.jcr.tck.workspacename=test
-
-# namespace configuration
-javax.jcr.tck.namespaces=test
-javax.jcr.tck.namespaces.test=http://www.apache.org/jackrabbit/test
-
-# sample for per test case config overriding
-# Test class: AddNodeText
-# Test method: testName
-javax.jcr.tck.AddNodeTest.testName.nodename1=myname
-
-# QUERY CONFIGURATION
-
-# Test class: SaveTest
-# Test method: testConstraintViolationException
-# Specified node type must not allow child nodes.
-javax.jcr.tck.SaveTest.testConstraintViolationException.nodetype=nt:query
-
-# VERSIONING CONFIGURATION
-
-# nodetye that is versionable. if it is not, an attempt is made to create versionable nodes
-# by adding a mix:versionable mixin-type.
-# NOTE: javax.jcr.tck.nodetype must define a non-versionable nodetype!
-javax.jcr.tck.version.versionableNodeType=test:versionable
-javax.jcr.tck.version.propertyValue=aPropertyValue
-
-# testroot for the version package
-# the test root must allow versionable and non-versionable nodes being created below
-javax.jcr.tck.version.testroot=/testroot
-
-# 3 nodes (nodeName1, nodeName2, nodeName3 with nt=versionableNodeType / nt=nonVersionableNodeType will be cloned to 2nd workspace
-# nodename1 > used to persistently create versionable node below testroot
-# nodename2 > used to create second versionable node below testroot (used for restore/workspace.restore with uuid-conflict)
-# nodename3 > used to persistently create non-versionable node below testroot
-javax.jcr.tck.version.nodename1=versionableNodeName1
-javax.jcr.tck.version.nodename2=versionableNodeName2
-javax.jcr.tck.version.nodename3=nonVersionableNodeName1
-
-# nodename 4: versionabel child-node of the first versionable node with nodeName1 and nodetype 'versionableNodeType'
-# used for:
-# + creation of a node in the 2nd workspace, that does not exist in the first workspace
-# + creation of a node in the 2nd workspace, in order to test uuid-conflicts with Workspace.restore.
-# + creation of a sub-node in the default workspace, in order to test uuid-conflicts with Node.restore.
-# + NOTE: the nodetype with 'versionableNodeType' must define its children nodes to either have COPY or VERSION
-# OPV behaviour in order to successfully test Node.restore and Workspace.restore with uuid conflict.
-javax.jcr.tck.version.nodename4=childNodeName
-
-# path to existing String-properties and a new value for the property, that allows to test the indicated OPV behaviour
-javax.jcr.tck.OnParentVersionAbortTest.propertyname1=test:abortOnParentVersionProp
-javax.jcr.tck.OnParentVersionComputeTest.propertyname1=test:computeOnParentVersionProp
-javax.jcr.tck.OnParentVersionCopyTest.propertyname1=test:copyOnParentVersionProp
-javax.jcr.tck.OnParentVersionIgnoreTest.propertyname1=test:ignoreOnParentVersionProp
-javax.jcr.tck.OnParentVersionInitializeTest.propertyname1=test:initializeOnParentVersionProp
-
-# config for nodes that show the indicated OPV behaviour:
-# nodes are added in order to test the versioning behaviour indicated by the test-class name.
-# NOTE:
-# - nodename4 is uses as name for the childnode
-# - nodetype is used as nodetype name for the childnode
-# - the specified child node is created below nodename1 with versionableNodeType
-# the versionableNodeType and/or nodename1 may be overwritten with the individual
-# testclass below.
-javax.jcr.tck.OnParentVersionCopyTest.nodename4=test:copyOnParentVersion
-javax.jcr.tck.OnParentVersionCopyTest.nodetype=nt:unstructured
-javax.jcr.tck.OnParentVersionAbortTest.nodename4=test:abortOnParentVersion
-javax.jcr.tck.OnParentVersionAbortTest.nodetype=nt:unstructured
-
-# repository name
-org.apache.jackrabbit.repository.config=applications/test/repository.xml
-org.apache.jackrabbit.repository.name=repo
-org.apache.jackrabbit.repository.home=applications/test
diff --git a/contrib/orm-persistence/applications/test/workspaces/default/workspace.xml b/contrib/orm-persistence/applications/test/workspaces/default/workspace.xml
deleted file mode 100644
index afc8fa0f64b..00000000000
--- a/contrib/orm-persistence/applications/test/workspaces/default/workspace.xml
+++ /dev/null
@@ -1,31 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/contrib/orm-persistence/checkstyle.xml b/contrib/orm-persistence/checkstyle.xml
deleted file mode 100644
index 9a2d4485e83..00000000000
--- a/contrib/orm-persistence/checkstyle.xml
+++ /dev/null
@@ -1,168 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/contrib/orm-persistence/create_db_hsqldb.sql b/contrib/orm-persistence/create_db_hsqldb.sql
deleted file mode 100644
index 823c0b972aa..00000000000
--- a/contrib/orm-persistence/create_db_hsqldb.sql
+++ /dev/null
@@ -1,20 +0,0 @@
-CREATE TABLE JCR_NODE(UUID VARCHAR(36) NOT NULL,PARENT_UUID VARCHAR(36),DEFINITION_ID VARCHAR(100),NODE_TYPE VARCHAR(100),PRIMARY KEY(UUID))
-CREATE TABLE JCR_PROPERTY(ITEM_ID VARCHAR(200) NOT NULL,NAME VARCHAR(100),VALUE VARCHAR(100),PARENT_UUID VARCHAR(36),PROP_TYPE INTEGER,DEFINITION_ID VARCHAR(100),MULTI_VALUED CHAR(1),PRIMARY KEY (ITEM_ID))
-CREATE TABLE JCR_NODE_MIXIN_TYPE(NODE_UUID VARCHAR(36) NOT NULL,MIXIN_TYPE VARCHAR(100))
-CREATE TABLE JCR_NODE_PARENT(NODE_UUID VARCHAR(36) NOT NULL,PARENT_UUID VARCHAR(36))
-CREATE TABLE JCR_CHILD_NODE(PARENT_UUID VARCHAR(36),UUID VARCHAR(36),NAME VARCHAR(100),NODE_INDEX INTEGER)
-CREATE TABLE JCR_NODE_PROPERTY(PARENT_UUID VARCHAR(36) NOT NULL,NAME VARCHAR(100))
-CREATE TABLE JCR_NODE_REF(NREF_ID IDENTITY,TARGET_UUID VARCHAR(36) NOT NULL,PROP_UUID VARCHAR(36),PROP_NAME VARCHAR(100))
-CREATE TABLE JCR_BLOB(BLOB_ID IDENTITY, PARENT_UUID VARCHAR(36), PROP_NAME VARCHAR(100), VALUE_INDEX INTEGER, BLOB_SIZE INTEGER, BLOB_VALUE LONGVARBINARY)
-CREATE INDEX JCR_NODE_PROPERTY_INDEX1 ON JCR_NODE_PROPERTY(PARENT_UUID, NAME)
-CREATE INDEX JCR_NODE_PROPERTY_INDEX2 ON JCR_NODE_PROPERTY(PARENT_UUID)
-CREATE INDEX JCR_CHILD_NODE_INDEX1 ON JCR_CHILD_NODE (PARENT_UUID, UUID, NAME, NODE_INDEX)
-CREATE INDEX JCR_CHILD_NODE_INDEX2 ON JCR_CHILD_NODE (PARENT_UUID)
-CREATE INDEX JCR_NODE_MIXIN_TYPE_INDEX1 ON JCR_NODE_MIXIN_TYPE (NODE_UUID, MIXIN_TYPE)
-CREATE INDEX JCR_NODE_MIXIN_TYPE_INDEX2 ON JCR_NODE_MIXIN_TYPE (NODE_UUID)
-CREATE INDEX JCR_NODE_PARENT_INDEX1 ON JCR_NODE_PARENT (NODE_UUID, PARENT_UUID)
-CREATE INDEX JCR_NODE_PARENT_INDEX2 ON JCR_NODE_PARENT (NODE_UUID)
-CREATE INDEX JCR_NODE_REF_INDEX1 ON JCR_NODE_REF(TARGET_UUID, PROP_UUID, PROP_NAME)
-CREATE INDEX JCR_NODE_REF_INDEX2 ON JCR_NODE_REF(TARGET_UUID)
-CREATE INDEX JCR_BLOB_INDEX1 ON JCR_BLOB(PARENT_UUID, PROP_NAME, VALUE_INDEX)
-CREATE USER SA PASSWORD "" ADMIN
diff --git a/contrib/orm-persistence/create_db_mysql.sql b/contrib/orm-persistence/create_db_mysql.sql
deleted file mode 100644
index d4f56657f09..00000000000
--- a/contrib/orm-persistence/create_db_mysql.sql
+++ /dev/null
@@ -1,82 +0,0 @@
-DROP DATABASE IF EXISTS jackrabbit ;
-
-CREATE DATABASE jackrabbit ;
-
-USE jackrabbit ;
-
-CREATE TABLE JCR_NODE(
- UUID VARCHAR(36) NOT NULL,
- PARENT_UUID VARCHAR(36),
- DEFINITION_ID VARCHAR(100),
- NODE_TYPE VARCHAR(100),
- PRIMARY KEY (UUID)
-) TYPE=InnoDB;
-
-CREATE TABLE JCR_PROPERTY(
- ITEM_ID VARCHAR(200) NOT NULL,
- NAME VARCHAR(100),
- VALUE VARCHAR(100),
- PARENT_UUID VARCHAR(36),
- PROP_TYPE INTEGER,
- DEFINITION_ID VARCHAR(100),
- MULTI_VALUED CHAR(1),
- PRIMARY KEY (ITEM_ID)
-) TYPE=InnoDB;
-
-CREATE TABLE JCR_NODE_MIXIN_TYPE(
- NODE_UUID VARCHAR(36) NOT NULL,
- MIXIN_TYPE VARCHAR(100)
-) TYPE=InnoDB;
-
-CREATE TABLE JCR_NODE_PARENT(
- NODE_UUID VARCHAR(36) NOT NULL,
- PARENT_UUID VARCHAR(36)
-) TYPE=InnoDB;
-
-CREATE TABLE JCR_CHILD_NODE(
- PARENT_UUID VARCHAR(36) NOT NULL,
- UUID VARCHAR(36),
- NAME VARCHAR(100),
- NODE_INDEX INTEGER
-) TYPE=InnoDB;
-
-CREATE TABLE JCR_NODE_PROPERTY(
- PARENT_UUID VARCHAR(36) NOT NULL,
- NAME VARCHAR(100)
-) TYPE=InnoDB;
-
-CREATE TABLE JCR_NODE_REF(
- NREF_ID INTEGER NOT NULL AUTO_INCREMENT,
- TARGET_UUID VARCHAR(36) NOT NULL,
- PROP_UUID VARCHAR(36),
- PROP_NAME VARCHAR(100),
- PRIMARY KEY (NREF_ID)
-) TYPE=InnoDB;
-
-CREATE TABLE JCR_BLOB(
- BLOB_ID INTEGER NOT NULL AUTO_INCREMENT,
- PARENT_UUID VARCHAR(36),
- PROP_NAME VARCHAR(100),
- VALUE_INDEX INTEGER,
- BLOB_SIZE BIGINT,
- BLOB_VALUE BLOB,
- PRIMARY KEY(BLOB_ID)
-) TYPE=InnoDB;
-
-
-CREATE INDEX JCR_NODE_PROPERTY_INDEX1 ON JCR_NODE_PROPERTY(PARENT_UUID, NAME);
-CREATE INDEX JCR_NODE_PROPERTY_INDEX2 ON JCR_NODE_PROPERTY(PARENT_UUID);
-
-CREATE INDEX JCR_CHILD_NODE_INDEX1 ON JCR_CHILD_NODE (PARENT_UUID, UUID, NAME, NODE_INDEX);
-CREATE INDEX JCR_CHILD_NODE_INDEX2 ON JCR_CHILD_NODE (PARENT_UUID);
-
-CREATE INDEX JCR_NODE_MIXIN_TYPE_INDEX1 ON JCR_NODE_MIXIN_TYPE (NODE_UUID, MIXIN_TYPE);
-CREATE INDEX JCR_NODE_MIXIN_TYPE_INDEX2 ON JCR_NODE_MIXIN_TYPE (NODE_UUID);
-
-CREATE INDEX JCR_NODE_PARENT_INDEX1 ON JCR_NODE_PARENT (NODE_UUID, PARENT_UUID);
-CREATE INDEX JCR_NODE_PARENT_INDEX2 ON JCR_NODE_PARENT (NODE_UUID);
-
-CREATE INDEX JCR_NODE_REF_INDEX1 ON JCR_NODE_REF(TARGET_UUID, PROP_UUID, PROP_NAME);
-CREATE INDEX JCR_NODE_REF_INDEX2 ON JCR_NODE_REF(TARGET_UUID);
-
-CREATE INDEX JCR_BLOB_INDEX1 ON JCR_BLOB(PARENT_UUID, PROP_NAME, VALUE_INDEX);
diff --git a/contrib/orm-persistence/maven.xml b/contrib/orm-persistence/maven.xml
deleted file mode 100644
index 795352ee958..00000000000
--- a/contrib/orm-persistence/maven.xml
+++ /dev/null
@@ -1,92 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/contrib/orm-persistence/project.properties b/contrib/orm-persistence/project.properties
deleted file mode 100644
index a7190113c82..00000000000
--- a/contrib/orm-persistence/project.properties
+++ /dev/null
@@ -1,46 +0,0 @@
-# Copyright 2003-2005 The Apache Software Foundation or its licensors,
-# as applicable
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-
-######################################################################
-# JUnit Testing
-######################################################################
-
-maven.test.failure = false
-maven.junit.fork=true
-maven.test.search.classdir=true
-maven.junit.sysproperties=org.xml.sax.driver
-maven.junit.jvmargs=-Xmx1024M
-org.xml.sax.driver=org.apache.xerces.parsers.SAXParser
-
-######################################################################
-# JavaDoc
-#
-# javadoc urls can be added here, multiple urls are appended using a comma
-#
-# maven.javadoc.links = http://foo/bar/api,\
-# http://flim/flam/api/
-######################################################################
-maven.javadoc.links=http://java.sun.com/j2se/1.4.2/docs/api/,\
- http://incubator.apache.org/jackrabbit/apidocs/,\
- http://www.day.com/maven/jsr170/javadocs/jcr-0.16.1-pfd/
-maven.javadoc.author=false
-maven.javadoc.version=false
-
-######################################################################
-# Checkstyle
-######################################################################
-maven.checkstyle.properties= checkstyle.xml
-maven.linkcheck.enable=false
diff --git a/contrib/orm-persistence/project.xml b/contrib/orm-persistence/project.xml
deleted file mode 100644
index f4627d9184e..00000000000
--- a/contrib/orm-persistence/project.xml
+++ /dev/null
@@ -1,235 +0,0 @@
-
-
-
- 3
- jackrabbit-orm
- jackrabbit
- JackRabbit ORM Persistence Managers
- 0.16.2-dev
-
- The Apache Software Foundation
- http://incubator.apache.org/projects/jackrabbit.html
- http://incubator.apache.org/images/apache-incubator-logo.png
-
- 2004
- org.apache.jackrabbit.*
- /images/jackrabbitlogo.gif
-
- ORM implementation of Jackrabbit persistence managers. This sub-projects of Jackrabbit adds two
- persistence manager implementations that use Object - Relational mapping technology : OJB
- (http://db.apache.org/ojb) and Hibernate (http://www.hibernate.org).
-
- ORM persistence managers for Jackrabbit
-
-
-
- Serge Huber
-
-
-
- Java Developer
-
- +1
-
-
-
-
-
- jackrabbit
- jackrabbit
- 0.16.2-dev
-
-
- concurrent
- 1.3.4
-
-
- commons-collections
- 2.1
-
-
- jdom
- 1.0
-
-
- geronimo-spec
- geronimo-spec-jta
- 1.0-M1
-
-
- jsr170
- jcr
- 0.16.2
- http://www.day.com/maven/jsr170/jars/jcr-0.16.2.jar
-
-
- log4j
- 1.2.8
-
-
- lucene
- lucene
- 1.4.3
-
-
- xerces
- xercesImpl
- 2.6.2
-
-
- xerces
- xmlParserAPIs
- 2.6.2
-
-
- commons-logging
- 1.0
-
-
-
-
- ojb
- db-ojb
- 1.0.1
-
-
- hsqldb
- hsqldb
- 1.7.1
-
-
- commons-lang
- commons-lang
- 2.0
-
-
- commons-pool
- commons-pool
- 1.2
-
-
- commons-dbcp
- 1.2.1
-
-
- mysql
- mysql-connector-java
- 3.0.10-stable-bin
-
-
-
-
- hibernate
- hibernate
- 2.1.7c
-
-
- dom4j
- dom4j
- 1.4
-
-
- ehcache
- ehcache
- 0.9
-
-
- cglib
- cglib-full
- 2.0.2
-
-
- odmg
- odmg
- 3.0
-
-
-
-
- cqfs
- cqfs-jackrabbit
- 3.5.6
- http://www.day.com/maven/cqfs/jars/cqfs-jackrabbit-3.5.6.jar
-
-
- cqfs
- cqfs
- 3.5.6
- http://www.day.com/maven/cqfs/jars/cqfs-3.5.6.jar
-
-
-
-
-
- src/java
- src/test
-
-
- **/*TestAll.class
-
-
-
- applications/test
-
- *.properties
- *.xml
- ojb/*.xml
- ojb/*.dtd
- hibernate/*.xml
- hibernate/*.dtd
-
-
-
-
-
-
-
- applications/test
-
- *.properties
- *.xml
- ojb/*.xml
- ojb/*.dtd
- hibernate/*.xml
- hibernate/*.dtd
-
-
-
-
-
-
- maven-changelog-plugin
- maven-changes-plugin
- maven-checkstyle-plugin
-
-
-
- maven-javadoc-plugin
-
- maven-junit-report-plugin
- maven-jxr-plugin
- maven-license-plugin
-
-
- maven-tasklist-plugin
-
-
-
diff --git a/contrib/orm-persistence/reset_db_mysql.bat b/contrib/orm-persistence/reset_db_mysql.bat
deleted file mode 100644
index 0ad795adb28..00000000000
--- a/contrib/orm-persistence/reset_db_mysql.bat
+++ /dev/null
@@ -1,3 +0,0 @@
-mysqladmin -f -uroot drop jackrabbit
-mysqladmin -uroot create jackrabbit
-mysql -uroot jackrabbit < create_db_mysql.sql
\ No newline at end of file
diff --git a/contrib/orm-persistence/src/java/org/apache/jackrabbit/core/state/orm/ORMBlobValue.java b/contrib/orm-persistence/src/java/org/apache/jackrabbit/core/state/orm/ORMBlobValue.java
deleted file mode 100644
index c797c74feb6..00000000000
--- a/contrib/orm-persistence/src/java/org/apache/jackrabbit/core/state/orm/ORMBlobValue.java
+++ /dev/null
@@ -1,116 +0,0 @@
-/*
- * Copyright 2004-2005 The Apache Software Foundation or its licensors,
- * as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.jackrabbit.core.state.orm;
-
-import java.io.Serializable;
-
-/**
- * BLOB value ORM object
- */
-public class ORMBlobValue
- implements Serializable {
-
- private Integer dbId;
- private String parentUUID;
- private String propertyName;
- private Integer index;
- private Long size;
- private byte[] blobValue;
- public ORMBlobValue() {
- }
-
- public void setDbId(Integer dbId) {
- this.dbId = dbId;
- }
-
- public void setParentUUID(String parentUUID) {
- this.parentUUID = parentUUID;
- }
-
- public void setPropertyName(String propertyName) {
- this.propertyName = propertyName;
- }
-
- public void setIndex(Integer index) {
- this.index = index;
- }
-
- public void setSize(Long size) {
-
- this.size = size;
- }
-
- public void setBlobValue(byte[] blobValue) {
-
- this.blobValue = blobValue;
- }
-
- public Integer getDbId() {
- return dbId;
- }
-
- public String getParentUUID() {
- return parentUUID;
- }
-
- public String getPropertyName() {
- return propertyName;
- }
-
- public Integer getIndex() {
- return index;
- }
-
- public Long getSize() {
-
- return size;
- }
-
- public byte[] getBlobValue() {
-
- return blobValue;
- }
-
- public boolean equals(Object obj) {
- if (!(obj instanceof ORMBlobValue)) {
- return false;
- }
- ORMBlobValue right = (ORMBlobValue) obj;
- if (dbId == null) {
- if (right.getDbId() == null) {
- return true;
- }
- // let's test other values.
- if (parentUUID.equals(right.getParentUUID()) &&
- propertyName.equals(right.getPropertyName()) &&
- index.equals(right.getIndex())) {
- return true;
- }
- return false;
- }
- if (dbId.equals(right.getDbId())) {
- return true;
- } else {
- return false;
- }
- }
-
- public int hashCode() {
- return getDbId().hashCode();
- }
-
-}
diff --git a/contrib/orm-persistence/src/java/org/apache/jackrabbit/core/state/orm/ORMChildNodeEntry.java b/contrib/orm-persistence/src/java/org/apache/jackrabbit/core/state/orm/ORMChildNodeEntry.java
deleted file mode 100644
index 0c9d6d1e73a..00000000000
--- a/contrib/orm-persistence/src/java/org/apache/jackrabbit/core/state/orm/ORMChildNodeEntry.java
+++ /dev/null
@@ -1,118 +0,0 @@
-/*
- * Copyright 2004-2005 The Apache Software Foundation or its licensors,
- * as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.jackrabbit.core.state.orm;
-
-import java.io.Serializable;
-
-import org.apache.jackrabbit.core.state.NodeState.ChildNodeEntry;
-
-/**
- * This class represents a child node entry row in the ORM object graph.
- */
-public class ORMChildNodeEntry
- implements Serializable, Comparable {
- private String uuid;
- private String parentUUID;
- private String name;
- private Integer index;
- private Integer dbId;
- private ORMNodeState parent;
- public ORMChildNodeEntry() {
- }
-
- public ORMChildNodeEntry(ORMNodeState parent, ChildNodeEntry childNodeEntry, String parentUUID) {
- this.parent = parent;
- uuid = childNodeEntry.getUUID();
- this.parentUUID = parentUUID;
- name = childNodeEntry.getName().toString();
- index = new Integer(childNodeEntry.getIndex());
- }
-
- public void setUuid(String uuid) {
- this.uuid = uuid;
- }
-
- public void setParentUUID(String parentUUID) {
- this.parentUUID = parentUUID;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public void setIndex(Integer index) {
- this.index = index;
- }
-
- public void setDbId(Integer dbId) {
- this.dbId = dbId;
- }
-
- public void setParent(ORMNodeState parent) {
- this.parent = parent;
- }
-
- public String getUuid() {
- return uuid;
- }
-
- public String getParentUUID() {
- return parentUUID;
- }
-
- public String getName() {
- return name;
- }
-
- public Integer getIndex() {
- return index;
- }
-
- public Integer getDbId() {
- return dbId;
- }
-
- public ORMNodeState getParent() {
- return parent;
- }
-
- public boolean equals(Object obj) {
- if (!(obj instanceof ORMChildNodeEntry)) {
- return false;
- }
- ORMChildNodeEntry right = (ORMChildNodeEntry) obj;
- if (getUuid().equals(right.getUuid()) &&
- getName().equals(right.getName()) &&
- (getIndex().equals(right.getIndex()))) {
- return true;
- } else {
- return false;
- }
- }
-
- public int compareTo(Object obj) {
- if (equals(obj)) {
- return 0;
- }
- ORMChildNodeEntry right = (ORMChildNodeEntry) obj;
- return (getUuid() + getName() + getIndex()).compareTo(right.getUuid() + right.getName() + right.getIndex());
- }
-
- public int hashCode() {
- return (getUuid() + getName() + getIndex()).hashCode();
- }
-}
diff --git a/contrib/orm-persistence/src/java/org/apache/jackrabbit/core/state/orm/ORMNodeMixinType.java b/contrib/orm-persistence/src/java/org/apache/jackrabbit/core/state/orm/ORMNodeMixinType.java
deleted file mode 100644
index cf0355dbaa4..00000000000
--- a/contrib/orm-persistence/src/java/org/apache/jackrabbit/core/state/orm/ORMNodeMixinType.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * Copyright 2004-2005 The Apache Software Foundation or its licensors,
- * as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.jackrabbit.core.state.orm;
-
-import java.io.Serializable;
-
-/**
- * This class represents a single entry of a mixin type for a node.
- */
-public class ORMNodeMixinType
- implements Serializable {
- private String nodeUUID;
- private String mixinTypeName;
- private Integer dbId;
- private ORMNodeState node;
- public ORMNodeMixinType() {
- }
-
- public ORMNodeMixinType(ORMNodeState node, String nodeUUID, String mixinTypeName) {
- this.node = node;
- this.nodeUUID = nodeUUID;
- this.mixinTypeName = mixinTypeName;
- }
-
- public void setNodeUUID(String nodeUUID) {
- this.nodeUUID = nodeUUID;
- }
-
- public void setMixinTypeName(String mixinTypeName) {
-
- this.mixinTypeName = mixinTypeName;
- }
-
- public void setDbId(Integer dbId) {
- this.dbId = dbId;
- }
-
- public void setNode(ORMNodeState node) {
- this.node = node;
- }
-
- public String getNodeUUID() {
- return nodeUUID;
- }
-
- public String getMixinTypeName() {
-
- return mixinTypeName;
- }
-
- public Integer getDbId() {
- return dbId;
- }
-
- public ORMNodeState getNode() {
- return node;
- }
-
- public boolean equals(Object obj) {
- if (!(obj instanceof ORMChildNodeEntry)) {
- return false;
- }
- ORMNodeMixinType right = (ORMNodeMixinType) obj;
- if (getMixinTypeName().equals(right.getMixinTypeName())) {
- return true;
- } else {
- return false;
- }
- }
-
- public int hashCode() {
- return getMixinTypeName().hashCode();
- }
-
-}
diff --git a/contrib/orm-persistence/src/java/org/apache/jackrabbit/core/state/orm/ORMNodeParent.java b/contrib/orm-persistence/src/java/org/apache/jackrabbit/core/state/orm/ORMNodeParent.java
deleted file mode 100644
index 23e89659450..00000000000
--- a/contrib/orm-persistence/src/java/org/apache/jackrabbit/core/state/orm/ORMNodeParent.java
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- * Copyright 2004-2005 The Apache Software Foundation or its licensors,
- * as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.jackrabbit.core.state.orm;
-
-import java.io.Serializable;
-
-/**
- * This class represents a single entry of a node's parents.
- */
-public class ORMNodeParent
- implements Serializable {
- private String nodeUUID;
- private String parentUUID;
- private Integer dbId;
- private ORMNodeState node;
- public ORMNodeParent() {
- }
-
- public ORMNodeParent(ORMNodeState node, String nodeUUID, String parentUUID) {
- this.node = node;
- this.nodeUUID = nodeUUID;
- this.parentUUID = parentUUID;
- }
-
- public void setNodeUUID(String nodeUUID) {
- this.nodeUUID = nodeUUID;
- }
-
- public void setParentUUID(String parentUUID) {
- this.parentUUID = parentUUID;
- }
-
- public void setDbId(Integer dbId) {
- this.dbId = dbId;
- }
-
- public void setNode(ORMNodeState node) {
- this.node = node;
- }
-
- public String getNodeUUID() {
- return nodeUUID;
- }
-
- public String getParentUUID() {
- return parentUUID;
- }
-
- public Integer getDbId() {
- return dbId;
- }
-
- public ORMNodeState getNode() {
- return node;
- }
-
- public boolean equals(Object obj) {
- if (!(obj instanceof ORMNodeParent)) {
- return false;
- }
- ORMNodeParent right = (ORMNodeParent) obj;
- if (getParentUUID().equals(right.getParentUUID())) {
- return true;
- } else {
- return false;
- }
- }
-
- public int hashCode() {
- return getParentUUID().hashCode();
- }
-}
diff --git a/contrib/orm-persistence/src/java/org/apache/jackrabbit/core/state/orm/ORMNodeReference.java b/contrib/orm-persistence/src/java/org/apache/jackrabbit/core/state/orm/ORMNodeReference.java
deleted file mode 100644
index a4f1dc9f002..00000000000
--- a/contrib/orm-persistence/src/java/org/apache/jackrabbit/core/state/orm/ORMNodeReference.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * Copyright 2004-2005 The Apache Software Foundation or its licensors,
- * as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.jackrabbit.core.state.orm;
-
-import java.io.Serializable;
-
-/**
- * This class represents a node reference, that is to say a property that
- * points to a specific node.
- */
-public class ORMNodeReference
- implements Serializable {
- private String targetId;
- private String propertyParentUUID;
- private String propertyName;
- private Integer dbId;
- public ORMNodeReference() {
- }
-
- public ORMNodeReference(String targetId, String propertyParentUUID, String propertyName) {
- this.targetId = targetId;
- this.propertyParentUUID = propertyParentUUID;
- this.propertyName = propertyName;
- }
-
- public void setTargetId(String targetId) {
- this.targetId = targetId;
- }
-
- public void setPropertyParentUUID(String propertyParentUUID) {
- this.propertyParentUUID = propertyParentUUID;
- }
-
- public void setPropertyName(String propertyName) {
- this.propertyName = propertyName;
- }
-
- public void setDbId(Integer dbId) {
- this.dbId = dbId;
- }
-
- public String getTargetId() {
- return targetId;
- }
-
- public String getPropertyParentUUID() {
- return propertyParentUUID;
- }
-
- public String getPropertyName() {
- return propertyName;
- }
-
- public Integer getDbId() {
- return dbId;
- }
-
- public boolean equals(Object obj) {
- if (!(obj instanceof ORMNodeParent)) {
- return false;
- }
- ORMNodeReference right = (ORMNodeReference) obj;
- if (getTargetId().equals(right.getTargetId()) &&
- getPropertyParentUUID().equals(right.getPropertyParentUUID()) &&
- getPropertyName().equals(right.getPropertyName()) ) {
- return true;
- } else {
- return false;
- }
- }
-
- public int hashCode() {
- return (getTargetId() + getPropertyParentUUID() + getPropertyName()).hashCode();
- }
-}
diff --git a/contrib/orm-persistence/src/java/org/apache/jackrabbit/core/state/orm/ORMNodeState.java b/contrib/orm-persistence/src/java/org/apache/jackrabbit/core/state/orm/ORMNodeState.java
deleted file mode 100644
index 43d58c81a2b..00000000000
--- a/contrib/orm-persistence/src/java/org/apache/jackrabbit/core/state/orm/ORMNodeState.java
+++ /dev/null
@@ -1,197 +0,0 @@
-/*
- * Copyright 2004-2005 The Apache Software Foundation or its licensors,
- * as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.jackrabbit.core.state.orm;
-
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Set;
-
-import org.apache.jackrabbit.core.ItemId;
-import org.apache.jackrabbit.core.QName;
-import org.apache.jackrabbit.core.nodetype.NodeDefId;
-import org.apache.jackrabbit.core.state.NodeState;
-import org.apache.jackrabbit.core.state.NodeState.ChildNodeEntry;
-import org.apache.jackrabbit.core.state.NodeState.PropertyEntry;
-import org.apache.log4j.Logger;
-
-/**
- * This class represents an copy of Jackrabbit's node state, in an ORM
- * compatible format.
- */
-public abstract class ORMNodeState implements Serializable {
-
- private static Logger log = Logger.getLogger(ORMNodeState.class);
-
- protected String uuid;
- protected String parentUUID;
- protected String nodeTypeName;
- protected String definitionId;
-
- public ORMNodeState() {
-
- }
-
- public ORMNodeState(ItemId id) {
- uuid = id.toString();
- }
-
- public ORMNodeState(NodeState state) {
- fromPersistentNodeState(state);
- }
-
- public void fromPersistentNodeState(NodeState state) {
- getChildNodeEntries().clear();
- getPropertyEntries().clear();
- getMixinTypeNames().clear();
- getParentUUIDs().clear();
- uuid = state.getUUID();
- parentUUID = state.getParentUUID();
- if (state.getNodeTypeName() != null) {
- nodeTypeName = state.getNodeTypeName().toString();
- }
- if (state.getDefinitionId() != null) {
- definitionId = state.getDefinitionId().toString();
- }
- Iterator childNodeEntriesIter = state.getChildNodeEntries().iterator();
- while (childNodeEntriesIter.hasNext()) {
- ChildNodeEntry curChildNodeEntry = (ChildNodeEntry) childNodeEntriesIter.next();
- log.debug("childNodeEntry " + curChildNodeEntry.getIndex() + " name=" + curChildNodeEntry.getName() + " uuid=" + curChildNodeEntry.getUUID());
- ORMChildNodeEntry childNode = new ORMChildNodeEntry(this, curChildNodeEntry, uuid);
- getChildNodeEntries().add(childNode);
- }
- Iterator propertyEntryIter = state.getPropertyEntries().iterator();
- while (propertyEntryIter.hasNext()) {
- PropertyEntry curPropertyEntry = (PropertyEntry) propertyEntryIter.next();
- log.debug("propertyEntry " + curPropertyEntry.getName());
- ORMPropertyEntry propertyEntry = new ORMPropertyEntry(this, curPropertyEntry, uuid);
- getPropertyEntries().add(propertyEntry);
- }
- Iterator mixinTypeIter = state.getMixinTypeNames().iterator();
- while (mixinTypeIter.hasNext()) {
- QName curName = (QName) mixinTypeIter.next();
- getMixinTypeNames().add(new ORMNodeMixinType(this, uuid, curName.toString()));
- }
- Iterator parentIter = state.getParentUUIDs().iterator();
- while (parentIter.hasNext()) {
- String parentId = (String) parentIter.next();
- getParentUUIDs().add(new ORMNodeParent(this, uuid, parentId));
- }
- }
-
- public String getUuid() {
- return uuid;
- }
-
- public String getParentUUID() {
- return parentUUID;
- }
-
- public String getNodeTypeName() {
- return nodeTypeName;
- }
-
- public String getDefinitionId() {
-
- return definitionId;
- }
-
- public abstract Collection getChildNodeEntries();
-
- public abstract Collection getPropertyEntries();
-
- public abstract Collection getMixinTypeNames();
-
- public abstract Collection getParentUUIDs();
-
- public void setUuid(String uuid) {
- this.uuid = uuid;
- }
-
- public void setParentUUID(String parentUUID) {
- this.parentUUID = parentUUID;
- }
-
- public void setNodeTypeName(String nodeTypeName) {
- this.nodeTypeName = nodeTypeName;
- }
-
- public void setDefinitionId(String definitionId) {
-
- this.definitionId = definitionId;
- }
-
- public abstract void setChildNodeEntries(Collection childNodeEntries);
-
- public abstract void setPropertyEntries(Collection propertyEntries);
-
- public abstract void setMixinTypeNames(Collection mixinTypeNames);
-
- public abstract void setParentUUIDs(Collection parentUUIDs);
-
- public void toPersistentNodeState(NodeState state) {
- state.setDefinitionId(NodeDefId.valueOf(getDefinitionId()));
- state.setNodeTypeName(QName.valueOf(getNodeTypeName()));
- state.setParentUUID(getParentUUID());
-
- Iterator childNodeEntryIter = getChildNodeEntries().iterator();
- while (childNodeEntryIter.hasNext()) {
- ORMChildNodeEntry curChildNodeEntry = (ORMChildNodeEntry) childNodeEntryIter.next();
- log.debug(" Loaded child node " + QName.valueOf(curChildNodeEntry.getName()) + " uuid=" + curChildNodeEntry.getUuid());
- state.addChildNodeEntry(QName.valueOf(curChildNodeEntry.getName()), curChildNodeEntry.getUuid());
- }
- Iterator propertyEntryIter = getPropertyEntries().iterator();
- while (propertyEntryIter.hasNext()) {
- ORMPropertyEntry curPropertyEntry = (ORMPropertyEntry) propertyEntryIter.next();
- log.debug(" Loaded property " + QName.valueOf(curPropertyEntry.getName()));
- state.addPropertyEntry(QName.valueOf(curPropertyEntry.getName()));
- }
- Iterator mixinTypeNameIter = getMixinTypeNames().iterator();
- Set mixinTypeQNames = new HashSet();
- while (mixinTypeNameIter.hasNext()) {
- ORMNodeMixinType curMixinType = (ORMNodeMixinType) mixinTypeNameIter.next();
- mixinTypeQNames.add(QName.valueOf(curMixinType.getMixinTypeName()));
- }
- state.setMixinTypeNames(mixinTypeQNames);
- Iterator parentUUIDIter = getParentUUIDs().iterator();
- List nParentUUIDs = new ArrayList();
- while (parentUUIDIter.hasNext()) {
- ORMNodeParent curNodeParent = (ORMNodeParent) parentUUIDIter.next();
- nParentUUIDs.add(curNodeParent.getParentUUID());
- }
- state.setParentUUIDs(nParentUUIDs);
- }
-
- public boolean equals(Object obj) {
- if (!(obj instanceof ORMNodeState)) {
- return false;
- }
- ORMNodeState right = (ORMNodeState) obj;
- if (getUuid().equals(right.getUuid())) {
- return true;
- } else {
- return false;
- }
- }
-
- public int hashCode() {
- return getUuid().hashCode();
- }
-}
diff --git a/contrib/orm-persistence/src/java/org/apache/jackrabbit/core/state/orm/ORMPropertyEntry.java b/contrib/orm-persistence/src/java/org/apache/jackrabbit/core/state/orm/ORMPropertyEntry.java
deleted file mode 100644
index 86f26356b6b..00000000000
--- a/contrib/orm-persistence/src/java/org/apache/jackrabbit/core/state/orm/ORMPropertyEntry.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * Copyright 2004-2005 The Apache Software Foundation or its licensors,
- * as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.jackrabbit.core.state.orm;
-
-import java.io.Serializable;
-
-import org.apache.jackrabbit.core.state.NodeState.PropertyEntry;
-
-/**
- * This class represents a single entry of a property in a node. This
- * class only stores the name of the property, the actual property and it's
- * values are stored in the ORMPropertyState class.
- */
-public class ORMPropertyEntry
- implements Serializable {
- private String parentUUID;
- private String name;
- private Integer dbId;
- private ORMNodeState parent;
- public ORMPropertyEntry() {
- }
-
- public ORMPropertyEntry(ORMNodeState parent, PropertyEntry propertyEntry, String parentUUID) {
- this.parent = parent;
- this.parentUUID = parentUUID;
- this.name = propertyEntry.getName().toString();
- }
-
- public void setParentUUID(String parentUUID) {
- this.parentUUID = parentUUID;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public void setDbId(Integer dbId) {
-
- this.dbId = dbId;
- }
-
- public void setParent(ORMNodeState parent) {
- this.parent = parent;
- }
-
- public String getParentUUID() {
- return parentUUID;
- }
-
- public String getName() {
- return name;
- }
-
- public Integer getDbId() {
-
- return dbId;
- }
-
- public ORMNodeState getParent() {
- return parent;
- }
-
- public boolean equals(Object obj) {
- if (!(obj instanceof ORMPropertyEntry)) {
- return false;
- }
- ORMPropertyEntry right = (ORMPropertyEntry) obj;
- if (getName().equals(right.getName())) {
- return true;
- } else {
- return false;
- }
- }
-
- public int hashCode() {
- return (getName()).hashCode();
- }
-
-}
diff --git a/contrib/orm-persistence/src/java/org/apache/jackrabbit/core/state/orm/ORMPropertyState.java b/contrib/orm-persistence/src/java/org/apache/jackrabbit/core/state/orm/ORMPropertyState.java
deleted file mode 100644
index 16bdab6bb10..00000000000
--- a/contrib/orm-persistence/src/java/org/apache/jackrabbit/core/state/orm/ORMPropertyState.java
+++ /dev/null
@@ -1,171 +0,0 @@
-/*
- * Copyright 2004-2005 The Apache Software Foundation or its licensors,
- * as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.jackrabbit.core.state.orm;
-
-import java.io.Serializable;
-
-import org.apache.jackrabbit.core.InternalValue;
-import org.apache.jackrabbit.core.ItemId;
-import org.apache.jackrabbit.core.PropertyId;
-import org.apache.jackrabbit.core.nodetype.PropDefId;
-import org.apache.jackrabbit.core.state.ItemStateException;
-import org.apache.jackrabbit.core.state.PropertyState;
-import org.apache.jackrabbit.core.state.orm.ojb.ValuesToStringFieldConversion;
-import org.apache.ojb.broker.accesslayer.conversions.ConversionException;
-import javax.jcr.PropertyType;
-
-/**
- * This class represents a property state in an ORM-compatible format.
- */
-public class ORMPropertyState implements Serializable {
- private String values;
- private Integer type;
- private String definitionId;
- private Boolean multiValued;
- private String itemId;
- private String name;
- private String parentUUID;
-
- public ORMPropertyState() {
- }
-
- public ORMPropertyState(ItemId id) throws ItemStateException {
- if (id instanceof PropertyId) {
- PropertyId propId = (PropertyId) id;
- this.itemId = propId.toString();
- name = propId.getName().toString();
- parentUUID = propId.getParentUUID();
- } else {
- throw new ItemStateException("PropertyId expected, instead got " + id.getClass());
- }
- }
-
- public ORMPropertyState(PropertyState state) {
- fromPersistentPropertyState(state);
- }
-
- public void fromPersistentPropertyState(PropertyState state) throws
- ConversionException {
- this.itemId = state.getId().toString();
- name = state.getName().toString();
- parentUUID = state.getParentUUID();
- values = (String) new ValuesToStringFieldConversion().javaToSql(state.getValues());
- type = new Integer(state.getType());
- if (state.getDefinitionId() != null) {
- definitionId = state.getDefinitionId().toString();
- }
- multiValued = new Boolean(state.isMultiValued());
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public void setValues(String values) {
- this.values = values;
- }
-
- public void setParentUUID(String parentUUID) {
- this.parentUUID = parentUUID;
- }
-
- public void setType(Integer type) {
- this.type = type;
- }
-
- public void setDefinitionId(String definitionId) {
-
- this.definitionId = definitionId;
- }
-
- public void setMultiValued(Boolean multiValued) {
- this.multiValued = multiValued;
- }
-
- public void setItemId(String itemId) {
-
- this.itemId = itemId;
- }
-
- public String getName() {
- return name;
- }
-
- public String getValues() {
- return values;
- }
-
- public String getParentUUID() {
- return parentUUID;
- }
-
- public Integer getType() {
- return type;
- }
-
- public String getDefinitionId() {
-
- return definitionId;
- }
-
- public Boolean getMultiValued() {
- return multiValued;
- }
-
- public String getItemId() {
-
- return itemId;
- }
-
- public void toPersistentPropertyState(PropertyState state) {
- if (getDefinitionId() != null) {
- state.setDefinitionId(PropDefId.valueOf(getDefinitionId()));
- }
- if (getType() != null) {
- state.setType(getType().intValue());
- }
- if (getType().intValue() != PropertyType.BINARY) {
- ValuesToStringFieldConversion vts = new
- ValuesToStringFieldConversion(getType().intValue());
- InternalValue[] values = (InternalValue[]) vts.sqlToJava(getValues());
- if (values.length > 1) {
- state.setMultiValued(true);
- } else {
- state.setMultiValued(multiValued.booleanValue());
- }
- state.setValues(values);
- } else {
- state.setMultiValued(multiValued.booleanValue());
- }
- }
-
- public boolean equals(Object obj) {
- if (!(obj instanceof ORMPropertyState)) {
- return false;
- }
- ORMPropertyState right = (ORMPropertyState) obj;
- if (itemId.equals(right.getItemId())) {
- return true;
- } else {
- return false;
- }
- }
-
- public int hashCode() {
- return getItemId().hashCode();
- }
-}
diff --git a/contrib/orm-persistence/src/java/org/apache/jackrabbit/core/state/orm/hibernate/HibernateNodeState.java b/contrib/orm-persistence/src/java/org/apache/jackrabbit/core/state/orm/hibernate/HibernateNodeState.java
deleted file mode 100644
index 61f4f47f74d..00000000000
--- a/contrib/orm-persistence/src/java/org/apache/jackrabbit/core/state/orm/hibernate/HibernateNodeState.java
+++ /dev/null
@@ -1,114 +0,0 @@
-/*
- * Copyright 2004-2005 The Apache Software Foundation or its licensors,
- * as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.jackrabbit.core.state.orm.hibernate;
-
-import java.util.Collection;
-import java.util.HashSet;
-import java.util.Set;
-
-import org.apache.jackrabbit.core.ItemId;
-import org.apache.jackrabbit.core.state.NodeState;
-import org.apache.jackrabbit.core.state.orm.ORMNodeState;
-
-/**
- * Hibernate-specific node state class. This is necessary because
- * in this implementation we use a set to represent lists.
- */
-public class HibernateNodeState extends ORMNodeState {
-
- private Set setChildNodeEntries = new HashSet();
- private Set setParentUUIDs = new HashSet();
- private Set setMixinTypeNames = new HashSet();
- private Set setPropertyEntries = new HashSet();
-
- public HibernateNodeState() {
- }
- public HibernateNodeState(ItemId id) {
- super(id);
- }
- public HibernateNodeState(NodeState state) {
- super();
- fromPersistentNodeState(state);
- }
- public Collection getChildNodeEntries() {
- return setChildNodeEntries;
- }
- public void setChildNodeEntries(Collection childNodeEntries) {
- this.setChildNodeEntries.clear();
- this.setChildNodeEntries.addAll(childNodeEntries);
- }
-
- public Collection getPropertyEntries() {
- return setPropertyEntries;
- }
-
- public Collection getMixinTypeNames() {
- return setMixinTypeNames;
- }
-
- public Collection getParentUUIDs() {
- return setParentUUIDs;
- }
-
- public void setPropertyEntries(Collection propertyEntries) {
- this.setPropertyEntries.clear();
- this.setPropertyEntries.addAll(propertyEntries);
- }
-
- public void setMixinTypeNames(Collection mixinTypeNames) {
- this.setMixinTypeNames.clear();
- this.setMixinTypeNames.addAll(mixinTypeNames);
- }
-
- public void setParentUUIDs(Collection parentUUIDs) {
- this.setParentUUIDs.clear();
- this.setParentUUIDs.addAll(parentUUIDs);
- }
-
- public Set getSetChildNodeEntries() {
- return setChildNodeEntries;
- }
-
- public void setSetChildNodeEntries(Set setChildNodeEntries) {
- this.setChildNodeEntries = setChildNodeEntries;
- }
-
- public Set getSetPropertyEntries() {
- return setPropertyEntries;
- }
-
- public void setSetPropertyEntries(Set setPropertyEntries) {
- this.setPropertyEntries = setPropertyEntries;
- }
-
- public Set getSetMixinTypeNames() {
- return setMixinTypeNames;
- }
-
- public void setSetMixinTypeNames(Set setMixinTypeNames) {
- this.setMixinTypeNames = setMixinTypeNames;
- }
-
- public Set getSetParentUUIDs() {
- return setParentUUIDs;
- }
-
- public void setSetParentUUIDs(Set setParentUUIDs) {
- this.setParentUUIDs = setParentUUIDs;
- }
-
-}
diff --git a/contrib/orm-persistence/src/java/org/apache/jackrabbit/core/state/orm/hibernate/HibernatePersistenceManager.java b/contrib/orm-persistence/src/java/org/apache/jackrabbit/core/state/orm/hibernate/HibernatePersistenceManager.java
deleted file mode 100644
index 2cad00aeece..00000000000
--- a/contrib/orm-persistence/src/java/org/apache/jackrabbit/core/state/orm/hibernate/HibernatePersistenceManager.java
+++ /dev/null
@@ -1,703 +0,0 @@
-/*
- * Copyright 2004-2005 The Apache Software Foundation or its licensors,
- * as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.jackrabbit.core.state.orm.hibernate;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-import javax.jcr.PropertyType;
-
-import org.apache.jackrabbit.core.BLOBFileValue;
-import org.apache.jackrabbit.core.InternalValue;
-import org.apache.jackrabbit.core.NodeId;
-import org.apache.jackrabbit.core.PropertyId;
-import org.apache.jackrabbit.core.QName;
-import org.apache.jackrabbit.core.state.AbstractPersistenceManager;
-import org.apache.jackrabbit.core.state.ItemState;
-import org.apache.jackrabbit.core.state.ItemStateException;
-import org.apache.jackrabbit.core.state.NoSuchItemStateException;
-import org.apache.jackrabbit.core.state.NodeReferences;
-import org.apache.jackrabbit.core.state.NodeReferencesId;
-import org.apache.jackrabbit.core.state.NodeState;
-import org.apache.jackrabbit.core.state.PMContext;
-import org.apache.jackrabbit.core.state.PropertyState;
-import org.apache.jackrabbit.core.state.orm.ORMBlobValue;
-import org.apache.jackrabbit.core.state.orm.ORMNodeReference;
-import org.apache.jackrabbit.core.state.orm.ORMPropertyState;
-import org.apache.log4j.Logger;
-import net.sf.hibernate.Hibernate;
-import net.sf.hibernate.HibernateException;
-import net.sf.hibernate.ObjectNotFoundException;
-import net.sf.hibernate.Session;
-import net.sf.hibernate.SessionFactory;
-import net.sf.hibernate.Transaction;
-import net.sf.hibernate.cfg.Configuration;
-import net.sf.hibernate.type.Type;
-
-/**
- * Hibernate implementation of a Jackrabbit persistence manager.
- */
-public class HibernatePersistenceManager extends AbstractPersistenceManager {
-
- private static Logger log = Logger.getLogger(HibernatePersistenceManager.class);
-
- private SessionFactory sessionFactory;
-
- public HibernatePersistenceManager() {
- }
-
- /**
- * @see org.apache.jackrabbit.core.state.PersistenceManager#init
- */
- public void init(PMContext context) throws Exception {
- try {
- // Create the SessionFactory
- sessionFactory = new Configuration().configure().
- buildSessionFactory();
- } catch (Throwable ex) {
- log.error("Initial SessionFactory creation failed.", ex);
- throw new ExceptionInInitializerError(ex);
- }
- }
-
- /**
- * @see org.apache.jackrabbit.core.state.PersistenceManager#close
- */
- public void close() throws Exception {
- }
-
- /**
- * @see org.apache.jackrabbit.core.state.PersistenceManager#load(NodeId)
- */
- public NodeState load(NodeId nodeId) throws NoSuchItemStateException,
- ItemStateException {
- log.debug("Request for " + nodeId.getUUID());
-
- NodeState state = null;
- Session session = null;
- Transaction tx = null;
- try {
- session = sessionFactory.openSession();
- tx = session.beginTransaction();
- List nodeList = session.find(
- "from org.apache.jackrabbit.core.state.orm.hibernate.HibernateNodeState as node WHERE " +
- "node.uuid = ?",
- new Object[] {nodeId.getUUID()},
- new Type[] {Hibernate.STRING});
-
- tx.commit();
- if (nodeList.size() != 1) {
- throw new NoSuchItemStateException("Couldn't find unique node " +
- nodeId.getUUID() + ", found " +
- nodeList.size() +
- " results instead");
- }
- HibernateNodeState result = (HibernateNodeState) nodeList.get(0);
- state = createNew(nodeId);
- result.toPersistentNodeState(state);
- } catch (HibernateException he) {
- try {
- if (tx != null)
- tx.rollback();
- } catch (HibernateException he2) {
- log.error("Error while rolling back transaction", he2);
- }
- throw new ItemStateException("Error loading " + nodeId.getUUID(),
- he);
- } finally {
- if (session != null) {
- try {
- session.close();
- } catch (HibernateException he) {
- throw new ItemStateException(
- "Error while closing hibernate session", he);
- }
- }
- }
- return state;
- }
-
- /**
- * @see org.apache.jackrabbit.core.state.PersistenceManager#load(PropertyId)
- */
- public PropertyState load(PropertyId propId) throws
- NoSuchItemStateException, ItemStateException {
-
- PropertyState state = null;
- Session session = null;
- try {
- session = sessionFactory.openSession();
- Transaction tx = session.beginTransaction();
- ORMPropertyState propState = null;
- try {
-
- List propertyList = session.find(
- "from org.apache.jackrabbit.core.state.orm.ORMPropertyState as prop WHERE " +
- "prop.parentUUID = ? and prop.name = ?",
- new Object[] {propId.getParentUUID(),
- propId.getName().toString()},
- new Type[] {Hibernate.STRING, Hibernate.STRING});
-
- tx.commit();
- if (propertyList.size() != 1) {
- throw new NoSuchItemStateException(
- "Couldn't find unique property " + propId + ", found " +
- propertyList.size() + " results instead");
- }
- propState = (ORMPropertyState) propertyList.get(0);
- state = createNew(propId);
- propState.toPersistentPropertyState(state);
- if (propState.getType().intValue() == PropertyType.BINARY) {
- // we must now load the binary values.
- ArrayList internalValueList = new ArrayList();
- List blobValueList = session.find(
- "from org.apache.jackrabbit.core.state.orm.ORMBlobValue as bv WHERE " +
- "bv.parentUUID = ? and bv.propertyName = ?",
- new Object[] {propId.getParentUUID(),
- propId.getName().toString()},
- new Type[] {Hibernate.STRING, Hibernate.STRING});
-
- Iterator resultIter = blobValueList.iterator();
- while (resultIter.hasNext()) {
- ORMBlobValue ormBlobValue = (ORMBlobValue) resultIter.
- next();
- ByteArrayInputStream in = new ByteArrayInputStream(
- ormBlobValue.getBlobValue());
- try {
- BLOBFileValue blobValue = new BLOBFileValue(in);
- internalValueList.add(blobValue);
- } catch (Throwable t) {
- throw new ItemStateException(
- "Error while trying to load blob value", t);
- }
- }
- state.setValues( (InternalValue[]) internalValueList.
- toArray(new
- InternalValue[internalValueList.
- size()]));
- }
- } catch (ObjectNotFoundException onfe) {
- throw new NoSuchItemStateException("Couldn't find " + propId,
- onfe);
- }
- } catch (HibernateException he) {
- throw new ItemStateException("Error loading " + propId, he);
- } finally {
- if (session != null) {
- try {
- session.close();
- } catch (HibernateException he) {
- throw new ItemStateException(
- "Error while closing hibernate session", he);
- }
- }
- }
- return state;
- }
-
- /**
- * @see org.apache.jackrabbit.core.state.PersistenceManager#load(NodeReferencesId)
- */
- public NodeReferences load(NodeReferencesId targetId) throws
- NoSuchItemStateException, ItemStateException {
- log.debug("Loading node references for targetId=" +
- targetId.toString());
- NodeReferences refs = null;
- Session session = null;
- Transaction tx = null;
- try {
- session = sessionFactory.openSession();
- tx = session.beginTransaction();
- Iterator nodeRefIter = session.iterate("from org.apache.jackrabbit.core.state.orm.ORMNodeReference as nf where nf.targetId='" +
- targetId.toString() +
- "'");
- refs = new NodeReferences(targetId);
- while (nodeRefIter.hasNext()) {
- ORMNodeReference curNodeReference = (ORMNodeReference)
- nodeRefIter.
- next();
- refs.addReference(new PropertyId(curNodeReference.
- getPropertyParentUUID(),
- QName.
- valueOf(curNodeReference.
- getPropertyName())));
- }
- tx.commit();
- } catch (HibernateException he) {
- try {
- if (tx != null)
- tx.rollback();
- } catch (HibernateException he2) {
- log.error("Error while rolling back transaction", he2);
- }
- log.error("Error while loading node reference for targetId=" +
- targetId.toString(), he);
- } finally {
- if (session != null) {
- try {
- session.close();
- } catch (HibernateException he) {
- throw new ItemStateException(
- "Error while closing hibernate session", he);
- }
- }
- }
- return refs;
- }
-
- /**
- * @see org.apache.jackrabbit.core.state.PersistenceManager#exists(NodeId)
- */
- public boolean exists(NodeId id) throws ItemStateException {
- HibernateNodeState result = null;
- Session session = null;
- Transaction tx = null;
- try {
- session = sessionFactory.openSession();
- tx = session.beginTransaction();
- List nodeList = session.find(
- "from org.apache.jackrabbit.core.state.orm.hibernate.HibernateNodeState as node WHERE " +
- "node.uuid = ?",
- new Object[] {id.toString()},
- new Type[] {Hibernate.STRING});
-
- tx.commit();
- if (nodeList.size() < 1) {
- return false;
- } else {
- if (nodeList.size() > 1) {
- log.warn("Node " + id +
- " exists more than once in database !");
- }
- return true;
- }
- } catch (HibernateException he) {
- try {
- if (tx != null)
- tx.rollback();
- } catch (HibernateException he2) {
- log.error("Error while rolling back transaction", he2);
- }
- throw new ItemStateException("Error loading " + id, he);
- } finally {
- if (session != null) {
- try {
- session.close();
- } catch (HibernateException he) {
- throw new ItemStateException(
- "Error while closing hibernate session", he);
- }
- }
- }
- }
-
- /**
- * @see org.apache.jackrabbit.core.state.PersistenceManager#exists(PropertyId)
- */
- public boolean exists(PropertyId id) throws ItemStateException {
- boolean result = false;
- Session session = null;
- Transaction tx = null;
- try {
- session = sessionFactory.openSession();
- tx = session.beginTransaction();
- ORMPropertyState propState = null;
- PropertyId propId = (PropertyId) id;
- List propertyList = session.find(
- "from org.apache.jackrabbit.core.state.orm.ORMPropertyState as prop WHERE " +
- "prop.parentUUID = ? and prop.name = ?",
- new Object[] {propId.getParentUUID(),
- propId.getName().toString()},
- new Type[] {Hibernate.STRING, Hibernate.STRING});
-
- tx.commit();
- if (propertyList.size() < 1) {
- return false;
- } else {
- if (propertyList.size() > 1) {
- log.warn("Property " + id +
- " exists more than once in database !");
- }
- return true;
- }
- } catch (HibernateException he) {
- try {
- if (tx != null)
- tx.rollback();
- } catch (HibernateException he2) {
- log.error("Error while rolling back transaction", he2);
- }
- throw new ItemStateException("Error loading " + id, he);
- } finally {
- if (session != null) {
- try {
- session.close();
- } catch (HibernateException he) {
- throw new ItemStateException(
- "Error while closing hibernate session", he);
- }
- }
- }
- }
-
- /**
- * @see org.apache.jackrabbit.core.state.PersistenceManager#exists(NodeReferencesId)
- */
- public boolean exists(NodeReferencesId targetId) throws ItemStateException {
- boolean result = false;
- Session session = null;
- Transaction tx = null;
- try {
- session = sessionFactory.openSession();
- tx = session.beginTransaction();
- Iterator nodeRefIter = session.iterate("from org.apache.jackrabbit.core.state.orm.ORMNodeReference as nf where nf.targetId='" +
- targetId.toString() +
- "'");
- NodeReferences refs = new NodeReferences(targetId);
- if (nodeRefIter.hasNext()) {
- result = true;
- }
- tx.commit();
- } catch (HibernateException he) {
- try {
- if (tx != null)
- tx.rollback();
- } catch (HibernateException he2) {
- log.error("Error while rolling back transaction", he2);
- }
- throw new ItemStateException(
- "Error while testing reference existence for targetId=" +
- targetId, he);
- } finally {
- if (session != null) {
- try {
- session.close();
- } catch (HibernateException he) {
- throw new ItemStateException(
- "Error while closing hibernate session", he);
- }
- }
- }
- return result;
- }
-
- /**
- * @see org.apache.jackrabbit.core.state.AbstractPersistenceManager#store(NodeState)
- */
- public void store(NodeState state) throws ItemStateException {
- log.debug("Request to store " + state.getId());
- boolean isUpdate = true;
- Session session = null;
- Transaction tx = null;
- try {
- session = sessionFactory.openSession();
- tx = session.beginTransaction();
- HibernateNodeState nodeState = new HibernateNodeState(state);
- if (state.getStatus() == ItemState.STATUS_NEW) {
- session.save(nodeState);
- } else {
- session.update(nodeState);
- }
- tx.commit();
- } catch (HibernateException he) {
- try {
- if (tx != null)
- tx.rollback();
- } catch (HibernateException he2) {
- log.error("Error while rolling back transaction", he2);
- }
- throw new ItemStateException("Error saving " + state.getId(), he);
- } finally {
- if (session != null) {
- try {
- session.close();
- } catch (HibernateException he) {
- throw new ItemStateException(
- "Error while closing hibernate session", he);
- }
- }
- }
- }
-
- /**
- * @see org.apache.jackrabbit.core.state.AbstractPersistenceManager#store(PropertyState)
- */
- public void store(PropertyState state) throws ItemStateException {
- log.debug("Request to store " + state.getId());
- boolean isUpdate = true;
- Session session = null;
- Transaction tx = null;
- try {
- session = sessionFactory.openSession();
- tx = session.beginTransaction();
- ORMPropertyState propState = new ORMPropertyState(state);
-
- InternalValue[] values = state.getValues();
- if (values != null) {
- for (int i = 0; i < values.length; i++) {
-
- // first we delete any existing blob values (this is faster
- // than trying to load and update each value seperately)
- session.delete("from org.apache.jackrabbit.core.state.orm.ORMBlobValue as bv where bv.parentUUID=? AND bv.propertyName=?",
- new Object[] {state.getParentUUID(),
- state.getName().toString()},
- new Type[] {Hibernate.STRING,
- Hibernate.STRING});
-
- InternalValue val = values[i];
- if (val != null) {
- if (state.getType() == PropertyType.BINARY) {
- ORMBlobValue ormBlobValue = null;
- ormBlobValue = new ORMBlobValue();
- ormBlobValue.setParentUUID(state.getParentUUID());
- ormBlobValue.setPropertyName(state.getName().
- toString());
- ormBlobValue.setIndex(new Integer(i));
- BLOBFileValue blobVal = (BLOBFileValue) val.
- internalValue();
- propState.setValues("");
- ByteArrayOutputStream out = new
- ByteArrayOutputStream();
- try {
- blobVal.spool(out);
- } catch (Throwable t) {
- tx.rollback();
- session.close();
- throw new ItemStateException(t.getMessage(), t);
- }
- ormBlobValue.setSize(new Long(blobVal.getLength()));
- ormBlobValue.setBlobValue(out.toByteArray());
- session.save(ormBlobValue);
- }
- }
- }
- }
-
- if (state.getStatus() == ItemState.STATUS_NEW) {
- session.save(propState);
- } else {
- session.update(propState);
- }
- tx.commit();
- } catch (HibernateException he) {
- try {
- if (tx != null)
- tx.rollback();
- } catch (HibernateException he2) {
- log.error("Error while rolling back transaction", he2);
- }
- throw new ItemStateException("Error saving " + state.getId(), he);
- } finally {
- if (session != null) {
- try {
- session.close();
- } catch (HibernateException he) {
- throw new ItemStateException(
- "Error while closing hibernate session", he);
- }
- }
- }
- }
-
- /**
- * @see org.apache.jackrabbit.core.state.AbstractPersistenceManager#store(NodeReferences)
- */
- public void store(NodeReferences refs) throws ItemStateException {
- Iterator nodeRefPropIdIter = refs.getReferences().iterator();
- log.debug("Request to store node references for targetId=" +
- refs.getTargetId());
- Session session = null;
- Transaction tx = null;
- try {
- session = sessionFactory.openSession();
- tx = session.beginTransaction();
- int i = 0;
- while (nodeRefPropIdIter.hasNext()) {
- PropertyId curPropertyId = (PropertyId) nodeRefPropIdIter.next();
- ORMNodeReference curNodeReference = new ORMNodeReference(refs.
- getTargetId().toString(), curPropertyId.getParentUUID(),
- curPropertyId.getName().toString());
- session.save(curNodeReference);
- i++;
- if (i % 20 == 0) {
- session.flush();
- session.clear();
- }
- }
- tx.commit();
- } catch (HibernateException he) {
- try {
- if (tx != null)
- tx.rollback();
- } catch (HibernateException he2) {
- log.error("Error while rolling back transaction", he2);
- }
- throw new ItemStateException(
- "Error storing node references for targetId=" +
- refs.getTargetId(), he);
- } finally {
- if (session != null) {
- try {
- session.close();
- } catch (HibernateException he) {
- throw new ItemStateException(
- "Error while closing hibernate session", he);
- }
- }
- }
- }
-
- /**
- * @see org.apache.jackrabbit.core.state.AbstractPersistenceManager#destroy(NodeState)
- */
- public void destroy(NodeState state) throws ItemStateException {
- log.debug("Deleting node " + state.getUUID());
- Session session = null;
- Transaction tx = null;
- try {
- session = sessionFactory.openSession();
- tx = session.beginTransaction();
- HibernateNodeState nodeState = null;
- try {
- List nodeList = session.find(
- "from org.apache.jackrabbit.core.state.orm.hibernate.HibernateNodeState as node WHERE " +
- "node.uuid = ?",
- new Object[] {state.getId().toString()},
- new Type[] {Hibernate.STRING});
-
- if (nodeList.size() != 1) {
- } else {
- nodeState = (HibernateNodeState) nodeList.get(0);
- session.delete(nodeState);
- }
- } catch (ObjectNotFoundException onfe) {
- }
- tx.commit();
- } catch (HibernateException he) {
- try {
- if (tx != null)
- tx.rollback();
- } catch (HibernateException he2) {
- log.error("Error while rolling back transaction", he2);
- }
- throw new ItemStateException("Error deleting " + state.getId(), he);
- } finally {
- if (session != null) {
- try {
- session.close();
- } catch (HibernateException he) {
- throw new ItemStateException(
- "Error while closing hibernate session", he);
- }
- }
- }
- }
-
- /**
- * @see org.apache.jackrabbit.core.state.AbstractPersistenceManager#destroy(PropertyState)
- */
- public void destroy(PropertyState state) throws ItemStateException {
- log.debug("Deleting property " + state.getId());
- Session session = null;
- Transaction tx = null;
- try {
- session = sessionFactory.openSession();
- tx = session.beginTransaction();
- ORMPropertyState propState = null;
- try {
- List propertyList = session.find(
- "from org.apache.jackrabbit.core.state.orm.ORMPropertyState as prop WHERE " +
- "prop.itemId = ?",
- new Object[] {state.getId().toString()},
- new Type[] {Hibernate.STRING});
-
- if (propertyList.size() != 1) {
- } else {
- propState = (ORMPropertyState) propertyList.get(0);
- session.delete(propState);
- if (state.getType() == PropertyType.BINARY) {
- session.delete("from org.apache.jackrabbit.core.state.orm.ORMBlobValue as bv where bv.parentUUID=? AND bv.propertyName=?",
- new Object[] {state.getParentUUID(),
- state.getName().toString()},
- new Type[] {Hibernate.STRING,
- Hibernate.STRING});
- }
- }
- } catch (ObjectNotFoundException onfe) {
- }
- tx.commit();
- } catch (HibernateException he) {
- try {
- if (tx != null)
- tx.rollback();
- } catch (HibernateException he2) {
- log.error("Error while rolling back transaction", he2);
- }
- throw new ItemStateException("Error deleting " + state.getId(), he);
- } finally {
- if (session != null) {
- try {
- session.close();
- } catch (HibernateException he) {
- throw new ItemStateException(
- "Error while closing hibernate session", he);
- }
- }
- }
- }
-
- /**
- * @see org.apache.jackrabbit.core.state.AbstractPersistenceManager#destroy(NodeReferences)
- */
- public void destroy(NodeReferences refs) throws ItemStateException {
- log.debug("Deleting node refences for targetId=" +
- refs.getTargetId().toString());
- Session session = null;
- Transaction tx = null;
- try {
- session = sessionFactory.openSession();
- tx = session.beginTransaction();
- session.delete("from org.apache.jackrabbit.core.state.orm.ORMNodeReference as nf where nf.targetId='" +
- refs.getTargetId().toString() +
- "'");
- refs.clearAllReferences();
- tx.commit();
- } catch (HibernateException he) {
- try {
- if (tx != null)
- tx.rollback();
- } catch (HibernateException he2) {
- log.error("Error while rolling back transaction", he2);
- }
- throw new ItemStateException(
- "Error deleting node references for targetId=" +
- refs.getTargetId().toString(), he);
- } finally {
- if (session != null) {
- try {
- session.close();
- } catch (HibernateException he) {
- throw new ItemStateException(
- "Error while closing hibernate session", he);
- }
- }
- }
- }
-
-}
diff --git a/contrib/orm-persistence/src/java/org/apache/jackrabbit/core/state/orm/ojb/OJBNodeState.java b/contrib/orm-persistence/src/java/org/apache/jackrabbit/core/state/orm/ojb/OJBNodeState.java
deleted file mode 100644
index 477eb4f053f..00000000000
--- a/contrib/orm-persistence/src/java/org/apache/jackrabbit/core/state/orm/ojb/OJBNodeState.java
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- * Copyright 2004-2005 The Apache Software Foundation or its licensors,
- * as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.jackrabbit.core.state.orm.ojb;
-
-import java.io.Serializable;
-import java.util.Collection;
-import java.util.List;
-
-import org.apache.jackrabbit.core.ItemId;
-import org.apache.jackrabbit.core.state.NodeState;
-import org.apache.jackrabbit.core.state.orm.ORMNodeState;
-import org.apache.ojb.broker.util.collections.RemovalAwareList;
-
-/**
- * OJB specific node state. In order to properly track list
- * modifications, we use an OJB specific list implementation.
- */
-public class OJBNodeState extends ORMNodeState implements Serializable {
-
- private List awareChildNodeEntries = new RemovalAwareList();
- private List awarePropertyEntries = new RemovalAwareList();
- private List awareMixinTypeNames = new RemovalAwareList();
- private List awareParentUUIDs = new RemovalAwareList();
-
- public OJBNodeState() {
- }
- public OJBNodeState(ItemId id) {
- super(id);
- }
- public OJBNodeState(NodeState state) {
- super();
- fromPersistentNodeState(state);
- }
- public Collection getChildNodeEntries() {
- return awareChildNodeEntries;
- }
- public void setChildNodeEntries(Collection childNodeEntries) {
- this.awareChildNodeEntries.clear();
- this.awareChildNodeEntries.addAll(childNodeEntries);
- }
-
- public List getAwareChildNodeEntries() {
- return awareChildNodeEntries;
- }
-
- public void setAwareChildNodeEntries(List awareChildNodeEntries) {
- this.awareChildNodeEntries = awareChildNodeEntries;
- }
-
- public Collection getPropertyEntries() {
- return awarePropertyEntries;
- }
-
- public Collection getMixinTypeNames() {
- return awareMixinTypeNames;
- }
-
- public Collection getParentUUIDs() {
- return awareParentUUIDs;
- }
-
- public void setPropertyEntries(Collection propertyEntries) {
- this.awarePropertyEntries.clear();
- this.awarePropertyEntries.addAll(propertyEntries);
- }
-
- public void setMixinTypeNames(Collection mixinTypeNames) {
- this.awareMixinTypeNames.clear();
- this.awareMixinTypeNames.addAll(mixinTypeNames);
- }
-
- public void setParentUUIDs(Collection parentUUIDs) {
- this.awareParentUUIDs.clear();
- this.awareParentUUIDs.addAll(parentUUIDs);
- }
-
-}
diff --git a/contrib/orm-persistence/src/java/org/apache/jackrabbit/core/state/orm/ojb/OJBPersistenceManager.java b/contrib/orm-persistence/src/java/org/apache/jackrabbit/core/state/orm/ojb/OJBPersistenceManager.java
deleted file mode 100644
index a2014968472..00000000000
--- a/contrib/orm-persistence/src/java/org/apache/jackrabbit/core/state/orm/ojb/OJBPersistenceManager.java
+++ /dev/null
@@ -1,570 +0,0 @@
-/*
- * Copyright 2004-2005 The Apache Software Foundation or its licensors,
- * as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.jackrabbit.core.state.orm.ojb;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.util.ArrayList;
-import java.util.Iterator;
-
-import javax.jcr.PropertyType;
-
-import org.apache.jackrabbit.core.BLOBFileValue;
-import org.apache.jackrabbit.core.InternalValue;
-import org.apache.jackrabbit.core.NodeId;
-import org.apache.jackrabbit.core.PropertyId;
-import org.apache.jackrabbit.core.QName;
-import org.apache.jackrabbit.core.state.ChangeLog;
-import org.apache.jackrabbit.core.state.ItemState;
-import org.apache.jackrabbit.core.state.ItemStateException;
-import org.apache.jackrabbit.core.state.NoSuchItemStateException;
-import org.apache.jackrabbit.core.state.NodeReferences;
-import org.apache.jackrabbit.core.state.NodeReferencesId;
-import org.apache.jackrabbit.core.state.NodeState;
-import org.apache.jackrabbit.core.state.PMContext;
-import org.apache.jackrabbit.core.state.PersistenceManager;
-import org.apache.jackrabbit.core.state.PropertyState;
-import org.apache.jackrabbit.core.state.orm.ORMBlobValue;
-import org.apache.jackrabbit.core.state.orm.ORMNodeReference;
-import org.apache.jackrabbit.core.state.orm.ORMPropertyState;
-import org.apache.log4j.Logger;
-import org.apache.ojb.broker.PersistenceBroker;
-import org.apache.ojb.broker.PersistenceBrokerException;
-import org.apache.ojb.broker.PersistenceBrokerFactory;
-import org.apache.ojb.broker.query.Criteria;
-import org.apache.ojb.broker.query.QueryByCriteria;
-import org.apache.ojb.broker.query.QueryByIdentity;
-
-/**
- * OJB implementation of a Jackrabbit persistence manager.
- */
-public class OJBPersistenceManager implements PersistenceManager
-{
-
- private static Logger log = Logger.getLogger(OJBPersistenceManager.class);
-
- private boolean initialized = false;
-
- public OJBPersistenceManager()
- {
- }
-
- /**
- * @see org.apache.jackrabbit.core.state.PersistenceManager#init
- */
- public void init(PMContext context) throws Exception
- {
- // FIXME: A config param to set the broker name would be handy
- if (initialized)
- {
- throw new IllegalStateException("already initialized");
- }
- initialized = true;
- }
-
- /**
- * @see org.apache.jackrabbit.core.state.PersistenceManager#close
- */
- public void close() throws Exception
- {
- // Nothing to do
- }
-
- /**
- * @see org.apache.jackrabbit.core.state.PersistenceManager#load(NodeId)
- */
- public NodeState load(NodeId nodeId) throws NoSuchItemStateException,
- ItemStateException
- {
- PersistenceBroker broker = PersistenceBrokerFactory
- .defaultPersistenceBroker();
- try
- {
- log.debug("Request for " + nodeId.getUUID());
- OJBNodeState nodeState = new OJBNodeState();
- nodeState.setUuid(nodeId.getUUID());
- QueryByIdentity query = new QueryByIdentity(nodeState);
- OJBNodeState result = (OJBNodeState) broker.getObjectByQuery(query);
- if (result == null)
- {
- throw new NoSuchItemStateException(nodeId.getUUID());
- }
- NodeState state = createNew(nodeId);
- result.toPersistentNodeState(state);
- return state;
- } catch (PersistenceBrokerException e)
- {
- throw new ItemStateException(e);
- } finally
- {
- if (broker != null)
- broker.close();
- }
- }
-
- /**
- * @see org.apache.jackrabbit.core.state.PersistenceManager#load(PropertyId)
- */
- public PropertyState load(PropertyId propId)
- throws NoSuchItemStateException, ItemStateException
- {
- PersistenceBroker broker = PersistenceBrokerFactory
- .defaultPersistenceBroker();
- try
- {
- log.debug("Request for property " + propId);
- ORMPropertyState propState = new ORMPropertyState(propId);
- QueryByIdentity query = new QueryByIdentity(propState);
- PropertyState state = createNew(propId);
- ORMPropertyState result = (ORMPropertyState) broker
- .getObjectByQuery(query);
- if (result == null)
- {
- throw new NoSuchItemStateException("Couldn't find property "
- + propId);
- }
- result.toPersistentPropertyState(state);
- if (result.getType().intValue() == PropertyType.BINARY)
- {
- // we must now load the binary values.
- ArrayList internalValueList = new ArrayList();
- Criteria criteria = new Criteria();
- criteria.addEqualTo("parentUUID", state.getParentUUID());
- criteria.addEqualTo("propertyName", state.getName().toString());
- QueryByCriteria blobQuery = new QueryByCriteria(
- ORMBlobValue.class, criteria);
- Iterator resultIter = broker.getCollectionByQuery(blobQuery)
- .iterator();
- while (resultIter.hasNext())
- {
- ORMBlobValue ormBlobValue = (ORMBlobValue) resultIter
- .next();
- ByteArrayInputStream in = new ByteArrayInputStream(
- ormBlobValue.getBlobValue());
- try
- {
- internalValueList.add(InternalValue.create(in));
- } catch (Throwable t)
- {
- throw new ItemStateException(
- "Error while trying to load blob value", t);
- }
- }
- state.setValues((InternalValue[]) internalValueList
- .toArray(new InternalValue[internalValueList.size()]));
- }
- return state;
- } catch (PersistenceBrokerException e)
- {
- throw new ItemStateException(e);
- } finally
- {
- if (broker != null)
- broker.close();
- }
- }
-
- /**
- * @see org.apache.jackrabbit.core.state.PersistenceManager#load(NodeReferencesId)
- */
- public NodeReferences load(NodeReferencesId targetId)
- throws NoSuchItemStateException, ItemStateException
- {
- PersistenceBroker broker = PersistenceBrokerFactory
- .defaultPersistenceBroker();
- try
- {
- ORMNodeReference nodeRef = new ORMNodeReference();
- nodeRef.setTargetId(targetId.toString());
- QueryByCriteria query = new QueryByCriteria(nodeRef);
- Iterator resultIter = broker.getCollectionByQuery(query).iterator();
- NodeReferences refs = new NodeReferences(targetId);
- while (resultIter.hasNext())
- {
- ORMNodeReference curNodeReference = (ORMNodeReference) resultIter
- .next();
- refs.addReference(new PropertyId(curNodeReference
- .getPropertyParentUUID(), QName
- .valueOf(curNodeReference.getPropertyName())));
- }
- return refs;
- } catch (PersistenceBrokerException e)
- {
- throw new ItemStateException(e);
- } finally
- {
- if (broker != null)
- broker.close();
- }
- }
-
- /**
- * @see org.apache.jackrabbit.core.state.PersistenceManager#exists(NodeId)
- */
- public boolean exists(NodeId id) throws ItemStateException
- {
- PersistenceBroker broker = PersistenceBrokerFactory
- .defaultPersistenceBroker();
- try
- {
- OJBNodeState nodeState = new OJBNodeState(id);
- QueryByIdentity query = new QueryByIdentity(nodeState);
- OJBNodeState result = (OJBNodeState) broker.getObjectByQuery(query);
- if (result == null)
- {
- return false;
- } else
- {
- return true;
- }
- } catch (PersistenceBrokerException e)
- {
- throw new ItemStateException(e);
- } finally
- {
- if (broker != null)
- broker.close();
- }
- }
-
- /**
- * @see org.apache.jackrabbit.core.state.PersistenceManager#exists(PropertyId)
- */
- public boolean exists(PropertyId id) throws ItemStateException
- {
- PersistenceBroker broker = PersistenceBrokerFactory
- .defaultPersistenceBroker();
- try
- {
- ORMPropertyState propState = new ORMPropertyState(id);
- // QueryByCriteria query = new QueryByCriteria(propState);
- QueryByIdentity query = new QueryByIdentity(propState);
- ORMPropertyState result = (ORMPropertyState) broker
- .getObjectByQuery(query);
- if (result == null)
- {
- return false;
- } else
- {
- return true;
- }
- } catch (PersistenceBrokerException e)
- {
- throw new ItemStateException(e);
- } finally
- {
- if (broker != null)
- broker.close();
- }
- }
-
- /**
- * @see org.apache.jackrabbit.core.state.PersistenceManager#exists(NodeReferencesId)
- */
- public boolean exists(NodeReferencesId targetId) throws ItemStateException
- {
- PersistenceBroker broker = PersistenceBrokerFactory
- .defaultPersistenceBroker();
- try
- {
-
- ORMNodeReference nodeRef = new ORMNodeReference();
- nodeRef.setTargetId(targetId.toString());
- QueryByCriteria query = new QueryByCriteria(nodeRef);
- Iterator resultIter = broker.getCollectionByQuery(query).iterator();
- NodeReferences refs = new NodeReferences(targetId);
- if (resultIter.hasNext())
- {
- return true;
- }
- return false;
- } catch (PersistenceBrokerException e)
- {
- throw new ItemStateException(e);
- } finally
- {
- if (broker != null)
- broker.close();
- }
- }
-
- /**
- * @see org.apache.jackrabbit.core.state.AbstractPersistenceManager#store(NodeState)
- */
- private void store(NodeState state, PersistenceBroker broker)
- throws ItemStateException
- {
- log.debug("Request to store node " + state.getId());
- OJBNodeState nodeState = new OJBNodeState(state.getId());
- QueryByIdentity query = new QueryByIdentity(nodeState);
- OJBNodeState result = (OJBNodeState) broker.getObjectByQuery(query);
- if (result == null)
- {
- result = new OJBNodeState();
- }
- result.fromPersistentNodeState(state);
- broker.store(result);
- }
-
- /**
- * @see org.apache.jackrabbit.core.state.AbstractPersistenceManager#store(PropertyState)
- */
- private void store(PropertyState state, PersistenceBroker broker)
- throws ItemStateException
- {
- log.debug("Request to store property " + state.getId());
- ORMPropertyState propState = new ORMPropertyState(state.getId());
- QueryByIdentity query = new QueryByIdentity(propState);
- ORMPropertyState result = (ORMPropertyState) broker
- .getObjectByQuery(query);
- if (result == null)
- {
- result = new ORMPropertyState();
- }
- result.fromPersistentPropertyState(state);
-
- InternalValue[] values = state.getValues();
- if (values != null)
- {
- for (int i = 0; i < values.length; i++)
- {
- InternalValue val = values[i];
- if (val != null)
- {
- if (state.getType() == PropertyType.BINARY)
- {
- Criteria criteria = new Criteria();
- criteria
- .addEqualTo("parentUUID", state.getParentUUID());
- criteria.addEqualTo("propertyName", state.getName()
- .toString());
- criteria.addEqualTo("index", new Integer(i));
- QueryByCriteria blobQuery = new QueryByCriteria(
- ORMBlobValue.class, criteria);
- Iterator resultIter = broker.getCollectionByQuery(
- blobQuery).iterator();
- ORMBlobValue ormBlobValue = null;
- if (resultIter.hasNext())
- {
- ormBlobValue = (ORMBlobValue) resultIter.next();
- } else
- {
- ormBlobValue = new ORMBlobValue();
- ormBlobValue.setParentUUID(state.getParentUUID());
- ormBlobValue.setPropertyName(state.getName()
- .toString());
- ormBlobValue.setIndex(new Integer(i));
- }
- BLOBFileValue blobVal = (BLOBFileValue) val
- .internalValue();
- result.setValues("");
- ByteArrayOutputStream out = new ByteArrayOutputStream();
- try
- {
- blobVal.spool(out);
- } catch (Throwable t)
- {
- // The caller is responsible of aborting the
- // transaction
- // broker.abortTransaction();
- throw new ItemStateException(t.getMessage(), t);
- }
- ormBlobValue.setSize(new Long(blobVal.getLength()));
- ormBlobValue.setBlobValue(out.toByteArray());
- broker.store(ormBlobValue);
- }
- }
- }
- }
- broker.store(result);
- }
-
- /**
- * @see org.apache.jackrabbit.core.state.AbstractPersistenceManager#store(NodeReferences)
- */
- private void store(NodeReferences refs, PersistenceBroker broker)
- throws ItemStateException
- {
- // destroy all the references before saving
- destroy(refs, broker);
-
- Iterator nodeRefPropIdIter = refs.getReferences().iterator();
- while (nodeRefPropIdIter.hasNext())
- {
- PropertyId curPropertyId = (PropertyId) nodeRefPropIdIter.next();
- ORMNodeReference curNodeReference = new ORMNodeReference(refs
- .getTargetId().toString(), curPropertyId.getParentUUID(),
- curPropertyId.getName().toString());
- broker.store(curNodeReference);
- }
- }
-
- /**
- * @see org.apache.jackrabbit.core.state.AbstractPersistenceManager#destroy(NodeState)
- */
- private void destroy(NodeState state, PersistenceBroker broker)
- throws ItemStateException
- {
- log.debug("Deleting node " + state.getId());
-
- // Destroy node
- OJBNodeState nodeState = new OJBNodeState(state.getId());
- QueryByIdentity query = new QueryByIdentity(nodeState);
- OJBNodeState result = (OJBNodeState) broker.getObjectByQuery(query);
- if (result == null)
- {
- result = new OJBNodeState();
- }
- broker.delete(result);
- }
-
- /**
- * @see org.apache.jackrabbit.core.state.AbstractPersistenceManager#destroy(PropertyState)
- */
- private void destroy(PropertyState state, PersistenceBroker broker)
- throws ItemStateException
- {
- ORMPropertyState propState = new ORMPropertyState(state);
- broker.delete(propState);
- if (state.getType() == PropertyType.BINARY)
- {
- Criteria criteria = new Criteria();
- criteria.addEqualTo("parentUUID", state.getParentUUID());
- criteria.addEqualTo("propertyName", state.getName().toString());
- QueryByCriteria blobQuery = new QueryByCriteria(ORMBlobValue.class,
- criteria);
- broker.deleteByQuery(blobQuery);
- }
- }
-
- /**
- * @see org.apache.jackrabbit.core.state.AbstractPersistenceManager#destroy(NodeReferences)
- */
- private void destroy(NodeReferences refs, PersistenceBroker broker)
- throws ItemStateException
- {
- ORMNodeReference nodeRef = new ORMNodeReference();
- nodeRef.setTargetId(refs.getTargetId().toString());
- QueryByCriteria query = new QueryByCriteria(nodeRef);
- Iterator resultIter = broker.getCollectionByQuery(query).iterator();
- while (resultIter.hasNext())
- {
- ORMNodeReference curNodeReference = (ORMNodeReference) resultIter
- .next();
- broker.delete(curNodeReference);
- }
- }
-
- /**
- * @see PersistenceManager#createNew
- */
- public NodeState createNew(NodeId id)
- {
- return new NodeState(id.getUUID(), null, null, NodeState.STATUS_NEW,
- false);
- }
-
- /**
- * @see PersistenceManager#createNew
- */
- public PropertyState createNew(PropertyId id)
- {
- return new PropertyState(id.getName(), id.getParentUUID(),
- PropertyState.STATUS_NEW, false);
- }
-
- /**
- * @see PersistenceManager#store(ChangeLog)
- *
- * This method ensures that changes are either written completely to the
- * underlying persistence layer, or not at all.
- */
- public void store(ChangeLog changeLog) throws ItemStateException
- {
- PersistenceBroker broker = PersistenceBrokerFactory
- .defaultPersistenceBroker();
- try
- {
- broker.beginTransaction() ;
- Iterator iter = changeLog.deletedStates();
- while (iter.hasNext())
- {
- ItemState state = (ItemState) iter.next();
- if (state.isNode())
- {
- destroy((NodeState) state, broker);
- } else
- {
- destroy((PropertyState) state, broker);
- }
- }
- iter = changeLog.addedStates();
- while (iter.hasNext())
- {
- ItemState state = (ItemState) iter.next();
- if (state.isNode())
- {
- store((NodeState) state, broker);
- } else
- {
- store((PropertyState) state, broker);
- }
- }
- iter = changeLog.modifiedStates();
- while (iter.hasNext())
- {
- ItemState state = (ItemState) iter.next();
- if (state.isNode())
- {
- store((NodeState) state, broker);
- } else
- {
- store((PropertyState) state, broker);
- }
- }
- iter = changeLog.modifiedRefs();
- while (iter.hasNext())
- {
- NodeReferences refs = (NodeReferences) iter.next();
- if (refs.hasReferences())
- {
- store(refs, broker);
- } else
- {
- destroy(refs, broker);
- }
- }
- broker.commitTransaction() ;
- } catch (ItemStateException e)
- {
- if (broker != null)
- broker.abortTransaction();
- throw e;
- } catch (PersistenceBrokerException e)
- {
- if (broker != null)
- broker.abortTransaction();
- throw new ItemStateException("Unable to store", e);
- } finally
- {
- if (broker != null)
- broker.close();
- }
-
- }
-
-}
diff --git a/contrib/orm-persistence/src/java/org/apache/jackrabbit/core/state/orm/ojb/ValuesToStringFieldConversion.java b/contrib/orm-persistence/src/java/org/apache/jackrabbit/core/state/orm/ojb/ValuesToStringFieldConversion.java
deleted file mode 100644
index 93594c2e8be..00000000000
--- a/contrib/orm-persistence/src/java/org/apache/jackrabbit/core/state/orm/ojb/ValuesToStringFieldConversion.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * Copyright 2004-2005 The Apache Software Foundation or its licensors,
- * as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.jackrabbit.core.state.orm.ojb;
-
-import java.util.ArrayList;
-import java.util.StringTokenizer;
-
-import org.apache.jackrabbit.core.InternalValue;
-import org.apache.ojb.broker.accesslayer.conversions.ConversionException;
-import org.apache.ojb.broker.accesslayer.conversions.FieldConversion;
-
-/**
- * Helper class to convert multi-valued properties into an encoded
- * string stored in a single database column.
- */
-public class ValuesToStringFieldConversion
- implements FieldConversion {
-
- private int type;
-
- public ValuesToStringFieldConversion() {
- }
-
- public ValuesToStringFieldConversion(int type) {
- this.type = type;
- }
-
- public Object javaToSql(Object object) throws ConversionException {
- InternalValue[] values = (InternalValue[]) object;
- StringBuffer buffer = new StringBuffer();
- for (int i=0; i < values.length; i++) {
- buffer.append(values[i].toString());
- if (i < values.length - 1) {
- buffer.append(",");
- }
- }
- return buffer.toString();
- }
-
- public Object sqlToJava(Object object) throws ConversionException {
- ArrayList valueList = new ArrayList();
- StringTokenizer tokenizer = new StringTokenizer((String) object, ",");
- while (tokenizer.hasMoreTokens()) {
- InternalValue curValue = InternalValue.valueOf(tokenizer.nextToken(), type);
- valueList.add(curValue);
- }
- return (InternalValue[]) valueList.toArray(new InternalValue[valueList.size()]);
- }
-}
diff --git a/contrib/orm-persistence/src/test/org/apache/jackrabbit/test/orm/BlobTest.java b/contrib/orm-persistence/src/test/org/apache/jackrabbit/test/orm/BlobTest.java
deleted file mode 100644
index 05ad50d2931..00000000000
--- a/contrib/orm-persistence/src/test/org/apache/jackrabbit/test/orm/BlobTest.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * Copyright 2004-2005 The Apache Software Foundation or its licensors,
- * as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.jackrabbit.test.orm;
-
-import javax.jcr.Node;
-import javax.jcr.NodeIterator;
-import java.io.InputStream;
-import javax.jcr.StringValue;
-import java.io.ByteArrayInputStream;
-import java.io.BufferedInputStream;
-
-import org.apache.jackrabbit.test.AbstractJCRTest;
-
-/**
- * BLOB insertion/retrieval test case.
- */
-public class BlobTest extends AbstractJCRTest {
-
- private final static int BLOB_SIZE = 1*1024*1024;
- byte[] blobContent = new byte[BLOB_SIZE];
-
- public BlobTest() {
- }
-
- public void testBlob() throws Exception {
- Node rn = superuser.getRootNode();
-
- NodeIterator nodeIter = rn.getNodes();
- while (nodeIter.hasNext()) {
- Node curNode = nodeIter.nextNode();
- }
-
- log.println("Creating BLOB data of " + BLOB_SIZE + " bytes...");
- for (int i=0; i < BLOB_SIZE; i++) {
- blobContent[i] = (byte) (i % 256);
- }
- log.println("Adding BLOB node...");
- if (!rn.hasNode("blobnode")) {
- ByteArrayInputStream inputStream = new ByteArrayInputStream(blobContent);
- Node n = rn.addNode("blobnode", "nt:unstructured");
- n.setProperty("testprop", new StringValue("Hello, World."));
- n.setProperty("blobTest", inputStream);
- superuser.save();
- }
- log.println("Verifying BLOB node...");
- InputStream readInputStream = rn.getProperty("blobnode/blobTest").
- getStream();
- int ch = -1;
- int i=0;
- BufferedInputStream buf = new BufferedInputStream(readInputStream);
- while ((ch = buf.read()) != -1) {
- assertEquals((byte) ch, blobContent[i]);
- i++;
- }
- log.println("Removing BLOB node...");
- rn.getNode("blobnode").remove();
- superuser.save();
- }
-
-}
diff --git a/contrib/orm-persistence/src/test/org/apache/jackrabbit/test/orm/TestAll.java b/contrib/orm-persistence/src/test/org/apache/jackrabbit/test/orm/TestAll.java
deleted file mode 100644
index fc03d699e01..00000000000
--- a/contrib/orm-persistence/src/test/org/apache/jackrabbit/test/orm/TestAll.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Copyright 2004-2005 The Apache Software Foundation or its licensors,
- * as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.jackrabbit.test.orm;
-
-import junit.framework.TestCase;
-import junit.framework.Test;
-import junit.framework.TestSuite;
-
-/**
- * Test suite that includes all testcases for the package
- * javax.jcr
.
- */
-public class TestAll extends TestCase {
-
- /**
- * Returns a Test
suite that executes all tests inside this
- * package.
- *
- * @return a Test
suite that executes all tests inside this
- * package.
- */
- public static Test suite() {
- TestSuite suite = new TestSuite("Jackrabbit ORM persistence tests");
-
- suite.addTestSuite(BlobTest.class);
- suite.addTestSuite(XMLImportSpeedTest.class);
-
- return suite;
- }
-}
diff --git a/contrib/orm-persistence/src/test/org/apache/jackrabbit/test/orm/XMLImportSpeedTest.java b/contrib/orm-persistence/src/test/org/apache/jackrabbit/test/orm/XMLImportSpeedTest.java
deleted file mode 100644
index 0d76713d605..00000000000
--- a/contrib/orm-persistence/src/test/org/apache/jackrabbit/test/orm/XMLImportSpeedTest.java
+++ /dev/null
@@ -1,138 +0,0 @@
-/*
- * Copyright 2004-2005 The Apache Software Foundation or its licensors,
- * as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.jackrabbit.test.orm;
-
-import java.io.FileInputStream;
-import javax.jcr.Node;
-import javax.jcr.NodeIterator;
-import javax.jcr.Property;
-import javax.jcr.PropertyIterator;
-import javax.jcr.PropertyType;
-import javax.jcr.RepositoryException;
-import javax.jcr.Value;
-
-import org.apache.jackrabbit.test.AbstractJCRTest;
-import org.dom4j.Document;
-import org.dom4j.Element;
-import org.dom4j.io.SAXReader;
-
-/**
- * Test suite for XML import speed benchmarking.
- */
-public class XMLImportSpeedTest extends AbstractJCRTest {
-
- private static final int BLOB_NODE_COUNT = 2;
- private static final int XML_IMPORT_NODE_COUNT = 1;
-
- private final String XML_IMPORT_FILENAME = "applications/test/import.xml";
-
- private int totalNodeCount = 0;
- private int totalElementCount = 0;
- private int totalAttributeCount = 0;
-
- public void treeWalk(Document document) {
- treeWalk(document.getRootElement());
- }
-
- public void treeWalk(Element element) {
- totalElementCount++;
- totalAttributeCount += element.attributeCount();
- for (int i = 0, size = element.nodeCount(); i < size; i++) {
- totalNodeCount++;
- org.dom4j.Node node = element.node(i);
- if (node instanceof Element) {
- treeWalk( (Element) node);
- } else {
- // do something....
- }
- }
- }
-
- public void testXMLImportSpeed() throws Exception {
- Node rn = superuser.getRootNode();
-
- if (!rn.hasNode("importxml0")) {
- log.println("importing xml");
-
- SAXReader reader = new SAXReader();
- Document document = reader.read(new FileInputStream(
- XML_IMPORT_FILENAME));
- treeWalk(document);
- log.println("XML file " + XML_IMPORT_FILENAME + " has " +
- totalElementCount + " elements, " + totalNodeCount +
- " nodes and " + totalAttributeCount +
- " attributes");
-
- log.println("Now performing XML import " +
- XML_IMPORT_NODE_COUNT +
- " time(s)...");
- long xmlImportTestStart = System.currentTimeMillis();
- for (int i = 0; i < XML_IMPORT_NODE_COUNT; i++) {
- Node nl = rn.addNode("importxml" + i, "nt:unstructured");
- superuser.importXML("/importxml" + i,
- new FileInputStream(
- XML_IMPORT_FILENAME));
- log.println("Saving...");
- superuser.save();
- }
- long xmlImportTestTime = System.currentTimeMillis() -
- xmlImportTestStart;
- log.println("Imported XML " + XML_IMPORT_NODE_COUNT +
- " time(s) in " +
- xmlImportTestTime + "ms average=" +
- xmlImportTestTime / XML_IMPORT_NODE_COUNT +
- "ms/node");
-
- log.println("Removing imported node(s)...");
- for (int i = 0; i < XML_IMPORT_NODE_COUNT; i++) {
- Node curXMLImportNode = rn.getNode("importxml" + i);
- curXMLImportNode.remove();
- }
- superuser.save();
- } else {
- log.println(
- "XML import has already been run previously, not reimporting on same nodes");
- }
-
- // dump(rn);
-
- }
-
- public void dump(Node n) throws RepositoryException {
- log.println(n.getPath());
- PropertyIterator pit = n.getProperties();
- while (pit.hasNext()) {
- Property p = pit.nextProperty();
- if (!p.getDefinition().isMultiple()) {
- Value curValue = p.getValue();
- if (curValue.getType() == PropertyType.BINARY) {
- log.println(p.getPath() + "=BINARY[" + p.getLength() + "]");
- } else {
- log.println(p.getPath() + "=" + p.getString());
- }
- } else {
- log.println("Multi-value for " + p.getPath());
- }
- }
- NodeIterator nit = n.getNodes();
- while (nit.hasNext()) {
- Node cn = nit.nextNode();
- dump(cn);
- }
- }
-
-}
diff --git a/contrib/tck-webapp/maven.xml b/contrib/tck-webapp/maven.xml
deleted file mode 100644
index b9df7ca37aa..00000000000
--- a/contrib/tck-webapp/maven.xml
+++ /dev/null
@@ -1,54 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/contrib/tck-webapp/project.properties b/contrib/tck-webapp/project.properties
deleted file mode 100644
index 502c15b8254..00000000000
--- a/contrib/tck-webapp/project.properties
+++ /dev/null
@@ -1,5 +0,0 @@
-# ------------------------------------------------------------------------
-maven.repo.remote = http://www.ibiblio.org/maven/,http://www.day.com/maven/
-maven.test.skip = true
-
-
diff --git a/contrib/tck-webapp/project.xml b/contrib/tck-webapp/project.xml
deleted file mode 100644
index d2742df27b9..00000000000
--- a/contrib/tck-webapp/project.xml
+++ /dev/null
@@ -1,166 +0,0 @@
-
-
-
-
-
-
- tck-webapp
-
- Day TCK web application
- 0.1
-
-
-
-
-
-
-
-
-
- concurrent
- 1.3.4
-
- true
-
-
-
- commons-collections
- 2.1
-
- true
-
-
-
- lucene
- lucene
- 1.4.3
-
- true
-
-
-
- xerces
- xercesImpl
- 2.6.2
-
- true
-
-
-
-
-
- jsr170
- jcr
- 0.16.2
- http://www.day.com/maven/jsr170/jars/jcr-0.16.2.jar
-
-
-
- jackrabbit
- 0.16.2-dev
-
- true
-
-
-
-
- cqfs
- cqfs-jackrabbit
- 3.5.6
- http://www.day.com/maven/cqfs/jars/cqfs-jackrabbit-3.5.6.jar
-
- true
-
-
-
-
- cqfs
- 3.5.6
-
- true
-
-
-
- commons-logging
- 1.0
-
- true
-
-
-
-
-
-
- jdom
- 1.0
-
- true
-
-
-
- log4j
- 1.2.8
-
- true
-
-
-
-
-
-
- servletapi
- 2.3
-
-
- junit
- 3.8.1
-
- true
-
-
-
-
-
-
-
-
-
- ${basedir}/src/java
-
-
- fakeClass
-
- **/test/observation/*.java
- **/test/search/*.java
-
-
-
-
-
- src/java
-
- **/api/**/*.java
- **/*.xml
- **/*.xsd
- **/*.properties
- **/*.dtd
-
-
-
-
-
diff --git a/contrib/tck-webapp/src/java/org/apache/jackrabbit/tck/TckHelper.java b/contrib/tck-webapp/src/java/org/apache/jackrabbit/tck/TckHelper.java
deleted file mode 100644
index 33360848a71..00000000000
--- a/contrib/tck-webapp/src/java/org/apache/jackrabbit/tck/TckHelper.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Copyright 2004-2005 The Apache Software Foundation or its licensors,
- * as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.jackrabbit.tck;
-
-/**
- * Just a helper class
- */
-public class TckHelper {
- public static String getStatus(int state) {
- String status = "UNDEFINED";
-
- switch (state) {
- case TestResult.SUCCESS:
- status = "SUCCESS";
- break;
- case TestResult.ERROR:
- status = "ERROR";
- break;
- case TestResult.FAILURE:
- status = "FAILURE";
- }
- return status;
- }
-}
diff --git a/contrib/tck-webapp/src/java/org/apache/jackrabbit/tck/TckTestRunner.java b/contrib/tck-webapp/src/java/org/apache/jackrabbit/tck/TckTestRunner.java
deleted file mode 100644
index 821190eea70..00000000000
--- a/contrib/tck-webapp/src/java/org/apache/jackrabbit/tck/TckTestRunner.java
+++ /dev/null
@@ -1,213 +0,0 @@
-/*
- * Copyright 2004-2005 The Apache Software Foundation or its licensors,
- * as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.jackrabbit.tck;
-
-import junit.framework.Test;
-import junit.runner.BaseTestRunner;
-import javax.servlet.jsp.JspWriter;
-import java.io.IOException;
-import java.io.Writer;
-import java.util.Map;
-import java.util.HashMap;
-import java.text.MessageFormat;
-
-import org.apache.jackrabbit.test.NotExecutableException;
-
-/**
- * The TckTestRunner
class implements the TestListener
interface.
- */
-public class TckTestRunner extends BaseTestRunner {
- /** Test state */
- int state;
-
- /** The test */
- Test test;
-
- /** the writer */
- Writer writer;
-
- /*** contains all results from all tests */
- Map results;
-
- /** test start time */
- long startTime;
-
- /** time that a test took */
- long testTime;
-
- /** Result of a test */
- TestResult result;
-
- /** String containing defined log output */
- private String logString;
-
- /** String containing defined interaction output */
- private String interactionString;
-
- /** current testclass */
- private String currentTestClass;
-
- /** new test identifier string */
- private String newTestString;
-
- /**
- * The constructor inits the result map and sets the writer
- *
- * @param writer
- */
- public TckTestRunner(JspWriter writer) {
- this.writer = writer;
- results = new HashMap();
- currentTestClass = "";
- }
-
- /**
- * This method is called everytime a test is executed.
- * The result object is "reset". the state is "reset" to its default value.
- * The startTime is set.
- *
- * @param test The Test
which will be executed
- */
- public synchronized void startTest(Test test) {
- result = new TestResult();
- state = TestResult.SUCCESS;
- startTime = System.currentTimeMillis();
- }
-
- /**
- * The test could not be started. This should not happen...
- *
- * @param message error message
- */
- protected void runFailed(String message) {
- String msg = "RUN FAILED:" + message;
- write(msg, false);
- }
-
- /**
- * This method is called everytime a test is finished. it does not matter if the
- * test was successful or not. The TestResult
is added to the results list.
- *
- * @param test the current Test
- */
- public synchronized void endTest(Test test) {
- testTime = System.currentTimeMillis() - startTime;
- result.setTest(test);
- result.setTestTime(testTime);
- result.setStatus(state);
- results.put(test.toString(), result);
- if (!currentTestClass.equals(test.getClass().getName())) {
- currentTestClass = test.getClass().getName();
- write(test.toString(), true);
- } else {
- write(test.toString(), false);
- }
- }
-
- /**
- * This method is called when a Test
failed.
- * The "error" code is passed:
- * - an error occured while testing
- * - the test failed
- * And the Throwable
object with the information why the test failed is passed as well.
- *
- * @param status "error" code
- * @param test current Test
- * @param t Throwable
of error/failure
- */
- public void testFailed(int status, Test test, Throwable t) {
- if (t instanceof NotExecutableException) {
- state = TestResult.NOT_EXECUTABLE;
- } else {
- state = status;
- }
- result.setErrorMsg(t.toString());
- }
-
- /**
- * Writes test logging information to output
- *
- * @param msg
- */
- private void write(String msg, boolean newTestClass) {
- if (writer != null) {
- try {
- String html = "";
- if (logString!= null && !"".equals(logString)) {
- html = MessageFormat.format(logString, new String[]{msg, TckHelper.getStatus(state)});
- writer.write(html);
- }
-
- String color;
- switch (state) {
- case TestResult.SUCCESS:
- color = "pass";
- break;
- case TestResult.ERROR:
- case TestResult.FAILURE:
- color = "failure";
- break;
- case TestResult.NOT_EXECUTABLE:
- color = "error";
- break;
- default:
- color = "clear";
- }
-
- if (interactionString!= null && !"".equals(interactionString)) {
- html = MessageFormat.format(interactionString, new String[]{msg, color, String.valueOf(testTime)});
- if (newTestClass) {
- html += newTestString;
- }
- writer.write(html);
- }
- writer.flush();
- } catch (IOException e) {
- // ignore
- }
- } else {
- System.out.println(msg);
- }
- }
-
- /**
- * Returns all results
- * @return all test results
- */
- public Map getResults() {
- return results;
- }
-
- public void setLogString(String logString) {
- this.logString = logString;
- }
-
- public void setInteractionString(String interactionString) {
- this.interactionString = interactionString;
- }
-
- public void setNewTestString(String newTestString) {
- this.newTestString = newTestString;
- }
-
- public void testStarted(String testName) {
- }
-
- public void testEnded(String testName) {
- }
-}
-
diff --git a/contrib/tck-webapp/src/java/org/apache/jackrabbit/tck/TestFinder.java b/contrib/tck-webapp/src/java/org/apache/jackrabbit/tck/TestFinder.java
deleted file mode 100644
index 9239f263d34..00000000000
--- a/contrib/tck-webapp/src/java/org/apache/jackrabbit/tck/TestFinder.java
+++ /dev/null
@@ -1,222 +0,0 @@
-/*
- * Copyright 2004-2005 The Apache Software Foundation or its licensors,
- * as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.jackrabbit.tck;
-
-import junit.framework.TestSuite;
-import junit.framework.Test;
-import java.io.*;
-import java.util.jar.JarEntry;
-import java.util.jar.JarFile;
-import java.util.*;
-
-/**
- * The TestFinder
class is responsible to find all TestCase
s which are
- * in a jar. The information which jar has to be searched is passed in the constructor.
- */
-public class TestFinder {
- /** Jar file to search the test classes */
- private JarFile jarFile;
-
- /** all tests */
- private Map allTests;
-
- /** all test suites */
- private Map suites;
-
- /**
- * The path where the jar containing the test classes and its sources is residing is passed here.
- *
- * @throws IOException
- */
- public TestFinder() throws IOException {
- allTests = new HashMap();
- suites = new HashMap();
- }
-
- /**
- * This method searches all tests.
- *
- * @param exclude file(class) name (e.g. allTests) of tests which should be excluded.
- * @param in InputStream
of jar file containing the test class sources
- * @throws IOException
- * @throws ClassNotFoundException
- */
- public void find(InputStream in, String exclude) throws IOException, ClassNotFoundException {
- File tmpFile = null;
- try {
- // save to a temp file
- tmpFile = File.createTempFile("tck-tests", "jar");
- OutputStream out = null;
- try {
- out = new FileOutputStream(tmpFile);
- byte[] buf = new byte[1024];
- int len;
- while ((len = in.read(buf)) > 0) {
- out.write(buf, 0, len);
- }
- } finally {
- in.close();
- out.close();
- }
-
- jarFile = new JarFile(tmpFile);
-
- // go through all jar file entries and take the one we are interessted in.
- Enumeration enum = jarFile.entries();
-
- while (enum.hasMoreElements()) {
- JarEntry entry = (JarEntry) enum.nextElement();
- String name = entry.getName();
-
- if (!entry.isDirectory() && name.endsWith(".java")) {
- // only source files are from interesst
- String classname = name.replace('/','.').substring(0, name.lastIndexOf(".java"));
-
- Class testclass = Class.forName(classname);
-
- // check if class is really a testsuite
- if (!isTestSuite(testclass)) {
- continue;
- }
-
- // check for files to be excluded
- if (name.endsWith(exclude)) {
- continue;
- }
-
- // retrieve keyword from source file
- String keyword = getKeyword(entry);
-
- // classify testsuite (level1, level2,...)
- if (suites.containsKey(keyword)) {
- TestSuite suite = (TestSuite) suites.get(keyword);
- suite.addTestSuite(testclass);
- } else {
- TestSuite suite = new TestSuite(keyword);
- suite.addTestSuite(testclass);
- suites.put(keyword, suite);
- }
-
- // memorize tests
- allTests.put(classname, keyword);
- }
- }
- } finally {
- if (tmpFile != null) {
- tmpFile.delete();
- }
- }
- }
-
- /**
- * Check if the passed test class is a "real" test suite
- *
- * @param testclass class to check
- * @return true if a test suite
- */
- private boolean isTestSuite(Class testclass) {
- TestSuite ts = new TestSuite(testclass);
- if (ts.countTestCases() > 0) {
- Test t = (Test) ts.tests().nextElement();
- if (t.toString().startsWith("warning")) {
- return false;
- }
- } else {
- return false;
- }
- return true;
- }
-
- /**
- * Reads the keyword from the java source.
- *
- * @param entry JarEntry
to parse
- * @return returns the existing keyword or "unspecified"
- * @throws IOException
- */
- private String getKeyword(JarEntry entry) throws IOException {
- InputStream input = jarFile.getInputStream(entry);
- InputStreamReader isr = new InputStreamReader(input);
- BufferedReader reader = new BufferedReader(isr);
- String line;
- while ((line = reader.readLine()) != null) {
- String keyword = null;
- if ((keyword = parseLine(line)) != null) {
- return keyword;
- }
- }
- reader.close();
- return "unspecified";
- }
-
- /**
- * Parses a line and checks for the "keywords" keyword
- *
- * @param line line to parse
- * @return the kewyword string or null
- */
- private String parseLine(String line) {
- int pos = line.indexOf("keywords");
- int len = "keywords".length();
- String word = "";
-
- if ( pos >= 0) {
- char l[] = line.toCharArray();
- pos += len;
-
- while (pos < l.length) {
- char c = l[pos];
-
- switch (c) {
- case 9: // '\t'
- case 10: // '\n'
- case 12: // '\f'
- case 13: // '\r'
- case 32: // ' '
- if (!"".equals(word)) {
- return word;
- }
- break;
- default:
- word += c;
- }
- pos++;
- }
- }
- return ("".equals(word)) ? null : word;
- }
-
- /**
- * Returns all tests categorized by it's keyword
- * @return all tests
- */
- public Map getTests() {
- return allTests;
- }
-
- /**
- * Returns all built test suites. the suites are categorized:
- * - level1
- * - level 2
- * - optional...
- *
- * @return test suites
- */
- public Map getSuites() {
- return suites;
- }
-}
\ No newline at end of file
diff --git a/contrib/tck-webapp/src/java/org/apache/jackrabbit/tck/TestResult.java b/contrib/tck-webapp/src/java/org/apache/jackrabbit/tck/TestResult.java
deleted file mode 100644
index 9c3153532f8..00000000000
--- a/contrib/tck-webapp/src/java/org/apache/jackrabbit/tck/TestResult.java
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * Copyright 2004-2005 The Apache Software Foundation or its licensors,
- * as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.jackrabbit.tck;
-
-import junit.framework.Test;
-
-/**
- * The TestResult
class is just a helper class to store test results.
- */
-public class TestResult {
-
- /** Test succeeded */
- public static final int SUCCESS = 0;
-
- /** An error occured while testing */
- public static final int ERROR = 1;
-
- /** The test failed */
- public static final int FAILURE = 2;
-
- /** The test cannot be executed */
- public static final int NOT_EXECUTABLE = 4;
-
- /** The test */
- private Test test;
-
- /** Test status */
- private int status;
-
- /** Error message */
- private String errorMsg;
-
- /** Time that consumed while testing */
- private long testTime;
-
- public TestResult() {
- // do nothing
- }
-
- public long getTestTime() {
- return testTime;
- }
-
- public void setTestTime(long testTime) {
- this.testTime = testTime;
- }
-
- public Test getTest() {
- return test;
- }
-
- public void setTest(Test test) {
- this.test = test;
- }
-
- public int getStatus() {
- return status;
- }
-
- public void setStatus(int status) {
- this.status = status;
- }
-
- public String getErrorMsg() {
- return errorMsg;
- }
-
- public void setErrorMsg(String errorMsg) {
- this.errorMsg = errorMsg;
- }
-}
diff --git a/contrib/tck-webapp/src/java/org/apache/jackrabbit/tck/Tester.java b/contrib/tck-webapp/src/java/org/apache/jackrabbit/tck/Tester.java
deleted file mode 100644
index 5646330012d..00000000000
--- a/contrib/tck-webapp/src/java/org/apache/jackrabbit/tck/Tester.java
+++ /dev/null
@@ -1,154 +0,0 @@
-/*
- * Copyright 2004-2005 The Apache Software Foundation or its licensors,
- * as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.jackrabbit.tck;
-
-import junit.framework.TestSuite;
-import junit.framework.TestResult;
-import javax.jcr.*;
-import javax.jcr.nodetype.ConstraintViolationException;
-import javax.servlet.jsp.JspWriter;
-import java.util.*;
-import java.io.IOException;
-import java.text.MessageFormat;
-
-import org.apache.jackrabbit.test.AbstractJCRTest;
-import org.apache.jackrabbit.test.RepositoryHelper;
-
-/**
- * The Tester
starts the all tests and saves all tests.
- */
-public class Tester {
-
- /** Object containing all tests */
- TestFinder tests;
-
- /** all test results are stored here */
- Map results;
-
- /** the test listener */
- TckTestRunner runner;
-
- /** the jsp writer */
- JspWriter writer;
-
- /** The string to be writen after finishing a suite */
- String finishedSuiteString;
-
- /**
- * The constructor...
- *
- * @param tests All tests found using TestFinder
- */
- public Tester(TestFinder tests, TckTestRunner runner, JspWriter writer) {
- this.tests = tests;
- results = new HashMap();
- this.runner = runner;
- this.writer = writer;
-
- // set the configuration for the to be tested repository
- AbstractJCRTest.helper = new RepositoryHelper(WebAppTestConfig.getCurrentConfig());
- }
-
- /**
- * Calling this method starts the testing. All test results will be stored in the
- * results hashmap for further use.
- *
- * @return the result list (map)
- */
- public Map run() {
-
- // get suites (level1, level2, ...)
- Iterator suites = tests.getSuites().keySet().iterator();
-
- while (suites.hasNext()) {
- TestSuite suite = (TestSuite) tests.getSuites().get(suites.next());
-
- TestResult result = new TestResult();
- result.addListener(runner);
- try {
- suite.run(result);
- results.putAll(runner.getResults());
- write(suite);
- } catch (Exception e) {
- // ignore
- }
- }
- return results;
- }
-
-
- public void setfinishedSuiteString(String line) {
- finishedSuiteString = line;
- }
-
- /**
- * Writes a predefined string to the output after finishing a test suite
- */
- private void write(TestSuite suite) throws IOException {
- if (writer != null) {
- writer.write(MessageFormat.format(finishedSuiteString, new String[]{suite.toString(), String.valueOf(suite.testCount())}));
- }
- }
-
- /**
- * This method stores the result underneath the passed node in this structure:
- *
- * node
- * + suite name 1
- * + test 1
- * + test 2
- * ...
- * + suite name 2
- * + test a
- * + test b
- * ...
- * ....
- *
- * @param node parent Node
for storage
- * @throws RepositoryException
- * @throws ConstraintViolationException
- * @throws InvalidItemStateException
- * @throws AccessDeniedException
- */
- public void storeResults(Node node) throws RepositoryException, ConstraintViolationException, InvalidItemStateException, AccessDeniedException {
- // create categories: level1, level2....
- Iterator keyItr = tests.getSuites().keySet().iterator();
- while (keyItr.hasNext()) {
- node.addNode((String) keyItr.next());
- }
-
- // save test results here
- Iterator itr = results.keySet().iterator();
- while (itr.hasNext()) {
- String key = (String) itr.next();
- org.apache.jackrabbit.tck.TestResult tr = (org.apache.jackrabbit.tck.TestResult) results.get(key);
- String className = tr.getTest().getClass().getName();
- String testName = key.substring(0, key.indexOf("("));
- String keyword = (String) tests.getTests().get(className);
- if (keyword != null) {
- Node testResNode = node.addNode(keyword + "/" + key);
- testResNode.setProperty("name", testName);
- testResNode.setProperty("status", tr.getStatus());
- if (tr.getErrorMsg() != null) {
- testResNode.setProperty("errrormsg", tr.getErrorMsg());
- }
- testResNode.setProperty("testtime", tr.getTestTime());
- }
- }
- node.save();
- }
-}
diff --git a/contrib/tck-webapp/src/java/org/apache/jackrabbit/tck/WebAppTestConfig.java b/contrib/tck-webapp/src/java/org/apache/jackrabbit/tck/WebAppTestConfig.java
deleted file mode 100644
index ac6fda65dee..00000000000
--- a/contrib/tck-webapp/src/java/org/apache/jackrabbit/tck/WebAppTestConfig.java
+++ /dev/null
@@ -1,256 +0,0 @@
-/*
- * Copyright 2004-2005 The Apache Software Foundation or its licensors,
- * as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.jackrabbit.tck;
-
-import org.apache.jackrabbit.tck.j2ee.RepositoryServlet;
-import org.apache.jackrabbit.test.JNDIRepositoryStub;
-import org.apache.jackrabbit.test.RepositoryStub;
-
-import javax.jcr.*;
-import javax.servlet.http.HttpServletRequest;
-import java.util.*;
-import java.io.InputStream;
-import java.io.IOException;
-
-import junit.framework.TestSuite;
-import junit.framework.TestCase;
-
-
-/**
- * The WebAppTestConfig
class reads and saves the config in the tck web app specific way.
- */
-public class WebAppTestConfig {
- /** default property names */
- public final static String[] propNames = {JNDIRepositoryStub.PROP_PREFIX + "." + JNDIRepositoryStub.PROP_WORKSPACE_NAME,
- JNDIRepositoryStub.REPOSITORY_LOOKUP_PROP,
- "java.naming.provider.url",
- "java.naming.factory.initial",
- JNDIRepositoryStub.PROP_PREFIX + "." + JNDIRepositoryStub.PROP_SUPERUSER_NAME,
- JNDIRepositoryStub.PROP_PREFIX + "." + JNDIRepositoryStub.PROP_SUPERUSER_PWD,
- JNDIRepositoryStub.PROP_PREFIX + "." + JNDIRepositoryStub.PROP_READWRITE_NAME,
- JNDIRepositoryStub.PROP_PREFIX + "." + JNDIRepositoryStub.PROP_READWRITE_PWD,
- JNDIRepositoryStub.PROP_PREFIX + "." + JNDIRepositoryStub.PROP_READONLY_NAME,
- JNDIRepositoryStub.PROP_PREFIX + "." + JNDIRepositoryStub.PROP_READONLY_PWD,
- JNDIRepositoryStub.PROP_PREFIX + "." + JNDIRepositoryStub.PROP_TESTROOT,
- JNDIRepositoryStub.PROP_PREFIX + "." + JNDIRepositoryStub.PROP_NODE_NAME1,
- JNDIRepositoryStub.PROP_PREFIX + "." + JNDIRepositoryStub.PROP_NODE_NAME2,
- JNDIRepositoryStub.PROP_PREFIX + "." + JNDIRepositoryStub.PROP_NODE_NAME3,
- JNDIRepositoryStub.PROP_PREFIX + "." + JNDIRepositoryStub.PROP_NODE_NAME4,
- JNDIRepositoryStub.PROP_PREFIX + "." + JNDIRepositoryStub.PROP_PROP_NAME1,
- JNDIRepositoryStub.PROP_PREFIX + "." + JNDIRepositoryStub.PROP_PROP_NAME2,
- JNDIRepositoryStub.PROP_PREFIX + "." + JNDIRepositoryStub.PROP_NAMESPACES,
- JNDIRepositoryStub.PROP_PREFIX + "." + JNDIRepositoryStub.PROP_NODETYPE};
-
- /**
- * Reads the config entries from the repository
- *
- * @return test config
- */
- public static Map getConfig() {
- Map config = new HashMap();
- try {
- Session repSession = RepositoryServlet.getSession();
- Node configNode = repSession.getRootNode().getNode("testconfig");
- PropertyIterator pitr = configNode.getProperties();
-
- while (pitr.hasNext()) {
- Property p = pitr.nextProperty();
- config.put(p.getName(), p.getString());
- }
- } catch (RepositoryException e) {
- return new HashMap();
- }
- return config;
- }
-
- /**
- * Reads the original config from the property file.
- *
- * @return original read only config
- */
- public static Map getOriConfig() {
- Properties props = new Properties();
- InputStream is = WebAppTestConfig.class.getClassLoader().getResourceAsStream(JNDIRepositoryStub.STUB_IMPL_PROPS);
- if (is != null) {
- try {
- props.load(is);
- } catch (IOException e) {
- // ignore
- }
- }
-
- // add additional props
- props.put(JNDIRepositoryStub.REPOSITORY_LOOKUP_PROP, "");
- props.put("java.naming.provider.url", "");
- props.put("java.naming.factory.initial", "");
-
- return props;
- }
-
- /**
- * Saves the configuration entries which needs to be set.
- *
- * @param request request with config changes
- * @param repSession Session
used to write config
- * @throws RepositoryException
- */
- public static void save(HttpServletRequest request, Session repSession) throws RepositoryException {
- // create config node if not yet existing
- Node testConfig;
- if (repSession.getRootNode().hasNode("testconfig")) {
- testConfig = repSession.getRootNode().getNode("testconfig");
- } else {
- testConfig = repSession.getRootNode().addNode("testconfig", "nt:unstructured");
- repSession.getRootNode().save();
- }
-
- // save config entries
- Iterator allPropNames = getCurrentConfig().keySet().iterator();
-
- while (allPropNames.hasNext()) {
- String pName = (String) allPropNames.next();
- setEntry(pName, request, testConfig);
- }
-
- // save
- testConfig.save();
- }
-
- /**
- * This method saves a single property
- *
- * @param propName property name
- * @param propValue property value
- * @param repSession session
- * @throws RepositoryException
- */
- public static void saveProperty(String propName, String propValue, Session repSession) throws RepositoryException {
- // create config node if not yet existing
- Node testConfig;
- if (repSession.getRootNode().hasNode("testconfig")) {
- testConfig = repSession.getRootNode().getNode("testconfig");
- } else {
- testConfig = repSession.getRootNode().addNode("testconfig", "nt:unstructured");
- repSession.getRootNode().save();
- }
-
- testConfig.setProperty(propName, propValue);
-
- // save
- testConfig.save();
- }
-
- /**
- * Set config entry
- *
- * @param propname config property name
- * @param request request to read property value
- * @param testConfig test config Node
- * @throws RepositoryException
- */
- private static void setEntry(String propname, HttpServletRequest request, Node testConfig) throws RepositoryException {
- if (request.getParameter(propname) != null) {
- testConfig.setProperty(propname, request.getParameter(propname));
- }
- }
-
- /**
- * Returns all test case specific configuration entries
- *
- * @param suite test suite
- * @return all test case specific conf entries
- */
- public static Map getTestCaseSpecificConfigs(TestSuite suite) {
- Map currentConfig = getCurrentConfig();
- Map configs = new HashMap();
-
- // check for "package" defined props
- String pname = suite.getName();
- if ("versioning".equals(pname)) {
- pname = "version";
- }
- configs.putAll(getProperties(pname, currentConfig));
-
- Enumeration allTestClasses = suite.tests();
-
- while (allTestClasses.hasMoreElements()) {
- TestSuite aTest = (TestSuite) allTestClasses.nextElement();
- String name = aTest.getName();
- name = name.substring(name.lastIndexOf(".") + 1);
-
- // check for class defined props
- configs.putAll(getProperties(name, currentConfig));
-
- // goto methods
- Enumeration testMethods = aTest.tests();
-
- while (testMethods.hasMoreElements()) {
- TestCase tc = (TestCase) testMethods.nextElement();
- String methodname = tc.getName();
- String fullName = name + "." + methodname;
- configs.putAll(getProperties(fullName, currentConfig));
- }
- }
- return configs;
- }
-
- /**
- * Returns the current configuration
- * @return
- */
- public static Map getCurrentConfig() {
- Map conf = getOriConfig();
- conf.putAll(getConfig());
- return conf;
- }
-
- /**
- * Returns all properties which property name starts with "javax.jcr.tck." + name
- *
- * @param name property name "extension"
- * @param config configuration
- * @return all properties which apply the above mentioned rule
- */
- private static Map getProperties(String name, Map config) {
- Map props = new HashMap();
-
- String pname = RepositoryStub.PROP_PREFIX + "." + name;
-
- Iterator itr = config.keySet().iterator();
-
- while (itr.hasNext()) {
- String key = (String) itr.next();
- if (key.startsWith(pname)) {
- props.put(key, config.get(key));
- }
- }
- return props;
- }
-
- /**
- * Removes the custom config entries
- *
- * @throws RepositoryException
- */
- public static void resetConfiguration() throws RepositoryException {
- Session repSession = RepositoryServlet.getSession();
- if (repSession.getRootNode().hasNode("testconfig")) {
- repSession.getRootNode().getNode("testconfig").remove();
- }
- repSession.getRootNode().save();
- }
-}
diff --git a/contrib/tck-webapp/src/java/org/apache/jackrabbit/tck/j2ee/RepositoryServlet.java b/contrib/tck-webapp/src/java/org/apache/jackrabbit/tck/j2ee/RepositoryServlet.java
deleted file mode 100644
index 841e8de4eba..00000000000
--- a/contrib/tck-webapp/src/java/org/apache/jackrabbit/tck/j2ee/RepositoryServlet.java
+++ /dev/null
@@ -1,221 +0,0 @@
-/*
- * Copyright 2004-2005 The Apache Software Foundation or its licensors,
- * as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.jackrabbit.tck.j2ee;
-
-import org.apache.log4j.PropertyConfigurator;
-import org.apache.log4j.Logger;
-import org.apache.jackrabbit.core.config.RepositoryConfig;
-import org.apache.jackrabbit.core.RepositoryImpl;
-import org.xml.sax.InputSource;
-
-import javax.servlet.http.HttpServlet;
-import javax.servlet.ServletException;
-import javax.jcr.*;
-import java.io.*;
-import java.util.Properties;
-import javax.servlet.http.HttpServletRequest;
-
-/**
- * The RepositoryServlet connects (starts) to a jsr170 repository and
- * puts the reference into the application context
- */
-public class RepositoryServlet extends HttpServlet {
-
- /** the logger */
- private static Logger log;// = Logger.getLogger(RepositoryServlet.class);
-
- /** repository configuration path */
- public final static String INIT_PARAM_REPOSITORY_CONFIG = "repository-config";
-
- /** repository home */
- public final static String INIT_PARAM_REPOSITORY_HOME = "repository-home";
-
- /** repository name */
- public final static String INIT_PARAM_REPOSITORY_NAME = "repository-name";
-
- /** jaas configuration file path */
- public static final String JAAS_CONFIG_FILE = "jaas-config-file";
-
- /** user id name */
- public static final String USER_ID = "jcr-userid";
-
- /** user password name */
- public static final String USER_PASSWORD = "jcr-password";
-
- /** log4j config */
- public final static String PARAM_LOG4J_CONFIG = "log4j-config";
-
- /** the repository to read/write test results and config */
- private static RepositoryImpl repository;
-
- /** the user id */
- private static String uid;
-
- /** the password */
- private static String pw;
-
- /**
- * The init method starts the repository to read/write test results and configuration,
- * sets the jaas config and the user id and the user password
- *
- * @throws ServletException
- */
- public void init() throws ServletException {
- super.init();
-
- try {
- // setup log4j
- // todo: do correctly
- String log4jConfig = getServletConfig().getInitParameter(PARAM_LOG4J_CONFIG);
- InputStream in = getServletContext().getResourceAsStream(log4jConfig);
- if (in == null) {
- // try normal init
- PropertyConfigurator.configure(log4jConfig);
- } else {
- try {
- Properties log4jProperties = new Properties();
- log4jProperties.load(in);
- in.close();
- PropertyConfigurator.configure(log4jProperties);
- } catch (IOException e) {
- throw new ServletException("Unable to load log4jProperties: " + e.toString());
- }
- }
- log_info("RepositoryServlet initializing..");
-
- // setup home directory
- String repHome = getServletConfig().getInitParameter(INIT_PARAM_REPOSITORY_HOME);
- if (repHome == null) {
- log_info(INIT_PARAM_REPOSITORY_HOME + " missing.");
- throw new ServletException(INIT_PARAM_REPOSITORY_HOME + " missing.");
- }
- File repositoryHome;
- try {
- repositoryHome = new File(repHome).getCanonicalFile();
- } catch (IOException e) {
- log_info(INIT_PARAM_REPOSITORY_HOME + " invalid." + e.toString());
- throw new ServletException(INIT_PARAM_REPOSITORY_HOME + " invalid." + e.toString());
- }
- log_info(" repository-home = " + repositoryHome.getPath());
-
- // setup repository
- String repConfig = getServletConfig().getInitParameter(INIT_PARAM_REPOSITORY_CONFIG);
- if (repConfig == null) {
- log_info(INIT_PARAM_REPOSITORY_CONFIG + " missing.");
- throw new ServletException(INIT_PARAM_REPOSITORY_CONFIG + " missing.");
- }
- log_info(" repository-config = " + repConfig);
-
- in = getServletContext().getResourceAsStream(repConfig);
- if (in == null) {
- try {
- in = new FileInputStream(new File(repositoryHome, repConfig));
- } catch (FileNotFoundException e) {
- log_info(INIT_PARAM_REPOSITORY_CONFIG + " invalid." + e.toString());
- throw new ServletException(INIT_PARAM_REPOSITORY_CONFIG + " invalid." + e.toString());
- }
- }
-
- // get repository name
- String repositoryName = getServletConfig().getInitParameter(INIT_PARAM_REPOSITORY_NAME);
- if (repositoryName == null) {
- repositoryName = "default";
- }
- log_info(" repository-name = " + repositoryName);
-
- InputSource is = new InputSource(in);
- RepositoryConfig config = RepositoryConfig.create(is, repositoryHome.getPath());
- repository = RepositoryImpl.create(config);
-
- log_info("JSR170 RI Repository initialized.");
-
- // set jaas config file path
- String jaasConfigFile = getServletConfig().getInitParameter(JAAS_CONFIG_FILE);
- if (jaasConfigFile != null && !"".equals(jaasConfigFile)) {
- System.setProperty("java.security.auth.login.config", jaasConfigFile);
- log_info("JAAS config path set by the tck webapp. java.security.auth.login.config = " + jaasConfigFile);
- } else {
- log_info("No JAAS config path set by the tck webapp.");
- }
-
-
- // set user id and password to read/write test results and configuration
- uid = getServletConfig().getInitParameter(USER_ID);
- pw = getServletConfig().getInitParameter(USER_PASSWORD);
-
- } catch (RepositoryException e) {
- log_info("Unable to initialize repository: " + e.toString(), e);
- throw new ServletException("Unable to initialize repository: " + e.toString(), e);
- }
-
- }
-
- public void destroy() {
- super.destroy();
- log_info("RepositoryServlet shutting down...");
- }
-
- private void log_info(String msg) {
- if (log != null) {
- log.info(msg);
- } else {
- log(msg);
- }
- }
-
- private void log_info(String msg, Throwable t) {
- if (log != null) {
- log.info(msg, t);
- } else {
- log(msg, t);
- }
- }
- /**
- * Returns the JSR170 repository
- * @return a jsr170 repository
- */
- public static Repository getRepository() {
- return repository;
- }
-
- /**
- * Returns the jcr session
- *
- * @return
- */
- public static Session getSession() {
- try {
- return login();
- } catch (RepositoryException e) {
- log.error("Unable to retrieve session: " + e.toString());
- }
- return null;
- }
-
- /**
- * Logs in to the repository. The user to login is specified in the servlet config.
- * @throws RepositoryException
- */
- public static Session login()
- throws RepositoryException {
-
- // login
- Session repSession = repository.login(new SimpleCredentials(uid, pw.toCharArray()), null);
- return repSession;
- }
-
-}
diff --git a/contrib/tck-webapp/src/webapp/WEB-INF/classes/repositoryStubImpl.properties b/contrib/tck-webapp/src/webapp/WEB-INF/classes/repositoryStubImpl.properties
deleted file mode 100644
index 4887807befb..00000000000
--- a/contrib/tck-webapp/src/webapp/WEB-INF/classes/repositoryStubImpl.properties
+++ /dev/null
@@ -1,323 +0,0 @@
-#
-# This is the configuration file for the jackrabbit repository test stub.
-#
-
-# Stub implementation class
-javax.jcr.tck.repository_stub_impl=org.apache.jackrabbit.test.JNDIRepositoryStub
-
-# repository specific configuration
-org.apache.jackrabbit.repository.config=applications/test/repository.xml
-org.apache.jackrabbit.repository.name=repo
-org.apache.jackrabbit.repository.home=applications/test
-org.apache.jackrabbit.repository.jaas.config=applications/test/jaas.config
-
-# credential configuration
-javax.jcr.tck.superuser.name=superuser
-javax.jcr.tck.superuser.pwd=
-javax.jcr.tck.readwrite.name=user
-javax.jcr.tck.readwrite.pwd=
-javax.jcr.tck.readonly.name=anonymous
-javax.jcr.tck.readonly.pwd=
-
-# global test configuration
-javax.jcr.tck.testroot=/testroot
-javax.jcr.tck.nodetype=nt:unstructured
-javax.jcr.tck.nodename1=node1
-javax.jcr.tck.nodename2=node2
-javax.jcr.tck.nodename3=node3
-javax.jcr.tck.nodename4=node4
-javax.jcr.tck.propertyname1=prop1
-javax.jcr.tck.propertyname2=prop2
-javax.jcr.tck.workspacename=test
-
-# namespace configuration
-javax.jcr.tck.namespaces=test
-javax.jcr.tck.namespaces.test=http://www.apache.org/jackrabbit/test
-
-# sample for per test case config overriding
-# Test class: AddNodeText
-# Test method: testName
-javax.jcr.tck.AddNodeTest.testName.nodename1=myname
-
-# ==============================================================================
-# JAVAX.JCR CONFIGURATION
-# ==============================================================================
-
-# Test class: ItemDefTest
-javax.jcr.tck.ItemDefTest.testroot=/testdata
-
-# Test class: ItemReadMethodsTest
-javax.jcr.tck.ItemReadMethodsTest.testroot=/testdata
-
-# Test class: NodeReadMethodsTest
-javax.jcr.tck.NodeReadMethodsTest.testroot=/testdata
-
-# Test class: PropertyTypeTest
-javax.jcr.tck.PropertyTypeTest.testroot=/testdata
-
-# Test class: BinaryPropertyTest
-javax.jcr.tck.BinaryPropertyTest.testroot=/testdata
-
-# Test class: BooleanPropertyTest
-javax.jcr.tck.BooleanPropertyTest.testroot=/testdata
-
-# Test class: DatePropertyTest
-javax.jcr.tck.DatePropertyTest.testroot=/testdata
-
-# Test class: DoublePropertyTest
-javax.jcr.tck.DoublePropertyTest.testroot=/testdata
-
-# Test class: LongPropertyTest
-javax.jcr.tck.LongPropertyTest.testroot=/testdata
-
-# Test class: NamePropertyTest
-javax.jcr.tck.NamePropertyTest.testroot=/testdata
-
-# Test class: PathPropertyTest
-javax.jcr.tck.PathPropertyTest.testroot=/testdata
-
-# Test class: ReferencePropertyTest
-javax.jcr.tck.ReferencePropertyTest.testroot=/testdata
-
-# Test class: StringPropertyTest
-javax.jcr.tck.StringPropertyTest.testroot=/testdata
-
-# Test class: UndefinedPropertyTest
-javax.jcr.tck.UndefinedPropertyTest.testroot=/testdata
-
-# Test class: PropertyReadMethodsTest
-javax.jcr.tck.PropertyReadMethodsTest.testroot=/testdata
-
-# Test class: NodeIteratorTest
-javax.jcr.tck.NodeIteratorTest.testroot=/testdata
-
-# Test class: NodeDiscoveringNodeTypesTest
-javax.jcr.tck.NodeDiscoveringNodeTypesTest.testroot=/testdata
-
-# Test class: RepositoryDescriptorTest
-javax.jcr.tck.RepositoryDescriptorTest.testroot=/testdata
-
-# Test class: WorkspaceReadMethodsTest
-javax.jcr.tck.WorkspaceReadMethodsTest.testroot=/testdata
-
-# Test class: SessionReadMethodsTest
-javax.jcr.tck.SessionReadMethodsTest.testroot=/testdata
-
-# Test class: NamespaceRegistryReadMethodsTest
-javax.jcr.tck.NamespaceRegistryReadMethodsTest.testroot=/testdata
-
-# Test class: NamespaceRemappingTest
-javax.jcr.tck.NamespaceRemappingTest.testroot=/testdata
-
-# Test class: SessionTest
-# Test method: testMoveItemExistsException
-# nodetype that does not allow same name siblings
-javax.jcr.tck.SessionTest.testMoveItemExistsException.nodetype2=nt:folder
-# valid node type that can be added as child of nodetype2
-javax.jcr.tck.SessionTest.testMoveItemExistsException.nodetype3=nt:hierarchyNode
-
-# Test class: SessionTest
-# Test method: testSaveContstraintViolationException
-# nodetype that has a property that is mandatory but not autocreated
-javax.jcr.tck.SessionTest.testSaveContstraintViolationException.nodetype2=nt:file
-
-# Test class: SessionUUIDTest
-# node type that has a property of type PropertyType.REFERENCE
-javax.jcr.tck.SessionUUIDTest.nodetype=nt:unstructured
-# name of the property that is of type PropertyType.REFERENCE
-javax.jcr.tck.SessionUUIDTest.propertyname1=foobar
-# nodetype that has nodetype mix:referenceable assigned
-javax.jcr.tck.SessionUUIDTest.nodetype2=test:refTargetNode
-
-# Test class: SessionUUIDTest
-# Test method: testSaveMovedRefNode
-# name of the property that can be modified
-javax.jcr.tck.SessionUUIDTest.testSaveMovedRefNode.propertyname1=foobar
-
-# Test class: NodeTest
-# Test method: testAddNodeItemExistsException
-# nodetype that does not allow same name siblings and allows child nodes of
-# the same type
-javax.jcr.tck.NodeTest.testAddNodeItemExistsException.nodetype=nt:folder
-
-# Test class: NodeTest
-# Test method: testRemoveMandatoryNode
-# nodetype that has a mandatory child node definition
-javax.jcr.tck.NodeTest.testRemoveMandatoryNode.nodetype2=nt:file
-# nodetype of the mandatory child
-javax.jcr.tck.NodeTest.testRemoveMandatoryNode.nodetype3=nt:base
-# name of the mandatory node
-javax.jcr.tck.NodeTest.testRemoveMandatoryNode.nodename3=jcr:content
-
-# Test class: NodeTest
-# Test method: testSaveContstraintViolationException
-# nodetype that has a property that is mandatory but not autocreated
-javax.jcr.tck.NodeTest.testSaveContstraintViolationException.nodetype2=nt:file
-
-# Test class: NodeUUIDTest
-# node type that has a property of type PropertyType.REFERENCE
-javax.jcr.tck.NodeUUIDTest.nodetype=nt:unstructured
-# name of the property that is of type PropertyType.REFERENCE
-javax.jcr.tck.NodeUUIDTest.propertyname1=ref
-# nodetype that has nodetype mix:referenceable assigned
-javax.jcr.tck.NodeUUIDTest.nodetype2=test:refTargetNode
-
-# Test class: NodeUUIDTest
-# Test method: testSaveMovedRefNode
-# name of the property that can be modified
-javax.jcr.tck.NodeUUIDTest.testSaveMovedRefNode.propertyname1=foobar
-# nodetype that has nodetype mix:referenceable assigned
-
-# Test class: NodeOrderableChildNodesTest
-# nodetype that supports orderable child nodes
-javax.jcr.tck.NodeOrderableChildNodesTest.nodetype2=nt:unstructured
-# valid node type that can be added as child of nodetype 2
-javax.jcr.tck.NodeOrderableChildNodesTest.nodetype3=nt:unstructured
-
-# Test class: NodeOrderableChildNodesTest
-# Test method: testOrderBeforeUnsupportedRepositoryOperationException
-# nodetype that does not allow ordering of child nodes
-javax.jcr.tck.NodeOrderableChildNodesTest.testOrderBeforeUnsupportedRepositoryOperationException.nodetype2=nt:folder
-# valid node type that can be added as child of nodetype 2
-javax.jcr.tck.NodeOrderableChildNodesTest.testOrderBeforeUnsupportedRepositoryOperationException.nodetype3=nt:hierarchyNode
-
-# ------------------------------------------------------------------------------
-# observation configuration
-# ------------------------------------------------------------------------------
-
-# Configuration settings for the serialization.
-# Note that the serialization test tries to use as many features of the repository
-# as possible, but fails silently if a feature is not available. You have to
-# specify all of the following configuration entries, even if your repository does
-# not support the feature that is associated with them.
-
-# Root node for the example tree
-javax.jcr.tck.SerializationTest.testroot=/testdata/serialization
-
-# Node type to use for the example tree. Specify a node type that allows complex trees and all property types if possible
-javax.jcr.tck.SerializationTest.nodetype=nt:unstructured
-
-# Name of the nodes for source and target tree
-javax.jcr.tck.SerializationTest.sourceFolderName=source
-javax.jcr.tck.SerializationTest.targetFolderName=target
-javax.jcr.tck.SerializationTest.rootNodeName=test
-
-# List the properties whose values may change during serialization/deserialization. For example,
-# the UUID of a node is unique in the repository, so it will have to change when you re-import
-# a tree at a different location.
-javax.jcr.tck.SerializationTest.propertyValueMayChange= jcr:created jcr:uuid jcr:versionHistory jcr:baseVersion jcr:predecessors P_Reference
-
-# The name of the test node types. For easier diagnostics, the node types have names
-# that tell you the kind of information they store
-javax.jcr.tck.SerializationTest.nodeTypesTestNode=NodeTypes
-javax.jcr.tck.SerializationTest.mixinTypeTestNode=MixinTypes
-javax.jcr.tck.SerializationTest.propertyTypesTestNode=PropertyTypes
-javax.jcr.tck.SerializationTest.sameNameChildrenTestNode=SameNameChildren
-javax.jcr.tck.SerializationTest.multiValuePropertiesTestNode=MultiValueProperties
-javax.jcr.tck.SerializationTest.referenceableNodeTestNode=ReferenceableNode
-javax.jcr.tck.SerializationTest.orderChildrenTestNode=OrderChildren
-javax.jcr.tck.SerializationTest.namespaceTestNode=Namespace
-
-# The name of the test property types.
-javax.jcr.tck.SerializationTest.stringTestProperty=P_String
-javax.jcr.tck.SerializationTest.binaryTestProperty=P_Binary
-javax.jcr.tck.SerializationTest.dateTestProperty=P_Date
-javax.jcr.tck.SerializationTest.longTestProperty=P_Long
-javax.jcr.tck.SerializationTest.doubleTestProperty=P_Double
-javax.jcr.tck.SerializationTest.booleanTestProperty=P_Boolean
-javax.jcr.tck.SerializationTest.nameTestProperty=P_Name
-javax.jcr.tck.SerializationTest.pathTestProperty=P_Path
-javax.jcr.tck.SerializationTest.referenceTestProperty=P_Reference
-javax.jcr.tck.SerializationTest.multiValueTestProperty=P_MultiValue
-
-# Test method: testVersioningExceptionSessionFileChild
-# specified nodetype must be versionable and allow child nodes of the same type.
-javax.jcr.tck.SerializationTest.testVersioningExceptionSessionFileChild.nodetype=test:versionable
-
-# Test method: testVersioningExceptionSessionFileParent
-# specified nodetype must be versionable and allow child nodes of the same type.
-javax.jcr.tck.SerializationTest.testVersioningExceptionSessionFileParent.nodetype=test:versionable
-
-# ==============================================================================
-# JAVAX.JCR.QUERY CONFIGURATION
-# ==============================================================================
-
-# Test class: SaveTest
-# Test method: testConstraintViolationException
-# Specified node type must not allow child nodes.
-javax.jcr.tck.SaveTest.testConstraintViolationException.nodetype=nt:query
-
-# Test class: XPathQueryLevel1Test
-javax.jcr.tck.XPathQueryLevel1Test.testroot=/testdata/query
-
-# Test class: XPathDocOrderTest
-javax.jcr.tck.XPathDocOrderTest.testroot=/testdata/query
-
-# Test class: XPathPosIndexTest
-javax.jcr.tck.XPathPosIndexTest.testroot=/testdata/query
-
-# Test class: XPathOrderByTest
-javax.jcr.tck.XPathOrderByTest.testroot=/testdata/query
-
-# Test class: XPathSyntaxTest
-javax.jcr.tck.XPathSyntaxTest.testroot=/testdata/query
-
-# Test class: SQLQueryLevel1Test
-javax.jcr.tck.SQLQueryLevel1Test.testroot=/testdata/query
-
-# Test class: SQLSyntaxTest
-javax.jcr.tck.SQLSyntaxTest.testroot=/testdata/query
-
-# Test class: SQLOrderByTest
-javax.jcr.tck.SQLOrderByTest.testroot=/testdata/query
-
-# ==============================================================================
-# JAVAX.JCR.VERSIONING CONFIGURATION
-# ==============================================================================
-
-# nodetye that is versionable. if it is not, an attempt is made to create versionable nodes
-# by adding a mix:versionable mixin-type.
-# NOTE: javax.jcr.tck.nodetype must define a non-versionable nodetype!
-javax.jcr.tck.version.versionableNodeType=test:versionable
-javax.jcr.tck.version.propertyValue=aPropertyValue
-
-# testroot for the version package
-# the test root must allow versionable and non-versionable nodes being created below
-javax.jcr.tck.version.testroot=/testroot
-
-# 3 nodes (nodeName1, nodeName2, nodeName3 with nt=versionableNodeType / nt=nonVersionableNodeType will be cloned to 2nd workspace
-# nodename1 > used to persistently create versionable node below testroot
-# nodename2 > used to create second versionable node below testroot (used for restore/workspace.restore with uuid-conflict)
-# nodename3 > used to persistently create non-versionable node below testroot
-javax.jcr.tck.version.nodename1=versionableNodeName1
-javax.jcr.tck.version.nodename2=versionableNodeName2
-javax.jcr.tck.version.nodename3=nonVersionableNodeName1
-
-# nodename 4: versionabel child-node of the first versionable node with nodeName1 and nodetype 'versionableNodeType'
-# used for:
-# + creation of a node in the 2nd workspace, that does not exist in the first workspace
-# + creation of a node in the 2nd workspace, in order to test uuid-conflicts with Workspace.restore.
-# + creation of a sub-node in the default workspace, in order to test uuid-conflicts with Node.restore.
-# + NOTE: the nodetype with 'versionableNodeType' must define its children nodes to either have COPY or VERSION
-# OPV behaviour in order to successfully test Node.restore and Workspace.restore with uuid conflict.
-javax.jcr.tck.version.nodename4=childNodeName
-
-# path to existing String-properties and a new value for the property, that allows to test the indicated OPV behaviour
-javax.jcr.tck.OnParentVersionAbortTest.propertyname1=test:abortOnParentVersionProp
-javax.jcr.tck.OnParentVersionComputeTest.propertyname1=test:computeOnParentVersionProp
-javax.jcr.tck.OnParentVersionCopyTest.propertyname1=test:copyOnParentVersionProp
-javax.jcr.tck.OnParentVersionIgnoreTest.propertyname1=test:ignoreOnParentVersionProp
-javax.jcr.tck.OnParentVersionInitializeTest.propertyname1=test:initializeOnParentVersionProp
-
-# config for nodes that show the indicated OPV behaviour:
-# nodes are added in order to test the versioning behaviour indicated by the test-class name.
-# NOTE:
-# - nodename4 is uses as name for the childnode
-# - nodetype is used as nodetype name for the childnode
-# - the specified child node is created below nodename1 with versionableNodeType
-# the versionableNodeType and/or nodename1 may be overwritten with the individual
-# testclass below.
-javax.jcr.tck.OnParentVersionCopyTest.nodename4=test:copyOnParentVersion
-javax.jcr.tck.OnParentVersionCopyTest.nodetype=nt:unstructured
-javax.jcr.tck.OnParentVersionAbortTest.nodename4=test:abortOnParentVersion
-javax.jcr.tck.OnParentVersionAbortTest.nodetype=nt:unstructured
diff --git a/contrib/tck-webapp/src/webapp/WEB-INF/content-repository/log4j.properties b/contrib/tck-webapp/src/webapp/WEB-INF/content-repository/log4j.properties
deleted file mode 100644
index 2728ce9be0d..00000000000
--- a/contrib/tck-webapp/src/webapp/WEB-INF/content-repository/log4j.properties
+++ /dev/null
@@ -1,20 +0,0 @@
-# Set root logger level to DEBUG and its only appender to A1.
-log4j.rootLogger=INFO, stdout
-#log4j.rootLogger=DEBUG, stdout, file
-#log4j.rootLogger=ERROR, stdout, file
-
-# 'stdout' is set to be a ConsoleAppender.
-log4j.appender.stdout=org.apache.log4j.ConsoleAppender
-
-# 'stdout' uses PatternLayout
-log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
-log4j.appender.stdout.layout.ConversionPattern=%d{dd.MM.yyyy HH:mm:ss} *%-5p* [%t] %c{1}: %m (%F, line %L)\n
-
-# 'file' is set to be a FileAppender.
-log4j.appender.file=org.apache.log4j.FileAppender
-log4j.appender.file.File=jcr.log
-
-# 'file' uses PatternLayout.
-log4j.appender.file.layout=org.apache.log4j.PatternLayout
-log4j.appender.file.layout.ConversionPattern=%d{dd.MM.yyyy HH:mm:ss} *%-5p* [%t] %c{1}: %m (%F, line %L)\n
-
diff --git a/contrib/tck-webapp/src/webapp/WEB-INF/content-repository/repository.xml b/contrib/tck-webapp/src/webapp/WEB-INF/content-repository/repository.xml
deleted file mode 100644
index cd35dc49e6d..00000000000
--- a/contrib/tck-webapp/src/webapp/WEB-INF/content-repository/repository.xml
+++ /dev/null
@@ -1,234 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-]>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/contrib/tck-webapp/src/webapp/WEB-INF/tck/log4j.properties b/contrib/tck-webapp/src/webapp/WEB-INF/tck/log4j.properties
deleted file mode 100644
index 057f2048a0a..00000000000
--- a/contrib/tck-webapp/src/webapp/WEB-INF/tck/log4j.properties
+++ /dev/null
@@ -1,27 +0,0 @@
-# Set root logger level to DEBUG and its only appender to A1.
-log4j.rootLogger=INFO, stdout
-#log4j.rootLogger=DEBUG, stdout, file
-#log4j.rootLogger=ERROR, stdout, file
-log4j.logger.org.apache.jackrabbit.test.testwebapp.j2ee.TesterServlet.login=INFO, login
-
-# 'stdout' is set to be a ConsoleAppender.
-log4j.appender.stdout=org.apache.log4j.ConsoleAppender
-
-# 'stdout' uses PatternLayout
-log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
-log4j.appender.stdout.layout.ConversionPattern=%d{dd.MM.yyyy HH:mm:ss} *%-5p* [%t] %c{1}: %m (%F, line %L)\n
-
-# 'file' is set to be a FileAppender.
-log4j.appender.file=org.apache.log4j.FileAppender
-log4j.appender.file.File=jcr.log
-
-# 'file' uses PatternLayout.
-log4j.appender.file.layout=org.apache.log4j.PatternLayout
-log4j.appender.file.layout.ConversionPattern=%d{dd.MM.yyyy HH:mm:ss} *%-5p* [%t] %c{1}: %m (%F, line %L)\n
-
-# 'login' is set to be a FileAppender.
-log4j.appender.login=org.apache.log4j.FileAppender
-log4j.appender.login.File=tck/home/login.log
-log4j.appender.login.layout=org.apache.log4j.PatternLayout
-log4j.appender.login.layout.ConversionPattern=%d{dd.MM.yyyy HH:mm:ss} *%-5p* [%t] %c{1}: %m (%F, line %L)\n
-
diff --git a/contrib/tck-webapp/src/webapp/WEB-INF/web.xml b/contrib/tck-webapp/src/webapp/WEB-INF/web.xml
deleted file mode 100644
index 67bbdfb8a17..00000000000
--- a/contrib/tck-webapp/src/webapp/WEB-INF/web.xml
+++ /dev/null
@@ -1,59 +0,0 @@
-
-
-
-
- TCK web application
-
-
-
-
-
- Repository
- repository servlet that starts the repository and registers it to JNDI.
- org.apache.jackrabbit.tck.j2ee.RepositoryServlet
-
-
- log4j-config
- /WEB-INF/content-repository/log4j.properties
- initial log4j configuration
-
-
-
- repository-config
- /WEB-INF/content-repository/repository.xml
- the repository config location
-
-
-
- repository-home
- tck/content-repository
- the repository home
-
-
-
- repository-name
- tck.repository
- Repository Name under which the repository is registered via JNDI
-
-
-
- jaas-config-file
- etc/jaas.config
- Path of the jaas config file
-
-
-
- jcr-userid
- superuser
- User to read/write from the repository where test results and config is stored
-
-
-
- jcr-password
- superuser
- User password
-
-
- 1
-
-
\ No newline at end of file
diff --git a/contrib/tck-webapp/src/webapp/config.jsp b/contrib/tck-webapp/src/webapp/config.jsp
deleted file mode 100644
index 8d760d9b217..00000000000
--- a/contrib/tck-webapp/src/webapp/config.jsp
+++ /dev/null
@@ -1,168 +0,0 @@
-<%--
-Copyright 2004-2005 The Apache Software Foundation or its licensors,
- as applicable.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
---%><%@ page import="javax.jcr.Session,
- javax.jcr.Node,
- javax.jcr.NodeIterator,
- java.text.SimpleDateFormat,
- java.util.*,
- org.apache.jackrabbit.tck.WebAppTestConfig,
- org.apache.jackrabbit.test.JNDIRepositoryStub,
- org.apache.jackrabbit.tck.WebAppTestConfig,
- org.apache.jackrabbit.tck.j2ee.RepositoryServlet,
- org.apache.jackrabbit.tck.TestFinder,
- junit.framework.TestSuite"
-%><%@page session="false" %><%
-
-// get path from jar where the test sources are stored
-String TEST_JCR_PATH = "/WEB-INF/lib/tck-webapp-0.1.jar";
-
-Session repSession = RepositoryServlet.getSession();
-if (repSession == null) {
- return;
-}
-
-String mode = request.getParameter("mode");
-
-%>
-
-
-
-
-
-
-
-
-
-
-
-
- <%
- if (mode == null || !mode.equals("view")) {
- // check for property additions
- String newid = request.getParameter("newid");
- String newvalue = request.getParameter("newvalue");
- if (newvalue != null && !"".equals(newvalue) && newid != null && !"".equals(newid)) {
- WebAppTestConfig.saveProperty(newid, newvalue, repSession);
- }
-
- // reset to default configuration (from properties file) if requested
- String resetConfig = request.getParameter("resetconfig");
- if (resetConfig != null && "yes".equals(resetConfig)) {
- WebAppTestConfig.resetConfiguration();
- }
-
- // load current configuration
- Map props = WebAppTestConfig.getCurrentConfig();
- %>
-
- <%
- } else {
- %>
-
- <%
- }
- %>
-
-
-
-
-
\ No newline at end of file
diff --git a/contrib/tck-webapp/src/webapp/docroot/imgs/banner_left.jpg b/contrib/tck-webapp/src/webapp/docroot/imgs/banner_left.jpg
deleted file mode 100644
index f050a8db649..00000000000
Binary files a/contrib/tck-webapp/src/webapp/docroot/imgs/banner_left.jpg and /dev/null differ
diff --git a/contrib/tck-webapp/src/webapp/docroot/imgs/banner_right.jpg b/contrib/tck-webapp/src/webapp/docroot/imgs/banner_right.jpg
deleted file mode 100644
index c77b393048b..00000000000
Binary files a/contrib/tck-webapp/src/webapp/docroot/imgs/banner_right.jpg and /dev/null differ
diff --git a/contrib/tck-webapp/src/webapp/docroot/imgs/clear.png b/contrib/tck-webapp/src/webapp/docroot/imgs/clear.png
deleted file mode 100644
index 2b7c47df7fd..00000000000
Binary files a/contrib/tck-webapp/src/webapp/docroot/imgs/clear.png and /dev/null differ
diff --git a/contrib/tck-webapp/src/webapp/docroot/imgs/error.png b/contrib/tck-webapp/src/webapp/docroot/imgs/error.png
deleted file mode 100644
index 577366c6d29..00000000000
Binary files a/contrib/tck-webapp/src/webapp/docroot/imgs/error.png and /dev/null differ
diff --git a/contrib/tck-webapp/src/webapp/docroot/imgs/failure.png b/contrib/tck-webapp/src/webapp/docroot/imgs/failure.png
deleted file mode 100644
index 1c3413a21a2..00000000000
Binary files a/contrib/tck-webapp/src/webapp/docroot/imgs/failure.png and /dev/null differ
diff --git a/contrib/tck-webapp/src/webapp/docroot/imgs/pass.png b/contrib/tck-webapp/src/webapp/docroot/imgs/pass.png
deleted file mode 100644
index 11b20c212e9..00000000000
Binary files a/contrib/tck-webapp/src/webapp/docroot/imgs/pass.png and /dev/null differ
diff --git a/contrib/tck-webapp/src/webapp/docroot/ui/default.css b/contrib/tck-webapp/src/webapp/docroot/ui/default.css
deleted file mode 100644
index 8a1898d986f..00000000000
--- a/contrib/tck-webapp/src/webapp/docroot/ui/default.css
+++ /dev/null
@@ -1,514 +0,0 @@
-/*
- * Copyright 2004-2005 The Apache Software Foundation or its licensors,
- * as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/* CSS Document */
-
-body
- {
- font-family: Verdana, Arial, Helvetica, san-serif;
- background-color: #ffffff;
- padding: 0px;
- margin: 0px;
- margin-top: 30px;
- vertical-align: top;
- text-align: left;
- }
-
-br
- {
- line-height:20px;
- }
-
-table
- {
- text-align: left;
- padding: 0px;
- margin: 0px;
- border: 0px solid #66dd44;
- }
-
-
-table.content
- {
- postion: absolute;
- font-size: 10px;
- line-height: 13px;
- border: 0px solid #66dd44;
- border-top: 1px solid #cccccc;
- padding: 0px;
- margin: 0px;
- margin-top: 26px;
- margin-bottom: 26px;
- width: 718px;
- text-align: left;
- }
-
-td.content
- {
- color: #333333;
- border: 0px solid #66dd44;
- border-bottom: 1px solid #cccccc;
- border-right: 0px solid #cccccc;
- border-left: 0px solid #cccccc;
- vertical-align: top;
- padding: 3px;
- padding-left: 10px;
- }
-
-td.graph
- {
- font-size: 11px;
- padding-left: 10px;
- color: #333333;
- }
-
-
-td.disabled
- {
- color:#999999;
- }
-
-th.content
- {
- color: #333333;
- border: 0px solid #66dd44;
- border-bottom: 1px solid #cccccc;
- text-align: left;
- padding: 5px;
- padding-left:10px;
- }
-
-th.container
- {
- color:#6181A9;
- background-color:#f0f0f0;
- }
-
-th.important
- {
- color:#B81833;
- }
-
-.important
- {
- color:#B81833;
- }
-
-#maintable
- {
- postion: absolute;
- font-size: 10px;
- line-height: 13px;
- border: 1px solid #000000;
- padding: 0px;
- margin: 0px;
- width: 960px;
- }
-
-
-
-.toolcell
- {
- font-size: 10px;
- color: #999999;
- line-height: 10px;
- background-color: #000000;
- height: 18px;
- width: 960px;
- padding: 0px;
- padding-bottom: 1px;
- text-align: left;
- }
-
-.toolcell A:link
- {
- color: #C5E2EE;
- text-decoration: none;
- }
-
-.toolcell A:visited
- {
- color: #C5E2EE;
- text-decoration: none;
- }
-
-.toolcell A:hover
- {
- color: #99FF33;
- text-decoration: none;
- border-bottom: 1px solid;
- }
-
-.toolcell A:active
- {
- color: #FFFFFF;
- text-decoration: none;
- }
-
-.leadcell
- {
- margin: 0px;
- padding: 0px;
- border: 0px solid #000000;
- width: 720px;
- height: 100px;
- background-image: url('../imgs/banner_left.jpg');
- vertical-align: top
- }
-
-.leadcelltext
- {
- position: absolute;
- border: 0px solid #000000;
- font-size: 26px;
- line-height: 32px;
- margin-top: 5px;
- margin-left: 8px;
- color: #ffffff;
- vertical-align: top;
- }
-
-.logocell
- {
- border-left: 1px solid #000000;
- width: 239px;
- align:right
- }
-
-#technavcell
- {
- font-size: 10px;
- font-weight: bold;
- border: 0px solid #000000;
- border-top: 1px solid #000000;
- height: 21px;
- background-color: #6181A9;
- }
-
-#technav
- {
- float: left;
- display: block;
- font-size: 10px;
- line-height: 20px;
- font-weight: bold;
- color: #000000;
- height: 21px;
- border: 0px solid #000000;
- padding: 0px;
- background-color: #ffffff;
- }
-.technavat
- {
- cursor:default;
- float: left;
- display: block;
- font-size: 10px;
- line-height: 20px;
- font-weight: bold;
- color: #000000;
- height: 21px;
- border: 0px solid #000000;
- border-right: 1px solid #000000;
- padding: 0px 10px 0px 10px;
- background-color: #B6CAE4;
- }
-#technav A:link
- {
- float: left;
- display: block;
- color: #ffffff;
- border: 0px solid #000000;
- border-right: 1px solid #000000;
- height: 21px;
- text-decoration: none;
- padding: 0px 10px 0px 10px;
- background-color: #6181A9;
- }
-#technav A:visited
- {
- float: left;
- display: block;
- color: #ffffff;
- border-right: 1px solid #000000;
- height: 21px;
- text-decoration: none;
- padding: 0px 10px 0px 10px;
- background-color: #6181A9;
- }
-#technav A:hover
- {
- float: left;
- display: block;
- color: #ffffff;
- border-right: 1px solid #000000;
- height: 21px;
- text-decoration: none;
- padding: 0px 10px 0px 10px;
- background-color: #000000;
- }
-#technav A:active
- {
- float: left;
- display: block;
- color: #ffffff;
- border-right: 1px solid #000000;
- height: 21px;
- text-decoration: none;
- padding: 0px 10px 0px 10px;
- background-color: #6181A9;
- }
-
-.techcontentcell
- {
- width: 718px;
- border: 0px solid #000000;
- border-top: 1px solid #000000;
- }
-
-.relatedcell
- {
- border-left: 1px solid #000000;
- border-top: 1px solid #000000;
- width: 239px;
- background-color: #EBF0F6;
- }
-
-.claimcell
- {
- width: 715px;
- font-size: 10px;
- color: #ffffff;
- line-height: 10px;
- background-color: #000000;
- height: 18px;
- padding: 0px;
- padding-bottom: 1px;
- }
-
-.claimcell A:link
- {
- color: #C5E2EE;
- text-decoration: none;
- }
-
-.claimcell A:visited
- {
- color: #C5E2EE;
- text-decoration: none;
- }
-
-.claimcell A:hover
- {
- color: #99FF33;
- text-decoration: none;
- border-bottom: 1px solid;
- }
-
-.claimcell A:active
- {
- color: #FFFFFF;
- text-decoration: none;
- }
-
-/* CENTRAL CONTENT AREA STYLING */
-
-.content
- {
- position: relative;
- margin: 25px;
- font-size: 11px;
- line-height: 16px;
- color: #000000;
- }
-
-.content A:link
- {
- color: #336600;
- text-decoration: underline;
- }
-
-.content A:visited
- {
- color: #666666;
- text-decoration: underline;
- }
-
-.content A:hover
- {
- color: #ffffff;
- background-color: #336600;
- text-decoration: none;
- }
-
-.content A:active
- {
- color: #ffffff;
- background-color: #000000;
- text-decoration: none;
- }
-
-
-
-/* TEXT STYLING */
-
-h1, h2, h3, h4, h5, h6, p
-
- {
- margin: 0px;
- margin-bottom: 8px;
- font-size: 11px;
- line-height: 16px;
- font-weight:bold;
- }
-
-
-h1
- {
- color: #000000;
- margin-top: 32px;
- clear: left;
- }
-
-
-h2
- {
- color: #336699;
- }
-
-
-h3
- {
- color: #336699;
- }
-
-p
- {
- font-size: 11px;
- line-height: 16px;
- font-weight: normal;
- color: #000000;
- }
-
-/* FORMS */
-
-form
- {
- font-size: 9px;
- border-top: 0px solid #000000;
- border-bottom: 0px solid #000000;
- border-left: 0px solid #000000;
- border-right: 0px solid #000000;
- margin: 0;
- padding: 0;
- clear: left;
- }
-select, textarea
- {
- font-family: Verdana, Arial, Helvetica, san-serif;
- font-size: 9px;
- font-weight: normal;
- display: block;
- float: left;
- padding-top: 3px;
- margin-bottom: 10px;
- }
-.input
- {
- font-family: Verdana, Arial, Helvetica, san-serif;
- font-size: 10px;
- font-weight: normal;
- color: #184054;
- background-color: #f0f0f0;
- border: 1px solid #999999;
- border-bottom: 1px solid #cccccc;
- border-right: 1px solid #cccccc;
- width:400px;
- }
-
-.submit
- {
- cursor:default;
- width:60px;
- font-family: Verdana, Arial, Helvetica, san-serif;
- font-size: 10px;
- font-weight: bold;
- background-color: #f0f0f0;
- height: 20px;
- padding: 0px;
- padding-bottom: 1px;
- margin: 0px;
- border: 1px solid #cccccc;
- border-bottom: 1px solid #666666;
- border-right: 1px solid #666666;
- }
-
-input.important
- {
- background-color:#B81833;
- color:#ffffff;
- }
-
-select
- {
- color: #184054;
- background-color: #f0f0f0;
- border: 0px solid #999999;
- }
-textarea
- {
- color: #184054;
- background-color: #f0f0f0;
- width: 234px;
- height: 100px;
- border: 1px solid #999999;
- border-bottom: 1px solid #cccccc;
- border-right: 1px solid #cccccc;
- }
-.clearleft
- {
- clear: left;
- }
-.clearboth
- {
- clear: both;
- }
-
-.checkradio
- {
- background-color: #ffffff;
- width: 20px;
- padding: 0px;
- padding-bottom: 10px;
- margin: 0px;
- margin-top: 2px;
- border: 0px solid #999999;
- }
-
-.checkradiotext
- {
- font-size: 9px;
- font-weight: normal;
- line-height: 11px;
- width: 100px;
- color: #000000;
- padding: 0px;
- padding-bottom: 10px;
- margin: 0px;
- margin-top: 4px;
- border: 0px solid #999999;
- }
\ No newline at end of file
diff --git a/contrib/tck-webapp/src/webapp/graph.jsp b/contrib/tck-webapp/src/webapp/graph.jsp
deleted file mode 100644
index cb5b99382ba..00000000000
--- a/contrib/tck-webapp/src/webapp/graph.jsp
+++ /dev/null
@@ -1,249 +0,0 @@
-<%--
-Copyright 2004-2005 The Apache Software Foundation or its licensors,
- as applicable.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
---%><%@ page import="javax.jcr.Session,
- javax.jcr.Node,
- javax.jcr.NodeIterator,
- junit.framework.Test,
- junit.framework.TestSuite,
- java.util.*,
- junit.framework.TestCase,
- javax.jcr.Property,
- java.text.SimpleDateFormat,
- org.apache.jackrabbit.tck.*,
- org.apache.jackrabbit.tck.j2ee.RepositoryServlet"
-%><%@page session="false" %><%
-
-// get the repository session for read(config and test results) and write (config and test results) access
-Session repSession = RepositoryServlet.getSession();
-if (repSession == null) {
- return;
-}
-
-// get path from jar where the test sources are stored
-String TEST_JCR_PATH = "/WEB-INF/lib/tck-webapp-0.1.jar";
-
-// display mode:
-// - testnow : new test
-// - view: view results
-// - null: blank view
-String mode = request.getParameter("mode");
-
-%>
-
-
-
-
-
- <%
- // draw empty test grid
- if (mode == null || (mode != null && mode.equals("testnow"))) {
- // prepare test
- TestFinder tf = new TestFinder();
- tf.find(getServletConfig().getServletContext().getResource(TEST_JCR_PATH).openStream(),
- "TestAll.java");
- Iterator tests = tf.getSuites().keySet().iterator();
-
- out.write("");
- tests = tf.getSuites().keySet().iterator();
-
- while (tests.hasNext()) {
- String key = (String) tests.next();
- TestSuite t = (TestSuite) tf.getSuites().get(key);
- Enumeration members = t.tests();
- out.write("" + t.toString() + " Config ");
-
- // list tests ordered by key (level1, level2, ....)
- while (members.hasMoreElements()) {
- TestSuite aTest = (TestSuite) members.nextElement();
-
- out.write("" +
- aTest.toString() + " ");
-
- Enumeration testMethods = aTest.tests();
- while (testMethods.hasMoreElements()) {
- TestCase tc = (TestCase) testMethods.nextElement();
- String methodname = tc.getName();
-
- String id = methodname + "(" + aTest.getName() + ")";
- out.write(" ");
- }
- out.write(" ");
- }
- if (tests.hasNext()) {
- out.write(" ");
- }
- }
-
- out.write("
");
- }
-
- // start testing or show results
- if (mode != null && mode.equals("testnow")) {
- // read and save test configuration
- WebAppTestConfig.save(request, repSession);
-
- // start testing
- Node rootNode = repSession.getRootNode();
- Node testResNode = (rootNode.hasNode("testing")) ?
- rootNode.getNode("testing") : rootNode.addNode("testing", "nt:unstructured");
- rootNode.save();
-
- out.write("");
- TestFinder testfinder = new TestFinder();
- testfinder.find(getServletConfig().getServletContext().getResource(TEST_JCR_PATH).openStream(),
- "TestAll.java");
- TckTestRunner runner = new TckTestRunner(out);
- String logStr = "";
- runner.setLogString(logStr);
- String interAStr = "";
- runner.setInteractionString(interAStr);
- runner.setNewTestString("");
- Tester t = new Tester(testfinder, runner, out);
- t.setfinishedSuiteString("");
- long startMillies = System.currentTimeMillis();
- t.run();
- Node results = testResNode.addNode(String.valueOf(startMillies));
- testResNode.save();
- t.storeResults(results);
- out.write("");
- out.write("");
- out.write("");
- } else if (mode != null && mode.equals("view")) {
- out.write("");
-
- TestFinder tf = new TestFinder();
- tf.find(getServletConfig().getServletContext().getResource(TEST_JCR_PATH).openStream(), "TestAll.java");
-
- // the test to be viewed is defined by the timestamp
- String testTimeInMs = request.getParameter("test");
-
- // load "test root"
- Node testroot = repSession.getRootNode().getNode("testing/" + testTimeInMs);
-
- Calendar cal = Calendar.getInstance();
- cal.setTimeInMillis(Long.parseLong(testTimeInMs));
- SimpleDateFormat formatter = new SimpleDateFormat("dd.MM.yyyy hh:mm:ss");
- String formatedTestTime = formatter.format(cal.getTime());
-
- out.write("");
- out.write("Test: " + formatedTestTime + " ");
- out.write("
");
-
- out.write("");
- out.write(" ");
-
- // display the test result categorized by the test suites:
- // - level1
- // - level2
- // - .....
- Iterator tests = tf.getSuites().keySet().iterator();
-
- while (tests.hasNext()) {
- String key = (String) tests.next();
- TestSuite t = (TestSuite) tf.getSuites().get(key);
- Enumeration members = t.tests();
- out.write("" + t.toString() + " ");
- while (members.hasMoreElements()) {
- TestSuite aTest = (TestSuite) members.nextElement();
-
- out.write("" +
- aTest.toString() + " ");
-
- Enumeration testMethods = aTest.tests();
- while (testMethods.hasMoreElements()) {
- TestCase tc = (TestCase) testMethods.nextElement();
- String methodname = tc.getName();
-
- // test identifier
- String keyname = methodname + "(" + aTest.getName() + ")";
-
- // load node containig the test result for one test
- Node testResultNode;
- if (testroot.hasNode(key + "/" + keyname)) {
- testResultNode = testroot.getNode(key + "/" + keyname);
- } else {
- continue;
- }
-
- int status = new Long(testResultNode.getProperty("status").getLong()).intValue();
- String color;
- switch (status) {
- case TestResult.SUCCESS:
- color = "pass";
- break;
- case TestResult.ERROR:
- case TestResult.FAILURE:
- color = "failure";
- break;
- case TestResult.NOT_EXECUTABLE:
- color = "error";
- break;
- default:
- color = "clear";
- }
-
- String testTime = (testResultNode.hasProperty("testtime")) ?
- String.valueOf(testResultNode.getProperty("testtime").getLong()) : "0";
-
- String errorMsg = (testResultNode.hasProperty("errrormsg")) ?
- "Error: " + testResultNode.getProperty("errrormsg").getString() : "";
- errorMsg = errorMsg.replaceAll("'"," ");
- errorMsg = errorMsg.replaceAll("\""," ");
- errorMsg = errorMsg.replaceAll("\n"," ");
- errorMsg = errorMsg.replaceAll("\r"," ");
-
- String testInfo = "- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -" +
- "- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
" +
- "Test name: " + methodname + "(" + aTest.getName() + ")
" +
- "Time: " + testTime + "ms
" + errorMsg + "
";
-
- out.write(" ");
- }
- out.write(" ");
- }
- if (tests.hasNext()) {
- out.write(" ");
- }
- }
-
- out.write("
");
- out.write("");
- out.write("");
- }
- %>
-
-
\ No newline at end of file
diff --git a/contrib/tck-webapp/src/webapp/index.jsp b/contrib/tck-webapp/src/webapp/index.jsp
deleted file mode 100644
index cca418f7f40..00000000000
--- a/contrib/tck-webapp/src/webapp/index.jsp
+++ /dev/null
@@ -1,69 +0,0 @@
-<%--
-Copyright 2004-2005 The Apache Software Foundation or its licensors,
- as applicable.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
---%><%@ page import="javax.jcr.Session,
- java.util.List,
- java.util.ArrayList"
-%><%@page session="false" %><%
-
- String parent = request.getRequestURI();
- if (parent.length() > 1) {
- parent = parent.substring(0,parent.lastIndexOf('/'));
- }
-
-%>
- TCK for JSR170
-
-
-
-
-
-
-
-
- TCK for JSR 170
Content Repository Standard
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/contrib/tck-webapp/src/webapp/status.jsp b/contrib/tck-webapp/src/webapp/status.jsp
deleted file mode 100644
index a3ac44b59cf..00000000000
--- a/contrib/tck-webapp/src/webapp/status.jsp
+++ /dev/null
@@ -1,24 +0,0 @@
-<%--
-Copyright 2004-2005 The Apache Software Foundation or its licensors,
- as applicable.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
---%><%@page session="false" %><%
-
-%>
-
-
-
-
-
-
diff --git a/contrib/vfs/05-03-03-repository.xml b/contrib/vfs/05-03-03-repository.xml
deleted file mode 100644
index 05cca38b8ba..00000000000
--- a/contrib/vfs/05-03-03-repository.xml
+++ /dev/null
@@ -1,228 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-]>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/contrib/vfs/README.txt b/contrib/vfs/README.txt
deleted file mode 100644
index eb0e5d74409..00000000000
--- a/contrib/vfs/README.txt
+++ /dev/null
@@ -1,14 +0,0 @@
-For testing you can use tmp provider. This provider will delete
-all the files and folders on repository shutdown.
-
-The providers configuration file (providers.xml) must be in the classpath.
-
-repository.xml Example:
-
-
-
-
-
-
-
-
diff --git a/contrib/vfs/src/java/org/apache/jackrabbit/core/fs/vfs/VFSFileSystem.java b/contrib/vfs/src/java/org/apache/jackrabbit/core/fs/vfs/VFSFileSystem.java
deleted file mode 100644
index 3298c7ff5a5..00000000000
--- a/contrib/vfs/src/java/org/apache/jackrabbit/core/fs/vfs/VFSFileSystem.java
+++ /dev/null
@@ -1,631 +0,0 @@
-/*
- * Copyright 2004-2005 The Apache Software Foundation or its licensors,
- * as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.jackrabbit.core.fs.vfs;
-
-import java.io.File;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.util.ArrayList;
-import java.util.Calendar;
-import java.util.Collection;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.commons.vfs.AllFileSelector;
-import org.apache.commons.vfs.FileObject;
-import org.apache.commons.vfs.FileSelector;
-import org.apache.commons.vfs.FileSystemException;
-import org.apache.commons.vfs.FileType;
-import org.apache.commons.vfs.FileUtil;
-import org.apache.commons.vfs.RandomAccessContent;
-import org.apache.commons.vfs.cache.SoftRefFilesCache;
-import org.apache.commons.vfs.impl.StandardFileSystemManager;
-import org.apache.commons.vfs.util.RandomAccessMode;
-import org.apache.jackrabbit.core.fs.FileSystem;
-import org.apache.jackrabbit.core.fs.RandomAccessOutputStream;
-
-/**
- * FileSystem backed by Commons VFS
- *
- * @author Edgar Poce
- */
-public class VFSFileSystem implements FileSystem
-{
- /**
- * Logger
- */
- private Log log = LogFactory.getLog(VFSFileSystem.class);
-
- /**
- * File selector
- */
- public final static FileSelector ALL = new AllFileSelector() ;
-
- /**
- * VFS manager
- */
- StandardFileSystemManager fsManager;
-
- /**
- * Scheme
- */
- private String prefix;
-
- /**
- * Path
- */
- private String path;
-
- /**
- * The config file
- */
- private String config;
-
- /**
- *
- */
- public VFSFileSystem()
- {
- super();
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.apache.jackrabbit.core.fs.FileSystem#init()
- */
- public void init() throws org.apache.jackrabbit.core.fs.FileSystemException
- {
-
- if (this.path == null)
- {
- String msg = "Path is not set";
- log.error(msg);
- throw new org.apache.jackrabbit.core.fs.FileSystemException(msg);
- }
-
- if (this.config == null)
- {
- String msg = "Configuration file name is not set (\"config\" parameter ).";
- log.error(msg);
- throw new org.apache.jackrabbit.core.fs.FileSystemException(msg);
- }
-
- try
- {
- // Init file system
- fsManager = new StandardFileSystemManager();
-
- // Set class loader for resource retrieval
- fsManager.setClassLoader(this.getClass().getClassLoader());
-
- // Configuration file name
- fsManager.setConfiguration(this.getClass().getClassLoader()
- .getResource(this.config).toExternalForm());
-
- // Set the logger
- fsManager.setLogger(log);
-
- // Cache strategy
- // FIXME: set through configuration
- fsManager.setFilesCache(new SoftRefFilesCache());
- fsManager.init();
-
- // Set the base folder
- FileObject fo = fsManager
- .resolveFile(this.prefix + ":" + this.path);
- fsManager.setBaseFile(fo);
-
- } catch (FileSystemException e)
- {
- String msg = "Unable to init VFS FileSystem";
- log.error(msg, e);
- throw new org.apache.jackrabbit.core.fs.FileSystemException(msg, e);
- }
-
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.apache.jackrabbit.core.fs.FileSystem#close()
- */
- public void close()
- throws org.apache.jackrabbit.core.fs.FileSystemException
- {
- this.fsManager.close() ;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.apache.jackrabbit.core.fs.FileSystem#getInputStream(java.lang.String)
- */
- public InputStream getInputStream(String filePath)
- throws org.apache.jackrabbit.core.fs.FileSystemException
- {
- try
- {
- FileObject file = this.getFile(filePath);
- this.validateFile(file);
- return file.getContent().getInputStream();
- } catch (FileSystemException e)
- {
- throw new org.apache.jackrabbit.core.fs.FileSystemException(e);
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.apache.jackrabbit.core.fs.FileSystem#getOutputStream(java.lang.String)
- */
- public OutputStream getOutputStream(String filePath)
- throws org.apache.jackrabbit.core.fs.FileSystemException
- {
- try
- {
- FileObject file = this.getFile(filePath);
- if (!file.exists())
- {
- file.createFile();
- }
- this.validateFile(file);
- return file.getContent().getOutputStream();
- } catch (FileSystemException e)
- {
- throw new org.apache.jackrabbit.core.fs.FileSystemException(e);
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.apache.jackrabbit.core.fs.FileSystem#getRandomAccessOutputStream(java.lang.String)
- */
- public RandomAccessOutputStream getRandomAccessOutputStream(String filePath)
- throws org.apache.jackrabbit.core.fs.FileSystemException
- {
- try
- {
- FileObject file = this.getFile(filePath);
- this.validateFile(file);
- RandomAccessContent raf = file.getContent().getRandomAccessContent(
- RandomAccessMode.READWRITE);
- return new VFSRAFOutputStream(raf);
- } catch (FileSystemException e)
- {
- throw new org.apache.jackrabbit.core.fs.FileSystemException(e);
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.apache.jackrabbit.core.fs.FileSystem#createFolder(java.lang.String)
- */
- public void createFolder(String folderPath)
- throws org.apache.jackrabbit.core.fs.FileSystemException
- {
- try
- {
- FileObject folder = this.getFile(folderPath);
- folder.createFolder();
- } catch (FileSystemException e)
- {
- throw new org.apache.jackrabbit.core.fs.FileSystemException(e);
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.apache.jackrabbit.core.fs.FileSystem#exists(java.lang.String)
- */
- public boolean exists(String path)
- throws org.apache.jackrabbit.core.fs.FileSystemException
- {
- try
- {
- return this.getFile(path).exists();
- } catch (FileSystemException e)
- {
- throw new org.apache.jackrabbit.core.fs.FileSystemException(e);
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.apache.jackrabbit.core.fs.FileSystem#isFile(java.lang.String)
- */
- public boolean isFile(String path)
- throws org.apache.jackrabbit.core.fs.FileSystemException
- {
- try
- {
- return this.getFile(path).getType().equals(FileType.FILE);
- } catch (FileSystemException e)
- {
- throw new org.apache.jackrabbit.core.fs.FileSystemException(e);
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.apache.jackrabbit.core.fs.FileSystem#isFolder(java.lang.String)
- */
- public boolean isFolder(String path)
- throws org.apache.jackrabbit.core.fs.FileSystemException
- {
- try
- {
- return this.getFile(path).getType().equals(FileType.FOLDER);
- } catch (FileSystemException e)
- {
- throw new org.apache.jackrabbit.core.fs.FileSystemException(e);
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.apache.jackrabbit.core.fs.FileSystem#hasChildren(java.lang.String)
- */
- public boolean hasChildren(String path)
- throws org.apache.jackrabbit.core.fs.FileSystemException
- {
- try
- {
- return this.getFile(path).getChildren().length > 0;
- } catch (FileSystemException e)
- {
- throw new org.apache.jackrabbit.core.fs.FileSystemException(e);
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.apache.jackrabbit.core.fs.FileSystem#length(java.lang.String)
- */
- public long length(String filePath)
- throws org.apache.jackrabbit.core.fs.FileSystemException
- {
- try
- {
- FileObject file = this.getFile(filePath);
- this.validateFile(file);
- return file.getContent().getSize();
- } catch (FileSystemException e)
- {
- throw new org.apache.jackrabbit.core.fs.FileSystemException(e);
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.apache.jackrabbit.core.fs.FileSystem#lastModified(java.lang.String)
- */
- public long lastModified(String path)
- throws org.apache.jackrabbit.core.fs.FileSystemException
- {
- try
- {
- return this.getFile(path).getContent().getLastModifiedTime();
- } catch (FileSystemException e)
- {
- throw new org.apache.jackrabbit.core.fs.FileSystemException(e);
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.apache.jackrabbit.core.fs.FileSystem#touch(java.lang.String)
- */
- public void touch(String filePath)
- throws org.apache.jackrabbit.core.fs.FileSystemException
- {
- try
- {
- FileObject file = this.getFile(filePath);
- this.validateFile(file);
- file.getContent().setLastModifiedTime(
- Calendar.getInstance().getTimeInMillis());
- } catch (FileSystemException e)
- {
- throw new org.apache.jackrabbit.core.fs.FileSystemException(e);
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.apache.jackrabbit.core.fs.FileSystem#list(java.lang.String)
- */
- public String[] list(String folderPath)
- throws org.apache.jackrabbit.core.fs.FileSystemException
- {
- return this.list(this.getFile(folderPath), null);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.apache.jackrabbit.core.fs.FileSystem#listFiles(java.lang.String)
- */
- public String[] listFiles(String folderPath)
- throws org.apache.jackrabbit.core.fs.FileSystemException
- {
- return this.list(this.getFile(folderPath), FileType.FILE);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.apache.jackrabbit.core.fs.FileSystem#listFolders(java.lang.String)
- */
- public String[] listFolders(String folderPath)
- throws org.apache.jackrabbit.core.fs.FileSystemException
- {
- return this.list(this.getFile(folderPath), FileType.FOLDER);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.apache.jackrabbit.core.fs.FileSystem#deleteFile(java.lang.String)
- */
- public void deleteFile(String filePath)
- throws org.apache.jackrabbit.core.fs.FileSystemException
- {
- try
- {
- FileObject file = this.getFile(filePath);
- this.validateFile(file);
- this.delete(file);
- } catch (FileSystemException e)
- {
- throw new org.apache.jackrabbit.core.fs.FileSystemException(e);
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.apache.jackrabbit.core.fs.FileSystem#deleteFolder(java.lang.String)
- */
- public void deleteFolder(String folderPath)
- throws org.apache.jackrabbit.core.fs.FileSystemException
- {
- try
- {
- FileObject folder = this.getFile(folderPath);
- this.validateFolder(folder);
- this.delete(folder);
- } catch (FileSystemException e)
- {
- throw new org.apache.jackrabbit.core.fs.FileSystemException(e);
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.apache.jackrabbit.core.fs.FileSystem#move(java.lang.String,
- * java.lang.String)
- */
- public void move(String srcPath, String destPath)
- throws org.apache.jackrabbit.core.fs.FileSystemException
- {
- try
- {
- FileObject src = this.getFile(srcPath);
- FileObject dest = this.getFile(destPath);
- src.moveTo(dest);
- } catch (FileSystemException e)
- {
- throw new org.apache.jackrabbit.core.fs.FileSystemException(e);
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.apache.jackrabbit.core.fs.FileSystem#copy(java.lang.String,
- * java.lang.String)
- */
- public void copy(String srcPath, String destPath)
- throws org.apache.jackrabbit.core.fs.FileSystemException
- {
- try
- {
- FileObject src = this.getFile(srcPath);
- FileObject dest = this.getFile(destPath);
- FileUtil.copyContent(src, dest);
- } catch (FileSystemException e)
- {
- throw new org.apache.jackrabbit.core.fs.FileSystemException(e);
- } catch (IOException e)
- {
- throw new org.apache.jackrabbit.core.fs.FileSystemException(e);
- }
- }
-
- /**
- * Gets the FileObject for the given path
- *
- * @param path
- * @return FileSystem
- * @throws FileSystemException
- */
- private FileObject getFile(String path)
- throws org.apache.jackrabbit.core.fs.FileSystemException
- {
- try
- {
- if (path.startsWith("/")) {
- path = path.substring(1, path.length()) ;
- }
- return fsManager.resolveFile(path);
- } catch (FileSystemException e)
- {
- String msg = "Unable to get file " + path;
- log.error(msg, e);
- throw new org.apache.jackrabbit.core.fs.FileSystemException(msg, e);
- }
- }
-
- /**
- * Validates Folder Type
- *
- * @param folder
- * @throws FileSystemException
- */
- private void validateFolder(FileObject folder) throws FileSystemException
- {
- if (!folder.getType().equals(FileType.FOLDER))
- {
- String msg = folder.getName().getPath()
- + " does not denote a folder";
- log.error(msg);
- throw new FileSystemException(msg);
- }
- }
-
- /**
- * Validates File Type
- *
- * @param folder
- * @throws FileSystemException
- */
- private void validateFile(FileObject file) throws FileSystemException
- {
- if (!file.getType().equals(FileType.FILE))
- {
- String msg = file.getName().getPath() + " does not denote a file";
- log.error(msg);
- throw new FileSystemException(msg);
- }
- }
-
- /**
- * List the children for the given Type.
- *
- * @param path
- * @param type
- * @return
- * @throws org.apache.jackrabbit.core.fs.FileSystemException
- */
- private String[] list(FileObject folder, FileType type)
- throws org.apache.jackrabbit.core.fs.FileSystemException
- {
- try
- {
- this.validateFolder(folder);
- FileObject[] fo = folder.getChildren();
- Collection c = new ArrayList();
- for (int i = 0; i < fo.length; i++)
- {
- if (type == null)
- {
- c.add(fo[i].getName().getBaseName());
- } else
- {
- if (fo[i].getType().equals(type))
- {
- c.add(fo[i].getName().getBaseName());
- }
- }
- }
- return (String[]) c.toArray(new String[c.size()]);
- } catch (FileSystemException e)
- {
- throw new org.apache.jackrabbit.core.fs.FileSystemException(e);
- }
- }
-
- /**
- * Deletes the given File
- */
- private void delete(FileObject file)
- throws org.apache.jackrabbit.core.fs.FileSystemException
- {
- try
- {
- file.delete(ALL);
- } catch (FileSystemException e)
- {
- throw new org.apache.jackrabbit.core.fs.FileSystemException(e);
- }
- }
-
- public String getPath()
- {
- return path;
- }
-
- public void setPath(String path)
- {
- this.path = path;
- }
-
- /**
- * Makes a file canonical
- */
- public static File getCanonicalFile(final File file)
- {
- try
- {
- return file.getCanonicalFile();
- } catch (IOException e)
- {
- return file.getAbsoluteFile();
- }
- }
-
- public String getConfig()
- {
- return config;
- }
-
- public void setConfig(String config)
- {
- this.config = config;
- }
-
- /**
- * @return Returns the scheme.
- */
- public String getPrefix()
- {
- return prefix;
- }
-
- /**
- * @param scheme
- * The scheme to set.
- */
- public void setPrefix(String prefix)
- {
- this.prefix = prefix;
- }
-}
\ No newline at end of file
diff --git a/contrib/vfs/src/java/org/apache/jackrabbit/core/fs/vfs/VFSRAFOutputStream.java b/contrib/vfs/src/java/org/apache/jackrabbit/core/fs/vfs/VFSRAFOutputStream.java
deleted file mode 100644
index ec06b5c239d..00000000000
--- a/contrib/vfs/src/java/org/apache/jackrabbit/core/fs/vfs/VFSRAFOutputStream.java
+++ /dev/null
@@ -1,145 +0,0 @@
-/*
- * Copyright 2004-2005 The Apache Software Foundation or its licensors,
- * as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.jackrabbit.core.fs.vfs;
-
-import java.io.IOException;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.commons.vfs.RandomAccessContent;
-import org.apache.jackrabbit.core.fs.RandomAccessOutputStream;
-
-/**
- * Wrapper of VFS output stream on a random access file.
- *
- * @author Edgar Poce
- */
-class VFSRAFOutputStream extends RandomAccessOutputStream
-{
-
- private Log log = LogFactory.getLog(VFSRAFOutputStream.class);
-
- /**
- * The default size of the write buffer in bytes.
- */
- static final int DEFAULT_BUFFER_SIZE = 1024;
-
- /**
- * The write buffer.
- */
- private final byte[] buffer;
-
- /**
- * The underlying RandomAccessContent
.
- */
- protected RandomAccessContent rac;
-
- /**
- * The starting position of the buffer in the code.
- */
- private long bufferStart;
-
- /**
- * The end of valid data in the buffer.
- */
- private int bufferEnd;
-
- /**
- * Dummy buffer for {@link #write(int)}.
- */
- private byte[] one = new byte[1];
-
- /**
- * Constructor
- */
- public VFSRAFOutputStream(RandomAccessContent rac, int size)
- {
- super();
- this.rac = rac;
- this.buffer = new byte[size];
- try
- {
- bufferStart = rac.getFilePointer();
- } catch (IOException e)
- {
- log.error("Unable to get file pointer");
- }
- }
-
- /**
- * Constructor
- */
- public VFSRAFOutputStream(RandomAccessContent rac)
- {
- this(rac, DEFAULT_BUFFER_SIZE);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.apache.jackrabbit.core.fs.RandomAccessOutputStream#seek(long)
- */
- public void seek(long position) throws IOException
- {
- flush();
- rac.seek(position);
- bufferStart = position;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see java.io.OutputStream#write(int)
- */
- public void write(int b) throws IOException
- {
- one[0] = (byte) b;
- write(one, 0, 1);
- }
-
- public void close() throws IOException
- {
- flush();
- rac.close();
- rac = null;
- }
-
- public void flush() throws IOException
- {
- rac.write(buffer, 0, bufferEnd);
- bufferEnd = 0;
- bufferStart = rac.getFilePointer();
- }
-
- public void write(byte b[], int off, int len) throws IOException
- {
- if (len > buffer.length - bufferEnd)
- {
- flush();
- rac.write(b, off, len);
- } else
- {
- System.arraycopy(b, off, buffer, bufferEnd, len);
- bufferEnd += len;
- }
- }
-
- public void write(byte[] b) throws IOException
- {
- write(b, 0, b.length);
- }
-}
\ No newline at end of file
diff --git a/contrib/vfs/src/java/providers.xml b/contrib/vfs/src/java/providers.xml
deleted file mode 100644
index 8b57883d3ef..00000000000
--- a/contrib/vfs/src/java/providers.xml
+++ /dev/null
@@ -1,107 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/contrib/vfs/src/test/org/apache/jackrabbit/core/fs/vfs/VFSFileSystemTest.java b/contrib/vfs/src/test/org/apache/jackrabbit/core/fs/vfs/VFSFileSystemTest.java
deleted file mode 100644
index 5be1ff0f2f9..00000000000
--- a/contrib/vfs/src/test/org/apache/jackrabbit/core/fs/vfs/VFSFileSystemTest.java
+++ /dev/null
@@ -1,188 +0,0 @@
-/*
- * Copyright 2004-2005 The Apache Software Foundation or its licensors,
- * as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.jackrabbit.core.fs.vfs;
-
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.util.Arrays;
-
-import org.apache.jackrabbit.core.fs.RandomAccessOutputStream;
-import org.apache.jackrabbit.test.JUnitTest;
-
-/**
- *
- * FileSystem backed by Commons VFS Tests
- *
- *
- *
- * In order to run the following VM arguments must be set:
- *
- * - fs.prefix = [provider prefix]
- * - fs.path = [root path]
- * - fs.config = [providers config file]
- *
- *
- * @author Edgar Poce
- */
-public class VFSFileSystemTest extends JUnitTest
-{
- private static final String PREFIX = "fs.prefix";
-
- private static final String PATH = "fs.path";
-
- private static final String CONFIG = "fs.config";
-
- private static final String TEST_FOLDER = "testFolder1";
-
- private static final String TEST_FILE = "testFile1.txt";
-
- private static final String TEST_FOLDER2 = TEST_FOLDER + "/testFolder2";
-
- private static final String TEST_FILE2 = TEST_FOLDER2 + "/testFile2.txt";
-
- private static final String TEST_FILE3 = TEST_FOLDER2 + "/testFile3.txt";
-
- /**
- * VFS fs
- */
- private VFSFileSystem fs;
-
- /*
- * (non-Javadoc)
- *
- * @see junit.framework.TestCase#setUp()
- */
- protected void setUp() throws Exception
- {
- super.setUp();
- fs = new VFSFileSystem();
- fs.setPrefix(System.getProperty(PREFIX));
- fs.setPath(System.getProperty(PATH));
- fs.setConfig(System.getProperty(CONFIG));
- fs.init();
- }
-
- /*
- * (non-Javadoc)
- *
- * @see junit.framework.TestCase#tearDown()
- */
- protected void tearDown() throws Exception
- {
- super.tearDown();
- fs.close();
- fs = null;
- }
-
- public void testFileSystem() throws Exception
- {
- /*
- * Create folder
- */
- // depth = 0
- fs.createFolder(TEST_FOLDER);
- assertTrue(fs.exists(TEST_FOLDER));
- assertTrue(fs.isFolder(TEST_FOLDER));
- // depth = 1
- fs.createFolder(TEST_FOLDER2);
- assertTrue(fs.exists(TEST_FOLDER2));
- assertTrue(fs.isFolder(TEST_FOLDER2));
- // Children
- assertTrue(fs.hasChildren(TEST_FOLDER));
- assertTrue(fs.list(TEST_FOLDER)[0].equals(getName(TEST_FOLDER2)));
- assertTrue(fs.listFiles(TEST_FOLDER).length == 0);
- assertTrue(fs.listFolders(TEST_FOLDER)[0].equals(getName(TEST_FOLDER2)));
-
- /*
- * Create file
- */
- // depth = 1
- byte[] write = "hello world".getBytes();
- byte[] read = new byte[write.length];
-
- OutputStream out = fs.getOutputStream(TEST_FILE);
- out.write(write);
- out.flush();
- out.close();
- assertTrue(fs.exists(TEST_FILE));
- fs.getInputStream(TEST_FILE).read(read);
- assertTrue(Arrays.equals(write, read));
- // depth = 2
- out = fs.getOutputStream(TEST_FILE2);
- out.write(write);
- out.flush();
- out.close();
- assertTrue(fs.exists(TEST_FILE2));
- InputStream in = fs.getInputStream(TEST_FILE2);
- in.read(read);
- in.close();
- assertTrue(Arrays.equals(write, read));
-
- /*
- * Delete file
- */
- fs.deleteFile(TEST_FILE2);
- assertFalse(fs.exists(TEST_FILE2));
-
- /*
- * Delete folder
- */
- fs.deleteFolder(TEST_FOLDER2);
- assertFalse(fs.exists(TEST_FOLDER2));
-
- /*
- * Copy file
- */
- fs.copy(TEST_FILE, TEST_FILE2);
- assertTrue(fs.exists(TEST_FILE2));
- assertTrue(fs.isFile(TEST_FILE2));
-
- /*
- * Move file
- */
- fs.move(TEST_FILE2, TEST_FILE3);
- assertFalse(fs.exists(TEST_FILE2));
- assertTrue(fs.exists(TEST_FILE3));
- assertTrue(fs.isFile(TEST_FILE3));
-
- /* Radom access content */
- RandomAccessOutputStream rout = fs
- .getRandomAccessOutputStream(TEST_FILE);
- rout.seek(100);
- rout.write(10);
- rout.flush();
- rout.close();
-
- in = fs.getInputStream(TEST_FILE);
- in.skip(100);
- assertTrue(in.read() == 10);
- in.close();
-
- }
-
- /**
- * Get the name
- *
- * @param path
- * @return
- */
- private String getName(String path)
- {
- return path.substring(path.lastIndexOf("/") + 1, path.length());
- }
-
-}
\ No newline at end of file
diff --git a/examples/jackrabbit-firsthops/pom.xml b/examples/jackrabbit-firsthops/pom.xml
new file mode 100644
index 00000000000..aba9b44e573
--- /dev/null
+++ b/examples/jackrabbit-firsthops/pom.xml
@@ -0,0 +1,90 @@
+
+
+
+ 4.0.0
+
+ org.apache.jackrabbit
+ jackrabbit-firsthops
+ 0.1-SNAPSHOT
+ First Hops
+ First Hops Example Page
+ http://jackrabbit.apache.org/first-hops.html
+
+
+
+
+
+ javax.jcr
+ jcr
+ 2.0
+
+
+
+
+ org.apache.jackrabbit
+ jackrabbit-core
+ 2.12.1
+
+
+
+
+
+
+
+
+ org.slf4j
+ slf4j-log4j12
+
+
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-compiler-plugin
+ 2.3.2
+
+ 1.5
+
+ 1.5
+ true
+ false
+ true
+ false
+
+
+
+
+
+
+
+
+
diff --git a/examples/jackrabbit-firsthops/src/main/java/org/apache/jackrabbit/firsthops/FirstHop.java b/examples/jackrabbit-firsthops/src/main/java/org/apache/jackrabbit/firsthops/FirstHop.java
new file mode 100644
index 00000000000..23ef4daed09
--- /dev/null
+++ b/examples/jackrabbit-firsthops/src/main/java/org/apache/jackrabbit/firsthops/FirstHop.java
@@ -0,0 +1,51 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.firsthops;
+
+import javax.jcr.GuestCredentials;
+import javax.jcr.Repository;
+import javax.jcr.Session;
+
+import org.apache.jackrabbit.commons.JcrUtils;
+
+/**
+ * First hop example. Logs in to a content repository and prints a status
+ * message.
+ */
+public class FirstHop {
+
+ /**
+ * The main entry point of the example application.
+ *
+ * @param args
+ * command line arguments (ignored)
+ * @throws Exception
+ * if an error occurs
+ */
+ public static void main(String[] args) throws Exception {
+ Repository repository = JcrUtils.getRepository();
+ Session session = repository.login(new GuestCredentials());
+ try {
+ String user = session.getUserID();
+ String name = repository.getDescriptor(Repository.REP_NAME_DESC);
+ System.out.println("Logged in as " + user + " to a " + name
+ + " repository.");
+ } finally {
+ session.logout();
+ }
+ }
+}
diff --git a/examples/jackrabbit-firsthops/src/main/java/org/apache/jackrabbit/firsthops/SecondHop.java b/examples/jackrabbit-firsthops/src/main/java/org/apache/jackrabbit/firsthops/SecondHop.java
new file mode 100644
index 00000000000..61a3bdeafaf
--- /dev/null
+++ b/examples/jackrabbit-firsthops/src/main/java/org/apache/jackrabbit/firsthops/SecondHop.java
@@ -0,0 +1,65 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.firsthops;
+
+import javax.jcr.Repository;
+import javax.jcr.Session;
+import javax.jcr.SimpleCredentials;
+import javax.jcr.Node;
+
+import org.apache.jackrabbit.commons.JcrUtils;
+
+/**
+ * Second hop example. Stores, retrieves, and removes example content.
+ */
+public class SecondHop {
+
+ /**
+ * The main entry point of the example application.
+ *
+ * @param args
+ * command line arguments (ignored)
+ * @throws Exception
+ * if an error occurs
+ */
+ public static void main(String[] args) throws Exception {
+ Repository repository = JcrUtils.getRepository();
+ Session session = repository.login(new SimpleCredentials("admin",
+ "admin".toCharArray()));
+ try {
+ Node root = session.getRootNode();
+
+ // Store content
+ Node hello = root.addNode("hello");
+ Node world = hello.addNode("world");
+ world.setProperty("message", "Hello, World!");
+ session.save();
+
+ // Retrieve content
+ Node node = root.getNode("hello/world");
+ System.out.println(node.getPath());
+ System.out.println(node.getProperty("message").getString());
+
+ // Remove content
+ root.getNode("hello").remove();
+ session.save();
+ } finally {
+ session.logout();
+ }
+ }
+
+}
diff --git a/examples/jackrabbit-firsthops/src/main/java/org/apache/jackrabbit/firsthops/ThirdHop.java b/examples/jackrabbit-firsthops/src/main/java/org/apache/jackrabbit/firsthops/ThirdHop.java
new file mode 100644
index 00000000000..79b20f95929
--- /dev/null
+++ b/examples/jackrabbit-firsthops/src/main/java/org/apache/jackrabbit/firsthops/ThirdHop.java
@@ -0,0 +1,100 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.firsthops;
+
+import javax.jcr.*;
+import java.io.FileInputStream;
+
+import org.apache.jackrabbit.commons.JcrUtils;
+
+/**
+ * Third Jackrabbit example application. Imports an example XML file and outputs
+ * the contents of the entire workspace.
+ */
+public class ThirdHop {
+
+ /**
+ * The main entry point of the example application.
+ *
+ * @param args
+ * command line arguments (ignored)
+ * @throws Exception
+ * if an error occurs
+ */
+ public static void main(String[] args) throws Exception {
+ Repository repository = JcrUtils.getRepository();
+ Session session = repository.login(new SimpleCredentials("admin",
+ "admin".toCharArray()));
+
+ FileInputStream xml = new FileInputStream("src/main/resources/test.xml");
+ try {
+ Node root = session.getRootNode();
+
+ // Import the XML file unless already imported
+ if (!root.hasNode("importxml")) {
+ System.out.print("Importing xml... ");
+ // Create an unstructured node under which to import the XML
+ Node node = root.addNode("importxml", "nt:unstructured");
+ // Import the file "test.xml" under the created node
+ session.importXML(node.getPath(), xml,
+ ImportUUIDBehavior.IMPORT_UUID_CREATE_NEW);
+
+ session.save();
+ System.out.println("done.");
+ }
+
+ dump(root);
+ } finally {
+ session.logout();
+ }
+ }
+
+ /** Recursively outputs the contents of the given node. */
+ private static void dump(Node node) throws RepositoryException {
+ // First output the node path
+ System.out.println(node.getPath());
+ // Skip the virtual (and large!) jcr:system subtree
+ if (node.getName().equals("jcr:system")) {
+ return;
+ }
+
+ // Then output the properties
+ PropertyIterator properties = node.getProperties();
+ while (properties.hasNext()) {
+ Property property = properties.nextProperty();
+ if (property.getDefinition().isMultiple()) {
+ // A multi-valued property, print all values
+ Value[] values = property.getValues();
+ for (int i = 0; i < values.length; i++) {
+ System.out.println(property.getPath() + " = "
+ + values[i].getString());
+ }
+ } else {
+ // A single-valued property
+ System.out.println(property.getPath() + " = "
+ + property.getString());
+ }
+ }
+
+ // Finally output all the child nodes recursively
+ NodeIterator nodes = node.getNodes();
+ while (nodes.hasNext()) {
+ dump(nodes.nextNode());
+ }
+ }
+
+}
diff --git a/examples/jackrabbit-firsthops/src/main/resources/log4j.properties b/examples/jackrabbit-firsthops/src/main/resources/log4j.properties
new file mode 100644
index 00000000000..c8e9cb77d23
--- /dev/null
+++ b/examples/jackrabbit-firsthops/src/main/resources/log4j.properties
@@ -0,0 +1,20 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+log4j.rootLogger=ERROR, Console
+
+log4j.appender.Console=org.apache.log4j.ConsoleAppender
+log4j.appender.Console.layout=org.apache.log4j.PatternLayout
+log4j.appender.Console.layout.ConversionPattern=%d %p %c - %m%n
diff --git a/examples/jackrabbit-firsthops/src/main/resources/test.xml b/examples/jackrabbit-firsthops/src/main/resources/test.xml
new file mode 100644
index 00000000000..fdc026199ee
--- /dev/null
+++ b/examples/jackrabbit-firsthops/src/main/resources/test.xml
@@ -0,0 +1,68 @@
+
+
+
+ Three Namespaces
+
+
+ An Ellipse and a Rectangle
+
+
+
+
+ The equation for ellipses
+
+
+
+ 1
+
+
+
+
+
+
+ x
+ 2
+
+
+
+ a
+ 2
+
+
+
+
+
+
+ y
+ 2
+
+
+
+ b
+ 2
+
+
+
+
+
+
+ Last Modified January 10, 2002
+
+
diff --git a/jackrabbit-api/README.txt b/jackrabbit-api/README.txt
new file mode 100644
index 00000000000..c5b53a35cf9
--- /dev/null
+++ b/jackrabbit-api/README.txt
@@ -0,0 +1,8 @@
+=========================
+Welcome to Jackrabbit API
+=========================
+
+This is the API component of the Apache Jackrabbit project.
+This component contains the interface extensions that Apache
+Jackrabbit supports in addition to the standard JCR API. You can
+use these interfaces to access Jackrabbit-specific functionality.
diff --git a/jackrabbit-api/pom.xml b/jackrabbit-api/pom.xml
new file mode 100644
index 00000000000..e461edefbd5
--- /dev/null
+++ b/jackrabbit-api/pom.xml
@@ -0,0 +1,74 @@
+
+
+
+
+
+ 4.0.0
+
+
+
+
+
+ org.apache.jackrabbit
+ jackrabbit-parent
+ 2.17.5-SNAPSHOT
+ ../jackrabbit-parent/pom.xml
+
+ jackrabbit-api
+ Apache Jackrabbit API
+ Jackrabbit-specific extensions to the JCR API
+ bundle
+
+
+
+
+ org.apache.felix
+ maven-bundle-plugin
+ true
+
+
+ org.apache.rat
+ apache-rat-plugin
+
+
+ .checkstyle
+
+
+
+
+
+
+
+
+ javax.jcr
+ jcr
+
+
+ org.osgi
+ org.osgi.annotation
+ provided
+
+
+
+
+ org.jetbrains
+ annotations
+ 16.0.2
+
+
+
diff --git a/jackrabbit-api/src/main/appended-resources/META-INF/NOTICE b/jackrabbit-api/src/main/appended-resources/META-INF/NOTICE
new file mode 100644
index 00000000000..45e7de5ff36
--- /dev/null
+++ b/jackrabbit-api/src/main/appended-resources/META-INF/NOTICE
@@ -0,0 +1,2 @@
+Based on source code originally developed by
+Day Software (http://www.day.com/).
diff --git a/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/JackrabbitNode.java b/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/JackrabbitNode.java
new file mode 100644
index 00000000000..0895f9cc667
--- /dev/null
+++ b/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/JackrabbitNode.java
@@ -0,0 +1,50 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.api;
+
+import javax.jcr.RepositoryException;
+import javax.jcr.lock.LockException;
+import javax.jcr.nodetype.ConstraintViolationException;
+import javax.jcr.nodetype.NoSuchNodeTypeException;
+import javax.jcr.version.VersionException;
+
+/**
+ * The Jackrabbit Node interface. This interface contains the
+ * Jackrabbit-specific extensions to the JCR {@link javax.jcr.Node} interface.
+ */
+public interface JackrabbitNode {
+
+ /**
+ *
+ * @param newName
+ * @throws javax.jcr.RepositoryException
+ */
+ void rename(String newName) throws RepositoryException;
+
+ /**
+ *
+ * @param mixinNames
+ * @throws NoSuchNodeTypeException
+ * @throws VersionException
+ * @throws ConstraintViolationException
+ * @throws LockException
+ * @throws RepositoryException
+ */
+ void setMixins(String[] mixinNames)
+ throws NoSuchNodeTypeException, VersionException,
+ ConstraintViolationException, LockException, RepositoryException;
+}
diff --git a/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/JackrabbitNodeTypeManager.java b/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/JackrabbitNodeTypeManager.java
new file mode 100644
index 00000000000..9a14a3ba880
--- /dev/null
+++ b/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/JackrabbitNodeTypeManager.java
@@ -0,0 +1,88 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.api;
+
+import java.io.IOException;
+import java.io.InputStream;
+
+import javax.jcr.RepositoryException;
+import javax.jcr.nodetype.NodeType;
+import javax.jcr.nodetype.NodeTypeManager;
+
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+
+/**
+ * The Jackrabbit node type manager interface. This interface contains the
+ * Jackrabbit-specific extensions to the JCR {@link NodeTypeManager} interface.
+ *
+ * Currently Jackrabbit provides a mechanism to register new node types, but
+ * it is not possible to modify or remove existing node types.
+ *
+ * @deprecated Use standard JCR 2.0 API methods defined by
+ * {@link NodeTypeManager} instead.
+ */
+public interface JackrabbitNodeTypeManager extends NodeTypeManager {
+
+ /**
+ * The standard XML content type to be used with XML-formatted
+ * node type streams.
+ */
+ String TEXT_XML = "text/xml";
+
+ /**
+ * The experimental content type for the compact node type definition
+ * files.
+ */
+ String TEXT_X_JCR_CND = "text/x-jcr-cnd";
+
+ /**
+ * Registers node types from the given node type XML stream.
+ *
+ * @param in node type XML stream
+ * @return registered node types
+ * @throws SAXException if the XML stream could not be read or parsed
+ * @throws RepositoryException if the node types are invalid or another
+ * repository error occurs
+ */
+ NodeType[] registerNodeTypes(InputSource in)
+ throws SAXException, RepositoryException;
+
+ /**
+ * Registers node types from the given input stream of the given type.
+ *
+ * @param in node type stream
+ * @param contentType type of the input stream
+ * @return registered node types
+ * @throws IOException if the input stream could not be read or parsed
+ * @throws RepositoryException if the node types are invalid or another
+ * repository error occurs
+ */
+ NodeType[] registerNodeTypes(InputStream in, String contentType)
+ throws IOException, RepositoryException;
+
+ /**
+ * Checks if a node type with the given name is registered.
+ *
+ * @param name node type name
+ * @return true
if the named node type is registered
+ * false
otherwise
+ * @throws RepositoryException if an error occurs
+ */
+ boolean hasNodeType(String name) throws RepositoryException;
+
+}
diff --git a/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/JackrabbitRepository.java b/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/JackrabbitRepository.java
new file mode 100644
index 00000000000..9a84715789b
--- /dev/null
+++ b/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/JackrabbitRepository.java
@@ -0,0 +1,92 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.api;
+
+import java.util.Map;
+
+import javax.jcr.Credentials;
+import javax.jcr.LoginException;
+import javax.jcr.NoSuchWorkspaceException;
+import javax.jcr.Repository;
+import javax.jcr.RepositoryException;
+import javax.jcr.Session;
+
+/**
+ * The Jackrabbit repository interface. This interface contains the
+ * Jackrabbit-specific extensions to the JCR {@link Repository} interface.
+ */
+public interface JackrabbitRepository extends Repository {
+
+ /**
+ * Key to a boolean
descriptor. Returns true
if
+ * and only if user management is supported.
+ */
+ public static final String OPTION_USER_MANAGEMENT_SUPPORTED = "option.user.management.supported";
+
+ /**
+ * Key to a boolean
descriptor. Returns true
if
+ * and only if principal management is supported.
+ */
+ public static final String OPTION_PRINCIPAL_MANAGEMENT_SUPPORTED = "option.principal.management.supported";
+
+ /**
+ * Key to a boolean
descriptor. Returns true
if
+ * and only if privilege management is supported.
+ */
+ public static final String OPTION_PRIVILEGE_MANAGEMENT_SUPPORTED = "option.privilege.management.supported";
+
+ /**
+ * Equivalent to {@code login(credentials, workspaceName)} except that the returned
+ * Session instance contains the given extra session attributes in addition to any
+ * included in the given Credentials instance. Attribute names from the credentials
+ * and the attribute map must not overlap. In case of an overlap implementation
+ * may throw an RepositoryException
.
+ *
+ * The attributes are implementation-specific and may affect the behavior of the returned
+ * session. Unlike credentials attributes, these separately passed session attributes
+ * are guaranteed not to affect the authentication of the client.
+ *
+ * An implementation that does not support a particular session attribute is expected
+ * to ignore it and not make it available through the returned session. A client that
+ * depends on specific behavior defined by a particular attribute can check whether
+ * the returned session contains that attribute to verify whether the underlying
+ * repository implementation supports that feature.
+ *
+ * @param credentials the credentials of the user
+ * @param workspaceName the name of a workspace
+ * @param attributes implementation-specific session attributes
+ * @return a valid session for the user to access the repository
+ * @throws LoginException if authentication or authorization for the specified workspace fails
+ * @throws NoSuchWorkspaceException if the specified workspace is not recognized
+ * @throws RepositoryException if another error occurs
+ */
+ Session login(Credentials credentials, String workspaceName, Map attributes)
+ throws LoginException, NoSuchWorkspaceException, RepositoryException;
+
+ /**
+ * Shuts down the repository. A Jackrabbit repository instance contains
+ * a acquired resources and cached data that needs to be released and
+ * persisted when the repository is no longer used. This method handles
+ * all these shutdown tasks and must therefore be called by the
+ * client application once the repository instance is no longer used.
+ *
+ * Possible errors are logged rather than thrown as exceptions as there
+ * is little that a client application could do in such a case.
+ */
+ void shutdown();
+
+}
diff --git a/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/JackrabbitRepositoryFactory.java b/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/JackrabbitRepositoryFactory.java
new file mode 100644
index 00000000000..c96e5534dc9
--- /dev/null
+++ b/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/JackrabbitRepositoryFactory.java
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.api;
+
+import javax.jcr.RepositoryException;
+import javax.jcr.RepositoryFactory;
+import org.apache.jackrabbit.api.management.RepositoryManager;
+
+/**
+ * Classes that implement this interface additionally provide management features.
+ */
+public interface JackrabbitRepositoryFactory extends RepositoryFactory {
+
+ /**
+ * Get the repository management component. Only the factory that created
+ * the given repository may retrieve the manager.
+ *
+ * @param repository the repository to manage
+ * @return the manager
+ */
+ RepositoryManager getRepositoryManager(JackrabbitRepository repository) throws RepositoryException;
+
+}
diff --git a/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/JackrabbitSession.java b/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/JackrabbitSession.java
new file mode 100644
index 00000000000..1fe1c1d4c8b
--- /dev/null
+++ b/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/JackrabbitSession.java
@@ -0,0 +1,255 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.api;
+
+import org.apache.jackrabbit.api.security.user.UserManager;
+import org.apache.jackrabbit.api.security.principal.PrincipalManager;
+
+import javax.jcr.Item;
+import javax.jcr.Node;
+import javax.jcr.Property;
+import javax.jcr.Session;
+import javax.jcr.AccessDeniedException;
+import javax.jcr.RepositoryException;
+import javax.jcr.UnsupportedRepositoryOperationException;
+
+import org.jetbrains.annotations.NotNull;
+
+/**
+ * Jackrabbit specific extension of the JCR {@link javax.jcr.Session} interface.
+ */
+public interface JackrabbitSession extends Session {
+
+ /**
+ * A constant representing the {@code add_property} action string, used to
+ * determine if this {@code Session} has permission to add a new property.
+ *
+ * @see #hasPermission(String, String...)
+ */
+ String ACTION_ADD_PROPERTY = "add_property";
+
+ /**
+ * A constant representing the {@code modify_property} action string, used to
+ * determine if this {@code Session} has permission to modify a property.
+ *
+ * @see #hasPermission(String, String...)
+ */
+ String ACTION_MODIFY_PROPERTY = "modify_property";
+
+ /**
+ * A constant representing the {@code remove_property} action string, used to
+ * determine if this {@code Session} has permission to remove a property.
+ *
+ * @see #hasPermission(String, String...)
+ */
+ String ACTION_REMOVE_PROPERTY = "remove_property";
+
+ /**
+ * A constant representing the {@code remove_node} action string, used to
+ * determine if this {@code Session} has permission to remove a node.
+ *
+ * @see #hasPermission(String, String...)
+ */
+ String ACTION_REMOVE_NODE = "remove_node";
+
+ /**
+ * A constant representing the {@code node_type_management} action string,
+ * used to determine if this {@code Session} has permission to write
+ * node type information of a node.
+ *
+ * @see #hasPermission(String, String...)
+ */
+ String ACTION_NODE_TYPE_MANAGEMENT = "node_type_management";
+
+ /**
+ * A constant representing the {@code versioning} action string,
+ * used to determine if this {@code Session} has permission to perform
+ * version operations on a node.
+ *
+ * @see #hasPermission(String, String...)
+ */
+ String ACTION_VERSIONING = "versioning";
+
+ /**
+ * A constant representing the {@code locking} action string,
+ * used to determine if this {@code Session} has permission to lock or
+ * unlock a node.
+ *
+ * @see #hasPermission(String, String...)
+ */
+ String ACTION_LOCKING = "locking";
+
+ /**
+ * A constant representing the {@code read_access_control} action string,
+ * used to determine if this {@code Session} has permission to read
+ * access control content at the given path.
+ *
+ * @see #hasPermission(String, String...)
+ */
+ String ACTION_READ_ACCESS_CONTROL = "read_access_control";
+
+ /**
+ * A constant representing the {@code modify_access_control} action string,
+ * used to determine if this {@code Session} has permission to modify
+ * access control content at the given path.
+ *
+ * @see #hasPermission(String, String...)
+ */
+ String ACTION_MODIFY_ACCESS_CONTROL = "modify_access_control";
+
+ /**
+ * A constant representing the {@code user_management} action string,
+ * used to determine if this {@code Session} has permission to perform
+ * user management operations at the given path.
+ *
+ * @see #hasPermission(String, String...)
+ */
+ String ACTION_USER_MANAGEMENT = "user_management";
+
+ /**
+ * Returns {@code true} if this {@code Session} has permission to
+ * perform the specified actions at the specified {@code absPath} and
+ * {@code false} otherwise.
+ *
+ * The {@code actions} parameter is a list of action strings. Apart
+ * from the actions defined on {@link Session}, this variant also allows
+ * to specify the following additional actions to provide better permission
+ * discovery:
+ *
+ * - {@link
+ * #ACTION_ADD_PROPERTY {@code add_property}}: If {@code hasPermission(path,
+ * "add_property")} returns {@code true}, then this {@code Session} has
+ * permission to add a new property at {@code path}.
+ * - {@link #ACTION_MODIFY_PROPERTY {@code modify_property}}: If
+ * {@code hasPermission(path, "modify_property")} returns
+ * {@code true}, then this {@code Session} has permission to change
+ * a property at {@code path}.
+ * - {@link
+ * #ACTION_REMOVE_PROPERTY {@code remove_property}}: If {@code hasPermission(path,
+ * "remove_property")} returns {@code true}, then this {@code Session} has
+ * permission to remove a property at {@code path}.
+ * - {@link #ACTION_REMOVE_NODE {@code remove_node}}: If
+ * {@code hasPermission(path, "remove_node")} returns {@code true}, then
+ * this {@code Session} has permission to remove a node at {@code path}.
+ * - {@link #ACTION_NODE_TYPE_MANAGEMENT {@code node_type_management}}: If
+ * {@code hasPermission(path, "node_type_management")} returns {@code true}, then
+ * this {@code Session} has permission to explicitly set or change the node type
+ * information associated with a node at {@code path}.
+ * - {@link #ACTION_VERSIONING {@code versioning}}: If
+ * {@code hasPermission(path, "versioning")} returns {@code true}, then
+ * this {@code Session} has permission to perform version related operations
+ * on a node at {@code path}.
+ * - {@link #ACTION_LOCKING {@code locking}}: If
+ * {@code hasPermission(path, "locking")} returns {@code true}, then
+ * this {@code Session} has permission to lock and unlock a node at {@code path}.
+ * - {@link #ACTION_READ_ACCESS_CONTROL {@code read_access_control}}: If
+ * {@code hasPermission(path, "read_access_control")} returns {@code true}, then
+ * this {@code Session} has permission to read access control content stored
+ * at an item at {@code path}.
+ * - {@link #ACTION_MODIFY_ACCESS_CONTROL {@code modify_access_control}}: If
+ * {@code hasPermission(path, "modify_access_control")} returns {@code true}, then
+ * this {@code Session} has permission to modify access control content
+ * at an item at {@code path}.
+ * - {@link #ACTION_USER_MANAGEMENT {@code user_management}}: If
+ * {@code hasPermission(path, "user_management")} returns {@code true}, then
+ * this {@code Session} has permission to perform user management operations
+ * at an item at {@code path}.
+ *
+ *
+ * When more than one action is specified, this method will only return
+ * {@code true} if this {@code Session} has permission to perform all
+ * of the listed actions at the specified path.
+ *
+ * The information returned through this method will only reflect the permission
+ * status (both JCR defined and implementation-specific) and not
+ * other restrictions that may exist, such as node type or other
+ * implementation enforced constraints. For example, even though
+ * {@code hasPermission} may indicate that a particular {@code Session} may
+ * add a property at {@code /A/B/C}, the node type of the node at {@code /A/B}
+ * may prevent the addition of a property called {@code C}.
+ *
+ * @param absPath an absolute path.
+ * @param actions one or serveral actions.
+ * @return {@code true} if this {@code Session} has permission to
+ * perform the specified actions at the specified
+ * {@code absPath}.
+ * @throws RepositoryException if an error occurs.
+ * @see Session#hasPermission(String, String)
+ */
+ public boolean hasPermission(@NotNull String absPath, @NotNull String... actions) throws RepositoryException;
+
+ /**
+ * Returns the PrincipalManager
for the current Session
.
+ *
+ * @return the PrincipalManager
associated with this Session
.
+ * @throws AccessDeniedException If the session lacks privileges to access
+ * the principal manager or principals in general.
+ * @throws UnsupportedRepositoryOperationException If principal management
+ * is not supported.
+ * @throws RepositoryException If another error occurs.
+ * @see PrincipalManager
+ */
+ PrincipalManager getPrincipalManager() throws AccessDeniedException, UnsupportedRepositoryOperationException, RepositoryException;
+
+ /**
+ * Returns the UserManager
for the current Session
.
+ *
+ * @return the UserManager
associated with this Session
.
+ * @throws javax.jcr.AccessDeniedException If this session is not allowed to
+ * to access user data.
+ * @throws UnsupportedRepositoryOperationException If user management is
+ * not supported.
+ * @throws javax.jcr.RepositoryException If another error occurs.
+ * @see UserManager
+ */
+ UserManager getUserManager() throws AccessDeniedException, UnsupportedRepositoryOperationException, RepositoryException;
+
+ /**
+ * Returns the node at the specified absolute path in the workspace. If no
+ * such node exists, then it returns the property at the specified path.
+ * If no such property exists, then it return {@code null}.
+ *
+ * @param absPath An absolute path.
+ * @return the specified {@code Item} or {@code null}.
+ * @throws RepositoryException if another error occurs.
+ * @since 2.11.1
+ */
+ Item getItemOrNull(final String absPath) throws RepositoryException;
+
+ /**
+ * Returns the property at the specified absolute path in the workspace or
+ * {@code null} if no such node exists.
+ *
+ * @param absPath An absolute path.
+ * @return the specified {@code Property} or {@code null}.
+ * @throws RepositoryException if another error occurs.
+ * @since 2.11.1
+ */
+ Property getPropertyOrNull(final String absPath) throws RepositoryException;
+
+ /**
+ * Returns the node at the specified absolute path in the workspace or
+ * {@code null} if no such node exists.
+ *
+ * @param absPath An absolute path.
+ * @return the specified {@code Node} or {@code null}.
+ * @throws RepositoryException If another error occurs.
+ * @since 2.11.1
+ */
+ Node getNodeOrNull(final String absPath) throws RepositoryException;
+
+}
diff --git a/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/JackrabbitValue.java b/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/JackrabbitValue.java
new file mode 100644
index 00000000000..f458edec81f
--- /dev/null
+++ b/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/JackrabbitValue.java
@@ -0,0 +1,56 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.api;
+
+import javax.jcr.Value;
+
+/**
+ * Values returned by Jackrabbit may implement this interface. The interface
+ * defines optional features. An application should check if the returned value
+ * is of this type before casting as in:
+ *
+ * if (v instanceof JackrabbitValue) {
+ * JackrabbitValue j = (JackrabbitValue) v;
+ * ....
+ * }
+ *
+ */
+public interface JackrabbitValue extends Value {
+
+ /**
+ * Get a unique identifier of the content of this value. Usually this is a
+ * message digest of the content (a cryptographically secure one-way hash).
+ * This allows to avoid processing large binary values multiple times.
+ *
+ * This method returns null if the identifier is unknown. The identifier may
+ * not always be available, for example if the value has not yet been saved
+ * or processed. Once an identifier is available, it will never change
+ * because values are immutable.
+ *
+ * If two values have the same identifier, the content of the value is
+ * guaranteed to be the same. However it is not guaranteed that two values
+ * with the same content will return the same identifier.
+ *
+ * The identifier is opaque, meaning it can have any format and size, however
+ * it is at normally about 50 characters and at most 255 characters long.
+ * The string only contains Unicode code points from 32 to 127 (including).
+ *
+ * @return the unique identifier or null
+ */
+ String getContentIdentity();
+
+}
diff --git a/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/JackrabbitValueFactory.java b/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/JackrabbitValueFactory.java
new file mode 100644
index 00000000000..e03209a3592
--- /dev/null
+++ b/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/JackrabbitValueFactory.java
@@ -0,0 +1,188 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.jackrabbit.api;
+
+import javax.jcr.AccessDeniedException;
+import javax.jcr.Binary;
+import javax.jcr.RepositoryException;
+import javax.jcr.Session;
+import javax.jcr.ValueFactory;
+
+import org.apache.jackrabbit.api.binary.BinaryUpload;
+import org.apache.jackrabbit.api.binary.BinaryDownload;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+import org.osgi.annotation.versioning.ProviderType;
+
+/**
+ * Defines optional functionality that a {@link ValueFactory} may choose to
+ * provide. A {@link ValueFactory} may also implement this interface without
+ * supporting all of the capabilities in this interface. Each method of the
+ * interface describes the behavior of that method if the underlying capability
+ * is not available.
+ *
+ * Currently this interface defines the following optional features:
+ *
+ * - Direct Binary Access - enable a client to upload or download binaries
+ * directly to/from a storage location
+ *
+ *
+ * The features are described in more detail below.
+ *
+ *
Direct Binary Access
+ *
+ * The Direct Binary Access feature provides the capability for a client to
+ * upload or download binaries directly to/from a storage location. For
+ * example, this might be a cloud storage providing high-bandwidth direct
+ * network access. This API allows for requests to be authenticated and for
+ * access permission checks to take place within the repository, but for clients
+ * to then access the storage location directly.
+ *
+ * The feature consists of two parts, direct binary upload and direct binary
+ * download.
+ *
+ *
+ *
Direct Binary Upload
+ *
+ * This feature enables remote clients to upload binaries directly to a storage
+ * location.
+ *
+ * When adding binaries already present on the same JVM or server as Jackrabbit
+ * or Oak, for example because they were generated locally, please use the
+ * regular JCR API for {@link javax.jcr.Property#setValue(Binary) adding
+ * binaries through input streams} instead. This feature is solely designed for
+ * remote clients.
+ *
+ * The direct binary upload process is split into 3 phases:
+ *
+ * -
+ * Initialize: A remote client makes request to the
+ * Jackrabbit-based application to request an upload, which calls {@link
+ * #initiateBinaryUpload(long, int)} and returns the resulting {@link
+ * BinaryUpload information} to the remote client.
+ *
+ * -
+ * Upload: The remote client performs the actual binary upload
+ * directly to the binary storage provider. The {@link BinaryUpload}
+ * returned from the previous call to {@link
+ * #initiateBinaryUpload(long, int)} contains detailed instructions on
+ * how to complete the upload successfully. For more information, see
+ * the BinaryUpload documentation.
+ *
+ * -
+ * Complete: The remote client notifies the Jackrabbit-based
+ * application that step 2 is complete. The upload token returned in
+ * the first step (obtained by calling {@link
+ * BinaryUpload#getUploadToken()} is passed by the client to {@link
+ * #completeBinaryUpload(String)}. This will provide the application
+ * with a regular {@link Binary JCR Binary} that can then be used to
+ * write JCR content including the binary (such as an nt:file structure)
+ * and {@link Session#save() persist} it.
+ *
+ *
+ *
+ *
Direct Binary Download
+ *
+ * The direct binary download process is described in detail in {@link
+ * BinaryDownload}.
+ */
+@ProviderType
+public interface JackrabbitValueFactory extends ValueFactory {
+ /**
+ * Initiate a transaction to upload binary data directly to a storage
+ * location. {@link IllegalArgumentException} will be thrown if an upload
+ * cannot be supported for the required parameters, or if the parameters are
+ * otherwise invalid. For example, if the value of {@code maxSize} exceeds
+ * the size limits for a single binary upload for the implementation or the
+ * service provider, or if the value of {@code maxSize} divided by {@code
+ * maxParts} exceeds the size limit for an upload or upload part of the
+ * implementation or the service provider, {@link IllegalArgumentException}
+ * may be thrown.
+ *
+ * Each service provider has specific limitations on upload sizes,
+ * multi-part upload support, part sizes, etc. which can result in {@link
+ * IllegalArgumentException} being thrown. You should consult the
+ * documentation for your underlying implementation and your service
+ * provider for details.
+ *
+ * If this call is successful, a {@link BinaryUpload} is returned
+ * which contains the information a client needs to successfully complete
+ * a direct upload.
+ *
+ * @param maxSize The expected maximum size of the binary to be uploaded by
+ * the client. If the actual size of the binary is known, this
+ * size should be used; otherwise, the client should make a best
+ * guess. If a client calls this method with one size and then
+ * later determines that the guess was too small, the transaction
+ * should be restarted by calling this method again with the correct
+ * size.
+ * @param maxURIs The maximum number of upload URIs that the client can
+ * accept. The implementation will ensure that an upload of size
+ * {@code maxSize} can be completed by splitting the value of {@code
+ * maxSize} into parts, such that the size of the largest part does
+ * not exceed any known implementation or service provider
+ * limitations on upload part size and such that the number of parts
+ * does not exceed the value of {@code maxURIs}. If this is not
+ * possible, {@link IllegalArgumentException} will be thrown. A
+ * client may specify -1 for this value, indicating that any number
+ * of URIs may be returned.
+ * @return A {@link BinaryUpload} that can be used by the client to complete
+ * the upload via a call to {@link #completeBinaryUpload(String)},
+ * or {@code null} if the implementation does not support the direct
+ * upload feature.
+ * @throws IllegalArgumentException if the provided arguments are
+ * invalid or if a valid upload cannot be completed given the
+ * provided arguments.
+ * @throws AccessDeniedException if it is determined that insufficient
+ * permission exists to perform the upload.
+ */
+ @Nullable
+ BinaryUpload initiateBinaryUpload(long maxSize, int maxURIs)
+ throws IllegalArgumentException, AccessDeniedException;
+
+ /**
+ * Complete a transaction to upload binary data directly to a storage
+ * location. The client must provide a valid {@code uploadToken} that can
+ * only be obtained via a previous call to {@link
+ * #initiateBinaryUpload(long, int)}. If the {@code uploadToken} is
+ * unreadable or invalid, {@link IllegalArgumentException} will be thrown.
+ *
+ * Calling this method does not associate the returned {@link Binary} with
+ * any location in the repository. It is the responsibility of the client
+ * to do this if desired.
+ *
+ * The {@code uploadToken} can be obtained from the {@link
+ * BinaryUpload} returned from a prior call to {@link
+ * #initiateBinaryUpload(long, int)}. Clients should treat the {@code
+ * uploadToken} as an immutable string, and should expect that
+ * implementations will sign the string and verify the signature when this
+ * method is called.
+ *
+ * @param uploadToken A String that is used to identify the direct upload
+ * transaction.
+ * @return The uploaded {@link Binary}, or {@code null} if the
+ * implementation does not support the direct upload feature.
+ * @throws IllegalArgumentException if the {@code uploadToken} is
+ * unreadable or invalid.
+ * @throws RepositoryException if a repository access error occurs.
+ */
+ @Nullable
+ Binary completeBinaryUpload(@NotNull String uploadToken)
+ throws IllegalArgumentException, RepositoryException;
+}
diff --git a/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/JackrabbitWorkspace.java b/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/JackrabbitWorkspace.java
new file mode 100644
index 00000000000..fae4eb3911a
--- /dev/null
+++ b/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/JackrabbitWorkspace.java
@@ -0,0 +1,67 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.api;
+
+import org.apache.jackrabbit.api.security.authorization.PrivilegeManager;
+import org.xml.sax.InputSource;
+
+import javax.jcr.AccessDeniedException;
+import javax.jcr.RepositoryException;
+import javax.jcr.Workspace;
+
+/**
+ * The Jackrabbit workspace interface. This interface contains the
+ * Jackrabbit-specific extensions to the JCR {@link Workspace} interface.
+ */
+public interface JackrabbitWorkspace extends Workspace {
+
+ /**
+ * Creates a workspace with the given name.
+ *
+ * @param workspaceName name of the new workspace
+ * @throws AccessDeniedException if the current session is not allowed to
+ * create the workspace
+ * @throws RepositoryException if a workspace with the given name
+ * already exists or if another error occurs
+ * @see #getAccessibleWorkspaceNames()
+ */
+ void createWorkspace(String workspaceName)
+ throws AccessDeniedException, RepositoryException;
+
+ /**
+ * Creates a workspace with the given name and a workspace configuration
+ * template.
+ *
+ * @param workspaceName name of the new workspace
+ * @param workspaceTemplate the configuration template of the new workspace
+ * @throws AccessDeniedException if the current session is not allowed to
+ * create the workspace
+ * @throws RepositoryException if a workspace with the given name
+ * already exists or if another error occurs
+ * @see #getAccessibleWorkspaceNames()
+ */
+ void createWorkspace(String workspaceName, InputSource workspaceTemplate)
+ throws AccessDeniedException, RepositoryException;
+
+ /**
+ * Returns the privilege manager.
+ *
+ * @return the privilege manager.
+ * @throws RepositoryException If an error occurs.
+ */
+ PrivilegeManager getPrivilegeManager() throws RepositoryException;
+}
diff --git a/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/ReferenceBinary.java b/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/ReferenceBinary.java
new file mode 100644
index 00000000000..b4378e2d343
--- /dev/null
+++ b/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/ReferenceBinary.java
@@ -0,0 +1,39 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.api;
+
+import javax.jcr.Binary;
+
+/**
+ * Referenceable binary. In addition to the normal JCR {@link Binary}
+ * functionality, implementations of this class contain a secure
+ * reference to the storage location of the binary stream. This
+ * reference can be used to efficiently copy binaries across servers as
+ * long as both the source and target servers use the same underlying
+ * storage for binaries.
+ */
+public interface ReferenceBinary extends Binary {
+
+ /**
+ * Returns a secure reference to this binary, or {@code null} if such
+ * a reference is not available.
+ *
+ * @return binary reference, or {@code null}
+ */
+ String getReference();
+
+}
diff --git a/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/ReferenceBinaryException.java b/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/ReferenceBinaryException.java
new file mode 100644
index 00000000000..4ae0f3b2f9c
--- /dev/null
+++ b/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/ReferenceBinaryException.java
@@ -0,0 +1,27 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.api;
+
+import javax.jcr.RepositoryException;
+
+public class ReferenceBinaryException extends RepositoryException {
+
+ public ReferenceBinaryException(String message) {
+ super(message);
+ }
+
+}
diff --git a/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/XASession.java b/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/XASession.java
new file mode 100644
index 00000000000..efd0b3e7b73
--- /dev/null
+++ b/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/XASession.java
@@ -0,0 +1,48 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.api;
+
+import javax.jcr.Session;
+import javax.transaction.xa.XAResource;
+
+/**
+ * The XASession interface extends the capability of {@link Session} by adding
+ * access to a JCR repository's support for the Java Transaction API (JTA).
+ *
+ * This support takes the form of a {@link javax.transaction.xa.XAResource}
+ * object. The functionality of this object closely resembles that defined by
+ * the standard X/Open XA Resource interface.
+ *
+ * This interface is used by the transaction manager; an application does not
+ * use it directly.
+ *
+ * @since 1.4
+ * @deprecated An XA-enabled session should directly implement the
+ * {@link javax.transaction.xa.XAResource} interface
+ */
+public interface XASession extends Session {
+
+ /**
+ * Retrieves an {@link XAResource} object that the transaction manager
+ * will use to manage this XASession object's participation in
+ * a distributed transaction.
+ *
+ * @return the {@link XAResource} object.
+ */
+ XAResource getXAResource();
+
+}
diff --git a/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/binary/BinaryDownload.java b/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/binary/BinaryDownload.java
new file mode 100644
index 00000000000..cfd629c566e
--- /dev/null
+++ b/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/binary/BinaryDownload.java
@@ -0,0 +1,65 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.jackrabbit.api.binary;
+
+import java.net.URI;
+
+import javax.jcr.Binary;
+import javax.jcr.RepositoryException;
+
+import org.jetbrains.annotations.Nullable;
+import org.osgi.annotation.versioning.ProviderType;
+
+/**
+ * This extension interface provides a mechanism whereby a client can download
+ * a {@link Binary} directly from a storage location.
+ */
+@ProviderType
+public interface BinaryDownload extends Binary {
+ /**
+ * Get a URI for downloading a {@link Binary} directly from a storage
+ * location with the provided {@link BinaryDownloadOptions}. This is
+ * probably a signed URI with a short TTL (time to live), although the API
+ * does not require it to be so.
+ *
+ * The implementation will attempt to apply the specified {@code
+ * downloadOptions} to the subsequent download. For example, if the caller
+ * knows that the URI refers to a specific type of content, the caller can
+ * specify that content type by setting the internet media type and
+ * character encoding in the {@code downloadOptions}. The caller may also
+ * use a default instance obtained via {@link BinaryDownloadOptions#DEFAULT}
+ * in which case the caller is indicating that the default behavior of the
+ * service provider is acceptable.
+ *
+ * @param downloadOptions
+ * A {@link BinaryDownloadOptions} instance which is used to
+ * request specific options on the binary to be downloaded.
+ * {@link BinaryDownloadOptions#DEFAULT} should be used if the
+ * caller wishes to accept the service provider's default
+ * behavior.
+ * @return A URI for downloading the binary directly, or {@code null} if the
+ * binary cannot be downloaded directly or if the underlying
+ * implementation does not support this capability.
+ * @throws RepositoryException if an error occurs trying to locate the
+ * binary.
+ */
+ @Nullable
+ URI getURI(BinaryDownloadOptions downloadOptions)
+ throws RepositoryException;
+}
diff --git a/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/binary/BinaryDownloadOptions.java b/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/binary/BinaryDownloadOptions.java
new file mode 100644
index 00000000000..5a3680e2aab
--- /dev/null
+++ b/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/binary/BinaryDownloadOptions.java
@@ -0,0 +1,319 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.jackrabbit.api.binary;
+
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+import org.osgi.annotation.versioning.ProviderType;
+
+/**
+ * Specifies the options to be used when obtaining a direct download URI via
+ * {@link BinaryDownload#getURI(BinaryDownloadOptions)}. Setting these options
+ * allows the caller to instruct the service provider that these options should
+ * be applied to the response to a request made with the URI returned.
+ *
+ * To specify download options, obtain a {@link BinaryDownloadOptionsBuilder}
+ * via the {@link #builder()} method, then specify the options desired and
+ * get the object via {@link BinaryDownloadOptionsBuilder#build()}.
+ *
+ * If no options are needed, use {@link BinaryDownloadOptions#DEFAULT} which
+ * instructs the implementation to use the service provider default behavior.
+ */
+@ProviderType
+public final class BinaryDownloadOptions {
+ private final String mediaType;
+ private final String characterEncoding;
+ private final String fileName;
+ private final String dispositionType;
+
+ private BinaryDownloadOptions(final String mediaType,
+ final String characterEncoding,
+ final String fileName,
+ final String dispositionType) {
+ this.mediaType = mediaType;
+ this.characterEncoding = characterEncoding;
+ this.fileName = fileName;
+ this.dispositionType = dispositionType;
+ }
+
+ /**
+ * Provides a default instance of this class. Using the default instance
+ * indicates that the caller is willing to accept the service provider
+ * default behavior.
+ */
+ public static final BinaryDownloadOptions DEFAULT =
+ BinaryDownloadOptions.builder().build();
+
+ /**
+ * Returns the internet media type that should be assumed for the binary that is to be
+ * downloaded. This value should be a valid {@code jcr:mimeType}. This
+ * value can be set by calling {@link
+ * BinaryDownloadOptionsBuilder#withMediaType(String)} when building an
+ * instance of this class.
+ *
+ * @return A String representation of the internet media type, or {@code null} if no
+ * type has been specified.
+ * @see
+ * JCR 2.0 Repository Model - jcr:mimeType
+ */
+ @Nullable
+ public final String getMediaType() {
+ return mediaType;
+ }
+
+ /**
+ * Returns the character encoding that should be assumed for the binary that
+ * is to be downloaded. This value should be a valid {@code jcr:encoding}.
+ * It can be set by calling {@link
+ * BinaryDownloadOptionsBuilder#withCharacterEncoding(String)} when building an
+ * instance of this class.
+ *
+ * @return The character encoding, or {@code null} if no
+ * encoding has been specified.
+ * @see
+ * JCR 2.0 Repository Model - jcr:encoding
+ */
+ @Nullable
+ public final String getCharacterEncoding() {
+ return characterEncoding;
+ }
+
+ /**
+ * Returns the filename that should be assumed for the binary that is to be
+ * downloaded. This value can be set by calling {@link
+ * BinaryDownloadOptionsBuilder#withFileName(String)} when building an
+ * instance of this class.
+ *
+ * @return The file name, or {@code null} if no
+ * file name has been specified.
+ */
+ @Nullable
+ public final String getFileName() {
+ return fileName;
+ }
+
+ /**
+ * Returns the disposition type that should be assumed for the binary that
+ * is to be downloaded. This value can be set by calling {@link
+ * BinaryDownloadOptionsBuilder#withDispositionTypeInline()} or {@link
+ * BinaryDownloadOptionsBuilder#withDispositionTypeAttachment()} when
+ * building an instance of this class. The default value of this setting is
+ * "inline".
+ *
+ * @return The disposition type.
+ * @see RFC 6266, Section 4.2
+ */
+ @NotNull
+ public final String getDispositionType() {
+ return dispositionType;
+ }
+
+ /**
+ * Returns a {@link BinaryDownloadOptionsBuilder} instance to be used for
+ * creating an instance of this class.
+ *
+ * @return A builder instance.
+ */
+ @NotNull
+ public static BinaryDownloadOptionsBuilder builder() {
+ return new BinaryDownloadOptionsBuilder();
+ }
+
+ /**
+ * Used to build an instance of {@link BinaryDownloadOptions} with the
+ * options set as desired by the caller.
+ */
+ public static final class BinaryDownloadOptionsBuilder {
+ private String mediaType = null;
+ private String characterEncoding = null;
+ private String fileName = null;
+ private DispositionType dispositionType = DispositionType.INLINE;
+
+ private BinaryDownloadOptionsBuilder() { }
+
+ /**
+ * Sets the internet media type of the {@link BinaryDownloadOptions} object to be
+ * built. This value should be a valid {@code jcr:mimeType}.
+ *
+ * Calling this method has the effect of instructing the service
+ * provider to set {@code mediaType} as the internet media type
+ * in the {@code Content-Type} header field of the response to a request
+ * issued with a URI obtained by calling {@link
+ * BinaryDownload#getURI(BinaryDownloadOptions)}. This value can be
+ * later retrieved by calling {@link
+ * BinaryDownloadOptions#getMediaType()} on the instance returned from a
+ * call to {@link #build()}.
+ *
+ * Note that if the internet media type defines a "charset" parameter
+ * (as many textual types do), the caller may also wish to set the
+ * character encoding which is done separately. See {@link
+ * #withCharacterEncoding(String)}.
+ *
+ * The caller should ensure that the internet media type set is valid; the
+ * implementation does not perform any validation of this setting.
+ *
+ * If no internet media type is provided, no {@code Content-Type} header field will be
+ * specified to the service provider.
+ *
+ * @param mediaType The internet media type.
+ * @return The calling instance.
+ * @see
+ * JCR 2.0 Repository Model - jcr:mimeType
+ */
+ @NotNull
+ public BinaryDownloadOptionsBuilder withMediaType(@NotNull String mediaType) {
+ this.mediaType = mediaType;
+ return this;
+ }
+
+ /**
+ * Sets the character encoding of the {@link BinaryDownloadOptions} object to be
+ * built. This value should be a valid {@code jcr:encoding}.
+ *
+ * Calling this method has the effect of instructing the service
+ * provider to set {@code charecterEncoding} as the "charset" parameter
+ * of the content type in the {@code Content-Type} header field of the
+ * response to a request issued with a URI obtained by calling {@link
+ * BinaryDownload#getURI(BinaryDownloadOptions)}. This value can be
+ * later retrieved by calling {@link
+ * BinaryDownloadOptions#getCharacterEncoding()} on the instance returned by a
+ * call to {@link #build()}.
+ *
+ * Note that setting the character encoding only makes sense if the internet media type has
+ * also been set. See {@link
+ * #withMediaType(String)}.
+ *
+ * The caller should ensure that the proper character encoding has been set for
+ * the internet media type; the implementation does not perform any validation of
+ * these settings.
+ *
+ * @param characterEncoding A String representation of the jcr:encoding.
+ * @return The calling instance.
+ * @see
+ * JCR 2.0 Repository Model - jcr:encoding
+ */
+ @NotNull
+ public BinaryDownloadOptionsBuilder withCharacterEncoding(@NotNull String characterEncoding) {
+ this.characterEncoding = characterEncoding;
+ return this;
+ }
+
+ /**
+ * Sets the filename of the {@link BinaryDownloadOptions} object to be
+ * built.
+ *
+ * Calling this method has the effect of instructing the service
+ * provider to set {@code fileName} as the filename in the {@code
+ * Content-Disposition} header of the response to a request issued with
+ * a URI obtained by calling {@link
+ * BinaryDownload#getURI(BinaryDownloadOptions)}. This value can be
+ * later retrieved by calling {@link
+ * BinaryDownloadOptions#getFileName()} on the instance returned by a
+ * call to {@link #build()}.
+ *
+ *
+ * @param fileName The filename.
+ * @return The calling instance.
+ * @see RFC 6266, Section 4.3
+ */
+ @NotNull
+ public BinaryDownloadOptionsBuilder withFileName(@NotNull String fileName) {
+ this.fileName = fileName;
+ return this;
+ }
+
+ /**
+ * Sets the disposition type of the {@link BinaryDownloadOptions} object
+ * to be built to {@code inline}.
+ *
+ * Calling this method has the effect of instructing the service
+ * provider to set the disposition type in the {@code
+ * Content-Disposition} header of the response to {@code inline}. This
+ * value can be later retrieved by calling {@link
+ * BinaryDownloadOptions#getDispositionType()} on the instance built by
+ * calling {@link #build()}.
+ *
+ * If this value is not set, the default value of {@code inline}
+ * will be used.
+ *
+ * @return The calling instance.
+ */
+ @NotNull
+ public BinaryDownloadOptionsBuilder withDispositionTypeInline() {
+ dispositionType = DispositionType.INLINE;
+ return this;
+ }
+
+ /**
+ * Sets the disposition type of the {@link BinaryDownloadOptions} object
+ * to be built to {@code attachment}.
+ *
+ * Calling this method has the effect of instructing the service
+ * provider to set the disposition type in the {@code
+ * Content-Disposition} header of the response to {@code attachment}.
+ * This value can later be retrieved by calling {@link
+ * BinaryDownloadOptions#getDispositionType()} on the instance built by
+ * calling {@link #build()}.
+ *
+ * If this value is not set, the default value of {@code inline}
+ * will be used.
+ *
+ * @return The calling instance.
+ */
+ @NotNull
+ public BinaryDownloadOptionsBuilder withDispositionTypeAttachment() {
+ dispositionType = DispositionType.ATTACHMENT;
+ return this;
+ }
+
+ /**
+ * Construct a {@link BinaryDownloadOptions} instance with the
+ * properties specified to the builder.
+ *
+ * @return A new {@link BinaryDownloadOptions} instance built with the
+ * properties specified to the builder.
+ */
+ @NotNull
+ public BinaryDownloadOptions build() {
+ return new BinaryDownloadOptions(mediaType,
+ characterEncoding,
+ fileName,
+ null != dispositionType
+ ? dispositionType.toString()
+ : DispositionType.INLINE.toString()
+ );
+ }
+
+ private enum DispositionType {
+ INLINE("inline"),
+ ATTACHMENT("attachment");
+
+ private final String value;
+
+ DispositionType(final String value) {
+ this.value = value;
+ }
+
+ @Override
+ public String toString() {
+ return value;
+ }
+ }
+ }
+}
diff --git a/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/binary/BinaryUpload.java b/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/binary/BinaryUpload.java
new file mode 100644
index 00000000000..c6057806e3e
--- /dev/null
+++ b/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/binary/BinaryUpload.java
@@ -0,0 +1,211 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.jackrabbit.api.binary;
+
+import java.net.URI;
+
+import org.apache.jackrabbit.api.JackrabbitValueFactory;
+import org.jetbrains.annotations.NotNull;
+import org.osgi.annotation.versioning.ProviderType;
+
+/**
+ * This extension interface provides a mechanism whereby a client can upload a
+ * binary directly to a storage location. An object of this type can be
+ * created by a call to {@link
+ * JackrabbitValueFactory#initiateBinaryUpload(long, int)} which will return an
+ * object of this type if the underlying implementation supports direct upload
+ * functionality. When calling this method, the client indicates the expected
+ * size of the binary and the number of URIs that it is willing to accept. The
+ * implementation will attempt to create an instance of this class that is
+ * suited to enabling the client to complete the upload successfully.
+ *
+ * Using an instance of this class, a client can then use one or more of the
+ * included URIs for uploading the binary directly by calling {@link
+ * #getUploadURIs()} and iterating through the URIs returned. Multi-part
+ * uploads are supported by the interface, although they may not be supported
+ * by the underlying implementation.
+ *
+ * Once a client finishes uploading the binary data, the client must then call
+ * {@link JackrabbitValueFactory#completeBinaryUpload(String)} to complete the
+ * upload. This call requires an upload token which can be obtained from an
+ * instance of this class by calling {@link #getUploadToken()}.
+ *
+ * Below is the detailed direct binary upload algorithm for the remote client.
+ *
+ * In this example the following variables are used:
+ *
+ * - {@code fileSize}: the actual binary size (must be known at this
+ * point)
+ *
- {@code minPartSize}: the value from {@link #getMinPartSize()}
+ *
- {@code maxPartSize}: the value from {@link #getMaxPartSize()}
+ *
- {@code numUploadURIs}: the number of entries in {@link
+ * #getUploadURIs()}
+ *
- {@code uploadURIs}: the entries in {@link #getUploadURIs()}
+ *
- {@code partSize}: the part size to be used in the upload (to be
+ * determined in the algorithm)
+ *
+ *
+ * Steps:
+ *
+ * - If (fileSize divided by maxPartSize) is larger than numUploadURIs,
+ * then the client cannot proceed and will have to request a new set of URIs
+ * with the right fileSize as maxSize
+ *
- If fileSize is smaller than minPartSize, then take the first provided
+ * upload URI to upload the entire binary, with partSize = fileSize
+ * -
+ * (optional) If the client has more information to optimize, the
+ * partSize can be chosen, under the condition that all of these are
+ * true for the partSize:
+ *
+ * - larger than minPartSize
+ *
- smaller or equal than maxPartSize (unless it is -1 =
+ * unlimited)
+ *
- larger than fileSize divided by numUploadURIs
+ *
+ *
+ * - Otherwise all part URIs are to be used and the partSize = fileSize
+ * divided by numUploadURIs (integer division, discard modulo which will be
+ * the last part)
+ *
- Upload: segment the binary into partSize, for each segment take the
+ * next URI from uploadURIs (strictly in order), proceed with a standard
+ * HTTP PUT for each (for "http(s)" URIs, otherwise currently unspecified),
+ * and for the last part use whatever segment size is left
+ *
- If a segment fails during upload, retry (up to a certain time out)
+ *
- After the upload has finished successfully, notify the application,
+ * for example through a complete request, passing the {@link
+ * #getUploadToken() upload token}, and the application will call {@link
+ * JackrabbitValueFactory#completeBinaryUpload(String)} with the token
+ *
+ *
+ * JSON view
+ *
+ * A JSON representation of this interface as passed back to a remote client
+ * might look like this:
+ *
+ * {
+ * "uploadToken": "aaaa-bbbb-cccc-dddd-eeee-ffff-gggg-hhhh",
+ * "minPartSize": 10485760,
+ * "maxPartSize": 104857600,
+ * "uploadURIs": [
+ * "http://server.com/upload/1",
+ * "http://server.com/upload/2",
+ * "http://server.com/upload/3",
+ * "http://server.com/upload/4"
+ * ]
+ * }
+ *
+ * */
+@ProviderType
+public interface BinaryUpload {
+ /**
+ * Returns an Iterable of URIs that can be used for uploading binary data
+ * directly to a storage location. The first URI can be used for uploading
+ * binary data as a single entity, or multiple URIs can be used if the
+ * client wishes to do multi-part uploads.
+ *
+ * Clients are not necessarily required to use all of the URIs provided. A
+ * client may choose to use fewer, or even only one of the URIs. However,
+ * regardless of the number of URIs used, they must be consumed in sequence.
+ * For example, if a client wishes to upload a binary in three parts and
+ * there are five URIs returned, the client must use the first URI to
+ * upload the first part, the second URI to upload the second part, and
+ * the third URI to upload the third part. The client is not required to
+ * use the fourth and fifth URIs. However, using the second URI to upload
+ * the third part may result in either an upload failure or a corrupted
+ * upload; likewise, skipping the second URI to use subsequent URIs may
+ * result in either an upload failure or a corrupted upload.
+ *
+ * Clients should be aware that some storage providers have limitations on
+ * the minimum and maximum size of a binary payload for a single upload, so
+ * clients should take these limitations into account when deciding how many
+ * of the URIs to use. Underlying implementations may also choose to
+ * enforce their own limitations.
+ *
+ * While the API supports multi-part uploading via multiple upload URIs,
+ * implementations are not required to support multi-part uploading. If the
+ * underlying implementation does not support multi-part uploading, a single
+ * URI will be returned regardless of the size of the data being uploaded.
+ *
+ * Some storage providers also support multi-part uploads by reusing a
+ * single URI multiple times, in which case the implementation may also
+ * return a single URI regardless of the size of the data being uploaded.
+ *
+ * You should consult both the DataStore implementation documentation and
+ * the storage service provider documentation for details on such matters as
+ * multi-part upload support, upload minimum and maximum sizes, etc.
+ *
+ * @return Iterable of URIs that can be used for uploading directly to a
+ * storage location.
+ */
+ @NotNull
+ Iterable getUploadURIs();
+
+ /**
+ * The smallest part size a client may upload for a multi-part upload, not
+ * counting the final part. This is usually either a service provider or
+ * implementation limitation.
+ *
+ * Note that the API offers no guarantees that uploading parts of this size
+ * can successfully complete the requested upload using the URIs provided
+ * via {@link #getUploadURIs()}. In other words, clients wishing to perform
+ * a multi-part upload must split the upload into parts of at least this
+ * size, but the sizes may need to be larger in order to successfully
+ * complete the upload.
+ *
+ * @return The smallest size acceptable for multi-part uploads.
+ */
+ long getMinPartSize();
+
+ /**
+ * The largest part size a client may upload for a multi-part upload. This
+ * is usually either a service provider or implementation limitation.
+ *
+ * The API guarantees that a client can successfully complete a direct
+ * upload of the binary data of the requested size using the provided URIs
+ * by splitting the binary data into parts of the size returned by this
+ * method.
+ *
+ * The client is not required to use part sizes of this size; smaller sizes
+ * may be used so long as they are at least as large as the size returned by
+ * {@link #getMinPartSize()}.
+ *
+ * If the binary size specified by a client when calling {@link
+ * JackrabbitValueFactory#initiateBinaryUpload(long, int)} ends up being
+ * smaller than the actual size of the binary being uploaded, these API
+ * guarantees no longer apply, and it may not be possible to complete the
+ * upload using the URIs provided. In such cases, the client should restart
+ * the transaction using the correct size.
+ *
+ * @return The maximum size of an upload part for multi-part uploads.
+ */
+ long getMaxPartSize();
+
+ /**
+ * Returns the upload token to be used in a subsequent call to {@link
+ * JackrabbitValueFactory#completeBinaryUpload(String)}. This upload token
+ * is used by the implementation to identify this upload. Clients should
+ * treat the upload token as an immutable string, as the underlying
+ * implementation may choose to implement techniques to detect tampering and
+ * reject the upload if the token is modified.
+ *
+ * @return This upload's unique upload token.
+ */
+ @NotNull
+ String getUploadToken();
+}
diff --git a/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/binary/package-info.java b/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/binary/package-info.java
new file mode 100755
index 00000000000..62ebbfa00d0
--- /dev/null
+++ b/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/binary/package-info.java
@@ -0,0 +1,26 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+/**
+ * Interfaces related to direct upload/download of binaries.
+ */
+@Version("1.0.0")
+package org.apache.jackrabbit.api.binary;
+
+import org.osgi.annotation.versioning.Version;
\ No newline at end of file
diff --git a/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/jmx/EventListenerMBean.java b/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/jmx/EventListenerMBean.java
new file mode 100644
index 00000000000..cee8df6dafc
--- /dev/null
+++ b/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/jmx/EventListenerMBean.java
@@ -0,0 +1,123 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.api.jmx;
+
+import javax.management.openmbean.CompositeData;
+
+/**
+ * MBean interface for exposing information about a registered observation
+ * listener.
+ *
+ * @see JCR-3608
+ */
+public interface EventListenerMBean {
+
+ /** Class name of the event listener */
+ String getClassName();
+
+ /** toString of the event listener */
+ String getToString();
+
+ /** Stack trace of where the listener was registered */
+ String getInitStackTrace();
+
+ /** Event types of the listener registration */
+ int getEventTypes();
+
+ /** Absolute path of the listener registration */
+ String getAbsPath();
+
+ /** Whether the listener registration is deep */
+ boolean isDeep();
+
+ /** UUIDs of the listener registration */
+ String[] getUuid();
+
+ /** Node types of the listener registration */
+ String[] getNodeTypeName();
+
+ /** Whether the listener registration is non-local */
+ boolean isNoLocal();
+
+ /** Number of {@code onEvent()} calls made on the listener */
+ long getEventDeliveries();
+
+ /** Average number of {@code onEvent()} calls per hour */
+ long getEventDeliveriesPerHour();
+
+ /** Average time (in microseconds) taken per {@code onEvent()} call */
+ long getMicrosecondsPerEventDelivery();
+
+ /** Number of individual events delivered to the listener */
+ long getEventsDelivered();
+
+ /** Average number of individual events delivered per hour */
+ long getEventsDeliveredPerHour();
+
+ /** Average time (in microseconds) taken per event delivered */
+ long getMicrosecondsPerEventDelivered();
+
+ /** Ratio of time spent in event processing */
+ double getRatioOfTimeSpentProcessingEvents();
+
+ /** Ratio of time spent in event listener vs. the overall event processing */
+ double getEventConsumerTimeRatio();
+
+ /** Is user information accessed without checking if an event is external? */
+ boolean isUserInfoAccessedWithoutExternalsCheck();
+
+ /** Is user information accessed from an external event? */
+ boolean isUserInfoAccessedFromExternalEvent();
+
+ /** Is date information accessed without checking if an event is external? */
+ boolean isDateAccessedWithoutExternalsCheck();
+
+ /** Is date information accessed from an external event? */
+ boolean isDateAccessedFromExternalEvent();
+
+ /**
+ * The time difference between the current system time and the head (oldest)
+ * element in the queue in milliseconds. This method returns zero if the
+ * queue is empty.
+ */
+ long getQueueBacklogMillis();
+
+ /**
+ * {@link org.apache.jackrabbit.api.stats.TimeSeries time series} of the number of
+ * items related to generating observation events that are currently queued by the
+ * system. The exact nature of these items is implementation specific and might not
+ * be in a one to one relation with the number of pending JCR events.
+ * @return time series of the queue length
+ */
+ CompositeData getQueueLength();
+
+ /**
+ * @return time series of the number of JCR events
+ */
+ CompositeData getEventCount();
+
+ /**
+ * @return time series of the time it took an event listener to process JCR events.
+ */
+ CompositeData getEventConsumerTime();
+
+ /**
+ * @return time series of the time it took the system to produce JCR events.
+ */
+ CompositeData getEventProducerTime();
+
+}
diff --git a/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/jmx/ManagedRepositoryMBean.java b/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/jmx/ManagedRepositoryMBean.java
new file mode 100644
index 00000000000..751667af16e
--- /dev/null
+++ b/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/jmx/ManagedRepositoryMBean.java
@@ -0,0 +1,68 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.api.jmx;
+
+import java.util.Map;
+
+import javax.jcr.RepositoryException;
+
+/**
+ * Interface for managing a JCR repository as a JMX MBean.
+ *
+ * @since Apache Jackrabbit 2.3
+ */
+public interface ManagedRepositoryMBean {
+
+ /**
+ * Returns the name of this repository implementation.
+ *
+ * @see javax.jcr.Repository#REP_NAME_DESC
+ * @return name of this repository implementation
+ */
+ String getName();
+
+ /**
+ * Returns the version of this repository implementation.
+ *
+ * @see javax.jcr.Repository#REP_VERSION_DESC
+ * @return version of this repository implementation
+ */
+ String getVersion();
+
+ /**
+ * Returns all the repository descriptors.
+ *
+ * @return repository descriptors
+ */
+ Map getDescriptors();
+
+ /**
+ * Returns the names of all the workspaces in this repository.
+ *
+ * @return workspace names
+ */
+ String[] getWorkspaceNames();
+
+ /**
+ * Creates a new workspace with the given name.
+ *
+ * @param name workspace name
+ * @throws RepositoryException if the workspace could not be created
+ */
+ void createWorkspace(String name) throws RepositoryException;
+
+}
diff --git a/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/jmx/QueryStatManagerMBean.java b/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/jmx/QueryStatManagerMBean.java
new file mode 100644
index 00000000000..8cbd23d25d0
--- /dev/null
+++ b/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/jmx/QueryStatManagerMBean.java
@@ -0,0 +1,79 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.api.jmx;
+
+import javax.management.openmbean.TabularData;
+
+import org.apache.jackrabbit.api.stats.QueryStat;
+
+/**
+ * JMX Bindings for {@link QueryStat}.
+ *
+ */
+public interface QueryStatManagerMBean {
+
+ String NAME = "org.apache.jackrabbit:type=QueryStats";
+
+ /**
+ * @return a sorted array containing the top
+ * {@link #getSlowQueriesQueueSize()} slowest queries
+ */
+ TabularData getSlowQueries();
+
+ /**
+ * @return a sorted array containing the
+ * {@link #getPopularQueriesQueueSize()} most popular queries
+ */
+ TabularData getPopularQueries();
+
+ /**
+ * @return size of the Slow queue
+ */
+ int getSlowQueriesQueueSize();
+
+ /**
+ * Change the size of the Slow queue
+ *
+ * @param size
+ * the new size
+ */
+ void setSlowQueriesQueueSize(int size);
+
+ /**
+ * clears the Slow queue
+ */
+ void clearSlowQueriesQueue();
+
+ /**
+ * @return size of the Popular queue
+ */
+ int getPopularQueriesQueueSize();
+
+ /**
+ * Change the size of the Popular queue
+ *
+ * @param size
+ * the new size
+ */
+ void setPopularQueriesQueueSize(int size);
+
+ /**
+ * clears the Popular queue
+ */
+ void clearPopularQueriesQueue();
+
+}
diff --git a/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/jmx/package-info.java b/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/jmx/package-info.java
new file mode 100644
index 00000000000..c83550c8116
--- /dev/null
+++ b/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/jmx/package-info.java
@@ -0,0 +1,22 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * JMX management interfaces for JCR.
+ */
+@org.osgi.annotation.versioning.Version("2.3.0")
+package org.apache.jackrabbit.api.jmx;
diff --git a/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/management/DataStoreGarbageCollector.java b/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/management/DataStoreGarbageCollector.java
new file mode 100644
index 00000000000..3b5061dca9a
--- /dev/null
+++ b/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/management/DataStoreGarbageCollector.java
@@ -0,0 +1,106 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.api.management;
+
+import javax.jcr.RepositoryException;
+
+/**
+ * Garbage collector for DataStore. This implementation iterates through all
+ * nodes and reads the binary properties. To detect nodes that are moved while
+ * the scan runs, event listeners are started. Like the well known garbage
+ * collection in Java, the items that are still in use are marked. Currently
+ * this is achieved by updating the modified date of the entries. Newly added
+ * entries are detected because the modified date is changed when they are
+ * added.
+ *
+ * Example code to run the data store garbage collection:
+ *
+ * JackrabbitRepositoryFactory jf = (JackrabbitRepositoryFactory) factory;
+ * RepositoryManager m = jf.getRepositoryManager((JackrabbitRepository) repository);
+ * GarbageCollector gc = m.createDataStoreGarbageCollector();
+ * gc.mark();
+ * gc.sweep();
+ *
+ */
+public interface DataStoreGarbageCollector {
+
+ /**
+ * Set the delay between scanning items.
+ * The main scan loop sleeps this many milliseconds after
+ * scanning a node. The default is 0, meaning the scan should run at full speed.
+ *
+ * @param millis the number of milliseconds to sleep
+ */
+ void setSleepBetweenNodes(long millis);
+
+ /**
+ * Get the delay between scanning items.
+ *
+ * @return the number of milliseconds to sleep
+ */
+ long getSleepBetweenNodes();
+
+ /**
+ * Set the event listener. If set, the event listener will be called
+ * for each item that is scanned. This mechanism can be used
+ * to display the progress.
+ *
+ * @param callback if set, this is called while scanning
+ */
+ void setMarkEventListener(MarkEventListener callback);
+
+ /**
+ * Enable or disable using the IterablePersistenceManager interface
+ * to scan the items. This is important for clients that need
+ * the complete Node implementation in the ScanEventListener
+ * callback.
+ *
+ * @param allow true if using the IterablePersistenceManager interface is allowed
+ */
+ void setPersistenceManagerScan(boolean allow);
+
+ /**
+ * Check if using the IterablePersistenceManager interface is allowed.
+ *
+ * @return true if using IterablePersistenceManager is possible.
+ */
+ boolean isPersistenceManagerScan();
+
+ /**
+ * Scan the repository. The garbage collector will iterate over all nodes in the repository
+ * and update the last modified date. If all persistence managers implement the
+ * IterablePersistenceManager interface, this mechanism is used; if not, the garbage
+ * collector scans the repository using the JCR API starting from the root node.
+ *
+ * @throws RepositoryException
+ */
+ void mark() throws RepositoryException;
+
+ /**
+ * Delete all unused items in the data store.
+ *
+ * @return the number of deleted items
+ * @throws RepositoryException
+ */
+ int sweep() throws RepositoryException;
+
+ /**
+ * Cleanup resources used internally by this instance.
+ */
+ void close();
+
+}
diff --git a/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/management/MarkEventListener.java b/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/management/MarkEventListener.java
new file mode 100644
index 00000000000..5b5d2a7c9d2
--- /dev/null
+++ b/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/management/MarkEventListener.java
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.api.management;
+
+import javax.jcr.Node;
+import javax.jcr.RepositoryException;
+
+/**
+ * The listener interface for receiving garbage collection scan events.
+ */
+public interface MarkEventListener {
+
+ /**
+ * This method is called before a node is scanned.
+ *
+ * @param node node to be scanned
+ */
+ void beforeScanning(Node node) throws RepositoryException;
+
+}
\ No newline at end of file
diff --git a/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/management/RepositoryManager.java b/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/management/RepositoryManager.java
new file mode 100644
index 00000000000..2db260c4a9a
--- /dev/null
+++ b/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/management/RepositoryManager.java
@@ -0,0 +1,50 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.api.management;
+
+import javax.jcr.RepositoryException;
+
+/**
+ * The repository manager provides life-cycle management features for
+ * repositories.
+ *
+ * Not all implementations are required to implement all features,
+ * for example some implementations may not support starting a repository after
+ * is has been stopped.
+ */
+public interface RepositoryManager {
+
+ /**
+ * Shuts down the repository. A Jackrabbit repository instance contains
+ * a acquired resources and cached data that needs to be released and
+ * persisted when the repository is no longer used. This method handles
+ * all these shutdown tasks and should therefore be called by the
+ * client application once the repository instance is no longer used.
+ *
+ * Possible errors are logged rather than thrown as exceptions as there
+ * is little that a client application could do in such a case.
+ */
+ void stop();
+
+ /**
+ * Create a data store garbage collector for this repository.
+ *
+ * @return the data store garbage collector if the data store is enabled, null otherwise
+ */
+ DataStoreGarbageCollector createDataStoreGarbageCollector() throws RepositoryException;
+
+}
diff --git a/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/management/package-info.java b/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/management/package-info.java
new file mode 100644
index 00000000000..abfc83d03d3
--- /dev/null
+++ b/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/management/package-info.java
@@ -0,0 +1,22 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * Interfaces for managing a Jackrabbit repository.
+ */
+@org.osgi.annotation.versioning.Version("2.3.1")
+package org.apache.jackrabbit.api.management;
diff --git a/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/observation/JackrabbitEvent.java b/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/observation/JackrabbitEvent.java
new file mode 100644
index 00000000000..a7e7a05b448
--- /dev/null
+++ b/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/observation/JackrabbitEvent.java
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.api.observation;
+
+import javax.jcr.observation.Event;
+
+/**
+ * This is an extension of the event interface which provides
+ * a method to detect whether the changes happened on locally
+ * or remotely in a clustered environment.
+ */
+public interface JackrabbitEvent extends Event {
+
+ /**
+ * Return a flag indicating whether this is an externally generated event.
+ *
+ * @return true
if this is an external event;
+ * false
otherwise
+ */
+ boolean isExternal();
+}
diff --git a/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/observation/JackrabbitEventFilter.java b/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/observation/JackrabbitEventFilter.java
new file mode 100644
index 00000000000..be63fbebcb4
--- /dev/null
+++ b/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/observation/JackrabbitEventFilter.java
@@ -0,0 +1,309 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.api.observation;
+
+import static java.util.Arrays.copyOf;
+
+/**
+ * A storage object for event filter configuration.
+ *
+ * The parameters of the filter can then be set by chaining the set methods,
+ * since each method returns the same EventFilter
with the indicated parameter set.
+ *
+ * Once the filter is configured, it and an {@link javax.jcr.observation.EventListener} object are
+ * passed to
+ * {@link org.apache.jackrabbit.api.observation.JackrabbitObservationManager#addEventListener(javax.jcr.observation.EventListener, JackrabbitEventFilter)}.
+ *
+ * The filter restricts which events are sent to the EventListener
according to the
+ * following parameters. Note that the term associated parent node of an event means the
+ * parent node of the item at (or formerly at) the path returned by
+ * {@link javax.jcr.observation.Event#getPath}.
+ *
+ * -
+ *
eventTypes
:
+ * A bitwise OR
of the event types to be listened to. See
+ * {@link javax.jcr.observation.Event} for details.
+ *
+ * -
+ *
absPath
, absPaths
, excludedPaths
,
+ * isDeep
: Only events whose associated parent node is at one
+ * of the paths in absPath
or absPaths
(or within
+ * its subgraph, if isDeep
is true
) will be received
+ * except if the associated parent node is at one of the paths in
+ * excludedPaths
or its subgraph.
+ * It is permissible to register a listener for a path where no node currently
+ * exists.
+ *
+ * -
+ *
uuid
:
+ * Only events whose associated parent node has one of
+ * the identifiers in this list will be received. If his parameter is
+ * null
then no identifier-related restriction is placed on
+ * events received. Note that specifying an empty array instead of
+ * null
would result in no nodes being listened to. The term
+ * "UUID" is used for compatibility with JCR 1.0.
+ *
+ * -
+ *
nodeTypeName
:
+ * Only events whose associated parent node has
+ * one of the node types (or a subtype of one of the node types) in this
+ * list will be received. If his parameter is null
then no node
+ * type-related restriction is placed on events received. Note that
+ * specifying an empty array instead of null
would result in no
+ * nodes types being listened to.
+ *
+ * -
+ *
noLocal
: if true
, then events
+ * generated by the session through which the listener was registered are
+ * ignored. Otherwise, they are not ignored.
+ *
+ * -
+ *
noExternal
: if true
, then events
+ * from external cluster nodes are ignored. Otherwise, they are not ignored.
+ *
+ * -
+ *
noInternal
: if true
, then events
+ * from this cluster node are ignored. Otherwise, they are not ignored.
+ *
+ *
+ * The restrictions are "ANDed" together. In other words, for a particular node to be "listened to" it
+ * must meet all the restrictions.
+ *
+ */
+public class JackrabbitEventFilter { // TODO extends EventFilter once JCR 2.1 is out
+ private int eventTypes;
+ private String absPath;
+ private boolean isDeep;
+ private String[] identifiers;
+ private String[] nodeTypeNames;
+ private boolean noLocal;
+ private String[] absPaths = new String[]{};
+ private String[] excludedPaths = new String[]{};
+ private boolean noExternal;
+ private boolean noInternal;
+
+ /**
+ * Sets the eventTypes
parameter of the filter.
+ * If left unset, this parameter defaults to 0
.
+ *
+ * @param eventTypes an int
.
+ * @return This EventFilter object with the eventTypes
parameter set.
+ */
+ public JackrabbitEventFilter setEventTypes(int eventTypes) {
+ this.eventTypes = eventTypes;
+ return this;
+ }
+
+ /**
+ * Returns the eventTypes
parameter of the filter.
+ *
+ * @return an int
.
+ */
+ public int getEventTypes() {
+ return eventTypes;
+ }
+
+ /**
+ * Sets the absPath
parameter of the filter.
+ * If left unset, this parameter defaults to null
.
+ *
+ * @param absPath an absolute path String
.
+ * @return This EventFilter object with the absPath
parameter set.
+ */
+ public JackrabbitEventFilter setAbsPath(String absPath) {
+ this.absPath = absPath;
+ return this;
+ }
+
+ /**
+ * Returns the absPath
parameter of the filter.
+ *
+ * @return a String
.
+ */
+ public String getAbsPath() {
+ return absPath;
+ }
+
+ /**
+ * Sets the isDeep
parameter of the filter.
+ * If left unset, this parameter defaults to false
.
+ *
+ * @param isDeep a boolean
.
+ * @return This EventFilter object with the isDeep
parameter set.
+ */
+ public JackrabbitEventFilter setIsDeep(boolean isDeep) {
+ this.isDeep = isDeep;
+ return this;
+ }
+
+ /**
+ * Returns the isDeep
parameter of the filter.
+ *
+ * @return a boolean
.
+ */
+ public boolean getIsDeep() {
+ return isDeep;
+ }
+
+ /**
+ * Sets the identifiers
parameter of the filter.
+ * If left unset, this parameter defaults to null
.
+ *
+ * @param identifiers a String
array.
+ * @return This EventFilter object with the identifiers
parameter set.
+ */
+ public JackrabbitEventFilter setIdentifiers(String[] identifiers) {
+ this.identifiers = copyOf(identifiers, identifiers.length);
+ return null;
+ }
+
+ /**
+ * Returns the uuids
parameter of the filter.
+ *
+ * @return a String
array.
+ */
+ public String[] getIdentifiers() {
+ return identifiers == null ? null : copyOf(identifiers, identifiers.length);
+ }
+
+ /**
+ * Sets the nodeTypeNames
parameter of the filter.
+ * If left unset, this parameter defaults to null
.
+ *
+ * @param nodeTypeNames a String
array.
+ * @return This EventFilter object with the nodeTypes
parameter set.
+ */
+ public JackrabbitEventFilter setNodeTypes(String[] nodeTypeNames) {
+ this.nodeTypeNames = copyOf(nodeTypeNames, nodeTypeNames.length);
+ return this;
+ }
+
+ /**
+ * Returns the nodeTypeName
parameter of the filter.
+ *
+ * @return a String
array.
+ */
+ public String[] getNodeTypes() {
+ return nodeTypeNames == null ? null : copyOf(nodeTypeNames, nodeTypeNames.length);
+ }
+
+ /**
+ * Sets the noLocal
parameter of the filter.
+ * If left unset, this parameter defaults to false
.
+ *
+ * @param noLocal a boolean
.
+ * @return This EventFilter object with the noLocal
parameter set.
+ */
+ public JackrabbitEventFilter setNoLocal(boolean noLocal) {
+ this.noLocal = noLocal;
+ return this;
+ }
+
+ /**
+ * Returns the noLocal
parameter of the filter.
+ *
+ * @return a boolean
.
+ */
+ public boolean getNoLocal() {
+ return noLocal;
+ }
+
+ /**
+ * Sets the absPaths
parameter of the filter.
+ * If left unset, this parameter defaults to an empty array.
+ *
+ * @param absPaths an absolute path String
array.
+ * @return This EventFilter object with the absPaths
parameter set.
+ */
+ public JackrabbitEventFilter setAdditionalPaths(String... absPaths) {
+ this.absPaths = copyOf(absPaths, absPaths.length);
+ return this;
+ }
+
+ /**
+ * Returns the absPaths
parameter of the filter.
+ *
+ * @return a String
array.
+ */
+ public String[] getAdditionalPaths() {
+ return copyOf(absPaths, absPaths.length);
+ }
+
+ /**
+ * Sets the excludedPaths
parameter of the filter.
+ * If left unset, this parameter defaults to an empty array.
+ *
+ * @param excludedPaths an absolute path String
array.
+ * @return This EventFilter object with the excludedPaths
parameter set.
+ */
+ public JackrabbitEventFilter setExcludedPaths(String... excludedPaths) {
+ this.excludedPaths = copyOf(excludedPaths, excludedPaths.length);
+ return this;
+ }
+
+ /**
+ * Returns the excludedPaths
parameter of the filter.
+ *
+ * @return a String
array.
+ */
+ public String[] getExcludedPaths() {
+ return copyOf(excludedPaths, excludedPaths.length);
+ }
+
+ /**
+ * Sets the noExternal
parameter of the filter.
+ * If left unset, this parameter defaults to false
.
+ *
+ * @param noExternal a boolean
.
+ * @return This EventFilter object with the noExternal
parameter set.
+ */
+ public JackrabbitEventFilter setNoExternal(boolean noExternal) {
+ this.noExternal = noExternal;
+ return this;
+ }
+
+ /**
+ * Returns the noExternal
parameter of the filter.
+ *
+ * @return a boolean
.
+ */
+ public boolean getNoExternal() {
+ return noExternal;
+ }
+
+ /**
+ * Sets the noInternal
parameter of the filter.
+ * If left unset, this parameter defaults to false
.
+ *
+ * @param noInternal a boolean
.
+ * @return This EventFilter object with the noExternal
parameter set.
+ */
+ public JackrabbitEventFilter setNoInternal(boolean noInternal) {
+ this.noInternal = noInternal;
+ return this;
+ }
+
+ /**
+ * Returns the noInternal
parameter of the filter.
+ *
+ * @return a boolean
.
+ */
+ public boolean getNoInternal() {
+ return noInternal;
+ }
+
+}
\ No newline at end of file
diff --git a/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/observation/JackrabbitObservationManager.java b/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/observation/JackrabbitObservationManager.java
new file mode 100644
index 00000000000..122ad5aa8e9
--- /dev/null
+++ b/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/observation/JackrabbitObservationManager.java
@@ -0,0 +1,55 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.api.observation;
+
+import javax.jcr.RepositoryException;
+import javax.jcr.observation.EventListener;
+import javax.jcr.observation.ObservationManager;
+
+/**
+ * Jackrabbit specific extensions to {@link javax.jcr.observation.ObservationManager}.
+ */
+public interface JackrabbitObservationManager extends ObservationManager {
+
+ /**
+ * Adds an event listener that listens for the events specified
+ * by the passed {@link JackrabbitEventFilter}.
+ *
+ * In addition to the EventFilter
, the set of events reported
+ * will be further filtered by the access rights of the
+ * current Session
.
+ *
+ * See {@link JackrabbitEventFilter} for a description of the filtering parameters available.
+ *
+ * The filter of an already-registered EventListener
can be
+ * changed at runtime by re-registering the same EventListener
+ * object (i.e. the same actual Java object) with a new filter.
+ * The implementation must ensure that no events are lost during the changeover.
+ *
+ * In addition to the filters placed on a listener above, the scope of
+ * observation support, in terms of which parts of a workspace are observable, may also
+ * be subject to implementation-specific restrictions. For example, in some
+ * repositories observation of changes in the jcr:system
+ * subgraph may not be supported.
+ *
+ * @param listener an {@link EventListener} object.
+ * @param filter an {@link JackrabbitEventFilter} object.
+ * @throws RepositoryException If an error occurs.
+ */
+ void addEventListener(EventListener listener, JackrabbitEventFilter filter)
+ throws RepositoryException;
+}
diff --git a/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/observation/package-info.java b/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/observation/package-info.java
new file mode 100644
index 00000000000..9e07701c96e
--- /dev/null
+++ b/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/observation/package-info.java
@@ -0,0 +1,22 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * Jackrabbit extensions for JCR observation.
+ */
+@org.osgi.annotation.versioning.Version("2.3.1")
+package org.apache.jackrabbit.api.observation;
diff --git a/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/package-info.java b/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/package-info.java
new file mode 100644
index 00000000000..0c62b58306e
--- /dev/null
+++ b/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/package-info.java
@@ -0,0 +1,22 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * Jackrabbit extensions for JCR core interfaces
+ */
+@org.osgi.annotation.versioning.Version("2.5.0")
+package org.apache.jackrabbit.api;
diff --git a/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/query/JackrabbitQueryResult.java b/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/query/JackrabbitQueryResult.java
new file mode 100644
index 00000000000..101c4e95456
--- /dev/null
+++ b/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/query/JackrabbitQueryResult.java
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.api.query;
+
+import javax.jcr.query.QueryResult;
+
+/**
+ * The Jackrabbit query result interface. This interface contains the
+ * Jackrabbit-specific extensions to the JCR {@link QueryResult} interface.
+ *
+ * @since Jackrabbit 2.6
+ */
+public interface JackrabbitQueryResult extends QueryResult {
+
+ /**
+ * Returns the total number of hits. This is the number of results you
+ * would get without any limit or offset settings. This method may return
+ * -1
if the total size is unknown.
+ *
+ * @return the total number of hits, or -1
+ */
+ int getTotalSize();
+
+}
diff --git a/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/query/package-info.java b/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/query/package-info.java
new file mode 100755
index 00000000000..5395862e157
--- /dev/null
+++ b/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/query/package-info.java
@@ -0,0 +1,19 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/* see JCR-4060 */
+@org.osgi.annotation.versioning.Version("2.13.5")
+package org.apache.jackrabbit.api.query;
diff --git a/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/security/JackrabbitAccessControlEntry.java b/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/security/JackrabbitAccessControlEntry.java
new file mode 100644
index 00000000000..58654a80e80
--- /dev/null
+++ b/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/security/JackrabbitAccessControlEntry.java
@@ -0,0 +1,81 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.api.security;
+
+import javax.jcr.RepositoryException;
+import javax.jcr.Value;
+import javax.jcr.ValueFormatException;
+import javax.jcr.security.AccessControlEntry;
+
+import org.osgi.annotation.versioning.ProviderType;
+
+/**
+ * JackrabbitAccessControlEntry
is a Jackrabbit specific extension
+ * of the AccessControlEntry
interface. It represents an single
+ * entry of a {@link JackrabbitAccessControlList}.
+ */
+@ProviderType
+public interface JackrabbitAccessControlEntry extends AccessControlEntry {
+
+ /**
+ * @return true if this entry adds Privilege
s for the principal;
+ * false otherwise.
+ */
+ boolean isAllow();
+
+ /**
+ * Return the names of the restrictions present with this access control entry.
+ *
+ * @return the names of the restrictions
+ * @throws RepositoryException if an error occurs.
+ */
+ String[] getRestrictionNames() throws RepositoryException;
+
+ /**
+ * Return the value of the restriction with the specified name or
+ * null
if no such restriction exists. In case the restriction
+ * with the specified name contains multiple value this method will call
+ * {@code ValueFormatException}.
+ *
+ * @param restrictionName The of the restriction as obtained through
+ * {@link #getRestrictionNames()}.
+ * @return value of the restriction with the specified name or
+ * null
if no such restriction exists.
+ * @throws ValueFormatException If the restriction with the specified name
+ * contains multiple values.
+ * @throws RepositoryException if an error occurs.
+ * @see #getRestrictions(String)
+ */
+ Value getRestriction(String restrictionName) throws ValueFormatException, RepositoryException;
+
+ /**
+ * Return the values of the restriction with the specified name or
+ * null
if no such restriction exists. For restrictions that
+ * contain just a single value this method is expected to return an array
+ * with a single element even if the underlying implementation stored the
+ * restriction in single-value JCR property.
+ *
+ * @param restrictionName The of the restriction as obtained through
+ * {@link #getRestrictionNames()}.
+ * @return the values of the restriction with the specified name as an array
+ * or null
if no such restriction exists. The array may contain
+ * zero, one or multiple values.
+ * @throws RepositoryException if an error occurs.
+ * @see #getRestriction(String)
+ */
+ Value[] getRestrictions(String restrictionName) throws RepositoryException;
+}
diff --git a/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/security/JackrabbitAccessControlList.java b/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/security/JackrabbitAccessControlList.java
new file mode 100644
index 00000000000..7663518e2c7
--- /dev/null
+++ b/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/security/JackrabbitAccessControlList.java
@@ -0,0 +1,192 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.api.security;
+
+import java.security.Principal;
+import java.util.Map;
+import javax.jcr.RepositoryException;
+import javax.jcr.UnsupportedRepositoryOperationException;
+import javax.jcr.Value;
+import javax.jcr.security.AccessControlEntry;
+import javax.jcr.security.AccessControlException;
+import javax.jcr.security.AccessControlList;
+import javax.jcr.security.AccessControlPolicy;
+import javax.jcr.security.Privilege;
+
+import org.osgi.annotation.versioning.ProviderType;
+
+/**
+ * JackrabbitAccessControlList
is an extension of the AccessControlList
.
+ * Similar to the latter any modifications made will not take effect, until it is
+ * {@link javax.jcr.security.AccessControlManager#setPolicy(String, AccessControlPolicy)
+ * written back} and {@link javax.jcr.Session#save() saved}.
+ */
+@ProviderType
+public interface JackrabbitAccessControlList extends JackrabbitAccessControlPolicy, AccessControlList {
+
+ /**
+ * Returns the names of the supported restrictions or an empty array
+ * if no restrictions are respected.
+ *
+ * @return the names of the supported restrictions or an empty array.
+ * @see #addEntry(Principal, Privilege[], boolean, Map)
+ * @throws RepositoryException If an error occurs.
+ */
+ String[] getRestrictionNames() throws RepositoryException;
+
+ /**
+ * Return the expected {@link javax.jcr.PropertyType property type} of the
+ * restriction with the specified restrictionName
.
+ *
+ * @param restrictionName Any of the restriction names retrieved from
+ * {@link #getRestrictionNames()}.
+ * @return expected {@link javax.jcr.PropertyType property type}.
+ * @throws RepositoryException If an error occurs.
+ */
+ int getRestrictionType(String restrictionName) throws RepositoryException;
+
+ /**
+ * Returns true
if the restriction is multivalued; false
+ * otherwise. If an given implementation doesn't support multivalued restrictions,
+ * this method always returns false
.
+ *
+ * @param restrictionName Any of the restriction names retrieved from
+ * {@link #getRestrictionNames()}.
+ * @return true
if the restriction is multivalued; false
+ * if the restriction with the given name is single value or if the implementation
+ * doesn't support multivalued restrictions, this method always returns false
.
+ * @throws RepositoryException If an error occurs.
+ * @see #addEntry(Principal, Privilege[], boolean, Map, Map)
+ */
+ boolean isMultiValueRestriction(String restrictionName) throws RepositoryException;
+
+ /**
+ * Returns true
if this policy does not yet define any
+ * entries.
+ *
+ * @return If no entries are present.
+ */
+ boolean isEmpty();
+
+ /**
+ * Returns the number of entries or 0 if the policy {@link #isEmpty() is empty}.
+ *
+ * @return The number of entries present or 0 if the policy {@link #isEmpty() is empty}.
+ */
+ int size();
+
+ /**
+ * Same as {@link #addEntry(Principal, Privilege[], boolean, Map)} using
+ * some implementation specific restrictions.
+ *
+ * @param principal the principal to add the entry for
+ * @param privileges the privileges to add
+ * @param isAllow if true
if this is a positive (allow) entry
+ * @return true if this policy has changed by incorporating the given entry;
+ * false otherwise.
+ * @throws AccessControlException If any of the given parameter is invalid
+ * or cannot be handled by the implementation.
+ * @throws RepositoryException If another error occurs.
+ * @see AccessControlList#addAccessControlEntry(Principal, Privilege[])
+ */
+ boolean addEntry(Principal principal, Privilege[] privileges, boolean isAllow)
+ throws AccessControlException, RepositoryException;
+
+ /**
+ * Adds an access control entry to this policy consisting of the specified
+ * principal
, the specified privileges
, the
+ * isAllow
flag and an optional map containing additional
+ * restrictions.
+ *
+ * This method returns true
if this policy was modified,
+ * false
otherwise.
+ *
+ * An AccessControlException
is thrown if any of the specified
+ * parameters is invalid or if some other access control related exception occurs.
+ *
+ * @param principal the principal to add the entry for
+ * @param privileges the privileges to add
+ * @param isAllow if true
if this is a positive (allow) entry
+ * @param restrictions A map of additional restrictions used to narrow the
+ * effect of the entry to be created. The map must map JCR names to a single
+ * {@link javax.jcr.Value} object.
+ * @return true if this policy has changed by incorporating the given entry;
+ * false otherwise.
+ * @throws AccessControlException If any of the given parameter is invalid
+ * or cannot be handled by the implementation.
+ * @throws RepositoryException If another error occurs.
+ * @see AccessControlList#addAccessControlEntry(Principal, Privilege[])
+ */
+ boolean addEntry(Principal principal, Privilege[] privileges,
+ boolean isAllow, Map restrictions)
+ throws AccessControlException, RepositoryException;
+
+ /**
+ * Adds an access control entry to this policy consisting of the specified
+ * principal
, the specified privileges
, the
+ * isAllow
flag and an optional map containing additional
+ * restrictions.
+ *
+ * This method returns true
if this policy was modified,
+ * false
otherwise.
+ *
+ * An AccessControlException
is thrown if any of the specified
+ * parameters is invalid or if some other access control related exception occurs.
+ *
+ * @param principal the principal to add the entry for
+ * @param privileges the privileges to add
+ * @param isAllow if true
if this is a positive (allow) entry
+ * @param restrictions A map of additional restrictions used to narrow the
+ * effect of the entry to be created. The map must map JCR names to a single
+ * {@link javax.jcr.Value} object.
+ * @param mvRestrictions A map of additional multivalued restrictions used to narrow the
+ * effect of the entry to be created. The map must map JCR names to a
+ * {@link javax.jcr.Value} array.
+ * @return true if this policy has changed by incorporating the given entry;
+ * false otherwise.
+ * @throws AccessControlException If any of the given parameter is invalid
+ * or cannot be handled by the implementation.
+ * @throws RepositoryException If another error occurs.
+ * @see AccessControlList#addAccessControlEntry(Principal, Privilege[])
+ * @since 2.8
+ */
+ boolean addEntry(Principal principal, Privilege[] privileges,
+ boolean isAllow, Map restrictions,
+ Map mvRestrictions)
+ throws AccessControlException, RepositoryException;
+
+ /**
+ * If the AccessControlList
implementation supports
+ * reordering of entries the specified srcEntry
is inserted
+ * at the position of the specified destEntry
.
+ *
+ * If destEntry
is null
the entry is moved to the
+ * end of the list.
+ *
+ * If srcEntry
and destEntry
are the same no
+ * changes are made.
+ *
+ * @param srcEntry The access control entry to be moved within the list.
+ * @param destEntry The entry before which the srcEntry
will be moved.
+ * @throws AccessControlException If any of the given entries is invalid or
+ * cannot be handled by the implementation.
+ * @throws UnsupportedRepositoryOperationException If ordering is not supported.
+ * @throws RepositoryException If another error occurs.
+ */
+ void orderBefore(AccessControlEntry srcEntry, AccessControlEntry destEntry)
+ throws AccessControlException, UnsupportedRepositoryOperationException, RepositoryException;
+}
diff --git a/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/security/JackrabbitAccessControlManager.java b/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/security/JackrabbitAccessControlManager.java
new file mode 100644
index 00000000000..a5fe13f8620
--- /dev/null
+++ b/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/security/JackrabbitAccessControlManager.java
@@ -0,0 +1,168 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.api.security;
+
+import javax.jcr.AccessDeniedException;
+import javax.jcr.RepositoryException;
+import javax.jcr.UnsupportedRepositoryOperationException;
+import javax.jcr.PathNotFoundException;
+import javax.jcr.security.AccessControlException;
+import javax.jcr.security.AccessControlManager;
+import javax.jcr.security.AccessControlPolicy;
+import javax.jcr.security.Privilege;
+
+import java.security.Principal;
+import java.util.Set;
+
+import org.osgi.annotation.versioning.ProviderType;
+
+/**
+ * JackrabbitAccessControlManager
provides extensions to the
+ * AccessControlManager
interface.
+ */
+@ProviderType
+public interface JackrabbitAccessControlManager extends AccessControlManager {
+
+ /**
+ * Returns the applicable policies for the specified principal
+ * or an empty array if no additional policies can be applied.
+ *
+ * @param principal A principal known to the editing session.
+ * @return array of policies for the specified principal
. Note
+ * that the policy object returned must reveal the path of the node where
+ * they can be applied later on using {@link AccessControlManager#setPolicy(String, javax.jcr.security.AccessControlPolicy)}.
+ * @throws AccessDeniedException if the session lacks
+ * MODIFY_ACCESS_CONTROL
privilege.
+ * @throws AccessControlException if the specified principal does not exist
+ * or if another access control related exception occurs.
+ * @throws UnsupportedRepositoryOperationException if editing access control
+ * policies by principal is not supported.
+ * @throws RepositoryException if another error occurs.
+ * @see JackrabbitAccessControlPolicy#getPath()
+ */
+ JackrabbitAccessControlPolicy[] getApplicablePolicies(Principal principal) throws AccessDeniedException, AccessControlException, UnsupportedRepositoryOperationException, RepositoryException;
+
+ /**
+ * Returns the AccessControlPolicy
objects that have been set
+ * for the given principal
or an empty array if no policy has
+ * been set. This method reflects the binding state, including transient
+ * policy modifications.
+ *
+ * @param principal A valid principal.
+ * @return The policies defined for the given principal or an empty array.
+ * @throws AccessDeniedException if the session lacks
+ * READ_ACCESS_CONTROL
privilege.
+ * @throws AccessControlException if the specified principal does not exist
+ * or if another access control related exception occurs.
+ * @throws UnsupportedRepositoryOperationException if editing access control
+ * policies by principal is not supported.
+ * @throws RepositoryException If another error occurs.
+ */
+ JackrabbitAccessControlPolicy[] getPolicies(Principal principal) throws AccessDeniedException, AccessControlException, UnsupportedRepositoryOperationException, RepositoryException;
+
+ /**
+ * Returns the AccessControlPolicy
objects that are in effect
+ * for the given Principal
s. This may be policies set through
+ * this API or some implementation specific (default) policies.
+ *
+ * @param principals A set of valid principals.
+ * @return The policies defined for the given principal or an empty array.
+ * @throws AccessDeniedException if the session lacks
+ * READ_ACCESS_CONTROL
privilege.
+ * @throws AccessControlException if the specified principal does not exist
+ * or if another access control related exception occurs.
+ * @throws UnsupportedRepositoryOperationException if editing access control
+ * policies by principal is not supported.
+ * @throws RepositoryException If another error occurs.
+ */
+ AccessControlPolicy[] getEffectivePolicies(Set principals) throws AccessDeniedException, AccessControlException, UnsupportedRepositoryOperationException, RepositoryException;
+
+ /**
+ * Returns whether the given set of Principal
s has the specified
+ * privileges for absolute path absPath
, which must be an
+ * existing node.
+ *
+ * Testing an aggregate privilege is equivalent to testing each non
+ * aggregate privilege among the set returned by calling
+ * Privilege.getAggregatePrivileges()
for that privilege.
+ *
+ * The results reported by the this method reflect the net effect of
+ * the currently applied control mechanisms. It does not reflect unsaved
+ * access control policies or unsaved access control entries. Changes to
+ * access control status caused by these mechanisms only take effect on
+ * Session.save()
and are only then reflected in the results of
+ * the privilege test methods.
+ *
+ * Since this method allows to view the privileges of principals other
+ * than included in the editing session, this method must throw
+ * AccessDeniedException
if the session lacks
+ * READ_ACCESS_CONTROL
privilege for the absPath
+ * node.
+ *
+ * @param absPath an absolute path.
+ * @param principals a set of Principal
s for which is the
+ * given privileges are tested.
+ * @param privileges an array of Privilege
s.
+ * @return true
if the session has the specified privileges;
+ * false
otherwise.
+ * @throws javax.jcr.PathNotFoundException if no node at absPath
exists
+ * or the session does not have sufficient access to retrieve a node at that location.
+ * @throws AccessDeniedException if the session lacks
+ * READ_ACCESS_CONTROL
privilege for the absPath
node.
+ * @throws RepositoryException if another error occurs.
+ */
+ public boolean hasPrivileges(String absPath, Set principals, Privilege[] privileges)
+ throws PathNotFoundException, AccessDeniedException, RepositoryException;
+
+ /**
+ * Returns the privileges the given set of Principal
s has for
+ * absolute path absPath
, which must be an existing node.
+ *
+ * The returned privileges are those for which {@link #hasPrivileges} would
+ * return true
.
+ *
+ * The results reported by the this method reflect the net effect of
+ * the currently applied control mechanisms. It does not reflect unsaved
+ * access control policies or unsaved access control entries. Changes to
+ * access control status caused by these mechanisms only take effect on
+ * Session.save()
and are only then reflected in the results of
+ * the privilege test methods.
+ *
+ * Since this method allows to view the privileges of principals other
+ * than included in the editing session, this method must throw
+ * AccessDeniedException
if the session lacks
+ * READ_ACCESS_CONTROL
privilege for the absPath
+ * node.
+ *
+ * Note that this method does not resolve any group membership, as this is
+ * the job of the user manager. nor does it augment the set with the
+ * "everyone" principal.
+ *
+ * @param absPath an absolute path.
+ * @param principals a set of Principal
s for which is the
+ * privileges are retrieved.
+ * @return an array of Privilege
s.
+ * @throws PathNotFoundException if no node at absPath
exists
+ * or the session does not have sufficient access to retrieve a node at that
+ * location.
+ * @throws AccessDeniedException if the session lacks READ_ACCESS_CONTROL
+ * privilege for the absPath
node.
+ * @throws RepositoryException if another error occurs.
+ */
+ public Privilege[] getPrivileges(String absPath, Set principals)
+ throws PathNotFoundException, AccessDeniedException, RepositoryException;
+}
\ No newline at end of file
diff --git a/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/security/JackrabbitAccessControlPolicy.java b/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/security/JackrabbitAccessControlPolicy.java
new file mode 100644
index 00000000000..fb554b7ca03
--- /dev/null
+++ b/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/security/JackrabbitAccessControlPolicy.java
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.api.security;
+
+import javax.jcr.security.AccessControlPolicy;
+
+import org.osgi.annotation.versioning.ProviderType;
+
+/**
+ * JackrabbitAccessControlPolicy
is an extension of the
+ * AccessControlPolicy
that exposes the path of the Node to
+ * which it can be applied using {@link javax.jcr.security.AccessControlManager#setPolicy(String, javax.jcr.security.AccessControlPolicy)}.
+ */
+@ProviderType
+public interface JackrabbitAccessControlPolicy extends AccessControlPolicy {
+
+ /**
+ * Returns the path of the node this policy has been created for.
+ *
+ * @return the path of the node this policy has been created for.
+ */
+ String getPath();
+}
\ No newline at end of file
diff --git a/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/security/authentication/token/TokenCredentials.java b/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/security/authentication/token/TokenCredentials.java
new file mode 100644
index 00000000000..0c360bd7529
--- /dev/null
+++ b/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/security/authentication/token/TokenCredentials.java
@@ -0,0 +1,117 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.api.security.authentication.token;
+
+import javax.jcr.Credentials;
+import java.util.HashMap;
+
+/**
+ * TokenCredentials
implements the Credentials
+ * interface and represents single token credentials. Similar to
+ * {@link javax.jcr.SimpleCredentials} this credentials implementation allows
+ * to set additional attributes.
+ */
+public final class TokenCredentials implements Credentials {
+
+ private final String token;
+ private final HashMap attributes = new HashMap();
+
+ /**
+ * Create a new instance.
+ *
+ * @param token A token string used to create this credentials instance.
+ * @throws IllegalArgumentException If the specified token is null
+ * or empty string.
+ */
+ public TokenCredentials(String token) throws IllegalArgumentException {
+ if (token == null || token.length() == 0) {
+ throw new IllegalArgumentException("Invalid token '" + token + "'");
+ }
+ this.token = token;
+ }
+
+ /**
+ * Returns the token this credentials are built from.
+ *
+ * @return the token.
+ */
+ public String getToken() {
+ return token;
+ }
+
+ /**
+ * Stores an attribute in this credentials instance.
+ *
+ * @param name a String
specifying the name of the attribute
+ * @param value the Object
to be stored
+ */
+ public void setAttribute(String name, String value) {
+ // name cannot be null
+ if (name == null) {
+ throw new IllegalArgumentException("name cannot be null");
+ }
+
+ // null value is the same as removeAttribute()
+ if (value == null) {
+ removeAttribute(name);
+ return;
+ }
+
+ synchronized (attributes) {
+ attributes.put(name, value);
+ }
+ }
+
+ /**
+ * Returns the value of the named attribute as an Object
, or
+ * null
if no attribute of the given name exists.
+ *
+ * @param name a String
specifying the name of the attribute
+ * @return an Object
containing the value of the attribute, or
+ * null
if the attribute does not exist
+ */
+ public String getAttribute(String name) {
+ synchronized (attributes) {
+ return (attributes.get(name));
+ }
+ }
+
+ /**
+ * Removes an attribute from this credentials instance.
+ *
+ * @param name a String
specifying the name of the attribute to
+ * remove
+ */
+ public void removeAttribute(String name) {
+ synchronized (attributes) {
+ attributes.remove(name);
+ }
+ }
+
+ /**
+ * Returns the names of the attributes available to this credentials
+ * instance. This method returns an empty array if the credentials instance
+ * has no attributes available to it.
+ *
+ * @return a string array containing the names of the stored attributes
+ */
+ public String[] getAttributeNames() {
+ synchronized (attributes) {
+ return attributes.keySet().toArray(new String[attributes.keySet().size()]);
+ }
+ }
+}
\ No newline at end of file
diff --git a/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/security/authentication/token/package-info.java b/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/security/authentication/token/package-info.java
new file mode 100644
index 00000000000..d0893aae59a
--- /dev/null
+++ b/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/security/authentication/token/package-info.java
@@ -0,0 +1,22 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * Token credentials.
+ */
+@org.osgi.annotation.versioning.Version("2.3")
+package org.apache.jackrabbit.api.security.authentication.token;
diff --git a/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/security/authorization/PrincipalSetPolicy.java b/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/security/authorization/PrincipalSetPolicy.java
new file mode 100644
index 00000000000..5843358f41a
--- /dev/null
+++ b/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/security/authorization/PrincipalSetPolicy.java
@@ -0,0 +1,78 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.api.security.authorization;
+
+import java.security.Principal;
+import java.util.Set;
+
+import javax.jcr.security.AccessControlException;
+import javax.jcr.security.AccessControlPolicy;
+
+import org.jetbrains.annotations.NotNull;
+
+/**
+ * Extension of the JCR {@link javax.jcr.security.AccessControlPolicy AccessControlPolicy}
+ * intended to grant a set of {@code Principal}s the ability to perform certain
+ * actions. The scope of this policy (and thus the affected items) is an
+ * implementation detail; it may e.g. take effect on the tree defined by the
+ * {@link javax.jcr.Node}, where a given {@code PrincipalSetPolicy} is being
+ * applied.
+ *
+ * The very details on what actions are granted by a given {@code PrincipalSetPolicy}
+ * remains an implementation detail. Similarly a given permission model is
+ * in charge of defining the interactions and effects different
+ * {@link AccessControlPolicy policies} will have if used together in the same
+ * repository.
+ */
+public interface PrincipalSetPolicy extends AccessControlPolicy {
+
+ /**
+ * Returns the set of {@code Principal}s that are allowed to perform
+ * implementation specific actions on the items affected by this policy.
+ *
+ * @return The set of {@code Principal}s that are allowed to perform
+ * implementation specific actions on the those items where this policy
+ * takes effect.
+ */
+ @NotNull
+ Set getPrincipals();
+
+ /**
+ * Add {@code Principal}s that are allowed to perform some implementation
+ * specific actions on those items where this policy takes effect.
+ *
+ * @param principals The {@code Principal}s that are granted access.
+ * @return {@code true} if this policy was modified; {@code false} otherwise.
+ * @throws javax.jcr.security.AccessControlException If any of the specified
+ * principals is considered invalid or if another access control specific
+ * error occurs.
+ */
+ boolean addPrincipals(@NotNull Principal... principals) throws AccessControlException;
+
+ /**
+ * Remove the specified {@code Principal}s for the set of allowed principals
+ * thus revoking their ability to perform the implementation specific actions
+ * on items where this policy takes effect.
+ *
+ * @param principals The {@code Principal}s for which access should be revoked.
+ * @return {@code true} if this policy was modified; {@code false} otherwise.
+ * @throws javax.jcr.security.AccessControlException If any of the specified
+ * principals is considered invalid or if another access control specific
+ * error occurs.
+ */
+ boolean removePrincipals(@NotNull Principal... principals) throws AccessControlException;
+}
\ No newline at end of file
diff --git a/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/security/authorization/PrivilegeManager.java b/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/security/authorization/PrivilegeManager.java
new file mode 100644
index 00000000000..c00a779f62b
--- /dev/null
+++ b/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/security/authorization/PrivilegeManager.java
@@ -0,0 +1,76 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.api.security.authorization;
+
+import javax.jcr.AccessDeniedException;
+import javax.jcr.NamespaceException;
+import javax.jcr.RepositoryException;
+import javax.jcr.security.AccessControlException;
+import javax.jcr.security.Privilege;
+
+/**
+ * PrivilegeManager
is a jackrabbit specific extensions to
+ * JCR access control management that allows to retrieve privileges known
+ * by this JCR implementation and to register new custom privileges according
+ * to implementation specific rules.
+ *
+ * @see javax.jcr.security.AccessControlManager#privilegeFromName(String)
+ */
+public interface PrivilegeManager {
+
+ /**
+ * Returns all registered privileges.
+ *
+ * @return all registered privileges.
+ * @throws RepositoryException If an error occurs.
+ */
+ Privilege[] getRegisteredPrivileges() throws RepositoryException;
+
+ /**
+ * Returns the privilege with the specified privilegeName
.
+ *
+ * @param privilegeName Name of the principal.
+ * @return the privilege with the specified privilegeName
.
+ * @throws javax.jcr.security.AccessControlException If no privilege with the given name exists.
+ * @throws javax.jcr.RepositoryException If another error occurs.
+ */
+ Privilege getPrivilege(String privilegeName) throws AccessControlException, RepositoryException;
+
+ /**
+ * Creates and registers a new custom privilege with the specified
+ * characteristics and returns the new privilege.
+ *
+ * If the registration succeeds, the changes are immediately effective;
+ * there is no need to call save
.
+ *
+ * @param privilegeName The name of the new custom privilege.
+ * @param isAbstract Boolean flag indicating if the privilege is abstract.
+ * @param declaredAggregateNames An array of privilege names referring to
+ * registered privileges being aggregated by this new custom privilege.
+ * In case of a non aggregate privilege an empty array should be passed.
+ * @return the new privilege.
+ * @throws AccessDeniedException If the session this manager has been created
+ * for is not allowed to register new privileges.
+ * @throws NamespaceException If any of the specified JCR names is illegal.
+ * @throws RepositoryException If the privilege could not be registered due
+ * to any implementation specific constraint violations or if persisting the
+ * custom privilege fails.
+ */
+ Privilege registerPrivilege(String privilegeName, boolean isAbstract,
+ String[] declaredAggregateNames)
+ throws AccessDeniedException, NamespaceException, RepositoryException;
+}
diff --git a/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/security/authorization/package-info.java b/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/security/authorization/package-info.java
new file mode 100644
index 00000000000..cac7bfa550a
--- /dev/null
+++ b/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/security/authorization/package-info.java
@@ -0,0 +1,22 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * Jackrabbit extensions for authorization.
+ */
+@org.osgi.annotation.versioning.Version("2.3.1")
+package org.apache.jackrabbit.api.security.authorization;
diff --git a/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/security/package-info.java b/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/security/package-info.java
new file mode 100644
index 00000000000..beb4d80851b
--- /dev/null
+++ b/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/security/package-info.java
@@ -0,0 +1,22 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * Jackrabbit extensions for access control.
+ */
+@org.osgi.annotation.versioning.Version("2.4.0")
+package org.apache.jackrabbit.api.security;
diff --git a/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/security/principal/GroupPrincipal.java b/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/security/principal/GroupPrincipal.java
new file mode 100644
index 00000000000..17c0d44f957
--- /dev/null
+++ b/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/security/principal/GroupPrincipal.java
@@ -0,0 +1,52 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.api.security.principal;
+
+import java.security.Principal;
+import java.util.Enumeration;
+
+import org.osgi.annotation.versioning.ProviderType;
+
+/**
+ * This interface is used to represent a group of principals. It is meant to
+ * replace the deprecated {@code java.security.acl.Group}.
+ */
+@ProviderType
+public interface GroupPrincipal extends Principal {
+
+ /**
+ * Returns true if the passed principal is a member of the group.
+ * This method does a recursive search, so if a principal belongs to a
+ * group which is a member of this group, true is returned.
+ *
+ * @param member the principal whose membership is to be checked.
+ * @return true if the principal is a member of this group,
+ * false otherwise.
+ */
+ public boolean isMember(Principal member);
+
+ /**
+ * Returns an enumeration of the members in the group. This includes both
+ * declared members and all principals that are indirect group members. The
+ * returned objects can be instances of either Principal or GroupPrincipal
+ * (which is a subclass of Principal).
+ *
+ * @return an enumeration of the group members.
+ */
+ public Enumeration extends Principal> members();
+
+}
diff --git a/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/security/principal/ItemBasedPrincipal.java b/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/security/principal/ItemBasedPrincipal.java
new file mode 100644
index 00000000000..c7b57fc2617
--- /dev/null
+++ b/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/security/principal/ItemBasedPrincipal.java
@@ -0,0 +1,39 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.api.security.principal;
+
+import javax.jcr.RepositoryException;
+
+/**
+ * ItemBasedPrincipal
is a Principal
having a
+ * corresponding item within the JCR repository. In addition to the methods
+ * inherited from the {@link java.security.Principal} interface it therefore
+ * provides a {@link #getPath()} method.
+ */
+public interface ItemBasedPrincipal extends JackrabbitPrincipal {
+
+ /**
+ * Returns the JCR path of the item that corresponds to this
+ * Principal
.
+ *
+ * @return the path of the {@link javax.jcr.Item} that corresponds to this
+ * Principal
.
+ * @throws RepositoryException If an error occurs while retrieving the
+ * Item
path.
+ */
+ String getPath() throws RepositoryException;
+}
diff --git a/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/security/principal/JackrabbitPrincipal.java b/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/security/principal/JackrabbitPrincipal.java
new file mode 100644
index 00000000000..77ae1302cdf
--- /dev/null
+++ b/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/security/principal/JackrabbitPrincipal.java
@@ -0,0 +1,27 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.api.security.principal;
+
+import java.security.Principal;
+
+/**
+ * JackrabbitPrincipal
marks the principal to be the result of
+ * authentication against the repository.
+ */
+public interface JackrabbitPrincipal extends Principal {
+
+}
diff --git a/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/security/principal/PrincipalIterator.java b/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/security/principal/PrincipalIterator.java
new file mode 100644
index 00000000000..5a843177f72
--- /dev/null
+++ b/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/security/principal/PrincipalIterator.java
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.api.security.principal;
+
+import javax.jcr.RangeIterator;
+import java.security.Principal;
+
+/**
+ * A {@link RangeIterator} iterating over Principal
s.
+ */
+public interface PrincipalIterator extends RangeIterator {
+
+ /**
+ * Returns the next principal.
+ *
+ * @return the next principal
+ */
+ Principal nextPrincipal();
+
+}
diff --git a/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/security/principal/PrincipalManager.java b/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/security/principal/PrincipalManager.java
new file mode 100644
index 00000000000..626164d312c
--- /dev/null
+++ b/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/security/principal/PrincipalManager.java
@@ -0,0 +1,161 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.api.security.principal;
+
+import java.security.Principal;
+
+/**
+ * This interface defines the principal manager which is the clients view on all
+ * principals known to the repository. Each principal manager is bound to a
+ * session and is restricted by the respective access control. The principal
+ * manager in addition provides basic search facilities.
+ *
+ * A {@link Principal} is an object used to connect to any kind
+ * of security mechanism. Example for this are the
+ * {@link javax.security.auth.spi.LoginModule login modules} that use principals
+ * to process the login procedure.
+ * A principal can be a member of a {@link GroupPrincipal}. A
+ * group is a principal itself and can therefore be a member of a group again.
+ *
+ * Please note the following security considerations that need to be respected
+ * when implementing the PrincipalManager: All principals returned by this
+ * manager as well as {@link GroupPrincipal#members()} must respect access
+ * restrictions that may be present for the Session
this manager
+ * has been built for. The same applies for
+ * {@link #getGroupMembership(Principal)}.
+ *
+ * Since Jackrabbit 2.18, a new interface has been introduced to represent the
+ * concept of a group of principals: {@link GroupPrincipal}, alongside
+ * {@code java.security.acl.Group} which is deprecated to be deleted. Until the
+ * final deletion of {@code java.security.acl.Group}, the 2 interfaces will be
+ * used concurrently for backwards compatibility reasons. See JCR-4249 for more
+ * details.
+ */
+public interface PrincipalManager {
+
+ /**
+ * Filter flag indicating that only Principal
s that do NOT
+ * represent a group should be searched and returned.
+ */
+ int SEARCH_TYPE_NOT_GROUP = 1;
+
+ /**
+ * Filter flag indicating that only Principal
s that represent
+ * a group of Principals should be searched and returned.
+ */
+ int SEARCH_TYPE_GROUP = 2;
+
+ /**
+ * Filter flag indicating that all Principal
s should be search
+ * irrespective whether they represent a group of Principals or not.
+ */
+ int SEARCH_TYPE_ALL = 3;
+
+ /**
+ * Checks if the principal with the given name is known to this manager
+ * (in respect to the sessions access rights). If this method returns
+ * true
then the following expression evaluates to true
+ * as well: PrincipalManager.getPrincipal(name).getName().equals(name)
+ *
+ * @param principalName the name of the principal to check
+ * @return return true
if the principal with this name is known
+ * to this manager; false
otherwise.
+ */
+ boolean hasPrincipal(String principalName);
+
+ /**
+ * Returns the principal with the given name if is known to this manager
+ * (with respect to the sessions access rights).
+ * Please note that due to security reasons group principals will only
+ * reveal those members that are visible to the Session this
+ * PrincipalManager
has been built for.
+ *
+ * @param principalName the name of the principal to retrieve
+ * @return return the requested principal or null
if a
+ * principal with the given name does not exist or is not accessible
+ * for the editing session.
+ */
+ Principal getPrincipal(String principalName);
+
+ /**
+ * Gets the principals matching a simple filter expression applied against
+ * the {@link Principal#getName() principal name}.
+ * TODO: define the filter expression.
+ * An implementation may limit the number of principals returned.
+ * If there are no matching principals, an empty iterator is returned.
+ *
+ * @param simpleFilter
+ * @return a PrincipalIterator
over the Principal
s
+ * matching the given filter.
+ */
+ PrincipalIterator findPrincipals(String simpleFilter);
+
+ /**
+ * Gets the principals matching a simple filter expression applied against
+ * the {@link Principal#getName() principal name} AND the specified search
+ * type.
+ * TODO: define the filter expression.
+ * An implementation may limit the number of principals returned.
+ * If there are no matching principals, an empty iterator is returned.
+ *
+ * @param simpleFilter
+ * @param searchType Any of the following constants:
+ *
+ * - {@link PrincipalManager#SEARCH_TYPE_ALL}
+ * - {@link PrincipalManager#SEARCH_TYPE_GROUP}
+ * - {@link PrincipalManager#SEARCH_TYPE_NOT_GROUP}
+ *
+ * @return a PrincipalIterator
over the Principal
s
+ * matching the given filter and search type.
+ */
+ PrincipalIterator findPrincipals(String simpleFilter, int searchType);
+
+ /**
+ * Returns all Principal
s matching the specified search type.
+ *
+ * @param searchType Any of the following constants:
+ *
+ * - {@link PrincipalManager#SEARCH_TYPE_ALL}
+ * - {@link PrincipalManager#SEARCH_TYPE_GROUP}
+ * - {@link PrincipalManager#SEARCH_TYPE_NOT_GROUP}
+ *
+ * @return a PrincipalIterator
over all the Principal
s
+ * matching the given search type.
+ */
+ PrincipalIterator getPrincipals(int searchType);
+
+ /**
+ * Returns an iterator over all group principals for which the given
+ * principal is either direct or indirect member of.
+ *
+ * Example:
+ * If Principal P is member of Group A, and Group A is member of
+ * Group B, this method will return Principal A and Principal B.
+ *
+ * @param principal the principal to return it's membership from.
+ * @return an iterator returning all groups the given principal is member of.
+ */
+ PrincipalIterator getGroupMembership(Principal principal);
+
+ /**
+ * Returns the Principal
which is implicitly applied to
+ * every subject.
+ *
+ * @return the 'everyone' principal
+ */
+ Principal getEveryone();
+}
diff --git a/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/security/principal/package-info.java b/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/security/principal/package-info.java
new file mode 100644
index 00000000000..0731f296338
--- /dev/null
+++ b/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/security/principal/package-info.java
@@ -0,0 +1,22 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * Jackrabbit extensions for JAAS principals.
+ */
+@org.osgi.annotation.versioning.Version("2.4.0")
+package org.apache.jackrabbit.api.security.principal;
diff --git a/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/security/user/Authorizable.java b/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/security/user/Authorizable.java
new file mode 100644
index 00000000000..be0668d32bf
--- /dev/null
+++ b/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/security/user/Authorizable.java
@@ -0,0 +1,200 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.api.security.user;
+
+import java.security.Principal;
+import java.util.Iterator;
+
+import javax.jcr.RepositoryException;
+import javax.jcr.UnsupportedRepositoryOperationException;
+import javax.jcr.Value;
+
+/**
+ * The Authorizable is the common base interface for {@link User} and
+ * {@link Group}. It provides access to the Principal
s associated
+ * with an Authorizable
(see below) and allow to access and
+ * modify additional properties such as e.g. full name, e-mail or address.
+ *
+ * Please note the difference between Authorizable
and
+ * {@link java.security.Principal Principal}:
+ * An Authorizable
is repository object that is neither associated
+ * with nor depending from a particular Session
and thus independent
+ * of the login mechanisms creating Session
s.
+ *
+ * On the other hand Principal
s are representations of user
+ * identities. In other words: each Principal
within the set
+ * associated with the Session's Subject upon login represents an identity for
+ * that user. An the set of Principal
s may differ between different
+ * login mechanisms.
+ *
+ * Consequently an one-to-many relationship exists between Authorizable
+ * and Principal (see also {@link #getPrincipal()}.
+ *
+ * The interfaces derived from Authorizable are defined as follows:
+ *
+ * - {@link User}: defined to be an Authorizable that can be authenticated
+ * (by using Credentials) and impersonated.
+ * - {@link Group}: defined to be a collection of other
+ *
Authorizable
s.
+ *
+ *
+ * @see User
+ * @see Group
+ */
+public interface Authorizable {
+
+ /**
+ * Return the implementation specific identifier for this
+ * Authorizable
. It could e.g. be a UserID or simply the
+ * principal name.
+ *
+ * @return Name of this Authorizable
.
+ * @throws RepositoryException if an error occurs.
+ */
+ String getID() throws RepositoryException;
+
+ /**
+ * @return if the current Authorizable is a {@link Group}
+ */
+ boolean isGroup();
+
+ /**
+ * @return a representation as Principal.
+ * @throws RepositoryException If an error occurs.
+ */
+ Principal getPrincipal() throws RepositoryException;
+
+ /**
+ * @return all {@link Group}s, this Authorizable is declared member of.
+ * @throws RepositoryException If an error occurs.
+ */
+ Iterator declaredMemberOf() throws RepositoryException;
+
+ /**
+ * @return all {@link Group}s, this Authorizable is member of included
+ * indirect group membership.
+ * @throws RepositoryException If an error occurs.
+ */
+ Iterator memberOf() throws RepositoryException;
+
+ /**
+ * Removes this Authorizable
, if the session has sufficient
+ * permissions. Note, that removing an Authorizable
even
+ * if it listed as member of a Group or if still has members (this is
+ * a Group itself).
+ *
+ * @throws RepositoryException If an error occurred and the
+ * Authorizable
could not be removed.
+ */
+ void remove() throws RepositoryException;
+
+ /**
+ * Returns the names of properties present with this
+ * Authorizable not taking possible relative paths into consideration.
+ * Same as {@link #getPropertyNames(String)} where the specified string
+ * is ".".
+ *
+ * @return names of properties.
+ * @throws RepositoryException If an error occurs.
+ * @see #getProperty(String) where the specified relative path is simply an
+ * name.
+ * @see #hasProperty(String)
+ */
+ Iterator getPropertyNames() throws RepositoryException;
+
+ /**
+ * Returns the names of properties present with this
+ * Authorizable at the specified relative path.
+ *
+ * @param relPath A relative path.
+ * @return names of properties.
+ * @throws RepositoryException If an error occurs.
+ * @see #getProperty(String)
+ * @see #hasProperty(String)
+ */
+ Iterator getPropertyNames(String relPath) throws RepositoryException;
+
+ /**
+ * Tests if a the property with specified name exists.
+ *
+ * @param relPath The relative path to the property to be tested.
+ * @return true
if a property with the given name exists.
+ * @throws RepositoryException If an error occurs.
+ * @see #getProperty(String)
+ */
+ boolean hasProperty(String relPath) throws RepositoryException;
+
+ /**
+ * Set an arbitrary property to this Authorizable
.
+ *
+ * @param relPath The relative path of the property to be added or modified.
+ * @param value The desired value.
+ * @throws RepositoryException If the specified property could not be set.
+ */
+ void setProperty(String relPath, Value value) throws RepositoryException;
+
+ /**
+ * Set an arbitrary property to this Authorizable
.
+ *
+ * @param relPath The relative path of the property to be added or modified.
+ * @param value The desired property values.
+ * @throws RepositoryException If the specified property could not be set.
+ */
+ void setProperty(String relPath, Value[] value) throws RepositoryException;
+
+ /**
+ * Returns the values for the properties with the specified name or
+ * null
.
+ *
+ * @param relPath Relative path of the property to be retrieved.
+ * @return value of the property with the given name or null
+ * if no such property exists.
+ * @throws RepositoryException If an error occurs.
+ */
+ Value[] getProperty(String relPath) throws RepositoryException;
+
+ /**
+ * Removes the property with the given name.
+ *
+ * @param relPath Relative path (or name) of the property to be removed.
+ * @return true If the property at the specified relPath was successfully
+ * removed; false if no such property was present.
+ * @throws RepositoryException If an error occurs.
+ */
+ boolean removeProperty(String relPath) throws RepositoryException;
+
+ /**
+ * Returns a JCR path if this authorizable instance is associated with an
+ * item that can be accessed by the editing Session
.
+ *
+ * Throws UnsupportedRepositoryOperationException
if this
+ * method is not supported or if there is no item associated with this
+ * authorizable that is accessible by the editing Session
.
+ *
+ * Throws RepositoryException
if another error occurs while
+ * retrieving the path.
+ *
+ * @return the path of the {@link javax.jcr.Item} that corresponds to this
+ * Authorizable
.
+ * @throws UnsupportedRepositoryOperationException If this method is not
+ * supported or if there exists no accessible item associated with this
+ * Authorizable
instance.
+ * @throws RepositoryException If an error occurs while retrieving the
+ * Item
path.
+ */
+ String getPath() throws UnsupportedRepositoryOperationException, RepositoryException;
+}
diff --git a/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/security/user/AuthorizableExistsException.java b/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/security/user/AuthorizableExistsException.java
new file mode 100644
index 00000000000..0832fccfd10
--- /dev/null
+++ b/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/security/user/AuthorizableExistsException.java
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.api.security.user;
+
+import javax.jcr.RepositoryException;
+
+/**
+ * AuthorizableExistsException
+ */
+public class AuthorizableExistsException extends RepositoryException {
+
+ /**
+ * Serial version UID.
+ */
+ private static final long serialVersionUID = 7875416346848889564L;
+
+ public AuthorizableExistsException(String msg) {
+ super(msg);
+ }
+
+}
diff --git a/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/security/user/AuthorizableTypeException.java b/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/security/user/AuthorizableTypeException.java
new file mode 100644
index 00000000000..a70c707aa6f
--- /dev/null
+++ b/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/security/user/AuthorizableTypeException.java
@@ -0,0 +1,29 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.api.security.user;
+
+import javax.jcr.RepositoryException;
+
+/**
+ * The {@code AuthorizableTypeException} signals an {@link Authorizable} type mismatch.
+ */
+public class AuthorizableTypeException extends RepositoryException {
+
+ public AuthorizableTypeException(String msg) {
+ super(msg);
+ }
+}
diff --git a/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/security/user/Group.java b/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/security/user/Group.java
new file mode 100644
index 00000000000..81bc7bb081b
--- /dev/null
+++ b/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/security/user/Group.java
@@ -0,0 +1,119 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.api.security.user;
+
+import javax.jcr.RepositoryException;
+import javax.jcr.Session;
+
+import java.util.Iterator;
+import java.util.Set;
+
+import org.jetbrains.annotations.NotNull;
+
+/**
+ * A Group is a collection of {@link #getMembers() Authorizable}s.
+ */
+public interface Group extends Authorizable {
+
+ /**
+ * @return Iterator of Authorizable
s which are declared
+ * members of this Group.
+ * @throws RepositoryException If an error occurs.
+ */
+ Iterator getDeclaredMembers() throws RepositoryException;
+
+ /**
+ * @return Iterator of Authorizable
s which are members of
+ * this Group. This includes both declared members and all authorizables
+ * that are indirect group members.
+ * @throws RepositoryException If an error occurs.
+ */
+ Iterator getMembers() throws RepositoryException;
+
+ /**
+ * Test whether an {@link Authorizable} is a declared member of this group.
+ * @param authorizable The Authorizable
to test.
+ * @return true
if the Authorizable to test is a direct member
+ * @throws RepositoryException If an error occurs.
+ */
+ boolean isDeclaredMember(Authorizable authorizable) throws RepositoryException;
+
+ /**
+ * @param authorizable The Authorizable
to test.
+ * @return true if the Authorizable to test is a direct or indirect member
+ * of this Group.
+ * @throws RepositoryException If an error occurs.
+ */
+ boolean isMember(Authorizable authorizable) throws RepositoryException;
+
+ /**
+ * Add a member to this Group.
+ *
+ * @param authorizable The Authorizable
to be added as
+ * member to this group.
+ * @return true if the Authorizable
has successfully been added
+ * to this Group, false otherwise (e.g. unknown implementation
+ * or if it already is a member or if the passed authorizable is this
+ * group itself or for some implementation specific constraint).
+ * @throws RepositoryException If an error occurs.
+ */
+ boolean addMember(Authorizable authorizable) throws RepositoryException;
+
+ /**
+ * Add one or more member(s) to this Group. Note, that an implementation may
+ * define circumstances under which this method allows to add non-existing
+ * {@code Authorizable}s as new members. Also an implementation may choose to
+ * (partially) postpone validation/verification util {@link Session#save()}.
+ *
+ * @param memberIds The {@code Id}s of the authorizables to be added as
+ * members to this group.
+ * @return a set of those {@code memberIds} that could not be added or an
+ * empty set of all ids have been successfully processed. The former may include
+ * those cases where a given id cannot be resolved to an existing authorizable,
+ * one that is already member or if adding the member would create a
+ * cyclic group membership.
+ * @throws RepositoryException If one of the specified memberIds is invalid or
+ * if some other error occurs.
+ */
+ Set addMembers(@NotNull String... memberIds) throws RepositoryException;
+
+ /**
+ * Remove a member from this Group.
+ *
+ * @param authorizable The Authorizable
to be removed from
+ * the list of group members.
+ * @return true if the Authorizable was successfully removed. False otherwise.
+ * @throws RepositoryException If an error occurs.
+ */
+ boolean removeMember(Authorizable authorizable) throws RepositoryException;
+
+ /**
+ * Remove one or several members from this Group. Note, that an implementation
+ * may define circumstances under which this method allows to remove members
+ * that (no longer) exist. An implementation may choose to (partially)
+ * postpone validation/verification util {@link Session#save()}.
+ *
+ * @param memberIds The {@code Id}s of the authorizables to be removed
+ * from the members of this group.
+ * @return a set of those {@code memberIds} that could not be removed or an
+ * empty set if all ids have been successfully processed. The former may include
+ * those cases where a given id cannot be resolved to an existing authorizable.
+ * @throws RepositoryException If one of the specified memberIds is invalid
+ * or if some other error occurs.
+ */
+ Set removeMembers(@NotNull String... memberIds) throws RepositoryException;
+}
diff --git a/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/security/user/Impersonation.java b/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/security/user/Impersonation.java
new file mode 100644
index 00000000000..e03a223ce4f
--- /dev/null
+++ b/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/security/user/Impersonation.java
@@ -0,0 +1,72 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.api.security.user;
+
+import org.apache.jackrabbit.api.security.principal.PrincipalIterator;
+
+import javax.jcr.RepositoryException;
+import javax.security.auth.Subject;
+import java.security.Principal;
+
+/**
+ * The Impersonation
maintains Principals that are allowed to
+ * impersonate. Principals can be added or removed using
+ * {@link #grantImpersonation(Principal)} and
+ * {@link #revokeImpersonation(Principal)}, respectively.
+ *
+ * @see User#getImpersonation()
+ */
+public interface Impersonation {
+
+ /**
+ * @return An iterator over the Principal
s that are allowed
+ * to impersonate the User
this Impersonation
+ * object has been created for.
+ * @throws RepositoryException If an error occurs.
+ */
+ PrincipalIterator getImpersonators() throws RepositoryException;
+
+ /**
+ * @param principal The principal that should be allowed to impersonate
+ * the User
this Impersonation
has been built for.
+ * @return true if the specified Principal
has not been allowed
+ * to impersonate before and if impersonation has been successfully
+ * granted to it, false otherwise.
+ * @throws RepositoryException If an error occurs.
+ */
+ boolean grantImpersonation(Principal principal) throws RepositoryException;
+
+ /**
+ * @param principal The principal that should no longer be allowed to
+ * impersonate.
+ * @return If the granted impersonation has been successfully revoked for
+ * the given principal; false otherwise.
+ * @throws RepositoryException If an error occurs.
+ */
+ boolean revokeImpersonation(Principal principal) throws RepositoryException;
+
+ /**
+ * Test if the given subject (i.e. any of the principals it contains) is
+ * allowed to impersonate.
+ *
+ * @param subject to impersonate.
+ * @return true if this Impersonation
allows the specified
+ * Subject to impersonate.
+ * @throws RepositoryException If an error occurs.
+ */
+ boolean allows(Subject subject) throws RepositoryException;
+}
diff --git a/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/security/user/Query.java b/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/security/user/Query.java
new file mode 100644
index 00000000000..65c2a194e67
--- /dev/null
+++ b/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/security/user/Query.java
@@ -0,0 +1,50 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.jackrabbit.api.security.user;
+
+/**
+ * A query to match {@link Authorizable}s. Pass an instance of this interface to
+ * {@link UserManager#findAuthorizables(Query)}.
+ *
+ * The following query finds all users named 'Bob' which have the word
+ * 'engineer' in its description and returns them in ascending order wrt. to
+ * the name.
+ *
+ *
+ * Iterator<Authorizable> result = userMgr.findAuthorizables(new Query() {
+ * public <T> void build(QueryBuilder<T> builder) {
+ * builder.setCondition(builder.
+ * and(builder.
+ * property("@name", RelationOp.EQ, valueFactory.createValue("Bob")), builder.
+ * contains("@description", "engineer")));
+ *
+ * builder.setSortOrder("@name", Direction.ASCENDING);
+ * builder.setSelector(Selector.USER);
+ * }
+ * });
+ *
+ */
+public interface Query {
+
+ /**
+ * Build the query using a {@link QueryBuilder}.
+ * @param builder A query builder for building the query.
+ * @param Opaque type of the query builder.
+ */
+ void build(QueryBuilder builder);
+}
diff --git a/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/security/user/QueryBuilder.java b/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/security/user/QueryBuilder.java
new file mode 100644
index 00000000000..6a49b882aa5
--- /dev/null
+++ b/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/security/user/QueryBuilder.java
@@ -0,0 +1,292 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.jackrabbit.api.security.user;
+
+import javax.jcr.Value;
+
+public interface QueryBuilder {
+
+ /**
+ * The sort order of the result set of a query.
+ */
+ enum Direction {
+ ASCENDING("ascending"),
+ DESCENDING("descending");
+
+ private final String direction;
+
+ Direction(String direction) {
+ this.direction = direction;
+ }
+
+ public String getDirection() {
+ return direction;
+ }
+ }
+
+ /**
+ * Set the selector for the query. The selector determines whether the query
+ * returns all {@link Authorizable}s or just {@link User}s respectively {@link Group}s.
+ *
+ * @param selector The selector for the query
+ */
+ void setSelector(Class extends Authorizable> selector);
+
+ /**
+ * Set the scope for the query. If set, the query will only return members of a specific group.
+ *
+ * @param groupName Name of the group to restrict the query to.
+ * @param declaredOnly If true
only declared members of the groups are returned.
+ * Otherwise indirect memberships are also considered.
+ */
+ void setScope(String groupName, boolean declaredOnly);
+
+ /**
+ * Set the condition for the query. The query only includes {@link Authorizable}s
+ * for which this condition holds.
+ *
+ * @param condition Condition upon which Authorizables
are included in the query result
+ */
+ void setCondition(T condition);
+
+ /**
+ * Set the sort order of the {@link Authorizable}s returned by the query.
+ * The format of the propertyName
is the same as in XPath:
+ * @propertyName
sorts on a property of the current node.
+ * relative/path/@propertyName
sorts on a property of a
+ * descendant node.
+ *
+ * @param propertyName The name of the property to sort on
+ * @param direction Direction to sort. Either {@link Direction#ASCENDING} or {@link Direction#DESCENDING}
+ * @param ignoreCase Ignore character case in sort if true
. Note: For false
+ * sorting is done lexicographically even for non string properties.
+ */
+ void setSortOrder(String propertyName, Direction direction, boolean ignoreCase);
+
+ /**
+ * Set the sort order of the {@link Authorizable}s returned by the query.
+ * The format of the propertyName
is the same as in XPath:
+ * @propertyName
sorts on a property of the current node.
+ * relative/path/@propertyName
sorts on a property of a
+ * descendant node. Character case is taken into account for the sort order.
+ *
+ * @param propertyName The name of the property to sort on
+ * @param direction Direction to sort. Either {@link Direction#ASCENDING} or {@link Direction#DESCENDING}
+ */
+ void setSortOrder(String propertyName, Direction direction);
+
+ /**
+ * Set limits for the query. The limits consists of a bound and a maximal
+ * number of results. The bound refers to the value of the
+ * {@link #setSortOrder(String, Direction) sort order} property. The
+ * query returns at most maxCount
{@link Authorizable}s whose
+ * values of the sort order property follow bound
in the sort
+ * direction. This method has no effect if the sort order is not specified.
+ *
+ * @param bound Bound from where to start returning results. null
+ * for no bound
+ * @param maxCount Maximal number of results to return. -1 for no limit.
+ */
+ void setLimit(Value bound, long maxCount);
+
+ /**
+ * Set limits for the query. The limits consists of an offset and a maximal
+ * number of results. offset
refers to the offset within the full
+ * result set at which the returned result set should start expressed in terms
+ * of the number of {@link Authorizable}s to skip. maxCount
sets the
+ * maximum size of the result set expressed in terms of the number of authorizables
+ * to return.
+ *
+ * @param offset Offset from where to start returning results. 0
for no offset.
+ * @param maxCount Maximal number of results to return. -1 for no limit.
+ */
+ void setLimit(long offset, long maxCount);
+
+ /**
+ * Create a condition which holds if the name of the {@link Authorizable}
+ * matches a pattern
.
+ * The percent character "%" represents any string of zero or more characters and the
+ * underscore character "_" represents any single character. Any literal use of these characters
+ * and the backslash character "\" must be escaped with a backslash character.
+ * The pattern is matched against the {@link Authorizable#getID() id} and the
+ * {@link Authorizable#getPrincipal() principal}.
+ *
+ * @param pattern Pattern to match the name of an authorizable.
+ * @return A condition
+ */
+ T nameMatches(String pattern);
+
+ /**
+ * Create a condition which holds if the node of an {@link Authorizable} has a
+ * property at relPath
which is not equal to value
.
+ * The format of the relPath
argument is the same as in XPath:
+ * @attributeName
for an attribute on this node and
+ * relative/path/@attributeName
for an attribute of a descendant node.
+ *
+ * @param relPath Relative path from the authorizable's node to the property
+ * @param value Value to compare the property at relPath
to
+ * @return A condition
+ */
+ T neq(String relPath, Value value);
+
+ /**
+ * Create a condition which holds if the node of an {@link Authorizable} has a
+ * property at relPath
which is equal to value
.
+ * The format of the relPath
argument is the same as in XPath:
+ * @attributeName
for an attribute on this node and
+ * relative/path/@attributeName
for an attribute of a descendant node.
+ *
+ * @param relPath Relative path from the authorizable's node to the property
+ * @param value Value to compare the property at relPath
to
+ * @return A condition
+ */
+ T eq(String relPath, Value value);
+
+ /**
+ * Create a condition which holds if the node of an {@link Authorizable} has a
+ * property at relPath
which is smaller than value
.
+ * The format of the relPath
argument is the same as in XPath:
+ * @attributeName
for an attribute on this node and
+ * relative/path/@attributeName
for an attribute of a descendant node.
+ *
+ * @param relPath Relative path from the authorizable's node to the property
+ * @param value Value to compare the property at relPath
to
+ * @return A condition
+ */
+ T lt(String relPath, Value value);
+
+ /**
+ * Create a condition which holds if the node of an {@link Authorizable} has a
+ * property at relPath
which is smaller than or equal to value
.
+ * The format of the relPath
argument is the same as in XPath:
+ * @attributeName
for an attribute on this node and
+ * relative/path/@attributeName
for an attribute of a descendant node.
+ *
+ * @param relPath Relative path from the authorizable's node to the property
+ * @param value Value to compare the property at relPath
to
+ * @return A condition
+ */
+ T le(String relPath, Value value);
+
+ /**
+ * Create a condition which holds if the node of an {@link Authorizable} has a
+ * property at relPath
which is greater than value
.
+ * The format of the relPath
argument is the same as in XPath:
+ * @attributeName
for an attribute on this node and
+ * relative/path/@attributeName
for an attribute of a descendant node.
+ *
+ * @param relPath Relative path from the authorizable's node to the property
+ * @param value Value to compare the property at relPath
to
+ * @return A condition
+ */
+ T gt(String relPath, Value value);
+
+ /**
+ * Create a condition which holds if the node of an {@link Authorizable} has a
+ * property at relPath
which is greater than or equal to value
.
+ * The format of the relPath
argument is the same as in XPath:
+ * @attributeName
for an attribute on this node and
+ * relative/path/@attributeName
for an attribute of a descendant node.
+ *
+ * @param relPath Relative path from the authorizable's node to the property
+ * @param value Value to compare the property at relPath
to
+ * @return A condition
+ */
+ T ge(String relPath, Value value);
+
+ /**
+ * Create a condition which holds if the node of an {@link Authorizable} has a
+ * property at relPath
.
+ * The format of the relPath
argument is the same as in XPath:
+ * @attributeName
for an attribute on this node and
+ * relative/path/@attributeName
for an attribute of a descendant node.
+ *
+ * @param relPath Relative path from the authorizable's node to the property
+ * @return A condition
+ */
+ T exists(String relPath);
+
+ /**
+ * Create a condition which holds if the node of an {@link Authorizable} has a
+ * property at relPath
which matches the pattern in pattern
.
+ * The percent character "%" represents any string of zero or more characters and the
+ * underscore character "_" represents any single character. Any literal use of these characters
+ * and the backslash character "\" must be escaped with a backslash character.
+ * The format of the relPath
argument is the same as in XPath:
+ * @attributeName
for an attribute on this node and
+ * relative/path/@attributeName
for an attribute of a descendant node.
+ *
+ * @param relPath Relative path from the authorizable's node to the property
+ * @param pattern Pattern to match the property at relPath
against
+ * @return A condition
+ */
+ T like(String relPath, String pattern);
+
+ /**
+ * Create a full text search condition. The condition holds if the node of an
+ * {@link Authorizable} has a property at relPath
for which
+ * searchExpr
yields results.
+ * The format of the relPath
argument is the same as in XPath:
+ * .
searches all properties of the current node, @attributeName
+ * searches the attributeName property of the current node, relative/path/.
+ * searches all properties of the descendant node at relative/path and
+ * relative/path/@attributeName
searches the attributeName property
+ * of the descendant node at relative/path.
+ * The syntax of searchExpr
is [-]value { [OR] [-]value }
.
+ *
+ * @param relPath Relative path from the authorizable's node to the property
+ * @param searchExpr A full text search expression
+ * @return A condition
+ */
+ T contains(String relPath, String searchExpr);
+
+ /**
+ * Create a condition which holds for {@link Authorizable}s which can impersonate as
+ * name
.
+ *
+ * @param name Name of an authorizable
+ * @return A condition
+ */
+ T impersonates(String name);
+
+ /**
+ * Return a condition which holds if condition
does not hold.
+ *
+ * @param condition Condition to negate
+ * @return A condition
+ */
+ T not(T condition);
+
+ /**
+ * Return a condition which holds if both sub conditions hold.
+ *
+ * @param condition1 first sub condition
+ * @param condition2 second sub condition
+ * @return A condition
+ */
+ T and(T condition1, T condition2);
+
+ /**
+ * Return a condition which holds if any of the two sub conditions hold.
+ *
+ * @param condition1 first sub condition
+ * @param condition2 second sub condition
+ * @return A condition
+ */
+ T or(T condition1, T condition2);
+}
diff --git a/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/security/user/User.java b/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/security/user/User.java
new file mode 100644
index 00000000000..e02e3db9a4a
--- /dev/null
+++ b/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/security/user/User.java
@@ -0,0 +1,107 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.api.security.user;
+
+import javax.jcr.RepositoryException;
+import javax.jcr.Credentials;
+
+/**
+ * User is a special {@link Authorizable} that can be authenticated and
+ * impersonated.
+ *
+ * @see #getCredentials()
+ * @see #getImpersonation()
+ */
+public interface User extends Authorizable {
+
+ /**
+ * @return true if the current user represents the administrator.
+ */
+ boolean isAdmin();
+
+ /**
+ * @return true if the current user represents a system user.
+ */
+ boolean isSystemUser();
+
+ /**
+ * Returns the internal Credentials
representation for this
+ * user. This method is expected to be used for validation during the
+ * login process. However, the return value should neither be usable nor
+ * used for {@link javax.jcr.Repository#login}.
+ *
+ * @return Credentials
for this user.
+ * @throws javax.jcr.RepositoryException If an error occurs.
+ */
+ Credentials getCredentials() throws RepositoryException;
+
+ /**
+ * @return Impersonation
for this User
.
+ * @throws javax.jcr.RepositoryException If an error occurs.
+ */
+ Impersonation getImpersonation() throws RepositoryException;
+
+ /**
+ * Change the password of this user.
+ *
+ * @param password The new password.
+ * @throws RepositoryException If an error occurs.
+ */
+ void changePassword(String password) throws RepositoryException;
+
+ /**
+ * Change the password of this user.
+ *
+ * @param password The new password.
+ * @param oldPassword The old password.
+ * @throws RepositoryException If the old password doesn't match or if
+ * an error occurs.
+ */
+ void changePassword(String password, String oldPassword) throws RepositoryException;
+
+ /**
+ * Disable this user thus preventing future login if the reason
+ * is a non-null String.
+ * Note however, that this user will still be accessible by
+ * {@link UserManager#getAuthorizable}.
+ *
+ * @param reason String describing the reason for disable this user or
+ * null
if the user account should be enabled again.
+ * @throws RepositoryException If an error occurs.
+ */
+ void disable(String reason) throws RepositoryException;
+
+ /**
+ * Returns true
if this user is disabled, false
+ * otherwise.
+ *
+ * @return true
if this user is disabled, false
+ * otherwise.
+ * @throws RepositoryException If an error occurs.
+ */
+ boolean isDisabled() throws RepositoryException;
+
+ /**
+ * Returns the String specified upon disabling this user or null
+ * if {@link #isDisabled()} returns false
.
+ *
+ * @return The reason specified upon disabling this user or null
+ * if this user is not disabled.
+ * @throws RepositoryException If an error occurs.
+ */
+ String getDisabledReason() throws RepositoryException;
+}
diff --git a/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/security/user/UserManager.java b/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/security/user/UserManager.java
new file mode 100644
index 00000000000..cc46db1a29e
--- /dev/null
+++ b/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/security/user/UserManager.java
@@ -0,0 +1,316 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.api.security.user;
+
+import java.security.Principal;
+import java.util.Iterator;
+
+import javax.jcr.RepositoryException;
+import javax.jcr.Session;
+import javax.jcr.UnsupportedRepositoryOperationException;
+
+import org.osgi.annotation.versioning.ProviderType;
+
+/**
+ * The UserManager
provides access to and means to maintain
+ * {@link Authorizable authorizable objects} i.e. {@link User users} and
+ * {@link Group groups}. The UserManager
is bound to a particular
+ * Session
.
+ *
+ * Note that all create
calls will modify the session associated
+ * with the {@linkplain UserManager} (whether this is the current session or not
+ * depends on the repository configuration). If the user manager is not
+ * in "autosave" mode (see {@link UserManager#isAutoSave()}), problems like
+ * overlapping creation of intermediate nodes may only surface upon a subsequent
+ * {@link Session#save()} operation; callers should be prepared to repeat them
+ * in case this happens.
+ */
+@ProviderType
+public interface UserManager {
+
+ /**
+ * Filter flag indicating that only User
s should be searched
+ * and returned.
+ */
+ int SEARCH_TYPE_USER = 1;
+
+ /**
+ * Filter flag indicating that only Group
s should be searched
+ * and returned.
+ */
+ int SEARCH_TYPE_GROUP = 2;
+
+ /**
+ * Filter flag indicating that all Authorizable
s should be
+ * searched.
+ */
+ int SEARCH_TYPE_AUTHORIZABLE = 3;
+
+ /**
+ * Get the Authorizable by its id.
+ *
+ * @param id The user or group id.
+ * @return Authorizable or null
, if not present.
+ * @throws RepositoryException If an error occurs.
+ * @see Authorizable#getID()
+ */
+ Authorizable getAuthorizable(String id) throws RepositoryException;
+
+ /**
+ * Get the Authorizable of a specific type by its id.
+ *
+ * @param id the user or group id.
+ * @param authorizableClass the class of the type of Authorizable required; must not be null
.
+ * @param the required Authorizable type.
+ * @return Authorizable or null
, if not present.
+ * @throws AuthorizableTypeException If an authorizable exists but is not of the requested type.
+ * @throws RepositoryException If an error occurs
+ */
+ T getAuthorizable(String id, Class authorizableClass) throws AuthorizableTypeException, RepositoryException;
+
+ /**
+ * Get the Authorizable by its Principal.
+ *
+ * @param principal The principal of the authorizable to retrieve.
+ * @return Authorizable or null
, if not present.
+ * @throws RepositoryException If an error occurs.
+ */
+ Authorizable getAuthorizable(Principal principal) throws RepositoryException;
+
+ /**
+ * In accordance to {@link org.apache.jackrabbit.api.security.user.Authorizable#getPath()}
+ * this method allows to retrieve an given authorizable by it's path.
+ *
+ * @param path The path to an authorizable.
+ * @return Authorizable or null
, if not present.
+ * @throws UnsupportedRepositoryOperationException If this implementation does
+ * support to retrieve authorizables by path.
+ * @throws RepositoryException If another error occurs.
+ * @see org.apache.jackrabbit.api.security.user.Authorizable#getPath()
+ */
+ Authorizable getAuthorizableByPath(String path) throws UnsupportedRepositoryOperationException, RepositoryException;
+
+ /**
+ * Returns all Authorizable
s that have a
+ * {@link Authorizable#getProperty(String) property} with the given relative
+ * path (or name) that matches the specified value.
+ *
+ * If a relative path with more than one segment is specified only properties
+ * exactly matching that patch will be returned. If, however, a name is
+ * specified all properties that may be retrieved using
+ * {@link Authorizable#getProperty(String)} will be searched for a match.
+ *
+ * @param relPath A relative property path or name.
+ * @param value A string value to match.
+ * @return All Authorizable
s that have a property with the given
+ * name exactly matching the given value.
+ * @throws RepositoryException If an error occurs.
+ * @see Authorizable#getProperty(String)
+ */
+ Iterator findAuthorizables(String relPath, String value) throws RepositoryException;
+
+ /**
+ * Returns all Authorizable
s that have a
+ * {@link Authorizable#getProperty(String) property} with the given relative
+ * path (or name) that matches the specified value. In contrast to
+ * {@link #findAuthorizables(String, String)} the type of authorizable is
+ * respected while executing the search.
+ *
+ * If a relative path with more than one segment is specified only properties
+ * exactly matching that path will be returned. If, however, a name is
+ * specified all properties that may be retrieved using
+ * {@link Authorizable#getProperty(String)} will be searched for a match.
+ *
+ * @param relPath A relative property path or name.
+ * @param value A string value to match.
+ * @param searchType Any of the following constants:
+ *
+ * - {@link #SEARCH_TYPE_AUTHORIZABLE}
+ * - {@link #SEARCH_TYPE_GROUP}
+ * - {@link #SEARCH_TYPE_USER}
+ *
+ * @return An iterator of Authorizable
.
+ * @throws RepositoryException If an error occurs.
+ */
+ Iterator findAuthorizables(String relPath, String value, int searchType) throws RepositoryException;
+
+ /**
+ * Return {@link Authorizable}s that match a specific {@link Query}.
+ *
+ * @param query A query
+ * @return Iterator of authorizables witch match the query
.
+ * @throws RepositoryException If an error occurs.
+ */
+ Iterator findAuthorizables(Query query) throws RepositoryException;
+
+ /**
+ * Creates an User for the given userID / password pair; neither of the
+ * specified parameters can be null
.
+ * Same as {@link #createUser(String,String,Principal,String)} where
+ * the specified userID is equal to the principal name and the intermediate
+ * path is null
.
+ *
+ * @param userID The ID of the new user.
+ * @param password The initial password of this user.
+ * @return The new User
.
+ * @throws AuthorizableExistsException in case the given userID is already
+ * in use or another Authorizable with the same principal name exists.
+ * @throws RepositoryException If another error occurs.
+ */
+ User createUser(String userID, String password) throws AuthorizableExistsException, RepositoryException;
+
+ /**
+ * Creates an User for the given parameters. If the implementation is not
+ * able to deal with the intermediatePath
that parameter should
+ * be ignored.
+ * Except for the intermediatePath
, neither of the specified
+ * parameters can be null
.
+ *
+ * @param userID The ID of the new user.
+ * @param password The initial password of the new user.
+ * @param principal The principal of the new user.
+ * @param intermediatePath An optional intermediate path used to create the
+ * new user. If the intermediate path is null
an internal,
+ * implementation specific structure will be used.
+ * @return The new User
.
+ * @throws AuthorizableExistsException in case the given userID is already
+ * in use or another Authorizable with the same principal name exists.
+ * @throws RepositoryException If the current Session is
+ * not allowed to create users or some another error occurs.
+ */
+ User createUser(String userID, String password, Principal principal,
+ String intermediatePath) throws AuthorizableExistsException, RepositoryException;
+
+
+ /**
+ * Create a new system user for the specified {@code userID}. The new authorizable
+ * is required to have the following characteristics:
+ *
+ *
+ * - {@link org.apache.jackrabbit.api.security.user.User#isSystemUser()} returns {@code true}.
+ * - The system user doesn't have a password set and doesn't allow change the password.
+ * - The principal name is generated by the system; it may be the same as {@code userID}.
+ * - A given implementation may choose to keep system users in a dedicated
+ * location and thus may impose restrictions on the {@code intermediatePath}.
+ *
+ *
+ * @param userID A valid userID.
+ * @param intermediatePath An optional intermediate path to create the new
+ * system user. The implemenation may decide to reject intermediate paths
+ * if they violate an implementation specific requirement with respect to
+ * the location where systems users are being held. If the intermediate path
+ * is {@code null} an internal implementation specific structure will be used.
+ * @return The new system user.
+ * @throws AuthorizableExistsException if an Authorizable with this id already exists.
+ * @throws RepositoryException If another error occurs.
+ */
+ User createSystemUser(String userID, String intermediatePath) throws AuthorizableExistsException, RepositoryException;
+
+ /**
+ * Creates a Group for the given groupID, which must not be null
.
+ *
+ * Same as {@link #createGroup(String, Principal,String)} where the specified
+ * groupID is the name of the Principal
the intermediate path
+ * is null
.
+ *
+ * @param groupID The ID of the new group; must not be null
.
+ * @return The new Group
.
+ * @throws AuthorizableExistsException in case the given groupID is already
+ * in use or another {@link Authorizable} with the same
+ * {@link Authorizable#getID() ID} or principal name already exists.
+ * @throws RepositoryException If another error occurs.
+ */
+ Group createGroup(String groupID) throws AuthorizableExistsException, RepositoryException;
+
+ /**
+ * Creates a new Group
that is based on the given principal.
+ * Note that the group's ID is implementation specific. The implementation
+ * may take the principal name as ID hint but must in any case assert that
+ * it is unique among the IDs known to this manager.
+ *
+ * @param principal A non-null Principal
+ * @return The new Group
.
+ * @throws AuthorizableExistsException in case the given principal is
+ * already in use with another Authorizable.
+ * @throws RepositoryException If another error occurs.
+ */
+ Group createGroup(Principal principal) throws AuthorizableExistsException, RepositoryException;
+
+ /**
+ * Same as {@link #createGroup(String, Principal, String)} where the
+ * name of the specified principal is used to create the group's ID.
+ *
+ * @param principal The principal associated with the new group.
+ * @param intermediatePath An optional intermediate path used to create the
+ * new group. If the intermediate path is null
an internal,
+ * implementation specific structure will be used.
+ * @return The new Group
.
+ * @throws AuthorizableExistsException in case the given principal is
+ * already in use with another Authorizable.
+ * @throws RepositoryException If another error occurs.
+ */
+ Group createGroup(Principal principal, String intermediatePath) throws AuthorizableExistsException, RepositoryException;
+
+ /**
+ * Creates a new Group
that is based on the given id, principal
+ * and the specified intermediatePath
hint. If the implementation
+ * is not able to deal with the intermediatePath
this parameter
+ * should be ignored.
+ *
+ * @param groupID The ID of the new group.
+ * @param principal The principal of the new group.
+ * @param intermediatePath An optional intermediate path used to create the
+ * new group. If the intermediate path is null
an internal,
+ * implementation specific structure will be used.
+ * @return The new Group
.
+ * @throws AuthorizableExistsException in case the given principal is already
+ * in use with another Authorizable.
+ * @throws RepositoryException If another error occurs.
+ */
+ Group createGroup(String groupID, Principal principal, String intermediatePath) throws AuthorizableExistsException, RepositoryException;
+
+ /**
+ * If any write operations executed through the User API are automatically
+ * persisted this method returns true
. In this case there are
+ * no pending transient changes left and there is no need to explicitly call
+ * {@link javax.jcr.Session#save()}. If this method returns false
+ * any changes must be completed by an extra save call on the
+ * Session
associated with this UserManager
.
+ *
+ * @return true
if changes are automatically persisted;
+ * false
if changes made through this API (including method
+ * calls on {@link Authorizable} and subclasses are only transient and
+ * must be persisted using {@link javax.jcr.Session#save()}.
+ * @see #autoSave(boolean)
+ */
+ boolean isAutoSave();
+
+ /**
+ * Changes the auto save behavior of this UserManager
.
+ *
+ * Note, that this shouldn't be allowed in cases where the associated session
+ * is different from the original session accessing the user manager.
+ *
+ * @param enable If true
changes made through this API will
+ * be automatically saved; otherwise an explicit call to
+ * {@link javax.jcr.Session#save()} is required in order to persist changes.
+ * @throws UnsupportedRepositoryOperationException If the implementation
+ * does not allow to change the auto save behavior.
+ * @throws RepositoryException If some other error occurs.
+ */
+ void autoSave(boolean enable) throws UnsupportedRepositoryOperationException, RepositoryException;
+}
diff --git a/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/security/user/package-info.java b/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/security/user/package-info.java
new file mode 100644
index 00000000000..50e7742eeb0
--- /dev/null
+++ b/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/security/user/package-info.java
@@ -0,0 +1,22 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * Jackrabbit extensions for user management.
+ */
+@org.osgi.annotation.versioning.Version("2.4.2")
+package org.apache.jackrabbit.api.security.user;
diff --git a/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/stats/QueryStat.java b/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/stats/QueryStat.java
new file mode 100644
index 00000000000..13786db55ba
--- /dev/null
+++ b/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/stats/QueryStat.java
@@ -0,0 +1,94 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.api.stats;
+
+/**
+ * Statistics on query operations
+ *
+ */
+public interface QueryStat {
+
+ /**
+ * @return a sorted array containing the top
+ * {@link #getSlowQueriesQueueSize()} slowest queries
+ */
+ QueryStatDto[] getSlowQueries();
+
+ /**
+ * @return size of the Slow queue
+ */
+ int getSlowQueriesQueueSize();
+
+ /**
+ * Change the size of the Slow queue
+ *
+ * @param size
+ * the new size
+ */
+ void setSlowQueriesQueueSize(int size);
+
+ /**
+ * clears the Slow queue
+ */
+ void clearSlowQueriesQueue();
+
+ /**
+ * @return a sorted array containing the
+ * {@link #getPopularQueriesQueueSize()} most popular queries
+ */
+ QueryStatDto[] getPopularQueries();
+
+ /**
+ * @return size of the Popular queue
+ */
+ int getPopularQueriesQueueSize();
+
+ /**
+ * Change the size of the Popular queue
+ *
+ * @param size
+ * the new size
+ */
+ void setPopularQueriesQueueSize(int size);
+
+ /**
+ * clears the Popular queue
+ */
+ void clearPopularQueriesQueue();
+
+ /** -- GENERAL OPS -- **/
+
+ /**
+ * If this service is currently registering stats
+ *
+ * @return true
if the service is enabled
+ */
+ boolean isEnabled();
+
+ /**
+ * Enables/Disables the service
+ *
+ * @param enabled
+ */
+ void setEnabled(boolean enabled);
+
+ /**
+ * clears all data
+ */
+ void reset();
+
+}
diff --git a/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/stats/QueryStatDto.java b/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/stats/QueryStatDto.java
new file mode 100644
index 00000000000..4f66fcada87
--- /dev/null
+++ b/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/stats/QueryStatDto.java
@@ -0,0 +1,41 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.api.stats;
+
+import java.io.Serializable;
+
+/**
+ * Object that holds statistical info about a query.
+ *
+ */
+public interface QueryStatDto extends Serializable {
+
+ long getDuration();
+
+ String getLanguage();
+
+ String getStatement();
+
+ String getCreationTime();
+
+ int getOccurrenceCount();
+
+ long getPosition();
+
+ void setPosition(long position);
+
+}
diff --git a/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/stats/RepositoryStatistics.java b/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/stats/RepositoryStatistics.java
new file mode 100644
index 00000000000..4d206262d91
--- /dev/null
+++ b/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/stats/RepositoryStatistics.java
@@ -0,0 +1,147 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.api.stats;
+
+
+/**
+ * Statistics on core repository operations
+ *
+ */
+public interface RepositoryStatistics {
+
+ /**
+ * The values of this enum determine the type of the time
+ * series returned by {@link #getTimeSeries(Type)}
+ * and link {@link #getTimeSeries(String, boolean)}.
+ */
+ enum Type {
+ BUNDLE_READ_COUNTER(true),
+ BUNDLE_WRITE_COUNTER(true),
+ BUNDLE_WRITE_DURATION(true),
+ BUNDLE_WRITE_AVERAGE(false),
+ BUNDLE_CACHE_ACCESS_COUNTER(true),
+ BUNDLE_CACHE_SIZE_COUNTER(false),
+ BUNDLE_CACHE_MISS_COUNTER(true),
+ BUNDLE_CACHE_MISS_DURATION(true),
+ BUNDLE_CACHE_MISS_AVERAGE(false),
+ BUNDLE_COUNTER(true),
+ BUNDLE_WS_SIZE_COUNTER(true),
+
+ /**
+ * Number of read accesses through any session.
+ */
+ SESSION_READ_COUNTER(true),
+
+ /**
+ * Total time spent reading from sessions in nano seconds.
+ */
+ SESSION_READ_DURATION(true),
+
+ /**
+ * Average time spent reading from sessions in nano seconds.
+ * This is the sum of all read durations divided by the number
+ * of reads in the respective time period.
+ */
+ SESSION_READ_AVERAGE(false),
+
+ /**
+ * Number of write accesses through any session.
+ */
+ SESSION_WRITE_COUNTER(true),
+
+ /**
+ * Total time spent writing to sessions in nano seconds.
+ */
+ SESSION_WRITE_DURATION(true),
+
+ /**
+ * Average time spent writing to sessions in nano seconds.
+ * This is the sum of all write durations divided by the number
+ * of writes in the respective time period.
+ */
+ SESSION_WRITE_AVERAGE(false),
+
+ /**
+ * Number of calls sessions that have been logged in.
+ */
+ SESSION_LOGIN_COUNTER(true),
+
+ /**
+ * Number of currently logged in sessions.
+ */
+ SESSION_COUNT(false),
+
+ /**
+ * Number of queries executed.
+ */
+ QUERY_COUNT(true),
+
+ /**
+ * Total time spent evaluating queries in milli seconds.
+ */
+ QUERY_DURATION(true),
+
+ /**
+ * Average time spent evaluating queries in milli seconds.
+ * This is the sum of all query durations divided by the number
+ * of queries in the respective time period.
+ */
+ QUERY_AVERAGE(true),
+
+ /**
+ * Total number of observation {@code Event} instances delivered
+ * to all observation listeners.
+ */
+ OBSERVATION_EVENT_COUNTER(true),
+
+ /**
+ * Total time spent processing observation events by all observation
+ * listeners in nano seconds.
+ */
+ OBSERVATION_EVENT_DURATION(true),
+
+ /**
+ * Average time spent processing observation events by all observation
+ * listeners in nano seconds.
+ * This is the sum of all observation durations divided by the number
+ * of observation events in the respective time period.
+ */
+ OBSERVATION_EVENT_AVERAGE(true);
+
+ private final boolean resetValueEachSecond;
+
+ Type(final boolean resetValueEachSecond) {
+ this.resetValueEachSecond = resetValueEachSecond;
+ }
+
+ public static Type getType(String type) {
+ Type realType = null;
+ try {
+ realType = valueOf(type);
+ } catch (IllegalArgumentException ignore) {}
+ return realType;
+ }
+
+ public boolean isResetValueEachSecond() {
+ return resetValueEachSecond;
+ }
+ }
+
+ TimeSeries getTimeSeries(Type type);
+
+ TimeSeries getTimeSeries(String type, boolean resetValueEachSecond);
+}
diff --git a/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/stats/TimeSeries.java b/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/stats/TimeSeries.java
new file mode 100755
index 00000000000..6c21a32265b
--- /dev/null
+++ b/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/stats/TimeSeries.java
@@ -0,0 +1,64 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.api.stats;
+
+/**
+ * Interface for a time series of the measured values per
+ * second, minute, hour and day. The type of the value is arbitrary; it
+ * could be cache hits or misses, disk reads or writes, created sessions,
+ * completed transactions, or pretty much anything of interest.
+ *
+ * @since Apache Jackrabbit 2.3.2
+ */
+public interface TimeSeries {
+
+ /**
+ * Returns the measured value per second over the last minute.
+ *
+ * @return measured value per second, in chronological order
+ */
+ long[] getValuePerSecond();
+
+ /**
+ * Returns the measured value per minute over the last hour.
+ *
+ * @return measured value per minute, in chronological order
+ */
+ long[] getValuePerMinute();
+
+ /**
+ * Returns the measured value per hour over the last week.
+ *
+ * @return measured value per hour, in chronological order
+ */
+ long[] getValuePerHour();
+
+ /**
+ * Returns the measured value per week over the last three years.
+ *
+ * @return measured value per week, in chronological order
+ */
+ long[] getValuePerWeek();
+
+ /**
+ * The value used to encode missing values i.e. for a period where no value was recorded.
+ *
+ * @return default value
+ */
+ long getMissingValue();
+
+}
diff --git a/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/stats/package-info.java b/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/stats/package-info.java
new file mode 100644
index 00000000000..dc88a2d541c
--- /dev/null
+++ b/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/stats/package-info.java
@@ -0,0 +1,22 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * Jackrabbit repository statistics
+ */
+@org.osgi.annotation.versioning.Version("1.2.0")
+package org.apache.jackrabbit.api.stats;
diff --git a/jackrabbit-api/src/main/javadoc/org/apache/jackrabbit/api/package.html b/jackrabbit-api/src/main/javadoc/org/apache/jackrabbit/api/package.html
new file mode 100644
index 00000000000..135c2bfaea9
--- /dev/null
+++ b/jackrabbit-api/src/main/javadoc/org/apache/jackrabbit/api/package.html
@@ -0,0 +1,19 @@
+
+
+Contains set of interfaces that form the Jackrabbit-specific extensions to the JCR API
+
diff --git a/jackrabbit-aws-ext/README.txt b/jackrabbit-aws-ext/README.txt
new file mode 100644
index 00000000000..864329c95e7
--- /dev/null
+++ b/jackrabbit-aws-ext/README.txt
@@ -0,0 +1,28 @@
+====================================================
+Welcome to Jackrabbit Amazon WebServices Extension
+====================================================
+
+This is the Amazon Webservices Extension component of the Apache Jackrabbit project.
+This component contains S3 Datastore which stores binaries on Amazon S3 (http://aws.amazon.com/s3).
+
+====================================================
+Build Instructions
+====================================================
+To build the latest SNAPSHOT versions of all the components
+included here, run the following command with Maven 3:
+
+ mvn clean install
+
+To run testcases which stores in S3 bucket, please pass aws config file via system property. For e.g.
+
+ mvn clean install -DargLine="-Dconfig=/opt/cq/aws.properties"
+
+Sample aws properties located at src/test/resources/aws.properties
+
+====================================================
+Configuration Instructions
+====================================================
+It require to configure aws.properties to configure S3 Datastore.
+
+
+
diff --git a/jackrabbit-aws-ext/pom.xml b/jackrabbit-aws-ext/pom.xml
new file mode 100644
index 00000000000..07f13293fad
--- /dev/null
+++ b/jackrabbit-aws-ext/pom.xml
@@ -0,0 +1,113 @@
+
+
+
+
+
+ 4.0.0
+
+
+
+
+
+ org.apache.jackrabbit
+ jackrabbit-parent
+ 2.17.5-SNAPSHOT
+ ../jackrabbit-parent/pom.xml
+
+ jackrabbit-aws-ext
+ Jackrabbit AWS Extension
+ Jackrabbit extenstion to Amazon Webservices
+ bundle
+
+
+
+
+
+
+ javax.jcr
+ jcr
+
+
+ org.osgi
+ org.osgi.annotation
+ provided
+
+
+ org.apache.jackrabbit
+ jackrabbit-jcr-commons
+ ${project.version}
+
+
+ com.amazonaws
+ aws-java-sdk-s3
+ 1.11.330
+
+
+ org.apache.jackrabbit
+ jackrabbit-data
+ ${project.version}
+
+
+ org.apache.jackrabbit
+ jackrabbit-data
+ ${project.version}
+ test-jar
+
+
+ org.slf4j
+ slf4j-api
+
+
+
+ junit
+ junit
+ test
+
+
+ org.slf4j
+ slf4j-log4j12
+ test
+
+
+
+
+
+ maven-surefire-plugin
+
+
+ **/aws/**/TestAll.java
+
+
+
+
+ org.apache.felix
+ maven-bundle-plugin
+ true
+
+
+ org.apache.jackrabbit.aws.ext.ds
+ sun.io
+
+
+
+
+ org.apache.rat
+ apache-rat-plugin
+
+
+ .checkstyle
+
+
+
+
+
+
diff --git a/jackrabbit-aws-ext/src/main/java/org/apache/jackrabbit/aws/ext/S3Constants.java b/jackrabbit-aws-ext/src/main/java/org/apache/jackrabbit/aws/ext/S3Constants.java
new file mode 100644
index 00000000000..29da427a06d
--- /dev/null
+++ b/jackrabbit-aws-ext/src/main/java/org/apache/jackrabbit/aws/ext/S3Constants.java
@@ -0,0 +1,117 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.jackrabbit.aws.ext;
+
+/**
+ * Defined Amazon S3 constants.
+ */
+public final class S3Constants {
+
+ /**
+ * Amazon aws access key.
+ */
+ public static final String ACCESS_KEY = "accessKey";
+
+ /**
+ * Amazon aws secret key.
+ */
+ public static final String SECRET_KEY = "secretKey";
+
+ /**
+ * Amazon S3 Http connection timeout.
+ */
+ public static final String S3_CONN_TIMEOUT = "connectionTimeout";
+
+ /**
+ * Amazon S3 socket timeout.
+ */
+ public static final String S3_SOCK_TIMEOUT = "socketTimeout";
+
+ /**
+ * Amazon S3 maximum connections to be used.
+ */
+ public static final String S3_MAX_CONNS = "maxConnections";
+
+ /**
+ * Amazon S3 maximum retries.
+ */
+ public static final String S3_MAX_ERR_RETRY = "maxErrorRetry";
+
+ /**
+ * Amazon aws S3 bucket.
+ */
+ public static final String S3_BUCKET = "s3Bucket";
+
+ /**
+ * Amazon aws S3 region.
+ */
+ public static final String S3_REGION = "s3Region";
+
+ /**
+ * Amazon aws S3 region.
+ */
+ public static final String S3_END_POINT = "s3EndPoint";
+
+ /**
+ * Constant for S3 Connector Protocol
+ */
+ public static final String S3_CONN_PROTOCOL = "s3ConnProtocol";
+
+ /**
+ * Constant to rename keys
+ */
+ public static final String S3_RENAME_KEYS = "s3RenameKeys";
+
+ /**
+ * Constant to rename keys
+ */
+ public static final String S3_WRITE_THREADS = "writeThreads";
+
+ /**
+ * Constant to enable encryption in S3.
+ */
+ public static final String S3_ENCRYPTION = "s3Encryption";
+
+ /**
+ * Constant for no encryption. it is default.
+ */
+ public static final String S3_ENCRYPTION_NONE = "NONE";
+
+ /**
+ * Constant to set SSE_S3 encryption.
+ */
+ public static final String S3_ENCRYPTION_SSE_S3 = "SSE_S3";
+
+ /**
+ * Constant to set proxy host.
+ */
+ public static final String PROXY_HOST = "proxyHost";
+
+ /**
+ * Constant to set proxy port.
+ */
+ public static final String PROXY_PORT = "proxyPort";
+
+ /**
+ * private constructor so that class cannot initialized from outside.
+ */
+ private S3Constants() {
+
+ }
+
+}
diff --git a/jackrabbit-aws-ext/src/main/java/org/apache/jackrabbit/aws/ext/S3RequestDecorator.java b/jackrabbit-aws-ext/src/main/java/org/apache/jackrabbit/aws/ext/S3RequestDecorator.java
new file mode 100644
index 00000000000..2fcc2444ffe
--- /dev/null
+++ b/jackrabbit-aws-ext/src/main/java/org/apache/jackrabbit/aws/ext/S3RequestDecorator.java
@@ -0,0 +1,87 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.jackrabbit.aws.ext;
+
+import java.util.Properties;
+
+import com.amazonaws.services.s3.model.CopyObjectRequest;
+import com.amazonaws.services.s3.model.ObjectMetadata;
+import com.amazonaws.services.s3.model.PutObjectRequest;
+
+/**
+ * This class to sets encrption mode in S3 request.
+ *
+ */
+public class S3RequestDecorator {
+ DataEncryption dataEncryption = DataEncryption.NONE;
+
+ public S3RequestDecorator(Properties props) {
+ if (props.getProperty(S3Constants.S3_ENCRYPTION) != null) {
+ this.dataEncryption = dataEncryption.valueOf(props.getProperty(S3Constants.S3_ENCRYPTION));
+ }
+ }
+
+ /**
+ * Set encryption in {@link PutObjectRequest}
+ */
+ public PutObjectRequest decorate(PutObjectRequest request) {
+ switch (getDataEncryption()) {
+ case SSE_S3:
+ ObjectMetadata metadata = request.getMetadata() == null
+ ? new ObjectMetadata()
+ : request.getMetadata();
+ metadata.setSSEAlgorithm(ObjectMetadata.AES_256_SERVER_SIDE_ENCRYPTION);
+ request.setMetadata(metadata);
+ break;
+ case NONE:
+ break;
+ }
+ return request;
+ }
+
+ /**
+ * Set encryption in {@link CopyObjectRequest}
+ */
+ public CopyObjectRequest decorate(CopyObjectRequest request) {
+ switch (getDataEncryption()) {
+ case SSE_S3:
+ ObjectMetadata metadata = request.getNewObjectMetadata() == null
+ ? new ObjectMetadata()
+ : request.getNewObjectMetadata();
+ metadata.setSSEAlgorithm(ObjectMetadata.AES_256_SERVER_SIDE_ENCRYPTION);
+ request.setNewObjectMetadata(metadata);
+ break;
+ case NONE:
+ break;
+ }
+ return request;
+ }
+
+ private DataEncryption getDataEncryption() {
+ return this.dataEncryption;
+ }
+
+ /**
+ * Enum to indicate S3 encryption mode
+ *
+ */
+ private enum DataEncryption {
+ SSE_S3, NONE;
+ }
+
+}
diff --git a/jackrabbit-aws-ext/src/main/java/org/apache/jackrabbit/aws/ext/Utils.java b/jackrabbit-aws-ext/src/main/java/org/apache/jackrabbit/aws/ext/Utils.java
new file mode 100644
index 00000000000..88c0fc85f22
--- /dev/null
+++ b/jackrabbit-aws-ext/src/main/java/org/apache/jackrabbit/aws/ext/Utils.java
@@ -0,0 +1,227 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.jackrabbit.aws.ext;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Properties;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.amazonaws.AmazonClientException;
+import com.amazonaws.ClientConfiguration;
+import com.amazonaws.Protocol;
+import com.amazonaws.auth.AWSCredentials;
+import com.amazonaws.auth.BasicAWSCredentials;
+import com.amazonaws.regions.Regions;
+import com.amazonaws.services.s3.AmazonS3;
+import com.amazonaws.services.s3.AmazonS3Client;
+import com.amazonaws.services.s3.model.ObjectListing;
+import com.amazonaws.services.s3.model.Region;
+import com.amazonaws.services.s3.model.S3ObjectSummary;
+import com.amazonaws.util.StringUtils;
+
+/**
+ * Amazon S3 utilities.
+ */
+public final class Utils {
+
+ private static final Logger LOG = LoggerFactory.getLogger(Utils.class);
+
+ public static final String DEFAULT_CONFIG_FILE = "aws.properties";
+
+ private static final String DELETE_CONFIG_SUFFIX = ";burn";
+
+ /**
+ * The default value AWS bucket region.
+ */
+ public static final String DEFAULT_AWS_BUCKET_REGION = "us-standard";
+
+ /**
+ * constants to define endpoint to various AWS region
+ */
+ public static final String AWSDOTCOM = "amazonaws.com";
+
+ public static final String S3 = "s3";
+
+ public static final String DOT = ".";
+
+ public static final String DASH = "-";
+
+ /**
+ * private constructor so that class cannot initialized from outside.
+ */
+ private Utils() {
+
+ }
+
+ /**
+ * Create AmazonS3Client from properties.
+ *
+ * @param prop properties to configure @link {@link AmazonS3Client}
+ * @return {@link AmazonS3Client}
+ */
+ public static AmazonS3Client openService(final Properties prop) {
+ String accessKey = prop.getProperty(S3Constants.ACCESS_KEY);
+ String secretKey = prop.getProperty(S3Constants.SECRET_KEY);
+ AmazonS3Client s3service = null;
+ if (StringUtils.isNullOrEmpty(accessKey)
+ || StringUtils.isNullOrEmpty(secretKey)) {
+ LOG.info("Configuring Amazon Client from environment");
+ s3service = new AmazonS3Client(getClientConfiguration(prop));
+ } else {
+ LOG.info("Configuring Amazon Client from property file.");
+ AWSCredentials credentials = new BasicAWSCredentials(accessKey,
+ secretKey);
+ s3service = new AmazonS3Client(credentials,
+ getClientConfiguration(prop));
+ }
+ String region = prop.getProperty(S3Constants.S3_REGION);
+ String endpoint = null;
+ String propEndPoint = prop.getProperty(S3Constants.S3_END_POINT);
+ if ((propEndPoint != null) && !"".equals(propEndPoint)) {
+ endpoint = propEndPoint;
+ } else {
+ if (StringUtils.isNullOrEmpty(region)) {
+ com.amazonaws.regions.Region s3Region = Regions.getCurrentRegion();
+ if (s3Region != null) {
+ region = s3Region.getName();
+ } else {
+ throw new AmazonClientException(
+ "parameter ["
+ + S3Constants.S3_REGION
+ + "] not configured and cannot be derived from environment");
+ }
+ }
+ if (DEFAULT_AWS_BUCKET_REGION.equals(region)) {
+ endpoint = S3 + DOT + AWSDOTCOM;
+ } else if (Region.EU_Ireland.toString().equals(region)) {
+ endpoint = "s3-eu-west-1" + DOT + AWSDOTCOM;
+ } else {
+ endpoint = S3 + DASH + region + DOT + AWSDOTCOM;
+ }
+ }
+ /*
+ * setting endpoint to remove latency of redirection. If endpoint is
+ * not set, invocation first goes us standard region, which
+ * redirects it to correct location.
+ */
+ s3service.setEndpoint(endpoint);
+ LOG.info("S3 service endpoint [{}] ", endpoint);
+ return s3service;
+ }
+
+ /**
+ * Delete S3 bucket. This method first deletes all objects from bucket and
+ * then delete empty bucket.
+ *
+ * @param bucketName the bucket name.
+ */
+ public static void deleteBucket(final String bucketName) throws IOException {
+ Properties prop = readConfig(DEFAULT_CONFIG_FILE);
+ AmazonS3 s3service = openService(prop);
+ ObjectListing prevObjectListing = s3service.listObjects(bucketName);
+ while (true) {
+ for (S3ObjectSummary s3ObjSumm : prevObjectListing.getObjectSummaries()) {
+ s3service.deleteObject(bucketName, s3ObjSumm.getKey());
+ }
+ if (!prevObjectListing.isTruncated()) {
+ break;
+ }
+ prevObjectListing = s3service.listNextBatchOfObjects(prevObjectListing);
+ }
+ s3service.deleteBucket(bucketName);
+ }
+
+ /**
+ * Read a configuration properties file. If the file name ends with ";burn",
+ * the file is deleted after reading.
+ *
+ * @param fileName the properties file name
+ * @return the properties
+ * @throws IOException if the file doesn't exist
+ */
+ public static Properties readConfig(String fileName) throws IOException {
+ boolean delete = false;
+ if (fileName.endsWith(DELETE_CONFIG_SUFFIX)) {
+ delete = true;
+ fileName = fileName.substring(0, fileName.length()
+ - DELETE_CONFIG_SUFFIX.length());
+ }
+ if (!new File(fileName).exists()) {
+ throw new IOException("Config file not found: " + fileName);
+ }
+ Properties prop = new Properties();
+ InputStream in = null;
+ try {
+ in = new FileInputStream(fileName);
+ prop.load(in);
+ } finally {
+ if (in != null) {
+ in.close();
+ }
+ if (delete) {
+ deleteIfPossible(new File(fileName));
+ }
+ }
+ return prop;
+ }
+
+ private static void deleteIfPossible(final File file) {
+ boolean deleted = file.delete();
+ if (!deleted) {
+ LOG.warn("Could not delete " + file.getAbsolutePath());
+ }
+ }
+
+ private static ClientConfiguration getClientConfiguration(Properties prop) {
+ int connectionTimeOut = Integer.parseInt(prop.getProperty(S3Constants.S3_CONN_TIMEOUT));
+ int socketTimeOut = Integer.parseInt(prop.getProperty(S3Constants.S3_SOCK_TIMEOUT));
+ int maxConnections = Integer.parseInt(prop.getProperty(S3Constants.S3_MAX_CONNS));
+ int maxErrorRetry = Integer.parseInt(prop.getProperty(S3Constants.S3_MAX_ERR_RETRY));
+
+ String protocol = prop.getProperty(S3Constants.S3_CONN_PROTOCOL);
+ String proxyHost = prop.getProperty(S3Constants.PROXY_HOST);
+ String proxyPort = prop.getProperty(S3Constants.PROXY_PORT);
+
+ ClientConfiguration cc = new ClientConfiguration();
+
+ if (protocol != null && protocol.equalsIgnoreCase("http")) {
+ cc.setProtocol(Protocol.HTTP);
+ }
+
+ if (proxyHost != null && !proxyHost.isEmpty()) {
+ cc.setProxyHost(proxyHost);
+ }
+
+ if (proxyPort != null && !proxyPort.isEmpty()) {
+ cc.setProxyPort(Integer.parseInt(proxyPort));
+ }
+
+ cc.setConnectionTimeout(connectionTimeOut);
+ cc.setSocketTimeout(socketTimeOut);
+ cc.setMaxConnections(maxConnections);
+ cc.setMaxErrorRetry(maxErrorRetry);
+
+ return cc;
+ }
+
+}
diff --git a/jackrabbit-aws-ext/src/main/java/org/apache/jackrabbit/aws/ext/ds/S3Backend.java b/jackrabbit-aws-ext/src/main/java/org/apache/jackrabbit/aws/ext/ds/S3Backend.java
new file mode 100644
index 00000000000..01e87ddb403
--- /dev/null
+++ b/jackrabbit-aws-ext/src/main/java/org/apache/jackrabbit/aws/ext/ds/S3Backend.java
@@ -0,0 +1,921 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.jackrabbit.aws.ext.ds;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Date;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Properties;
+import java.util.Set;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.ThreadPoolExecutor;
+import java.util.concurrent.TimeUnit;
+
+import org.apache.jackrabbit.aws.ext.S3Constants;
+import org.apache.jackrabbit.aws.ext.S3RequestDecorator;
+import org.apache.jackrabbit.aws.ext.Utils;
+import org.apache.jackrabbit.core.data.AbstractBackend;
+import org.apache.jackrabbit.core.data.AsyncTouchCallback;
+import org.apache.jackrabbit.core.data.AsyncTouchResult;
+import org.apache.jackrabbit.core.data.AsyncUploadCallback;
+import org.apache.jackrabbit.core.data.AsyncUploadResult;
+import org.apache.jackrabbit.core.data.CachingDataStore;
+import org.apache.jackrabbit.core.data.DataIdentifier;
+import org.apache.jackrabbit.core.data.DataStoreException;
+import org.apache.jackrabbit.core.data.util.NamedThreadFactory;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.amazonaws.AmazonClientException;
+import com.amazonaws.AmazonServiceException;
+import com.amazonaws.event.ProgressEvent;
+import com.amazonaws.event.ProgressListener;
+import com.amazonaws.regions.Regions;
+import com.amazonaws.services.s3.AmazonS3Client;
+import com.amazonaws.services.s3.model.CopyObjectRequest;
+import com.amazonaws.services.s3.model.DeleteObjectsRequest;
+import com.amazonaws.services.s3.model.DeleteObjectsResult;
+import com.amazonaws.services.s3.model.ObjectListing;
+import com.amazonaws.services.s3.model.ObjectMetadata;
+import com.amazonaws.services.s3.model.PutObjectRequest;
+import com.amazonaws.services.s3.model.Region;
+import com.amazonaws.services.s3.model.S3Object;
+import com.amazonaws.services.s3.model.S3ObjectSummary;
+import com.amazonaws.services.s3.transfer.Copy;
+import com.amazonaws.services.s3.transfer.TransferManager;
+import com.amazonaws.services.s3.transfer.Upload;
+import com.amazonaws.util.StringUtils;
+
+/**
+ * A data store backend that stores data on Amazon S3.
+ */
+public class S3Backend extends AbstractBackend {
+
+ /**
+ * Logger instance.
+ */
+ private static final Logger LOG = LoggerFactory.getLogger(S3Backend.class);
+
+ private static final String KEY_PREFIX = "dataStore_";
+
+ private AmazonS3Client s3service;
+
+ private String bucket;
+
+ private TransferManager tmx;
+
+ private Properties properties;
+
+ private Date startTime;
+
+ private S3RequestDecorator s3ReqDecorator;
+
+ /**
+ * Initialize S3Backend. It creates AmazonS3Client and TransferManager from
+ * aws.properties. It creates S3 bucket if it doesn't pre-exist in S3.
+ */
+ @Override
+ public void init(CachingDataStore store, String homeDir, String config)
+ throws DataStoreException {
+ super.init(store, homeDir, config);
+ Properties initProps = null;
+ //Check is configuration is already provided. That takes precedence
+ //over config provided via file based config
+ if(this.properties != null){
+ initProps = this.properties;
+ } else {
+ if(config == null){
+ config = Utils.DEFAULT_CONFIG_FILE;
+ }
+ try{
+ initProps = Utils.readConfig(config);
+ }catch(IOException e){
+ throw new DataStoreException("Could not initialize S3 from "
+ + config, e);
+ }
+ this.properties = initProps;
+ }
+ init(store, homeDir, initProps);
+ }
+
+ public void init(CachingDataStore store, String homeDir, Properties prop)
+ throws DataStoreException {
+
+ ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader();
+ try {
+ startTime = new Date();
+ Thread.currentThread().setContextClassLoader(
+ getClass().getClassLoader());
+ LOG.debug("init");
+ setDataStore(store);
+ s3ReqDecorator = new S3RequestDecorator(prop);
+
+ s3service = Utils.openService(prop);
+ if (bucket == null || "".equals(bucket.trim())) {
+ bucket = prop.getProperty(S3Constants.S3_BUCKET);
+ }
+ String region = prop.getProperty(S3Constants.S3_REGION);
+ Region s3Region = null;
+ if (StringUtils.isNullOrEmpty(region)) {
+ com.amazonaws.regions.Region ec2Region = Regions.getCurrentRegion();
+ if (ec2Region != null) {
+ s3Region = Region.fromValue(ec2Region.getName());
+ } else {
+ throw new AmazonClientException(
+ "parameter ["
+ + S3Constants.S3_REGION
+ + "] not configured and cannot be derived from environment");
+ }
+ } else {
+ if (Utils.DEFAULT_AWS_BUCKET_REGION.equals(region)) {
+ s3Region = Region.US_Standard;
+ } else if (Region.EU_Ireland.toString().equals(region)) {
+ s3Region = Region.EU_Ireland;
+ } else {
+ s3Region = Region.fromValue(region);
+ }
+ }
+
+ if (!s3service.doesBucketExist(bucket)) {
+ s3service.createBucket(bucket, s3Region);
+ LOG.info("Created bucket [{}] in [{}] ", bucket, region);
+ } else {
+ LOG.info("Using bucket [{}] in [{}] ", bucket, region);
+ }
+
+ int writeThreads = 10;
+ String writeThreadsStr = prop.getProperty(S3Constants.S3_WRITE_THREADS);
+ if (writeThreadsStr != null) {
+ writeThreads = Integer.parseInt(writeThreadsStr);
+ }
+ LOG.info("Using thread pool of [{}] threads in S3 transfer manager.", writeThreads);
+ tmx = new TransferManager(s3service,
+ (ThreadPoolExecutor) Executors.newFixedThreadPool(writeThreads,
+ new NamedThreadFactory("s3-transfer-manager-worker")));
+
+ int asyncWritePoolSize = 10;
+ String maxConnsStr = prop.getProperty(S3Constants.S3_MAX_CONNS);
+ if (maxConnsStr != null) {
+ asyncWritePoolSize = Integer.parseInt(maxConnsStr)
+ - writeThreads;
+ }
+ setAsyncWritePoolSize(asyncWritePoolSize);
+ String renameKeyProp = prop.getProperty(S3Constants.S3_RENAME_KEYS);
+ boolean renameKeyBool = (renameKeyProp == null || "".equals(renameKeyProp))
+ ? false
+ : Boolean.parseBoolean(renameKeyProp);
+ LOG.info("Rename keys [{}]", renameKeyBool);
+ if (renameKeyBool) {
+ renameKeys();
+ }
+ LOG.debug("S3 Backend initialized in [{}] ms",
+ +(System.currentTimeMillis() - startTime.getTime()));
+ } catch (Exception e) {
+ LOG.debug(" error ", e);
+ throw new DataStoreException("Could not initialize S3 from "
+ + prop, e);
+ } finally {
+ if (contextClassLoader != null) {
+ Thread.currentThread().setContextClassLoader(contextClassLoader);
+ }
+ }
+ }
+
+ /**
+ * It uploads file to Amazon S3. If file size is greater than 5MB, this
+ * method uses parallel concurrent connections to upload.
+ */
+ @Override
+ public void write(DataIdentifier identifier, File file)
+ throws DataStoreException {
+ this.write(identifier, file, false, null);
+
+ }
+
+ @Override
+ public void writeAsync(DataIdentifier identifier, File file,
+ AsyncUploadCallback callback) throws DataStoreException {
+ if (callback == null) {
+ throw new IllegalArgumentException(
+ "callback parameter cannot be null in asyncUpload");
+ }
+ getAsyncWriteExecutor().execute(new AsyncUploadJob(identifier, file,
+ callback));
+ }
+
+ /**
+ * Check if record identified by identifier exists in Amazon S3.
+ */
+ @Override
+ public boolean exists(DataIdentifier identifier) throws DataStoreException {
+ long start = System.currentTimeMillis();
+ String key = getKeyName(identifier);
+ ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader();
+ try {
+ Thread.currentThread().setContextClassLoader(
+ getClass().getClassLoader());
+ ObjectMetadata objectMetaData = s3service.getObjectMetadata(bucket,
+ key);
+ if (objectMetaData != null) {
+ LOG.trace("exists [{}]: [true] took [{}] ms.",
+ identifier, (System.currentTimeMillis() - start) );
+ return true;
+ }
+ return false;
+ } catch (AmazonServiceException e) {
+ if (e.getStatusCode() == 404 || e.getStatusCode() == 403) {
+ LOG.debug("exists [{}]: [false] took [{}] ms.",
+ identifier, (System.currentTimeMillis() - start) );
+ return false;
+ }
+ throw new DataStoreException(
+ "Error occured to getObjectMetadata for key ["
+ + identifier.toString() + "]", e);
+ } finally {
+ if (contextClassLoader != null) {
+ Thread.currentThread().setContextClassLoader(contextClassLoader);
+ }
+ }
+ }
+
+ @Override
+ public boolean exists(DataIdentifier identifier, boolean touch)
+ throws DataStoreException {
+ long start = System.currentTimeMillis();
+ String key = getKeyName(identifier);
+ ObjectMetadata objectMetaData = null;
+ boolean retVal = false;
+ ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader();
+ try {
+ Thread.currentThread().setContextClassLoader(
+ getClass().getClassLoader());
+ objectMetaData = s3service.getObjectMetadata(bucket, key);
+ if (objectMetaData != null) {
+ retVal = true;
+ if (touch) {
+ CopyObjectRequest copReq = new CopyObjectRequest(bucket,
+ key, bucket, key);
+ copReq.setNewObjectMetadata(objectMetaData);
+ Copy copy = tmx.copy(s3ReqDecorator.decorate(copReq));
+ copy.waitForCopyResult();
+ LOG.debug("[{}] touched took [{}] ms. ", identifier,
+ (System.currentTimeMillis() - start));
+ }
+ } else {
+ retVal = false;
+ }
+
+ } catch (AmazonServiceException e) {
+ if (e.getStatusCode() == 404 || e.getStatusCode() == 403) {
+ retVal = false;
+ } else {
+ throw new DataStoreException(
+ "Error occured to find exists for key ["
+ + identifier.toString() + "]", e);
+ }
+ } catch (Exception e) {
+ throw new DataStoreException(
+ "Error occured to find exists for key "
+ + identifier.toString(), e);
+ } finally {
+ if (contextClassLoader != null) {
+ Thread.currentThread().setContextClassLoader(contextClassLoader);
+ }
+ }
+ LOG.debug("exists [{}]: [{}] took [{}] ms.", new Object[] { identifier,
+ retVal, (System.currentTimeMillis() - start) });
+ return retVal;
+ }
+
+ @Override
+ public void touchAsync(final DataIdentifier identifier,
+ final long minModifiedDate, final AsyncTouchCallback callback)
+ throws DataStoreException {
+ ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader();
+ try {
+ if (callback == null) {
+ throw new IllegalArgumentException(
+ "callback parameter cannot be null in touchAsync");
+ }
+ Thread.currentThread().setContextClassLoader(
+ getClass().getClassLoader());
+
+ getAsyncWriteExecutor().execute(new Runnable() {
+ @Override
+ public void run() {
+ try {
+ touch(identifier, minModifiedDate);
+ callback.onSuccess(new AsyncTouchResult(identifier));
+ } catch (DataStoreException e) {
+ AsyncTouchResult result = new AsyncTouchResult(
+ identifier);
+ result.setException(e);
+ callback.onFailure(result);
+ }
+ }
+ });
+ } catch (Exception e) {
+ callback.onAbort(new AsyncTouchResult(identifier));
+ throw new DataStoreException("Cannot touch the record "
+ + identifier.toString(), e);
+ } finally {
+ if (contextClassLoader != null) {
+ Thread.currentThread().setContextClassLoader(contextClassLoader);
+ }
+ }
+
+ }
+
+ @Override
+ public void touch(DataIdentifier identifier, long minModifiedDate)
+ throws DataStoreException {
+ ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader();
+ try {
+ final long start = System.currentTimeMillis();
+ final String key = getKeyName(identifier);
+ if (minModifiedDate > 0
+ && minModifiedDate > getLastModified(identifier)) {
+ CopyObjectRequest copReq = new CopyObjectRequest(bucket, key,
+ bucket, key);
+ copReq.setNewObjectMetadata(new ObjectMetadata());
+ Copy copy = tmx.copy(s3ReqDecorator.decorate(copReq));
+ copy.waitForCompletion();
+ LOG.debug("[{}] touched. time taken [{}] ms ", new Object[] {
+ identifier, (System.currentTimeMillis() - start) });
+ } else {
+ LOG.trace("[{}] touch not required. time taken [{}] ms ",
+ new Object[] { identifier,
+ (System.currentTimeMillis() - start) });
+ }
+
+ } catch (Exception e) {
+ throw new DataStoreException("Error occured in touching key ["
+ + identifier.toString() + "]", e);
+ } finally {
+ if (contextClassLoader != null) {
+ Thread.currentThread().setContextClassLoader(contextClassLoader);
+ }
+ }
+ }
+
+ @Override
+ public InputStream read(DataIdentifier identifier)
+ throws DataStoreException {
+ long start = System.currentTimeMillis();
+ String key = getKeyName(identifier);
+ ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader();
+ try {
+ Thread.currentThread().setContextClassLoader(
+ getClass().getClassLoader());
+ S3Object object = s3service.getObject(bucket, key);
+ InputStream in = object.getObjectContent();
+ LOG.debug("[{}] read took [{}]ms", identifier,
+ (System.currentTimeMillis() - start));
+ return in;
+ } catch (AmazonServiceException e) {
+ throw new DataStoreException("Object not found: " + key, e);
+ } finally {
+ if (contextClassLoader != null) {
+ Thread.currentThread().setContextClassLoader(contextClassLoader);
+ }
+ }
+ }
+
+ @Override
+ public Iterator getAllIdentifiers()
+ throws DataStoreException {
+ long start = System.currentTimeMillis();
+ ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader();
+ try {
+ Thread.currentThread().setContextClassLoader(
+ getClass().getClassLoader());
+ Set ids = new HashSet();
+ ObjectListing prevObjectListing = s3service.listObjects(bucket);
+ while (true) {
+ for (S3ObjectSummary s3ObjSumm : prevObjectListing.getObjectSummaries()) {
+ String id = getIdentifierName(s3ObjSumm.getKey());
+ if (id != null) {
+ ids.add(new DataIdentifier(id));
+ }
+ }
+ if (!prevObjectListing.isTruncated()) break;
+ prevObjectListing = s3service.listNextBatchOfObjects(prevObjectListing);
+ }
+ LOG.debug("getAllIdentifiers returned size [{}] took [{}] ms.",
+ ids.size(), (System.currentTimeMillis() - start));
+ return ids.iterator();
+ } catch (AmazonServiceException e) {
+ throw new DataStoreException("Could not list objects", e);
+ } finally {
+ if (contextClassLoader != null) {
+ Thread.currentThread().setContextClassLoader(contextClassLoader);
+ }
+ }
+ }
+
+ @Override
+ public long getLastModified(DataIdentifier identifier)
+ throws DataStoreException {
+ long start = System.currentTimeMillis();
+ String key = getKeyName(identifier);
+ ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader();
+ try {
+ Thread.currentThread().setContextClassLoader(
+ getClass().getClassLoader());
+ ObjectMetadata object = s3service.getObjectMetadata(bucket, key);
+ long lastModified = object.getLastModified().getTime();
+ LOG.debug(
+ "Identifier [{}]'s lastModified = [{}] took [{}]ms.",
+ new Object[] { identifier, lastModified,
+ (System.currentTimeMillis() - start) });
+ return lastModified;
+ } catch (AmazonServiceException e) {
+ if (e.getStatusCode() == 404 || e.getStatusCode() == 403) {
+ LOG.info(
+ "getLastModified:Identifier [{}] not found. Took [{}] ms.",
+ identifier, (System.currentTimeMillis() - start));
+ }
+ throw new DataStoreException(e);
+ } finally {
+ if (contextClassLoader != null) {
+ Thread.currentThread().setContextClassLoader(contextClassLoader);
+ }
+ }
+ }
+
+ @Override
+ public long getLength(DataIdentifier identifier) throws DataStoreException {
+ long start = System.currentTimeMillis();
+ String key = getKeyName(identifier);
+ ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader();
+ try {
+ Thread.currentThread().setContextClassLoader(
+ getClass().getClassLoader());
+ ObjectMetadata object = s3service.getObjectMetadata(bucket, key);
+ long length = object.getContentLength();
+ LOG.debug("Identifier [{}]'s length = [{}] took [{}]ms.",
+ new Object[] { identifier, length,
+ (System.currentTimeMillis() - start) });
+ return length;
+ } catch (AmazonServiceException e) {
+ throw new DataStoreException("Could not length of dataIdentifier "
+ + identifier, e);
+ } finally {
+ if (contextClassLoader != null) {
+ Thread.currentThread().setContextClassLoader(contextClassLoader);
+ }
+ }
+ }
+
+ @Override
+ public void deleteRecord(DataIdentifier identifier)
+ throws DataStoreException {
+ long start = System.currentTimeMillis();
+ String key = getKeyName(identifier);
+ ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader();
+ try {
+ Thread.currentThread().setContextClassLoader(
+ getClass().getClassLoader());
+ s3service.deleteObject(bucket, key);
+ LOG.debug("Identifier [{}] deleted. It took [{}]ms.", new Object[] {
+ identifier, (System.currentTimeMillis() - start) });
+ } catch (AmazonServiceException e) {
+ throw new DataStoreException(
+ "Could not getLastModified of dataIdentifier " + identifier, e);
+ } finally {
+ if (contextClassLoader != null) {
+ Thread.currentThread().setContextClassLoader(contextClassLoader);
+ }
+ }
+ }
+
+ @Override
+ public Set deleteAllOlderThan(long min)
+ throws DataStoreException {
+ long start = System.currentTimeMillis();
+ // S3 stores lastModified to lower boundary of timestamp in ms.
+ // and hence min is reduced by 1000ms.
+ min = min - 1000;
+ Set deleteIdSet = new HashSet(30);
+ ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader();
+ try {
+ Thread.currentThread().setContextClassLoader(
+ getClass().getClassLoader());
+ ObjectListing prevObjectListing = s3service.listObjects(bucket);
+ while (true) {
+ List deleteList = new ArrayList();
+ for (S3ObjectSummary s3ObjSumm : prevObjectListing.getObjectSummaries()) {
+ DataIdentifier identifier = new DataIdentifier(
+ getIdentifierName(s3ObjSumm.getKey()));
+ long lastModified = s3ObjSumm.getLastModified().getTime();
+ LOG.debug("Identifier [{}]'s lastModified = [{}]", identifier, lastModified);
+ if (lastModified < min
+ && getDataStore().confirmDelete(identifier)
+ // confirm once more that record's lastModified < min
+ // order is important here
+ && s3service.getObjectMetadata(bucket,
+ s3ObjSumm.getKey()).getLastModified().getTime() < min) {
+
+ getDataStore().deleteFromCache(identifier);
+ LOG.debug("add id [{}] to delete lists",
+ s3ObjSumm.getKey());
+ deleteList.add(new DeleteObjectsRequest.KeyVersion(
+ s3ObjSumm.getKey()));
+ deleteIdSet.add(identifier);
+ }
+ }
+ if (deleteList.size() > 0) {
+ DeleteObjectsRequest delObjsReq = new DeleteObjectsRequest(
+ bucket);
+ delObjsReq.setKeys(deleteList);
+ DeleteObjectsResult dobjs = s3service.deleteObjects(delObjsReq);
+ if (dobjs.getDeletedObjects().size() != deleteList.size()) {
+ throw new DataStoreException(
+ "Incomplete delete object request. only "
+ + dobjs.getDeletedObjects().size() + " out of "
+ + deleteList.size() + " are deleted");
+ } else {
+ LOG.debug("[{}] records deleted from datastore",
+ deleteList);
+ }
+ }
+ if (!prevObjectListing.isTruncated()) {
+ break;
+ }
+ prevObjectListing = s3service.listNextBatchOfObjects(prevObjectListing);
+ }
+ } finally {
+ if (contextClassLoader != null) {
+ Thread.currentThread().setContextClassLoader(contextClassLoader);
+ }
+ }
+ LOG.info(
+ "deleteAllOlderThan: min=[{}] exit. Deleted[{}] records. Number of records deleted [{}] took [{}]ms",
+ new Object[] { min, deleteIdSet, deleteIdSet.size(),
+ (System.currentTimeMillis() - start) });
+ return deleteIdSet;
+ }
+
+ @Override
+ public void close() throws DataStoreException {
+ super.close();
+ // backend is closing. abort all mulitpart uploads from start.
+ if(s3service.doesBucketExist(bucket)) {
+ tmx.abortMultipartUploads(bucket, startTime);
+ }
+ tmx.shutdownNow();
+ s3service.shutdown();
+ LOG.info("S3Backend closed.");
+ }
+
+ public String getBucket() {
+ return bucket;
+ }
+
+ public void setBucket(String bucket) {
+ this.bucket = bucket;
+ }
+
+ /**
+ * Properties used to configure the backend. If provided explicitly
+ * before init is invoked then these take precedence
+ *
+ * @param properties to configure S3Backend
+ */
+ public void setProperties(Properties properties) {
+ this.properties = properties;
+ }
+
+ private void write(DataIdentifier identifier, File file,
+ boolean asyncUpload, AsyncUploadCallback callback)
+ throws DataStoreException {
+ String key = getKeyName(identifier);
+ ObjectMetadata objectMetaData = null;
+ long start = System.currentTimeMillis();
+ ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader();
+ try {
+ Thread.currentThread().setContextClassLoader(
+ getClass().getClassLoader());
+ // check if the same record already exists
+ try {
+ objectMetaData = s3service.getObjectMetadata(bucket, key);
+ } catch (AmazonServiceException ase) {
+ if (!(ase.getStatusCode() == 404 || ase.getStatusCode() == 403)) {
+ throw ase;
+ }
+ }
+ if (objectMetaData != null) {
+ long l = objectMetaData.getContentLength();
+ if (l != file.length()) {
+ throw new DataStoreException("Collision: " + key
+ + " new length: " + file.length() + " old length: " + l);
+ }
+ LOG.debug("[{}]'s exists, lastmodified = [{}]", key,
+ objectMetaData.getLastModified().getTime());
+ CopyObjectRequest copReq = new CopyObjectRequest(bucket, key,
+ bucket, key);
+ copReq.setNewObjectMetadata(objectMetaData);
+ Copy copy = tmx.copy(s3ReqDecorator.decorate(copReq));
+ try {
+ copy.waitForCopyResult();
+ LOG.debug("lastModified of [{}] updated successfully.", identifier);
+ if (callback != null) {
+ callback.onSuccess(new AsyncUploadResult(identifier, file));
+ }
+ }catch (Exception e2) {
+ AsyncUploadResult asyncUpRes= new AsyncUploadResult(identifier, file);
+ asyncUpRes.setException(e2);
+ if (callback != null) {
+ callback.onAbort(asyncUpRes);
+ }
+ throw new DataStoreException("Could not upload " + key, e2);
+ }
+ }
+
+ if (objectMetaData == null) {
+ try {
+ // start multipart parallel upload using amazon sdk
+ Upload up = tmx.upload(s3ReqDecorator.decorate(new PutObjectRequest(
+ bucket, key, file)));
+ // wait for upload to finish
+ if (asyncUpload) {
+ up.addProgressListener(new S3UploadProgressListener(up,
+ identifier, file, callback));
+ LOG.debug(
+ "added upload progress listener to identifier [{}]",
+ identifier);
+ } else {
+ up.waitForUploadResult();
+ LOG.debug("synchronous upload to identifier [{}] completed.", identifier);
+ if (callback != null) {
+ callback.onSuccess(new AsyncUploadResult(
+ identifier, file));
+ }
+ }
+ } catch (Exception e2 ) {
+ AsyncUploadResult asyncUpRes= new AsyncUploadResult(identifier, file);
+ asyncUpRes.setException(e2);
+ if (callback != null) {
+ callback.onAbort(asyncUpRes);
+ }
+ throw new DataStoreException("Could not upload " + key, e2);
+ }
+ }
+ } finally {
+ if (contextClassLoader != null) {
+ Thread.currentThread().setContextClassLoader(contextClassLoader);
+ }
+ }
+ LOG.debug(
+ "write of [{}], length=[{}], in async mode [{}], in [{}]ms",
+ new Object[] { identifier, file.length(), asyncUpload,
+ (System.currentTimeMillis() - start) });
+ }
+
+ /**
+ * This method rename object keys in S3 concurrently. The number of
+ * concurrent threads is defined by 'maxConnections' property in
+ * aws.properties. As S3 doesn't have "move" command, this method simulate
+ * move as copy object object to new key and then delete older key.
+ */
+ private void renameKeys() throws DataStoreException {
+ long startTime = System.currentTimeMillis();
+ ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader();
+ long count = 0;
+ try {
+ Thread.currentThread().setContextClassLoader(
+ getClass().getClassLoader());
+ ObjectListing prevObjectListing = s3service.listObjects(bucket);
+ List deleteList = new ArrayList();
+ int nThreads = Integer.parseInt(properties.getProperty("maxConnections"));
+ ExecutorService executor = Executors.newFixedThreadPool(nThreads,
+ new NamedThreadFactory("s3-object-rename-worker"));
+ boolean taskAdded = false;
+ while (true) {
+ for (S3ObjectSummary s3ObjSumm : prevObjectListing.getObjectSummaries()) {
+ executor.execute(new KeyRenameThread(s3ObjSumm.getKey()));
+ taskAdded = true;
+ count++;
+ // delete the object if it follows old key name format
+ if( s3ObjSumm.getKey().startsWith(KEY_PREFIX)) {
+ deleteList.add(new DeleteObjectsRequest.KeyVersion(
+ s3ObjSumm.getKey()));
+ }
+ }
+ if (!prevObjectListing.isTruncated()) break;
+ prevObjectListing = s3service.listNextBatchOfObjects(prevObjectListing);
+ }
+ // This will make the executor accept no new threads
+ // and finish all existing threads in the queue
+ executor.shutdown();
+
+ try {
+ // Wait until all threads are finish
+ while (taskAdded
+ && !executor.awaitTermination(10, TimeUnit.SECONDS)) {
+ LOG.info("Rename S3 keys tasks timedout. Waiting again");
+ }
+ } catch (InterruptedException ie) {
+
+ }
+ LOG.info("Renamed [{}] keys, time taken [{}]sec", count,
+ ((System.currentTimeMillis() - startTime) / 1000));
+ // Delete older keys.
+ if (deleteList.size() > 0) {
+ DeleteObjectsRequest delObjsReq = new DeleteObjectsRequest(
+ bucket);
+ int batchSize = 500, startIndex = 0, size = deleteList.size();
+ int endIndex = batchSize < size ? batchSize : size;
+ while (endIndex <= size) {
+ delObjsReq.setKeys(Collections.unmodifiableList(deleteList.subList(
+ startIndex, endIndex)));
+ DeleteObjectsResult dobjs = s3service.deleteObjects(delObjsReq);
+ LOG.info(
+ "Records[{}] deleted in datastore from index [{}] to [{}]",
+ new Object[] { dobjs.getDeletedObjects().size(),
+ startIndex, (endIndex - 1) });
+ if (endIndex == size) {
+ break;
+ } else {
+ startIndex = endIndex;
+ endIndex = (startIndex + batchSize) < size
+ ? (startIndex + batchSize)
+ : size;
+ }
+ }
+ }
+ } finally {
+ if (contextClassLoader != null) {
+ Thread.currentThread().setContextClassLoader(contextClassLoader);
+ }
+ }
+ }
+
+ /**
+ * The method convert old key format to new format. For e.g. this method
+ * converts old key dataStore_004cb70c8f87d78f04da41e7547cb434094089ea to
+ * 004c-b70c8f87d78f04da41e7547cb434094089ea.
+ */
+ private static String convertKey(String oldKey)
+ throws IllegalArgumentException {
+ if (!oldKey.startsWith(KEY_PREFIX)) {
+ return oldKey;
+ }
+ String key = oldKey.substring(KEY_PREFIX.length());
+ return key.substring(0, 4) + Utils.DASH + key.substring(4);
+ }
+
+ /**
+ * Get key from data identifier. Object is stored with key in S3.
+ */
+ private static String getKeyName(DataIdentifier identifier) {
+ String key = identifier.toString();
+ return key.substring(0, 4) + Utils.DASH + key.substring(4);
+ }
+
+ /**
+ * Get data identifier from key.
+ */
+ private static String getIdentifierName(String key) {
+ if (!key.contains(Utils.DASH)) {
+ return null;
+ }
+ return key.substring(0, 4) + key.substring(5);
+ }
+
+
+ /**
+ * The class renames object key in S3 in a thread.
+ */
+ private class KeyRenameThread implements Runnable {
+
+ private String oldKey;
+
+ public void run() {
+ ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader();
+ try {
+ Thread.currentThread().setContextClassLoader(
+ getClass().getClassLoader());
+ String newS3Key = convertKey(oldKey);
+ CopyObjectRequest copReq = new CopyObjectRequest(bucket,
+ oldKey, bucket, newS3Key);
+ Copy copy = tmx.copy(s3ReqDecorator.decorate(copReq));
+ try {
+ copy.waitForCopyResult();
+ LOG.debug("[{}] renamed to [{}] ", oldKey, newS3Key);
+ } catch (InterruptedException ie) {
+ LOG.error(" Exception in renaming [{}] to [{}] ",
+ new Object[] { ie, oldKey, newS3Key });
+ }
+ } finally {
+ if (contextClassLoader != null) {
+ Thread.currentThread().setContextClassLoader(
+ contextClassLoader);
+ }
+ }
+ }
+
+ public KeyRenameThread(String oldKey) {
+ this.oldKey = oldKey;
+ }
+ }
+
+ /**
+ * Listener which receives callback on status of S3 upload.
+ */
+ private class S3UploadProgressListener implements ProgressListener {
+
+ private File file;
+
+ private DataIdentifier identifier;
+
+ private AsyncUploadCallback callback;
+
+ private Upload upload;
+
+ public S3UploadProgressListener(Upload upload, DataIdentifier identifier, File file,
+ AsyncUploadCallback callback) {
+ super();
+ this.identifier = identifier;
+ this.file = file;
+ this.callback = callback;
+ this.upload = upload;
+ }
+
+ public void progressChanged(ProgressEvent progressEvent) {
+ switch (progressEvent.getEventCode()) {
+ case ProgressEvent.COMPLETED_EVENT_CODE:
+ callback.onSuccess(new AsyncUploadResult(identifier, file));
+ break;
+ case ProgressEvent.FAILED_EVENT_CODE:
+ AsyncUploadResult result = new AsyncUploadResult(
+ identifier, file);
+ try {
+ AmazonClientException e = upload.waitForException();
+ if (e != null) {
+ result.setException(e);
+ }
+ } catch (InterruptedException e) {
+ Thread.currentThread().interrupt();
+ }
+ callback.onFailure(result);
+ break;
+ default:
+ break;
+ }
+ }
+ }
+
+ /**
+ * This class implements {@link Runnable} interface to upload {@link File}
+ * to S3 asynchronously.
+ */
+ private class AsyncUploadJob implements Runnable {
+
+ private DataIdentifier identifier;
+
+ private File file;
+
+ private AsyncUploadCallback callback;
+
+ public AsyncUploadJob(DataIdentifier identifier, File file,
+ AsyncUploadCallback callback) {
+ super();
+ this.identifier = identifier;
+ this.file = file;
+ this.callback = callback;
+ }
+
+ public void run() {
+ try {
+ write(identifier, file, true, callback);
+ } catch (DataStoreException e) {
+ LOG.error("Could not upload [" + identifier + "], file[" + file
+ + "]", e);
+ }
+
+ }
+ }
+}
diff --git a/jackrabbit-aws-ext/src/main/java/org/apache/jackrabbit/aws/ext/ds/S3DataStore.java b/jackrabbit-aws-ext/src/main/java/org/apache/jackrabbit/aws/ext/ds/S3DataStore.java
new file mode 100644
index 00000000000..8253572b244
--- /dev/null
+++ b/jackrabbit-aws-ext/src/main/java/org/apache/jackrabbit/aws/ext/ds/S3DataStore.java
@@ -0,0 +1,50 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.aws.ext.ds;
+
+import java.util.Properties;
+
+import org.apache.jackrabbit.core.data.Backend;
+import org.apache.jackrabbit.core.data.CachingDataStore;
+
+/**
+ * An Amazon S3 data store.
+ */
+public class S3DataStore extends CachingDataStore {
+ private Properties properties;
+
+ @Override
+ protected Backend createBackend() {
+ S3Backend backend = new S3Backend();
+ if(properties != null){
+ backend.setProperties(properties);
+ }
+ return backend;
+ }
+
+ @Override
+ protected String getMarkerFile() {
+ return "s3.init.done";
+ }
+
+ /**
+ * Properties required to configure the S3Backend
+ */
+ public void setProperties(Properties properties) {
+ this.properties = properties;
+ }
+}
diff --git a/jackrabbit-aws-ext/src/main/java/org/apache/jackrabbit/aws/ext/ds/package-info.java b/jackrabbit-aws-ext/src/main/java/org/apache/jackrabbit/aws/ext/ds/package-info.java
new file mode 100755
index 00000000000..d82936c941a
--- /dev/null
+++ b/jackrabbit-aws-ext/src/main/java/org/apache/jackrabbit/aws/ext/ds/package-info.java
@@ -0,0 +1,19 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/* see JCR-4060 */
+@org.osgi.annotation.versioning.Version("2.13.5")
+package org.apache.jackrabbit.aws.ext.ds;
diff --git a/jackrabbit-aws-ext/src/test/java/org/apache/jackrabbit/aws/ext/TestAll.java b/jackrabbit-aws-ext/src/test/java/org/apache/jackrabbit/aws/ext/TestAll.java
new file mode 100644
index 00000000000..fb289ad99c5
--- /dev/null
+++ b/jackrabbit-aws-ext/src/test/java/org/apache/jackrabbit/aws/ext/TestAll.java
@@ -0,0 +1,59 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.jackrabbit.aws.ext;
+
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+
+import org.apache.jackrabbit.aws.ext.ds.TestS3Ds;
+import org.apache.jackrabbit.aws.ext.ds.TestS3DSAsyncTouch;
+import org.apache.jackrabbit.aws.ext.ds.TestS3DsCacheOff;
+import org.apache.jackrabbit.aws.ext.ds.TestS3DSWithSSES3;
+import org.apache.jackrabbit.aws.ext.ds.TestS3DSWithSmallCache;
+import org.apache.jackrabbit.core.data.TestCaseBase;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Test suite that includes all test cases for the this module.
+ */
+public class TestAll extends TestCase {
+
+ private static final Logger LOG = LoggerFactory.getLogger(TestAll.class);
+
+ /**
+ * TestAll
suite that executes all tests inside this module. To
+ * run test cases against Amazon S3 pass AWS configuration properties file as
+ * system property -Dconfig=/opt/cq/aws.properties. Sample aws properties
+ * located at src/test/resources/aws.properties.
+ */
+ public static Test suite() {
+ TestSuite suite = new TestSuite("S3 tests");
+ String config = System.getProperty(TestCaseBase.CONFIG);
+ LOG.info("config= " + config);
+ if (config != null && !"".equals(config.trim())) {
+ suite.addTestSuite(TestS3Ds.class);
+ suite.addTestSuite(TestS3DSAsyncTouch.class);
+ suite.addTestSuite(TestS3DSWithSmallCache.class);
+ suite.addTestSuite(TestS3DsCacheOff.class);
+ suite.addTestSuite(TestS3DSWithSSES3.class);
+ }
+ return suite;
+ }
+}
diff --git a/jackrabbit-aws-ext/src/test/java/org/apache/jackrabbit/aws/ext/ds/S3TestDataStore.java b/jackrabbit-aws-ext/src/test/java/org/apache/jackrabbit/aws/ext/ds/S3TestDataStore.java
new file mode 100644
index 00000000000..33dbba4d0ec
--- /dev/null
+++ b/jackrabbit-aws-ext/src/test/java/org/apache/jackrabbit/aws/ext/ds/S3TestDataStore.java
@@ -0,0 +1,47 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.aws.ext.ds;
+
+import java.util.Properties;
+
+import org.apache.jackrabbit.core.data.Backend;
+
+/**
+ * This class intialize {@link S3DataStore} with the give bucket. The other
+ * configuration are taken from configuration file. This class is implemented so
+ * that each test case run in its own bucket. It was required as deletions in
+ * bucket are not immediately reflected in the next test case.
+ */
+public class S3TestDataStore extends S3DataStore {
+
+ Properties props;
+
+ public S3TestDataStore() {
+ super();
+ }
+
+ public S3TestDataStore(Properties props) {
+ super();
+ this.props = props;
+ }
+
+ protected Backend createBackend() {
+ Backend backend = new S3Backend();
+ ((S3Backend) backend).setProperties(props);
+ return backend;
+ }
+}
diff --git a/jackrabbit-aws-ext/src/test/java/org/apache/jackrabbit/aws/ext/ds/TestS3DSAsyncTouch.java b/jackrabbit-aws-ext/src/test/java/org/apache/jackrabbit/aws/ext/ds/TestS3DSAsyncTouch.java
new file mode 100644
index 00000000000..910d4229b4f
--- /dev/null
+++ b/jackrabbit-aws-ext/src/test/java/org/apache/jackrabbit/aws/ext/ds/TestS3DSAsyncTouch.java
@@ -0,0 +1,53 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.aws.ext.ds;
+
+import java.io.IOException;
+
+import javax.jcr.RepositoryException;
+
+import org.apache.jackrabbit.core.data.CachingDataStore;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Test {@link CachingDataStore} with
+ * {@link CachingDataStore#setTouchAsync(boolean) set to true. It requires to
+ * pass aws config file via system property. For e.g.
+ * -Dconfig=/opt/cq/aws.properties. Sample aws properties located at
+ * src/test/resources/aws.properties
+ */
+public class TestS3DSAsyncTouch extends TestS3Ds {
+
+ protected static final Logger LOG = LoggerFactory.getLogger(TestS3DSAsyncTouch.class);
+
+ public TestS3DSAsyncTouch() throws IOException {
+
+ }
+
+ @Override
+ protected CachingDataStore createDataStore() throws RepositoryException {
+ S3DataStore s3ds = new S3DataStore();
+ s3ds.setProperties(props);
+ s3ds.setTouchAsync(true);
+ s3ds.setSecret("123456");
+ s3ds.init(dataStoreDir);
+ s3ds.updateModifiedDateOnAccess(System.currentTimeMillis() + 50 * 1000);
+ sleep(1000);
+ return s3ds;
+ }
+}
diff --git a/jackrabbit-aws-ext/src/test/java/org/apache/jackrabbit/aws/ext/ds/TestS3DSWithSSES3.java b/jackrabbit-aws-ext/src/test/java/org/apache/jackrabbit/aws/ext/ds/TestS3DSWithSSES3.java
new file mode 100644
index 00000000000..45a29482494
--- /dev/null
+++ b/jackrabbit-aws-ext/src/test/java/org/apache/jackrabbit/aws/ext/ds/TestS3DSWithSSES3.java
@@ -0,0 +1,94 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.jackrabbit.aws.ext.ds;
+
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+
+import javax.jcr.RepositoryException;
+
+import org.apache.jackrabbit.aws.ext.S3Constants;
+import org.apache.jackrabbit.core.data.CachingDataStore;
+import org.apache.jackrabbit.core.data.DataRecord;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Test S3DataStore operation with SSE_S3 encryption.
+ */
+public class TestS3DSWithSSES3 extends TestS3Ds {
+
+ protected static final Logger LOG = LoggerFactory.getLogger(TestS3DSWithSSES3.class);
+
+ public TestS3DSWithSSES3() throws IOException {
+ }
+
+ @Override
+ protected CachingDataStore createDataStore() throws RepositoryException {
+ props.setProperty(S3Constants.S3_ENCRYPTION,
+ S3Constants.S3_ENCRYPTION_SSE_S3);
+ S3DataStore s3ds = new S3DataStore();
+ s3ds.setProperties(props);
+ s3ds.setSecret("123456");
+ s3ds.init(dataStoreDir);
+ sleep(1000);
+ return s3ds;
+ }
+
+ /**
+ * Test data migration enabling SSE_S3 encryption.
+ */
+ public void testDataMigration() {
+ try {
+ String bucket = props.getProperty(S3Constants.S3_BUCKET);
+ S3DataStore s3ds = new S3DataStore();
+ s3ds.setProperties(props);
+ s3ds.setCacheSize(0);
+ s3ds.init(dataStoreDir);
+ byte[] data = new byte[dataLength];
+ randomGen.nextBytes(data);
+ DataRecord rec = s3ds.addRecord(new ByteArrayInputStream(data));
+ assertEquals(data.length, rec.getLength());
+ assertRecord(data, rec);
+ s3ds.close();
+
+ // turn encryption now.
+ props.setProperty(S3Constants.S3_BUCKET, bucket);
+ props.setProperty(S3Constants.S3_ENCRYPTION,
+ S3Constants.S3_ENCRYPTION_SSE_S3);
+ props.setProperty(S3Constants.S3_RENAME_KEYS, "true");
+ s3ds = new S3DataStore();
+ s3ds.setProperties(props);
+ s3ds.setCacheSize(0);
+ s3ds.init(dataStoreDir);
+
+ rec = s3ds.getRecord(rec.getIdentifier());
+ assertEquals(data.length, rec.getLength());
+ assertRecord(data, rec);
+
+ randomGen.nextBytes(data);
+ rec = s3ds.addRecord(new ByteArrayInputStream(data));
+ s3ds.close();
+
+ } catch (Exception e) {
+ LOG.error("error:", e);
+ fail(e.getMessage());
+ }
+ }
+
+}
diff --git a/jackrabbit-aws-ext/src/test/java/org/apache/jackrabbit/aws/ext/ds/TestS3DSWithSmallCache.java b/jackrabbit-aws-ext/src/test/java/org/apache/jackrabbit/aws/ext/ds/TestS3DSWithSmallCache.java
new file mode 100644
index 00000000000..b63bf67f025
--- /dev/null
+++ b/jackrabbit-aws-ext/src/test/java/org/apache/jackrabbit/aws/ext/ds/TestS3DSWithSmallCache.java
@@ -0,0 +1,53 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.aws.ext.ds;
+
+import java.io.IOException;
+
+import javax.jcr.RepositoryException;
+
+import org.apache.jackrabbit.core.data.CachingDataStore;
+import org.apache.jackrabbit.core.data.LocalCache;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Test {@link CachingDataStore} with S3Backend and with very small size (@link
+ * {@link LocalCache}. It requires to pass aws config file via system property.
+ * For e.g. -Dconfig=/opt/cq/aws.properties. Sample aws properties located at
+ * src/test/resources/aws.properties
+ */
+public class TestS3DSWithSmallCache extends TestS3Ds {
+
+ protected static final Logger LOG = LoggerFactory.getLogger(TestS3DSWithSmallCache.class);
+
+ public TestS3DSWithSmallCache() throws IOException {
+ }
+
+ @Override
+ protected CachingDataStore createDataStore() throws RepositoryException {
+ S3DataStore s3ds = new S3DataStore();
+ s3ds.setProperties(props);
+ s3ds.setCacheSize(dataLength * 10);
+ s3ds.setCachePurgeTrigFactor(0.5d);
+ s3ds.setCachePurgeResizeFactor(0.4d);
+ s3ds.setSecret("123456");
+ s3ds.init(dataStoreDir);
+ sleep(1000);
+ return s3ds;
+ }
+}
diff --git a/jackrabbit-aws-ext/src/test/java/org/apache/jackrabbit/aws/ext/ds/TestS3Ds.java b/jackrabbit-aws-ext/src/test/java/org/apache/jackrabbit/aws/ext/ds/TestS3Ds.java
new file mode 100644
index 00000000000..36c256cddda
--- /dev/null
+++ b/jackrabbit-aws-ext/src/test/java/org/apache/jackrabbit/aws/ext/ds/TestS3Ds.java
@@ -0,0 +1,144 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.aws.ext.ds;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+import java.util.Properties;
+
+import javax.jcr.RepositoryException;
+
+import org.apache.jackrabbit.aws.ext.S3Constants;
+import org.apache.jackrabbit.aws.ext.Utils;
+import org.apache.jackrabbit.core.data.Backend;
+import org.apache.jackrabbit.core.data.CachingDataStore;
+import org.apache.jackrabbit.core.data.TestCaseBase;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.amazonaws.services.s3.AmazonS3Client;
+import com.amazonaws.services.s3.model.DeleteObjectsRequest;
+import com.amazonaws.services.s3.model.ObjectListing;
+import com.amazonaws.services.s3.model.S3ObjectSummary;
+import com.amazonaws.services.s3.transfer.TransferManager;
+
+/**
+ * Test {@link CachingDataStore} with S3Backend and local cache on. It requires
+ * to pass aws config file via system property. For e.g.
+ * -Dconfig=/opt/cq/aws.properties. Sample aws properties located at
+ * src/test/resources/aws.properties
+ */
+public class TestS3Ds extends TestCaseBase {
+
+ protected static final Logger LOG = LoggerFactory.getLogger(TestS3Ds.class);
+
+ private Date startTime = null;
+
+ protected Properties props;
+
+ protected String config;
+
+ public TestS3Ds() throws IOException {
+ System.setProperty(
+ TestCaseBase.CONFIG,
+ "C:/src/apache/jackrabbit-encryp-changes/jackrabbit/jackrabbit-aws-ext/src/test/resources/aws.properties");
+ config = System.getProperty(CONFIG);
+ props = Utils.readConfig(System.getProperty(CONFIG));
+ }
+
+ @Override
+ protected void setUp() throws Exception {
+ startTime = new Date();
+ super.setUp();
+ String bucket = String.valueOf(randomGen.nextInt(9999)) + "-"
+ + String.valueOf(randomGen.nextInt(9999)) + "-test";
+ props.setProperty(S3Constants.S3_BUCKET, bucket);
+ // delete bucket if exists
+ deleteBucket(bucket);
+ }
+
+ @Override
+ protected void tearDown() {
+ try {
+ deleteBucket();
+ super.tearDown();
+ } catch (Exception ignore) {
+
+ }
+ }
+
+ @Override
+ protected CachingDataStore createDataStore() throws RepositoryException {
+ S3DataStore s3ds = new S3DataStore();
+ s3ds.setProperties(props);
+ s3ds.setSecret("123456");
+ s3ds.init(dataStoreDir);
+ sleep(1000);
+ return s3ds;
+ }
+
+ /**
+ * Cleaning of bucket after test run.
+ */
+ /**
+ * Cleaning of bucket after test run.
+ */
+ public void deleteBucket() throws Exception {
+ Backend backend = ((S3DataStore) ds).getBackend();
+ String bucket = ((S3Backend) backend).getBucket();
+ deleteBucket(bucket);
+ }
+
+ public void deleteBucket(String bucket) throws Exception {
+ LOG.info("deleting bucket [" + bucket + "]");
+ Properties props = Utils.readConfig(config);
+ AmazonS3Client s3service = Utils.openService(props);
+ TransferManager tmx = new TransferManager(s3service);
+
+ if (s3service.doesBucketExist(bucket)) {
+ for (int i = 0; i < 4; i++) {
+ tmx.abortMultipartUploads(bucket, startTime);
+ ObjectListing prevObjectListing = s3service.listObjects(bucket);
+ while (prevObjectListing != null) {
+ List deleteList = new ArrayList();
+ for (S3ObjectSummary s3ObjSumm : prevObjectListing.getObjectSummaries()) {
+ deleteList.add(new DeleteObjectsRequest.KeyVersion(
+ s3ObjSumm.getKey()));
+ }
+ if (deleteList.size() > 0) {
+ DeleteObjectsRequest delObjsReq = new DeleteObjectsRequest(
+ bucket);
+ delObjsReq.setKeys(deleteList);
+ s3service.deleteObjects(delObjsReq);
+ }
+ if (!prevObjectListing.isTruncated()) break;
+ prevObjectListing = s3service.listNextBatchOfObjects(prevObjectListing);
+ }
+ }
+ s3service.deleteBucket(bucket);
+ LOG.info("bucket [ " + bucket + "] deleted");
+
+ } else {
+ LOG.info("bucket [" + bucket + "] doesn't exists");
+ }
+ tmx.shutdownNow();
+ s3service.shutdown();
+ }
+
+}
diff --git a/jackrabbit-aws-ext/src/test/java/org/apache/jackrabbit/aws/ext/ds/TestS3DsCacheOff.java b/jackrabbit-aws-ext/src/test/java/org/apache/jackrabbit/aws/ext/ds/TestS3DsCacheOff.java
new file mode 100644
index 00000000000..14896b9da7b
--- /dev/null
+++ b/jackrabbit-aws-ext/src/test/java/org/apache/jackrabbit/aws/ext/ds/TestS3DsCacheOff.java
@@ -0,0 +1,50 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.aws.ext.ds;
+
+import java.io.IOException;
+
+import javax.jcr.RepositoryException;
+
+import org.apache.jackrabbit.core.data.CachingDataStore;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Test {@link CachingDataStore} with S3Backend and local cache Off. It requires
+ * to pass aws config file via system property. For e.g.
+ * -Dconfig=/opt/cq/aws.properties. Sample aws properties located at
+ * src/test/resources/aws.properties
+ */
+public class TestS3DsCacheOff extends TestS3Ds {
+
+ protected static final Logger LOG = LoggerFactory.getLogger(TestS3DsCacheOff.class);
+
+ public TestS3DsCacheOff() throws IOException {
+ }
+
+ @Override
+ protected CachingDataStore createDataStore() throws RepositoryException {
+ S3DataStore s3ds = new S3DataStore();
+ s3ds.setProperties(props);
+ s3ds.setCacheSize(0);
+ s3ds.setSecret("123456");
+ s3ds.init(dataStoreDir);
+ sleep(1000);
+ return s3ds;
+ }
+}
diff --git a/jackrabbit-aws-ext/src/test/resources/aws.properties b/jackrabbit-aws-ext/src/test/resources/aws.properties
new file mode 100644
index 00000000000..04c752ae027
--- /dev/null
+++ b/jackrabbit-aws-ext/src/test/resources/aws.properties
@@ -0,0 +1,47 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+# AWS account ID
+accessKey=
+# AWS secret key
+secretKey=
+# AWS bucket name
+s3Bucket=
+# AWS bucket region
+# Mapping of S3 regions to their constants
+# US Standard us-standard
+# US West us-west-2
+# US West (Northern California) us-west-1
+# EU (Ireland) EU
+# Asia Pacific (Singapore) ap-southeast-1
+# Asia Pacific (Sydney) ap-southeast-2
+# Asia Pacific (Tokyo) ap-northeast-1
+# South America (Sao Paulo) sa-east-1
+s3Region=
+# S3 endpoint to be used. This parameter is optional
+# and has a higher precedence over endpoint derived
+# via S3 region.
+s3EndPoint=
+connectionTimeout=120000
+socketTimeout=120000
+maxConnections=20
+maxErrorRetry=10
+# maximum concurrent threads to write to S3.
+writeThreads=10
+# proxy configurations (optional)
+proxyHost=
+proxyPort=
\ No newline at end of file
diff --git a/jackrabbit-aws-ext/src/test/resources/log4j.properties b/jackrabbit-aws-ext/src/test/resources/log4j.properties
new file mode 100644
index 00000000000..ac7c3fc2057
--- /dev/null
+++ b/jackrabbit-aws-ext/src/test/resources/log4j.properties
@@ -0,0 +1,31 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+# this is the log4j configuration for the JCR API tests
+log4j.rootLogger=INFO, file
+log4j.logger.org.apache.jackrabbit.core.data.CachingDataStore=ERROR
+log4j.logger.org.apache.jackrabbit.aws.ext.ds=INFO
+
+#log4j.logger.org.apache.jackrabbit.test=DEBUG
+
+# 'file' is set to be a FileAppender.
+log4j.appender.file=org.apache.log4j.FileAppender
+log4j.appender.file.File=target/debug.log
+
+# 'file' uses PatternLayout.
+log4j.appender.file.layout=org.apache.log4j.PatternLayout
+log4j.appender.file.layout.ConversionPattern=%d{dd.MM.yyyy HH:mm:ss} *%-5p* [%t] %c{1}: %m (%F, line %L)\n
diff --git a/jackrabbit-aws-ext/src/test/resources/repository_sample.xml b/jackrabbit-aws-ext/src/test/resources/repository_sample.xml
new file mode 100644
index 00000000000..40a00ea064a
--- /dev/null
+++ b/jackrabbit-aws-ext/src/test/resources/repository_sample.xml
@@ -0,0 +1,170 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/jackrabbit-bundle/pom.xml b/jackrabbit-bundle/pom.xml
new file mode 100644
index 00000000000..5c5b4168c31
--- /dev/null
+++ b/jackrabbit-bundle/pom.xml
@@ -0,0 +1,135 @@
+
+
+
+
+
+ 4.0.0
+
+
+
+
+
+ org.apache.jackrabbit
+ jackrabbit-parent
+ 2.17.5-SNAPSHOT
+ ../jackrabbit-parent/pom.xml
+
+ jackrabbit-bundle
+ bundle
+ Jackrabbit OSGi bundle
+ OSGi bundle of Apache Jackrabbit
+
+
+
+
+ org.apache.felix
+ maven-bundle-plugin
+ true
+
+
+ *;groupId=!org.osgi|javax.jcr
+ true
+
+ org.apache.jackrabbit.api.*;version=${project.version}
+
+
+
+ org.apache.jackrabbit.test;resolution:=optional,
+
+ javax.servlet;resolution:=optional,
+ javax.servlet.http;resolution:=optional,
+
+ org.apache.xpath;resolution:=optional,
+ org.apache.xpath.objects;resolution:=optional,
+ org.apache.xml.utils;resolution:=optional,
+ org.apache.xalan.serialize;resolution:=optional,
+ org.apache.xalan.templates;resolution:=optional,
+ org.apache.derby.impl.drda;resolution:=optional,
+ *
+
+
+ org.apache.jackrabbit.bundle.Activator
+
+
+
+
+
+
+
+
+
+ org.osgi
+ org.osgi.core
+ 4.2.0
+ provided
+
+
+ org.osgi
+ org.osgi.compendium
+ 4.2.0
+ provided
+
+
+ javax.jcr
+ jcr
+ provided
+
+
+
+ org.apache.jackrabbit
+ jackrabbit-core
+ ${project.version}
+ provided
+
+
+ javax.jcr
+ jcr
+
+
+ org.slf4j
+ slf4j-api
+
+
+ org.slf4j
+ jcl-over-slf4j
+
+
+
+
+ org.apache.jackrabbit
+ jackrabbit-jcr2dav
+ ${project.version}
+ provided
+
+
+ javax.jcr
+ jcr
+
+
+ org.slf4j
+ slf4j-api
+
+
+ org.slf4j
+ jcl-over-slf4j
+
+
+
+
+
+
diff --git a/jackrabbit-bundle/src/main/java/org/apache/jackrabbit/bundle/Activator.java b/jackrabbit-bundle/src/main/java/org/apache/jackrabbit/bundle/Activator.java
new file mode 100644
index 00000000000..f9f358aba3b
--- /dev/null
+++ b/jackrabbit-bundle/src/main/java/org/apache/jackrabbit/bundle/Activator.java
@@ -0,0 +1,57 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.bundle;
+
+import java.io.File;
+import java.util.Hashtable;
+
+import javax.jcr.Repository;
+
+import org.apache.jackrabbit.core.RepositoryImpl;
+import org.apache.jackrabbit.core.config.RepositoryConfig;
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceRegistration;
+
+public class Activator implements BundleActivator {
+
+ private volatile RepositoryImpl repository;
+
+ private volatile ServiceRegistration registration;
+
+ public void start(BundleContext context) throws Exception {
+ repository = RepositoryImpl.create(
+ RepositoryConfig.install(new File("jackrabbit")));
+
+ Hashtable properties = new Hashtable();
+ for (String key : repository.getDescriptorKeys()) {
+ String descriptor = repository.getDescriptor(key);
+ if (descriptor != null) {
+ properties.put(key, descriptor);
+ }
+ }
+ registration = context.registerService(
+ Repository.class.getName(), repository, properties);
+ }
+
+ public void stop(BundleContext context) throws Exception {
+ registration.unregister();
+
+ repository.shutdown();
+ }
+
+}
diff --git a/jackrabbit-bundle/src/main/resources/OSGI-INF/jackrabbit-repository-factory.xml b/jackrabbit-bundle/src/main/resources/OSGI-INF/jackrabbit-repository-factory.xml
new file mode 100644
index 00000000000..8c9efb48a58
--- /dev/null
+++ b/jackrabbit-bundle/src/main/resources/OSGI-INF/jackrabbit-repository-factory.xml
@@ -0,0 +1,23 @@
+
+
+
+
+
+
+
+
diff --git a/jackrabbit-core/HEADER.txt b/jackrabbit-core/HEADER.txt
new file mode 100644
index 00000000000..ae6f28c4a1c
--- /dev/null
+++ b/jackrabbit-core/HEADER.txt
@@ -0,0 +1,16 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
diff --git a/jackrabbit-core/README.txt b/jackrabbit-core/README.txt
new file mode 100644
index 00000000000..21c486f43e5
--- /dev/null
+++ b/jackrabbit-core/README.txt
@@ -0,0 +1,7 @@
+==========================
+Welcome to Jackrabbit Core
+==========================
+
+This is the Core component of the Apache Jackrabbit project.
+This component contains the core of the fully JSR-170 compliant
+Apache Jackrabbit content repository implementation.
diff --git a/jackrabbit-core/checkstyle-suppressions.xml b/jackrabbit-core/checkstyle-suppressions.xml
new file mode 100644
index 00000000000..c0f0ab1833f
--- /dev/null
+++ b/jackrabbit-core/checkstyle-suppressions.xml
@@ -0,0 +1,31 @@
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/jackrabbit-core/checkstyle.xml b/jackrabbit-core/checkstyle.xml
new file mode 100644
index 00000000000..df1aedb4a14
--- /dev/null
+++ b/jackrabbit-core/checkstyle.xml
@@ -0,0 +1,175 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/jackrabbit-core/jdepend.properties b/jackrabbit-core/jdepend.properties
new file mode 100644
index 00000000000..b7e12a58b41
--- /dev/null
+++ b/jackrabbit-core/jdepend.properties
@@ -0,0 +1,20 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+ignore.java=java.*,javax.*,org.w3c.*,org.xml.*
+ignore.sun=sun.*,com.sun.*
+ignore.jackrabbit=org.apache.jackrabbit.util
+ignore.slf4j=org.slf4j
+ignore.commons=org.apache.commons
+ignore.concurrent=EDU.*
diff --git a/jackrabbit-core/pom.xml b/jackrabbit-core/pom.xml
new file mode 100644
index 00000000000..965e5c0c580
--- /dev/null
+++ b/jackrabbit-core/pom.xml
@@ -0,0 +1,582 @@
+
+
+
+
+
+ 4.0.0
+
+
+
+
+
+ org.apache.jackrabbit
+ jackrabbit-parent
+ 2.17.5-SNAPSHOT
+ ../jackrabbit-parent/pom.xml
+
+ jackrabbit-core
+ Jackrabbit Core
+ Jackrabbit content repository implementation
+
+
+ false
+ -Xmx512m
+
+
+
+
+
+ maven-antrun-plugin
+
+
+ process-test-resources
+ process-test-resources
+
+
+
+
+
+
+
+
+
+
+
+ run
+
+
+
+
+
+ ant
+ ant-optional
+ 1.5.3-1
+
+
+
+
+ maven-surefire-plugin
+
+
+ **/*TestAll.java
+
+ ${test.opts}
+
+
+ java.awt.headless
+ true
+
+
+ derby.system.durability
+ test
+
+
+ derby.storage.fileSyncTransactionLog
+ true
+
+
+ derby.stream.error.file
+ target/derby.log
+
+
+ org.apache.jackrabbit.repository.home
+ target/repository-factory-test
+
+
+ known.issues
+
+org.apache.jackrabbit.core.ConcurrentImportTest
+org.apache.jackrabbit.core.xml.DocumentViewTest#testMultiValue
+org.apache.jackrabbit.core.NodeImplTest#testReferentialIntegrityCorruptionGetPath
+org.apache.jackrabbit.core.integration.ConcurrentQueryTest#testConcurrentQueryWithDeletes
+org.apache.jackrabbit.test.api.ShareableNodeTest#testGetName
+org.apache.jackrabbit.test.api.ShareableNodeTest#testGetNode
+org.apache.jackrabbit.test.api.ShareableNodeTest#testGetNodes
+org.apache.jackrabbit.test.api.ShareableNodeTest#testGetNodesByPattern
+org.apache.jackrabbit.test.api.ShareableNodeTest#testMoveShareableNode
+org.apache.jackrabbit.test.api.ShareableNodeTest#testTransientMoveShareableNode
+org.apache.jackrabbit.test.api.lock.OpenScopedLockTest#testLockExpiration
+org.apache.jackrabbit.test.api.lock.SessionScopedLockTest#testLockExpiration
+org.apache.jackrabbit.test.api.observation.NodeReorderTest#testNodeReorderMove
+org.apache.jackrabbit.core.data.ConcurrentGcTest#testDatabases
+org.apache.jackrabbit.core.data.GarbageCollectorTest#testCloseSessionWhileRunningGc
+org.apache.jackrabbit.core.data.GarbageCollectorTest#testSimultaneousRunGC
+org.apache.jackrabbit.core.ReplacePropertyWhileOthersReadTest
+org.apache.jackrabbit.core.security.user.MembershipCachePerfTest
+org.apache.jackrabbit.test.api.query.qom.NodeLocalNameTest#testStringLiteralInvalidName
+org.apache.jackrabbit.test.api.query.qom.NodeLocalNameTest#testPathLiteral
+org.apache.jackrabbit.test.api.query.qom.NodeLocalNameTest#testURILiteral
+
+
+
+ org.apache.jackrabbit.test.integration
+ ${org.apache.jackrabbit.test.integration}
+
+
+
+
+
+ do_test
+ integration-test
+
+
+ **/integration/*Test.java
+
+
+
+ test
+
+
+
+
+
+ org.apache.rat
+ apache-rat-plugin
+
+
+ src/main/javadoc/**/*.uxf
+ src/test/repository/**
+ src/test/resources/**/*.txt
+ src/test/resources/**/*.rtf
+ src/test/resources/**/*.cnd
+ src/test/compatibility/**/target/**
+ src/test/compatibility/**/.*/**
+ src/test/compatibility/repositories.zip
+ repository/**
+ *.log
+
+
+
+
+ org.apache.maven.plugins
+ maven-jar-plugin
+
+
+ logback-test.xml
+
+
+
+
+
+ test-jar
+
+
+
+
+
+
+
+ src/main/resources
+
+
+ src/main/resources-filtered
+ true
+
+
+
+
+
+
+ org.eclipse.m2e
+ lifecycle-mapping
+ 1.0.0
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-antrun-plugin
+ [1.6,)
+
+ run
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ concurrent
+ concurrent
+
+
+ commons-collections
+ commons-collections
+
+
+ commons-io
+ commons-io
+
+
+ commons-dbcp
+ commons-dbcp
+ 1.3
+
+
+ javax.jcr
+ jcr
+
+
+ org.apache.jackrabbit
+ jackrabbit-api
+ ${project.version}
+
+
+ org.apache.jackrabbit
+ jackrabbit-jcr-commons
+ ${project.version}
+
+
+ org.apache.jackrabbit
+ jackrabbit-data
+ ${project.version}
+
+
+ org.apache.jackrabbit
+ jackrabbit-data
+ ${project.version}
+ test-jar
+ test
+
+
+ org.apache.jackrabbit
+ jackrabbit-spi-commons
+ ${project.version}
+
+
+ org.apache.jackrabbit
+ jackrabbit-spi
+ ${project.version}
+
+
+
+ org.apache.jackrabbit
+ jackrabbit-spi
+ ${project.version}
+ tests
+ test
+
+
+ org.apache.tika
+ tika-core
+
+
+ org.slf4j
+ slf4j-api
+
+
+ org.apache.lucene
+ lucene-core
+
+
+ org.apache.derby
+ derby
+
+
+ org.apache.jackrabbit
+ jackrabbit-jcr-tests
+ ${project.version}
+ true
+
+
+ junit
+ junit
+ test
+
+
+ org.apache.jackrabbit
+ jackrabbit-jcr-benchmark
+ test
+
+
+ org.apache.tika
+ tika-parsers
+ test
+
+
+ commons-logging
+ commons-logging
+
+
+
+
+ org.slf4j
+ jcl-over-slf4j
+
+
+ ch.qos.logback
+ logback-classic
+ test
+
+
+ javax.transaction
+ javax.transaction-api
+ test
+
+
+ com.h2database
+ h2
+ 1.4.195
+ test
+
+
+ org.mockito
+ mockito-core
+ test
+
+
+
+
+
+ integrationTesting
+
+ true
+
+
+
+
+ mysql
+
+ jackrabbit
+ org.apache.jackrabbit.core.fs.db.DbFileSystem
+ org.apache.jackrabbit.core.data.db.DbDataStore
+ org.apache.jackrabbit.core.persistence.pool.MySqlPersistenceManager
+ org.apache.jackrabbit.core.journal.DatabaseJournal
+ mysql
+ select 1
+ user
+ pwd
+ com.mysql.jdbc.Driver
+ jdbc:mysql://localhost:3306/${config.db.name}?autoReconnect=true
+ jdbc:mysql://localhost:3306/mysql?autoReconnect=true
+ drop database ${config.db.name}
+ create database ${config.db.name}
+
+
+
+ mssql
+
+ jackrabbit
+ org.apache.jackrabbit.core.fs.db.MSSqlFileSystem
+ org.apache.jackrabbit.core.data.db.DbDataStore
+ org.apache.jackrabbit.core.persistence.pool.MSSqlPersistenceManager
+ org.apache.jackrabbit.core.journal.MSSqlDatabaseJournal
+ mssql
+ select 1
+ user
+ pwd
+ net.sourceforge.jtds.jdbc.Driver
+ jdbc:jtds:sqlserver://localhost:2433/${config.db.name}
+ jdbc:jtds:sqlserver://localhost:2433/master
+ drop database ${config.db.name}
+ create database ${config.db.name}
+
+
+
+ oracle
+
+ unused
+ org.apache.jackrabbit.core.fs.db.OracleFileSystem
+ org.apache.jackrabbit.core.data.db.DbDataStore
+ org.apache.jackrabbit.core.persistence.pool.OraclePersistenceManager
+ org.apache.jackrabbit.core.journal.OracleDatabaseJournal
+ oracle
+ select 'validationQuery' from dual
+ user
+ password
+ oracle.jdbc.driver.OracleDriver
+ jdbc:oracle:thin:@localhost:1521:xe
+ unused
+ unused
+ unused
+
+
+
+ h2
+
+ jackrabbit
+ org.apache.jackrabbit.core.fs.db.DbFileSystem
+ org.apache.jackrabbit.core.data.db.DbDataStore
+ org.apache.jackrabbit.core.persistence.pool.H2PersistenceManager
+ org.apache.jackrabbit.core.journal.DatabaseJournal
+ h2
+ call 1
+ sa
+ sa
+ org.h2.Driver
+
+ jdbc:h2:~/jackrabbit2;MAX_LENGTH_INPLACE_LOB=10240;DB_CLOSE_ON_EXIT=FALSE
+ unused
+ drop all objects delete files
+ unused
+
+
+
+ use-descriptor-overlay
+
+
+
+
+ org.codehaus.mojo
+ sql-maven-plugin
+
+
+ mysql
+ mysql-connector-java
+ 5.1.6
+ jar
+ provided
+
+
+ net.sourceforge.jtds
+ jtds
+ 1.2.2
+ provided
+
+
+
+ ${config.db.driver}
+ ${config.db.metaurl}
+ ${config.db.user}
+ ${config.db.pwd}
+ sensibleKey
+
+
+
+ drop-db
+ clean
+
+ execute
+
+
+ true
+ ${config.db.dropcommand}
+ continue
+
+
+
+ create-db
+ clean
+
+ execute
+
+
+ true
+ ${config.db.createcommand}
+
+
+
+
+
+ maven-antrun-plugin
+
+
+ overlay-repository-descriptors
+ process-test-resources
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ run
+
+
+
+
+
+ ant
+ ant-optional
+ 1.5.3-1
+
+
+
+
+
+
+
+ mysql
+ mysql-connector-java
+ 5.1.6
+ jar
+ test
+
+
+ net.sourceforge.jtds
+ jtds
+ 1.2.2
+ test
+
+
+ com.oracle
+ ojdbc14
+ 10.2.0.3.0
+ test
+
+
+
+
+
diff --git a/jackrabbit-core/src/main/appended-resources/META-INF/NOTICE b/jackrabbit-core/src/main/appended-resources/META-INF/NOTICE
new file mode 100644
index 00000000000..45e7de5ff36
--- /dev/null
+++ b/jackrabbit-core/src/main/appended-resources/META-INF/NOTICE
@@ -0,0 +1,2 @@
+Based on source code originally developed by
+Day Software (http://www.day.com/).
diff --git a/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/AbstractNodeData.java b/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/AbstractNodeData.java
new file mode 100644
index 00000000000..50954e086ee
--- /dev/null
+++ b/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/AbstractNodeData.java
@@ -0,0 +1,126 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.core;
+
+import javax.jcr.nodetype.NodeDefinition;
+import javax.jcr.RepositoryException;
+
+import org.apache.jackrabbit.core.id.ItemId;
+import org.apache.jackrabbit.core.id.NodeId;
+import org.apache.jackrabbit.core.state.NodeState;
+
+/**
+ * Data object representing a node.
+ */
+public abstract class AbstractNodeData extends ItemData {
+
+ /** Primary parent id of a shareable node. */
+ private NodeId primaryParentId;
+
+ /**
+ * Create a new instance of this class.
+ *
+ * @param state node state
+ * @param itemMgr item manager
+ */
+ protected AbstractNodeData(NodeState state, ItemManager itemMgr) {
+ super(state, itemMgr);
+
+ if (state.isShareable()) {
+ this.primaryParentId = state.getParentId();
+ }
+ }
+
+ /**
+ * Create a new instance of this class.
+ *
+ * @param id item id
+ */
+ protected AbstractNodeData(ItemId id) {
+ super(id);
+ }
+
+ /**
+ * Return the associated node state.
+ *
+ * @return node state
+ */
+ public NodeState getNodeState() {
+ return (NodeState) getState();
+ }
+
+ /**
+ * Return the associated node definition.
+ *
+ * @return node definition
+ * @throws RepositoryException if the definition cannot be retrieved.
+ */
+ public NodeDefinition getNodeDefinition() throws RepositoryException {
+ return (NodeDefinition) getDefinition();
+ }
+
+ /**
+ * Sets the associated node definition.
+ *
+ * @param definition new node definition
+ */
+ public void setNodeDefinition(NodeDefinition definition) {
+ setDefinition(definition);
+ }
+
+ /**
+ * Return the parent id of this node. Every shareable node in a shared set
+ * has a different parent.
+ *
+ * @return parent id
+ */
+ @Override
+ public NodeId getParentId() {
+ if (primaryParentId != null) {
+ return primaryParentId;
+ }
+ return getState().getParentId();
+ }
+
+ /**
+ * Return the primary parent id of this node. Every shareable node in a
+ * shared set has a different primary parent. Returns null
+ * for nodes that are not shareable.
+ *
+ * @return primary parent id or null
+ */
+ public NodeId getPrimaryParentId() {
+ return primaryParentId;
+ }
+
+ /**
+ * Set the primary parent id of this node.
+ *
+ * @param primaryParentId primary parent id
+ */
+ protected void setPrimaryParentId(NodeId primaryParentId) {
+ this.primaryParentId = primaryParentId;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean isNode() {
+ return true;
+ }
+}
diff --git a/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/AddMixinOperation.java b/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/AddMixinOperation.java
new file mode 100644
index 00000000000..f3049f894ce
--- /dev/null
+++ b/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/AddMixinOperation.java
@@ -0,0 +1,179 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.core;
+
+import static org.apache.jackrabbit.core.ItemValidator.CHECK_CHECKED_OUT;
+import static org.apache.jackrabbit.core.ItemValidator.CHECK_CONSTRAINTS;
+import static org.apache.jackrabbit.core.ItemValidator.CHECK_HOLD;
+import static org.apache.jackrabbit.core.ItemValidator.CHECK_LOCK;
+import static org.apache.jackrabbit.spi.commons.name.NameConstants.MIX_SIMPLE_VERSIONABLE;
+import static org.apache.jackrabbit.spi.commons.name.NameConstants.MIX_VERSIONABLE;
+
+import java.util.HashSet;
+import java.util.Set;
+
+import javax.jcr.RepositoryException;
+import javax.jcr.nodetype.ConstraintViolationException;
+import javax.jcr.nodetype.NodeDefinition;
+import javax.jcr.nodetype.PropertyDefinition;
+
+import org.apache.jackrabbit.core.nodetype.EffectiveNodeType;
+import org.apache.jackrabbit.core.nodetype.NodeTypeConflictException;
+import org.apache.jackrabbit.core.nodetype.NodeTypeImpl;
+import org.apache.jackrabbit.core.nodetype.NodeTypeManagerImpl;
+import org.apache.jackrabbit.core.nodetype.NodeTypeRegistry;
+import org.apache.jackrabbit.core.security.authorization.Permission;
+import org.apache.jackrabbit.core.session.SessionContext;
+import org.apache.jackrabbit.core.session.SessionWriteOperation;
+import org.apache.jackrabbit.core.state.NodeState;
+import org.apache.jackrabbit.spi.Name;
+import org.apache.jackrabbit.spi.commons.nodetype.NodeDefinitionImpl;
+import org.apache.jackrabbit.spi.commons.nodetype.PropertyDefinitionImpl;
+
+/**
+ * Session operation for adding a mixin type to a node.
+ */
+class AddMixinOperation implements SessionWriteOperation