You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mina.apache.org by ng...@apache.org on 2010/06/26 22:40:05 UTC

svn commit: r958281 [12/22] - in /mina/vysper/trunk: demo/pubsub/client/src/main/java/org/apache/vysper/demo/pubsub/client/ nbxml/src/main/java/org/apache/vysper/charset/ nbxml/src/main/java/org/apache/vysper/xml/decoder/ nbxml/src/main/java/org/apache...

Modified: mina/vysper/trunk/server/core/src/main/java/org/apache/vysper/xmpp/protocol/ProtocolWorker.java
URL: http://svn.apache.org/viewvc/mina/vysper/trunk/server/core/src/main/java/org/apache/vysper/xmpp/protocol/ProtocolWorker.java?rev=958281&r1=958280&r2=958281&view=diff
==============================================================================
--- mina/vysper/trunk/server/core/src/main/java/org/apache/vysper/xmpp/protocol/ProtocolWorker.java (original)
+++ mina/vysper/trunk/server/core/src/main/java/org/apache/vysper/xmpp/protocol/ProtocolWorker.java Sat Jun 26 20:39:54 2010
@@ -71,7 +71,6 @@ public class ProtocolWorker implements S
         stateWorker.put(SessionState.CLOSED, new EndOrClosedProtocolWorker());
     }
 
-
     /**
      * executes the handler for a stanza, handles Protocol exceptions.
      * also writes a response, if the handler implements ResponseStanzaContainer
@@ -80,8 +79,10 @@ public class ProtocolWorker implements S
      * @param stanza
      * @param sessionStateHolder
      */
-    public void processStanza(ServerRuntimeContext serverRuntimeContext, SessionContext sessionContext, Stanza stanza, SessionStateHolder sessionStateHolder) {
-        if (stanza == null) throw new RuntimeException("cannot process NULL stanzas");
+    public void processStanza(ServerRuntimeContext serverRuntimeContext, SessionContext sessionContext, Stanza stanza,
+            SessionStateHolder sessionStateHolder) {
+        if (stanza == null)
+            throw new RuntimeException("cannot process NULL stanzas");
 
         StanzaHandler stanzaHandler = serverRuntimeContext.getHandler(stanza);
 
@@ -99,11 +100,9 @@ public class ProtocolWorker implements S
         }
 
         // check as of RFC3920/4.3:
-        if (sessionStateHolder.getState() != SessionState.AUTHENTICATED)
-        {
+        if (sessionStateHolder.getState() != SessionState.AUTHENTICATED) {
             // is not authenticated...
-            if (XMPPCoreStanza.getWrapper(stanza) != null)
-            {
+            if (XMPPCoreStanza.getWrapper(stanza) != null) {
                 // ... and is a IQ/PRESENCE/MESSAGE stanza!
                 responseWriter.handleNotAuthorized(sessionContext, stanza);
                 return;
@@ -124,7 +123,8 @@ public class ProtocolWorker implements S
         }
         // make sure that there is a bound resource entry for that from's resource id attribute!
         if (from != null && from.getResource() != null) {
-            List<String> boundResources = sessionContext.getServerRuntimeContext().getResourceRegistry().getBoundResources(from, false);
+            List<String> boundResources = sessionContext.getServerRuntimeContext().getResourceRegistry()
+                    .getBoundResources(from, false);
             if (boundResources.size() == 0) {
                 responseWriter.handleWrongFromJID(sessionContext, stanza);
                 return;
@@ -134,7 +134,8 @@ public class ProtocolWorker implements S
         // in the same session.
         // see rfc3920_draft-saintandre-rfc3920bis-04.txt#8.5.4
         if (from != null && from.getResource() == null) {
-            List<String> boundResources = sessionContext.getServerRuntimeContext().getResourceRegistry().getResourcesForSession(sessionContext);
+            List<String> boundResources = sessionContext.getServerRuntimeContext().getResourceRegistry()
+                    .getResourcesForSession(sessionContext);
             if (boundResources.size() > 1) {
                 responseWriter.handleWrongFromJID(sessionContext, stanza);
                 return;
@@ -142,10 +143,10 @@ public class ProtocolWorker implements S
         }
 
         try {
-            stateAwareProtocolWorker.processStanza(sessionContext, sessionStateHolder,
-                                                   stanza, stanzaHandler);
+            stateAwareProtocolWorker.processStanza(sessionContext, sessionStateHolder, stanza, stanzaHandler);
         } catch (Exception e) {
-            logger.error("error executing handler {} with stanza {}", stanzaHandler.getClass().getName(), DenseStanzaLogRenderer.render(stanza));
+            logger.error("error executing handler {} with stanza {}", stanzaHandler.getClass().getName(),
+                    DenseStanzaLogRenderer.render(stanza));
             logger.debug("error executing handler exception: ", e);
         }
     }
@@ -154,7 +155,8 @@ public class ProtocolWorker implements S
         processTLSEstablishedInternal(sessionContext, sessionStateHolder, responseWriter);
     }
 
-    static void processTLSEstablishedInternal(SessionContext sessionContext, SessionStateHolder sessionStateHolder, ResponseWriter responseWriter) {
+    static void processTLSEstablishedInternal(SessionContext sessionContext, SessionStateHolder sessionStateHolder,
+            ResponseWriter responseWriter) {
         if (sessionContext.getState() != SessionState.ENCRYPTION_STARTED) {
             responseWriter.handleProtocolError(new TLSException(), sessionContext, null);
             return;

Modified: mina/vysper/trunk/server/core/src/main/java/org/apache/vysper/xmpp/protocol/QueuedStanzaProcessor.java
URL: http://svn.apache.org/viewvc/mina/vysper/trunk/server/core/src/main/java/org/apache/vysper/xmpp/protocol/QueuedStanzaProcessor.java?rev=958281&r1=958280&r2=958281&view=diff
==============================================================================
--- mina/vysper/trunk/server/core/src/main/java/org/apache/vysper/xmpp/protocol/QueuedStanzaProcessor.java (original)
+++ mina/vysper/trunk/server/core/src/main/java/org/apache/vysper/xmpp/protocol/QueuedStanzaProcessor.java Sat Jun 26 20:39:54 2010
@@ -19,12 +19,15 @@
  */
 package org.apache.vysper.xmpp.protocol;
 
-import org.apache.vysper.xmpp.server.SessionContext;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.LinkedBlockingQueue;
+import java.util.concurrent.ThreadPoolExecutor;
+import java.util.concurrent.TimeUnit;
+
 import org.apache.vysper.xmpp.server.ServerRuntimeContext;
+import org.apache.vysper.xmpp.server.SessionContext;
 import org.apache.vysper.xmpp.stanza.Stanza;
 
-import java.util.concurrent.*;
-
 /**
  * stanza processor, acts as a 'stage' by using a ThreadPoolExecutor
  * 
@@ -44,11 +47,13 @@ public class QueuedStanzaProcessor imple
         int coreThreadCount = 10;
         int maxThreadCount = 20;
         int threadTimeoutSeconds = 2 * 60 * 1000;
-        this.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) {
+    public void processStanza(ServerRuntimeContext serverRuntimeContext, SessionContext sessionContext, Stanza stanza,
+            SessionStateHolder sessionStateHolder) {
         executor.submit(new StanzaProcessorUnitOfWork(sessionContext, stanza, sessionStateHolder));
     }
 
@@ -59,17 +64,21 @@ public class QueuedStanzaProcessor imple
     private class StanzaProcessorUnitOfWork implements Runnable {
 
         private SessionContext sessionContext;
+
         private Stanza stanza;
+
         private SessionStateHolder sessionStateHolder;
 
-        private StanzaProcessorUnitOfWork(SessionContext sessionContext, Stanza stanza, SessionStateHolder sessionStateHolder) {
+        private StanzaProcessorUnitOfWork(SessionContext sessionContext, Stanza stanza,
+                SessionStateHolder sessionStateHolder) {
             this.sessionContext = sessionContext;
             this.stanza = stanza;
             this.sessionStateHolder = sessionStateHolder;
         }
 
         public void run() {
-            stanzaProcessor.processStanza(sessionContext.getServerRuntimeContext(), sessionContext, stanza, sessionStateHolder);
+            stanzaProcessor.processStanza(sessionContext.getServerRuntimeContext(), sessionContext, stanza,
+                    sessionStateHolder);
         }
     }
 

Modified: mina/vysper/trunk/server/core/src/main/java/org/apache/vysper/xmpp/protocol/ResponseStanzaContainer.java
URL: http://svn.apache.org/viewvc/mina/vysper/trunk/server/core/src/main/java/org/apache/vysper/xmpp/protocol/ResponseStanzaContainer.java?rev=958281&r1=958280&r2=958281&view=diff
==============================================================================
--- mina/vysper/trunk/server/core/src/main/java/org/apache/vysper/xmpp/protocol/ResponseStanzaContainer.java (original)
+++ mina/vysper/trunk/server/core/src/main/java/org/apache/vysper/xmpp/protocol/ResponseStanzaContainer.java Sat Jun 26 20:39:54 2010
@@ -30,5 +30,6 @@ public interface ResponseStanzaContainer
     Stanza getResponseStanza();
 
     boolean hasResponse();
+
     boolean hasNoResponse();
 }

Modified: mina/vysper/trunk/server/core/src/main/java/org/apache/vysper/xmpp/protocol/ResponseWriter.java
URL: http://svn.apache.org/viewvc/mina/vysper/trunk/server/core/src/main/java/org/apache/vysper/xmpp/protocol/ResponseWriter.java?rev=958281&r1=958280&r2=958281&view=diff
==============================================================================
--- mina/vysper/trunk/server/core/src/main/java/org/apache/vysper/xmpp/protocol/ResponseWriter.java (original)
+++ mina/vysper/trunk/server/core/src/main/java/org/apache/vysper/xmpp/protocol/ResponseWriter.java Sat Jun 26 20:39:54 2010
@@ -19,6 +19,8 @@
  */
 package org.apache.vysper.xmpp.protocol;
 
+import org.apache.vysper.xmpp.parser.ParsingErrorCondition;
+import org.apache.vysper.xmpp.parser.ParsingException;
 import org.apache.vysper.xmpp.server.SessionContext;
 import org.apache.vysper.xmpp.server.XMPPVersion;
 import org.apache.vysper.xmpp.server.response.ServerErrorResponses;
@@ -27,8 +29,6 @@ import org.apache.vysper.xmpp.stanza.Sta
 import org.apache.vysper.xmpp.stanza.StanzaErrorCondition;
 import org.apache.vysper.xmpp.stanza.StanzaErrorType;
 import org.apache.vysper.xmpp.stanza.XMPPCoreStanza;
-import org.apache.vysper.xmpp.parser.ParsingException;
-import org.apache.vysper.xmpp.parser.ParsingErrorCondition;
 
 /**
  * writes protocol level errors
@@ -39,11 +39,11 @@ public class ResponseWriter {
 
     public static void writeUnsupportedStanzaError(SessionContext sessionContext) {
 
-        Stanza errorStanza = ServerErrorResponses.getInstance().getStreamError(StreamErrorCondition.UNSUPPORTED_STANZA_TYPE,
-                sessionContext.getXMLLang(),
-                "service unavailable at this session state",
-                null);
-        Stanza streamOpener = new ServerResponses().getStreamOpenerForError(false, sessionContext.getServerJID(), XMPPVersion.VERSION_1_0, errorStanza);
+        Stanza errorStanza = ServerErrorResponses.getInstance().getStreamError(
+                StreamErrorCondition.UNSUPPORTED_STANZA_TYPE, sessionContext.getXMLLang(),
+                "service unavailable at this session state", null);
+        Stanza streamOpener = new ServerResponses().getStreamOpenerForError(false, sessionContext.getServerJID(),
+                XMPPVersion.VERSION_1_0, errorStanza);
 
         writeErrorAndClose(sessionContext, streamOpener);
     }
@@ -67,32 +67,29 @@ public class ResponseWriter {
         sessionContext.getResponseWriter().write(responseStanza);
     }
 
-    public static void handleProtocolError(ProtocolException protocolException, SessionContext sessionContext, Stanza receivedStanza) {
+    public static void handleProtocolError(ProtocolException protocolException, SessionContext sessionContext,
+            Stanza receivedStanza) {
         Stanza errorStanza = null;
-        if (protocolException != null) errorStanza = protocolException.getErrorStanza();
+        if (protocolException != null)
+            errorStanza = protocolException.getErrorStanza();
 
         if (errorStanza == null) {
             errorStanza = ServerErrorResponses.getInstance().getStreamError(StreamErrorCondition.BAD_FORMAT,
-                                                              sessionContext.getXMLLang(),
-                                                              "could not process incoming stanza",
-                                                              receivedStanza);
+                    sessionContext.getXMLLang(), "could not process incoming stanza", receivedStanza);
         }
         writeErrorAndClose(sessionContext, errorStanza);
     }
 
     public void handleUnsupportedStanzaType(SessionContext sessionContext, Stanza receivedStanza) {
-        Stanza errorStanza = ServerErrorResponses.getInstance().getStreamError(StreamErrorCondition.UNSUPPORTED_STANZA_TYPE,
-                                                          sessionContext.getXMLLang(),
-                                                          "could not process incoming stanza",
-                                                          receivedStanza);
+        Stanza errorStanza = ServerErrorResponses.getInstance().getStreamError(
+                StreamErrorCondition.UNSUPPORTED_STANZA_TYPE, sessionContext.getXMLLang(),
+                "could not process incoming stanza", receivedStanza);
         writeErrorAndClose(sessionContext, errorStanza);
     }
 
     public void handleNotAuthorized(SessionContext sessionContext, Stanza receivedStanza) {
         Stanza errorStanza = ServerErrorResponses.getInstance().getStreamError(StreamErrorCondition.NOT_AUTHORIZED,
-                                                          sessionContext.getXMLLang(),
-                                                          "could not process incoming stanza",
-                                                          receivedStanza);
+                sessionContext.getXMLLang(), "could not process incoming stanza", receivedStanza);
         writeErrorAndClose(sessionContext, errorStanza);
     }
 
@@ -104,20 +101,17 @@ public class ResponseWriter {
         }
 
         Stanza errorStanza = ServerErrorResponses.getInstance().getStanzaError(StanzaErrorCondition.UNKNOWN_SENDER,
-                                                          receivedCoreStanza,
-                                                          StanzaErrorType.MODIFY,
-                                                          "from attribute does not match authorized entity",
-                                                          null, null);
+                receivedCoreStanza, StanzaErrorType.MODIFY, "from attribute does not match authorized entity", null,
+                null);
         writeResponse(sessionContext, errorStanza);
     }
 
     public void handleParsingException(SessionContext sessionContext, ParsingException e) {
         //TODO write the __right__ error response, not bad-format default only
-        if (e.getErrorCondition() != ParsingErrorCondition.BAD_FORMAT) throw new RuntimeException("cannot handle this error condition yet");
+        if (e.getErrorCondition() != ParsingErrorCondition.BAD_FORMAT)
+            throw new RuntimeException("cannot handle this error condition yet");
         Stanza errorStanza = ServerErrorResponses.getInstance().getStreamError(StreamErrorCondition.BAD_FORMAT,
-                sessionContext.getXMLLang(),
-                "could not parse incoming stanza",
-                null);
+                sessionContext.getXMLLang(), "could not parse incoming stanza", null);
         writeErrorAndClose(sessionContext, errorStanza);
     }
 
@@ -126,5 +120,4 @@ public class ResponseWriter {
         sessionContext.endSession(SessionContext.SessionTerminationCause.STREAM_ERROR);
     }
 
-
 }

Modified: mina/vysper/trunk/server/core/src/main/java/org/apache/vysper/xmpp/protocol/ServiceUnavailableStanzaErrorHandler.java
URL: http://svn.apache.org/viewvc/mina/vysper/trunk/server/core/src/main/java/org/apache/vysper/xmpp/protocol/ServiceUnavailableStanzaErrorHandler.java?rev=958281&r1=958280&r2=958281&view=diff
==============================================================================
--- mina/vysper/trunk/server/core/src/main/java/org/apache/vysper/xmpp/protocol/ServiceUnavailableStanzaErrorHandler.java (original)
+++ mina/vysper/trunk/server/core/src/main/java/org/apache/vysper/xmpp/protocol/ServiceUnavailableStanzaErrorHandler.java Sat Jun 26 20:39:54 2010
@@ -19,8 +19,8 @@
  */
 package org.apache.vysper.xmpp.protocol;
 
-import org.apache.vysper.xmpp.server.SessionContext;
 import org.apache.vysper.xmpp.server.ServerRuntimeContext;
+import org.apache.vysper.xmpp.server.SessionContext;
 import org.apache.vysper.xmpp.server.response.ServerErrorResponses;
 import org.apache.vysper.xmpp.stanza.Stanza;
 import org.apache.vysper.xmpp.stanza.StanzaErrorCondition;
@@ -45,14 +45,19 @@ public class ServiceUnavailableStanzaErr
         return true;
     }
 
-    public ResponseStanzaContainer execute(Stanza stanza, ServerRuntimeContext serverRuntimeContext, boolean isOutboundStanza, SessionContext sessionContext, SessionStateHolder sessionStateHolder) throws ProtocolException {
+    public ResponseStanzaContainer execute(Stanza stanza, ServerRuntimeContext serverRuntimeContext,
+            boolean isOutboundStanza, SessionContext sessionContext, SessionStateHolder sessionStateHolder)
+            throws ProtocolException {
         if (!(stanza instanceof XMPPCoreStanza)) {
             stanza = XMPPCoreStanza.getWrapper(stanza);
         }
-        if (stanza == null) throw new IllegalArgumentException("cannot coerce into a message, iq or presence stanza");
+        if (stanza == null)
+            throw new IllegalArgumentException("cannot coerce into a message, iq or presence stanza");
 
         XMPPCoreStanza coreStanza = (XMPPCoreStanza) stanza;
-        Stanza errorStanza = ServerErrorResponses.getInstance().getStanzaError(StanzaErrorCondition.SERVICE_UNAVAILABLE, coreStanza, StanzaErrorType.CANCEL, "namespace not supported", null, null);
+        Stanza errorStanza = ServerErrorResponses.getInstance().getStanzaError(
+                StanzaErrorCondition.SERVICE_UNAVAILABLE, coreStanza, StanzaErrorType.CANCEL,
+                "namespace not supported", null, null);
         return new ResponseStanzaContainerImpl(errorStanza);
     }
 }

Modified: mina/vysper/trunk/server/core/src/main/java/org/apache/vysper/xmpp/protocol/SessionStateHolder.java
URL: http://svn.apache.org/viewvc/mina/vysper/trunk/server/core/src/main/java/org/apache/vysper/xmpp/protocol/SessionStateHolder.java?rev=958281&r1=958280&r2=958281&view=diff
==============================================================================
--- mina/vysper/trunk/server/core/src/main/java/org/apache/vysper/xmpp/protocol/SessionStateHolder.java (original)
+++ mina/vysper/trunk/server/core/src/main/java/org/apache/vysper/xmpp/protocol/SessionStateHolder.java Sat Jun 26 20:39:54 2010
@@ -20,7 +20,6 @@
 package org.apache.vysper.xmpp.protocol;
 
 import org.apache.vysper.xmpp.server.SessionState;
-
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 

Modified: mina/vysper/trunk/server/core/src/main/java/org/apache/vysper/xmpp/protocol/StanzaHandler.java
URL: http://svn.apache.org/viewvc/mina/vysper/trunk/server/core/src/main/java/org/apache/vysper/xmpp/protocol/StanzaHandler.java?rev=958281&r1=958280&r2=958281&view=diff
==============================================================================
--- mina/vysper/trunk/server/core/src/main/java/org/apache/vysper/xmpp/protocol/StanzaHandler.java (original)
+++ mina/vysper/trunk/server/core/src/main/java/org/apache/vysper/xmpp/protocol/StanzaHandler.java Sat Jun 26 20:39:54 2010
@@ -19,8 +19,8 @@
  */
 package org.apache.vysper.xmpp.protocol;
 
-import org.apache.vysper.xmpp.server.SessionContext;
 import org.apache.vysper.xmpp.server.ServerRuntimeContext;
+import org.apache.vysper.xmpp.server.SessionContext;
 import org.apache.vysper.xmpp.stanza.Stanza;
 
 /**
@@ -61,5 +61,7 @@ public interface StanzaHandler {
      * @param sessionStateHolder 
      * @return optionally returns a response which is passed to the session's client
      */
-    public ResponseStanzaContainer execute(Stanza stanza, ServerRuntimeContext serverRuntimeContext, boolean isOutboundStanza, SessionContext sessionContext, SessionStateHolder sessionStateHolder) throws ProtocolException;
+    public ResponseStanzaContainer execute(Stanza stanza, ServerRuntimeContext serverRuntimeContext,
+            boolean isOutboundStanza, SessionContext sessionContext, SessionStateHolder sessionStateHolder)
+            throws ProtocolException;
 }

Modified: mina/vysper/trunk/server/core/src/main/java/org/apache/vysper/xmpp/protocol/StanzaHandlerLookup.java
URL: http://svn.apache.org/viewvc/mina/vysper/trunk/server/core/src/main/java/org/apache/vysper/xmpp/protocol/StanzaHandlerLookup.java?rev=958281&r1=958280&r2=958281&view=diff
==============================================================================
--- mina/vysper/trunk/server/core/src/main/java/org/apache/vysper/xmpp/protocol/StanzaHandlerLookup.java (original)
+++ mina/vysper/trunk/server/core/src/main/java/org/apache/vysper/xmpp/protocol/StanzaHandlerLookup.java Sat Jun 26 20:39:54 2010
@@ -22,8 +22,8 @@ package org.apache.vysper.xmpp.protocol;
 import org.apache.vysper.xml.fragment.XMLElement;
 import org.apache.vysper.xmpp.addressing.Entity;
 import org.apache.vysper.xmpp.modules.core.base.handler.IQHandler;
-import org.apache.vysper.xmpp.modules.core.base.handler.RelayingIQHandler;
 import org.apache.vysper.xmpp.modules.core.base.handler.MessageHandler;
+import org.apache.vysper.xmpp.modules.core.base.handler.RelayingIQHandler;
 import org.apache.vysper.xmpp.modules.core.base.handler.StreamStartHandler;
 import org.apache.vysper.xmpp.modules.core.base.handler.XMLPrologHandler;
 import org.apache.vysper.xmpp.modules.core.im.handler.PresenceHandler;
@@ -43,9 +43,13 @@ import org.apache.vysper.xmpp.stanza.XMP
 public class StanzaHandlerLookup extends AbstractStanzaHandlerLookup {
 
     private IQHandler iqHandler = new RelayingIQHandler();
+
     private MessageHandler messageHandler = new MessageHandler();
+
     private PresenceHandler presenceHandler = new PresenceHandler();
+
     private static final ServiceUnavailableStanzaErrorHandler SERVICE_UNAVAILABLE_STANZA_ERROR_HANDLER = new ServiceUnavailableStanzaErrorHandler();
+
     protected ServerRuntimeContext serverRuntimeContext;
 
     public StanzaHandlerLookup(ServerRuntimeContext serverRuntimeContext) {
@@ -59,14 +63,20 @@ public class StanzaHandlerLookup extends
      */
     @Override
     public StanzaHandler getHandler(Stanza stanza) {
-        if (stanza == null) return null;
+        if (stanza == null)
+            return null;
 
         String name = stanza.getName();
-        if      ("xml".equals(name)) return new XMLPrologHandler();
-        else if ("stream".equals(name)) return new StreamStartHandler();
-        else if (iqHandler.verify(stanza)) return getIQHandler(stanza);
-        else if (messageHandler.verify(stanza)) return getMessageHandler(stanza);
-        else if (presenceHandler.verify(stanza)) return getPresenceHandler(stanza);
+        if ("xml".equals(name))
+            return new XMLPrologHandler();
+        else if ("stream".equals(name))
+            return new StreamStartHandler();
+        else if (iqHandler.verify(stanza))
+            return getIQHandler(stanza);
+        else if (messageHandler.verify(stanza))
+            return getMessageHandler(stanza);
+        else if (presenceHandler.verify(stanza))
+            return getPresenceHandler(stanza);
         else {
             // this is not a core stanza (RFC3920), but something like the following
             // (in descending-probability order):
@@ -78,7 +88,8 @@ public class StanzaHandlerLookup extends
             // ...so we delegate:
             StanzaHandler stanzaHandler = getHandlerForElement(stanza, stanza);
             // ... and if we could not resolve and it's a core stanza, we can safely return an error
-            if (stanzaHandler == null && XMPPCoreStanza.getWrapper(stanza) != null) return SERVICE_UNAVAILABLE_STANZA_ERROR_HANDLER;
+            if (stanzaHandler == null && XMPPCoreStanza.getWrapper(stanza) != null)
+                return SERVICE_UNAVAILABLE_STANZA_ERROR_HANDLER;
             return stanzaHandler;
         }
     }
@@ -97,7 +108,8 @@ public class StanzaHandlerLookup extends
         Entity to = stanza.getTo();
         Entity serverEntity = (serverRuntimeContext == null) ? null : serverRuntimeContext.getServerEnitity();
         boolean isAddressedToServerOrComponent = (to == null || (!to.isNodeSet() && !to.isResourceSet()));
-        boolean isAddressedToComponent = (to != null) && isAddressedToServerOrComponent && serverEntity != null && (!serverEntity.equals(to));
+        boolean isAddressedToComponent = (to != null) && isAddressedToServerOrComponent && serverEntity != null
+                && (!serverEntity.equals(to));
         boolean isAddressedToServer = (to == null) || (isAddressedToServerOrComponent && !isAddressedToComponent);
 
         // The following cases must be properly handled:
@@ -112,10 +124,13 @@ public class StanzaHandlerLookup extends
         if (stanza.getVerifier().subElementsPresentExact(1)) {
             XMLElement firstInnerElement = stanza.getFirstInnerElement();
             handlerForElement = getHandlerForElement(stanza, firstInnerElement);
-            if (handlerForElement != null) resolvedHandler = handlerForElement;
-            if (resolvedHandler == null && isAddressedToServer && XMPPCoreStanza.getWrapper(stanza) != null) resolvedHandler = SERVICE_UNAVAILABLE_STANZA_ERROR_HANDLER;
+            if (handlerForElement != null)
+                resolvedHandler = handlerForElement;
+            if (resolvedHandler == null && isAddressedToServer && XMPPCoreStanza.getWrapper(stanza) != null)
+                resolvedHandler = SERVICE_UNAVAILABLE_STANZA_ERROR_HANDLER;
         }
-        if (resolvedHandler == null) resolvedHandler = iqHandler;
+        if (resolvedHandler == null)
+            resolvedHandler = iqHandler;
         return resolvedHandler;
     }
 }

Modified: mina/vysper/trunk/server/core/src/main/java/org/apache/vysper/xmpp/protocol/StanzaProcessor.java
URL: http://svn.apache.org/viewvc/mina/vysper/trunk/server/core/src/main/java/org/apache/vysper/xmpp/protocol/StanzaProcessor.java?rev=958281&r1=958280&r2=958281&view=diff
==============================================================================
--- mina/vysper/trunk/server/core/src/main/java/org/apache/vysper/xmpp/protocol/StanzaProcessor.java (original)
+++ mina/vysper/trunk/server/core/src/main/java/org/apache/vysper/xmpp/protocol/StanzaProcessor.java Sat Jun 26 20:39:54 2010
@@ -19,8 +19,8 @@
  */
 package org.apache.vysper.xmpp.protocol;
 
-import org.apache.vysper.xmpp.server.SessionContext;
 import org.apache.vysper.xmpp.server.ServerRuntimeContext;
+import org.apache.vysper.xmpp.server.SessionContext;
 import org.apache.vysper.xmpp.stanza.Stanza;
 
 /**
@@ -33,7 +33,8 @@ public interface StanzaProcessor {
     /**
      * processes a stanza as received from a local session
      */
-    public void processStanza(ServerRuntimeContext serverRuntimeContext, SessionContext sessionContext, Stanza stanza, SessionStateHolder sessionStateHolder);
+    public void processStanza(ServerRuntimeContext serverRuntimeContext, SessionContext sessionContext, Stanza stanza,
+            SessionStateHolder sessionStateHolder);
 
     public void processTLSEstablished(SessionContext sessionContext, SessionStateHolder sessionStateHolder);
 }

Modified: mina/vysper/trunk/server/core/src/main/java/org/apache/vysper/xmpp/protocol/StateAwareProtocolWorker.java
URL: http://svn.apache.org/viewvc/mina/vysper/trunk/server/core/src/main/java/org/apache/vysper/xmpp/protocol/StateAwareProtocolWorker.java?rev=958281&r1=958280&r2=958281&view=diff
==============================================================================
--- mina/vysper/trunk/server/core/src/main/java/org/apache/vysper/xmpp/protocol/StateAwareProtocolWorker.java (original)
+++ mina/vysper/trunk/server/core/src/main/java/org/apache/vysper/xmpp/protocol/StateAwareProtocolWorker.java Sat Jun 26 20:39:54 2010
@@ -32,6 +32,6 @@ import org.apache.vysper.xmpp.stanza.Sta
  */
 public interface StateAwareProtocolWorker {
 
-    public void processStanza(SessionContext sessionContext, SessionStateHolder sessionStateHolder,
-                              Stanza stanza, StanzaHandler stanzaHandler);
+    public void processStanza(SessionContext sessionContext, SessionStateHolder sessionStateHolder, Stanza stanza,
+            StanzaHandler stanzaHandler);
 }

Modified: mina/vysper/trunk/server/core/src/main/java/org/apache/vysper/xmpp/protocol/StreamErrorCondition.java
URL: http://svn.apache.org/viewvc/mina/vysper/trunk/server/core/src/main/java/org/apache/vysper/xmpp/protocol/StreamErrorCondition.java?rev=958281&r1=958280&r2=958281&view=diff
==============================================================================
--- mina/vysper/trunk/server/core/src/main/java/org/apache/vysper/xmpp/protocol/StreamErrorCondition.java (original)
+++ mina/vysper/trunk/server/core/src/main/java/org/apache/vysper/xmpp/protocol/StreamErrorCondition.java Sat Jun 26 20:39:54 2010
@@ -27,30 +27,15 @@ package org.apache.vysper.xmpp.protocol;
  */
 public enum StreamErrorCondition {
 
-    BAD_FORMAT ("bad-format"),
-    BAD_NAMESPACE_PREFIX ("bad-namespace-prefix"),
-    CONFLICT ("conflict"),
-    CONNECTION_TIMEOUT ("connection-timeout"),
-    HOST_GONE ("host-gone"),
-    HOST_UNKNOWN ("host-unknown"),
-    IMPROPER_ADDRESSING ("improper-addressing"),
-    INTERNAL_SERVER_ERROR ("internal-server-error"),
-    INVALID_FROM ("invalid-from"),
-    INVALID_ID ("invalid-id"),
-    INVALID_NAMESPACE ("invalid-namespace"),
-    INVALID_XML ("invalid-xml"),
-    NOT_AUTHORIZED ("not-authorized"),
-    POLICY_VIOLATION ("policy-violation"),
-    REMOTE_CONNECTION_FAILED ("remote-connection-failed"),
-    RESOURCE_CONSTRAINT ("resource-constraint"),
-    RESTRICTED_XML ("restricted-xml"),
-    SEE_OTHER_HOST ("see-other-host"),
-    SYSTEM_SHUTDOWN ("system-shutdown"),
-    UNDEFINED_CONDITION ("undefined-condition"),
-    UNSUPPORTED_ENCODING ("unsupported-encoding"),
-    UNSUPPORTED_STANZA_TYPE ("unsupported-stanza-type"),
-    UNSUPPORTED_VERSION ("unsupported-version"),
-    XML_NOT_WELL_FORMED ("xml-not-well-formed");
+    BAD_FORMAT("bad-format"), BAD_NAMESPACE_PREFIX("bad-namespace-prefix"), CONFLICT("conflict"), CONNECTION_TIMEOUT(
+            "connection-timeout"), HOST_GONE("host-gone"), HOST_UNKNOWN("host-unknown"), IMPROPER_ADDRESSING(
+            "improper-addressing"), INTERNAL_SERVER_ERROR("internal-server-error"), INVALID_FROM("invalid-from"), INVALID_ID(
+            "invalid-id"), INVALID_NAMESPACE("invalid-namespace"), INVALID_XML("invalid-xml"), NOT_AUTHORIZED(
+            "not-authorized"), POLICY_VIOLATION("policy-violation"), REMOTE_CONNECTION_FAILED(
+            "remote-connection-failed"), RESOURCE_CONSTRAINT("resource-constraint"), RESTRICTED_XML("restricted-xml"), SEE_OTHER_HOST(
+            "see-other-host"), SYSTEM_SHUTDOWN("system-shutdown"), UNDEFINED_CONDITION("undefined-condition"), UNSUPPORTED_ENCODING(
+            "unsupported-encoding"), UNSUPPORTED_STANZA_TYPE("unsupported-stanza-type"), UNSUPPORTED_VERSION(
+            "unsupported-version"), XML_NOT_WELL_FORMED("xml-not-well-formed");
 
     private final String value;
 

Modified: mina/vysper/trunk/server/core/src/main/java/org/apache/vysper/xmpp/protocol/worker/AbstractStateAwareProtocolWorker.java
URL: http://svn.apache.org/viewvc/mina/vysper/trunk/server/core/src/main/java/org/apache/vysper/xmpp/protocol/worker/AbstractStateAwareProtocolWorker.java?rev=958281&r1=958280&r2=958281&view=diff
==============================================================================
--- mina/vysper/trunk/server/core/src/main/java/org/apache/vysper/xmpp/protocol/worker/AbstractStateAwareProtocolWorker.java (original)
+++ mina/vysper/trunk/server/core/src/main/java/org/apache/vysper/xmpp/protocol/worker/AbstractStateAwareProtocolWorker.java Sat Jun 26 20:39:54 2010
@@ -39,32 +39,39 @@ public abstract class AbstractStateAware
 
     abstract public SessionState getHandledState();
 
-    public void processStanza(SessionContext sessionContext, SessionStateHolder sessionStateHolder, Stanza stanza, StanzaHandler stanzaHandler) {
+    public void processStanza(SessionContext sessionContext, SessionStateHolder sessionStateHolder, Stanza stanza,
+            StanzaHandler stanzaHandler) {
         boolean proceed = checkState(sessionContext, sessionStateHolder, stanza, stanzaHandler);
-        if (!proceed) return; // TODO close stream?
+        if (!proceed)
+            return; // TODO close stream?
 
-        ResponseStanzaContainer responseStanzaContainer = executeHandler(sessionContext, sessionStateHolder, stanza, stanzaHandler);
+        ResponseStanzaContainer responseStanzaContainer = executeHandler(sessionContext, sessionStateHolder, stanza,
+                stanzaHandler);
 
         writeResponse(sessionContext, responseStanzaContainer);
     }
 
-    protected boolean checkState(SessionContext sessionContext, SessionStateHolder sessionStateHolder, Stanza stanza, StanzaHandler stanzaHandler) {
+    protected boolean checkState(SessionContext sessionContext, SessionStateHolder sessionStateHolder, Stanza stanza,
+            StanzaHandler stanzaHandler) {
         return 0 == getHandledState().compareTo(sessionContext.getState());
     }
 
     protected void writeResponse(SessionContext sessionContext, ResponseStanzaContainer responseStanzaContainer) {
         if (responseStanzaContainer != null && responseStanzaContainer.getResponseStanza() != null) {
             if (sessionContext == null) {
-                throw new IllegalStateException("no session context to write stanza to: " + responseStanzaContainer.getResponseStanza());
+                throw new IllegalStateException("no session context to write stanza to: "
+                        + responseStanzaContainer.getResponseStanza());
             }
             ResponseWriter.writeResponse(sessionContext, responseStanzaContainer);
         }
     }
 
-    protected ResponseStanzaContainer executeHandler(SessionContext sessionContext, SessionStateHolder sessionStateHolder, Stanza stanza, StanzaHandler stanzaHandler) {
+    protected ResponseStanzaContainer executeHandler(SessionContext sessionContext,
+            SessionStateHolder sessionStateHolder, Stanza stanza, StanzaHandler stanzaHandler) {
         ResponseStanzaContainer responseStanzaContainer = null;
         try {
-            responseStanzaContainer = stanzaHandler.execute(stanza, sessionContext.getServerRuntimeContext(), isProcessingOutboundStanzas(), sessionContext, sessionStateHolder);
+            responseStanzaContainer = stanzaHandler.execute(stanza, sessionContext.getServerRuntimeContext(),
+                    isProcessingOutboundStanzas(), sessionContext, sessionStateHolder);
         } catch (ProtocolException e) {
             ResponseWriter.handleProtocolError(e, sessionContext, stanza);
             return null;

Modified: mina/vysper/trunk/server/core/src/main/java/org/apache/vysper/xmpp/protocol/worker/AuthenticatedProtocolWorker.java
URL: http://svn.apache.org/viewvc/mina/vysper/trunk/server/core/src/main/java/org/apache/vysper/xmpp/protocol/worker/AuthenticatedProtocolWorker.java?rev=958281&r1=958280&r2=958281&view=diff
==============================================================================
--- mina/vysper/trunk/server/core/src/main/java/org/apache/vysper/xmpp/protocol/worker/AuthenticatedProtocolWorker.java (original)
+++ mina/vysper/trunk/server/core/src/main/java/org/apache/vysper/xmpp/protocol/worker/AuthenticatedProtocolWorker.java Sat Jun 26 20:39:54 2010
@@ -34,9 +34,12 @@ import org.apache.vysper.xmpp.stanza.Sta
 public class AuthenticatedProtocolWorker extends AbstractStateAwareProtocolWorker {
 
     @Override
-    protected boolean checkState(SessionContext sessionContext, SessionStateHolder sessionStateHolder, Stanza stanza, StanzaHandler stanzaHandler) {
-        if (stanzaHandler instanceof StreamStartHandler) return true;
-        if (stanzaHandler.verify(stanza)) return true;
+    protected boolean checkState(SessionContext sessionContext, SessionStateHolder sessionStateHolder, Stanza stanza,
+            StanzaHandler stanzaHandler) {
+        if (stanzaHandler instanceof StreamStartHandler)
+            return true;
+        if (stanzaHandler.verify(stanza))
+            return true;
         ResponseWriter.writeUnsupportedStanzaError(sessionContext);
         return false;
     }

Modified: mina/vysper/trunk/server/core/src/main/java/org/apache/vysper/xmpp/protocol/worker/EncryptedProtocolWorker.java
URL: http://svn.apache.org/viewvc/mina/vysper/trunk/server/core/src/main/java/org/apache/vysper/xmpp/protocol/worker/EncryptedProtocolWorker.java?rev=958281&r1=958280&r2=958281&view=diff
==============================================================================
--- mina/vysper/trunk/server/core/src/main/java/org/apache/vysper/xmpp/protocol/worker/EncryptedProtocolWorker.java (original)
+++ mina/vysper/trunk/server/core/src/main/java/org/apache/vysper/xmpp/protocol/worker/EncryptedProtocolWorker.java Sat Jun 26 20:39:54 2010
@@ -41,10 +41,14 @@ public class EncryptedProtocolWorker ext
     }
 
     @Override
-    protected boolean checkState(SessionContext sessionContext, SessionStateHolder sessionStateHolder, Stanza stanza, StanzaHandler stanzaHandler) {
-        if (stanzaHandler instanceof StreamStartHandler) return true;
-        if (stanzaHandler instanceof AbstractSASLHandler) return true;
-        if (stanzaHandler instanceof XMLPrologHandler) return true; // PSI client sends that. 
+    protected boolean checkState(SessionContext sessionContext, SessionStateHolder sessionStateHolder, Stanza stanza,
+            StanzaHandler stanzaHandler) {
+        if (stanzaHandler instanceof StreamStartHandler)
+            return true;
+        if (stanzaHandler instanceof AbstractSASLHandler)
+            return true;
+        if (stanzaHandler instanceof XMLPrologHandler)
+            return true; // PSI client sends that. 
         ResponseWriter.writeUnsupportedStanzaError(sessionContext);
         return false;
     }

Modified: mina/vysper/trunk/server/core/src/main/java/org/apache/vysper/xmpp/protocol/worker/EncryptionStartedProtocolWorker.java
URL: http://svn.apache.org/viewvc/mina/vysper/trunk/server/core/src/main/java/org/apache/vysper/xmpp/protocol/worker/EncryptionStartedProtocolWorker.java?rev=958281&r1=958280&r2=958281&view=diff
==============================================================================
--- mina/vysper/trunk/server/core/src/main/java/org/apache/vysper/xmpp/protocol/worker/EncryptionStartedProtocolWorker.java (original)
+++ mina/vysper/trunk/server/core/src/main/java/org/apache/vysper/xmpp/protocol/worker/EncryptionStartedProtocolWorker.java Sat Jun 26 20:39:54 2010
@@ -37,7 +37,8 @@ public class EncryptionStartedProtocolWo
     }
 
     @Override
-    protected boolean checkState(SessionContext sessionContext, SessionStateHolder sessionStateHolder, Stanza stanza, StanzaHandler stanzaHandler) {
+    protected boolean checkState(SessionContext sessionContext, SessionStateHolder sessionStateHolder, Stanza stanza,
+            StanzaHandler stanzaHandler) {
         // StartTLS is currently completely handled on the protocol side.
         // anyway, there are no stanzas to be parsed between ENCRYPTION_STARTED and ENCRYPTED.
         // the state change is handeld in ProtocolWorker.processTLSEstablished()

Modified: mina/vysper/trunk/server/core/src/main/java/org/apache/vysper/xmpp/protocol/worker/EndOrClosedProtocolWorker.java
URL: http://svn.apache.org/viewvc/mina/vysper/trunk/server/core/src/main/java/org/apache/vysper/xmpp/protocol/worker/EndOrClosedProtocolWorker.java?rev=958281&r1=958280&r2=958281&view=diff
==============================================================================
--- mina/vysper/trunk/server/core/src/main/java/org/apache/vysper/xmpp/protocol/worker/EndOrClosedProtocolWorker.java (original)
+++ mina/vysper/trunk/server/core/src/main/java/org/apache/vysper/xmpp/protocol/worker/EndOrClosedProtocolWorker.java Sat Jun 26 20:39:54 2010
@@ -37,7 +37,8 @@ public class EndOrClosedProtocolWorker e
     }
 
     @Override
-    protected boolean checkState(SessionContext sessionContext, SessionStateHolder sessionStateHolder, Stanza stanza, StanzaHandler stanzaHandler) {
+    protected boolean checkState(SessionContext sessionContext, SessionStateHolder sessionStateHolder, Stanza stanza,
+            StanzaHandler stanzaHandler) {
         throw new RuntimeException("session was terminated");
     }
 }

Modified: mina/vysper/trunk/server/core/src/main/java/org/apache/vysper/xmpp/protocol/worker/InitiatedProtocolWorker.java
URL: http://svn.apache.org/viewvc/mina/vysper/trunk/server/core/src/main/java/org/apache/vysper/xmpp/protocol/worker/InitiatedProtocolWorker.java?rev=958281&r1=958280&r2=958281&view=diff
==============================================================================
--- mina/vysper/trunk/server/core/src/main/java/org/apache/vysper/xmpp/protocol/worker/InitiatedProtocolWorker.java (original)
+++ mina/vysper/trunk/server/core/src/main/java/org/apache/vysper/xmpp/protocol/worker/InitiatedProtocolWorker.java Sat Jun 26 20:39:54 2010
@@ -40,9 +40,12 @@ public class InitiatedProtocolWorker ext
     }
 
     @Override
-    protected boolean checkState(SessionContext sessionContext, SessionStateHolder sessionStateHolder, Stanza stanza, StanzaHandler stanzaHandler) {
-        if (stanzaHandler instanceof XMLPrologHandler) return true;
-        if (stanzaHandler instanceof StreamStartHandler) return true;
+    protected boolean checkState(SessionContext sessionContext, SessionStateHolder sessionStateHolder, Stanza stanza,
+            StanzaHandler stanzaHandler) {
+        if (stanzaHandler instanceof XMLPrologHandler)
+            return true;
+        if (stanzaHandler instanceof StreamStartHandler)
+            return true;
         ResponseWriter.writeUnsupportedStanzaError(sessionContext);
         return false;
     }

Modified: mina/vysper/trunk/server/core/src/main/java/org/apache/vysper/xmpp/protocol/worker/StartedProtocolWorker.java
URL: http://svn.apache.org/viewvc/mina/vysper/trunk/server/core/src/main/java/org/apache/vysper/xmpp/protocol/worker/StartedProtocolWorker.java?rev=958281&r1=958280&r2=958281&view=diff
==============================================================================
--- mina/vysper/trunk/server/core/src/main/java/org/apache/vysper/xmpp/protocol/worker/StartedProtocolWorker.java (original)
+++ mina/vysper/trunk/server/core/src/main/java/org/apache/vysper/xmpp/protocol/worker/StartedProtocolWorker.java Sat Jun 26 20:39:54 2010
@@ -39,8 +39,10 @@ public class StartedProtocolWorker exten
     }
 
     @Override
-    protected boolean checkState(SessionContext sessionContext, SessionStateHolder sessionStateHolder, Stanza stanza, StanzaHandler stanzaHandler) {
-        if (stanzaHandler instanceof StartTLSHandler) return true;
+    protected boolean checkState(SessionContext sessionContext, SessionStateHolder sessionStateHolder, Stanza stanza,
+            StanzaHandler stanzaHandler) {
+        if (stanzaHandler instanceof StartTLSHandler)
+            return true;
         ResponseWriter.writeUnsupportedStanzaError(sessionContext);
         return false;
     }

Modified: mina/vysper/trunk/server/core/src/main/java/org/apache/vysper/xmpp/protocol/worker/UnconnectedProtocolWorker.java
URL: http://svn.apache.org/viewvc/mina/vysper/trunk/server/core/src/main/java/org/apache/vysper/xmpp/protocol/worker/UnconnectedProtocolWorker.java?rev=958281&r1=958280&r2=958281&view=diff
==============================================================================
--- mina/vysper/trunk/server/core/src/main/java/org/apache/vysper/xmpp/protocol/worker/UnconnectedProtocolWorker.java (original)
+++ mina/vysper/trunk/server/core/src/main/java/org/apache/vysper/xmpp/protocol/worker/UnconnectedProtocolWorker.java Sat Jun 26 20:39:54 2010
@@ -17,7 +17,7 @@
  *  under the License.
  *
  */
- package org.apache.vysper.xmpp.protocol.worker;
+package org.apache.vysper.xmpp.protocol.worker;
 
 import org.apache.vysper.xmpp.protocol.SessionStateHolder;
 import org.apache.vysper.xmpp.protocol.StanzaHandler;
@@ -37,7 +37,8 @@ public class UnconnectedProtocolWorker e
     }
 
     @Override
-    protected boolean checkState(SessionContext sessionContext, SessionStateHolder sessionStateHolder, Stanza stanza, StanzaHandler stanzaHandler) {
+    protected boolean checkState(SessionContext sessionContext, SessionStateHolder sessionStateHolder, Stanza stanza,
+            StanzaHandler stanzaHandler) {
         // TODO
         return true;
     }

Modified: mina/vysper/trunk/server/core/src/main/java/org/apache/vysper/xmpp/server/AbstractSessionContext.java
URL: http://svn.apache.org/viewvc/mina/vysper/trunk/server/core/src/main/java/org/apache/vysper/xmpp/server/AbstractSessionContext.java?rev=958281&r1=958280&r2=958281&view=diff
==============================================================================
--- mina/vysper/trunk/server/core/src/main/java/org/apache/vysper/xmpp/server/AbstractSessionContext.java (original)
+++ mina/vysper/trunk/server/core/src/main/java/org/apache/vysper/xmpp/server/AbstractSessionContext.java Sat Jun 26 20:39:54 2010
@@ -20,6 +20,9 @@
 
 package org.apache.vysper.xmpp.server;
 
+import java.util.HashMap;
+import java.util.Map;
+
 import org.apache.vysper.xmpp.addressing.Entity;
 import org.apache.vysper.xmpp.protocol.ProtocolException;
 import org.apache.vysper.xmpp.protocol.SessionStateHolder;
@@ -33,10 +36,6 @@ import org.apache.vysper.xmpp.writer.Sta
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import java.util.HashMap;
-import java.util.Map;
-import java.util.List;
-
 /**
  * provides default session context behavior
  * 
@@ -45,15 +44,23 @@ import java.util.List;
 public abstract class AbstractSessionContext implements SessionContext {
 
     private static final Logger logger = LoggerFactory.getLogger(AbstractSessionContext.class);
-    
+
     protected ServerRuntimeContext serverRuntimeContext;
+
     protected String sessionId;
+
     protected String xmlLang;
+
     protected UUIDGenerator sequence = new JVMBuiltinUUIDGenerator();
+
     protected SessionStateHolder sessionStateHolder; // be secure: do not provide this via a getter or other means
+
     protected Entity serverEntity;
+
     private Entity initiatingEntity;
+
     private boolean serverToServer = false;
+
     private Map<String, Object> attributeMap = new HashMap<String, Object>();
 
     public AbstractSessionContext(ServerRuntimeContext serverRuntimeContext, SessionStateHolder sessionStateHolder) {
@@ -82,8 +89,10 @@ public abstract class AbstractSessionCon
     }
 
     public void setInitiatingEntity(Entity entity) {
-        if (entity == null) throw new IllegalArgumentException("initiating entity must not be set to NULL");
-        if (entity.isResourceSet()) throw new IllegalArgumentException("initiating entity must be bare JID");
+        if (entity == null)
+            throw new IllegalArgumentException("initiating entity must not be set to NULL");
+        if (entity.isResourceSet())
+            throw new IllegalArgumentException("initiating entity must be bare JID");
         this.initiatingEntity = entity;
     }
 
@@ -117,15 +126,15 @@ public abstract class AbstractSessionCon
     }
 
     public void endSession(SessionTerminationCause terminationCause) {
-		StanzaWriter stanzaWriter = getResponseWriter();
-		stanzaWriter.close();
+        StanzaWriter stanzaWriter = getResponseWriter();
+        stanzaWriter.close();
 
         if (terminationCause == null) {
             throw new RuntimeException("no termination cause given");
         }
 
-		if (terminationCause == SessionTerminationCause.CLIENT_BYEBYE ||
-            terminationCause == SessionTerminationCause.CONNECTION_ABORT) {
+        if (terminationCause == SessionTerminationCause.CLIENT_BYEBYE
+                || terminationCause == SessionTerminationCause.CONNECTION_ABORT) {
             Stanza unavailableStanza = StanzaBuilder.createUnavailablePresenceStanza(null, terminationCause);
             StanzaHandler handler = serverRuntimeContext.getHandler(unavailableStanza);
             try {
@@ -144,11 +153,11 @@ public abstract class AbstractSessionCon
 
         // unbind session and remove from registry
         serverRuntimeContext.getResourceRegistry().unbindSession(this);
-        
+
         sessionStateHolder.setState(SessionState.CLOSED); // no more traffic
-        
-		// TODO close underlying transport (TCP socket)
-	}
+
+        // TODO close underlying transport (TCP socket)
+    }
 
     public Entity getServerJID() {
         return serverEntity;
@@ -166,7 +175,7 @@ public abstract class AbstractSessionCon
      * @return unique sequence ID
      */
     public String nextSequenceValue() {
-    	return sequence.create();
+        return sequence.create();
     }
 
     public Object putAttribute(String key, Object value) {

Modified: mina/vysper/trunk/server/core/src/main/java/org/apache/vysper/xmpp/server/DefaultServerRuntimeContext.java
URL: http://svn.apache.org/viewvc/mina/vysper/trunk/server/core/src/main/java/org/apache/vysper/xmpp/server/DefaultServerRuntimeContext.java?rev=958281&r1=958280&r2=958281&view=diff
==============================================================================
--- mina/vysper/trunk/server/core/src/main/java/org/apache/vysper/xmpp/server/DefaultServerRuntimeContext.java (original)
+++ mina/vysper/trunk/server/core/src/main/java/org/apache/vysper/xmpp/server/DefaultServerRuntimeContext.java Sat Jun 26 20:39:54 2010
@@ -38,18 +38,18 @@ import org.apache.vysper.xmpp.modules.Mo
 import org.apache.vysper.xmpp.modules.ServerRuntimeContextService;
 import org.apache.vysper.xmpp.protocol.HandlerDictionary;
 import org.apache.vysper.xmpp.protocol.NamespaceHandlerDictionary;
+import org.apache.vysper.xmpp.protocol.ProtocolWorker;
 import org.apache.vysper.xmpp.protocol.QueuedStanzaProcessor;
 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.server.components.Component;
 import org.apache.vysper.xmpp.stanza.Stanza;
 import org.apache.vysper.xmpp.state.presence.LatestPresenceCache;
 import org.apache.vysper.xmpp.state.presence.SimplePresenceCache;
 import org.apache.vysper.xmpp.state.resourcebinding.ResourceRegistry;
 import org.apache.vysper.xmpp.uuid.JVMBuiltinUUIDGenerator;
 import org.apache.vysper.xmpp.uuid.UUIDGenerator;
-import org.apache.vysper.xmpp.server.components.Component;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -114,7 +114,7 @@ public class DefaultServerRuntimeContext
      * holds the storage services
      */
     private StorageProviderRegistry storageProviderRegistry = new OpenStorageProviderRegistry();
-    
+
     /**
      * collection of all other services, which are mostly add-ons to the minimal setup
      */
@@ -132,16 +132,14 @@ public class DefaultServerRuntimeContext
         this.stanzaHandlerLookup = new StanzaHandlerLookup(this);
     }
 
-    public DefaultServerRuntimeContext(Entity serverEntity, StanzaRelay stanzaRelay, StorageProviderRegistry storageProviderRegistry) {
+    public DefaultServerRuntimeContext(Entity serverEntity, StanzaRelay stanzaRelay,
+            StorageProviderRegistry storageProviderRegistry) {
         this(serverEntity, stanzaRelay);
-        this.storageProviderRegistry = storageProviderRegistry; 
+        this.storageProviderRegistry = storageProviderRegistry;
     }
 
-    public DefaultServerRuntimeContext(Entity serverEntity,
-                                       StanzaRelay stanzaRelay,
-                                       ServerFeatures serverFeatures,
-                                       List<NamespaceHandlerDictionary> dictionaries,
-                                       ResourceRegistry resourceRegistry) {
+    public DefaultServerRuntimeContext(Entity serverEntity, StanzaRelay stanzaRelay, ServerFeatures serverFeatures,
+            List<NamespaceHandlerDictionary> dictionaries, ResourceRegistry resourceRegistry) {
         this(serverEntity, stanzaRelay);
         this.serverFeatures = serverFeatures;
         this.resourceRegistry = resourceRegistry;
@@ -229,7 +227,8 @@ public class DefaultServerRuntimeContext
      * @param service
      */
     public void registerServerRuntimeContextService(ServerRuntimeContextService service) {
-        if (service == null) throw new IllegalStateException("service must not be null");
+        if (service == null)
+            throw new IllegalStateException("service must not be null");
         if (serverRuntimeContextServiceMap.get(service.getServiceName()) != null) {
             throw new IllegalStateException("service already registered: " + service.getServiceName());
         }
@@ -253,7 +252,8 @@ public class DefaultServerRuntimeContext
      * @param storageProviderRegistry
      */
     public void setStorageProviderRegistry(StorageProviderRegistry storageProviderRegistry) {
-        logger.info("replacing the storage provider registry with " + storageProviderRegistry.getClass().getCanonicalName());
+        logger.info("replacing the storage provider registry with "
+                + storageProviderRegistry.getClass().getCanonicalName());
         this.storageProviderRegistry = storageProviderRegistry;
     }
 
@@ -298,7 +298,7 @@ public class DefaultServerRuntimeContext
         addModuleInternal(module);
         module.initialize(this);
     }
-    
+
     protected void addModuleInternal(Module module) {
 
         logger.info("adding module... {} ({})", module.getName(), module.getVersion());
@@ -307,7 +307,7 @@ public class DefaultServerRuntimeContext
         if (serviceList != null) {
             for (ServerRuntimeContextService serverRuntimeContextService : serviceList) {
                 registerServerRuntimeContextService(serverRuntimeContextService);
-                
+
                 // if a storage service, also register there 
                 if (serverRuntimeContextService instanceof StorageProvider) {
                     StorageProvider storageProvider = (StorageProvider) serverRuntimeContextService;
@@ -323,21 +323,21 @@ public class DefaultServerRuntimeContext
                 if (handlerDictionary instanceof NamespaceHandlerDictionary) {
                     addDictionary((NamespaceHandlerDictionary) handlerDictionary);
                 } else {
-                    throw new RuntimeException("arbitrary HandlerDictionary implementations not supported yet, " +
-                    		"only NamespaceHandlerDictionary.");
+                    throw new RuntimeException("arbitrary HandlerDictionary implementations not supported yet, "
+                            + "only NamespaceHandlerDictionary.");
                 }
             }
-            
+
         }
 
         if (module instanceof Component) {
-            registerComponent((Component)module);
+            registerComponent((Component) module);
         }
     }
-    
+
     public void registerComponent(Component component) {
         componentMap.put(component.getSubdomain(), component);
-    }                          
+    }
 
     public StanzaProcessor getComponentStanzaProcessor(String domain) {
         String serverDomain = getServerEnitity().getDomain();
@@ -346,7 +346,8 @@ public class DefaultServerRuntimeContext
         }
         String subdomain = domain.replace("." + serverDomain, "");
         Component component = componentMap.get(subdomain);
-        if (component == null) return null;
+        if (component == null)
+            return null;
         return component.getStanzaProcessor();
     }
 

Modified: mina/vysper/trunk/server/core/src/main/java/org/apache/vysper/xmpp/server/ServerFeatures.java
URL: http://svn.apache.org/viewvc/mina/vysper/trunk/server/core/src/main/java/org/apache/vysper/xmpp/server/ServerFeatures.java?rev=958281&r1=958280&r2=958281&view=diff
==============================================================================
--- mina/vysper/trunk/server/core/src/main/java/org/apache/vysper/xmpp/server/ServerFeatures.java (original)
+++ mina/vysper/trunk/server/core/src/main/java/org/apache/vysper/xmpp/server/ServerFeatures.java Sat Jun 26 20:39:54 2010
@@ -19,11 +19,11 @@
  */
 package org.apache.vysper.xmpp.server;
 
-import org.apache.vysper.xmpp.authorization.SASLMechanism;
-
 import java.util.ArrayList;
-import java.util.List;
 import java.util.Collections;
+import java.util.List;
+
+import org.apache.vysper.xmpp.authorization.SASLMechanism;
 
 /**
  * switch configuration of optional server features
@@ -64,7 +64,7 @@ public class ServerFeatures {
      * see http://xmpp.org/internet-drafts/draft-ietf-xmpp-3921bis-05.html#rules-barejid-resource-message
      *
      */
-    private boolean deliverMessageToHighestPriorityResourcesOnly = false; 
+    private boolean deliverMessageToHighestPriorityResourcesOnly = false;
 
     public ServerFeatures() {
         // default constructor

Modified: mina/vysper/trunk/server/core/src/main/java/org/apache/vysper/xmpp/server/ServerMain.java
URL: http://svn.apache.org/viewvc/mina/vysper/trunk/server/core/src/main/java/org/apache/vysper/xmpp/server/ServerMain.java?rev=958281&r1=958280&r2=958281&view=diff
==============================================================================
--- mina/vysper/trunk/server/core/src/main/java/org/apache/vysper/xmpp/server/ServerMain.java (original)
+++ mina/vysper/trunk/server/core/src/main/java/org/apache/vysper/xmpp/server/ServerMain.java Sat Jun 26 20:39:54 2010
@@ -20,23 +20,22 @@
 package org.apache.vysper.xmpp.server;
 
 import java.io.File;
-import java.util.List;
 import java.util.ArrayList;
+import java.util.List;
 
 import org.apache.vysper.mina.TCPEndpoint;
 import org.apache.vysper.storage.StorageProviderRegistry;
-import org.apache.vysper.storage.jcr.JcrStorageProviderRegistry;
 import org.apache.vysper.storage.inmemory.MemoryStorageProviderRegistry;
 import org.apache.vysper.xmpp.addressing.EntityFormatException;
 import org.apache.vysper.xmpp.addressing.EntityImpl;
 import org.apache.vysper.xmpp.authorization.AccountCreationException;
 import org.apache.vysper.xmpp.authorization.AccountManagement;
+import org.apache.vysper.xmpp.modules.Module;
+import org.apache.vysper.xmpp.modules.extension.xep0049_privatedata.PrivateDataModule;
 import org.apache.vysper.xmpp.modules.extension.xep0054_vcardtemp.VcardTempModule;
 import org.apache.vysper.xmpp.modules.extension.xep0092_software_version.SoftwareVersionModule;
 import org.apache.vysper.xmpp.modules.extension.xep0119_xmppping.XmppPingModule;
 import org.apache.vysper.xmpp.modules.extension.xep0202_entity_time.EntityTimeModule;
-import org.apache.vysper.xmpp.modules.extension.xep0049_privatedata.PrivateDataModule;
-import org.apache.vysper.xmpp.modules.Module;
 
 /**
  * starts the server as a standalone application
@@ -67,7 +66,8 @@ public class ServerMain {
         //StorageProviderRegistry providerRegistry = new JcrStorageProviderRegistry();
         StorageProviderRegistry providerRegistry = new MemoryStorageProviderRegistry();
 
-        final AccountManagement accountManagement = (AccountManagement)providerRegistry.retrieve(AccountManagement.class);
+        final AccountManagement accountManagement = (AccountManagement) providerRegistry
+                .retrieve(AccountManagement.class);
 
         if (!accountManagement.verifyAccountExists(EntityImpl.parse("user1@vysper.org"))) {
             accountManagement.addUser("user1@vysper.org", "password1");
@@ -108,11 +108,11 @@ public class ServerMain {
 
     private static List<Module> createModuleInstances(String[] moduleClassNames) {
         List<Module> modules = new ArrayList<Module>();
-        
+
         for (String moduleClassName : moduleClassNames) {
             Class<Module> moduleClass;
             try {
-                moduleClass = (Class<Module>)Class.forName(moduleClassName);
+                moduleClass = (Class<Module>) Class.forName(moduleClassName);
             } catch (ClassCastException e) {
                 System.err.println("not a Vysper module class: " + moduleClassName);
                 continue;

Modified: mina/vysper/trunk/server/core/src/main/java/org/apache/vysper/xmpp/server/ServerRuntimeContext.java
URL: http://svn.apache.org/viewvc/mina/vysper/trunk/server/core/src/main/java/org/apache/vysper/xmpp/server/ServerRuntimeContext.java?rev=958281&r1=958280&r2=958281&view=diff
==============================================================================
--- mina/vysper/trunk/server/core/src/main/java/org/apache/vysper/xmpp/server/ServerRuntimeContext.java (original)
+++ mina/vysper/trunk/server/core/src/main/java/org/apache/vysper/xmpp/server/ServerRuntimeContext.java Sat Jun 26 20:39:54 2010
@@ -20,6 +20,8 @@
 
 package org.apache.vysper.xmpp.server;
 
+import javax.net.ssl.SSLContext;
+
 import org.apache.vysper.storage.StorageProvider;
 import org.apache.vysper.xmpp.addressing.Entity;
 import org.apache.vysper.xmpp.authorization.UserAuthorization;
@@ -27,12 +29,10 @@ import org.apache.vysper.xmpp.delivery.S
 import org.apache.vysper.xmpp.modules.ServerRuntimeContextService;
 import org.apache.vysper.xmpp.protocol.StanzaHandler;
 import org.apache.vysper.xmpp.protocol.StanzaProcessor;
+import org.apache.vysper.xmpp.server.components.Component;
 import org.apache.vysper.xmpp.stanza.Stanza;
 import org.apache.vysper.xmpp.state.presence.LatestPresenceCache;
 import org.apache.vysper.xmpp.state.resourcebinding.ResourceRegistry;
-import org.apache.vysper.xmpp.server.components.Component;
-
-import javax.net.ssl.SSLContext;
 
 /**
  * provides each session with server-global data
@@ -65,7 +65,7 @@ public interface ServerRuntimeContext {
     void registerServerRuntimeContextService(ServerRuntimeContextService service);
 
     ServerRuntimeContextService getServerRuntimeContextService(String name);
-    
+
     StorageProvider getStorageProvider(Class<? extends StorageProvider> clazz);
 
     void registerComponent(Component component);

Modified: mina/vysper/trunk/server/core/src/main/java/org/apache/vysper/xmpp/server/SessionContext.java
URL: http://svn.apache.org/viewvc/mina/vysper/trunk/server/core/src/main/java/org/apache/vysper/xmpp/server/SessionContext.java?rev=958281&r1=958280&r2=958281&view=diff
==============================================================================
--- mina/vysper/trunk/server/core/src/main/java/org/apache/vysper/xmpp/server/SessionContext.java (original)
+++ mina/vysper/trunk/server/core/src/main/java/org/apache/vysper/xmpp/server/SessionContext.java Sat Jun 26 20:39:54 2010
@@ -20,9 +20,9 @@
 
 package org.apache.vysper.xmpp.server;
 
-import org.apache.vysper.xmpp.writer.StanzaWriter;
 import org.apache.vysper.xmpp.addressing.Entity;
 import org.apache.vysper.xmpp.state.resourcebinding.BindException;
+import org.apache.vysper.xmpp.writer.StanzaWriter;
 
 /**
  * provides the server-side session with its context data
@@ -32,6 +32,7 @@ import org.apache.vysper.xmpp.state.reso
 public interface SessionContext {
 
     static final String SESSION_ATTRIBUTE_MESSAGE_STANZA_NO_RECEIVE = "stanza.message.no_receive";
+
     static final String SESSION_ATTRIBUTE_PRESENCE_STANZA_NO_RECEIVE = "stanza.presence.no_receive";
 
     public enum SessionTerminationCause {
@@ -54,124 +55,124 @@ public interface SessionContext {
         STREAM_ERROR;
 
         public static boolean isClientReceivingStanzas(SessionTerminationCause cause) {
-            return cause == null || cause == SERVER_SHUTDOWN || cause == CLIENT_BYEBYE; 
+            return cause == null || cause == SERVER_SHUTDOWN || cause == CLIENT_BYEBYE;
         }
 
     }
 
-	/**
-	 * Gets the {@link ServerRuntimeContext}.
-	 *
-	 * @return the {@link ServerRuntimeContext}
-	 */
-	ServerRuntimeContext getServerRuntimeContext();
-
-	/**
-	 * FALSE iff _this_ server has initiated the connection (to another server),
-	 * and _not_ the remote side (client/server) initiated the session. for
-	 * common client/server connections this returns TRUE.
-	 *
-	 * @return
-	 */
-	boolean isRemotelyInitiatedSession();
-
-	/**
-	 * @return the initiating {@link Entity}
-	 */
-	Entity getInitiatingEntity();
-
-	/**
-	 * Sets the initiating entity.
-	 *
-	 * @param entity
-	 */
-	void setInitiatingEntity(Entity entity);
-
-	/**
-	 * @return <code>true</code> if this session is handling server-to-server
-	 *         communication (namespace "jabber:server").
-	 */
-	boolean isServerToServer();
-
-	/**
-	 * Set this session to handle server-to-server communication.
-	 */
-	void setServerToServer();
-
-	/**
-	 * Set this session to handle client-to-server communication.
-	 */
-	void setClientToServer();
-
-	/**
-	 * @return the state of this session
-	 */
-	SessionState getState();
-
-	/**
-	 * Returns the id for this session, which is unique inside a server instance
-	 * and across all hosted services.
-	 *
-	 * @return this session's id
-	 */
-	String getSessionId();
-
-	/**
-	 * Gets the default value for the 'xml:lang' attribute.
-	 *
-	 * @return the default language code
-	 */
-	String getXMLLang();
-
-	/**
-	 * Sets the default value for the 'xml:lang' attribute.
-	 *
-	 * @param languageCode
-	 *            the default language code
-	 */
-	void setXMLLang(String languageCode);
+    /**
+     * Gets the {@link ServerRuntimeContext}.
+     *
+     * @return the {@link ServerRuntimeContext}
+     */
+    ServerRuntimeContext getServerRuntimeContext();
+
+    /**
+     * FALSE iff _this_ server has initiated the connection (to another server),
+     * and _not_ the remote side (client/server) initiated the session. for
+     * common client/server connections this returns TRUE.
+     *
+     * @return
+     */
+    boolean isRemotelyInitiatedSession();
+
+    /**
+     * @return the initiating {@link Entity}
+     */
+    Entity getInitiatingEntity();
+
+    /**
+     * Sets the initiating entity.
+     *
+     * @param entity
+     */
+    void setInitiatingEntity(Entity entity);
+
+    /**
+     * @return <code>true</code> if this session is handling server-to-server
+     *         communication (namespace "jabber:server").
+     */
+    boolean isServerToServer();
 
-	StanzaWriter getResponseWriter();
+    /**
+     * Set this session to handle server-to-server communication.
+     */
+    void setServerToServer();
 
-	/**
-	 * Ends this session and the underlying TCP connection.
+    /**
+     * Set this session to handle client-to-server communication.
+     */
+    void setClientToServer();
+
+    /**
+     * @return the state of this session
+     */
+    SessionState getState();
+
+    /**
+     * Returns the id for this session, which is unique inside a server instance
+     * and across all hosted services.
+     *
+     * @return this session's id
+     */
+    String getSessionId();
+
+    /**
+     * Gets the default value for the 'xml:lang' attribute.
+     *
+     * @return the default language code
+     */
+    String getXMLLang();
+
+    /**
+     * Sets the default value for the 'xml:lang' attribute.
+     *
+     * @param languageCode
+     *            the default language code
+     */
+    void setXMLLang(String languageCode);
+
+    StanzaWriter getResponseWriter();
+
+    /**
+     * Ends this session and the underlying TCP connection.
      * @param give the logical cause for the session's end
-	 */
-	void endSession(SessionTerminationCause terminationCause);
+     */
+    void endSession(SessionTerminationCause terminationCause);
 
-	/**
-	 * Gets the JID of the server this session is associated with.
-	 *
-	 * @return the server's JID
-	 */
-	Entity getServerJID();
-
-	/**
-	 * signals the underlying transport to handle TLS handshake
-	 */
-	void switchToTLS();
-
-	/**
-	 * this method signals that from now on a new <stream:stream>... xml stream
-	 * begins. this is used at the very beginning of the session, then again
-	 * after encryption and after authentication. see RFC3920.7.5.7 and
-	 * RFC3920.6.2
-	 */
-	void setIsReopeningXMLStream();
-
-	/**
-	 * binds a resource to the session
-	 *
-	 * @return resource id
-	 * @throws BindException
-	 *             when binding fails
-	 */
-	String bindResource() throws BindException;
-
-	/**
-	 * @return a value other than any previously generated values.
-	 */
-	String nextSequenceValue();
+    /**
+     * Gets the JID of the server this session is associated with.
+     *
+     * @return the server's JID
+     */
+    Entity getServerJID();
+
+    /**
+     * signals the underlying transport to handle TLS handshake
+     */
+    void switchToTLS();
+
+    /**
+     * this method signals that from now on a new <stream:stream>... xml stream
+     * begins. this is used at the very beginning of the session, then again
+     * after encryption and after authentication. see RFC3920.7.5.7 and
+     * RFC3920.6.2
+     */
+    void setIsReopeningXMLStream();
+
+    /**
+     * binds a resource to the session
+     *
+     * @return resource id
+     * @throws BindException
+     *             when binding fails
+     */
+    String bindResource() throws BindException;
+
+    /**
+     * @return a value other than any previously generated values.
+     */
+    String nextSequenceValue();
 
     /**
      * put arbitrary object into the session

Modified: mina/vysper/trunk/server/core/src/main/java/org/apache/vysper/xmpp/server/SessionState.java
URL: http://svn.apache.org/viewvc/mina/vysper/trunk/server/core/src/main/java/org/apache/vysper/xmpp/server/SessionState.java?rev=958281&r1=958280&r2=958281&view=diff
==============================================================================
--- mina/vysper/trunk/server/core/src/main/java/org/apache/vysper/xmpp/server/SessionState.java (original)
+++ mina/vysper/trunk/server/core/src/main/java/org/apache/vysper/xmpp/server/SessionState.java Sat Jun 26 20:39:54 2010
@@ -55,7 +55,7 @@ public enum SessionState {
     /**
      * authentication has begun, but is not yet finished
      */
-//    AUTHENTICATION_STARTED,
+    //    AUTHENTICATION_STARTED,
 
     /**
      * authenticated
@@ -65,12 +65,12 @@ public enum SessionState {
     /**
      * a resource has been bound to the server
      */
-//    RESOURCE_BOUND,
+    //    RESOURCE_BOUND,
 
     /**
      * the initial session handshake is completed and regular stanzas are processed
      */
-//    OPEN_FOR_XMPP,
+    //    OPEN_FOR_XMPP,
 
     /**
      * end stanza processed

Modified: mina/vysper/trunk/server/core/src/main/java/org/apache/vysper/xmpp/server/XMPPServer.java
URL: http://svn.apache.org/viewvc/mina/vysper/trunk/server/core/src/main/java/org/apache/vysper/xmpp/server/XMPPServer.java?rev=958281&r1=958280&r2=958281&view=diff
==============================================================================
--- mina/vysper/trunk/server/core/src/main/java/org/apache/vysper/xmpp/server/XMPPServer.java (original)
+++ mina/vysper/trunk/server/core/src/main/java/org/apache/vysper/xmpp/server/XMPPServer.java Sat Jun 26 20:39:54 2010
@@ -30,9 +30,9 @@ import org.apache.vysper.xmpp.authorizat
 import org.apache.vysper.xmpp.authorization.SASLMechanism;
 import org.apache.vysper.xmpp.cryptography.BogusTrustManagerFactory;
 import org.apache.vysper.xmpp.cryptography.FileBasedTLSContextFactory;
-import org.apache.vysper.xmpp.delivery.inbound.DeliveringInboundStanzaRelay;
 import org.apache.vysper.xmpp.delivery.RecordingStanzaRelay;
 import org.apache.vysper.xmpp.delivery.StanzaRelayBroker;
+import org.apache.vysper.xmpp.delivery.inbound.DeliveringInboundStanzaRelay;
 import org.apache.vysper.xmpp.modules.Module;
 import org.apache.vysper.xmpp.modules.roster.RosterModule;
 import org.apache.vysper.xmpp.modules.servicediscovery.ServiceDiscoveryModule;
@@ -56,11 +56,17 @@ import org.apache.vysper.xmpp.state.reso
 public class XMPPServer {
 
     private final List<SASLMechanism> saslMechanisms = new ArrayList<SASLMechanism>();
+
     private String serverDomain;
+
     private DefaultServerRuntimeContext serverRuntimeContext;
+
     private StorageProviderRegistry storageProviderRegistry;
+
     private File tlsCertificateFile;
+
     private String tlsCertificatePassword;
+
     private final List<Endpoint> endpoints = new ArrayList<Endpoint>();
 
     public XMPPServer(String domain) {
@@ -101,8 +107,10 @@ public class XMPPServer {
 
         EntityImpl serverEntity = new EntityImpl(null, serverDomain, null);
 
-        AccountManagement accountManagement = (AccountManagement) storageProviderRegistry.retrieve(AccountManagement.class);
-        DeliveringInboundStanzaRelay internalStanzaRelay = new DeliveringInboundStanzaRelay(serverEntity, resourceRegistry, accountManagement);
+        AccountManagement accountManagement = (AccountManagement) storageProviderRegistry
+                .retrieve(AccountManagement.class);
+        DeliveringInboundStanzaRelay internalStanzaRelay = new DeliveringInboundStanzaRelay(serverEntity,
+                resourceRegistry, accountManagement);
         RecordingStanzaRelay externalStanzaRelay = new RecordingStanzaRelay();
 
         StanzaRelayBroker stanzaRelayBroker = new StanzaRelayBroker();
@@ -112,7 +120,8 @@ public class XMPPServer {
         ServerFeatures serverFeatures = new ServerFeatures();
         serverFeatures.setAuthenticationMethods(saslMechanisms);
 
-        serverRuntimeContext = new DefaultServerRuntimeContext(serverEntity, stanzaRelayBroker, serverFeatures, dictionaries, resourceRegistry);
+        serverRuntimeContext = new DefaultServerRuntimeContext(serverEntity, stanzaRelayBroker, serverFeatures,
+                dictionaries, resourceRegistry);
         serverRuntimeContext.setStorageProviderRegistry(storageProviderRegistry);
         serverRuntimeContext.setTlsContextFactory(tlsContextFactory);
 
@@ -122,7 +131,8 @@ public class XMPPServer {
         stanzaRelayBroker.setServerRuntimeContext(serverRuntimeContext);
         internalStanzaRelay.setServerRuntimeContext(serverRuntimeContext);
 
-        if (endpoints.size() == 0) throw new IllegalStateException("server must have at least one endpoint");
+        if (endpoints.size() == 0)
+            throw new IllegalStateException("server must have at least one endpoint");
         for (Endpoint endpoint : endpoints) {
             endpoint.setServerRuntimeContext(serverRuntimeContext);
             endpoint.start();
@@ -138,7 +148,7 @@ public class XMPPServer {
     public void addModule(Module module) {
         serverRuntimeContext.addModule(module);
     }
-    
+
     private void addCoreDictionaries(List<NamespaceHandlerDictionary> dictionaries) {
         dictionaries.add(new org.apache.vysper.xmpp.modules.core.base.BaseStreamStanzaDictionary());
         dictionaries.add(new org.apache.vysper.xmpp.modules.core.starttls.StartTLSStanzaDictionary());

Modified: mina/vysper/trunk/server/core/src/main/java/org/apache/vysper/xmpp/server/XMPPVersion.java
URL: http://svn.apache.org/viewvc/mina/vysper/trunk/server/core/src/main/java/org/apache/vysper/xmpp/server/XMPPVersion.java?rev=958281&r1=958280&r2=958281&view=diff
==============================================================================
--- mina/vysper/trunk/server/core/src/main/java/org/apache/vysper/xmpp/server/XMPPVersion.java (original)
+++ mina/vysper/trunk/server/core/src/main/java/org/apache/vysper/xmpp/server/XMPPVersion.java Sat Jun 26 20:39:54 2010
@@ -29,9 +29,13 @@ public class XMPPVersion {
     public static final XMPPVersion VERSION_1_0 = new XMPPVersion(1, 0);
 
     private int major = 1;
+
     private int minor = 0;
+
     private static final String STRING_ZERO = "0";
+
     private static final String STRING_UNO = "1";
+
     private static final String STRING_DOT = ".";
 
     public XMPPVersion() {
@@ -39,9 +43,11 @@ public class XMPPVersion {
     }
 
     public XMPPVersion(int major, int minor) {
-        if (major < 0) throw new IllegalArgumentException("major must at least be 0");
+        if (major < 0)
+            throw new IllegalArgumentException("major must at least be 0");
         this.major = major;
-        if (minor < 0) throw new IllegalArgumentException("minor must at least be 0");
+        if (minor < 0)
+            throw new IllegalArgumentException("minor must at least be 0");
         this.minor = minor;
     }
 
@@ -51,19 +57,26 @@ public class XMPPVersion {
             throw new IllegalArgumentException("XMPP version must be of format 'x.y'");
         }
         major = convertToInt(parts[0]);
-        if (major < 0) throw new IllegalArgumentException("major must at least be 0");
+        if (major < 0)
+            throw new IllegalArgumentException("major must at least be 0");
         minor = convertToInt(parts[1]);
-        if (minor < 0) throw new IllegalArgumentException("minor must at least be 0");
+        if (minor < 0)
+            throw new IllegalArgumentException("minor must at least be 0");
     }
 
     private int convertToInt(String part) {
-        if (part == null || part.length() == 0) throw new IllegalArgumentException("version part is empty");
-        if (STRING_ZERO.equals(part)) return 0;
-        if (STRING_UNO.equals(part)) return 1;
+        if (part == null || part.length() == 0)
+            throw new IllegalArgumentException("version part is empty");
+        if (STRING_ZERO.equals(part))
+            return 0;
+        if (STRING_UNO.equals(part))
+            return 1;
 
         part = part.trim();
-        if (part.startsWith("+") || part.startsWith("-")) throw new IllegalArgumentException("version part must contain only numbers");
-        if (part.startsWith(STRING_ZERO)) return convertToInt(part.substring(1)); // ignore leading zeros
+        if (part.startsWith("+") || part.startsWith("-"))
+            throw new IllegalArgumentException("version part must contain only numbers");
+        if (part.startsWith(STRING_ZERO))
+            return convertToInt(part.substring(1)); // ignore leading zeros
         return Integer.parseInt(part);
     }
 
@@ -84,18 +97,23 @@ public class XMPPVersion {
     }
 
     public static XMPPVersion getCommonDenomitator(XMPPVersion v1, XMPPVersion v2) {
-        if (v1.getMajor() != v2.getMajor()) return v1.getMajor() < v2.getMajor() ? v1 : v2;
+        if (v1.getMajor() != v2.getMajor())
+            return v1.getMajor() < v2.getMajor() ? v1 : v2;
         return v1.getMinor() < v2.getMinor() ? v1 : v2;
     }
 
     public boolean equals(Object o) {
-        if (this == o) return true;
-        if (o == null || getClass() != o.getClass()) return false;
+        if (this == o)
+            return true;
+        if (o == null || getClass() != o.getClass())
+            return false;
 
         final XMPPVersion that = (XMPPVersion) o;
 
-        if (major != that.major) return false;
-        if (minor != that.minor) return false;
+        if (major != that.major)
+            return false;
+        if (minor != that.minor)
+            return false;
 
         return true;
     }

Modified: mina/vysper/trunk/server/core/src/main/java/org/apache/vysper/xmpp/server/components/ComponentStanzaHandlerLookup.java
URL: http://svn.apache.org/viewvc/mina/vysper/trunk/server/core/src/main/java/org/apache/vysper/xmpp/server/components/ComponentStanzaHandlerLookup.java?rev=958281&r1=958280&r2=958281&view=diff
==============================================================================
--- mina/vysper/trunk/server/core/src/main/java/org/apache/vysper/xmpp/server/components/ComponentStanzaHandlerLookup.java (original)
+++ mina/vysper/trunk/server/core/src/main/java/org/apache/vysper/xmpp/server/components/ComponentStanzaHandlerLookup.java Sat Jun 26 20:39:54 2010
@@ -38,11 +38,11 @@ public class ComponentStanzaHandlerLooku
     }
 
     protected ComponentHandlerDictionary defaultHandlers = new ComponentHandlerDictionary();
-    
+
     public void addDefaultHandler(StanzaHandler stanzaHandler) {
         defaultHandlers.register(stanzaHandler);
     }
-    
+
     @Override
     public StanzaHandler getHandler(Stanza stanza) {
 
@@ -53,7 +53,8 @@ public class ComponentStanzaHandlerLooku
 
         StanzaHandler stanzaHandler = getHandlerForElement(stanza, firstInnerElement);
 
-        if (stanzaHandler == null) stanzaHandler = defaultHandlers.get(stanza);
+        if (stanzaHandler == null)
+            stanzaHandler = defaultHandlers.get(stanza);
 
         return stanzaHandler;
     }

Modified: mina/vysper/trunk/server/core/src/main/java/org/apache/vysper/xmpp/server/components/ComponentStanzaProcessor.java
URL: http://svn.apache.org/viewvc/mina/vysper/trunk/server/core/src/main/java/org/apache/vysper/xmpp/server/components/ComponentStanzaProcessor.java?rev=958281&r1=958280&r2=958281&view=diff
==============================================================================
--- mina/vysper/trunk/server/core/src/main/java/org/apache/vysper/xmpp/server/components/ComponentStanzaProcessor.java (original)
+++ mina/vysper/trunk/server/core/src/main/java/org/apache/vysper/xmpp/server/components/ComponentStanzaProcessor.java Sat Jun 26 20:39:54 2010
@@ -19,39 +19,47 @@
  */
 package org.apache.vysper.xmpp.server.components;
 
-import org.apache.vysper.xmpp.protocol.*;
+import org.apache.vysper.xmpp.delivery.failure.DeliveryException;
+import org.apache.vysper.xmpp.delivery.failure.IgnoreFailureStrategy;
+import org.apache.vysper.xmpp.protocol.NamespaceHandlerDictionary;
+import org.apache.vysper.xmpp.protocol.ProtocolException;
+import org.apache.vysper.xmpp.protocol.ResponseStanzaContainer;
+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.server.ServerRuntimeContext;
 import org.apache.vysper.xmpp.server.SessionContext;
 import org.apache.vysper.xmpp.stanza.Stanza;
 import org.apache.vysper.xmpp.stanza.XMPPCoreStanza;
-import org.apache.vysper.xmpp.delivery.failure.IgnoreFailureStrategy;
-import org.apache.vysper.xmpp.delivery.failure.DeliveryException;
 
 /**
  */
 public class ComponentStanzaProcessor implements StanzaProcessor {
 
     protected ServerRuntimeContext serverRuntimeContext;
-    
+
     protected ComponentStanzaHandlerLookup componentStanzaHandlerLookup = new ComponentStanzaHandlerLookup();
 
     public ComponentStanzaProcessor(ServerRuntimeContext serverRuntimeContext) {
         this.serverRuntimeContext = serverRuntimeContext;
     }
-    
+
     public void addHandler(StanzaHandler stanzaHandler) {
         componentStanzaHandlerLookup.addDefaultHandler(stanzaHandler);
     }
-    
+
     public void addDictionary(NamespaceHandlerDictionary namespaceHandlerDictionary) {
         componentStanzaHandlerLookup.addDictionary(namespaceHandlerDictionary);
     }
 
-    public void processStanza(ServerRuntimeContext serverRuntimeContext, SessionContext sessionContext, Stanza stanza, SessionStateHolder sessionStateHolder) {
-        if (stanza == null) throw new RuntimeException("cannot process NULL stanzas");
+    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");
+        if (xmppStanza == null)
+            throw new RuntimeException("cannot process only: IQ, message or presence");
 
         StanzaHandler stanzaHandler = componentStanzaHandlerLookup.getHandler(xmppStanza);
 
@@ -62,9 +70,10 @@ public class ComponentStanzaProcessor im
 
         ResponseStanzaContainer responseStanzaContainer = null;
         try {
-            responseStanzaContainer = stanzaHandler.execute(stanza, serverRuntimeContext, false, sessionContext, sessionStateHolder);
+            responseStanzaContainer = stanzaHandler.execute(stanza, serverRuntimeContext, false, sessionContext,
+                    sessionStateHolder);
         } catch (ProtocolException e) {
-            e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
+            e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
         }
 
         if (responseStanzaContainer != null && responseStanzaContainer.getResponseStanza() != null) {