jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ang...@apache.org
Subject svn commit: r421270 [23/23] - in /jackrabbit/trunk/contrib/spi: ./ commons/ commons/src/ commons/src/main/ commons/src/main/java/ commons/src/main/java/org/ commons/src/main/java/org/apache/ commons/src/main/java/org/apache/jackrabbit/ commons/src/main...
Date Wed, 12 Jul 2006 13:33:27 GMT
Propchange: jackrabbit/trunk/contrib/spi/spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/RepositoryServiceImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jackrabbit/trunk/contrib/spi/spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/RepositoryServiceImpl.java
------------------------------------------------------------------------------
    svn:keywords = author date id revision url

Added: jackrabbit/trunk/contrib/spi/spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/SessionInfoImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/SessionInfoImpl.java?rev=421270&view=auto
==============================================================================
--- jackrabbit/trunk/contrib/spi/spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/SessionInfoImpl.java
(added)
+++ jackrabbit/trunk/contrib/spi/spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/SessionInfoImpl.java
Wed Jul 12 06:33:19 2006
@@ -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.spi2dav;
+
+import org.slf4j.LoggerFactory;
+import org.slf4j.Logger;
+
+import org.apache.jackrabbit.spi.SessionInfo;
+import javax.jcr.Credentials;
+import javax.security.auth.Subject;
+import java.util.HashSet;
+import java.util.Set;
+
+/**
+ * <code>SessionInfoImpl</code>...
+ */
+public class SessionInfoImpl implements SessionInfo {
+
+    private static Logger log = LoggerFactory.getLogger(SessionInfoImpl.class);
+
+    private final Subject subject;
+    private final String workspaceName;
+    private String batchId;
+
+    private final Set lockTokens = new HashSet();
+
+    SessionInfoImpl(Credentials creds, String workspaceName) {
+        Set publicCreds = new HashSet();
+        if (creds != null) {
+            publicCreds.add(creds);
+        }
+        this.subject = new Subject(false, new HashSet(), publicCreds, new HashSet());
+        this.workspaceName = workspaceName;
+    }
+
+    public Subject getSubject() {
+        return subject;
+    }
+
+    public String getWorkspaceName() {
+        return workspaceName;
+    }
+
+    public String[] getLockTokens() {
+        return (String[]) lockTokens.toArray(new String[lockTokens.size()]);
+    }
+
+    public void addLockToken(String lockToken) {
+        lockTokens.add(lockToken);
+    }
+
+    public void removeLockToken(String lockToken) {
+        lockTokens.remove(lockToken);
+    }
+
+    public String getBatchId() {
+        return batchId;
+    }
+
+    public void setBatchId(String id) {
+        batchId = id;
+    }
+}
\ No newline at end of file

Propchange: jackrabbit/trunk/contrib/spi/spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/SessionInfoImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jackrabbit/trunk/contrib/spi/spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/SessionInfoImpl.java
------------------------------------------------------------------------------
    svn:keywords = author date id revision url

Added: jackrabbit/trunk/contrib/spi/spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/URIResolver.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/URIResolver.java?rev=421270&view=auto
==============================================================================
--- jackrabbit/trunk/contrib/spi/spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/URIResolver.java
(added)
+++ jackrabbit/trunk/contrib/spi/spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/URIResolver.java
Wed Jul 12 06:33:19 2006
@@ -0,0 +1,49 @@
+/*
+ * 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.spi2dav;
+
+import org.apache.jackrabbit.name.NamespaceResolver;
+import org.apache.jackrabbit.webdav.MultiStatusResponse;
+import org.apache.jackrabbit.spi.NodeId;
+import org.apache.jackrabbit.spi.PropertyId;
+import org.apache.jackrabbit.name.Path;
+import org.apache.jackrabbit.spi.SessionInfo;
+
+import javax.jcr.RepositoryException;
+
+/**
+ * <code>URIResolver</code> used to build HTTP compliant request URIs from
+ * a given ItemId.
+ * This includes:
+ * <ul>
+ * <li>converting qualified names consisting of {uri}localName to URI compliant jcr
names</li>
+ * <li>adding trailing base (repository) uri and workspace name in order to form the
proper url</li>
+ * </ul>
+ */
+// todo: namespace resolver needed for the remapping. potential consistency problems with
NamespaceRegistryImpl in jcr2spi layer?
+interface URIResolver extends NamespaceResolver {
+
+    Path getQPath(String uri, SessionInfo sessionInfo) throws RepositoryException;
+
+    NodeId getNodeId(NodeId parentId, MultiStatusResponse response) throws RepositoryException;
+
+    NodeId getNodeId(String uri, SessionInfo sessionInfo) throws RepositoryException;
+
+    PropertyId getPropertyId(NodeId parentId, MultiStatusResponse response) throws RepositoryException;
+
+    PropertyId getPropertyId(String uri, SessionInfo sessionInfo) throws RepositoryException;
+}
\ No newline at end of file

Propchange: jackrabbit/trunk/contrib/spi/spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/URIResolver.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jackrabbit/trunk/contrib/spi/spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/URIResolver.java
------------------------------------------------------------------------------
    svn:keywords = author date id revision url

Added: jackrabbit/trunk/contrib/spi/spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/ValueFactoryImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/ValueFactoryImpl.java?rev=421270&view=auto
==============================================================================
--- jackrabbit/trunk/contrib/spi/spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/ValueFactoryImpl.java
(added)
+++ jackrabbit/trunk/contrib/spi/spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/ValueFactoryImpl.java
Wed Jul 12 06:33:19 2006
@@ -0,0 +1,138 @@
+/*
+ * 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.spi2dav;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.jcr.Value;
+import javax.jcr.Node;
+import javax.jcr.RepositoryException;
+import javax.jcr.ValueFormatException;
+import javax.jcr.PropertyType;
+import javax.jcr.ValueFactory;
+import java.util.Calendar;
+import java.io.InputStream;
+
+/**
+ * <code>ValueFactoryImpl</code>...
+ */
+public class ValueFactoryImpl implements ValueFactory {
+
+    private static Logger log = LoggerFactory.getLogger(ValueFactoryImpl.class);
+
+    private static final ValueFactory factory = new ValueFactoryImpl();
+
+    /**
+     * Delegatee for all calls except for REFERENCE values.
+     */
+    private final ValueFactory commonsFactory = org.apache.jackrabbit.value.ValueFactoryImpl.getInstance();
+
+    /**
+     * Constructs a <code>ValueFactory</code> object.
+     */
+    private ValueFactoryImpl() {
+    }
+
+    public static ValueFactory getInstance() {
+        return factory;
+    }
+
+    public Value createValue(Node value) throws RepositoryException {
+        return new ReferenceValue(value);
+    }
+
+    public Value createValue(String string) {
+        return commonsFactory.createValue(string);
+    }
+
+    public Value createValue(String value, int type) throws ValueFormatException {
+        Value val;
+        switch (type) {
+            case PropertyType.REFERENCE:
+                val = ReferenceValue.valueOf(value);
+                break;
+            default:
+                val = commonsFactory.createValue(value, type);
+        }
+        return val;
+    }
+
+    public Value createValue(long l) {
+        return commonsFactory.createValue(l);
+    }
+
+    public Value createValue(double v) {
+        return commonsFactory.createValue(v);
+    }
+
+    public Value createValue(boolean b) {
+        return commonsFactory.createValue(b);
+    }
+
+    public Value createValue(Calendar calendar) {
+        return commonsFactory.createValue(calendar);
+    }
+
+    public Value createValue(InputStream inputStream) {
+        return commonsFactory.createValue(inputStream);
+    }
+
+    /**
+     * A <code>ReferenceValue</code> provides an implementation
+     * of the <code>Value</code> interface representing a <code>REFERENCE</code>
value
+     * (a UUID of an existing node).
+     */
+    private static class ReferenceValue extends org.apache.jackrabbit.value.ReferenceValue
{
+
+        private ReferenceValue(String uuid) {
+            super(uuid);
+        }
+
+        /**
+         * Constructs a <code>ReferenceValue</code> object representing the UUID
of
+         * an existing node.
+         *
+         * @param target the node to be referenced
+         * @throws IllegalArgumentException If <code>target</code> is nonreferenceable.
+         * @throws javax.jcr.RepositoryException      If another error occurs.
+         */
+        private ReferenceValue(Node target) throws RepositoryException {
+            super(target);
+        }
+
+        /**
+         * Returns a new <code>ReferenceValue</code> initialized to the value
+         * represented by the specified <code>String</code>.
+         * <p/>
+         * The specified <code>String</code> must denote the UUID of an existing
+         * node.
+         *
+         * @param s the string to be parsed.
+         * @return a newly constructed <code>ReferenceValue</code> representing
the
+         *         the specified value.
+         * @throws javax.jcr.ValueFormatException If the <code>String</code>
is null or empty String.
+         */
+        public static org.apache.jackrabbit.value.ReferenceValue valueOf(String s) throws
ValueFormatException {
+            if (s != null && !"".equals(s)) {
+                return new ReferenceValue(s);
+            } else {
+                throw new ValueFormatException("not a valid UUID format");
+            }
+        }
+    }
+}
\ No newline at end of file

Propchange: jackrabbit/trunk/contrib/spi/spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/ValueFactoryImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jackrabbit/trunk/contrib/spi/spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/ValueFactoryImpl.java
------------------------------------------------------------------------------
    svn:keywords = author date id revision url



Mime
View raw message