KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > javax > jcr > nodetype > NodeType


1 /*
2  * $Id: NodeType.java,v 1.3 2004/08/01 22:14:03 benjmestrallet Exp $
3  *
4  * Copyright 2002-2004 Day Management AG, Switzerland.
5  *
6  * Licensed under the Day RI License, Version 2.0 (the "License"),
7  * as a reference implementation of the following specification:
8  *
9  * Content Repository API for Java Technology, revision 0.12
10  * <http://www.jcp.org/en/jsr/detail?id=170>
11  *
12  * You may not use this file except in compliance with the License.
13  * You may obtain a copy of the License files at
14  *
15  * http://www.day.com/content/en/licenses/day-ri-license-2.0
16  * http://www.apache.org/licenses/LICENSE-2.0
17  *
18  * Unless required by applicable law or agreed to in writing, software
19  * distributed under the License is distributed on an "AS IS" BASIS,
20  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21  * See the License for the specific language governing permissions and
22  * limitations under the License.
23  */

24 package javax.jcr.nodetype;
25
26 import javax.jcr.Value;
27 import javax.jcr.RepositoryException;
28 import javax.jcr.ValueFormatException;
29
30 /**
31  * Represents a node type.
32  *
33  * @author Peeter Piegaze
34  * @author Stefan Guggisberg
35  */

36 public interface NodeType {
37
38   /**
39    * Returns the name of the node type.
40    *
41    * @return the name of the node type
42    */

43   public String JavaDoc getName();
44
45   /**
46    * Returns <code>true</code> if this node type is a mixin node type.
47    * Returns <code>false</code> if this node type is a primary node type.
48    *
49    * @return a boolean
50    */

51   public boolean isMixin();
52
53   /**
54    * Returns all supertypes of this node type including both those directly
55    * declared and those inherited. For primary types, this list will always
56    * include at least <code>nt:base</code>. For mixin types, there is no
57    * required base type.
58    *
59    * @return an array of <code>NodeType</code> objects.
60    * @see #getDeclaredSupertypes
61    */

62   public NodeType[] getSupertypes();
63
64   /**
65    * Returns all <i>direct</i> supertypes as specified in the declaration of
66    * <i>this</i> node type. In single inheritance systems this will always be
67    * an array of size 0 or 1. In systems that support multiple inheritance of
68    * node types this array may be of size greater than 1.
69    *
70    * @return an array of <code>NodeType</code> objects.
71    * @see #getSupertypes
72    */

73   public NodeType[] getDeclaredSupertypes();
74
75   /**
76    * Returns an array containing the property definitions of this node type,
77    * including the property definitions inherited from supertypes of this node
78    * type.
79    *
80    * @return an array containing the property definitions.
81    * @see #getDeclaredPropertyDefs
82    */

83   public PropertyDef[] getPropertyDefs();
84
85   /**
86    * Returns an array containing the property definitions explicitly specified
87    * in the declaration of <i>this</i> node type. This does <i>not</i> include
88    * property definitions inherited from supertypes of this node type.
89    *
90    * @return an array containing the property definitions.
91    * @see #getPropertyDefs
92    */

93   public PropertyDef[] getDeclaredPropertyDefs();
94
95   /**
96    * Returns an array containing the child node definitions of this node type,
97    * including the child node definitions inherited from supertypes of this
98    * node type.
99    *
100    * @return an array containing the child node definitions.
101    * @see #getDeclaredChildNodeDefs
102    */

103   public NodeDef[] getChildNodeDefs();
104
105   /**
106    * Returns an array containing the child node definitions explicitly
107    * specified in the declaration of <i>this</i> node type. This does
108    * <i>not</i> include child node definitions inherited from supertypes of
109    * this node type.
110    *
111    * @return an array containing the child node definitions.
112    * @see #getChildNodeDefs
113    */

114   public NodeDef[] getDeclaredChildNodeDefs();
115
116   /**
117    * Returns <code>true</code> if setting <code>propertyName</code> to
118    * <code>value</code> is allowed by this node type. Otherwise returns
119    * <code>false</code>.
120    *
121    * @param propertyName The name of the property
122    * @param value A <code>Value</code> object.
123    */

124   public boolean canSetProperty(String JavaDoc propertyName, Value value);
125
126   /**
127    * Returns <code>true</code> Checks if adding a child node called
128    * <code>childNodeName</code> is allowed by <i>this</i> node type.
129    * <p/>
130    *
131    * @param childNodeName The name of the child node.
132    */

133   public boolean canAddChildNode(String JavaDoc childNodeName);
134
135   /**
136    * Returns <code>true</code> if adding a child node called
137    * <code>childNodeName</code> of node type <code>nodeTypeName</code> is
138    * allowed by <i>this</i> node type. Otherwise returns <code>false</code>.
139    * The same as <code>{@link #canAddChildNode(String childNodeName)}</code>
140    * except that the type of the child node is explictly specified.
141    *
142    * @param childNodeName The name of the child node.
143    * @param nodeTypeName The name of the node type of the child node.
144    */

145   public boolean canAddChildNode(String JavaDoc childNodeName, String JavaDoc nodeTypeName);
146
147   /**
148    * Returns true if removing <code>itemName</code> is allowed by this node type.
149    * Otherwise returns <code>false</code>.
150    *
151    * @param itemName The name of the child item
152    */

153   public boolean checkRemoveItem(String JavaDoc itemName);
154
155
156 }
Popular Tags