Author: berndf
Date: Fri Aug 28 09:45:21 2009
New Revision: 808827

URL: http://svn.apache.org/viewvc?rev=808827&view=rev
Log:
components now have their own stanza processor, to operate indepently of the 
client-related processing.
VYSPER-176: actually route to a server registered component

Added:
    
mina/sandbox/vysper/trunk/server/core/src/main/java/org/apache/vysper/xmpp/server/components/ComponentStanzaProcessor.java
Modified:
    mina/sandbox/vysper/trunk/server/core/src/main/config/spring-config.xml
    
mina/sandbox/vysper/trunk/server/core/src/main/java/org/apache/vysper/xmpp/delivery/inbound/DeliveringInboundStanzaRelay.java
    
mina/sandbox/vysper/trunk/server/core/src/main/java/org/apache/vysper/xmpp/protocol/ProtocolWorker.java
    
mina/sandbox/vysper/trunk/server/core/src/main/java/org/apache/vysper/xmpp/protocol/QueuedStanzaProcessor.java
    
mina/sandbox/vysper/trunk/server/core/src/main/java/org/apache/vysper/xmpp/server/DefaultServerRuntimeContext.java
    
mina/sandbox/vysper/trunk/server/core/src/main/java/org/apache/vysper/xmpp/server/ServerRuntimeContext.java
    
mina/sandbox/vysper/trunk/server/core/src/main/java/org/apache/vysper/xmpp/server/XMPPServer.java
    
mina/sandbox/vysper/trunk/server/core/src/main/java/org/apache/vysper/xmpp/server/components/Component.java
    
mina/sandbox/vysper/trunk/server/extensions/xep0045-muc/src/main/java/org/apache/vysper/xmpp/modules/extension/xep0045_muc/MUCModule.java

Modified: 
mina/sandbox/vysper/trunk/server/core/src/main/config/spring-config.xml
URL: 
http://svn.apache.org/viewvc/mina/sandbox/vysper/trunk/server/core/src/main/config/spring-config.xml?rev=808827&r1=808826&r2=808827&view=diff
==============================================================================
--- mina/sandbox/vysper/trunk/server/core/src/main/config/spring-config.xml 
(original)
+++ mina/sandbox/vysper/trunk/server/core/src/main/config/spring-config.xml Fri 
Aug 28 09:45:21 2009
@@ -53,6 +53,7 @@
         <constructor-arg ref="domain" />
         <constructor-arg ref="resourceRegistry"/>
         <constructor-arg ref="storageRegistry"/>
+        <property name="serverRuntimeContext" ref="server" />
     </bean>
 
     <bean id="stanzaRelay" 
class="org.apache.vysper.xmpp.delivery.StanzaRelayBroker" >

Modified: 
mina/sandbox/vysper/trunk/server/core/src/main/java/org/apache/vysper/xmpp/delivery/inbound/DeliveringInboundStanzaRelay.java
URL: 
http://svn.apache.org/viewvc/mina/sandbox/vysper/trunk/server/core/src/main/java/org/apache/vysper/xmpp/delivery/inbound/DeliveringInboundStanzaRelay.java?rev=808827&r1=808826&r2=808827&view=diff
==============================================================================
--- 
mina/sandbox/vysper/trunk/server/core/src/main/java/org/apache/vysper/xmpp/delivery/inbound/DeliveringInboundStanzaRelay.java
 (original)
+++ 
mina/sandbox/vysper/trunk/server/core/src/main/java/org/apache/vysper/xmpp/delivery/inbound/DeliveringInboundStanzaRelay.java
 Fri Aug 28 09:45:21 2009
@@ -26,9 +26,11 @@
 import org.apache.vysper.xmpp.authorization.AccountManagement;
 import org.apache.vysper.xmpp.protocol.SessionStateHolder;
 import org.apache.vysper.xmpp.protocol.StanzaHandler;
+import org.apache.vysper.xmpp.protocol.StanzaProcessor;
 import org.apache.vysper.xmpp.protocol.worker.InboundStanzaProtocolWorker;
 import org.apache.vysper.xmpp.server.SessionContext;
 import org.apache.vysper.xmpp.server.SessionState;
+import org.apache.vysper.xmpp.server.ServerRuntimeContext;
 import org.apache.vysper.xmpp.stanza.Stanza;
 import org.apache.vysper.xmpp.stanza.XMPPCoreStanza;
 import org.apache.vysper.xmpp.stanza.IQStanza;
@@ -78,6 +80,7 @@
     protected AccountManagement accountVerification;
     protected OfflineStanzaReceiver offlineStanzaReceiver = null;
     protected Entity serverEntity;
+    protected ServerRuntimeContext serverRuntimeContext = null;
 
     public DeliveringInboundStanzaRelay(Entity serverEntity, ResourceRegistry 
resourceRegistry, StorageProviderRegistry storageProviderRegistry) {
         this(serverEntity, resourceRegistry, 
(AccountManagement)storageProviderRegistry.retrieve(AccountManagement.class));
@@ -93,6 +96,10 @@
         this.executor = new ThreadPoolExecutor(coreThreadCount, 
maxThreadCount, threadTimeoutSeconds, TimeUnit.SECONDS, new 
LinkedBlockingQueue<Runnable>());
     }
 
+    public void setServerRuntimeContext(ServerRuntimeContext 
serverRuntimeContext) {
+        this.serverRuntimeContext = serverRuntimeContext;
+    }
+
     public void relay(Entity receiver, Stanza stanza, DeliveryFailureStrategy 
deliveryFailureStrategy) throws DeliveryException {
         Future<RelayResult> resultFuture = executor.submit(new Relay(receiver, 
stanza, deliveryFailureStrategy));
     }
@@ -149,15 +156,19 @@
             try {
                 String receiverDomain = receiver.getDomain();
                 if (receiverDomain != null && 
!receiverDomain.equals(serverEntity.getDomain())) {
+                    if (serverRuntimeContext == null) {
+                        return new RelayResult(new 
ServiceNotAvailableException("cannot retrieve component from server context"));
+                    }
                     if (!receiverDomain.endsWith("." + 
serverEntity.getDomain())) {
                         return new RelayResult(new 
ServiceNotAvailableException("unsupported domain " + receiverDomain));
                     }
-                    
-                    // TODO get components runtime context
 
-                    // pass through to component all stanzas like 
component.vysper.org for server domain vysper.org
-                    // TODO INBOUND_STANZA_PROTOCOL_WORKER.processStanza(null, 
sessionStateHolder, stanza, stanzaHandler);
-                    throw new RuntimeException("component delivery not 
implemented");
+                    StanzaProcessor processor = 
serverRuntimeContext.getComponentStanzaProcessor(receiverDomain);
+                    if (processor == null) {
+                        return new RelayResult(new 
ServiceNotAvailableException("cannot retrieve component stanza processor for" + 
receiverDomain));
+                    }
+
+                    processor.processStanza(serverRuntimeContext, null, 
stanza, null);
                 }
 
                 if (receiver.isResourceSet()) {

Modified: 
mina/sandbox/vysper/trunk/server/core/src/main/java/org/apache/vysper/xmpp/protocol/ProtocolWorker.java
URL: 
http://svn.apache.org/viewvc/mina/sandbox/vysper/trunk/server/core/src/main/java/org/apache/vysper/xmpp/protocol/ProtocolWorker.java?rev=808827&r1=808826&r2=808827&view=diff
==============================================================================
--- 
mina/sandbox/vysper/trunk/server/core/src/main/java/org/apache/vysper/xmpp/protocol/ProtocolWorker.java
 (original)
+++ 
mina/sandbox/vysper/trunk/server/core/src/main/java/org/apache/vysper/xmpp/protocol/ProtocolWorker.java
 Fri Aug 28 09:45:21 2009
@@ -45,7 +45,7 @@
 import java.util.List;
 
 /**
- * responsible for high-level XMPP protocol logic.
+ * responsible for high-level XMPP protocol logic for client-server sessions
  * determines start, end and jabber conditions.
  * reads the stream and cuts it into stanzas,
  * holds state and invokes stanza execution,

Modified: 
mina/sandbox/vysper/trunk/server/core/src/main/java/org/apache/vysper/xmpp/protocol/QueuedStanzaProcessor.java
URL: 
http://svn.apache.org/viewvc/mina/sandbox/vysper/trunk/server/core/src/main/java/org/apache/vysper/xmpp/protocol/QueuedStanzaProcessor.java?rev=808827&r1=808826&r2=808827&view=diff
==============================================================================
--- 
mina/sandbox/vysper/trunk/server/core/src/main/java/org/apache/vysper/xmpp/protocol/QueuedStanzaProcessor.java
 (original)
+++ 
mina/sandbox/vysper/trunk/server/core/src/main/java/org/apache/vysper/xmpp/protocol/QueuedStanzaProcessor.java
 Fri Aug 28 09:45:21 2009
@@ -27,6 +27,8 @@
 
 /**
  * stanza processor, acts as a 'stage' by using a ThreadPoolExecutor
+ * 
+ * TODO: make thread pool configuration managable
  *
  * @author The Apache MINA Project ([email protected])
  */
@@ -36,13 +38,14 @@
 
     protected ExecutorService executor;
 
-    protected StanzaProcessor protocolWorker = new ProtocolWorker();
+    protected StanzaProcessor stanzaProcessor;
 
-    public QueuedStanzaProcessor() {
+    public QueuedStanzaProcessor(StanzaProcessor stanzaProcessor) {
         int coreThreadCount = 10;
         int maxThreadCount = 20;
         int threadTimeoutSeconds = 2 * 60 * 1000;
-        executor = new ThreadPoolExecutor(coreThreadCount, maxThreadCount, 
threadTimeoutSeconds, TimeUnit.SECONDS, new LinkedBlockingQueue<Runnable>());
+        this.executor = new ThreadPoolExecutor(coreThreadCount, 
maxThreadCount, threadTimeoutSeconds, TimeUnit.SECONDS, new 
LinkedBlockingQueue<Runnable>());
+        this.stanzaProcessor = stanzaProcessor;
     }
 
     public void processStanza(ServerRuntimeContext serverRuntimeContext, 
SessionContext sessionContext, Stanza stanza, SessionStateHolder 
sessionStateHolder) {
@@ -66,7 +69,7 @@
         }
 
         public void run() {
-            
protocolWorker.processStanza(sessionContext.getServerRuntimeContext(), 
sessionContext, stanza, sessionStateHolder);
+            
stanzaProcessor.processStanza(sessionContext.getServerRuntimeContext(), 
sessionContext, stanza, sessionStateHolder);
         }
     }
 

Modified: 
mina/sandbox/vysper/trunk/server/core/src/main/java/org/apache/vysper/xmpp/server/DefaultServerRuntimeContext.java
URL: 
http://svn.apache.org/viewvc/mina/sandbox/vysper/trunk/server/core/src/main/java/org/apache/vysper/xmpp/server/DefaultServerRuntimeContext.java?rev=808827&r1=808826&r2=808827&view=diff
==============================================================================
--- 
mina/sandbox/vysper/trunk/server/core/src/main/java/org/apache/vysper/xmpp/server/DefaultServerRuntimeContext.java
 (original)
+++ 
mina/sandbox/vysper/trunk/server/core/src/main/java/org/apache/vysper/xmpp/server/DefaultServerRuntimeContext.java
 Fri Aug 28 09:45:21 2009
@@ -42,6 +42,7 @@
 import org.apache.vysper.xmpp.protocol.StanzaHandler;
 import org.apache.vysper.xmpp.protocol.StanzaHandlerLookup;
 import org.apache.vysper.xmpp.protocol.StanzaProcessor;
+import org.apache.vysper.xmpp.protocol.ProtocolWorker;
 import org.apache.vysper.xmpp.stanza.Stanza;
 import org.apache.vysper.xmpp.state.presence.LatestPresenceCache;
 import org.apache.vysper.xmpp.state.presence.SimplePresenceCache;
@@ -92,7 +93,7 @@
     /**
      * 'input stream': receives stanzas issued by client sessions to be 
handled by the server
      */
-    private StanzaProcessor stanzaProcessor = new QueuedStanzaProcessor();
+    private StanzaProcessor stanzaProcessor = new QueuedStanzaProcessor(new 
ProtocolWorker());
 
     /**
      * 'output stream': receives stanzas issued by a session, which are going 
to other sessions/servers
@@ -118,6 +119,10 @@
      * collection of all other services, which are mostly add-ons to the 
minimal setup
      */
     final private Map<String, ServerRuntimeContextService> 
serverRuntimeContextServiceMap = new HashMap<String, 
ServerRuntimeContextService>();
+
+    /**
+     * map of all registered components, index by the subdomain they are 
registered for
+     */
     protected final Map<String, Component> componentMap = new HashMap<String, 
Component>();
 
     public DefaultServerRuntimeContext(Entity serverEntity, StanzaRelay 
stanzaRelay) {
@@ -334,7 +339,7 @@
         componentMap.put(component.getSubdomain(), component);
     }                          
 
-    public SessionContext getComponentSession(String domain) {
+    public StanzaProcessor getComponentStanzaProcessor(String domain) {
         String serverDomain = getServerEnitity().getDomain();
         if (!domain.endsWith(serverDomain)) {
             return null;
@@ -342,7 +347,7 @@
         String subdomain = domain.replace("." + domain, "");
         Component component = componentMap.get(subdomain);
         if (component == null) return null;
-        return component.getSessionContext();
+        return component.getStanzaProcessor();
     }
 
 }

Modified: 
mina/sandbox/vysper/trunk/server/core/src/main/java/org/apache/vysper/xmpp/server/ServerRuntimeContext.java
URL: 
http://svn.apache.org/viewvc/mina/sandbox/vysper/trunk/server/core/src/main/java/org/apache/vysper/xmpp/server/ServerRuntimeContext.java?rev=808827&r1=808826&r2=808827&view=diff
==============================================================================
--- 
mina/sandbox/vysper/trunk/server/core/src/main/java/org/apache/vysper/xmpp/server/ServerRuntimeContext.java
 (original)
+++ 
mina/sandbox/vysper/trunk/server/core/src/main/java/org/apache/vysper/xmpp/server/ServerRuntimeContext.java
 Fri Aug 28 09:45:21 2009
@@ -70,5 +70,5 @@
 
     void registerComponent(Component component);
 
-    SessionContext getComponentSession(String domain);
+    StanzaProcessor getComponentStanzaProcessor(String domain);
 }

Modified: 
mina/sandbox/vysper/trunk/server/core/src/main/java/org/apache/vysper/xmpp/server/XMPPServer.java
URL: 
http://svn.apache.org/viewvc/mina/sandbox/vysper/trunk/server/core/src/main/java/org/apache/vysper/xmpp/server/XMPPServer.java?rev=808827&r1=808826&r2=808827&view=diff
==============================================================================
--- 
mina/sandbox/vysper/trunk/server/core/src/main/java/org/apache/vysper/xmpp/server/XMPPServer.java
 (original)
+++ 
mina/sandbox/vysper/trunk/server/core/src/main/java/org/apache/vysper/xmpp/server/XMPPServer.java
 Fri Aug 28 09:45:21 2009
@@ -120,6 +120,7 @@
         serverRuntimeContext.addModule(new RosterModule());
 
         stanzaRelayBroker.setServerRuntimeContext(serverRuntimeContext);
+        internalStanzaRelay.setServerRuntimeContext(serverRuntimeContext);
 
         if (endpoints.size() == 0) throw new IllegalStateException("server 
must have at least one endpoint");
         for (Endpoint endpoint : endpoints) {

Modified: 
mina/sandbox/vysper/trunk/server/core/src/main/java/org/apache/vysper/xmpp/server/components/Component.java
URL: 
http://svn.apache.org/viewvc/mina/sandbox/vysper/trunk/server/core/src/main/java/org/apache/vysper/xmpp/server/components/Component.java?rev=808827&r1=808826&r2=808827&view=diff
==============================================================================
--- 
mina/sandbox/vysper/trunk/server/core/src/main/java/org/apache/vysper/xmpp/server/components/Component.java
 (original)
+++ 
mina/sandbox/vysper/trunk/server/core/src/main/java/org/apache/vysper/xmpp/server/components/Component.java
 Fri Aug 28 09:45:21 2009
@@ -1,6 +1,25 @@
+/*
+ *  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.server.components;
 
-import org.apache.vysper.xmpp.server.SessionContext;
+import org.apache.vysper.xmpp.protocol.StanzaProcessor;
 
 /**
  * a component is a server subsystem providing a dedicated extension.
@@ -11,5 +30,5 @@
     
     String getSubdomain();
     
-    SessionContext getSessionContext();
+    StanzaProcessor getStanzaProcessor();
 }

Added: 
mina/sandbox/vysper/trunk/server/core/src/main/java/org/apache/vysper/xmpp/server/components/ComponentStanzaProcessor.java
URL: 
http://svn.apache.org/viewvc/mina/sandbox/vysper/trunk/server/core/src/main/java/org/apache/vysper/xmpp/server/components/ComponentStanzaProcessor.java?rev=808827&view=auto
==============================================================================
--- 
mina/sandbox/vysper/trunk/server/core/src/main/java/org/apache/vysper/xmpp/server/components/ComponentStanzaProcessor.java
 (added)
+++ 
mina/sandbox/vysper/trunk/server/core/src/main/java/org/apache/vysper/xmpp/server/components/ComponentStanzaProcessor.java
 Fri Aug 28 09:45:21 2009
@@ -0,0 +1,82 @@
+/*
+ *  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.server.components;
+
+import org.apache.vysper.xmpp.protocol.StanzaProcessor;
+import org.apache.vysper.xmpp.protocol.SessionStateHolder;
+import org.apache.vysper.xmpp.protocol.AbstractHandlerDictionary;
+import org.apache.vysper.xmpp.protocol.StanzaHandler;
+import org.apache.vysper.xmpp.protocol.ProtocolException;
+import org.apache.vysper.xmpp.server.ServerRuntimeContext;
+import org.apache.vysper.xmpp.server.SessionContext;
+import org.apache.vysper.xmpp.stanza.Stanza;
+import org.apache.vysper.xmpp.stanza.XMPPCoreStanza;
+
+/**
+ */
+public class ComponentStanzaProcessor implements StanzaProcessor {
+
+    private static class ComponentHandlerDictionary extends 
AbstractHandlerDictionary {
+
+        public ComponentHandlerDictionary() {
+            super();
+        }
+    }
+
+    protected ServerRuntimeContext serverRuntimeContext;
+    
+    protected ComponentHandlerDictionary handlers = new 
ComponentHandlerDictionary();
+
+    public ComponentStanzaProcessor(ServerRuntimeContext serverRuntimeContext) 
{
+        this.serverRuntimeContext = serverRuntimeContext;
+    }
+    
+    public void addHandler(StanzaHandler stanzaHandler) {
+        handlers.register(stanzaHandler);
+    }
+    
+    public void processStanza(ServerRuntimeContext serverRuntimeContext, 
SessionContext sessionContext, Stanza stanza, SessionStateHolder 
sessionStateHolder) {
+        if (stanza == null) throw new RuntimeException("cannot process NULL 
stanzas");
+
+        XMPPCoreStanza xmppStanza = XMPPCoreStanza.getWrapper(stanza);
+        if (xmppStanza == null) throw new RuntimeException("cannot process 
only: IQ, message or presence");
+
+        StanzaHandler stanzaHandler = handlers.get(xmppStanza);
+        
+        if (stanzaHandler == null) {
+            unhandledStanza(stanza);
+            return;
+        }
+
+        try {
+            stanzaHandler.execute(stanza, serverRuntimeContext, false, 
sessionContext, sessionStateHolder);
+        } catch (ProtocolException e) {
+            e.printStackTrace();  //To change body of catch statement use File 
| Settings | File Templates.
+        }
+    }
+
+    private void unhandledStanza(Stanza stanza) {
+        throw new RuntimeException("no handler for stanza");
+    }
+
+    public void processTLSEstablished(SessionContext sessionContext, 
SessionStateHolder sessionStateHolder) {
+        throw new RuntimeException("should not be called for components, which 
only acts as an established session");
+    }
+}

Modified: 
mina/sandbox/vysper/trunk/server/extensions/xep0045-muc/src/main/java/org/apache/vysper/xmpp/modules/extension/xep0045_muc/MUCModule.java
URL: 
http://svn.apache.org/viewvc/mina/sandbox/vysper/trunk/server/extensions/xep0045-muc/src/main/java/org/apache/vysper/xmpp/modules/extension/xep0045_muc/MUCModule.java?rev=808827&r1=808826&r2=808827&view=diff
==============================================================================
--- 
mina/sandbox/vysper/trunk/server/extensions/xep0045-muc/src/main/java/org/apache/vysper/xmpp/modules/extension/xep0045_muc/MUCModule.java
 (original)
+++ 
mina/sandbox/vysper/trunk/server/extensions/xep0045-muc/src/main/java/org/apache/vysper/xmpp/modules/extension/xep0045_muc/MUCModule.java
 Fri Aug 28 09:45:21 2009
@@ -19,8 +19,6 @@
  */
 package org.apache.vysper.xmpp.modules.extension.xep0045_muc;
 
-import java.util.List;
-
 import org.apache.vysper.xmpp.addressing.Entity;
 import org.apache.vysper.xmpp.addressing.EntityFormatException;
 import org.apache.vysper.xmpp.addressing.EntityImpl;
@@ -41,17 +39,18 @@
 import 
org.apache.vysper.xmpp.modules.servicediscovery.management.ItemRequestListener;
 import 
org.apache.vysper.xmpp.modules.servicediscovery.management.ServerInfoRequestListener;
 import 
org.apache.vysper.xmpp.modules.servicediscovery.management.ServiceDiscoveryRequestException;
-import org.apache.vysper.xmpp.protocol.HandlerDictionary;
 import org.apache.vysper.xmpp.protocol.NamespaceURIs;
-import org.apache.vysper.xmpp.protocol.AbstractHandlerDictionary;
+import org.apache.vysper.xmpp.protocol.StanzaProcessor;
 import org.apache.vysper.xmpp.server.ServerRuntimeContext;
-import org.apache.vysper.xmpp.server.SessionContext;
 import org.apache.vysper.xmpp.server.components.Component;
+import org.apache.vysper.xmpp.server.components.ComponentStanzaProcessor;
 import org.apache.vysper.xmpp.stanza.IQStanzaType;
 import org.apache.vysper.xmpp.stanza.StanzaBuilder;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import java.util.List;
+
 /**
  * A module for <a href="http://xmpp.org/extensions/xep-0045.html";>XEP-0045 
Multi-user chat</a>.
  *
@@ -64,6 +63,8 @@
     
     private final Logger logger = LoggerFactory.getLogger(MUCModule.class);
     private ServerRuntimeContext serverRuntimeContext;
+
+    private ComponentStanzaProcessor stanzaProcessor;
     
     public MUCModule(Entity domain) {
         this(domain, new Conference("Conference"));
@@ -90,6 +91,12 @@
         super.initialize(serverRuntimeContext);
         
         this.serverRuntimeContext = serverRuntimeContext;
+
+        ComponentStanzaProcessor processor = new 
ComponentStanzaProcessor(serverRuntimeContext);
+        processor.addHandler(new MUCPresenceHandler(conference));
+        processor.addHandler(new MUCMessageHandler(conference, domain));
+        stanzaProcessor = processor;
+
         RoomStorageProvider roomStorageProvider = (RoomStorageProvider) 
serverRuntimeContext.getStorageProvider(RoomStorageProvider.class);
         OccupantStorageProvider occupantStorageProvider = 
(OccupantStorageProvider) 
serverRuntimeContext.getStorageProvider(OccupantStorageProvider.class);
 
@@ -163,21 +170,6 @@
         return null;
     }
     
-    @Override
-    protected void addHandlerDictionaries(List<HandlerDictionary> 
dictionaries) {
-        // MUC is only supported for running on a subdomain
-
-        
-        AbstractHandlerDictionary dictionary = new AbstractHandlerDictionary() 
{
-            
-        };
-        
-        dictionary.register(new MUCPresenceHandler(conference));
-        dictionary.register(new MUCMessageHandler(conference, domain));
-        
-// TODO        dictionaries.add(dictionary);
-    }
-
     /**
      * Make this object available for disco#items requests for rooms
      */
@@ -187,7 +179,6 @@
     }
     
     private void relayDiscoStanza(Entity receiver, InfoRequest request, String 
ns) {
-        // TODO how to get id?
         StanzaBuilder builder = 
StanzaBuilder.createIQStanza(request.getFrom(), receiver, IQStanzaType.GET, 
request.getID());
         builder.startInnerElement("query", ns);
         if(request.getNode() != null) {
@@ -226,7 +217,7 @@
         return domain.getDomain();
     }
 
-    public SessionContext getSessionContext() {
-        return null;
+    public StanzaProcessor getStanzaProcessor() {
+        return stanzaProcessor;
     }
 }


Reply via email to