KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > alfresco > filesys > server > auth > acl > DomainAccessControlParser


1 /*
2  * Copyright (C) 2005 Alfresco, Inc.
3  *
4  * Licensed under the Mozilla Public License version 1.1
5  * with a permitted attribution clause. You may obtain a
6  * copy of the License at
7  *
8  * http://www.alfresco.org/legal/license.txt
9  *
10  * Unless required by applicable law or agreed to in writing,
11  * software distributed under the License is distributed on an
12  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
13  * either express or implied. See the License for the specific
14  * language governing permissions and limitations under the
15  * License.
16  */

17 package org.alfresco.filesys.server.auth.acl;
18
19 import org.alfresco.config.ConfigElement;
20
21 /**
22  * Domain Name Access Control Parser Class
23  */

24 public class DomainAccessControlParser extends AccessControlParser
25 {
26
27     /**
28      * Default constructor
29      */

30     public DomainAccessControlParser()
31     {
32     }
33
34     /**
35      * Return the parser type
36      *
37      * @return String
38      */

39     public String JavaDoc getType()
40     {
41         return "domain";
42     }
43
44     /**
45      * Validate the parameters and create a user access control
46      *
47      * @param params ConfigElement
48      * @return AccessControl
49      * @throws ACLParseException
50      */

51     public AccessControl createAccessControl(ConfigElement params) throws ACLParseException
52     {
53
54         // Get the access type
55

56         int access = parseAccessType(params);
57
58         // Get the domain name to check for
59

60         String JavaDoc domainName = params.getAttribute("name");
61         if (domainName == null || domainName.length() == 0)
62             throw new ACLParseException("Domain name not specified");
63
64         // Create the domain access control
65

66         return new DomainAccessControl(domainName, getType(), access);
67     }
68 }
69
Popular Tags