KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > slide > structure > SubjectNode


1 /*
2  * $Header: /home/cvs/jakarta-slide/src/share/org/apache/slide/structure/SubjectNode.java,v 1.10 2004/08/05 15:44:58 unico Exp $
3  * $Revision: 1.10 $
4  * $Date: 2004/08/05 15:44:58 $
5  *
6  * ====================================================================
7  *
8  * Copyright 1999-2002 The Apache Software Foundation
9  *
10  * Licensed under the Apache License, Version 2.0 (the "License");
11  * you may not use this file except in compliance with the License.
12  * You may obtain a copy of the License at
13  *
14  * http://www.apache.org/licenses/LICENSE-2.0
15  *
16  * Unless required by applicable law or agreed to in writing, software
17  * distributed under the License is distributed on an "AS IS" BASIS,
18  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19  * See the License for the specific language governing permissions and
20  * limitations under the License.
21  *
22  */

23
24 package org.apache.slide.structure;
25
26 import java.util.Vector JavaDoc;
27
28 /**
29  * Subject node class.
30  *
31  * @version $Revision: 1.10 $
32  */

33 public class SubjectNode extends ObjectNode {
34     
35     /** generic subjects */
36     public static final String JavaDoc ALL_URI = "all";
37     public static final String JavaDoc OWNER_URI = "owner";
38     public static final String JavaDoc SELF_URI = "self";
39     public static final String JavaDoc UNAUTHENTICATED_URI = "unauthenticated";
40     public static final String JavaDoc AUTHENTICATED_URI = "authenticated";
41     
42     public static final SubjectNode ALL = new SubjectNode(ALL_URI);
43     public static final SubjectNode OWNER = new SubjectNode(OWNER_URI);
44     public static final SubjectNode SELF = new SubjectNode(SELF_URI);
45     public static final SubjectNode UNAUTHENTICATED = new SubjectNode(UNAUTHENTICATED_URI);
46     public static final SubjectNode AUTHENTICATED = new SubjectNode(AUTHENTICATED_URI);
47     
48     
49     // ----------------------------------------------------------- Constructors
50

51     
52     /**
53      * Constructor.
54      */

55     public SubjectNode() {
56         super();
57     }
58     
59     
60     /**
61      * Default constructor.
62      */

63     public SubjectNode(String JavaDoc uri) {
64         super(uri);
65     }
66     
67     
68     /**
69      * Default constructor.
70      */

71     public SubjectNode(String JavaDoc uri, Vector JavaDoc children, Vector JavaDoc links) {
72         super(uri, children, links);
73     }
74     
75     
76     /**
77      * Contructor to be used by stores supporting binding.
78      */

79     public SubjectNode(String JavaDoc uuri, Vector JavaDoc bindings, Vector JavaDoc parentset, Vector JavaDoc links) {
80         super(uuri, bindings, parentset, links);
81     }
82     
83     public static SubjectNode getSubjectNode(String JavaDoc subjectUri) {
84         if (SubjectNode.ALL_URI.equals(subjectUri)) {
85             return SubjectNode.ALL;
86         }
87         else if (SubjectNode.AUTHENTICATED_URI.equals(subjectUri)) {
88             return SubjectNode.AUTHENTICATED;
89         }
90         else if (SubjectNode.OWNER_URI.equals(subjectUri)) {
91             return SubjectNode.OWNER;
92         }
93         else if (SubjectNode.SELF_URI.equals(subjectUri)) {
94             return SubjectNode.SELF;
95         }
96         else if (SubjectNode.UNAUTHENTICATED_URI.equals(subjectUri)) {
97             return SubjectNode.UNAUTHENTICATED;
98         }
99         return new SubjectNode(subjectUri);
100     }
101 }
102
Popular Tags