You are viewing a plain text version of this content. The canonical link for it is here.
Posted to slide-dev@jakarta.apache.org by st...@apache.org on 2004/07/16 18:37:12 UTC
cvs commit: jakarta-slide/proposals/jcrri/src/org/apache/slide/jcr/core/nodetype NodeTypeDefStore.java NodeTypeManagerImpl.java NodeTypeRegistry.java NodeTypeRegistryListener.java PropDef.java PropDefId.java
stefan 2004/07/16 09:37:12
Modified: proposals/jcrri/src/org/apache/slide/jcr/core/nodetype
NodeTypeDefStore.java NodeTypeManagerImpl.java
NodeTypeRegistry.java NodeTypeRegistryListener.java
PropDef.java PropDefId.java
Log:
jcrri
Revision Changes Path
1.4 +0 -0 jakarta-slide/proposals/jcrri/src/org/apache/slide/jcr/core/nodetype/NodeTypeDefStore.java
Index: NodeTypeDefStore.java
===================================================================
RCS file: /home/cvs/jakarta-slide/proposals/jcrri/src/org/apache/slide/jcr/core/nodetype/NodeTypeDefStore.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
1.6 +33 -82 jakarta-slide/proposals/jcrri/src/org/apache/slide/jcr/core/nodetype/NodeTypeManagerImpl.java
Index: NodeTypeManagerImpl.java
===================================================================
RCS file: /home/cvs/jakarta-slide/proposals/jcrri/src/org/apache/slide/jcr/core/nodetype/NodeTypeManagerImpl.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- NodeTypeManagerImpl.java 7 Jul 2004 16:06:40 -0000 1.5
+++ NodeTypeManagerImpl.java 16 Jul 2004 16:37:11 -0000 1.6
@@ -31,8 +31,8 @@
import org.apache.slide.jcr.util.IteratorHelper;
import javax.jcr.RepositoryException;
-import javax.jcr.version.OnParentVersionAction;
import javax.jcr.nodetype.*;
+import javax.jcr.version.OnParentVersionAction;
import java.io.PrintStream;
import java.util.ArrayList;
import java.util.Collections;
@@ -49,7 +49,7 @@
private final NodeTypeRegistry ntReg;
- private final NodeDef rootNodeDef;
+ private final NodeDefImpl rootNodeDef;
// namespace resolver used to translate qualified names to JCR names
private final NamespaceResolver nsResolver;
@@ -70,14 +70,13 @@
// setup item cache with soft references to node type instances
ntCache = new ReferenceMap(ReferenceMap.HARD, ReferenceMap.SOFT);
- rootNodeDef = new RootNodeDefinition();
-
+ rootNodeDef = RootNodeDefinition.create(this, nsResolver);
}
/**
* @return
*/
- public NodeDef getRootNodeDefinition() {
+ public NodeDefImpl getRootNodeDefinition() {
return rootNodeDef;
}
@@ -85,7 +84,7 @@
* @param id
* @return
*/
- public NodeDef getNodeDef(NodeDefId id) {
+ public NodeDefImpl getNodeDef(NodeDefId id) {
ChildNodeDef cnd = ntReg.getNodeDef(id);
if (cnd == null) {
return null;
@@ -97,7 +96,7 @@
* @param id
* @return
*/
- public PropertyDef getPropDef(PropDefId id) {
+ public PropertyDefImpl getPropDef(PropDefId id) {
PropDef pd = ntReg.getPropDef(id);
if (pd == null) {
return null;
@@ -118,8 +117,8 @@
EffectiveNodeType ent = ntReg.getEffectiveNodeType(name);
NodeTypeDef def = ntReg.getNodeTypeDef(name);
- nt = new NodeTypeImpl(ent, def, this, nsResolver);
- ntCache.put(name, nt);
+ nt = new NodeTypeImpl(ent, def, this, nsResolver);
+ ntCache.put(name, nt);
return nt;
}
@@ -206,7 +205,6 @@
* Dumps the state of this <code>NodeTypeManager</code> instance.
*
* @param ps
- *
* @throws RepositoryException
*/
public void dump(PrintStream ps) throws RepositoryException {
@@ -220,39 +218,33 @@
* The <code>RootNodeDefinition</code> defines the characteristics of
* the root node.
*/
- private class RootNodeDefinition implements NodeDef {
-
- final NodeType ntBase;
- final NodeType ntUnstructured;
+ private static class RootNodeDefinition extends NodeDefImpl {
/**
- * Constructs a new instance of this class.
+ * private constructor
*/
- RootNodeDefinition() {
- try {
- ntBase = getNodeType(NodeTypeRegistry.NT_BASE);
- ntUnstructured = getNodeType(NodeTypeRegistry.NT_UNSTRUCTURED);
- } catch (NoSuchNodeTypeException nsnte) {
- // should never get here
- String msg = "predefined note types missing: " + nsnte.getMessage();
- log.fatal(msg, nsnte);
- throw new InternalError(msg);
- }
+ private RootNodeDefinition(ChildNodeDef def, NodeTypeManagerImpl ntMgr, NamespaceResolver nsResolver) {
+ super(def, ntMgr, nsResolver);
}
/**
- * @see NodeDef#getDeclaringNodeType
+ * Creates a new <code>RootNodeDefinition</code>.
*/
- public NodeType getDeclaringNodeType() {
- // not applicable
- return null;
- }
+ static RootNodeDefinition create(NodeTypeManagerImpl ntMgr, NamespaceResolver nsResolver) {
+ ChildNodeDef def = new ChildNodeDef();
- /**
- * @see NodeDef#getDefaultPrimaryType
- */
- public NodeType getDefaultPrimaryType() {
- return ntUnstructured;
+ //def.setName(null);
+ //def.setDeclaringNodeType(null);
+ def.setRequiredPrimaryTypes(new QName[]{NodeTypeRegistry.NT_BASE});
+ def.setDefaultPrimaryType(NodeTypeRegistry.NT_UNSTRUCTURED);
+ def.setMandatory(true);
+ def.setProtected(false);
+ def.setOnParentVersion(OnParentVersionAction.VERSION);
+ def.setPrimaryItem(false);
+ def.setAllowSameNameSibs(false);
+ def.setAutoCreate(true);
+
+ return new RootNodeDefinition(def, ntMgr, nsResolver);
}
/**
@@ -264,52 +256,11 @@
}
/**
- * @see NodeDef#getOnParentVersion
- */
- public int getOnParentVersion() {
- return OnParentVersionAction.VERSION;
- }
-
- /**
- * @see NodeDef#getRequiredPrimaryTypes
- */
- public NodeType[] getRequiredPrimaryTypes() {
- return new NodeType[]{ntBase};
- }
-
- /**
- * @see NodeDef#isAutoCreate
- */
- public boolean isAutoCreate() {
- return false;
- }
-
- /**
- * @see NodeDef#isMandatory
- */
- public boolean isMandatory() {
- return true;
- }
-
- /**
- * @see NodeDef#isPrimaryItem
- */
- public boolean isPrimaryItem() {
- return false;
- }
-
- /**
- * @see NodeDef#allowSameNameSibs
- */
- public boolean allowSameNameSibs() {
- return false;
- }
-
- /**
- * @see NodeDef#isProtected
+ * @see NodeDef#getDeclaringNodeType
*/
- public boolean isProtected() {
- return false;
+ public NodeType getDeclaringNodeType() {
+ // not applicable
+ return null;
}
}
}
1.8 +11 -2 jakarta-slide/proposals/jcrri/src/org/apache/slide/jcr/core/nodetype/NodeTypeRegistry.java
Index: NodeTypeRegistry.java
===================================================================
RCS file: /home/cvs/jakarta-slide/proposals/jcrri/src/org/apache/slide/jcr/core/nodetype/NodeTypeRegistry.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- NodeTypeRegistry.java 9 Jul 2004 16:48:34 -0000 1.7
+++ NodeTypeRegistry.java 16 Jul 2004 16:37:11 -0000 1.8
@@ -63,6 +63,15 @@
// mix:referenceable
public static final QName MIX_REFERENCEABLE =
new QName(NamespaceRegistryImpl.NS_MIX_URI, "referenceable");
+ // mix:versionable
+ public static final QName MIX_VERSIONABLE =
+ new QName(NamespaceRegistryImpl.NS_MIX_URI, "versionable");
+ // nt:versionHistory
+ public static final QName NT_VERSION_HISTORY =
+ new QName(NamespaceRegistryImpl.NS_NT_URI, "versionHistory");
+ // nt:version
+ public static final QName NT_VERSION =
+ new QName(NamespaceRegistryImpl.NS_NT_URI, "version");
private static final String BUILTIN_NODETYPES_RESOURCE_PATH =
"org/apache/slide/jcr/core/nodetype/builtin_nodetypes.xml";
1.2 +0 -0 jakarta-slide/proposals/jcrri/src/org/apache/slide/jcr/core/nodetype/NodeTypeRegistryListener.java
Index: NodeTypeRegistryListener.java
===================================================================
RCS file: /home/cvs/jakarta-slide/proposals/jcrri/src/org/apache/slide/jcr/core/nodetype/NodeTypeRegistryListener.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
1.7 +0 -0 jakarta-slide/proposals/jcrri/src/org/apache/slide/jcr/core/nodetype/PropDef.java
Index: PropDef.java
===================================================================
RCS file: /home/cvs/jakarta-slide/proposals/jcrri/src/org/apache/slide/jcr/core/nodetype/PropDef.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
1.2 +0 -0 jakarta-slide/proposals/jcrri/src/org/apache/slide/jcr/core/nodetype/PropDefId.java
Index: PropDefId.java
===================================================================
RCS file: /home/cvs/jakarta-slide/proposals/jcrri/src/org/apache/slide/jcr/core/nodetype/PropDefId.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
---------------------------------------------------------------------
To unsubscribe, e-mail: slide-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: slide-dev-help@jakarta.apache.org