001: /*
002: * Copyright 2006 Day Management AG, Switzerland. All rights reserved.
003: */
004: package javax.jcr.nodetype;
005:
006: /**
007: * The <code>NodeTypeDefinition</code> interface provides methods for
008: * discovering the static definition of a node type. These are accessible both
009: * before and after the node type is registered. Its subclass
010: * <code>NodeType</code> adds methods that are relevant only when the node type
011: * is "live"; that is, after it has been registered. Note that the separate
012: * <code>NodeDefinition</code> interface only plays a significant role in
013: * implementations that support node type registration. In those cases it serves
014: * as the superclass of both <code>NodeType</code> and
015: * <code>NodeTypeTemplate</code>. In implementations that do not support node
016: * type registration, only objects implementing the subinterface
017: * <code>NodeType</code> will be encountered.
018: *
019: * @since JCR 2.0
020: */
021: public interface NodeTypeDefinition {
022:
023: /**
024: * Returns the name of the node type.
025: * <p/>
026: * In implementations that support node type registration, if this
027: * <code>NodeTypeDefinition</code> object is actually a newly-created empty
028: * <code>NodeTypeTemplate</code>, then this method will return
029: * <code>null</code>.
030: *
031: * @return a <code>String</code>
032: */
033: public String getName();
034:
035: /**
036: * Returns the names of the supertypes actually declared in this node type.
037: * <p/>
038: * In implementations that support node type registration, if this
039: * <code>NodeTypeDefinition</code> object is actually a newly-created empty
040: * <code>NodeTypeTemplate</code>, then this method will return an array
041: * containing a single string indicating the node type
042: * <code>nt:base</code>.
043: *
044: * @return an array of <code>String</code>s
045: */
046: public String[] getDeclaredSupertypeNames();
047:
048: /**
049: * Returns <code>true</code> if this is an abstract node type; returns
050: * <code>false</code> otherwise.
051: * <p/>
052: * An abstract node type is one that cannot be assigned as the primary or
053: * mixin type of a node but can be used in the definitions of other node
054: * types as a superclass.
055: * <p/>
056: * In implementations that support node type registration, if this
057: * <code>NodeTypeDefinition</code> object is actually a newly-created empty
058: * <code>NodeTypeTemplate</code>, then this method will return
059: * <code>false</code>.
060: *
061: * @return a <code>boolean</code>
062: */
063: public boolean isAbstract();
064:
065: /**
066: * Returns <code>true</code> if this is a mixin type; returns
067: * <code>false</code> if it is primary.
068: * <p/>
069: * In implementations that support node type registration, if this
070: * <code>NodeTypeDefinition</code> object is actually a newly-created empty
071: * <code>NodeTypeTemplate</code>, then this method will return
072: * <code>false</code>.
073: *
074: * @return a <code>boolean</code>
075: */
076: public boolean isMixin();
077:
078: /**
079: * Returns <code>true</code> if nodes of this type must support orderable
080: * child nodes; returns <code>false</code> otherwise. If a node type returns
081: * <code>true</code> on a call to this method, then all nodes of that node
082: * type <i>must</i> support the method <code>Node.orderBefore</code>. If a
083: * node type returns <code>false</code> on a call to this method, then nodes
084: * of that node type <i>may</i> support <code>Node.orderBefore</code>. Only
085: * the primary node type of a node controls that node's status in this regard.
086: * This setting on a mixin node type will not have any effect on the node.
087: * <p/>
088: * In implementations that support node type registration, if this
089: * <code>NodeTypeDefinition</code> object is actually a newly-created empty
090: * <code>NodeTypeTemplate</code>, then this method will return
091: * <code>false</code>.
092: *
093: * @return a <code>boolean</code>
094: */
095: public boolean hasOrderableChildNodes();
096:
097: /**
098: * Returns the name of the primary item (one of the child items of the nodes
099: * of this node type). If this node has no primary item, then this method
100: * returns <code>null</code>. This indicator is used by the method
101: * <code>Node.getPrimaryItem()</code>.
102: * <p/>
103: * In implementations that support node type registration, if this
104: * <code>NodeTypeDefinition</code> object is actually a newly-created empty
105: * <code>NodeTypeTemplate</code>, then this method will return
106: * <code>null</code>.
107: *
108: * @return a <code>String</code>
109: */
110: public String getPrimaryItemName();
111:
112: /**
113: * Returns an array containing the property definitions actually declared in
114: * this node type.
115: * <p/>
116: * In implementations that support node type registration, if this
117: * <code>NodeTypeDefinition</code> object is actually a newly-created empty
118: * <code>NodeTypeTemplate</code>, then this method will return
119: * <code>null</code>.
120: *
121: * @return an array of <code>PropertyDefinition</code>s
122: */
123: public PropertyDefinition[] getDeclaredPropertyDefinitions();
124:
125: /**
126: * Returns an array containing the child node definitions actually declared
127: * in this node type.
128: * <p/>
129: * In implementations that support node type registration, if this
130: * <code>NodeTypeDefinition</code> object is actually a newly-created empty
131: * <code>NodeTypeTemplate</code>, then this method will return
132: * <code>null</code>.
133: *
134: * @return an array of <code>NodeDefinition</code>s
135: */
136: public NodeDefinition[] getDeclaredChildNodeDefinitions();
137: }
|