Author: mjakl
Date: Sat Jun 27 10:24:19 2009
New Revision: 788947

URL: http://svn.apache.org/viewvc?rev=788947&view=rev
Log:
Split up the PubSubPersistenceManager into CollectionNodeStorageProvider and 
LeafNodeStorageProvider. Renamed to conform to the top-level interface naming 
(StorageProvider). (VYSPER-81)

Added:
    
mina/sandbox/vysper/trunk/src/main/java/org/apache/vysper/xmpp/modules/extension/xep0060_pubsub/CollectionNodeStorageProvider.java
    
mina/sandbox/vysper/trunk/src/main/java/org/apache/vysper/xmpp/modules/extension/xep0060_pubsub/LeafNodeStorageProvider.java
      - copied, changed from r788941, 
mina/sandbox/vysper/trunk/src/main/java/org/apache/vysper/xmpp/modules/extension/xep0060_pubsub/PubSubPersistenceManager.java
Removed:
    
mina/sandbox/vysper/trunk/src/main/java/org/apache/vysper/xmpp/modules/extension/xep0060_pubsub/PubSubPersistenceManager.java
Modified:
    
mina/sandbox/vysper/trunk/src/main/java/org/apache/vysper/xmpp/modules/extension/xep0060_pubsub/NullPersistenceManager.java
    
mina/sandbox/vysper/trunk/src/main/java/org/apache/vysper/xmpp/modules/extension/xep0060_pubsub/PublishSubscribeModule.java
    
mina/sandbox/vysper/trunk/src/main/java/org/apache/vysper/xmpp/modules/extension/xep0060_pubsub/model/CollectionNode.java
    
mina/sandbox/vysper/trunk/src/main/java/org/apache/vysper/xmpp/modules/extension/xep0060_pubsub/model/LeafNode.java

Added: 
mina/sandbox/vysper/trunk/src/main/java/org/apache/vysper/xmpp/modules/extension/xep0060_pubsub/CollectionNodeStorageProvider.java
URL: 
http://svn.apache.org/viewvc/mina/sandbox/vysper/trunk/src/main/java/org/apache/vysper/xmpp/modules/extension/xep0060_pubsub/CollectionNodeStorageProvider.java?rev=788947&view=auto
==============================================================================
--- 
mina/sandbox/vysper/trunk/src/main/java/org/apache/vysper/xmpp/modules/extension/xep0060_pubsub/CollectionNodeStorageProvider.java
 (added)
+++ 
mina/sandbox/vysper/trunk/src/main/java/org/apache/vysper/xmpp/modules/extension/xep0060_pubsub/CollectionNodeStorageProvider.java
 Sat Jun 27 10:24:19 2009
@@ -0,0 +1,57 @@
+/*
+ *  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.vysper.xmpp.modules.extension.xep0060_pubsub;
+
+import org.apache.vysper.compliance.SpecCompliant;
+import org.apache.vysper.storage.StorageProvider;
+import org.apache.vysper.xmpp.addressing.Entity;
+import org.apache.vysper.xmpp.modules.extension.xep0060_pubsub.model.LeafNode;
+
+/**
+ * This interface defines all methods a StorageProvider has to offer to be 
suitable
+ * for a CollectionNode in the pubsub-module.
+ * 
+ * @author The Apache MINA Project (http://mina.apache.org)
+ *
+ */
+...@speccompliant(spec="xep-0060", status= 
SpecCompliant.ComplianceStatus.IN_PROGRESS, coverage = 
SpecCompliant.ComplianceCoverage.UNSUPPORTED)
+public interface CollectionNodeStorageProvider extends StorageProvider {
+
+    /**
+     * Retrieve a node via its JID
+     * @param jid the JID of the node we're searching for
+     * @return the LeafNode if found, null otherwise.
+     */
+    public LeafNode findNode(Entity jid);
+
+    /**
+     * Checks whether the collection node contains a node with a certain JID.
+     * @param jid the JID we're checking for.
+     * @return true if the JID corresponds to a known node.
+     */
+    public boolean containsNode(Entity jid);
+
+    /**
+     * Stores a node under the specified JID.
+     * @param jid the JID for the node.
+     * @param node the LeafNode to be stored.
+     */
+    public void storeNode(Entity jid, LeafNode node);
+}

Copied: 
mina/sandbox/vysper/trunk/src/main/java/org/apache/vysper/xmpp/modules/extension/xep0060_pubsub/LeafNodeStorageProvider.java
 (from r788941, 
mina/sandbox/vysper/trunk/src/main/java/org/apache/vysper/xmpp/modules/extension/xep0060_pubsub/PubSubPersistenceManager.java)
URL: 
http://svn.apache.org/viewvc/mina/sandbox/vysper/trunk/src/main/java/org/apache/vysper/xmpp/modules/extension/xep0060_pubsub/LeafNodeStorageProvider.java?p2=mina/sandbox/vysper/trunk/src/main/java/org/apache/vysper/xmpp/modules/extension/xep0060_pubsub/LeafNodeStorageProvider.java&p1=mina/sandbox/vysper/trunk/src/main/java/org/apache/vysper/xmpp/modules/extension/xep0060_pubsub/PubSubPersistenceManager.java&r1=788941&r2=788947&rev=788947&view=diff
==============================================================================
--- 
mina/sandbox/vysper/trunk/src/main/java/org/apache/vysper/xmpp/modules/extension/xep0060_pubsub/PubSubPersistenceManager.java
 (original)
+++ 
mina/sandbox/vysper/trunk/src/main/java/org/apache/vysper/xmpp/modules/extension/xep0060_pubsub/LeafNodeStorageProvider.java
 Sat Jun 27 10:24:19 2009
@@ -22,42 +22,17 @@
 import org.apache.vysper.compliance.SpecCompliant;
 import org.apache.vysper.storage.StorageProvider;
 import org.apache.vysper.xmpp.addressing.Entity;
-import org.apache.vysper.xmpp.modules.extension.xep0060_pubsub.model.LeafNode;
 import org.apache.vysper.xmpp.xmlfragment.XMLElement;
 
 /**
  * This interface defines all methods a StorageProvider has to offer to be 
suitable
- * for the pubsub-module.
+ * for a LeafNode in the pubsub-module.
  * 
  * @author The Apache MINA Project (http://mina.apache.org)
  */
 @SpecCompliant(spec="xep-0060", status= 
SpecCompliant.ComplianceStatus.IN_PROGRESS, coverage = 
SpecCompliant.ComplianceCoverage.UNSUPPORTED)
-public interface PubSubPersistenceManager extends StorageProvider {
+public interface LeafNodeStorageProvider extends StorageProvider {
 
-    // CollectionNode methods
-    
-    /**
-     * Retrieve a node via its JID
-     * @param jid the JID of the node we're searching for
-     * @return the LeafNode if found, null otherwise.
-     */
-    public LeafNode findNode(Entity jid);
-
-    /**
-     * Checks whether the collection node contains a node with a certain JID.
-     * @param jid the JID we're checking for.
-     * @return true if the JID corresponds to a known node.
-     */
-    public boolean containsNode(Entity jid);
-
-    /**
-     * Stores a node under the specified JID.
-     * @param jid the JID for the node.
-     * @param node the LeafNode to be stored.
-     */
-    public void storeNode(Entity jid, LeafNode node);
-
-    // LeafNode methods (subscriptions)
     /**
      * Add a subscriber to the LeafNode.
      * @param nodeJID the node JID to which the subscriber should be added.

Modified: 
mina/sandbox/vysper/trunk/src/main/java/org/apache/vysper/xmpp/modules/extension/xep0060_pubsub/NullPersistenceManager.java
URL: 
http://svn.apache.org/viewvc/mina/sandbox/vysper/trunk/src/main/java/org/apache/vysper/xmpp/modules/extension/xep0060_pubsub/NullPersistenceManager.java?rev=788947&r1=788946&r2=788947&view=diff
==============================================================================
--- 
mina/sandbox/vysper/trunk/src/main/java/org/apache/vysper/xmpp/modules/extension/xep0060_pubsub/NullPersistenceManager.java
 (original)
+++ 
mina/sandbox/vysper/trunk/src/main/java/org/apache/vysper/xmpp/modules/extension/xep0060_pubsub/NullPersistenceManager.java
 Sat Jun 27 10:24:19 2009
@@ -31,7 +31,7 @@
  * @author The Apache MINA Project (http://mina.apache.org)
  *
  */
-public class NullPersistenceManager implements PubSubPersistenceManager {
+public class NullPersistenceManager implements LeafNodeStorageProvider, 
CollectionNodeStorageProvider {
 
        protected Map<Entity, LeafNode> nodes;
 

Modified: 
mina/sandbox/vysper/trunk/src/main/java/org/apache/vysper/xmpp/modules/extension/xep0060_pubsub/PublishSubscribeModule.java
URL: 
http://svn.apache.org/viewvc/mina/sandbox/vysper/trunk/src/main/java/org/apache/vysper/xmpp/modules/extension/xep0060_pubsub/PublishSubscribeModule.java?rev=788947&r1=788946&r2=788947&view=diff
==============================================================================
--- 
mina/sandbox/vysper/trunk/src/main/java/org/apache/vysper/xmpp/modules/extension/xep0060_pubsub/PublishSubscribeModule.java
 (original)
+++ 
mina/sandbox/vysper/trunk/src/main/java/org/apache/vysper/xmpp/modules/extension/xep0060_pubsub/PublishSubscribeModule.java
 Sat Jun 27 10:24:19 2009
@@ -67,7 +67,7 @@
     public void initialize(ServerRuntimeContext serverRuntimeContext) {
         super.initialize(serverRuntimeContext);
 
-        PubSubPersistenceManager persistenceManager = 
(PubSubPersistenceManager) 
serverRuntimeContext.getStorageProvider(PubSubPersistenceManager.class);
+        CollectionNodeStorageProvider persistenceManager = 
(CollectionNodeStorageProvider) 
serverRuntimeContext.getStorageProvider(CollectionNodeStorageProvider.class);
         if (persistenceManager == null) {
             logger.error("No persistency manager found");
             // TODO throw some exception - without PM we can't do anything 
useful

Modified: 
mina/sandbox/vysper/trunk/src/main/java/org/apache/vysper/xmpp/modules/extension/xep0060_pubsub/model/CollectionNode.java
URL: 
http://svn.apache.org/viewvc/mina/sandbox/vysper/trunk/src/main/java/org/apache/vysper/xmpp/modules/extension/xep0060_pubsub/model/CollectionNode.java?rev=788947&r1=788946&r2=788947&view=diff
==============================================================================
--- 
mina/sandbox/vysper/trunk/src/main/java/org/apache/vysper/xmpp/modules/extension/xep0060_pubsub/model/CollectionNode.java
 (original)
+++ 
mina/sandbox/vysper/trunk/src/main/java/org/apache/vysper/xmpp/modules/extension/xep0060_pubsub/model/CollectionNode.java
 Sat Jun 27 10:24:19 2009
@@ -21,8 +21,8 @@
 
 import org.apache.vysper.compliance.SpecCompliant;
 import org.apache.vysper.xmpp.addressing.Entity;
+import 
org.apache.vysper.xmpp.modules.extension.xep0060_pubsub.CollectionNodeStorageProvider;
 import 
org.apache.vysper.xmpp.modules.extension.xep0060_pubsub.NullPersistenceManager;
-import 
org.apache.vysper.xmpp.modules.extension.xep0060_pubsub.PubSubPersistenceManager;
 
 /**
  * A collection node is a special pubsub node containing only other nodes. 
Either more CollectionNodes or
@@ -34,7 +34,7 @@
 public class CollectionNode {
 
     // the persistence manager for storing and retrieving node-info
-    protected PubSubPersistenceManager storage;
+    protected CollectionNodeStorageProvider storage;
 
     /**
      * Initializes the CollectionNode
@@ -66,7 +66,6 @@
         }
 
         LeafNode node = new LeafNode(jid);
-        node.setPersistenceManager(storage);
 
         storage.storeNode(jid, node);
 
@@ -78,7 +77,7 @@
      * 
      * @param persistenceManager the new persitency manager.
      */
-    public void setPersistenceManager(PubSubPersistenceManager 
persistenceManager) {
+    public void setPersistenceManager(CollectionNodeStorageProvider 
persistenceManager) {
         storage = persistenceManager;
     }
 }

Modified: 
mina/sandbox/vysper/trunk/src/main/java/org/apache/vysper/xmpp/modules/extension/xep0060_pubsub/model/LeafNode.java
URL: 
http://svn.apache.org/viewvc/mina/sandbox/vysper/trunk/src/main/java/org/apache/vysper/xmpp/modules/extension/xep0060_pubsub/model/LeafNode.java?rev=788947&r1=788946&r2=788947&view=diff
==============================================================================
--- 
mina/sandbox/vysper/trunk/src/main/java/org/apache/vysper/xmpp/modules/extension/xep0060_pubsub/model/LeafNode.java
 (original)
+++ 
mina/sandbox/vysper/trunk/src/main/java/org/apache/vysper/xmpp/modules/extension/xep0060_pubsub/model/LeafNode.java
 Sat Jun 27 10:24:19 2009
@@ -23,7 +23,7 @@
 import org.apache.vysper.xmpp.addressing.Entity;
 import org.apache.vysper.xmpp.delivery.StanzaRelay;
 import 
org.apache.vysper.xmpp.modules.extension.xep0060_pubsub.NullPersistenceManager;
-import 
org.apache.vysper.xmpp.modules.extension.xep0060_pubsub.PubSubPersistenceManager;
+import 
org.apache.vysper.xmpp.modules.extension.xep0060_pubsub.LeafNodeStorageProvider;
 import 
org.apache.vysper.xmpp.modules.extension.xep0060_pubsub.SubscriberNotificationVisitor;
 import org.apache.vysper.xmpp.xmlfragment.XMLElement;
 
@@ -39,7 +39,7 @@
     // the jid of the node
     protected Entity jid;
     // the persistency manager for storing and retrieving node information.
-    protected PubSubPersistenceManager storage = new NullPersistenceManager();
+    protected LeafNodeStorageProvider storage = new NullPersistenceManager();
 
     /**
      * Creates a new LeafNode with the specified JID.
@@ -53,7 +53,7 @@
      * Changes the persistenceManager.
      * @param persistenceManager the new persistence manager.
      */
-    public void setPersistenceManager(PubSubPersistenceManager 
persistenceManager) {
+    public void setPersistenceManager(LeafNodeStorageProvider 
persistenceManager) {
         this.storage = persistenceManager;
     }
 


Reply via email to