jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r1330757 - in /jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/nodetype: ./ ItemDefinitionImpl.java NodeDefinitionImpl.java NodeTypeImpl.java NodeTypeManagerImpl.java PropertyDefinitionImpl.java
Date Thu, 26 Apr 2012 10:24:46 GMT
Author: jukka
Date: Thu Apr 26 10:24:45 2012
New Revision: 1330757

URL: http://svn.apache.org/viewvc?rev=1330757&view=rev
Log:
OAK-66: JCR Node Type Management

First draft of type implementation classes

Added:
    jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/nodetype/
    jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/nodetype/ItemDefinitionImpl.java
    jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/nodetype/NodeDefinitionImpl.java
    jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/nodetype/NodeTypeImpl.java
    jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/nodetype/NodeTypeManagerImpl.java
    jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/nodetype/PropertyDefinitionImpl.java

Added: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/nodetype/ItemDefinitionImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/nodetype/ItemDefinitionImpl.java?rev=1330757&view=auto
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/nodetype/ItemDefinitionImpl.java
(added)
+++ jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/nodetype/ItemDefinitionImpl.java
Thu Apr 26 10:24:45 2012
@@ -0,0 +1,83 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.oak.jcr.nodetype;
+
+import javax.jcr.nodetype.ItemDefinition;
+import javax.jcr.nodetype.NodeType;
+
+import org.apache.jackrabbit.oak.namepath.NameMapper;
+
+class ItemDefinitionImpl implements ItemDefinition {
+
+    private final NodeType type;
+
+    protected final NameMapper mapper;
+
+    private final String name;
+
+    private final boolean autoCreated;
+
+    private final boolean mandatory;
+
+    private final int onParentRevision;
+
+    private final boolean isProtected;
+
+    protected ItemDefinitionImpl(
+            NodeType type, NameMapper mapper, String name, boolean autoCreated,
+            boolean mandatory, int onParentRevision, boolean isProtected) {
+        this.type = type;
+        this.mapper = mapper;
+        this.name = name;
+        this.autoCreated = autoCreated;
+        this.mandatory = mandatory;
+        this.onParentRevision = onParentRevision;
+        this.isProtected = isProtected;
+    }
+
+    @Override
+    public NodeType getDeclaringNodeType() {
+        return type;
+    }
+
+    @Override
+    public String getName() {
+        return mapper.getJcrName(name);
+    }
+
+    @Override
+    public boolean isAutoCreated() {
+        return autoCreated;
+    }
+
+    @Override
+    public boolean isMandatory() {
+        return mandatory;
+    }
+
+    @Override
+    public int getOnParentVersion() {
+        return onParentRevision;
+    }
+
+    @Override
+    public boolean isProtected() {
+        return isProtected;
+    }
+
+
+}

Added: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/nodetype/NodeDefinitionImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/nodetype/NodeDefinitionImpl.java?rev=1330757&view=auto
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/nodetype/NodeDefinitionImpl.java
(added)
+++ jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/nodetype/NodeDefinitionImpl.java
Thu Apr 26 10:24:45 2012
@@ -0,0 +1,93 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.oak.jcr.nodetype;
+
+import javax.jcr.RepositoryException;
+import javax.jcr.nodetype.NodeDefinition;
+import javax.jcr.nodetype.NodeType;
+import javax.jcr.nodetype.NodeTypeManager;
+
+import org.apache.jackrabbit.oak.namepath.NameMapper;
+
+class NodeDefinitionImpl extends ItemDefinitionImpl implements NodeDefinition {
+
+    private final NodeTypeManager manager;
+
+    private final String[] requiredPrimaryTypeNames;
+
+    private final String defaultPrimaryTypeName;
+
+    private final boolean allowsSameNameSiblings;
+
+    protected NodeDefinitionImpl(
+            NodeType type, NameMapper mapper, String name, boolean autoCreated,
+            boolean mandatory, int onParentRevision, boolean isProtected,
+            NodeTypeManager manager, String[] requiredPrimaryTypeNames,
+            String defaultPrimaryTypeName, boolean allowsSameNameSiblings) {
+        super(type, mapper, name, autoCreated,
+                mandatory, onParentRevision, isProtected);
+        this.manager = manager;
+        this.requiredPrimaryTypeNames = requiredPrimaryTypeNames;
+        this.defaultPrimaryTypeName = defaultPrimaryTypeName;
+        this.allowsSameNameSiblings = allowsSameNameSiblings;
+    }
+
+    @Override
+    public NodeType[] getRequiredPrimaryTypes() {
+        String[] names = getRequiredPrimaryTypeNames();
+        NodeType[] types = new NodeType[names.length];
+        for (int i = 0; i < names.length; i++) {
+            try {
+                types[i] = manager.getNodeType(names[i]);
+            } catch (RepositoryException e) {
+                throw new IllegalStateException(
+                        "Inconsistent node definition: " + this, e);
+            }
+        }
+        return types;
+    }
+
+    @Override
+    public String[] getRequiredPrimaryTypeNames() {
+        String[] names = new String[requiredPrimaryTypeNames.length];
+        for (int i = 0; i < names.length; i++) {
+            names[i] = mapper.getJcrName(requiredPrimaryTypeNames[i]);
+        }
+        return names;
+    }
+
+    @Override
+    public NodeType getDefaultPrimaryType() {
+        try {
+            return manager.getNodeType(getDefaultPrimaryTypeName());
+        } catch (RepositoryException e) {
+            throw new IllegalStateException(
+                    "Inconsistent node definition: " + this, e);
+        }
+    }
+
+    @Override
+    public String getDefaultPrimaryTypeName() {
+        return mapper.getJcrName(defaultPrimaryTypeName);
+    }
+
+    @Override
+    public boolean allowsSameNameSiblings() {
+        return allowsSameNameSiblings;
+    }
+
+}

Added: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/nodetype/NodeTypeImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/nodetype/NodeTypeImpl.java?rev=1330757&view=auto
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/nodetype/NodeTypeImpl.java
(added)
+++ jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/nodetype/NodeTypeImpl.java
Thu Apr 26 10:24:45 2012
@@ -0,0 +1,245 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.oak.jcr.nodetype;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.List;
+
+import javax.jcr.RepositoryException;
+import javax.jcr.Value;
+import javax.jcr.nodetype.NodeDefinition;
+import javax.jcr.nodetype.NodeType;
+import javax.jcr.nodetype.NodeTypeIterator;
+import javax.jcr.nodetype.NodeTypeManager;
+import javax.jcr.nodetype.PropertyDefinition;
+
+import org.apache.jackrabbit.commons.iterator.NodeTypeIteratorAdapter;
+import org.apache.jackrabbit.oak.namepath.NameMapper;
+
+class NodeTypeImpl implements NodeType {
+
+    private final NodeTypeManager manager;
+
+    private final NameMapper mapper;
+
+    private final String name;
+
+    private final String[] declaredSuperTypeNames;
+
+    private boolean isAbstract;
+
+    private final boolean isMixin;
+
+    private final boolean hasOrderableChildNodes;
+
+    private final String primaryItemName;
+
+    private final List<PropertyDefinition> declaredPropertyDefinitions;
+
+    private final List<NodeDefinition> declaredChildNodeDefinitions;
+
+    
+
+    public NodeTypeImpl(
+            NodeTypeManager manager, NameMapper mapper, String name,
+            String[] declaredSuperTypeNames, boolean isAbstract,
+            boolean isMixin, boolean hasOrderableChildNodes,
+            String primaryItemName,
+            List<PropertyDefinition> declaredPropertyDefinitions,
+            List<NodeDefinition> declaredChildNodeDefinitions) {
+        this.manager = manager;
+        this.mapper = mapper;
+        this.name = name;
+        this.declaredSuperTypeNames = declaredSuperTypeNames;
+        this.isAbstract = isAbstract;
+        this.isMixin = isMixin;
+        this.hasOrderableChildNodes = hasOrderableChildNodes;
+        this.primaryItemName = primaryItemName;
+        this.declaredPropertyDefinitions = declaredPropertyDefinitions;
+        this.declaredChildNodeDefinitions = declaredChildNodeDefinitions;
+    }
+
+    @Override
+    public String getName() {
+        return mapper.getJcrName(name);
+    }
+
+    @Override
+    public String[] getDeclaredSupertypeNames() {
+        String[] names = new String[declaredSuperTypeNames.length];
+        for (int i = 0; i < names.length; i++) {
+            names[i] = mapper.getJcrName(declaredSuperTypeNames[i]);
+        }
+        return names;
+    }
+
+    @Override
+    public boolean isAbstract() {
+        return isAbstract;
+    }
+
+    @Override
+    public boolean isMixin() {
+        return isMixin;
+    }
+
+    @Override
+    public boolean hasOrderableChildNodes() {
+        return hasOrderableChildNodes;
+    }
+
+    @Override
+    public boolean isQueryable() {
+        return true;
+    }
+
+    @Override
+    public String getPrimaryItemName() {
+        return mapper.getJcrName(primaryItemName);
+    }
+
+    @Override
+    public PropertyDefinition[] getDeclaredPropertyDefinitions() {
+        return declaredPropertyDefinitions.toArray(
+                new PropertyDefinition[declaredPropertyDefinitions.size()]);
+    }
+
+    @Override
+    public NodeDefinition[] getDeclaredChildNodeDefinitions() {
+        return declaredChildNodeDefinitions.toArray(
+                new NodeDefinition[declaredChildNodeDefinitions.size()]);
+    }
+
+    @Override
+    public NodeType[] getSupertypes() {
+        return null;
+    }
+
+    @Override
+    public NodeType[] getDeclaredSupertypes() {
+        return null;
+    }
+
+    @Override
+    public NodeTypeIterator getSubtypes() {
+        try {
+            Collection<NodeType> types = new ArrayList<NodeType>();
+            NodeTypeIterator iterator = manager.getAllNodeTypes();
+            while (iterator.hasNext()) {
+                NodeType type = iterator.nextNodeType();
+                if (type.isNodeType(getName()) && !isNodeType(type.getName())) {
+                    types.add(type);
+                }
+            }
+            return new NodeTypeIteratorAdapter(types);
+        } catch (RepositoryException e) {
+            throw new IllegalStateException(
+                    "Inconsistent node type: " + this, e);
+        }
+    }
+
+    @Override
+    public NodeTypeIterator getDeclaredSubtypes() {
+        try {
+            Collection<NodeType> types =
+                    new ArrayList<NodeType>(declaredSuperTypeNames.length);
+            for (int i = 0; i < declaredSuperTypeNames.length; i++) {
+                types.add(manager.getNodeType(
+                        mapper.getJcrName(declaredSuperTypeNames[i])));
+            }
+            return new NodeTypeIteratorAdapter(types);
+        } catch (RepositoryException e) {
+            throw new IllegalStateException(
+                    "Inconsistent node type: " + this, e);
+        }
+    }
+
+    @Override
+    public boolean isNodeType(String nodeTypeName) {
+        if (nodeTypeName.equals(getName())) {
+            return true;
+        }
+        for (NodeType type : getSupertypes()) {
+            if (nodeTypeName.equals(type.getName())) {
+                return true;
+            }
+        }
+        return false;
+    }
+
+    @Override
+    public PropertyDefinition[] getPropertyDefinitions() {
+        Collection<PropertyDefinition> definitions =
+                new ArrayList<PropertyDefinition>();
+        for (NodeType type : getSupertypes()) {
+            definitions.addAll(Arrays.asList(
+                    type.getDeclaredPropertyDefinitions()));
+        }
+        definitions.addAll(Arrays.asList(getDeclaredPropertyDefinitions()));
+        return definitions.toArray(new PropertyDefinition[definitions.size()]);
+    }
+
+    @Override
+    public NodeDefinition[] getChildNodeDefinitions() {
+        Collection<NodeDefinition> definitions =
+                new ArrayList<NodeDefinition>();
+        for (NodeType type : getSupertypes()) {
+            definitions.addAll(Arrays.asList(
+                    type.getDeclaredChildNodeDefinitions()));
+        }
+        definitions.addAll(Arrays.asList(getDeclaredChildNodeDefinitions()));
+        return definitions.toArray(new NodeDefinition[definitions.size()]);
+    }
+
+    @Override
+    public boolean canSetProperty(String propertyName, Value value) {
+        return true; // TODO
+    }
+
+    @Override
+    public boolean canSetProperty(String propertyName, Value[] values) {
+        return true; // TODO
+    }
+
+    @Override
+    public boolean canAddChildNode(String childNodeName) {
+        return true; // TODO
+    }
+
+    @Override
+    public boolean canAddChildNode(String childNodeName, String nodeTypeName) {
+        return true; // TODO
+    }
+
+    @Override
+    public boolean canRemoveItem(String itemName) {
+        return true; // TODO
+    }
+
+    @Override
+    public boolean canRemoveNode(String nodeName) {
+        return true; // TODO
+    }
+
+    @Override
+    public boolean canRemoveProperty(String propertyName) {
+        return true; // TODO
+    }
+
+}

Added: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/nodetype/NodeTypeManagerImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/nodetype/NodeTypeManagerImpl.java?rev=1330757&view=auto
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/nodetype/NodeTypeManagerImpl.java
(added)
+++ jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/nodetype/NodeTypeManagerImpl.java
Thu Apr 26 10:24:45 2012
@@ -0,0 +1,145 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.oak.jcr.nodetype;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.jcr.RepositoryException;
+import javax.jcr.UnsupportedRepositoryOperationException;
+import javax.jcr.nodetype.InvalidNodeTypeDefinitionException;
+import javax.jcr.nodetype.NoSuchNodeTypeException;
+import javax.jcr.nodetype.NodeDefinitionTemplate;
+import javax.jcr.nodetype.NodeType;
+import javax.jcr.nodetype.NodeTypeDefinition;
+import javax.jcr.nodetype.NodeTypeExistsException;
+import javax.jcr.nodetype.NodeTypeIterator;
+import javax.jcr.nodetype.NodeTypeManager;
+import javax.jcr.nodetype.NodeTypeTemplate;
+import javax.jcr.nodetype.PropertyDefinitionTemplate;
+
+import org.apache.jackrabbit.commons.iterator.NodeTypeIteratorAdapter;
+import org.apache.jackrabbit.oak.namepath.NameMapper;
+
+public class NodeTypeManagerImpl implements NodeTypeManager {
+
+    private final NameMapper mapper;
+
+    private final Map<String, NodeType> types = new HashMap<String, NodeType>();
+
+    public NodeTypeManagerImpl(NameMapper mapper) {
+        this.mapper = mapper;
+    }
+
+    @Override
+    public boolean hasNodeType(String name) throws RepositoryException {
+        return types.containsKey(mapper.getOakName(name));
+    }
+
+    @Override
+    public NodeType getNodeType(String name)
+            throws NoSuchNodeTypeException, RepositoryException {
+        NodeType type = types.get(mapper.getOakName(name));
+        if (type == null) {
+            throw new NoSuchNodeTypeException("Unknown node type: " + name);
+        }
+        return type;
+    }
+
+    @Override
+    public NodeTypeIterator getAllNodeTypes() throws RepositoryException {
+        return new NodeTypeIteratorAdapter(types.values());
+    }
+
+    @Override
+    public NodeTypeIterator getPrimaryNodeTypes() throws RepositoryException {
+        Collection<NodeType> primary = new ArrayList<NodeType>();
+        for (NodeType type : types.values()) {
+            if (!type.isMixin()) {
+                primary.add(type);
+            }
+        }
+        return new NodeTypeIteratorAdapter(primary);
+    }
+
+    @Override
+    public NodeTypeIterator getMixinNodeTypes() throws RepositoryException {
+        Collection<NodeType> mixin = new ArrayList<NodeType>();
+        for (NodeType type : types.values()) {
+            if (type.isMixin()) {
+                mixin.add(type);
+            }
+        }
+        return new NodeTypeIteratorAdapter(mixin);
+    }
+
+    @Override
+    public NodeTypeTemplate createNodeTypeTemplate()
+            throws UnsupportedRepositoryOperationException, RepositoryException {
+        throw new UnsupportedRepositoryOperationException();
+    }
+
+    @Override
+    public NodeTypeTemplate createNodeTypeTemplate(NodeTypeDefinition ntd)
+            throws UnsupportedRepositoryOperationException, RepositoryException {
+        throw new UnsupportedRepositoryOperationException();
+    }
+
+    @Override
+    public NodeDefinitionTemplate createNodeDefinitionTemplate()
+            throws UnsupportedRepositoryOperationException, RepositoryException {
+        throw new UnsupportedRepositoryOperationException();
+    }
+
+    @Override
+    public PropertyDefinitionTemplate createPropertyDefinitionTemplate()
+            throws UnsupportedRepositoryOperationException, RepositoryException {
+        throw new UnsupportedRepositoryOperationException();
+    }
+
+    @Override
+    public NodeType registerNodeType(NodeTypeDefinition ntd, boolean allowUpdate)
+            throws InvalidNodeTypeDefinitionException, NodeTypeExistsException,
+            UnsupportedRepositoryOperationException, RepositoryException {
+        throw new UnsupportedRepositoryOperationException();
+    }
+
+    @Override
+    public NodeTypeIterator registerNodeTypes(NodeTypeDefinition[] ntds,
+            boolean allowUpdate) throws InvalidNodeTypeDefinitionException,
+            NodeTypeExistsException, UnsupportedRepositoryOperationException,
+            RepositoryException {
+        throw new UnsupportedRepositoryOperationException();
+    }
+
+    @Override
+    public void unregisterNodeType(String name)
+            throws UnsupportedRepositoryOperationException,
+            NoSuchNodeTypeException, RepositoryException {
+        throw new UnsupportedRepositoryOperationException();
+    }
+
+    @Override
+    public void unregisterNodeTypes(String[] names)
+            throws UnsupportedRepositoryOperationException,
+            NoSuchNodeTypeException, RepositoryException {
+        throw new UnsupportedRepositoryOperationException();
+    }
+
+}

Added: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/nodetype/PropertyDefinitionImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/nodetype/PropertyDefinitionImpl.java?rev=1330757&view=auto
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/nodetype/PropertyDefinitionImpl.java
(added)
+++ jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/nodetype/PropertyDefinitionImpl.java
Thu Apr 26 10:24:45 2012
@@ -0,0 +1,77 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.oak.jcr.nodetype;
+
+import javax.jcr.Value;
+import javax.jcr.nodetype.NodeType;
+import javax.jcr.nodetype.PropertyDefinition;
+
+import org.apache.jackrabbit.oak.namepath.NameMapper;
+
+class PropertyDefinitionImpl
+        extends ItemDefinitionImpl implements PropertyDefinition {
+
+    private final int requiredType;
+
+    private final boolean multiple;
+
+    public PropertyDefinitionImpl(
+            NodeType type, NameMapper mapper, String name, boolean autoCreated,
+            boolean mandatory, int onParentRevision, boolean isProtected,
+            int requiredType, boolean multiple) {
+        super(type, mapper, name, autoCreated,
+                mandatory, onParentRevision, isProtected);
+        this.requiredType = requiredType;
+        this.multiple = multiple;
+    }
+
+    @Override
+    public int getRequiredType() {
+        return requiredType;
+    }
+
+    @Override
+    public String[] getValueConstraints() {
+        return new String[0];
+    }
+
+    @Override
+    public Value[] getDefaultValues() {
+        return new Value[0];
+    }
+
+    @Override
+    public boolean isMultiple() {
+        return multiple;
+    }
+
+    @Override
+    public String[] getAvailableQueryOperators() {
+        return new String[0];
+    }
+
+    @Override
+    public boolean isFullTextSearchable() {
+        return false;
+    }
+
+    @Override
+    public boolean isQueryOrderable() {
+        return false;
+    }
+
+}



Mime
View raw message