luetzkendorf 2005/02/02 09:19:35
Added:
src/webdav/server/org/apache/slide/webdav/util/properties/exchange
ChildcountProperty.java Constants.java
HasChildrenProperty.java HassubsProperty.java
HrefProperty.java IsCollectionProperty.java
IsFolderProperty.java IsRootProperty.java
package.html resource_kinds.xml
Log:
first version of properties supported by ms exchange and requested by
webfolders
Revision Changes Path
1.1
jakarta-slide/src/webdav/server/org/apache/slide/webdav/util/properties/exchange/ChildcountProperty.java
Index: ChildcountProperty.java
===================================================================
package org.apache.slide.webdav.util.properties.exchange;
import java.util.Enumeration;
import org.apache.slide.common.NamespaceAccessToken;
import org.apache.slide.common.PropertyName;
import org.apache.slide.common.SlideException;
import org.apache.slide.common.SlideToken;
import org.apache.slide.content.NodeRevisionDescriptor;
import org.apache.slide.content.NodeRevisionDescriptors;
import org.apache.slide.structure.ObjectNode;
import org.apache.slide.structure.Structure;
import org.apache.slide.webdav.util.WebdavContext;
import org.apache.slide.webdav.util.properties.AbstractComputedProperty;
import org.apache.slide.webdav.util.resourcekind.ResourceKind;
/**
* MS Exchange extension property <code>DAV:childcount</code>.
*
* <p>"A folder's total number of items, including subfolders."
*/
public class ChildcountProperty extends AbstractComputedProperty {
/* (non-Javadoc)
* @see
org.apache.slide.webdav.util.properties.PropertyComputer#getPropertyName()
*/
public PropertyName getPropertyName() {
return Constants.PN_CHILDCOUNT;
}
/* (non-Javadoc)
* @see
org.apache.slide.webdav.util.properties.PropertyComputer#computeValue(org.apache.slide.common.NamespaceAccessToken,
org.apache.slide.content.NodeRevisionDescriptors,
org.apache.slide.content.NodeRevisionDescriptor,
org.apache.slide.webdav.util.resourcekind.ResourceKind,
org.apache.slide.webdav.util.WebdavContext)
*/
public Object computeValue(NamespaceAccessToken nsaToken,
NodeRevisionDescriptors revisionDescriptors,
NodeRevisionDescriptor revisionDescriptor,
ResourceKind resourceKind, WebdavContext context)
throws SlideException {
Structure structure = nsaToken.getStructureHelper();
SlideToken slideToken = context.getSlideToken();
ObjectNode node = structure.retrieve(slideToken,
revisionDescriptors.getUri());
int count = 0;
for(Enumeration e = structure.getChildren(slideToken,
node);e.hasMoreElements(); e.nextElement()) {
count++;
}
return new Integer(count);
}
}
1.1
jakarta-slide/src/webdav/server/org/apache/slide/webdav/util/properties/exchange/Constants.java
Index: Constants.java
===================================================================
package org.apache.slide.webdav.util.properties.exchange;
import org.apache.slide.common.PropertyName;
/**
* @author stefan
*/
public class Constants {
private Constants() { }
static final Object TRUE_VALUE = "true";
static final Object FALSE_VALUE = "false";
public static final PropertyName PN_IS_COLLECTION =
PropertyName.getPropertyName("iscollection");
public static final PropertyName PN_IS_ROOT =
PropertyName.getPropertyName("isroot");
public static final PropertyName PN_HAS_CHILDREN =
PropertyName.getPropertyName("haschildren");
public static final PropertyName PN_CHILDCOUNT =
PropertyName.getPropertyName("childcount");
public static final PropertyName PN_HASSUBS =
PropertyName.getPropertyName("hassubs");
}
1.1
jakarta-slide/src/webdav/server/org/apache/slide/webdav/util/properties/exchange/HasChildrenProperty.java
Index: HasChildrenProperty.java
===================================================================
package org.apache.slide.webdav.util.properties.exchange;
import java.util.Enumeration;
import org.apache.slide.common.NamespaceAccessToken;
import org.apache.slide.common.PropertyName;
import org.apache.slide.common.SlideException;
import org.apache.slide.common.SlideToken;
import org.apache.slide.content.NodeRevisionDescriptor;
import org.apache.slide.content.NodeRevisionDescriptors;
import org.apache.slide.structure.ObjectNode;
import org.apache.slide.structure.Structure;
import org.apache.slide.webdav.util.WebdavContext;
import org.apache.slide.webdav.util.properties.AbstractComputedProperty;
import org.apache.slide.webdav.util.resourcekind.ResourceKind;
/**
* MS Exchange extension property <code>DAV:haschildren</code>.
*
* <p>"Indicates whether the folder or structured document item has child
objects."
*/
public class HasChildrenProperty extends AbstractComputedProperty {
/* (non-Javadoc)
* @see
org.apache.slide.webdav.util.properties.PropertyComputer#getPropertyName()
*/
public PropertyName getPropertyName() {
return Constants.PN_HAS_CHILDREN;
}
/* (non-Javadoc)
* @see
org.apache.slide.webdav.util.properties.PropertyComputer#computeValue(org.apache.slide.common.NamespaceAccessToken,
org.apache.slide.content.NodeRevisionDescriptors,
org.apache.slide.content.NodeRevisionDescriptor,
org.apache.slide.webdav.util.resourcekind.ResourceKind,
org.apache.slide.webdav.util.WebdavContext)
*/
public Object computeValue(NamespaceAccessToken nsaToken,
NodeRevisionDescriptors revisionDescriptors,
NodeRevisionDescriptor revisionDescriptor,
ResourceKind resourceKind, WebdavContext context)
throws SlideException {
Structure structure = nsaToken.getStructureHelper();
SlideToken slideToken = context.getSlideToken();
ObjectNode node = structure.retrieve(slideToken,
revisionDescriptors.getUri());
Enumeration e = structure.getChildren(slideToken, node);
if (e.hasMoreElements()) {
return Constants.TRUE_VALUE;
} else {
return Constants.FALSE_VALUE;
}
}
}
1.1
jakarta-slide/src/webdav/server/org/apache/slide/webdav/util/properties/exchange/HassubsProperty.java
Index: HassubsProperty.java
===================================================================
package org.apache.slide.webdav.util.properties.exchange;
import java.util.Enumeration;
import org.apache.slide.common.NamespaceAccessToken;
import org.apache.slide.common.PropertyName;
import org.apache.slide.common.SlideException;
import org.apache.slide.common.SlideToken;
import org.apache.slide.content.Content;
import org.apache.slide.content.NodeRevisionDescriptor;
import org.apache.slide.content.NodeRevisionDescriptors;
import org.apache.slide.structure.ObjectNode;
import org.apache.slide.structure.Structure;
import org.apache.slide.webdav.util.WebdavConstants;
import org.apache.slide.webdav.util.WebdavContext;
import org.apache.slide.webdav.util.properties.AbstractComputedProperty;
import org.apache.slide.webdav.util.resourcekind.ResourceKind;
/**
* MS Exchange extension property <code>DAV:haschildren</code>.
*
* <p>"Indicates whether the folder item has subfolders."
*/
public class HassubsProperty extends AbstractComputedProperty {
public PropertyName getPropertyName() {
return Constants.PN_HASSUBS;
}
/* (non-Javadoc)
* @see
org.apache.slide.webdav.util.properties.PropertyComputer#computeValue(org.apache.slide.common.NamespaceAccessToken,
org.apache.slide.content.NodeRevisionDescriptors,
org.apache.slide.content.NodeRevisionDescriptor,
org.apache.slide.webdav.util.resourcekind.ResourceKind,
org.apache.slide.webdav.util.WebdavContext)
*/
public Object computeValue(NamespaceAccessToken nsaToken,
NodeRevisionDescriptors revisionDescriptors,
NodeRevisionDescriptor revisionDescriptor,
ResourceKind resourceKind, WebdavContext context)
throws SlideException {
Structure structure = nsaToken.getStructureHelper();
Content content = nsaToken.getContentHelper();
SlideToken slideToken = context.getSlideToken();
ObjectNode node = structure.retrieve(slideToken,
revisionDescriptors.getUri());
for(Enumeration e = structure.getChildren(slideToken,
node);e.hasMoreElements(); ) {
ObjectNode child = (ObjectNode)e.nextElement();
NodeRevisionDescriptors childDescriptors =
content.retrieve(slideToken, child.getUri());
NodeRevisionDescriptor childDescriptor =
content.retrieve(slideToken, childDescriptors);
if (childDescriptor.propertyValueContains(
WebdavConstants.PN_RESOURCETYPE,
WebdavConstants.E_COLLECTION))
{
return Constants.TRUE_VALUE;
}
}
return Constants.FALSE_VALUE;
}
}
1.1
jakarta-slide/src/webdav/server/org/apache/slide/webdav/util/properties/exchange/HrefProperty.java
Index: HrefProperty.java
===================================================================
package org.apache.slide.webdav.util.properties.exchange;
import org.apache.slide.common.NamespaceAccessToken;
import org.apache.slide.common.PropertyName;
import org.apache.slide.common.SlideException;
import org.apache.slide.content.NodeRevisionDescriptor;
import org.apache.slide.content.NodeRevisionDescriptors;
import org.apache.slide.webdav.util.WebdavContext;
import org.apache.slide.webdav.util.WebdavUtils;
import org.apache.slide.webdav.util.properties.AbstractComputedProperty;
import org.apache.slide.webdav.util.resourcekind.ResourceKind;
/**
* MS Exchange extension property <code>DAV:href</code>.
*
* <p>The absolute URL of an item.
*/
public class HrefProperty extends AbstractComputedProperty {
/* (non-Javadoc)
* @see
org.apache.slide.webdav.util.properties.PropertyComputer#getPropertyName()
*/
public PropertyName getPropertyName() {
// TODO Auto-generated method stub
return null;
}
/* (non-Javadoc)
* @see
org.apache.slide.webdav.util.properties.PropertyComputer#computeValue(org.apache.slide.common.NamespaceAccessToken,
org.apache.slide.content.NodeRevisionDescriptors,
org.apache.slide.content.NodeRevisionDescriptor,
org.apache.slide.webdav.util.resourcekind.ResourceKind,
org.apache.slide.webdav.util.WebdavContext)
*/
public Object computeValue(NamespaceAccessToken nsaToken,
NodeRevisionDescriptors revisionDescriptors,
NodeRevisionDescriptor revisionDescriptor,
ResourceKind resourceKind, WebdavContext context)
throws SlideException {
// TODO we need to get more context infos
return WebdavUtils.getAbsolutePath(revisionDescriptors.getUri(),
context);
}
}
1.1
jakarta-slide/src/webdav/server/org/apache/slide/webdav/util/properties/exchange/IsCollectionProperty.java
Index: IsCollectionProperty.java
===================================================================
package org.apache.slide.webdav.util.properties.exchange;
import org.apache.slide.common.NamespaceAccessToken;
import org.apache.slide.common.PropertyName;
import org.apache.slide.common.SlideException;
import org.apache.slide.content.NodeRevisionDescriptor;
import org.apache.slide.content.NodeRevisionDescriptors;
import org.apache.slide.webdav.util.WebdavConstants;
import org.apache.slide.webdav.util.WebdavContext;
import org.apache.slide.webdav.util.properties.AbstractComputedProperty;
import org.apache.slide.webdav.util.resourcekind.ResourceKind;
/**
* MS Exchange extension property <code>DAV:iscollection</code>.
*
* <p>"Both structured documents and folders are collection items."
*/
public class IsCollectionProperty extends AbstractComputedProperty {
public PropertyName getPropertyName() {
return Constants.PN_IS_COLLECTION;
}
public Object computeValue(NamespaceAccessToken nsaToken,
NodeRevisionDescriptors revisionDescriptors,
NodeRevisionDescriptor revisionDescriptor,
ResourceKind resourceKind, WebdavContext context)
throws SlideException
{
boolean result = revisionDescriptor.propertyValueContains(
WebdavConstants.PN_RESOURCETYPE,
WebdavConstants.E_COLLECTION);
return result ? Constants.TRUE_VALUE : Constants.FALSE_VALUE;
}
}
1.1
jakarta-slide/src/webdav/server/org/apache/slide/webdav/util/properties/exchange/IsFolderProperty.java
Index: IsFolderProperty.java
===================================================================
package org.apache.slide.webdav.util.properties.exchange;
import org.apache.slide.common.NamespaceAccessToken;
import org.apache.slide.common.PropertyName;
import org.apache.slide.common.SlideException;
import org.apache.slide.content.NodeRevisionDescriptor;
import org.apache.slide.content.NodeRevisionDescriptors;
import org.apache.slide.webdav.util.WebdavConstants;
import org.apache.slide.webdav.util.WebdavContext;
import org.apache.slide.webdav.util.properties.AbstractComputedProperty;
import org.apache.slide.webdav.util.resourcekind.ResourceKind;
/**
* MS Exchange extension property <code>DAV:isfolder</code>.
*
* <p>"The isfolder field specifies whether an item is a folder."
*/
public class IsFolderProperty extends AbstractComputedProperty {
public PropertyName getPropertyName() {
return Constants.PN_IS_COLLECTION;
}
public Object computeValue(NamespaceAccessToken nsaToken,
NodeRevisionDescriptors revisionDescriptors,
NodeRevisionDescriptor revisionDescriptor,
ResourceKind resourceKind, WebdavContext context)
throws SlideException
{
boolean result = revisionDescriptor.propertyValueContains(
WebdavConstants.PN_RESOURCETYPE,
WebdavConstants.E_COLLECTION);
return result ? Constants.TRUE_VALUE : Constants.FALSE_VALUE;
}
}
1.1
jakarta-slide/src/webdav/server/org/apache/slide/webdav/util/properties/exchange/IsRootProperty.java
Index: IsRootProperty.java
===================================================================
package org.apache.slide.webdav.util.properties.exchange;
import org.apache.slide.common.NamespaceAccessToken;
import org.apache.slide.common.PropertyName;
import org.apache.slide.common.SlideException;
import org.apache.slide.content.NodeRevisionDescriptor;
import org.apache.slide.content.NodeRevisionDescriptors;
import org.apache.slide.webdav.util.WebdavContext;
import org.apache.slide.webdav.util.properties.AbstractComputedProperty;
import org.apache.slide.webdav.util.resourcekind.ResourceKind;
/**
* MS Exchange extension property <code>DAV:isroot</code>.
*
* <p>"The isroot field specifies whether an item is a root folder."
*/
public class IsRootProperty extends AbstractComputedProperty {
/* (non-Javadoc)
* @see
org.apache.slide.webdav.util.properties.PropertyComputer#getPropertyName()
*/
public PropertyName getPropertyName() {
return Constants.PN_IS_ROOT;
}
/* (non-Javadoc)
* @see
org.apache.slide.webdav.util.properties.PropertyComputer#computeValue(org.apache.slide.common.NamespaceAccessToken,
org.apache.slide.content.NodeRevisionDescriptors,
org.apache.slide.content.NodeRevisionDescriptor,
org.apache.slide.webdav.util.resourcekind.ResourceKind,
org.apache.slide.webdav.util.WebdavContext)
*/
public Object computeValue(NamespaceAccessToken nsaToken,
NodeRevisionDescriptors revisionDescriptors,
NodeRevisionDescriptor revisionDescriptor,
ResourceKind resourceKind, WebdavContext context)
throws SlideException {
return revisionDescriptors.getUri().equals("/") ?
Constants.TRUE_VALUE : Constants.FALSE_VALUE;
}
}
1.1
jakarta-slide/src/webdav/server/org/apache/slide/webdav/util/properties/exchange/package.html
Index: package.html
===================================================================
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<html>
<head>
<!--
$Header:
/home/cvs/jakarta-slide/src/webdav/server/org/apache/slide/webdav/util/properties/exchange/package.html,v
1.1 2005/02/02 17:19:35 luetzkendorf Exp $
$Revision: 1.1 $
$Date: 2005/02/02 17:19:35 $
====================================================================
Copyright 1999-2002 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.
-->
</head>
<body>
<p>Package containing property implementations that are supported by
WebDAV
components of Microsofts Exchange Server 2003 and requested by WebFolder
client.</p>
<p>To use this add something like the following to the events section of
your Domain.xml:
<pre>
<event classname="org.apache.slide.event.DomainEvent" enable="true"/>
<listener
classname="org.apache.slide.webdav.util.resourcekind.ResourceKindConfigurator">
<configuration>
<definition
resource="/org/apache/slide/webdav/util/properties/exchange/resource_kinds.xml"/>
</configuration>
</listener>
</pre>
</body>
</html>
1.1
jakarta-slide/src/webdav/server/org/apache/slide/webdav/util/properties/exchange/resource_kinds.xml
Index: resource_kinds.xml
===================================================================
<?xml version="1.0" encoding="iso-8859-1"?>
<!--
$Header:
/home/cvs/jakarta-slide/src/webdav/server/org/apache/slide/webdav/util/properties/exchange/resource_kinds.xml,v
1.1 2005/02/02 17:19:35 luetzkendorf Exp $
$Revision: 1.1 $
$Date: 2005/02/02 17:19:35 $
====================================================================
Copyright 1999-2002 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.
-->
<resource-kinds>
<resource-kind name="DeltavCompliant">
<live-properties>
<live-property name="iscollection" protected="true"
computer="org.apache.slide.webdav.util.properties.exchange.IsCollectionProperty">
</live-property>
<live-property name="isfolder" protected="true"
computer="org.apache.slide.webdav.util.properties.exchange.IsFolderProperty">
</live-property>
<live-property name="isroot" protected="true"
computer="org.apache.slide.webdav.util.properties.exchange.IsRootProperty">
</live-property>
<live-property name="haschildren" protected="true"
computer="org.apache.slide.webdav.util.properties.exchange.HasChildrenProperty">
</live-property>
<live-property name="childcount" protected="true"
computer="org.apache.slide.webdav.util.properties.exchange.ChildcountProperty">
</live-property>
<live-property name="hassubs" protected="true"
computer="org.apache.slide.webdav.util.properties.exchange.HassubsProperty">
</live-property>
<live-property name="isstructureddocument" protected="true"
computer="org.apache.slide.webdav.util.properties.ConstantProperty">
<computer-configuration>
<constant-value>false</constant-value>
</computer-configuration>
</live-property>
<live-property name="ishidden" protected="false"
computer="org.apache.slide.webdav.util.properties.DefaultedProperty">
<computer-configuration>
<default-value>false</default-value>
</computer-configuration>
</live-property>
<live-property name="isreadonly" protected="false"
computer="org.apache.slide.webdav.util.properties.DefaultedProperty">
<computer-configuration>
<default-value>false</default-value>
</computer-configuration>
</live-property>
</live-properties>
</resource-kind>
</resource-kinds>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]