KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > slide > webdav > util > properties > PrincipalCollectionSetProperty


1 /*
2  * Copyright 2002-2006 Jahia Ltd
3  *
4  * Licensed under the JAHIA COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (JCDDL),
5  * Version 1.0 (the "License"), or (at your option) any later version; you may
6  * not use this file except in compliance with the License. You should have
7  * received a copy of the License along with this program; if not, you may obtain
8  * a copy of the License at
9  *
10  * http://www.jahia.org/license/
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  */
/*
18  * $Header$
19  * $Revision: 384245 $
20  * $Date: 2006-03-08 16:50:01 +0100 (mer., 08 mars 2006) $
21  *
22  * ====================================================================
23  *
24  * Copyright 1999-2002 The Apache Software Foundation
25  *
26  * Licensed under the Apache License, Version 2.0 (the "License");
27  * you may not use this file except in compliance with the License.
28  * You may obtain a copy of the License at
29  *
30  * http://www.apache.org/licenses/LICENSE-2.0
31  *
32  * Unless required by applicable law or agreed to in writing, software
33  * distributed under the License is distributed on an "AS IS" BASIS,
34  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
35  * See the License for the specific language governing permissions and
36  * limitations under the License.
37  *
38  */

39 package org.apache.slide.webdav.util.properties;
40
41 import org.apache.slide.common.NamespaceAccessToken;
42 import org.apache.slide.common.NamespaceConfig;
43 import org.apache.slide.common.PropertyName;
44 import org.apache.slide.common.SlideException;
45 import org.apache.slide.content.NodeRevisionDescriptor;
46 import org.apache.slide.content.NodeRevisionDescriptors;
47 import org.apache.slide.util.XMLValue;
48 import org.apache.slide.webdav.util.AclConstants;
49 import org.apache.slide.webdav.util.WebdavContext;
50 import org.apache.slide.webdav.util.WebdavUtils;
51 import org.apache.slide.webdav.util.resourcekind.ResourceKind;
52
53
54 /**
55  * Computes the ACL <code>principal-collection-set</code> property.
56  */

57 public class PrincipalCollectionSetProperty extends
58         AbstractComputedProperty
59 {
60     public PropertyName getPropertyName() {
61         return AclConstants.PN_PRINCIPAL_COLLECTION_SET;
62     }
63
64     public Object JavaDoc computeValue(NamespaceAccessToken nsaToken,
65             NodeRevisionDescriptors revisionDescriptors,
66             NodeRevisionDescriptor revisionDescriptor, ResourceKind resourceKind, WebdavContext context)
67             throws SlideException
68     {
69         XMLValue xmlValue = new XMLValue();
70         NamespaceConfig namespaceConfig = nsaToken.getNamespaceConfig();
71
72         xmlValue.addHref(WebdavUtils.getAbsolutePath(
73                 namespaceConfig.getUsersPath(), context));
74
75         if (namespaceConfig.getGroupsPath() != null && namespaceConfig.getGroupsPath().length() != 0) {
76
77             xmlValue.addHref(WebdavUtils.getAbsolutePath(
78                     namespaceConfig.getGroupsPath(), context));
79         }
80         if (namespaceConfig.getRolesPath() != null && namespaceConfig.getRolesPath().length() != 0) {
81             xmlValue.addHref(WebdavUtils.getAbsolutePath(
82                     namespaceConfig.getRolesPath(), context));
83         }
84         return xmlValue;
85     }
86 }
87
Popular Tags