jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r279618 - in /incubator/jackrabbit/trunk/contrib/jcr-ext/src/java/org/apache/jackrabbit/decorator: DecoratorFactory.java LockDecorator.java SimpleDecoratorFactory.java
Date Thu, 08 Sep 2005 20:22:14 GMT
Author: jukka
Date: Thu Sep  8 13:21:48 2005
New Revision: 279618

URL: http://svn.apache.org/viewcvs?rev=279618&view=rev
Log:
JCR-EXT: Implemented the SimpleDecoratorFactory and added the LockDecorator.

Added:
    incubator/jackrabbit/trunk/contrib/jcr-ext/src/java/org/apache/jackrabbit/decorator/LockDecorator.java
  (with props)
Modified:
    incubator/jackrabbit/trunk/contrib/jcr-ext/src/java/org/apache/jackrabbit/decorator/DecoratorFactory.java
    incubator/jackrabbit/trunk/contrib/jcr-ext/src/java/org/apache/jackrabbit/decorator/SimpleDecoratorFactory.java

Modified: incubator/jackrabbit/trunk/contrib/jcr-ext/src/java/org/apache/jackrabbit/decorator/DecoratorFactory.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-ext/src/java/org/apache/jackrabbit/decorator/DecoratorFactory.java?rev=279618&r1=279617&r2=279618&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/contrib/jcr-ext/src/java/org/apache/jackrabbit/decorator/DecoratorFactory.java
(original)
+++ incubator/jackrabbit/trunk/contrib/jcr-ext/src/java/org/apache/jackrabbit/decorator/DecoratorFactory.java
Thu Sep  8 13:21:48 2005
@@ -6,7 +6,7 @@
  * 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
+ *      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,
@@ -22,22 +22,23 @@
 import javax.jcr.Repository;
 import javax.jcr.Session;
 import javax.jcr.Workspace;
+import javax.jcr.lock.Lock;
 
 /**
  * Factory interface for creating decorator instances. The decorator
  * classes create new decorator instances using a factory to make it
- * easier to customize the behaviour of a decorator layer. 
+ * easier to customize the behaviour of a decorator layer.
  */
 public interface DecoratorFactory {
 
     /**
      * Creates a repository decorator.
-     *  
+     *
      * @param repository the underlying repository instance
      * @return decorator for the given repository
      */
-    public Repository getRepositoryDecorator(Repository repository);
-    
+    Repository getRepositoryDecorator(Repository repository);
+
     /**
      * Creates a session decorator. The created session decorator will
      * return the given repository (decorator) instance from the
@@ -57,7 +58,7 @@
      * @param session    the underlying session instance
      * @return decorator for the given session
      */
-    public Session getSessionDecorator(Repository repository, Session session);
+    Session getSessionDecorator(Repository repository, Session session);
 
     /**
      * Creates a workspace decorator.
@@ -67,8 +68,8 @@
      * @param workspace the underlying workspace instance
      * @return workspace decorator
      */
-    public Workspace getWorkspaceDecorator(Session session, Workspace workspace);
-    
+    Workspace getWorkspaceDecorator(Session session, Workspace workspace);
+
     /**
      * Creates a node decorator.
      *
@@ -77,8 +78,8 @@
      * @param node    the underlying node instance
      * @return node decorator
      */
-    public Node getNodeDecorator(Session session, Node node);
-    
+    Node getNodeDecorator(Session session, Node node);
+
     /**
      * Creates a property decorator.
      *
@@ -87,8 +88,8 @@
      * @param property the underlying property instance
      * @return property decorator
      */
-    public Property getPropertyDecorator(Session session, Property property);
-    
+    Property getPropertyDecorator(Session session, Property property);
+
     /**
      * Creates an item decorator.
      *
@@ -97,6 +98,15 @@
      * @param item    the underlying item instance
      * @return item decorator
      */
-    public Item getItemDecorator(Session session, Item item);
-    
+    Item getItemDecorator(Session session, Item item);
+
+    /**
+     * Creates a lock decorator.
+     *
+     * @param node the node (decorator) instance to which the lock is bound
+     * @param lock the underlying lock instance
+     * @return lock decorator
+     */
+    Lock getLockDecorator(Node node, Lock lock);
+
 }

Added: incubator/jackrabbit/trunk/contrib/jcr-ext/src/java/org/apache/jackrabbit/decorator/LockDecorator.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-ext/src/java/org/apache/jackrabbit/decorator/LockDecorator.java?rev=279618&view=auto
==============================================================================
--- incubator/jackrabbit/trunk/contrib/jcr-ext/src/java/org/apache/jackrabbit/decorator/LockDecorator.java
(added)
+++ incubator/jackrabbit/trunk/contrib/jcr-ext/src/java/org/apache/jackrabbit/decorator/LockDecorator.java
Thu Sep  8 13:21:48 2005
@@ -0,0 +1,63 @@
+/*
+ * 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 javax.jcr.Node;
+import javax.jcr.RepositoryException;
+import javax.jcr.lock.Lock;
+import javax.jcr.lock.LockException;
+
+public class LockDecorator implements Lock {
+
+    private final Node node;
+
+    private final Lock lock;
+
+    public LockDecorator(Node node, Lock lock) {
+        this.node = node;
+        this.lock = lock;
+    }
+
+    public Node getNode() {
+        return node;
+    }
+
+    public String getLockOwner() {
+        return lock.getLockOwner();
+    }
+
+    public boolean isDeep() {
+        return lock.isDeep();
+    }
+
+    public String getLockToken() {
+        return lock.getLockToken();
+    }
+
+    public boolean isLive() throws RepositoryException {
+        return lock.isLive();
+    }
+
+    public boolean isSessionScoped() {
+        return lock.isSessionScoped();
+    }
+
+    public void refresh() throws LockException, RepositoryException {
+        lock.refresh();
+    }
+
+}

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

Modified: incubator/jackrabbit/trunk/contrib/jcr-ext/src/java/org/apache/jackrabbit/decorator/SimpleDecoratorFactory.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-ext/src/java/org/apache/jackrabbit/decorator/SimpleDecoratorFactory.java?rev=279618&r1=279617&r2=279618&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/contrib/jcr-ext/src/java/org/apache/jackrabbit/decorator/SimpleDecoratorFactory.java
(original)
+++ incubator/jackrabbit/trunk/contrib/jcr-ext/src/java/org/apache/jackrabbit/decorator/SimpleDecoratorFactory.java
Thu Sep  8 13:21:48 2005
@@ -6,7 +6,7 @@
  * 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
+ *      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,
@@ -22,6 +22,7 @@
 import javax.jcr.Repository;
 import javax.jcr.Session;
 import javax.jcr.Workspace;
+import javax.jcr.lock.Lock;
 
 /**
  * TODO
@@ -30,25 +31,21 @@
 
     /** {@inheritDoc} */
     public Repository getRepositoryDecorator(Repository repository) {
-        // TODO Auto-generated method stub
-        return null;
+        return new RepositoryDecorator(this, repository);
     }
 
     /** {@inheritDoc} */
     public Session getSessionDecorator(Repository repository, Session session) {
-        // TODO Auto-generated method stub
-        return null;
+        return new SessionDecorator(this, repository, session);
     }
 
     /** {@inheritDoc} */
     public Workspace getWorkspaceDecorator(Session session, Workspace workspace) {
-        // TODO Auto-generated method stub
-        return null;
+        return new WorkspaceDecorator(this, session, workspace);
     }
 
     /** {@inheritDoc} */
     public Node getNodeDecorator(Session session, Node node) {
-        // TODO Auto-generated method stub
         return null;
     }
 
@@ -60,8 +57,17 @@
 
     /** {@inheritDoc} */
     public Item getItemDecorator(Session session, Item item) {
-        // TODO Auto-generated method stub
-        return null;
+        if (item instanceof Node) {
+            return getNodeDecorator(session, (Node) item);
+        } else if (item instanceof Property) {
+            return getPropertyDecorator(session, (Property) item);
+        } else {
+            return new ItemDecorator(this, session, item);
+        }
+    }
+
+    public Lock getLockDecorator(Node node, Lock lock) {
+        return new LockDecorator(node, lock);
     }
 
 }



Mime
View raw message