A repository maysupportnode type management. Depending onimplementation-specific limitations (see §19.3Node TypeRegistration Restrictions), this feature may include some or allof the following:
Adding a node type to theregistry.
Removing a node type from theregistry.
Updating the definition of aregistered node type thatisnot currently in use asthe node type of any node in the repository.
Updating the definition of aregistered node type thatis currently in use as the nodetype of a node in the repository.
Import of node type definitionsto the repository.
Export of node types from therepository.
Whether a particularimplementation supports node type management and the restrictions inplace with regard to this feature can be determined by querying therepository descriptor table with the constants listed in §24.2.4Node Type Management.
Theinterface provides methods for discovering the static definition ofa node type. These are accessible both before and after the nodetype is registered. Its subclassadds methods that are relevant only when the node type is “live”;that is, after it has been registered.
In implementationsthat support node type registrations,serves as the superclass of bothand.In implementations that do not support node type registration, onlyobjects implementing the subclasswill be encountered.
Theinterface provides the following methods related to registering nodetypes. For methods of this interface that are related to node typediscovery, see §8Node Type Discovery. In implementationsthat do not support node type management, the methods ofwill throw an.
returns an emptywhich can then be used to define a node type and passed to.
returns aholding the specified.This template may then be altered and passed to.
returns an emptywhich can then be used to create a child node definition andattached to a.
returns an emptywhich can then be used to create a property definition and attachedto a.
registers a new nodetype or updates an existing node type using the specified definitionand returns the resultingobject. Typically, the object passed to this method will be a(a subclass of)acquired fromand then filled-in with definition information. Ifisthen an attempt to change the definition of an already registerednode type will be made (see §19.2.4.1Updating Node Types),otherwise an attempt to register a node type with the same name asan already registered one will fail immediately.
registers or updatesthe specified array ofobjects. This method is used to register or update a set of nodetypes with mutual dependencies. It returns an iterator over theresultingobjects. The effect of the method is “all or nothing”; if anerror occurs, no changes are made.
A repository thatsupports node type management may support updates to a node typealready in use as the type of an existing node. The extent of anysuch capability is implementation dependent. For example, someimplementations may permit only changes which do not invalidateexisting content, while others may allow larger changes. How anyresulting incompatibilities are resolved is also implementationdependent. Any changes to the type of an exiting node must takeeffect in accordance with thenode type assignment behaviorof the repository (see §10.10.1Node Type Assignment Behavior).
unregisters thespecified node type.
unregisters thespecified set of node types. This method is used to unregister a setof node types with mutual dependencies.
returnsif a node type with the specified name is registered and returnsotherwise.
A repositorymustprevent the registration of any node type that uses a reservednamespace either in its name or in the name of any of its itemdefinitions (see 3.4Namespace Mapping).
A repositorymayrestrict the range of node types that can be registered according toimplementation-specific criteria. This is most relevant in caseswhere a JCR repository is built on top of an existing content storewhich has intrinsic limitations that restrict the space of supportednode types.
Node types are definedprogrammatically by setting the attributes of template objects andpassing these to the.
Theis a container holding the node type's attributes and its propertyand child node definitions, which are themselves represented byandobjects, respectively.
The user registers anode type by first acquiring aand the necessaryorobjects through the(see §19.2NodeTypeManager). The attributes of these objectsare then set, with the appropriateandobjects added to theobject. The resultingobject is then passed to a registration method of the.
,like,is a subclass of,so it shares withthose methods that are relevant to a static definition. In additionto the methods inherited from,provides methods for setting the attributes of the definition. Thesetter methods are named appropriately according to the attributethat they set (see 3.6.1Node Type Definition Attributes).Consult the Javadoc for details on the method signatures.
Setting the propertydefinitions within a node type template is done by addingobjects to the mutableobject retrieved from
.
Similarly, setting thechild node definitions is done by addingobjects to the mutableobject retrieved from
.
See the correspondingget methods for each attribute in(see §19.1NodeTypeDefinition) for the default valuesassumed when a new emptyis created.
Theinterface extends(see §8.4PropertyDefinition Object) with the addition ofwrite methods, enabling the characteristics of a child propertydefinition to be set, after which theis added to a.The setter methods are named appropriately according to theattribute that they set (see §3.7.2Item Definition Attributesand §3.7.3Property Definition Attributes). Consult theJavadoc for details on the method signatures.
See the correspondingget methods for each attribute in(see §8.4PropertyDefinition Object) for the default valuesassumed when a new emptyis created.
Theinterface extends(see §8.5NodeDefinition Object) with the addition of writemethods, enabling the characteristics of a child node definition tobe set, after which theis added to a.The setter methods are named appropriately according to theattribute that they set (see §3.7.2Item Definition Attributesand §3.7.4Child Node Definition Attributes). Consult theJavadoc for details on the method signatures.
See the correspondingget methods for each attribute in(see §8.5NodeDefinition Object) for the default valuesassumed when a new emptyis created.