Hi Brad
I'll add it to the wiki later but here's a quick fix:
1. dirty hack:
Modify builtin-nodetypes.xml in org.apache.jackrabbit.core
(jackrabbit-core-1.4.jar)
Change the definition of nt:folder to
<nodeType name="nt:folder" isMixin="false" hasOrderableChildNodes="false"
primaryItemName="">
<supertypes>
<supertype>nt:hierarchyNode</supertype>
</supertypes>
<childNodeDefinition name="*" defaultPrimaryType=""
autoCreated="false" mandatory="false" onParentVersion="VERSION"
protected="false" sameNameSiblings="false">
<requiredPrimaryTypes>
<requiredPrimaryType>nt:hierarchyNode</requiredPrimaryType>
</requiredPrimaryTypes>
</childNodeDefinition>
<propertyDefinition name="*" requiredType="undefined"
autoCreated="false" mandatory="false" onParentVersion="COPY"
protected="false" multiple="true"/>
<propertyDefinition name="*" requiredType="undefined"
autoCreated="false" mandatory="false" onParentVersion="COPY"
protected="false" multiple="false"/>
</nodeType>
This is quick and dirty hack.
2. change config.xml in your WEB-INF
In the propertymanager Replace DirListingExportHandler with
WebDAVCollectionPropertyExportHandler
The code for WebDAVCollectionPropertyExportHandler is here:
/*
* 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.server.io;
import java.util.Map;
import javax.jcr.Node;
import javax.jcr.Property;
import javax.jcr.PropertyIterator;
import javax.jcr.RepositoryException;
import javax.jcr.Session;
import org.apache.jackrabbit.util.ISO9075;
import org.apache.jackrabbit.util.Text;
import org.apache.jackrabbit.webdav.property.DavPropertyName;
import org.apache.jackrabbit.webdav.xml.Namespace;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
*
* WebDAVCollectionPropertyExportHandler
*
* export all properties on a collection (mapped to nt:folder)
*
* some of the code was copied verbatim from DirListingExportHandler and
DefaultHandler
* and parts of that copied code may not actually do anything useful but i
think its better to
* err on the side of caution
* you can find the bits i am not sure of by looking for the tag "CCC"
(cargo cult coding)
* feel free to modify or kill them if you understand what you are doing
*
* author: Roland Porath
* history: 08/02/08 created
*
*/
public class WebDAVCollectionPropertyExportHandler implements
PropertyHandler {
private static Logger log =
LoggerFactory.getLogger(WebDAVCollectionPropertyExportHandler.class);
/**
* @see PropertyHandler#exportProperties(PropertyExportContext, boolean)
*/
public boolean exportProperties(PropertyExportContext exportContext,
boolean isCollection) throws RepositoryException
{
if(!canExport(exportContext, isCollection))
{
return false;
}
Node cn = (Node)exportContext.getExportRoot();
if (log.isDebugEnabled()) log.debug("exporting properties for " +
cn.getName());
//add every property you find to the export context
//WebDAV has no limitations here
PropertyIterator it = cn.getProperties();
while (it.hasNext())
{
Property p = it.nextProperty();
DavPropertyName davName = getDavName(p.getName(),
p.getSession());
String valueString = p.getValue().getString();
exportContext.setProperty(davName, valueString);
if (log.isDebugEnabled()) log.debug("exporting property name=" +
", davName=" + davName + ", value=" + valueString);
}
return true;
}
/**
* @see PropertyHandler#canExport(PropertyExportContext context, boolean
isCollection)
*/
public boolean canExport(PropertyExportContext context, boolean
isCollection)
{
//CCC
if (context == null || context.isCompleted())
{
return false;
}
//END CCC
return isCollection && context.getExportRoot() != null;
}
private DavPropertyName getDavName(String jcrName, Session session)
throws RepositoryException
{
// make sure the local name is xml compliant
String localName = ISO9075.encode(Text.getLocalName(jcrName));
String prefix = Text.getNamespacePrefix(jcrName);
String uri = session.getNamespaceURI(prefix);
Namespace namespace = Namespace.getNamespace(prefix, uri);
DavPropertyName name = DavPropertyName.create(localName, namespace);
return name;
}
/**
* @see PropertyHandler#canImport(PropertyExportContext context, boolean
isCollection)
*/
public boolean canImport(PropertyImportContext context, boolean
isCollection)
{
return false;
}
/**
* @see PropertyHandler#importProperties(PropertyImportContext
importContext, boolean isCollection)
*/
public Map importProperties(PropertyImportContext importContext,
boolean isCollection) throws RepositoryException
{
String msg = "importProperties should not be called; this is
only an export handler";
log.error(msg);
throw new RepositoryException(msg);
}
}