jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From thom...@apache.org
Subject svn commit: r1167243 - in /jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi2microkernel/src/main/java/org/apache/jackrabbit/spi2microkernel: QueryInfoImpl.java RepositoryServiceImpl.java
Date Fri, 09 Sep 2011 15:19:55 GMT
Author: thomasm
Date: Fri Sep  9 15:19:55 2011
New Revision: 1167243

URL: http://svn.apache.org/viewvc?rev=1167243&view=rev
Log:
Pretend to run queries (log them as warning) instead of throwing an exception.
Synchronize registering and unregistering namespaces and node types.

Added:
    jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi2microkernel/src/main/java/org/apache/jackrabbit/spi2microkernel/QueryInfoImpl.java
Modified:
    jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi2microkernel/src/main/java/org/apache/jackrabbit/spi2microkernel/RepositoryServiceImpl.java

Added: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi2microkernel/src/main/java/org/apache/jackrabbit/spi2microkernel/QueryInfoImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi2microkernel/src/main/java/org/apache/jackrabbit/spi2microkernel/QueryInfoImpl.java?rev=1167243&view=auto
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi2microkernel/src/main/java/org/apache/jackrabbit/spi2microkernel/QueryInfoImpl.java
(added)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi2microkernel/src/main/java/org/apache/jackrabbit/spi2microkernel/QueryInfoImpl.java
Fri Sep  9 15:19:55 2011
@@ -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.spi2microkernel;
+
+import javax.jcr.RangeIterator;
+import org.apache.jackrabbit.spi.Name;
+import org.apache.jackrabbit.spi.QueryInfo;
+
+/**
+ * A query result.
+ */
+public class QueryInfoImpl implements QueryInfo {
+
+    @Override
+    public String[] getColumnNames() {
+        return new String[0];
+    }
+
+    @Override
+    public RangeIterator getRows() {
+        return new RangeIterator() {
+
+            @Override
+            public long getPosition() {
+                return 0;
+            }
+
+            @Override
+            public long getSize() {
+                return 0;
+            }
+
+            @Override
+            public void skip(long x) {
+                // ignore
+            }
+
+            @Override
+            public boolean hasNext() {
+                return false;
+            }
+
+            @Override
+            public Object next() {
+                return null;
+            }
+
+            @Override
+            public void remove() {
+                throw new UnsupportedOperationException();
+            }
+
+        };
+    }
+
+    @Override
+    public Name[] getSelectorNames() {
+        return new Name[0];
+    }
+
+}

Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi2microkernel/src/main/java/org/apache/jackrabbit/spi2microkernel/RepositoryServiceImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi2microkernel/src/main/java/org/apache/jackrabbit/spi2microkernel/RepositoryServiceImpl.java?rev=1167243&r1=1167242&r2=1167243&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi2microkernel/src/main/java/org/apache/jackrabbit/spi2microkernel/RepositoryServiceImpl.java
(original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi2microkernel/src/main/java/org/apache/jackrabbit/spi2microkernel/RepositoryServiceImpl.java
Fri Sep  9 15:19:55 2011
@@ -42,6 +42,7 @@ import org.apache.jackrabbit.spi.Propert
 import org.apache.jackrabbit.spi.QNodeDefinition;
 import org.apache.jackrabbit.spi.QNodeTypeDefinition;
 import org.apache.jackrabbit.spi.QValue;
+import org.apache.jackrabbit.spi.QueryInfo;
 import org.apache.jackrabbit.spi.SessionInfo;
 import org.apache.jackrabbit.spi.Subscription;
 import org.apache.jackrabbit.spi.commons.AbstractRepositoryService;
@@ -69,6 +70,8 @@ import javax.jcr.PathNotFoundException;
 import javax.jcr.PropertyType;
 import javax.jcr.RepositoryException;
 import javax.jcr.UnsupportedRepositoryOperationException;
+import javax.jcr.query.InvalidQueryException;
+import javax.jcr.query.Query;
 import javax.jcr.version.OnParentVersionAction;
 import java.io.IOException;
 import java.io.InputStream;
@@ -128,6 +131,7 @@ public class RepositoryServiceImpl exten
     private static final long BINARY_VALUE_INLINE_THRESHOLD = 0x1000;
     private static final String DEFAULT_DEFAULT_WORKSPACE = "default";
     private static final String DEFAULT_SYSTEM_WORKSPACE = "system";
+    private static final String[] SUPPORTED_LANGUAGES = new String[]{Query.SQL, Query.JCR_JQOM,
Query.JCR_SQL2, Query.XPATH};
 
     static final Logger log = LoggerFactory.getLogger(RepositoryServiceImpl.class);
 
@@ -463,7 +467,7 @@ public class RepositoryServiceImpl exten
     //------------------------------------------< Node type management >---
 
     @Override
-    public void registerNodeTypes(SessionInfo sessionInfo, QNodeTypeDefinition[] nodeTypeDefinitions,
boolean allowUpdate)
+    public synchronized void registerNodeTypes(SessionInfo sessionInfo, QNodeTypeDefinition[]
nodeTypeDefinitions, boolean allowUpdate)
             throws RepositoryException {
 
         nodeTypeDefs.registerNodeTypes(nodeTypeDefinitions, true);
@@ -471,7 +475,7 @@ public class RepositoryServiceImpl exten
     }
 
     @Override
-    public void unregisterNodeTypes(SessionInfo sessionInfo, Name[] nodeTypeNames) throws
RepositoryException {
+    public synchronized void unregisterNodeTypes(SessionInfo sessionInfo, Name[] nodeTypeNames)
throws RepositoryException {
         nodeTypeDefs.unregisterNodeTypes(nodeTypeNames);
         nodeTypeStore.write(namespaces, nodeTypeDefs);
     }
@@ -490,7 +494,7 @@ public class RepositoryServiceImpl exten
     }};
 
     @Override
-    public void registerNamespace(SessionInfo sessionInfo, String prefix, String uri) throws
RepositoryException {
+    public synchronized void registerNamespace(SessionInfo sessionInfo, String prefix, String
uri) throws RepositoryException {
         if (namespaces.hasPrefix(prefix)) {
             String existingUri = namespaces.getURI(prefix);
             if (RESERVED_NS.contains(existingUri)) {
@@ -507,7 +511,7 @@ public class RepositoryServiceImpl exten
     }
 
     @Override
-    public void unregisterNamespace(SessionInfo sessionInfo, String uri) throws RepositoryException
{
+    public synchronized void unregisterNamespace(SessionInfo sessionInfo, String uri) throws
RepositoryException {
         if (RESERVED_NS.contains(uri)) {
             throw new NamespaceException("Cannot register reserved namespace: " + uri);
         }
@@ -698,7 +702,7 @@ public class RepositoryServiceImpl exten
             return new QBinaryValue(blobId, microKernel);
         }
     };
-    
+
     private class CommitBuilder implements Batch {
 
         private final SessionInfo sessionInfo;
@@ -862,4 +866,28 @@ public class RepositoryServiceImpl exten
         }
     }
 
+
+    public String[] getSupportedQueryLanguages(SessionInfo sessionInfo) throws RepositoryException
{
+        checkSessionInfo(sessionInfo);
+        return SUPPORTED_LANGUAGES;
+        // throw new UnsupportedRepositoryOperationException();
+    }
+
+    public String[] checkQueryStatement(SessionInfo sessionInfo, String statement,
+                                    String language, Map<String, String> namespaces)
throws
+            InvalidQueryException, RepositoryException {
+        checkSessionInfo(sessionInfo);
+        log.warn("checkQueryStatement " + language + " " + statement);
+        return new String[0];
+        // throw new UnsupportedRepositoryOperationException();
+    }
+
+    public QueryInfo executeQuery(SessionInfo sessionInfo, String statement,
+                                  String language, Map<String, String> namespaces,
long limit,
+                                  long offset, Map<String, QValue> values) throws RepositoryException
{
+        checkSessionInfo(sessionInfo);
+        log.warn("executeQuery " + language + " " + statement);
+        return new QueryInfoImpl();
+    }
+
 }



Mime
View raw message