Return-Path:
true
+ * @throws Exception if an error occurrs.
+ */
+ public boolean exportNode(ExportContext context, Node content) throws =
Exception {
+ File tmpfile =3D File.createTempFile("__webdav", ".xml");
+ FileOutputStream out =3D new FileOutputStream(tmpfile);
+ if (mode.equals(MODE_DOCVIEW)) {
+ content.getSession().exportDocView(content.getPath(), out, tru=
e, false);
+ } else {
+ content.getSession().exportSysView(content.getPath(), out, tru=
e, false);
+ }
+ out.close();
+ context.setInputStream(new FileInputStream(tmpfile));
+ context.setContentLength(tmpfile.length());
+ tmpfile.deleteOnExit();
+ return true;
+ }
+
+ /**
+ * Returns {@link #XML_CONTENT_TYPE}.
+ * @return {@link #XML_CONTENT_TYPE}.
+ */
+ public String getDefaultContentType() {
+ return XML_CONTENT_TYPE;
+ }
+
+ /**
+ * Returns true
+ * @param node
+ * @return true
+ */
+ public boolean canHandle(Node node) {
+ return true;
+ }
+}
Propchange: incubator/jackrabbit/trunk/contrib/jcr-server/server/src/java/o=
rg/apache/jackrabbit/server/io/XMLExportCommand.java
---------------------------------------------------------------------------=
---
svn =3D=20
Propchange: incubator/jackrabbit/trunk/contrib/jcr-server/server/src/java/o=
rg/apache/jackrabbit/server/io/XMLExportCommand.java
---------------------------------------------------------------------------=
---
svn:eol-style =3D native
Added: incubator/jackrabbit/trunk/contrib/jcr-server/server/src/java/org/ap=
ache/jackrabbit/server/io/XMLImportCommand.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-s=
erver/server/src/java/org/apache/jackrabbit/server/io/XMLImportCommand.java=
?view=3Dauto&rev=3D160914
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- incubator/jackrabbit/trunk/contrib/jcr-server/server/src/java/org/apach=
e/jackrabbit/server/io/XMLImportCommand.java (added)
+++ incubator/jackrabbit/trunk/contrib/jcr-server/server/src/java/org/apach=
e/jackrabbit/server/io/XMLImportCommand.java Mon Apr 11 09:04:58 2005
@@ -0,0 +1,72 @@
+/*
+ * Copyright 2004-2005 The Apache Software Foundation or its licensors,
+ * as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.server.io;
+
+import javax.jcr.Node;
+import java.io.InputStream;
+import java.util.Calendar;
+
+/**
+ * This Class implements an import command that deserializes the xml conta=
ined
+ * in the import stream, using {@link javax.jcr.Session#importXML(String, =
java.io.InputStream)}.
+ * It further sets the following properties:
+ *
+ *
+ */
+public class XMLImportCommand extends AbstractImportCommand {
+
+ /**
+ * the xml content type
+ */
+ public static final String XML_CONTENT_TYPE =3D "text/xml";
+
+ /**
+ * Imports the resource by deseriaizing the xml.
+ * @param ctx
+ * @param parentNode
+ * @param in
+ * @return
+ * @throws Exception
+ */
+ public boolean importResource(ImportContext ctx, Node parentNode,
+ InputStream in)
+ throws Exception {
+ Node content =3D parentNode.hasNode(JCR_CONTENT)
+ ? parentNode.getNode(JCR_CONTENT)
+ : parentNode.addNode(JCR_CONTENT, NT_UNSTRUCTURED);
+ content.setProperty(JCR_MIMETYPE, ctx.getContentType());
+ Calendar lastMod =3D Calendar.getInstance();
+ if (ctx.getModificationTime() !=3D 0) {
+ lastMod.setTimeInMillis(ctx.getModificationTime());
+ }
+ content.setProperty(JCR_LASTMODIFIED, lastMod);
+ parentNode.getSession().importXML(content.getPath(), in);
+ return true;
+ }
+
+ /**
+ * Returns true
if the given content type is equal to
+ * {@link #XML_CONTENT_TYPE}.
+ * @param contentType the content type to check.
+ * @return true
if equal to {@link #XML_CONTENT_TYPE}.
+ */
+ public boolean canHandle(String contentType) {
+ return XML_CONTENT_TYPE.equals(contentType);
+ }
+}
Propchange: incubator/jackrabbit/trunk/contrib/jcr-server/server/src/java/o=
rg/apache/jackrabbit/server/io/XMLImportCommand.java
---------------------------------------------------------------------------=
---
svn =3D=20
Propchange: incubator/jackrabbit/trunk/contrib/jcr-server/server/src/java/o=
rg/apache/jackrabbit/server/io/XMLImportCommand.java
---------------------------------------------------------------------------=
---
svn:eol-style =3D native
Added: incubator/jackrabbit/trunk/contrib/jcr-server/server/src/java/org/ap=
ache/jackrabbit/server/io/ZIPImportCommand.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-s=
erver/server/src/java/org/apache/jackrabbit/server/io/ZIPImportCommand.java=
?view=3Dauto&rev=3D160914
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- incubator/jackrabbit/trunk/contrib/jcr-server/server/src/java/org/apach=
e/jackrabbit/server/io/ZIPImportCommand.java (added)
+++ incubator/jackrabbit/trunk/contrib/jcr-server/server/src/java/org/apach=
e/jackrabbit/server/io/ZIPImportCommand.java Mon Apr 11 09:04:58 2005
@@ -0,0 +1,161 @@
+/*
+ * Copyright 2004-2005 The Apache Software Foundation or its licensors,
+ * as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.server.io;
+
+import org.apache.log4j.Logger;
+import org.apache.jackrabbit.webdav.util.Text;
+import org.apache.jackrabbit.JCRConstants;
+import org.apache.commons.chain.Context;
+import org.apache.commons.chain.Command;
+
+import javax.jcr.Node;
+import javax.jcr.RepositoryException;
+import java.io.InputStream;
+import java.util.zip.ZipInputStream;
+import java.util.zip.ZipEntry;
+
+/**
+ * This Class implements an import command that reads entries from a zip i=
nput
+ * stream and delegates the extracted file back to the import chain.
+ */
+public class ZIPImportCommand implements Command, JCRConstants {
+
+ /** the default logger */
+ private static final Logger log =3D Logger.getLogger(ZIPImportCommand.=
class);
+
+ /**
+ * the zip content type
+ */
+ public static final String ZIP_CONTENT_TYPE =3D "application/zip";
+
+ /**
+ * Executes this command by calling {@link #importResource} if
+ * the given context is of the correct class.
+ *
+ * @param context the (import) context.
+ * @return the return value of the delegated method or false;
+ * @throws Exception in an error occurrs
+ */
+ public boolean execute(Context context) throws Exception {
+ if (context instanceof ImportContext) {
+ return execute((ImportContext) context);
+ } else {
+ return false;
+ }
+ }
+
+ /**
+ * Executes this command. It checks if this command can handle the con=
tent
+ * type and delegates it to {@link #importResource}. If the import is
+ * successfull, the input stream of the importcontext is cleared.
+ *
+ * @param context the import context
+ * @return false
+ * @throws Exception if an error occurrs
+ */
+ public boolean execute(ImportContext context) throws Exception {
+ Node parentNode =3D context.getNode();
+ InputStream in =3D context.getInputStream();
+ if (in =3D=3D null) {
+ // assume already consumed
+ return false;
+ }
+ if (!canHandle(context.getContentType())) {
+ // ignore imports
+ return false;
+ }
+ importResource(parentNode, in);
+ context.setInputStream(null);
+ return true;
+ }
+
+ /**
+ * Imports a resource by extracting the input stream and delegating to
+ * import chain.
+ *
+ * @param parentNode the parent node
+ * @param in the input stream
+ * @throws Exception in an error occurrs
+ */
+ private void importResource(Node parentNode, InputStream in)
+ throws Exception {
+
+ // assuming zip content
+ ZipInputStream zin =3D new ZipInputStream(in);
+ ZipEntry entry;
+ while ((entry=3Dzin.getNextEntry())!=3Dnull) {
+ log.info("entry: " + entry.getName() + " size: " + entry.getSi=
ze());
+ if (entry.isDirectory()) {
+ mkDirs(parentNode, Text.makeValidJCRPath(entry.getName()));
+ zin.closeEntry();
+ } else {
+ String path =3D Text.makeValidJCRPath(entry.getName());
+ if (path.charAt(0)!=3D'/') {
+ path =3D "/" + path;
+ }
+ Node parent =3D mkDirs(parentNode, Text.getRelativeParent(=
path, 1));
+
+ BoundedInputStream bin =3D new BoundedInputStream(zin);
+ bin.setPropagateClose(false);
+
+ ImportContext subctx =3D new ImportContext(parent);
+ subctx.setInputStream(bin);
+ subctx.setSystemId(Text.getLabel(path));
+ subctx.setModificationTime(entry.getTime());
+ ImportNCResourceChain.getChain().execute(subctx);
+ zin.closeEntry();
+ }
+ }
+ zin.close();
+ }
+
+ /**
+ * Creates collection recursively.
+ *
+ * @param root
+ * @param relPath
+ * @return
+ * @throws RepositoryException
+ */
+ private Node mkDirs(Node root, String relPath) throws RepositoryExcept=
ion {
+ String[] seg =3D Text.explode(relPath, '/');
+ for (int i=3D0; i< seg.length; i++) {
+ if (!root.hasNode(seg[i])) {
+ // not quite correct
+ ImportContext subctx =3D new ImportContext(root);
+ subctx.setSystemId(seg[i]);
+ try {
+ ImportCollectionChain.getChain().execute(subctx);
+ } catch (Exception e) {
+ throw new RepositoryException(e);
+ }
+ }
+ root =3D root.getNode(seg[i]);
+ }
+ return root;
+ }
+
+ /**
+ * Returns true
if the given content type is equal to
+ * {@link #ZIP_CONTENT_TYPE}.
+ * @param contentType the content type to check.
+ * @return true
if equal to {@link #ZIP_CONTENT_TYPE}.
+ */
+ public boolean canHandle(String contentType) {
+ return ZIP_CONTENT_TYPE.equals(contentType);
+ }
+}
Propchange: incubator/jackrabbit/trunk/contrib/jcr-server/server/src/java/o=
rg/apache/jackrabbit/server/io/ZIPImportCommand.java
---------------------------------------------------------------------------=
---
svn =3D=20
Propchange: incubator/jackrabbit/trunk/contrib/jcr-server/server/src/java/o=
rg/apache/jackrabbit/server/io/ZIPImportCommand.java
---------------------------------------------------------------------------=
---
svn:eol-style =3D native
Added: incubator/jackrabbit/trunk/contrib/jcr-server/server/src/java/org/ap=
ache/jackrabbit/server/io/package.html
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-s=
erver/server/src/java/org/apache/jackrabbit/server/io/package.html?view=3Da=
uto&rev=3D160914
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- incubator/jackrabbit/trunk/contrib/jcr-server/server/src/java/org/apach=
e/jackrabbit/server/io/package.html (added)
+++ incubator/jackrabbit/trunk/contrib/jcr-server/server/src/java/org/apach=
e/jackrabbit/server/io/package.html Mon Apr 11 09:04:58 2005
@@ -0,0 +1,39 @@
+The jackrabbit webdav server, makes use of the commons-chain
+framekwork in order to perform inport and export operations.
+
DavLocatorFactory
. If no locator factory h=
as
+ * been set or created a new instance of {@link LocatorFactoryImpl} is
+ * returned.
+ *
+ * @return the locator factory
+ */
+ public DavLocatorFactory getLocatorFactory() {
+ if (locatorFactory =3D=3D null) {
+ locatorFactory =3D new LocatorFactoryImpl(resourcePathPrefix);
+ }
+ return locatorFactory;
+ }
+
+ /**
+ * Set the locator factory
+ *
+ * @param locatorFactory
+ */
+ public void setLocatorFactory(DavLocatorFactory locatorFactory) {
+ this.locatorFactory =3D locatorFactory;
+ }
+
+ /**
+ * Returns the LockManager
. If no lock manager has
+ * been set or created a new instance of {@link SimpleLockManager} is
+ * returned.
+ *
+ * @return the lock manager
+ */
+ public LockManager getLockManager() {
+ if (lockManager =3D=3D null) {
+ lockManager =3D new SimpleLockManager();
+ }
+ return lockManager;
+ }
+
+ /**
+ * Set the lock manager
+ *
+ * @param lockManager
+ */
+ public void setLockManager(LockManager lockManager) {
+ this.lockManager =3D lockManager;
+ }
+
+ /**
+ * Returns the DavResourceFactory
. If no request factory =
has
+ * been set or created a new instance of {@link ResourceFactoryImpl} is
+ * returned.
+ *
+ * @return the resource factory
+ */
+ public DavResourceFactory getResourceFactory() {
+ if (resourceFactory =3D=3D null) {
+ resourceFactory =3D new ResourceFactoryImpl(getLockManager());
+ }
+ return resourceFactory;
+ }
+
+ /**
+ * Set the resource factory
+ *
+ * @param resourceFactory
+ */
+ public void setResourceFactory(DavResourceFactory resourceFactory) {
+ this.resourceFactory =3D resourceFactory;
+ }
+
+ /**
* Returns the DavSessionProvider
. If no session provider=
has
* been set or created a new instance of {@link DavSessionProviderImpl=
} is
- * return.
+ * returned.
*
* @return the session provider
*/
- public DavSessionProvider getDavSessionProvider() {
+ public DavSessionProvider getSessionProvider() {
if (sessionProvider =3D=3D null) {
sessionProvider =3D new DavSessionProviderImpl();
}
@@ -224,7 +310,7 @@
*
* @param sessionProvider
*/
- public void setDavSessionProvider(DavSessionProvider sessionProvider) {
+ public void setSessionProvider(DavSessionProvider sessionProvider) {
this.sessionProvider =3D sessionProvider;
}
}
Modified: incubator/jackrabbit/trunk/contrib/jcr-server/server/src/java/org=
/apache/jackrabbit/server/simple/dav/DavResourceImpl.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-s=
erver/server/src/java/org/apache/jackrabbit/server/simple/dav/DavResourceIm=
pl.java?view=3Ddiff&r1=3D160913&r2=3D160914
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- incubator/jackrabbit/trunk/contrib/jcr-server/server/src/java/org/apach=
e/jackrabbit/server/simple/dav/DavResourceImpl.java (original)
+++ incubator/jackrabbit/trunk/contrib/jcr-server/server/src/java/org/apach=
e/jackrabbit/server/simple/dav/DavResourceImpl.java Mon Apr 11 09:04:58 2005
@@ -26,11 +26,19 @@
import org.apache.jackrabbit.webdav.spi.JcrDavException;
import org.apache.jackrabbit.webdav.lock.*;
import org.apache.jackrabbit.webdav.property.*;
+import org.apache.jackrabbit.JCRConstants;
+import org.apache.jackrabbit.server.io.ImportContext;
+import org.apache.jackrabbit.server.io.ImportNCResourceChain;
+import org.apache.jackrabbit.server.io.ImportCollectionChain;
+import org.apache.log4j.Logger;
=20
/**
* DavResourceImpl imeplements a DavResource.
*/
-public class DavResourceImpl implements DavResource {
+public class DavResourceImpl implements DavResource, JCRConstants {
+
+ /** the default logger */
+ private static final Logger log =3D Logger.getLogger(DavResourceImpl.c=
lass);
=20
private DavResourceFactory factory;
private LockManager lockManager;
@@ -79,7 +87,7 @@
node =3D (Node)repositoryItem;
=20
// define what is a resource in webdav
- if (node.isNodeType("nt:resource") || node.isNodeType("nt:file")) {
+ if (node.isNodeType(NT_RESOURCE) || node.isNodeType(NT_FILE)) {
isCollection =3D false;
}
}
@@ -315,70 +323,24 @@
=20
try {
String fileName =3D member.getDisplayName();
- Node file;
- boolean makeVersionable =3D true; // todo: to be configurable somewhe=
re
- if (node.hasNode(fileName)) {
- file =3D node.getNode(fileName);
- if (file.hasNode("jcr:content")) {
- // remove an existing repository entry for 'overwriting' is not poss=
ible
- file.getNode("jcr:content").remove();
- }
- } else {
- file =3D 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");
- }
+ ImportContext ctx =3D new ImportContext(node);
+ ctx.setInputStream(in);
+ ctx.setSystemId(fileName);
+ ImportNCResourceChain.getChain().execute(ctx);
session.getRepositorySession().save();
} catch (RepositoryException e) {
+ log.error("Error while executing import chain: " + e.toString(=
));
throw new JcrDavException(e);
} catch (IOException e) {
+ log.error("Error while executing import chain: " + e.toString(=
));
+ throw new DavException(DavServletResponse.SC_INTERNAL_SERVER_E=
RROR, e.getMessage());
+ } catch (Exception e) {
+ log.error("Error while executing import chain: " + e.toString(=
));
throw new DavException(DavServletResponse.SC_INTERNAL_SERVER_E=
RROR, e.getMessage());
}
}
=20
/**
- * Imports a xml into the repository
- *
- * @param parentNode
- * @param in
- * @param contentType
- * @throws RepositoryException
- * @throws IOException
- */
- private void importXml(Node parentNode, InputStream in, String content=
Type)
- throws RepositoryException, IOException {
- Node content =3D 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 conten=
tType)
- throws RepositoryException {
- Node content =3D 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());
- }
-
- /**
* Creates a new collection as member of this resource.
*
* @see DavResource#addMember(DavResource)
@@ -391,12 +353,19 @@
throw new DavException(DavServletResponse.SC_LOCKED);
}
try {
- node.addNode(member.getDisplayName(), "nt:folder");
+ ImportContext ctx =3D new ImportContext(node);
+ ctx.setSystemId(member.getDisplayName());
+ ImportCollectionChain.getChain().execute(ctx);
node.save();
} catch (ItemExistsException e) {
+ log.error("Error while executing import chain: " + e.toString(=
));
throw new DavException(DavServletResponse.SC_METHOD_NOT_ALLOWE=
D);
} catch (RepositoryException e) {
+ log.error("Error while executing import chain: " + e.toString(=
));
throw new JcrDavException(e);
+ } catch (Exception e) {
+ log.error("Error while executing import chain: " + e.toString(=
));
+ throw new DavException(DavServletResponse.SC_INTERNAL_SERVER_E=
RROR, e.getMessage());
}
}
=20
@@ -508,8 +477,12 @@
// LockException: no lock applies to this node >> igno=
re
// RepositoryException, AccessDeniedException or anoth=
er error >> ignore
}
- } else {
- // not-jcr lockable >> check for webdav lock
+ }
+
+ // could not retrieve jcr-lock (either not jcr-lockable or the=
lock has
+ // been created before the node was made jcr-lockable. test if=
a simple
+ // webdav lock is present.
+ if (lock =3D=3D null) {
lock =3D lockManager.getLock(type, scope, this);
}
}
@@ -528,8 +501,9 @@
*/
public ActiveLock lock(LockInfo lockInfo) throws DavException {
ActiveLock lock =3D null;
- if (isLockable(lockInfo.getType(), lockInfo.getScope())) {
- if (isJsrLockable()) {
+ if (isLockable(lockInfo.getType(), lockInfo.getScope())) {
+ // todo: deal with existing locks, that may have been created,=
before the node was jcr-lockable... =20
+ if (isJsrLockable()) {
try {
// try to execute the lock operation
Lock jcrLock =3D node.lock(lockInfo.isDeep(), false);
@@ -540,7 +514,7 @@
throw new JcrDavException(e);
}
} else {
- // create a new lock which creates a random lock token
+ // create a new webdav lock
lock =3D lockManager.createLock(lockInfo, this);
}
} else {
@@ -556,11 +530,9 @@
if (!exists()) {
throw new DavException(DavServletResponse.SC_NOT_FOUND);
}
- /* since lock is always has infinite timeout >> no extra refresh n=
eeded
- return a lockdiscovery with the lock-info and the default scope=
and type */
- ActiveLock lock =3D getLock(Type.WRITE, Scope.EXCLUSIVE);
+ ActiveLock lock =3D getLock(lockInfo.getType(), lockInfo.getScope(=
));
if (lock =3D=3D null) {
- throw new DavException(DavServletResponse.SC_PRECONDITION_FAILE=
D, "No lock present on resource " + getResourcePath());
+ throw new DavException(DavServletResponse.SC_PRECONDITION_FAILE=
D, "No lock with the given type/scope present on resource " + getResourcePa=
th());
}
=20
if (lock instanceof JcrActiveLock) {
@@ -573,6 +545,8 @@
} else {
lock =3D lockManager.refreshLock(lockInfo, lockToken, this);
}
+ /* since lock has infinite lock (simple) or undefined timeout (jcr)
+ return the lock as retrieved from getLock. */
return lock;
}
=20
Modified: incubator/jackrabbit/trunk/contrib/jcr-server/server/src/java/org=
/apache/jackrabbit/server/simple/dav/NodeResource.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-s=
erver/server/src/java/org/apache/jackrabbit/server/simple/dav/NodeResource.=
java?view=3Ddiff&r1=3D160913&r2=3D160914
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- incubator/jackrabbit/trunk/contrib/jcr-server/server/src/java/org/apach=
e/jackrabbit/server/simple/dav/NodeResource.java (original)
+++ incubator/jackrabbit/trunk/contrib/jcr-server/server/src/java/org/apach=
e/jackrabbit/server/simple/dav/NodeResource.java Mon Apr 11 09:04:58 2005
@@ -16,7 +16,10 @@
package org.apache.jackrabbit.server.simple.dav;
=20
import org.apache.log4j.Logger;
-import org.apache.jackrabbit.webdav.util.Text;
+import org.apache.jackrabbit.server.io.ExportContext;
+import org.apache.jackrabbit.server.io.ExportCollectionChain;
+import org.apache.jackrabbit.server.io.ExportNCResourceChain;
+import org.apache.commons.chain.Command;
=20
import javax.jcr.*;
import java.util.Date;
@@ -50,11 +53,6 @@
public static SimpleDateFormat creationDateFormat =3D
new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'");
=20
- private static final String PROP_MIMETYPE =3D "jcr:mimeType";
- private static final String PROP_ENCODING =3D "jcr:encoding";
- private static final String PROP_LASTMODIFIED =3D "jcr:lastModified";
- private static final String PROP_CREATED =3D "jcr:created";
-
private long creationTime =3D 0;
private long modificationTime =3D new Date().getTime();
private long contentLength =3D 0;
@@ -69,120 +67,21 @@
* @throws IllegalArgumentException if the given item is null
*/
public NodeResource(DavResourceImpl davResource, Node node) throws Ite=
mNotFoundException, RepositoryException {
- try {
- if (davResource.isCollection()) {
- createDirListingContent(node);
- } else {
- if (node.hasProperty(PROP_CREATED)) {
- creationTime =3D node.getProperty(PROP_CREATED).getValue().getLong();
- }
- Node content =3D 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 =3D content.getProperty(PROP_LASTMODIFIED).getLong();
- }
- if (content.hasProperty(PROP_MIMETYPE)) {
- contentType =3D content.getProperty(PROP_MIMETYPE).getString();
- }
- if (content.hasProperty(PROP_ENCODING)) {
- String encoding =3D content.getProperty(PROP_ENCODING).getString();
- if (!encoding.equals("")) {
- contentType+=3D"; charset=3D\"" + encoding + "\"";
- }
- }
- if (content.hasProperty("jcr:data")) {
- Property p =3D content.getProperty("jcr:data");
- contentLength =3D p.getLength();
- in =3D p.getStream();
- } else {
- contentLength =3D 0;
- }
- }
-
- private void createDocViewContent(Node node) throws IOException, Repos=
itoryException {
- File tmpfile =3D File.createTempFile("__webdav", ".xml");
- FileOutputStream out =3D new FileOutputStream(tmpfile);
- node.getSession().exportDocView(node.getPath(), out, true, false);
- out.close();
- in =3D new FileInputStream(tmpfile);
- contentLength =3D tmpfile.length();
- modificationTime =3D tmpfile.lastModified();
- contentType =3D "text/xml";
- tmpfile.deleteOnExit();
- }
-
- private void createSysViewContent(Node node) throws IOException, Repos=
itoryException {
- File tmpfile =3D File.createTempFile("__webdav", ".xml");
- FileOutputStream out =3D new FileOutputStream(tmpfile);
- node.getSession().exportSysView(node.getPath(), out, true, false);
- out.close();
- in =3D new FileInputStream(tmpfile);
- contentLength =3D tmpfile.length();
- modificationTime =3D tmpfile.lastModified();
- contentType =3D "text/xml";
- tmpfile.deleteOnExit();
- }
-
- private void createDirListingContent(Node node) throws IOException, Re=
positoryException {
- File tmpfile =3D File.createTempFile("__webdav", ".xml");
- FileOutputStream out =3D new FileOutputStream(tmpfile);
-
- String repName =3D node.getSession().getRepository().getDescriptor(Reposi=
tory.REP_NAME_DESC);
- String repURL =3D node.getSession().getRepository().getDescriptor(Reposit=
ory.REP_VENDOR_URL_DESC);
- String repVersion =3D node.getSession().getRepository().getDescriptor(Rep=
ository.REP_VERSION_DESC);
- PrintWriter writer =3D new PrintWriter(out);
- writer.print("");
- writer.print(repName);
- writer.print(" ");
- writer.print(repVersion);
- writer.print(" ");
- writer.print(node.getPath());
- writer.print(" ");
- writer.print("");
- writer.print(node.getPath());
- writer.print("
");
- writer.print("- ..
");
- NodeIterator iter =3D node.getNodes();
- while (iter.hasNext()) {
- Node child =3D iter.nextNode();
- String label =3D Text.getLabel(child.getPath());
- writer.print("- ");
- writer.print(label);
- writer.print("
");
- }
- writer.print("
Powered by ");
- writer.print(repName);
- writer.print(" version ");
- writer.print(repVersion);
- writer.print("");
-
- writer.close();
- out.close();
- in =3D new FileInputStream(tmpfile);
- contentLength =3D tmpfile.length();
- modificationTime =3D tmpfile.lastModified();
- contentType =3D "text/html";
- tmpfile.deleteOnExit();
+ ExportContext ctx =3D new ExportContext(node);
+ Command exportChain =3DdavResource.isCollection()
+ ? ExportCollectionChain.getChain()
+ : ExportNCResourceChain.getChain();
+ try {
+ exportChain.execute(ctx);
+ } catch (Exception e) {
+ log.error("Error while executing export chain: " + e.toString(=
));
+ throw new RepositoryException(e);
+ }
+ this.contentLength =3D ctx.getContentLength();
+ this.contentType =3D ctx.getContentType();
+ this.in =3D ctx.getInputStream();
+ this.creationTime =3D ctx.getCreationTime();
+ this.modificationTime =3D ctx.getModificationTime();
}
=20
/**
Modified: incubator/jackrabbit/trunk/contrib/jcr-server/server/src/java/org=
/apache/jackrabbit/server/simple/dav/lock/SimpleLockManager.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-s=
erver/server/src/java/org/apache/jackrabbit/server/simple/dav/lock/SimpleLo=
ckManager.java?view=3Ddiff&r1=3D160913&r2=3D160914
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- incubator/jackrabbit/trunk/contrib/jcr-server/server/src/java/org/apach=
e/jackrabbit/server/simple/dav/lock/SimpleLockManager.java (original)
+++ incubator/jackrabbit/trunk/contrib/jcr-server/server/src/java/org/apach=
e/jackrabbit/server/simple/dav/lock/SimpleLockManager.java Mon Apr 11 09:04=
:58 2005
@@ -140,7 +140,7 @@
public ActiveLock refreshLock(LockInfo lockInfo, String lockToken, Dav=
Resource resource)
throws DavException {
// timeout is always infinite > no test for expiration or adjusting timeo=
ut needed.
- ActiveLock lock =3D getLock(Type.WRITE, Scope.EXCLUSIVE, resource);
+ ActiveLock lock =3D getLock(lockInfo.getType(), lockInfo.getScope(), reso=
urce);
if (lock =3D=3D null) {
throw new DavException(DavServletResponse.SC_PRECONDITION_FAILED);
} else if (!lock.getToken().equals(lockToken)) {
Modified: incubator/jackrabbit/trunk/contrib/jcr-server/server/src/java/org=
/apache/jackrabbit/webdav/spi/AbstractResource.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-s=
erver/server/src/java/org/apache/jackrabbit/webdav/spi/AbstractResource.jav=
a?view=3Ddiff&r1=3D160913&r2=3D160914
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- incubator/jackrabbit/trunk/contrib/jcr-server/server/src/java/org/apach=
e/jackrabbit/webdav/spi/AbstractResource.java (original)
+++ incubator/jackrabbit/trunk/contrib/jcr-server/server/src/java/org/apach=
e/jackrabbit/webdav/spi/AbstractResource.java Mon Apr 11 09:04:58 2005
@@ -106,7 +106,7 @@
* @see DavResourceLocator#getHref(boolean)
*/
public String getHref() {
- return locator.getHref(true);
+ return locator.getHref(isCollection());
}
=20
/**
@@ -294,7 +294,7 @@
* @see DavResource#refreshLock(org.apache.jackrabbit.webdav.lock.Lock=
Info, String)
*/
public ActiveLock refreshLock(LockInfo info, String lockToken) throws =
DavException {
- return txMgr.refreshLock(info, lockToken, this);
+ return txMgr.refreshLock(info, lockToken, this); =20
}
=20
/**
Modified: incubator/jackrabbit/trunk/contrib/jcr-server/server/src/java/org=
/apache/jackrabbit/webdav/spi/DefaultItemCollection.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-s=
erver/server/src/java/org/apache/jackrabbit/webdav/spi/DefaultItemCollectio=
n=2Ejava?view=3Ddiff&r1=3D160913&r2=3D160914
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- incubator/jackrabbit/trunk/contrib/jcr-server/server/src/java/org/apach=
e/jackrabbit/webdav/spi/DefaultItemCollection.java (original)
+++ incubator/jackrabbit/trunk/contrib/jcr-server/server/src/java/org/apach=
e/jackrabbit/webdav/spi/DefaultItemCollection.java Mon Apr 11 09:04:58 2005
@@ -24,6 +24,7 @@
import org.apache.jackrabbit.webdav.ordering.*;
import org.apache.jackrabbit.webdav.util.Text;
import org.apache.jackrabbit.webdav.lock.*;
+import org.apache.jackrabbit.JCRConstants;
=20
import javax.jcr.*;
import javax.jcr.lock.Lock;
@@ -430,8 +431,12 @@
throw new DavException(DavServletResponse.SC_PRECONDITION_FAIL=
ED);
}
=20
- ActiveLock lock =3D getWriteLock();
- if (lock !=3D null && lockToken.equals(lock.getToken())) {
+ ActiveLock lock =3D getLock(reqLockInfo.getType(), reqLockInfo.get=
Scope());
+ if (lock =3D=3D null) {
+ throw new DavException(DavServletResponse.SC_PRECONDITION_FAIL=
ED, "No lock with the given scope/type present on this resource.");
+ }
+
+ if (Type.WRITE.equals(lock.getType())) {
try {
Lock jcrLock =3D ((Node) item).getLock();
jcrLock.refresh();
@@ -599,13 +604,13 @@
* resource: write locks (exclusive or exclusive session-scoped) in ca=
se the underlaying
* node has the node type mix:lockable.
*
- * @see #MIX_LOCKABLE
+ * @see org.apache.jackrabbit.JCRConstants#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)) {
+ if (exists() && ((Node)item).isNodeType(JCRConstants.MIX_LOCKA=
BLE)) {
supportedLock.addEntry(Type.WRITE, Scope.EXCLUSIVE);
// TODO: do session-scoped lock properly (including sessio=
n caching and proper scope discovery)
//supportedLock.addEntry(new SessionScopedLockEntry());
@@ -643,16 +648,16 @@
Node n =3D (Node)item;
// overwrite the default modificationtime if possible
try {
- if (n.hasProperty(PROP_LASTMODIFIED)) {
- setModificationTime(n.getProperty(PROP_LASTMODIFIED).g=
etLong());
+ if (n.hasProperty(JCRConstants.JCR_LASTMODIFIED)) {
+ setModificationTime(n.getProperty(JCRConstants.JCR_LAS=
TMODIFIED).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 =3D n.getProperty(PROP_CREATED).getV=
alue().getLong();
+ if (n.hasProperty(JCRConstants.JCR_CREATED)) {
+ long creationTime =3D n.getProperty(JCRConstants.JCR_C=
REATED).getValue().getLong();
properties.add(new DefaultDavProperty(DavPropertyName.=
CREATIONDATE,
DavConstants.creationDateFormat.format(new Dat=
e(creationTime))));
}
Modified: incubator/jackrabbit/trunk/contrib/jcr-server/server/src/java/org=
/apache/jackrabbit/webdav/spi/DefaultItemResource.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-s=
erver/server/src/java/org/apache/jackrabbit/webdav/spi/DefaultItemResource.=
java?view=3Ddiff&r1=3D160913&r2=3D160914
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- incubator/jackrabbit/trunk/contrib/jcr-server/server/src/java/org/apach=
e/jackrabbit/webdav/spi/DefaultItemResource.java (original)
+++ incubator/jackrabbit/trunk/contrib/jcr-server/server/src/java/org/apach=
e/jackrabbit/webdav/spi/DefaultItemResource.java Mon Apr 11 09:04:58 2005
@@ -99,7 +99,8 @@
* @param property
* @throws DavException
* @see DavResource#setProperty(org.apache.jackrabbit.webdav.property.=
DavProperty)
- * @todo undo incomplete modifications...
+ *
+ * todo: undo incomplete modifications...
*/
public void setProperty(DavProperty property) throws DavException {
if (!exists()) {
Modified: incubator/jackrabbit/trunk/contrib/jcr-server/server/src/java/org=
/apache/jackrabbit/webdav/spi/ItemResourceConstants.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-s=
erver/server/src/java/org/apache/jackrabbit/webdav/spi/ItemResourceConstant=
s=2Ejava?view=3Ddiff&r1=3D160913&r2=3D160914
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- incubator/jackrabbit/trunk/contrib/jcr-server/server/src/java/org/apach=
e/jackrabbit/webdav/spi/ItemResourceConstants.java (original)
+++ incubator/jackrabbit/trunk/contrib/jcr-server/server/src/java/org/apach=
e/jackrabbit/webdav/spi/ItemResourceConstants.java Mon Apr 11 09:04:58 2005
@@ -50,16 +50,6 @@
public static final String VERSIONSTORAGE_PATH =3D "/jcr:system/jcr:ve=
rsionStorage";
=20
/**
- * Constant for the mix:versionable node type name.
- */
- public static final String MIX_VERSIONABLE =3D "mix:versionable";
-
- /**
- * Constant for the mix:lockable node type name.
- */
- public static final String MIX_LOCKABLE =3D "mix:lockable";
-
- /**
* The namespace for all jcr specific extensions.
*/
public static final Namespace NAMESPACE =3D Namespace.getNamespace("jc=
r", "http://www.day.com/jcr/webdav/1.0");
@@ -129,16 +119,4 @@
=20
// property names used for resource representing a workspace
public static final DavPropertyName JCR_NAMESPACES =3D DavPropertyName=
.create("namespaces", NAMESPACE);
-
- /**
- * Property name for the jcr:created property present on Version items.
- */
- public static final DavPropertyName CREATED =3D DavPropertyName.create=
("created", ItemResourceConstants.NAMESPACE);
-
- // JCR property names
- public static final String PROP_LASTMODIFIED =3D "jcr:lastModified";
- public static final String PROP_CREATED =3D "jcr:created";
- public static final String PROP_BASEVERSION =3D "jcr:baseVersion";
- public static final String PROP_PREDECESSORS =3D "jcr:predecessors";
- public static final String PROP_MERGEFAILED =3D "jcr:mergeFailed";
}
Modified: incubator/jackrabbit/trunk/contrib/jcr-server/server/src/java/org=
/apache/jackrabbit/webdav/spi/VersionControlledItemCollection.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-s=
erver/server/src/java/org/apache/jackrabbit/webdav/spi/VersionControlledIte=
mCollection.java?view=3Ddiff&r1=3D160913&r2=3D160914
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- incubator/jackrabbit/trunk/contrib/jcr-server/server/src/java/org/apach=
e/jackrabbit/webdav/spi/VersionControlledItemCollection.java (original)
+++ incubator/jackrabbit/trunk/contrib/jcr-server/server/src/java/org/apach=
e/jackrabbit/webdav/spi/VersionControlledItemCollection.java Mon Apr 11 09:=
04:58 2005
@@ -20,6 +20,7 @@
import org.apache.jackrabbit.webdav.*;
import org.apache.jackrabbit.webdav.version.*;
import org.apache.jackrabbit.webdav.version.report.*;
+import org.apache.jackrabbit.JCRConstants;
=20
import javax.jcr.*;
import javax.jcr.observation.*;
@@ -95,7 +96,7 @@
}
if (!isVersionControlled()) {
try {
- ((Node)item).addMixin(MIX_VERSIONABLE);
+ ((Node)item).addMixin(JCRConstants.MIX_VERSIONABLE);
item.save();
} catch (RepositoryException e) {
throw new JcrDavException(e);
@@ -308,10 +309,10 @@
Node n =3D (Node)item;
if (removePropertyNames.contains(AUTO_MERGE_SET)) {
// retrieve the current jcr:mergeFailed property values
- if (!((Node)item).hasProperty(PROP_MERGEFAILED)) {
+ if (!((Node)item).hasProperty(JCRConstants.JCR_MERGEFAILED=
)) {
throw new DavException(DavServletResponse.SC_CONFLICT,=
"Attempt to resolve non-existing merge conflicts.");
}
- Value[] mergeFailed =3D ((Node)item).getProperty(PROP_MERG=
EFAILED).getValues();
+ Value[] mergeFailed =3D ((Node)item).getProperty(JCRConsta=
nts.JCR_MERGEFAILED).getValues();
=20
// resolve all remaining merge conflicts with 'cancel'
for (int i =3D 0; i < mergeFailed.length; i++) {
@@ -322,10 +323,10 @@
=20
} else if (setProperties.contains(AUTO_MERGE_SET) && setProper=
ties.contains(PREDECESSOR_SET)){
// retrieve the current jcr:mergeFailed property values
- if (!((Node)item).hasProperty(PROP_MERGEFAILED)) {
+ if (!((Node)item).hasProperty(JCRConstants.JCR_MERGEFAILED=
)) {
throw new DavException(DavServletResponse.SC_CONFLICT,=
"Attempt to resolve non-existing merge conflicts.");
}
- Value[] mergeFailed =3D ((Node)item).getProperty(PROP_MERG=
EFAILED).getValues();
+ Value[] mergeFailed =3D ((Node)item).getProperty(JCRConsta=
nts.JCR_MERGEFAILED).getValues();
=20
=20
// check which mergeFailed entries have been removed from =
the
@@ -460,15 +461,15 @@
properties.add(new HrefProperty(CHECKED_OUT, baseV=
Href, true));
=20
// DAV:predecessors property
- if (n.hasProperty(PROP_PREDECESSORS)) {
- Value[] predec =3D n.getProperty(PROP_PREDECES=
SORS).getValues();
+ if (n.hasProperty(JCRConstants.JCR_PREDECESSORS)) {
+ Value[] predec =3D n.getProperty(JCRConstants.=
JCR_PREDECESSORS).getValues();
addHrefProperty(PREDECESSOR_SET, predec, false=
);
}
// DAV:auto-merge-set property. NOTE: the DAV:merg=
e-set
// never occurs, because merging without bestEffor=
t flag
// being set results in an exception on failure.
- if (n.hasProperty(PROP_MERGEFAILED)) {
- ReferenceValue[] mergeFailed =3D (ReferenceVal=
ue[]) n.getProperty(PROP_MERGEFAILED).getValues();
+ if (n.hasProperty(JCRConstants.JCR_MERGEFAILED)) {
+ ReferenceValue[] mergeFailed =3D (ReferenceVal=
ue[]) n.getProperty(JCRConstants.JCR_MERGEFAILED).getValues();
addHrefProperty(AUTO_MERGE_SET, mergeFailed, f=
alse);
}
// todo: checkout-fork, checkin-fork
Modified: incubator/jackrabbit/trunk/contrib/jcr-server/server/src/java/org=
/apache/jackrabbit/webdav/spi/version/VersionItemCollection.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-s=
erver/server/src/java/org/apache/jackrabbit/webdav/spi/version/VersionItemC=
ollection.java?view=3Ddiff&r1=3D160913&r2=3D160914
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- incubator/jackrabbit/trunk/contrib/jcr-server/server/src/java/org/apach=
e/jackrabbit/webdav/spi/version/VersionItemCollection.java (original)
+++ incubator/jackrabbit/trunk/contrib/jcr-server/server/src/java/org/apach=
e/jackrabbit/webdav/spi/version/VersionItemCollection.java Mon Apr 11 09:04=
:58 2005
@@ -23,6 +23,7 @@
import org.apache.jackrabbit.webdav.property.*;
import org.apache.jackrabbit.webdav.version.*;
import org.apache.jackrabbit.webdav.version.report.ReportType;
+import org.apache.jackrabbit.JCRConstants;
import org.jdom.Element;
=20
import javax.jcr.*;
@@ -156,8 +157,6 @@
// created and creationDate properties
try {
String creationDate =3D DavConstants.creationDateFormat.fo=
rmat(v.getCreated().getTime());
- // jcr specific 'created' property
- properties.add(new DefaultDavProperty(CREATED, creationDat=
e));
// replace dummy creation date from default collection
properties.add(new DefaultDavProperty(DavPropertyName.CREA=
TIONDATE, creationDate));
=20
@@ -185,7 +184,7 @@
List nodeList =3D new ArrayList();
while (it.hasNext()) {
Property p =3D it.nextProperty();
- if (PROP_BASEVERSION.equals(p.getName())) {
+ if (JCRConstants.JCR_BASEVERSION.equals(p.getName())) {
Node n =3D p.getParent();
if (n.isCheckedOut()) {
nodeList.add(n);
Added: incubator/jackrabbit/trunk/contrib/jcr-server/webapp/src/webapp/WEB-=
INF/catalog.xml
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-s=
erver/webapp/src/webapp/WEB-INF/catalog.xml?view=3Dauto&rev=3D160914
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- incubator/jackrabbit/trunk/contrib/jcr-server/webapp/src/webapp/WEB-INF=
/catalog.xml (added)
+++ incubator/jackrabbit/trunk/contrib/jcr-server/webapp/src/webapp/WEB-INF=
/catalog.xml Mon Apr 11 09:04:58 2005
@@ -0,0 +1,133 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
Propchange: incubator/jackrabbit/trunk/contrib/jcr-server/webapp/src/webapp=
/WEB-INF/catalog.xml
---------------------------------------------------------------------------=
---
svn:eol-style =3D native
Added: incubator/jackrabbit/trunk/contrib/jcr-server/webapp/src/webapp/WEB-=
INF/simple_catalog.xml
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-s=
erver/webapp/src/webapp/WEB-INF/simple_catalog.xml?view=3Dauto&rev=3D160914
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- incubator/jackrabbit/trunk/contrib/jcr-server/webapp/src/webapp/WEB-INF=
/simple_catalog.xml (added)
+++ incubator/jackrabbit/trunk/contrib/jcr-server/webapp/src/webapp/WEB-INF=
/simple_catalog.xml Mon Apr 11 09:04:58 2005
@@ -0,0 +1,51 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
Propchange: incubator/jackrabbit/trunk/contrib/jcr-server/webapp/src/webapp=
/WEB-INF/simple_catalog.xml
---------------------------------------------------------------------------=
---
svn:eol-style =3D native
Modified: incubator/jackrabbit/trunk/contrib/jcr-server/webapp/src/webapp/W=
EB-INF/web.xml
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-s=
erver/webapp/src/webapp/WEB-INF/web.xml?view=3Ddiff&r1=3D160913&r2=3D160914
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- incubator/jackrabbit/trunk/contrib/jcr-server/webapp/src/webapp/WEB-INF=
/web.xml (original)
+++ incubator/jackrabbit/trunk/contrib/jcr-server/webapp/src/webapp/WEB-INF=
/web.xml Mon Apr 11 09:04:58 2005
@@ -151,6 +151,13 @@
defines the prefix for spooling resources out of the repos=
itory.
+
+ chain-catalog
+ /WEB-INF/catalog.xml
+
+ the defines the commons-chain catalog for server tasks.
+
+
3
=20
Modified: incubator/jackrabbit/trunk/contrib/jcr-server/webdav/src/java/org=
/apache/jackrabbit/webdav/lock/LockInfo.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-s=
erver/webdav/src/java/org/apache/jackrabbit/webdav/lock/LockInfo.java?view=
=3Ddiff&r1=3D160913&r2=3D160914
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- incubator/jackrabbit/trunk/contrib/jcr-server/webdav/src/java/org/apach=
e/jackrabbit/webdav/lock/LockInfo.java (original)
+++ incubator/jackrabbit/trunk/contrib/jcr-server/webdav/src/java/org/apach=
e/jackrabbit/webdav/lock/LockInfo.java Mon Apr 11 09:04:58 2005
@@ -110,7 +110,8 @@
=20
/**
* Returns the lock type or null if no 'lockinfo' element=
was
- * passed to the constructor or did not contain an 'type' element.
+ * passed to the constructor or did not contain an 'type' element and =
the
+ * type has not been set otherwise.
*
* @return type or null
*/
@@ -119,13 +120,32 @@
}
=20
/**
+ * Set the lock type.
+ *
+ * @param type
+ */
+ public void setType(Type type) {
+ this.type =3D type;
+ }
+
+ /**
* Return the lock scope or null if no 'lockinfo' element=
was
- * passed to the constructor or did not contain an 'scope' element.
+ * passed to the constructor or did not contain an 'scope' element and=
the
+ * scope has not been set otherwise.
*
* @return scope or null
*/
public Scope getScope() {
return scope;
+ }
+
+ /**
+ * Set the lock scope.
+ *
+ * @param scope
+ */
+ public void setScope(Scope scope) {
+ this.scope =3D scope;
}
=20
/**
Modified: incubator/jackrabbit/trunk/contrib/jcr-server/webdav/src/java/org=
/apache/jackrabbit/webdav/util/Text.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-s=
erver/webdav/src/java/org/apache/jackrabbit/webdav/util/Text.java?view=3Ddi=
ff&r1=3D160913&r2=3D160914
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- incubator/jackrabbit/trunk/contrib/jcr-server/webdav/src/java/org/apach=
e/jackrabbit/webdav/util/Text.java (original)
+++ incubator/jackrabbit/trunk/contrib/jcr-server/webdav/src/java/org/apach=
e/jackrabbit/webdav/util/Text.java Mon Apr 11 09:04:58 2005
@@ -169,6 +169,28 @@
}
=20
/**
+ * Creates a valid jcr label from the given one
+ *
+ * @param label
+ * @return
+ */
+ public static String makeValidJCRPath(String label) {
+ StringBuffer ret =3D new StringBuffer(label.length());
+ for (int i=3D0; i