You are viewing a plain text version of this content. The canonical link for it is here.
Posted to oak-commits@jackrabbit.apache.org by ju...@apache.org on 2012/04/27 16:55:22 UTC
svn commit: r1331450 [2/2] - in /jackrabbit/oak/trunk: ./
oak-commons/src/test/java/org/apache/jackrabbit/oak/commons/ oak-core/
oak-core/src/main/java/org/apache/jackrabbit/mk/
oak-core/src/main/java/org/apache/jackrabbit/mk/fs/ oak-core/src/main/java...
Propchange: jackrabbit/oak/trunk/oak-it/osgi/test-bundles.xml
------------------------------------------------------------------------------
svn:eol-style = native
Modified: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/ItemDelegate.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/ItemDelegate.java?rev=1331450&r1=1331449&r2=1331450&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/ItemDelegate.java (original)
+++ jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/ItemDelegate.java Fri Apr 27 14:55:14 2012
@@ -1,25 +1,25 @@
-/*
- * 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;
-
-public abstract class ItemDelegate {
-
- abstract String getName();
-
- abstract String getPath();
-}
+/*
+ * 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;
+
+public abstract class ItemDelegate {
+
+ abstract String getName();
+
+ abstract String getPath();
+}
Propchange: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/ItemDelegate.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/ItemImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/NodeDelegate.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/NodeDelegate.java?rev=1331450&r1=1331449&r2=1331450&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/NodeDelegate.java (original)
+++ jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/NodeDelegate.java Fri Apr 27 14:55:14 2012
@@ -1,190 +1,190 @@
-/*
- * 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;
-
-import org.apache.jackrabbit.oak.api.CoreValue;
-import org.apache.jackrabbit.oak.api.PropertyState;
-import org.apache.jackrabbit.oak.api.Tree;
-import org.apache.jackrabbit.oak.api.Tree.Status;
-import org.apache.jackrabbit.oak.commons.PathUtils;
-import org.apache.jackrabbit.oak.util.Function1;
-import org.apache.jackrabbit.oak.util.Iterators;
-
-import javax.jcr.ItemNotFoundException;
-import javax.jcr.PathNotFoundException;
-import javax.jcr.RepositoryException;
-import java.util.Iterator;
-import java.util.List;
-
-public class NodeDelegate extends ItemDelegate {
-
- private final SessionContext sessionContext;
- private Tree tree;
-
- NodeDelegate(SessionContext sessionContext, Tree tree) {
- this.sessionContext = sessionContext;
- this.tree = tree;
- }
-
- NodeDelegate addNode(String relPath) throws RepositoryException {
- Tree parentState = getTree(PathUtils.getParentPath(relPath));
- if (parentState == null) {
- throw new PathNotFoundException(relPath);
- }
-
- String name = PathUtils.getName(relPath);
- parentState.addChild(name);
- return new NodeDelegate(sessionContext, parentState.getChild(name));
- }
-
- NodeDelegate getAncestor(int depth) throws RepositoryException {
- int current = getDepth();
- if (depth < 0 || depth > current) {
- throw new ItemNotFoundException("ancestor at depth " + depth
- + " does not exist");
- }
- Tree ancestor = getTree();
- while (depth < current) {
- ancestor = ancestor.getParent();
- current -= 1;
- }
- return new NodeDelegate(sessionContext, ancestor);
- }
-
- Iterator<NodeDelegate> getChildren() throws RepositoryException {
- return nodeDelegateIterator(getTree().getChildren().iterator());
- }
-
- long getChildrenCount() throws RepositoryException {
- return getTree().getChildrenCount();
- }
-
- int getDepth() throws RepositoryException {
- return PathUtils.getDepth(getPath());
- }
-
- @Override
- String getName() {
- return getTree().getName();
- }
-
- Status getNodeStatus() {
- return getTree().getParent().getChildStatus(getName());
- }
-
- NodeDelegate getNodeOrNull(String relOakPath) {
- Tree tree = getTree(relOakPath);
- return tree == null ? null : new NodeDelegate(sessionContext, tree);
- }
-
- NodeDelegate getParent() throws RepositoryException {
- if (getTree().getParent() == null) {
- throw new ItemNotFoundException("Root has no parent");
- }
-
- return new NodeDelegate(sessionContext, getTree().getParent());
- }
-
- @Override
- String getPath() {
- return '/' + getTree().getPath();
- }
-
- Iterator<PropertyDelegate> getProperties() throws RepositoryException {
- return propertyDelegateIterator(getTree().getProperties().iterator());
- }
-
- long getPropertyCount() throws RepositoryException {
- return getTree().getPropertyCount();
- }
-
- PropertyDelegate getPropertyOrNull(String relOakPath)
- throws RepositoryException {
-
- Tree parent = getTree(PathUtils.getParentPath(relOakPath));
- if (parent == null) {
- return null;
- }
-
- String name = PathUtils.getName(relOakPath);
- PropertyState propertyState = parent.getProperty(name);
- return propertyState == null ? null : new PropertyDelegate(
- sessionContext, parent, propertyState);
- }
-
- SessionContext getSessionContext() {
- return sessionContext;
- }
-
- void remove() throws RepositoryException {
- getTree().getParent().removeChild(getName());
- }
-
- PropertyDelegate setProperty(String oakName, CoreValue value)
- throws RepositoryException {
-
- getTree().setProperty(oakName, value);
- return getPropertyOrNull(oakName);
- }
-
- PropertyDelegate setProperty(String oakName, List<CoreValue> value)
- throws RepositoryException {
-
- getTree().setProperty(oakName, value);
- return getPropertyOrNull(oakName);
- }
-
- // -----------------------------------------------------------< private >---
-
- private Tree getTree(String relPath) {
- Tree tree = getTree();
- for (String name : PathUtils.elements(relPath)) {
- if (tree == null) {
- return null;
- }
- tree = tree.getChild(name);
- }
- return tree;
- }
-
- private synchronized Tree getTree() {
- return tree = sessionContext.getTree(tree.getPath());
- }
-
- private Iterator<NodeDelegate> nodeDelegateIterator(
- Iterator<Tree> childNodeStates) {
- return Iterators.map(childNodeStates,
- new Function1<Tree, NodeDelegate>() {
- @Override
- public NodeDelegate apply(Tree state) {
- return new NodeDelegate(sessionContext, state);
- }
- });
- }
-
- private Iterator<PropertyDelegate> propertyDelegateIterator(
- Iterator<? extends PropertyState> properties) {
- return Iterators.map(properties,
- new Function1<PropertyState, PropertyDelegate>() {
- @Override
- public PropertyDelegate apply(PropertyState propertyState) {
- return new PropertyDelegate(sessionContext, tree,
- propertyState);
- }
- });
- }
-}
+/*
+ * 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;
+
+import org.apache.jackrabbit.oak.api.CoreValue;
+import org.apache.jackrabbit.oak.api.PropertyState;
+import org.apache.jackrabbit.oak.api.Tree;
+import org.apache.jackrabbit.oak.api.Tree.Status;
+import org.apache.jackrabbit.oak.commons.PathUtils;
+import org.apache.jackrabbit.oak.util.Function1;
+import org.apache.jackrabbit.oak.util.Iterators;
+
+import javax.jcr.ItemNotFoundException;
+import javax.jcr.PathNotFoundException;
+import javax.jcr.RepositoryException;
+import java.util.Iterator;
+import java.util.List;
+
+public class NodeDelegate extends ItemDelegate {
+
+ private final SessionContext sessionContext;
+ private Tree tree;
+
+ NodeDelegate(SessionContext sessionContext, Tree tree) {
+ this.sessionContext = sessionContext;
+ this.tree = tree;
+ }
+
+ NodeDelegate addNode(String relPath) throws RepositoryException {
+ Tree parentState = getTree(PathUtils.getParentPath(relPath));
+ if (parentState == null) {
+ throw new PathNotFoundException(relPath);
+ }
+
+ String name = PathUtils.getName(relPath);
+ parentState.addChild(name);
+ return new NodeDelegate(sessionContext, parentState.getChild(name));
+ }
+
+ NodeDelegate getAncestor(int depth) throws RepositoryException {
+ int current = getDepth();
+ if (depth < 0 || depth > current) {
+ throw new ItemNotFoundException("ancestor at depth " + depth
+ + " does not exist");
+ }
+ Tree ancestor = getTree();
+ while (depth < current) {
+ ancestor = ancestor.getParent();
+ current -= 1;
+ }
+ return new NodeDelegate(sessionContext, ancestor);
+ }
+
+ Iterator<NodeDelegate> getChildren() throws RepositoryException {
+ return nodeDelegateIterator(getTree().getChildren().iterator());
+ }
+
+ long getChildrenCount() throws RepositoryException {
+ return getTree().getChildrenCount();
+ }
+
+ int getDepth() throws RepositoryException {
+ return PathUtils.getDepth(getPath());
+ }
+
+ @Override
+ String getName() {
+ return getTree().getName();
+ }
+
+ Status getNodeStatus() {
+ return getTree().getParent().getChildStatus(getName());
+ }
+
+ NodeDelegate getNodeOrNull(String relOakPath) {
+ Tree tree = getTree(relOakPath);
+ return tree == null ? null : new NodeDelegate(sessionContext, tree);
+ }
+
+ NodeDelegate getParent() throws RepositoryException {
+ if (getTree().getParent() == null) {
+ throw new ItemNotFoundException("Root has no parent");
+ }
+
+ return new NodeDelegate(sessionContext, getTree().getParent());
+ }
+
+ @Override
+ String getPath() {
+ return '/' + getTree().getPath();
+ }
+
+ Iterator<PropertyDelegate> getProperties() throws RepositoryException {
+ return propertyDelegateIterator(getTree().getProperties().iterator());
+ }
+
+ long getPropertyCount() throws RepositoryException {
+ return getTree().getPropertyCount();
+ }
+
+ PropertyDelegate getPropertyOrNull(String relOakPath)
+ throws RepositoryException {
+
+ Tree parent = getTree(PathUtils.getParentPath(relOakPath));
+ if (parent == null) {
+ return null;
+ }
+
+ String name = PathUtils.getName(relOakPath);
+ PropertyState propertyState = parent.getProperty(name);
+ return propertyState == null ? null : new PropertyDelegate(
+ sessionContext, parent, propertyState);
+ }
+
+ SessionContext getSessionContext() {
+ return sessionContext;
+ }
+
+ void remove() throws RepositoryException {
+ getTree().getParent().removeChild(getName());
+ }
+
+ PropertyDelegate setProperty(String oakName, CoreValue value)
+ throws RepositoryException {
+
+ getTree().setProperty(oakName, value);
+ return getPropertyOrNull(oakName);
+ }
+
+ PropertyDelegate setProperty(String oakName, List<CoreValue> value)
+ throws RepositoryException {
+
+ getTree().setProperty(oakName, value);
+ return getPropertyOrNull(oakName);
+ }
+
+ // -----------------------------------------------------------< private >---
+
+ private Tree getTree(String relPath) {
+ Tree tree = getTree();
+ for (String name : PathUtils.elements(relPath)) {
+ if (tree == null) {
+ return null;
+ }
+ tree = tree.getChild(name);
+ }
+ return tree;
+ }
+
+ private synchronized Tree getTree() {
+ return tree = sessionContext.getTree(tree.getPath());
+ }
+
+ private Iterator<NodeDelegate> nodeDelegateIterator(
+ Iterator<Tree> childNodeStates) {
+ return Iterators.map(childNodeStates,
+ new Function1<Tree, NodeDelegate>() {
+ @Override
+ public NodeDelegate apply(Tree state) {
+ return new NodeDelegate(sessionContext, state);
+ }
+ });
+ }
+
+ private Iterator<PropertyDelegate> propertyDelegateIterator(
+ Iterator<? extends PropertyState> properties) {
+ return Iterators.map(properties,
+ new Function1<PropertyState, PropertyDelegate>() {
+ @Override
+ public PropertyDelegate apply(PropertyState propertyState) {
+ return new PropertyDelegate(sessionContext, tree,
+ propertyState);
+ }
+ });
+ }
+}
Propchange: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/NodeDelegate.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/NodeImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/PropertyDelegate.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/PropertyDelegate.java?rev=1331450&r1=1331449&r2=1331450&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/PropertyDelegate.java (original)
+++ jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/PropertyDelegate.java Fri Apr 27 14:55:14 2012
@@ -1,179 +1,179 @@
-/*
- * 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;
-
-import org.apache.jackrabbit.oak.api.CoreValue;
-import org.apache.jackrabbit.oak.api.PropertyState;
-import org.apache.jackrabbit.oak.api.Tree;
-import org.apache.jackrabbit.oak.commons.PathUtils;
-import org.apache.jackrabbit.oak.namepath.Paths;
-
-import javax.jcr.RepositoryException;
-import javax.jcr.Value;
-import javax.jcr.nodetype.NodeType;
-import javax.jcr.nodetype.PropertyDefinition;
-import java.util.List;
-
-public class PropertyDelegate extends ItemDelegate {
-
- private final SessionContext sessionContext;
- private Tree parent;
- private PropertyState propertyState;
-
- PropertyDelegate(SessionContext sessionContext, Tree parent,
- PropertyState propertyState) {
- this.sessionContext = sessionContext;
- this.parent = parent;
- this.propertyState = propertyState;
- }
-
- PropertyDefinition getDefinition() throws RepositoryException {
- // TODO
- return new PropertyDefinition() {
-
- @Override
- public int getRequiredType() {
- return 0;
- }
-
- @Override
- public String[] getValueConstraints() {
- // TODO
- return new String[0];
- }
-
- @Override
- public Value[] getDefaultValues() {
- // TODO
- return new Value[0];
- }
-
- @Override
- public boolean isMultiple() {
- // TODO
- return propertyState.isArray();
- }
-
- @Override
- public String[] getAvailableQueryOperators() {
- // TODO
- return new String[0];
- }
-
- @Override
- public boolean isFullTextSearchable() {
- // TODO
- return false;
- }
-
- @Override
- public boolean isQueryOrderable() {
- // TODO
- return false;
- }
-
- @Override
- public NodeType getDeclaringNodeType() {
- // TODO
- return null;
- }
-
- @Override
- public String getName() {
- // TODO
- return propertyState.getName();
- }
-
- @Override
- public boolean isAutoCreated() {
- // TODO
- return false;
- }
-
- @Override
- public boolean isMandatory() {
- // TODO
- return false;
- }
-
- @Override
- public int getOnParentVersion() {
- // TODO
- return 0;
- }
-
- @Override
- public boolean isProtected() {
- // TODO
- return false;
- }
- };
- }
-
- void remove() throws RepositoryException {
- getParentContentTree().removeProperty(getName());
- }
-
- void setValue(CoreValue value) throws RepositoryException {
- getParentContentTree().setProperty(getName(), value);
- }
-
- void setValues(List<CoreValue> values) throws RepositoryException {
- getParentContentTree().setProperty(getName(), values);
- }
-
- Tree getParentContentTree() {
- resolve();
- return parent;
- }
-
- PropertyState getPropertyState() {
- resolve();
- return propertyState;
- }
-
- Tree.Status getPropertyStatus() {
- return getParentContentTree().getPropertyStatus(getName());
- }
-
- @Override
- String getName() {
- return getPropertyState().getName();
- }
-
- @Override
- String getPath() {
- return '/' + getParentContentTree().getPath() + '/' + getName();
- }
-
- SessionContext getSessionContext() {
- return sessionContext;
- }
-
- //------------------------------------------------------------< private >---
-
- private synchronized void resolve() {
- parent = sessionContext.getTree(parent.getPath());
- String path = PathUtils.concat(parent.getPath(), propertyState.getName());
-
- if (parent == null) {
- propertyState = null;
- } else {
- propertyState = parent.getProperty(PathUtils.getName(path));
- }
- }
-}
+/*
+ * 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;
+
+import org.apache.jackrabbit.oak.api.CoreValue;
+import org.apache.jackrabbit.oak.api.PropertyState;
+import org.apache.jackrabbit.oak.api.Tree;
+import org.apache.jackrabbit.oak.commons.PathUtils;
+import org.apache.jackrabbit.oak.namepath.Paths;
+
+import javax.jcr.RepositoryException;
+import javax.jcr.Value;
+import javax.jcr.nodetype.NodeType;
+import javax.jcr.nodetype.PropertyDefinition;
+import java.util.List;
+
+public class PropertyDelegate extends ItemDelegate {
+
+ private final SessionContext sessionContext;
+ private Tree parent;
+ private PropertyState propertyState;
+
+ PropertyDelegate(SessionContext sessionContext, Tree parent,
+ PropertyState propertyState) {
+ this.sessionContext = sessionContext;
+ this.parent = parent;
+ this.propertyState = propertyState;
+ }
+
+ PropertyDefinition getDefinition() throws RepositoryException {
+ // TODO
+ return new PropertyDefinition() {
+
+ @Override
+ public int getRequiredType() {
+ return 0;
+ }
+
+ @Override
+ public String[] getValueConstraints() {
+ // TODO
+ return new String[0];
+ }
+
+ @Override
+ public Value[] getDefaultValues() {
+ // TODO
+ return new Value[0];
+ }
+
+ @Override
+ public boolean isMultiple() {
+ // TODO
+ return propertyState.isArray();
+ }
+
+ @Override
+ public String[] getAvailableQueryOperators() {
+ // TODO
+ return new String[0];
+ }
+
+ @Override
+ public boolean isFullTextSearchable() {
+ // TODO
+ return false;
+ }
+
+ @Override
+ public boolean isQueryOrderable() {
+ // TODO
+ return false;
+ }
+
+ @Override
+ public NodeType getDeclaringNodeType() {
+ // TODO
+ return null;
+ }
+
+ @Override
+ public String getName() {
+ // TODO
+ return propertyState.getName();
+ }
+
+ @Override
+ public boolean isAutoCreated() {
+ // TODO
+ return false;
+ }
+
+ @Override
+ public boolean isMandatory() {
+ // TODO
+ return false;
+ }
+
+ @Override
+ public int getOnParentVersion() {
+ // TODO
+ return 0;
+ }
+
+ @Override
+ public boolean isProtected() {
+ // TODO
+ return false;
+ }
+ };
+ }
+
+ void remove() throws RepositoryException {
+ getParentContentTree().removeProperty(getName());
+ }
+
+ void setValue(CoreValue value) throws RepositoryException {
+ getParentContentTree().setProperty(getName(), value);
+ }
+
+ void setValues(List<CoreValue> values) throws RepositoryException {
+ getParentContentTree().setProperty(getName(), values);
+ }
+
+ Tree getParentContentTree() {
+ resolve();
+ return parent;
+ }
+
+ PropertyState getPropertyState() {
+ resolve();
+ return propertyState;
+ }
+
+ Tree.Status getPropertyStatus() {
+ return getParentContentTree().getPropertyStatus(getName());
+ }
+
+ @Override
+ String getName() {
+ return getPropertyState().getName();
+ }
+
+ @Override
+ String getPath() {
+ return '/' + getParentContentTree().getPath() + '/' + getName();
+ }
+
+ SessionContext getSessionContext() {
+ return sessionContext;
+ }
+
+ //------------------------------------------------------------< private >---
+
+ private synchronized void resolve() {
+ parent = sessionContext.getTree(parent.getPath());
+ String path = PathUtils.concat(parent.getPath(), propertyState.getName());
+
+ if (parent == null) {
+ propertyState = null;
+ } else {
+ propertyState = parent.getProperty(PathUtils.getName(path));
+ }
+ }
+}
Propchange: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/PropertyDelegate.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/PropertyImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/RepositoryImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/SessionImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/WorkspaceImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/namespace/NamespaceRegistryImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/namespace/NamespaceRegistryImpl.java?rev=1331450&r1=1331449&r2=1331450&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/namespace/NamespaceRegistryImpl.java (original)
+++ jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/namespace/NamespaceRegistryImpl.java Fri Apr 27 14:55:14 2012
@@ -1,113 +1,113 @@
-/*
- * 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.namespace;
-
-import javax.jcr.NamespaceException;
-import javax.jcr.NamespaceRegistry;
-import javax.jcr.RepositoryException;
-
-import org.apache.jackrabbit.oak.api.CommitFailedException;
-import org.apache.jackrabbit.oak.api.ContentSession;
-import org.apache.jackrabbit.oak.plugins.name.NamespaceMappings;
-
-/**
- * Implementation of {@link NamespaceRegistry} based on {@link NamespaceMappings}.
- */
-public class NamespaceRegistryImpl implements NamespaceRegistry {
-
- private final NamespaceMappings nsMappings;
-
- public NamespaceRegistryImpl(ContentSession session) {
- this.nsMappings = new NamespaceMappings(session);
- }
-
- //--------------------------------------------------< NamespaceRegistry >---
- @Override
- public void registerNamespace(String prefix, String uri)
- throws RepositoryException {
- try {
- nsMappings.registerNamespace(prefix, uri);
- } catch (CommitFailedException e) {
- throw new RepositoryException(
- "Failed to register namespace mapping from "
- + prefix + " to " + uri, e);
- }
- }
-
- @Override
- public void unregisterNamespace(String prefix) throws RepositoryException {
- try {
- nsMappings.unregisterNamespace(prefix);
- } catch (CommitFailedException e) {
- throw new RepositoryException(
- "Failed to unregister a namespace mapping with prefix "
- + prefix, e);
- }
- }
-
- @Override
- public String[] getPrefixes() throws RepositoryException {
- try {
- return nsMappings.getPrefixes();
- } catch (RuntimeException e) {
- throw new RepositoryException(
- "Failed to retrieve registered namespace prefixes", e);
- }
- }
-
- @Override
- public String[] getURIs() throws RepositoryException {
- try {
- return nsMappings.getURIs();
- } catch (RuntimeException e) {
- throw new RepositoryException(
- "Failed to retrieve registered namespace URIs", e);
- }
- }
-
- @Override
- public String getURI(String prefix) throws RepositoryException {
- try {
- String uri = nsMappings.getURI(prefix);
- if (uri == null) {
- throw new NamespaceException(
- "No namespace registered for prefix " + prefix);
- }
- return uri;
- } catch (RuntimeException e) {
- throw new RepositoryException(
- "Failed to retrieve the namespace URI for prefix "
- + prefix, e);
- }
- }
-
- @Override
- public String getPrefix(String uri) throws RepositoryException {
- try {
- String prefix = nsMappings.getPrefix(uri);
- if (prefix == null) {
- throw new NamespaceException(
- "No namespace registered for prefix " + prefix);
- }
- return prefix;
- } catch (RuntimeException e) {
- throw new RepositoryException(
- "Failed to retrieve the namespace prefix for URI "
- + uri, e);
- }
- }
-}
+/*
+ * 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.namespace;
+
+import javax.jcr.NamespaceException;
+import javax.jcr.NamespaceRegistry;
+import javax.jcr.RepositoryException;
+
+import org.apache.jackrabbit.oak.api.CommitFailedException;
+import org.apache.jackrabbit.oak.api.ContentSession;
+import org.apache.jackrabbit.oak.plugins.name.NamespaceMappings;
+
+/**
+ * Implementation of {@link NamespaceRegistry} based on {@link NamespaceMappings}.
+ */
+public class NamespaceRegistryImpl implements NamespaceRegistry {
+
+ private final NamespaceMappings nsMappings;
+
+ public NamespaceRegistryImpl(ContentSession session) {
+ this.nsMappings = new NamespaceMappings(session);
+ }
+
+ //--------------------------------------------------< NamespaceRegistry >---
+ @Override
+ public void registerNamespace(String prefix, String uri)
+ throws RepositoryException {
+ try {
+ nsMappings.registerNamespace(prefix, uri);
+ } catch (CommitFailedException e) {
+ throw new RepositoryException(
+ "Failed to register namespace mapping from "
+ + prefix + " to " + uri, e);
+ }
+ }
+
+ @Override
+ public void unregisterNamespace(String prefix) throws RepositoryException {
+ try {
+ nsMappings.unregisterNamespace(prefix);
+ } catch (CommitFailedException e) {
+ throw new RepositoryException(
+ "Failed to unregister a namespace mapping with prefix "
+ + prefix, e);
+ }
+ }
+
+ @Override
+ public String[] getPrefixes() throws RepositoryException {
+ try {
+ return nsMappings.getPrefixes();
+ } catch (RuntimeException e) {
+ throw new RepositoryException(
+ "Failed to retrieve registered namespace prefixes", e);
+ }
+ }
+
+ @Override
+ public String[] getURIs() throws RepositoryException {
+ try {
+ return nsMappings.getURIs();
+ } catch (RuntimeException e) {
+ throw new RepositoryException(
+ "Failed to retrieve registered namespace URIs", e);
+ }
+ }
+
+ @Override
+ public String getURI(String prefix) throws RepositoryException {
+ try {
+ String uri = nsMappings.getURI(prefix);
+ if (uri == null) {
+ throw new NamespaceException(
+ "No namespace registered for prefix " + prefix);
+ }
+ return uri;
+ } catch (RuntimeException e) {
+ throw new RepositoryException(
+ "Failed to retrieve the namespace URI for prefix "
+ + prefix, e);
+ }
+ }
+
+ @Override
+ public String getPrefix(String uri) throws RepositoryException {
+ try {
+ String prefix = nsMappings.getPrefix(uri);
+ if (prefix == null) {
+ throw new NamespaceException(
+ "No namespace registered for prefix " + prefix);
+ }
+ return prefix;
+ } catch (RuntimeException e) {
+ throw new RepositoryException(
+ "Failed to retrieve the namespace prefix for URI "
+ + uri, e);
+ }
+ }
+}
Propchange: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/namespace/NamespaceRegistryImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/nodetype/ItemDefinitionImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/nodetype/NodeDefinitionImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/nodetype/NodeTypeImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/nodetype/NodeTypeManagerImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/nodetype/PropertyDefinitionImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/osgi/Activator.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/query/QueryImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/query/QueryManagerImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/query/QueryResultImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/query/RowImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/query/qom/AndImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/query/qom/BindVariableValueImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/query/qom/ChildNodeImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/query/qom/ChildNodeJoinConditionImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/query/qom/ColumnImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/query/qom/ComparisonImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/query/qom/ConstraintImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/query/qom/DescendantNodeImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/query/qom/DescendantNodeJoinConditionImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/query/qom/DynamicOperandImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/query/qom/EquiJoinConditionImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/query/qom/FullTextSearchImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/query/qom/FullTextSearchScoreImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/query/qom/JoinConditionImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/query/qom/JoinImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/query/qom/JoinType.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/query/qom/LengthImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/query/qom/LiteralImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/query/qom/LowerCaseImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/query/qom/NodeLocalNameImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/query/qom/NodeNameImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/query/qom/NotImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/query/qom/Operator.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/query/qom/Operator.java?rev=1331450&r1=1331449&r2=1331450&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/query/qom/Operator.java (original)
+++ jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/query/qom/Operator.java Fri Apr 27 14:55:14 2012
@@ -1,160 +1,160 @@
-/*
- * 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.query.qom;
-
-import javax.jcr.RepositoryException;
-import javax.jcr.query.qom.Comparison;
-import javax.jcr.query.qom.DynamicOperand;
-import javax.jcr.query.qom.QueryObjectModelConstants;
-import javax.jcr.query.qom.QueryObjectModelFactory;
-import javax.jcr.query.qom.StaticOperand;
-
-/**
- * Enumeration of the JCR 2.0 query operators.
- *
- * @since Apache Jackrabbit 2.0
- */
-public enum Operator {
-
- EQ(QueryObjectModelConstants.JCR_OPERATOR_EQUAL_TO, "="),
-
- NE(QueryObjectModelConstants.JCR_OPERATOR_NOT_EQUAL_TO, "!=", "<>"),
-
- GT(QueryObjectModelConstants.JCR_OPERATOR_GREATER_THAN, ">"),
-
- GE(QueryObjectModelConstants.JCR_OPERATOR_GREATER_THAN_OR_EQUAL_TO, ">="),
-
- LT(QueryObjectModelConstants.JCR_OPERATOR_LESS_THAN, "<"),
-
- LE(QueryObjectModelConstants.JCR_OPERATOR_LESS_THAN_OR_EQUAL_TO, "<="),
-
- LIKE(QueryObjectModelConstants.JCR_OPERATOR_LIKE, null, "like");
-
- /**
- * JCR name of this operator.
- */
- private final String name;
-
- /**
- * This operator in XPath syntax.
- */
- private final String xpath;
-
- /**
- * This operator in SQL syntax.
- */
- private final String sql;
-
- Operator(String name, String op) {
- this(name, op, op);
- }
-
- Operator(String name, String xpath, String sql) {
- this.name = name;
- this.xpath = xpath;
- this.sql = sql;
- }
-
- /**
- * Returns a comparison between the given operands using this operator.
- *
- * @param factory factory for creating the comparison
- * @param left operand on the left hand side
- * @param right operand on the right hand side
- * @return comparison
- * @throws RepositoryException if the comparison can not be created
- */
- public Comparison comparison(
- QueryObjectModelFactory factory,
- DynamicOperand left, StaticOperand right)
- throws RepositoryException {
- return factory.comparison(left, name, right);
- }
-
- /**
- * Formats an XPath constraint with this operator and the given operands.
- * The operands are simply used as-is, without any quoting or escaping.
- *
- * @param a first operand
- * @param b second operand
- * @return XPath constraint, {@code a op b} or
- * {@code jcr:like(a, b)} for {@link #LIKE}
- */
- public String formatXpath(String a, String b) {
- if (this == LIKE) {
- return "jcr:like(" + a + ", " + b + ')';
- } else {
- return a + ' ' + xpath + ' ' + b;
- }
- }
-
- /**
- * Formats an SQL constraint with this operator and the given operands.
- * The operands are simply used as-is, without any quoting or escaping.
- *
- * @param a first operand
- * @param b second operand
- * @return SQL constraint, {@code a op b}
- */
- public String formatSql(String a, String b) {
- return a + ' ' + sql + ' ' + b;
- }
-
- /**
- * Returns the JCR 2.0 name of this query operator.
- *
- * @see QueryObjectModelConstants
- * @return JCR name of this operator
- */
- @Override
- public String toString() {
- return name;
- }
-
- /**
- * Returns an array of the names of all the JCR 2.0 query operators.
- *
- * @return names of all query operators
- */
- public static String[] getAllQueryOperators() {
- return new String[] {
- EQ.toString(),
- NE.toString(),
- GT.toString(),
- GE.toString(),
- LT.toString(),
- LE.toString(),
- LIKE.toString()
- };
- }
-
- /**
- * Returns the operator with the given JCR name.
- *
- * @param name JCR name of an operator
- * @return operator with the given name
- */
- public static Operator getOperatorByName(String name) {
- for (Operator operator : Operator.values()) {
- if (operator.name.equals(name)) {
- return operator;
- }
- }
- throw new IllegalArgumentException("Unknown operator name: " + name);
- }
-
-}
+/*
+ * 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.query.qom;
+
+import javax.jcr.RepositoryException;
+import javax.jcr.query.qom.Comparison;
+import javax.jcr.query.qom.DynamicOperand;
+import javax.jcr.query.qom.QueryObjectModelConstants;
+import javax.jcr.query.qom.QueryObjectModelFactory;
+import javax.jcr.query.qom.StaticOperand;
+
+/**
+ * Enumeration of the JCR 2.0 query operators.
+ *
+ * @since Apache Jackrabbit 2.0
+ */
+public enum Operator {
+
+ EQ(QueryObjectModelConstants.JCR_OPERATOR_EQUAL_TO, "="),
+
+ NE(QueryObjectModelConstants.JCR_OPERATOR_NOT_EQUAL_TO, "!=", "<>"),
+
+ GT(QueryObjectModelConstants.JCR_OPERATOR_GREATER_THAN, ">"),
+
+ GE(QueryObjectModelConstants.JCR_OPERATOR_GREATER_THAN_OR_EQUAL_TO, ">="),
+
+ LT(QueryObjectModelConstants.JCR_OPERATOR_LESS_THAN, "<"),
+
+ LE(QueryObjectModelConstants.JCR_OPERATOR_LESS_THAN_OR_EQUAL_TO, "<="),
+
+ LIKE(QueryObjectModelConstants.JCR_OPERATOR_LIKE, null, "like");
+
+ /**
+ * JCR name of this operator.
+ */
+ private final String name;
+
+ /**
+ * This operator in XPath syntax.
+ */
+ private final String xpath;
+
+ /**
+ * This operator in SQL syntax.
+ */
+ private final String sql;
+
+ Operator(String name, String op) {
+ this(name, op, op);
+ }
+
+ Operator(String name, String xpath, String sql) {
+ this.name = name;
+ this.xpath = xpath;
+ this.sql = sql;
+ }
+
+ /**
+ * Returns a comparison between the given operands using this operator.
+ *
+ * @param factory factory for creating the comparison
+ * @param left operand on the left hand side
+ * @param right operand on the right hand side
+ * @return comparison
+ * @throws RepositoryException if the comparison can not be created
+ */
+ public Comparison comparison(
+ QueryObjectModelFactory factory,
+ DynamicOperand left, StaticOperand right)
+ throws RepositoryException {
+ return factory.comparison(left, name, right);
+ }
+
+ /**
+ * Formats an XPath constraint with this operator and the given operands.
+ * The operands are simply used as-is, without any quoting or escaping.
+ *
+ * @param a first operand
+ * @param b second operand
+ * @return XPath constraint, {@code a op b} or
+ * {@code jcr:like(a, b)} for {@link #LIKE}
+ */
+ public String formatXpath(String a, String b) {
+ if (this == LIKE) {
+ return "jcr:like(" + a + ", " + b + ')';
+ } else {
+ return a + ' ' + xpath + ' ' + b;
+ }
+ }
+
+ /**
+ * Formats an SQL constraint with this operator and the given operands.
+ * The operands are simply used as-is, without any quoting or escaping.
+ *
+ * @param a first operand
+ * @param b second operand
+ * @return SQL constraint, {@code a op b}
+ */
+ public String formatSql(String a, String b) {
+ return a + ' ' + sql + ' ' + b;
+ }
+
+ /**
+ * Returns the JCR 2.0 name of this query operator.
+ *
+ * @see QueryObjectModelConstants
+ * @return JCR name of this operator
+ */
+ @Override
+ public String toString() {
+ return name;
+ }
+
+ /**
+ * Returns an array of the names of all the JCR 2.0 query operators.
+ *
+ * @return names of all query operators
+ */
+ public static String[] getAllQueryOperators() {
+ return new String[] {
+ EQ.toString(),
+ NE.toString(),
+ GT.toString(),
+ GE.toString(),
+ LT.toString(),
+ LE.toString(),
+ LIKE.toString()
+ };
+ }
+
+ /**
+ * Returns the operator with the given JCR name.
+ *
+ * @param name JCR name of an operator
+ * @return operator with the given name
+ */
+ public static Operator getOperatorByName(String name) {
+ for (Operator operator : Operator.values()) {
+ if (operator.name.equals(name)) {
+ return operator;
+ }
+ }
+ throw new IllegalArgumentException("Unknown operator name: " + name);
+ }
+
+}
Propchange: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/query/qom/Operator.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/query/qom/OrImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/query/qom/Order.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/query/qom/OrderingImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/query/qom/PropertyExistenceImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/query/qom/PropertyValueImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/query/qom/QOMNode.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/query/qom/QOMVisitor.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/query/qom/QueryObjectModelFactoryImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/query/qom/QueryObjectModelImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/query/qom/SameNodeImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/query/qom/SameNodeJoinConditionImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/query/qom/SelectorImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/query/qom/SourceImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/query/qom/StaticOperandImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/query/qom/UpperCaseImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/security/principal/PrincipalIteratorAdapter.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/security/privileges/PrivilegeManagerImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/security/privileges/diff.txt
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/security/user/AuthorizableImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/security/user/AuthorizableNodeCreator.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/security/user/GroupImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/security/user/ImpersonationImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/security/user/ItemBasedPrincipalImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/security/user/PasswordUtility.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/security/user/UserImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/security/user/UserManagerConfig.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/security/user/UserManagerImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/security/user/action/AuthorizableAction.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/security/user/diff.txt
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/util/LogUtil.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/value/BinaryImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/value/ValueFactoryImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/value/ValueImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: jackrabbit/oak/trunk/oak-jcr/src/main/resources/META-INF/services/javax.jcr.RepositoryFactory
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/main/resources/META-INF/services/javax.jcr.RepositoryFactory?rev=1331450&r1=1331449&r2=1331450&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/main/resources/META-INF/services/javax.jcr.RepositoryFactory (original)
+++ jackrabbit/oak/trunk/oak-jcr/src/main/resources/META-INF/services/javax.jcr.RepositoryFactory Fri Apr 27 14:55:14 2012
@@ -1,16 +1,16 @@
-# 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.
-
-org.apache.jackrabbit.oak.jcr.OakRepositoryFactory
+# 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.
+
+org.apache.jackrabbit.oak.jcr.OakRepositoryFactory
Propchange: jackrabbit/oak/trunk/oak-jcr/src/main/resources/META-INF/services/javax.jcr.RepositoryFactory
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: jackrabbit/oak/trunk/oak-jcr/src/main/resources/org/apache/jackrabbit/oak/jcr/nodetype/builtin_nodetypes.cnd
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/AbstractRepositoryTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/CompatibilityIssuesTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/query/QueryTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/query/qom/QomTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: jackrabbit/oak/trunk/oak-jcr/src/test/java/util/NumberStream.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: jackrabbit/oak/trunk/oak-mk/src/main/java/org/apache/jackrabbit/mk/api/package-info.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: jackrabbit/oak/trunk/oak-mk/src/main/java/org/apache/jackrabbit/mk/blobs/BlobStore.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: jackrabbit/oak/trunk/oak-mk/src/main/java/org/apache/jackrabbit/mk/json/package-info.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: jackrabbit/oak/trunk/oak-mk/src/main/java/org/apache/jackrabbit/mk/model/DiffBuilder.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: jackrabbit/oak/trunk/oak-mk/src/main/java/org/apache/jackrabbit/mk/model/Node.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: jackrabbit/oak/trunk/oak-mk/src/main/java/org/apache/jackrabbit/mk/model/NodeDiffHandler.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: jackrabbit/oak/trunk/oak-mk/src/main/java/org/apache/jackrabbit/mk/osgi/Activator.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: jackrabbit/oak/trunk/oak-mk/src/main/java/org/apache/jackrabbit/mk/store/AbstractRevisionStore.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: jackrabbit/oak/trunk/oak-mk/src/main/java/org/apache/jackrabbit/mk/store/NotFoundException.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: jackrabbit/oak/trunk/oak-mk/src/main/java/org/apache/jackrabbit/mk/util/package-info.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: jackrabbit/oak/trunk/oak-mk/src/test/java/org/apache/jackrabbit/mk/util/MicroKernelInputStreamTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: jackrabbit/oak/trunk/oak-mk/src/test/resources/org/apache/jackrabbit/mk/json/test.json
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: jackrabbit/oak/trunk/oak-run/src/main/resources/logback.xml
------------------------------------------------------------------------------
svn:eol-style = native
Modified: jackrabbit/oak/trunk/oak-run/src/test/java/org/apache/jackrabbit/oak/run/BasicServerTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-run/src/test/java/org/apache/jackrabbit/oak/run/BasicServerTest.java?rev=1331450&r1=1331449&r2=1331450&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-run/src/test/java/org/apache/jackrabbit/oak/run/BasicServerTest.java (original)
+++ jackrabbit/oak/trunk/oak-run/src/test/java/org/apache/jackrabbit/oak/run/BasicServerTest.java Fri Apr 27 14:55:14 2012
@@ -1,54 +1,54 @@
-/*
- * 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.run;
-
-import java.net.HttpURLConnection;
-import java.net.URL;
-
-import org.apache.jackrabbit.util.Base64;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-import static org.junit.Assert.assertEquals;
-
-public class BasicServerTest {
-
- private Main.HttpServer server;
-
- @Before
- public void startServer() throws Exception {
- server = new Main.HttpServer(Main.URI, new String[0]);
- server.start();
- }
-
- @After
- public void stopServer() throws Exception {
- server.stop();
- }
-
- @Test
- public void testServerOk() throws Exception {
-
- URL server = new URL(Main.URI);
- HttpURLConnection conn = (HttpURLConnection) server.openConnection();
- conn.setRequestProperty("Authorization",
- "Basic " + Base64.encode("a:a"));
- assertEquals(200, conn.getResponseCode());
- }
-}
+/*
+ * 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.run;
+
+import java.net.HttpURLConnection;
+import java.net.URL;
+
+import org.apache.jackrabbit.util.Base64;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import static org.junit.Assert.assertEquals;
+
+public class BasicServerTest {
+
+ private Main.HttpServer server;
+
+ @Before
+ public void startServer() throws Exception {
+ server = new Main.HttpServer(Main.URI, new String[0]);
+ server.start();
+ }
+
+ @After
+ public void stopServer() throws Exception {
+ server.stop();
+ }
+
+ @Test
+ public void testServerOk() throws Exception {
+
+ URL server = new URL(Main.URI);
+ HttpURLConnection conn = (HttpURLConnection) server.openConnection();
+ conn.setRequestProperty("Authorization",
+ "Basic " + Base64.encode("a:a"));
+ assertEquals(200, conn.getResponseCode());
+ }
+}
Propchange: jackrabbit/oak/trunk/oak-run/src/test/java/org/apache/jackrabbit/oak/run/BasicServerTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: jackrabbit/oak/trunk/oak-sling/pom.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: jackrabbit/oak/trunk/oak-sling/src/main/java/org/apache/jackrabbit/oak/sling/Activator.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: jackrabbit/oak/trunk/oak-sling/src/main/java/org/apache/jackrabbit/oak/sling/SlingRepositoryImpl.java
------------------------------------------------------------------------------
svn:eol-style = native