jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mreut...@apache.org
Subject svn commit: r326437 [2/2] - /incubator/jackrabbit/trunk/contrib/jcr-ext/src/java/org/apache/jackrabbit/decorator/
Date Wed, 19 Oct 2005 07:56:53 GMT
Added: incubator/jackrabbit/trunk/contrib/jcr-ext/src/java/org/apache/jackrabbit/decorator/VersionHistoryDecorator.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-ext/src/java/org/apache/jackrabbit/decorator/VersionHistoryDecorator.java?rev=326437&view=auto
==============================================================================
--- incubator/jackrabbit/trunk/contrib/jcr-ext/src/java/org/apache/jackrabbit/decorator/VersionHistoryDecorator.java
(added)
+++ incubator/jackrabbit/trunk/contrib/jcr-ext/src/java/org/apache/jackrabbit/decorator/VersionHistoryDecorator.java
Wed Oct 19 00:56:37 2005
@@ -0,0 +1,142 @@
+/*
+ * Copyright 2004-2005 The Apache Software Foundation or its licensors,
+ *                     as applicable.
+ *
+ * Licensed 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.decorator;
+
+import org.apache.jackrabbit.decorator.NodeDecorator;
+import org.apache.jackrabbit.decorator.DecoratorFactory;
+import org.apache.jackrabbit.decorator.DecoratingVersionIterator;
+import org.apache.jackrabbit.decorator.VersionDecorator;
+
+import javax.jcr.version.VersionHistory;
+import javax.jcr.version.Version;
+import javax.jcr.version.VersionIterator;
+import javax.jcr.version.VersionException;
+import javax.jcr.Session;
+import javax.jcr.RepositoryException;
+import javax.jcr.ReferentialIntegrityException;
+import javax.jcr.AccessDeniedException;
+import javax.jcr.UnsupportedRepositoryOperationException;
+
+/**
+ */
+public class VersionHistoryDecorator extends NodeDecorator
+        implements VersionHistory {
+
+    protected final VersionHistory versionHistory;
+
+    public VersionHistoryDecorator(DecoratorFactory factory,
+                                   Session session,
+                                   VersionHistory versionHistory) {
+        super(factory, session, versionHistory);
+        this.versionHistory = versionHistory;
+    }
+
+    /**
+     * @inheritDoc
+     */
+    public String getVersionableUUID() throws RepositoryException {
+        return versionHistory.getVersionableUUID();
+    }
+
+    /**
+     * @inheritDoc
+     */
+    public Version getRootVersion() throws RepositoryException {
+        Version version = versionHistory.getRootVersion();
+        return factory.getVersionDecorator(session, version);
+    }
+
+    /**
+     * @inheritDoc
+     */
+    public VersionIterator getAllVersions() throws RepositoryException {
+        return new DecoratingVersionIterator(factory, session, versionHistory.getAllVersions());
+    }
+
+    /**
+     * @inheritDoc
+     */
+    public Version getVersion(String versionName) throws VersionException, RepositoryException
{
+        Version version = versionHistory.getVersion(versionName);
+        return factory.getVersionDecorator(session, version);
+    }
+
+    /**
+     * @inheritDoc
+     */
+    public Version getVersionByLabel(String label) throws RepositoryException {
+        Version version = versionHistory.getVersionByLabel(label);
+        return factory.getVersionDecorator(session, version);
+    }
+
+    /**
+     * @inheritDoc
+     */
+    public void addVersionLabel(String versionName,
+                                String label,
+                                boolean moveLabel) throws VersionException, RepositoryException
{
+        versionHistory.addVersionLabel(versionName, label, moveLabel);
+    }
+
+    /**
+     * @inheritDoc
+     */
+    public void removeVersionLabel(String label) throws VersionException, RepositoryException
{
+        versionHistory.removeVersionLabel(label);
+    }
+
+    /**
+     * @inheritDoc
+     */
+    public boolean hasVersionLabel(String label) throws RepositoryException {
+        return versionHistory.hasVersionLabel(label);
+    }
+
+    /**
+     * @inheritDoc
+     */
+    public boolean hasVersionLabel(Version version, String label)
+            throws VersionException, RepositoryException {
+        return versionHistory.hasVersionLabel(VersionDecorator.unwrap(version), label);
+    }
+
+    /**
+     * @inheritDoc
+     */
+    public String[] getVersionLabels() throws RepositoryException {
+        return versionHistory.getVersionLabels();
+    }
+
+    /**
+     * @inheritDoc
+     */
+    public String[] getVersionLabels(Version version)
+            throws VersionException, RepositoryException {
+        return versionHistory.getVersionLabels(VersionDecorator.unwrap(version));
+    }
+
+    /**
+     * @inheritDoc
+     */
+    public void removeVersion(String versionName)
+            throws ReferentialIntegrityException, AccessDeniedException,
+            UnsupportedRepositoryOperationException, VersionException,
+            RepositoryException {
+        versionHistory.removeVersion(versionName);
+    }
+
+}

Propchange: incubator/jackrabbit/trunk/contrib/jcr-ext/src/java/org/apache/jackrabbit/decorator/VersionHistoryDecorator.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/jackrabbit/trunk/contrib/jcr-ext/src/java/org/apache/jackrabbit/decorator/WorkspaceDecorator.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-ext/src/java/org/apache/jackrabbit/decorator/WorkspaceDecorator.java?rev=326437&r1=326436&r2=326437&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/contrib/jcr-ext/src/java/org/apache/jackrabbit/decorator/WorkspaceDecorator.java
(original)
+++ incubator/jackrabbit/trunk/contrib/jcr-ext/src/java/org/apache/jackrabbit/decorator/WorkspaceDecorator.java
Wed Oct 19 00:56:37 2005
@@ -43,16 +43,10 @@
 /**
  * Simple workspace decorator.
  */
-public class WorkspaceDecorator implements Workspace {
-
-    /** The decorator factory. */
-    private final DecoratorFactory factory;
-
-    /** The session (decorator) instance. */
-    private final Session session;
+public class WorkspaceDecorator extends AbstractDecorator implements Workspace {
 
     /** The underlying workspace instance. */
-    private final Workspace workspace;
+    protected final Workspace workspace;
 
     /**
      * Creates a workspace decorator.
@@ -63,8 +57,7 @@
      */
     public WorkspaceDecorator(
             DecoratorFactory factory, Session session, Workspace workspace) {
-        this.factory = factory;
-        this.session = session;
+        super(factory, session);
         this.workspace = workspace;
     }
 
@@ -128,14 +121,18 @@
             throws ItemExistsException,
             UnsupportedRepositoryOperationException, VersionException,
             LockException, InvalidItemStateException, RepositoryException {
-        workspace.restore(versions, removeExisting);
+        Version[] tmp = new Version[versions.length];
+        for (int i = 0; i < versions.length; i++) {
+            tmp[i] = VersionDecorator.unwrap(versions[i]);
+        }
+        workspace.restore(tmp, removeExisting);
     }
 
     /**
      * Forwards the method call to the underlying workspace.
      */
     public QueryManager getQueryManager() throws RepositoryException {
-        return workspace.getQueryManager();
+        return factory.getQueryManagerDecorator(session, workspace.getQueryManager());
     }
 
     /**



Mime
View raw message