KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > outerj > daisy > repository > acl > AclActionType


1 /*
2  * Copyright 2004 Outerthought bvba and Schaubroeck nv
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16 package org.outerj.daisy.repository.acl;
17
18 /**
19  * Enumeration of the different actions an {@link AclEntry} can specify for a certain
20  * {@link AclPermission}.
21  *
22  */

23 public final class AclActionType {
24     private final String JavaDoc name;
25
26     public AclActionType(String JavaDoc name) {
27         this.name = name;
28     }
29
30     public String JavaDoc toString() {
31         return name;
32     }
33
34     public static AclActionType fromString(String JavaDoc value) {
35         if (value.equals("grant"))
36             return GRANT;
37         else if (value.equals("deny"))
38             return DENY;
39         else if (value.equals("nothing"))
40             return DO_NOTHING;
41         else
42             throw new RuntimeException JavaDoc("Unrecognized action type: " + value);
43     }
44
45     public static final AclActionType GRANT = new AclActionType("grant");
46     public static final AclActionType DENY = new AclActionType("deny");
47     public static final AclActionType DO_NOTHING = new AclActionType("nothing");
48 }
49
Popular Tags