[jboss-cvs] JBoss Messaging SVN: r5339 - in trunk: docs/userguide/en/modules and 32 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Wed Nov 12 07:17:43 EST 2008


Author: ataylor
Date: 2008-11-12 07:17:43 -0500 (Wed, 12 Nov 2008)
New Revision: 5339

Added:
   trunk/src/config/logging.properties
   trunk/src/main/org/jboss/messaging/integration/
   trunk/src/main/org/jboss/messaging/integration/logging/
   trunk/src/main/org/jboss/messaging/integration/logging/BaseLoggerHandler.java
   trunk/src/main/org/jboss/messaging/integration/logging/JBMLoggerPlugin.java
   trunk/src/main/org/jboss/messaging/integration/logging/JBossLoggerHandler.java
   trunk/src/main/org/jboss/messaging/integration/logging/Log4jLoggerHandler.java
   trunk/src/main/org/jboss/messaging/integration/security/
   trunk/src/main/org/jboss/messaging/integration/security/JBossASSecurityManager.java
   trunk/src/main/org/jboss/messaging/integration/security/SecurityActions.java
   trunk/src/main/org/jboss/messaging/integration/transports/
   trunk/src/main/org/jboss/messaging/integration/transports/mina/
   trunk/src/main/org/jboss/messaging/integration/transports/mina/FilterChainSupport.java
   trunk/src/main/org/jboss/messaging/integration/transports/mina/IoBufferWrapper.java
   trunk/src/main/org/jboss/messaging/integration/transports/mina/MessagingIOSessionDataStructureFactory.java
   trunk/src/main/org/jboss/messaging/integration/transports/mina/MinaAcceptor.java
   trunk/src/main/org/jboss/messaging/integration/transports/mina/MinaAcceptorFactory.java
   trunk/src/main/org/jboss/messaging/integration/transports/mina/MinaConnection.java
   trunk/src/main/org/jboss/messaging/integration/transports/mina/MinaConnector.java
   trunk/src/main/org/jboss/messaging/integration/transports/mina/MinaConnectorFactory.java
   trunk/src/main/org/jboss/messaging/integration/transports/mina/MinaProtocolCodecFilter.java
   trunk/src/main/org/jboss/messaging/integration/transports/mina/TransportConstants.java
   trunk/src/main/org/jboss/messaging/integration/transports/netty/
   trunk/src/main/org/jboss/messaging/integration/transports/netty/ChannelBufferWrapper.java
   trunk/src/main/org/jboss/messaging/integration/transports/netty/ChannelPipelineSupport.java
   trunk/src/main/org/jboss/messaging/integration/transports/netty/MessagingChannelHandler.java
   trunk/src/main/org/jboss/messaging/integration/transports/netty/MessagingFrameDecoder.java
   trunk/src/main/org/jboss/messaging/integration/transports/netty/NettyAcceptor.java
   trunk/src/main/org/jboss/messaging/integration/transports/netty/NettyAcceptorFactory.java
   trunk/src/main/org/jboss/messaging/integration/transports/netty/NettyConnection.java
   trunk/src/main/org/jboss/messaging/integration/transports/netty/NettyConnector.java
   trunk/src/main/org/jboss/messaging/integration/transports/netty/NettyConnectorFactory.java
   trunk/src/main/org/jboss/messaging/integration/transports/netty/TransportConstants.java
Removed:
   trunk/src/main/org/jboss/messaging/core/logging/JBMLoggerPlugin.java
   trunk/src/main/org/jboss/messaging/core/remoting/impl/mina/
   trunk/src/main/org/jboss/messaging/core/remoting/impl/netty/
   trunk/src/main/org/jboss/messaging/core/security/impl/JBossASSecurityManager.java
   trunk/src/main/org/jboss/messaging/core/security/impl/SecurityActions.java
Modified:
   trunk/build-messaging.xml
   trunk/docs/userguide/en/modules/configuration.xml
   trunk/examples/build.properties
   trunk/examples/messaging/build.xml
   trunk/examples/messaging/src/org/jboss/messaging/example/ManagementClient.java
   trunk/examples/messaging/src/org/jboss/messaging/example/SSLClient.java
   trunk/examples/messaging/src/org/jboss/messaging/example/ScheduledMessageExample.java
   trunk/examples/messaging/src/org/jboss/messaging/example/SimpleClient.java
   trunk/examples/messaging/src/org/jboss/messaging/example/SimpleExample.java
   trunk/examples/messaging/src/org/jboss/messaging/example/WildCardClient.java
   trunk/messaging.iml
   trunk/src/config/jbm-beans.xml
   trunk/src/config/jbm-configuration.xml
   trunk/src/config/jbm-jndi.xml
   trunk/src/main/org/jboss/messaging/core/logging/Logger.java
   trunk/src/main/org/jboss/messaging/jms/client/JBossBytesMessage.java
   trunk/src/main/org/jboss/messaging/jms/client/JBossStreamMessage.java
   trunk/src/main/org/jboss/messaging/jms/server/management/impl/JMSQueueControl.java
   trunk/src/main/org/jboss/messaging/microcontainer/JBMBootstrapServer.java
   trunk/tests/jms-tests/src/org/jboss/test/messaging/jms/CTSMiscellaneousTest.java
   trunk/tests/jms-tests/src/org/jboss/test/messaging/jms/JMSTestCase.java
   trunk/tests/jms-tests/src/org/jboss/test/messaging/tools/ServerManagement.java
   trunk/tests/jms-tests/src/org/jboss/test/messaging/tools/container/LocalTestServer.java
   trunk/tests/src/org/jboss/messaging/tests/integration/base/IntegrationTestBase.java
   trunk/tests/src/org/jboss/messaging/tests/integration/basic/CoreClientTest.java
   trunk/tests/src/org/jboss/messaging/tests/integration/clientcrash/ClientCrashTest.java
   trunk/tests/src/org/jboss/messaging/tests/integration/clientcrash/ClientExitTest.java
   trunk/tests/src/org/jboss/messaging/tests/integration/clientcrash/CrashClient.java
   trunk/tests/src/org/jboss/messaging/tests/integration/clientcrash/GracefulClient.java
   trunk/tests/src/org/jboss/messaging/tests/integration/remoting/PingTest.java
   trunk/tests/src/org/jboss/messaging/tests/integration/ssl/CoreClientOverSSL.java
   trunk/tests/src/org/jboss/messaging/tests/integration/ssl/CoreClientOverSSLTest.java
   trunk/tests/src/org/jboss/messaging/tests/performance/persistence/StorageManagerTimingTest.java
   trunk/tests/src/org/jboss/messaging/tests/unit/core/message/impl/MessageImplTestBase.java
   trunk/tests/src/org/jboss/messaging/tests/unit/core/remoting/impl/mina/IoBufferWrapper2Test.java
   trunk/tests/src/org/jboss/messaging/tests/unit/core/remoting/impl/mina/IoBufferWrapperTest.java
   trunk/tests/src/org/jboss/messaging/tests/unit/core/remoting/impl/mina/MessagingIOSessionDataStructureFactoryTest.java
   trunk/tests/src/org/jboss/messaging/tests/unit/core/remoting/impl/mina/MinaAcceptorFactoryTest.java
   trunk/tests/src/org/jboss/messaging/tests/unit/core/remoting/impl/mina/MinaAcceptorTest.java
   trunk/tests/src/org/jboss/messaging/tests/unit/core/remoting/impl/mina/MinaConnectionTest.java
   trunk/tests/src/org/jboss/messaging/tests/unit/core/remoting/impl/mina/MinaConnectorTest.java
   trunk/tests/src/org/jboss/messaging/tests/unit/core/remoting/impl/netty/ChannelBufferWrapper2Test.java
   trunk/tests/src/org/jboss/messaging/tests/unit/core/remoting/impl/netty/ChannelBufferWrapperTest.java
   trunk/tests/src/org/jboss/messaging/tests/unit/core/remoting/impl/netty/NettyAcceptorFactoryTest.java
   trunk/tests/src/org/jboss/messaging/tests/unit/core/remoting/impl/netty/NettyAcceptorTest.java
   trunk/tests/src/org/jboss/messaging/tests/unit/core/remoting/impl/netty/NettyConnectionTest.java
   trunk/tests/src/org/jboss/messaging/tests/unit/core/remoting/impl/netty/NettyConnectorTest.java
   trunk/tests/src/org/jboss/messaging/tests/unit/core/security/impl/JBossASSecurityManagerTest.java
   trunk/tests/src/org/jboss/messaging/tests/unit/jms/misc/ManifestTest.java
   trunk/tests/src/org/jboss/messaging/tests/unit/util/TypedPropertiesTest.java
Log:
created new integration layer

Modified: trunk/build-messaging.xml
===================================================================
--- trunk/build-messaging.xml	2008-11-11 12:27:28 UTC (rev 5338)
+++ trunk/build-messaging.xml	2008-11-12 12:17:43 UTC (rev 5339)
@@ -57,10 +57,25 @@
    <property name="module.version"
              value="${messaging.version.major}.${messaging.version.minor}.${messaging.version.revision}.${messaging.version.tag}"/>
 
+   <!--jar names-->
 
+   <property name="core.jar.name" value="jbm-core.jar"/>
+   <property name="jms.jar.name" value="jbm-jms.jar"/>
+   <property name="transports.jar.name" value="jbm-transports.jar"/>
+   <property name="security.jar.name" value="jbm-jbossas-security.jar"/>
+   <property name="bootstrap.jar.name" value="jbm-bootstrap.jar"/>
+   <property name="logging.jar.name" value="jbm-logging.jar"/>
+   <property name="core.client..jar.name" value="jbm-core-client.jar"/>
+
    <!--source and build dirs-->
    <property name="build.dir" value="build"/>
    <property name="build.classes.dir" value="${build.dir}/classes"/>
+   <property name="build.core.classes.dir" value="${build.dir}/classes/core"/>
+   <property name="build.jms.classes.dir" value="${build.dir}/classes/jms"/>
+   <property name="build.transports.classes.dir" value="${build.dir}/classes/transports"/>
+   <property name="build.security.classes.dir" value="${build.dir}/classes/security"/>
+   <property name="build.bootstrap.classes.dir" value="${build.dir}/classes/bootstrap"/>
+   <property name="build.logging.classes.dir" value="${build.dir}/classes/logging"/>
    <property name="build.jars.dir" value="${build.dir}/jars"/>
    <property name="build.src.dir" value="${build.dir}/src"/>
    <property name="src.dir" value="src"/>
@@ -160,59 +175,80 @@
    <property name="junit.test.haltonfailure" value="false"/>
    <property name="junit.test.haltonerror" value="false"/>
 
-   <!--classpaths-->
-   <path id="core.compilation.classpath">
-      <path refid="jboss.common.classpath"/>
-      <path refid="apache.log4j.classpath"/>
-      <path refid="jboss.microcontainer.classpath"/>   	
-      <path refid="jboss.jbosssx.client.classpath"/>
-      <path refid="jboss.jboss.security.spi.classpath"/>
-      <path refid="jboss.jboss.jaspi.api.classpath"/>
-      <path refid="jgroups.jgroups.classpath"/>
-      <path refid="apache.mina.classpath"/>
-      <path refid="netty.netty.classpath"/>
-      <path refid="jpa.api.classpath"/>
-      <path location="${build.classes.dir}"/>
-   </path>
-	
    <path id="jms.compilation.classpath">
+      <path location="${build.core.classes.dir}"/>
       <path refid="jboss.jboss.javaee.classpath"/>
       <path refid="jboss.jbossts14.classpath"/>
       <path refid="jboss.integration.classpath"/>
    </path>
 
+   <path id="transports.compilation.classpath">
+      <path location="${build.core.classes.dir}"/>
+      <path refid="apache.mina.classpath"/>
+      <path refid="netty.netty.classpath"/>
+   </path>
+
+   <path id="security.compilation.classpath">
+      <path location="${build.core.classes.dir}"/>
+      <path refid="jboss.integration.classpath"/>
+      <path refid="jboss.jbosssx.client.classpath"/>
+      <path refid="jboss.jboss.security.spi.classpath"/>
+      <path refid="jboss.jboss.jaspi.api.classpath"/>
+   </path>
+
+   <path id="bootstrap.compilation.classpath">
+      <path location="${build.core.classes.dir}"/>
+      <path refid="jboss.microcontainer.classpath"/>
+      <path refid="jboss.common.classpath"/>
+   </path>
+
+   <path id="logging.compilation.classpath">
+      <path refid="apache.log4j.classpath"/>
+      <path refid="jboss.jboss.common.logging.spi.classpath"/>
+   </path>
+
    <path id="javadoc.classpath">
-      <path refid="core.compilation.classpath"/>
       <path refid="jms.compilation.classpath"/>
       <path location="${build.classes.dir}"/>
    </path>
 
    <path id="test.compilation.classpath">
-      <path refid="core.compilation.classpath"/>
       <path refid="jms.compilation.classpath"/>
-      <path location="${build.jars.dir}/jboss-${module.name}.jar"/>
+      <path refid="transports.compilation.classpath"/>
+      <path refid="security.compilation.classpath"/>
+      <path refid="bootstrap.compilation.classpath"/>
       <path refid="junit.junit.classpath"/>
       <path refid="jboss.profiler.jvmti.classpath"/>
       <path refid="jboss.test14.classpath"/>
       <path refid="jboss.jboss.retro.classpath"/>
-   	  <path refid="easymock.easymock.classpath" />
+      <path refid="easymock.easymock.classpath" />
       <path refid="easymock.classextension.classpath" />
+      <path location="${build.jars.dir}/${jms.jar.name}"/>
+      <path location="${build.jars.dir}/${transports.jar.name}"/>
+      <path location="${build.jars.dir}/${security.jar.name}"/>
+      <path location="${build.jars.dir}/${bootstrap.jar.name}"/>
    </path>
 
    <path id="jms.test.compilation.classpath">
-      <path refid="core.compilation.classpath"/>
+      <path refid="transports.compilation.classpath"/>
+      <path refid="security.compilation.classpath"/>
+      <path refid="bootstrap.compilation.classpath"/>
       <path refid="jms.compilation.classpath"/>
-      <path location="${build.jars.dir}/jboss-${module.name}.jar"/>
       <path refid="junit.junit.classpath"/>
       <path refid="jboss.profiler.jvmti.classpath"/>
       <path refid="jboss.test14.classpath"/>
       <path refid="jboss.jboss.retro.classpath"/>
       <path refid="apache.ant.classpath"/>
       <path refid="easymock.easymock.classpath" />
+      <path location="${build.jars.dir}/${core.jar.name}"/>
+      <path location="${build.jars.dir}/${jms.jar.name}"/>
+      <path location="${build.jars.dir}/${transports.jar.name}"/>
+      <path location="${build.jars.dir}/${security.jar.name}"/>
+      <path location="${build.jars.dir}/${bootstrap.jar.name}"/>
+      <path location="${build.jars.dir}/${logging.jar.name}"/>
    </path>
 
    <path id="findbugs.classpath">
-      <path refid="core.compilation.classpath"/>
       <path refid="jms.compilation.classpath"/>
       <path location="${build.jars.dir}/jboss-${module.name}.jar"/>
       <path refid="junit.junit.classpath"/>
@@ -234,7 +270,8 @@
       <path refid="oswego.concurrent.classpath"/>
       <path refid="slf4j.api.classpath"/>
       <path refid="slf4j.log4j.classpath"/>
-   	<path refid="cglib.classpath" />
+      <path refid="apache.log4j.classpath"/>
+      <path refid="cglib.classpath" />
       <path refid="jboss.common.core.classpath"/>
       <path refid="jboss.aop.classpath"/>
       <path refid="trove.trove.classpath"/>
@@ -248,6 +285,7 @@
       <pathelement location="${src.config.dir}"/>
       <pathelement location="${test.jms.dir}/config"/>
       <pathelement location="${test.jms.classes.dir}"/>
+      <path location="${build.jars.dir}/${transports.jar.name}"/>
       <path refid="jms.test.compilation.classpath"/>
       <path refid="trove.trove.classpath"/>
       <path refid="javassist.classpath"/>
@@ -308,6 +346,12 @@
    <target name="init" depends="createthirdparty">
       <mkdir dir="${build.dir}"/>
       <mkdir dir="${build.classes.dir}"/>
+      <mkdir dir="${build.core.classes.dir}"/>
+      <mkdir dir="${build.jms.classes.dir}"/>
+      <mkdir dir="${build.transports.classes.dir}"/>
+      <mkdir dir="${build.security.classes.dir}"/>
+      <mkdir dir="${build.bootstrap.classes.dir}"/>
+      <mkdir dir="${build.logging.classes.dir}"/>
       <mkdir dir="${build.jars.dir}"/>
       <mkdir dir="${build.src.dir}"/>
    </target>
@@ -321,7 +365,7 @@
 	           outputdirectory="${build.src.dir}/org/jboss/messaging/core/filter/impl"
               javacchome="${sun.javacc.lib}"
       	     static="false"/>
-   	<javac destdir="${build.classes.dir}"
+   	<javac destdir="${build.core.classes.dir}"
              target="${javac.target}"
              source="${javac.source}"
              optimize="${javac.optimize}"
@@ -336,16 +380,14 @@
             <pathelement path="${build.src.dir}"/>
             <pathelement path="${src.main.dir}"/>
          </src>
-         <include name="**/messaging/microcontainer/**/*.java"/>
          <include name="**/messaging/core/**/*.java"/>
          <include name="**/messaging/util/**/*.java"/>
-         <classpath refid="core.compilation.classpath"/>
       </javac>
    	<javah class="org.jboss.messaging.core.asyncio.impl.AsynchronousFileImpl"
-   	       classpathref="core.compilation.classpath" destdir="./native/src"/>
+   	       classpath="${build.core.classes.dir}" destdir="./native/src"/>
    	
       <copy file="${src.config.dir}/version.properties"
-         	tofile="${build.classes.dir}/version.properties"/>
+         	tofile="${build.core.classes.dir}/version.properties"/>
       
       <!--
       <echo message="messaging.version.versionName=${messaging.version.name}${line.separator}messaging.version.majorVersion=${messaging.version.major}${line.separator}messaging.version.minorVersion=${messaging.version.minor}${line.separator}messaging.version.microVersion=${messaging.version.micro}${line.separator}messaging.version.incrementingVersion=${messaging.version.incrementing}${line.separator}messaging.version.versionSuffix=${messaging.version.suffix}${line.separator}"
@@ -354,7 +396,7 @@
    </target>
 
    <target name="compile-jms" depends="compile-core">
-   	  <javac destdir="${build.classes.dir}"
+        <javac destdir="${build.jms.classes.dir}"
              target="${javac.target}"
              source="${javac.source}"
              optimize="${javac.optimize}"
@@ -366,14 +408,92 @@
              includeJavaRuntime="${javac.include.java.runtime}"
              failonerror="${javac.fail.onerror}">
          <src>
-            <pathelement path="${build.src.dir}"/>
             <pathelement path="${src.main.dir}"/>
          </src>
          <include name="**/jms/**/*.java"/>
          <classpath refid="jms.compilation.classpath"/>
-         <classpath refid="core.compilation.classpath"/>
       </javac>
    </target>
+
+   <target name="compile-transports" depends="compile-core">
+        <javac destdir="${build.transports.classes.dir}"
+             target="${javac.target}"
+             source="${javac.source}"
+             optimize="${javac.optimize}"
+             debug="${javac.debug}"
+             depend="${javac.depend}"
+             verbose="${javac.verbose}"
+             deprecation="${javac.deprecation}"
+             includeAntRuntime="${javac.include.ant.runtime}"
+             includeJavaRuntime="${javac.include.java.runtime}"
+             failonerror="${javac.fail.onerror}">
+         <src>
+            <pathelement path="${src.main.dir}"/>
+         </src>
+          <include name="org/jboss/messaging/integration/transports/**/*.java"/>
+         <classpath refid="transports.compilation.classpath"/>
+      </javac>
+   </target>
+
+   <target name="compile-security"  depends="compile-core">
+        <javac destdir="${build.security.classes.dir}"
+             target="${javac.target}"
+             source="${javac.source}"
+             optimize="${javac.optimize}"
+             debug="${javac.debug}"
+             depend="${javac.depend}"
+             verbose="${javac.verbose}"
+             deprecation="${javac.deprecation}"
+             includeAntRuntime="${javac.include.ant.runtime}"
+             includeJavaRuntime="${javac.include.java.runtime}"
+             failonerror="${javac.fail.onerror}">
+         <src>
+            <pathelement path="${src.main.dir}"/>
+         </src>
+         <include name="org/jboss/messaging/integration/security/**/*.java"/>
+         <classpath refid="security.compilation.classpath"/>
+      </javac>
+   </target>
+
+   <target name="compile-bootstrap" depends="compile-core">
+        <javac destdir="${build.bootstrap.classes.dir}"
+             target="${javac.target}"
+             source="${javac.source}"
+             optimize="${javac.optimize}"
+             debug="${javac.debug}"
+             depend="${javac.depend}"
+             verbose="${javac.verbose}"
+             deprecation="${javac.deprecation}"
+             includeAntRuntime="${javac.include.ant.runtime}"
+             includeJavaRuntime="${javac.include.java.runtime}"
+             failonerror="${javac.fail.onerror}">
+         <src>
+            <pathelement path="${src.main.dir}"/>
+         </src>
+         <include name="org/jboss/messaging/microcontainer/**/*.java"/>
+         <classpath refid="bootstrap.compilation.classpath"/>
+      </javac>
+   </target>
+
+   <target name="compile-logging" depends="init">
+        <javac destdir="${build.logging.classes.dir}"
+             target="${javac.target}"
+             source="${javac.source}"
+             optimize="${javac.optimize}"
+             debug="${javac.debug}"
+             depend="${javac.depend}"
+             verbose="${javac.verbose}"
+             deprecation="${javac.deprecation}"
+             includeAntRuntime="${javac.include.ant.runtime}"
+             includeJavaRuntime="${javac.include.java.runtime}"
+             failonerror="${javac.fail.onerror}">
+         <src>
+            <pathelement path="${src.main.dir}"/>
+         </src>
+         <include name="org/jboss/messaging/integration/logging/**/*.java"/>
+         <classpath refid="logging.compilation.classpath"/>
+      </javac>
+   </target>
 	
    <target name="build-native">
       <exec dir="native" executable="make">
@@ -387,10 +507,10 @@
    <!-- Archival Tasks                                                                           -->
    <!-- ======================================================================================== -->
 
-   <target name="jar" depends="compile">
+   <target name="jar-core" depends="compile-core">
 
-      <jar jarfile="${build.jars.dir}/jboss-${module.name}.jar">
-         <fileset dir="${build.classes.dir}" includes="**"/>
+      <jar jarfile="${build.jars.dir}/${core.jar.name}">
+         <fileset dir="${build.core.classes.dir}" includes="**"/>
          <manifest>
             <attribute name="JBossMessaging-Version" value="${messaging.version.string}"/>
             <attribute name="JBossMessaging-SVN-URL" value="${messaging.version.svnurl}"/>
@@ -399,11 +519,50 @@
 
    </target>
 
-   <target name="client-jar" depends="compile">      
-      <jar jarfile="${build.jars.dir}/jboss-${module.name}-client.jar">
-         <fileset dir="${build.classes.dir}">
-            <include name="version.properties"/>            
-            <include name="org/jboss/messaging/jms/**/*.class"/>
+   <target name="jar-jms" depends="compile-jms">
+
+      <jar jarfile="${build.jars.dir}/${jms.jar.name}">
+         <fileset dir="${build.jms.classes.dir}" includes="**"/>
+      </jar>
+
+   </target>
+
+   <target name="jar-transports" depends="compile-transports">
+
+      <jar jarfile="${build.jars.dir}/${transports.jar.name}">
+         <fileset dir="${build.transports.classes.dir}" includes="**"/>
+      </jar>
+
+   </target>
+
+   <target name="jar-security" depends="compile-security">
+
+      <jar jarfile="${build.jars.dir}/${security.jar.name}">
+         <fileset dir="${build.security.classes.dir}" includes="**"/>
+      </jar>
+
+   </target>
+
+    <target name="jar-bootstrap" depends="compile-bootstrap">
+
+      <jar jarfile="${build.jars.dir}/${bootstrap.jar.name}" >
+         <fileset dir="${build.bootstrap.classes.dir}" includes="**"/>
+      </jar>
+
+   </target>
+
+    <target name="jar-logging" depends="compile-logging">
+
+      <jar jarfile="${build.jars.dir}/${logging.jar.name}" >
+         <fileset dir="${build.logging.classes.dir}" includes="**"/>
+      </jar>
+
+   </target>
+
+      <target name="jar-client" depends="compile-core">
+      <jar jarfile="${build.jars.dir}/${core.client..jar.name}">
+         <fileset dir="${build.core.classes.dir}">
+            <include name="version.properties"/>
             <include name="org/jboss/messaging/core/client/**/*.class"/>
             <include name="org/jboss/messaging/core/exception/**/*.class"/>
             <include name="org/jboss/messaging/core/logging/**/*.class"/>
@@ -413,6 +572,7 @@
             <include name="org/jboss/messaging/core/list/**/*.class"/>
             <include name="org/jboss/messaging/core/message/**/*.class"/>
             <include name="org/jboss/messaging/core/version/**/*.class"/>
+            <include name="org/jboss/messaging/core/management/**/*.class"/>
             <!-- FIXME - why are these classes in the client jar ??? -->
             <include name="org/jboss/messaging/core/server/JournalType.class"/>
             <include name="org/jboss/messaging/core/journal/EncodingSupport.class"/>
@@ -422,12 +582,18 @@
       </jar>
 
    </target>
+
+   <target name="jar" depends="jar-core, jar-client, jar-jms, jar-transports, jar-security, jar-bootstrap, jar-logging">
+
+   </target>
+
+
    <!-- ======================================================================================== -->
    <!-- Distro Tasks                                                                           -->
    <!-- ======================================================================================== -->
 
 
-   <target name="distro" depends="jar, client-jar">
+   <target name="distro" depends="jar, jar-client">
 
       <mkdir dir="${build.distro.dir}"/>
       <mkdir dir="${build.distro.lib.dir}"/>
@@ -751,6 +917,8 @@
          <jvmarg value="-Xmx1024M"/>
          <jvmarg value="-Djava.library.path=native/bin"/>
          <jvmarg value="-Dmodule.output=./"/>
+         <jvmarg value="-Djava.util.logging.config.file=src/config/logging.properties"/>
+         <jvmarg value="-Dorg.jboss.logging.Logger.pluginClass=org.jboss.messaging.integration.logging.JBMLoggerPlugin"/>
          <!--<jvmarg line="-Xmx512M -Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005"/>-->
          <!--<jvmarg value="-ea"/>-->
          <sysproperty key="jbm.remoting.disable.invm" value="${disable.invm}"/>
@@ -931,8 +1099,9 @@
          <jvmarg value="-Xmx2048M"/>
          <jvmarg value="-XX:+AggressiveOpts"/>
          <jvmarg value="-XX:+UseFastAccessorMethods"/>
-      	 <jvmarg value="-Dcom.sun.management.jmxremote"/>
-         <jvmarg value="-Dorg.jboss.logging.Logger.pluginClass=org.jboss.messaging.core.logging.JBMLoggerPlugin"/>
+         <jvmarg value="-Dcom.sun.management.jmxremote"/>
+         <jvmarg value="-Djava.util.logging.config.file=src/config/logging.properties"/>
+         <jvmarg value="-Dorg.jboss.logging.Logger.pluginClass=org.jboss.messaging.integration.logging.JBMLoggerPlugin"/>
          <jvmarg value="-Djava.library.path=${native.bin.dir}"/>
          <jvmarg value="-Djava.naming.factory.initial=org.jnp.interfaces.NamingContextFactory"/>
          <jvmarg value="-Djava.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces"/>
@@ -974,80 +1143,80 @@
    </target>
    <!-- Examples -->
 
-   <target name="queueExample" depends="client-jar">
+   <target name="queueExample" depends="jar-client, jar-transports, jar-jms">
       <ant dir="${examples.dir}/jms" antfile="build.xml" target="queueExample"/>
    </target>
 
-   <target name="topicExample" depends="client-jar">
+   <target name="topicExample" depends="jar-client, jar-transports, jar-jms">
       <ant dir="${examples.dir}/jms" antfile="build.xml" target="topicExample"/>
    </target>
 
-   <target name="durSubExample" depends="client-jar">
+   <target name="durSubExample" depends="jar-client, jar-transports, jar-jms">
       <ant dir="${examples.dir}/jms" antfile="build.xml" target="durSubExample"/>
    </target>
 
-    <target name="wildcardExample" depends="client-jar">
+    <target name="wildcardExample" depends="jar-client, jar-transports, jar-jms">
       <ant dir="${examples.dir}/jms" antfile="build.xml" target="wildcardExample"/>
    </target>
 
-    <target name="messageGroupingExample" depends="client-jar">
+    <target name="messageGroupingExample" depends="jar-client, jar-transports, jar-jms">
       <ant dir="${examples.dir}/jms" antfile="build.xml" target="messageGroupingExample"/>
    </target>
 
-   <target name="scheduledExample" depends="client-jar">
+   <target name="scheduledExample" depends="jar-client, jar-transports, jar-jms">
       <ant dir="${examples.dir}/jms" antfile="build.xml" target="scheduledExample"/>
    </target>
 
-   <target name="simpleClient" depends="client-jar">
+   <target name="simpleClient" depends="jar-client, jar-transports, jar-jms">
       <ant dir="${examples.dir}/messaging" antfile="build.xml" target="simpleClient"/>
    </target>
 
-   <target name="ssslClient" depends="client-jar">
+   <target name="ssslClient" depends="jar-client, jar-transports, jar-jms">
       <ant dir="${examples.dir}/messaging" antfile="build.xml" target="sslClient"/>
    </target>
 
-   <target name="simpleExample" depends="jar, client-jar">
+   <target name="simpleExample" depends="jar">
       <ant dir="${examples.dir}/messaging" antfile="build.xml" target="simpleExample"/>
    </target>
 
-    <target name="managementClient" depends="client-jar">
+    <target name="managementClient" depends="jar-client, jar-transports, jar-jms">
        <ant dir="${examples.dir}/messaging" antfile="build.xml" target="managementClient"/>
     </target>
        
-   <target name="wildCardClient" depends="jar, client-jar">
+   <target name="wildCardClient" depends="jar-client, jar-transports, jar-jms">
          <ant dir="${examples.dir}/messaging" antfile="build.xml" target="wildCardClient"/>
    </target>
 
-   <target name="scheduledMessageExample" depends="jar, client-jar">
+   <target name="scheduledMessageExample" depends="jar-client, jar-transports, jar-jms">
          <ant dir="${examples.dir}/messaging" antfile="build.xml" target="scheduledMessageExample"/>
       </target>
    <!-- Performance examples -->
 
-   <target name="perfListener" depends="client-jar">
+   <target name="perfListener" depends="jar-client, jar-transports, jar-jms">
       <ant dir="${examples.dir}/jms" antfile="build.xml" target="perfListener"/>
    </target>
 
-   <target name="perfAutoAckListener" depends="client-jar">
+   <target name="perfAutoAckListener" depends="jar-client, jar-transports, jar-jms">
       <ant dir="${examples.dir}/jms" antfile="build.xml" target="perfAutoAckListener"/>
    </target>
 
-   <target name="perfDupsOKListener" depends="client-jar">
+   <target name="perfDupsOKListener" depends="jar-client, jar-transports, jar-jms">
       <ant dir="${examples.dir}/jms" antfile="build.xml" target="perfDupsOKListener"/>
    </target>
 
-   <target name="perfTransactionalListener" depends="client-jar">
+   <target name="perfTransactionalListener" depends="jar-client, jar-transports, jar-jms">
       <ant dir="${examples.dir}/jms" antfile="build.xml" target="perfTransactionalListener"/>
    </target>
 
-   <target name="perfSender" depends="client-jar">
+   <target name="perfSender" depends="jar-client, jar-transports, jar-jms">
       <ant dir="${examples.dir}/jms" antfile="build.xml" target="perfSender"/>
    </target>
 
-   <target name="perfNonTransactionalSender" depends="client-jar">
+   <target name="perfNonTransactionalSender" depends="jar-client, jar-transports, jar-jms">
       <ant dir="${examples.dir}/jms" antfile="build.xml" target="perfNonTransactionalSender"/>
    </target>
 
-   <target name="perfTransactionalSender" depends="client-jar">
+   <target name="perfTransactionalSender" depends="jar-client, jar-transports, jar-jms">
       <ant dir="${examples.dir}/jms" antfile="build.xml" target="perfTransactionalSender"/>
    </target>
 

Modified: trunk/docs/userguide/en/modules/configuration.xml
===================================================================
--- trunk/docs/userguide/en/modules/configuration.xml	2008-11-11 12:27:28 UTC (rev 5338)
+++ trunk/docs/userguide/en/modules/configuration.xml	2008-11-12 12:17:43 UTC (rev 5339)
@@ -772,8 +772,8 @@
             <programlisting>
                <![CDATA[
       <bean name="JBMSecurityManager"
-      class="org.jboss.messaging.core.security.impl.JBossASSecurityManager"/>
-               ]]>
+                     class="org.jboss.messaging.integration.security.JBossASSecurityManager"/>
+                              ]]>
             </programlisting>
             <para>To replace the Security Manager implement the following interface:</para>
             <programlisting>org.jboss.messaging.core.security.JBMSecurityManager</programlisting>

Modified: trunk/examples/build.properties
===================================================================
--- trunk/examples/build.properties	2008-11-11 12:27:28 UTC (rev 5338)
+++ trunk/examples/build.properties	2008-11-12 12:17:43 UTC (rev 5339)
@@ -1,3 +1,6 @@
 lib.dir=../../thirdparty
-client.jar=../../build/jars/jboss-messaging-client.jar
-server.jar=../../build/jars/jboss-messaging.jar
+client.core.jar=../../build/jars/jbm-core-client.jar
+transports.jar=../../build/jars/jbm-transports.jar
+jms.jar=../../build/jars/jbm-jms.jar
+core.jar=../../build/jars/jbm-core.jar
+

Modified: trunk/examples/messaging/build.xml
===================================================================
--- trunk/examples/messaging/build.xml	2008-11-11 12:27:28 UTC (rev 5338)
+++ trunk/examples/messaging/build.xml	2008-11-12 12:17:43 UTC (rev 5339)
@@ -40,16 +40,22 @@
    <property name="config.dir" value="config"/>
    <property name="build.dir" value="build"/>
 
-   <path id="compile.classpath">
+   <path id="client.compile.classpath">
       <fileset dir="${lib.dir}">
          <include name="**/*.jar"/>
       </fileset>
-      <pathelement location="${client.jar}"/>
-      <pathelement location="${server.jar}"/>
+      <pathelement location="${client.core.jar}"/>
+      <pathelement location="${transports.jar}"/>
+      <pathelement location="${jms.jar}"/>
    </path>
 
+   <path id="server.compile.classpath">
+      <path refid="client.compile.classpath"/>
+      <pathelement location="${core.jar}"/>
+   </path>
+
    <path id="runtime.classpath">
-      <path refid="compile.classpath"/>
+      <path refid="client.compile.classpath"/>
       <pathelement location="${build.dir}"/>
       <pathelement location="${config.dir}"/>
    </path>
@@ -72,44 +78,52 @@
    </target>
 
 
-   <target name="compile" depends="init">
+   <target name="compile.client" depends="init">
       <javac srcdir="${src.dir}" destdir="${build.dir}" debug="on"
              source="1.5">
-         <classpath refid="compile.classpath"/>
+         <classpath refid="server.compile.classpath"/>
+         <exclude name="org/jboss/messaging/example/SimpleExample.java"/>
       </javac>
    </target>
 
-   <target name="simpleClient" depends="compile">
+   <target name="compile.server" depends="init">
+      <javac srcdir="${src.dir}" destdir="${build.dir}" debug="on"
+             source="1.5">
+         <classpath refid="client.compile.classpath"/>
+      </javac>
+   </target>
+
+   <target name="simpleClient" depends="compile.client">
       <java classname="org.jboss.messaging.example.SimpleClient" fork="true">
          <classpath refid="runtime.classpath"/>
       </java>
    </target>
 
-   <target name="sslClient" depends="compile">
+   <target name="sslClient" depends="compile.client">
       <java classname="org.jboss.messaging.example.SSLClient" fork="true">
          <classpath refid="runtime.classpath"/>
       </java>
    </target>
 
-   <target name="simpleExample" depends="compile">
+   <target name="simpleExample" depends="compile.server">
       <java classname="org.jboss.messaging.example.SimpleExample" fork="true">
          <classpath refid="runtime.classpath"/>
       </java>
    </target>
 
-   <target name="managementClient" depends="compile">
+   <target name="managementClient" depends="compile.client">
       <java classname="org.jboss.messaging.example.ManagementClient" fork="true">
          <classpath refid="runtime.classpath"/>
       </java>
    </target>
 
-   <target name="wildCardClient" depends="compile">
+   <target name="wildCardClient" depends="compile.client">
       <java classname="org.jboss.messaging.example.WildCardClient" fork="true">
          <classpath refid="runtime.classpath"/>
       </java>
    </target>
 
-   <target name="scheduledMessageExample" depends="compile">
+   <target name="scheduledMessageExample" depends="compile.client">
       <java classname="org.jboss.messaging.example.ScheduledMessageExample" fork="true">
          <classpath refid="runtime.classpath"/>
       </java>

Modified: trunk/examples/messaging/src/org/jboss/messaging/example/ManagementClient.java
===================================================================
--- trunk/examples/messaging/src/org/jboss/messaging/example/ManagementClient.java	2008-11-11 12:27:28 UTC (rev 5338)
+++ trunk/examples/messaging/src/org/jboss/messaging/example/ManagementClient.java	2008-11-12 12:17:43 UTC (rev 5339)
@@ -47,7 +47,7 @@
    public static void main(final String[] args) throws Exception
    {
       SimpleString replytoQueue = new SimpleString("replyto.adminQueue");
-      ClientSessionFactory sessionFactory = new ClientSessionFactoryImpl(new TransportConfiguration("org.jboss.messaging.core.remoting.impl.netty.NettyConnectorFactory"));
+      ClientSessionFactory sessionFactory = new ClientSessionFactoryImpl(new TransportConfiguration("org.jboss.messaging.integration.transports.netty.NettyConnectorFactory"));
       final ClientSession clientSession = sessionFactory.createSession(false, true, true);
       SimpleString queue = new SimpleString("queuejms.testQueue");
 

Modified: trunk/examples/messaging/src/org/jboss/messaging/example/SSLClient.java
===================================================================
--- trunk/examples/messaging/src/org/jboss/messaging/example/SSLClient.java	2008-11-11 12:27:28 UTC (rev 5338)
+++ trunk/examples/messaging/src/org/jboss/messaging/example/SSLClient.java	2008-11-12 12:17:43 UTC (rev 5339)
@@ -29,7 +29,7 @@
 import org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl;
 import org.jboss.messaging.core.config.TransportConfiguration;
 import org.jboss.messaging.core.exception.MessagingException;
-import org.jboss.messaging.core.remoting.impl.netty.TransportConstants;
+import org.jboss.messaging.integration.transports.netty.TransportConstants;
 import org.jboss.messaging.jms.client.JBossTextMessage;
 import org.jboss.messaging.util.SimpleString;
 
@@ -46,7 +46,7 @@
       try
       {         
          ClientSessionFactory sessionFactory =
-            new ClientSessionFactoryImpl(new TransportConfiguration("org.jboss.messaging.core.remoting.impl.netty.NettyConnectorFactory"));  
+            new ClientSessionFactoryImpl(new TransportConfiguration("org.jboss.messaging.integration.transports.netty.NettyConnectorFactory"));
          sessionFactory.getTransportParams().put(TransportConstants.SSL_ENABLED_PROP_NAME, true);
          clientSession = sessionFactory.createSession(false, true, true);
          SimpleString queue = new SimpleString("queuejms.testQueue");

Modified: trunk/examples/messaging/src/org/jboss/messaging/example/ScheduledMessageExample.java
===================================================================
--- trunk/examples/messaging/src/org/jboss/messaging/example/ScheduledMessageExample.java	2008-11-11 12:27:28 UTC (rev 5338)
+++ trunk/examples/messaging/src/org/jboss/messaging/example/ScheduledMessageExample.java	2008-11-12 12:17:43 UTC (rev 5339)
@@ -51,7 +51,7 @@
       try
       {
          ClientSessionFactory sessionFactory =
-            new ClientSessionFactoryImpl(new TransportConfiguration("org.jboss.messaging.core.remoting.impl.netty.NettyConnectorFactory"));
+            new ClientSessionFactoryImpl(new TransportConfiguration("org.jboss.messaging.integration.transports.netty.NettyConnectorFactory"));
          clientSession = sessionFactory.createSession(false, true, true);
          SimpleString queue = new SimpleString("queuejms.testQueue");
          ClientProducer clientProducer = clientSession.createProducer(queue);

Modified: trunk/examples/messaging/src/org/jboss/messaging/example/SimpleClient.java
===================================================================
--- trunk/examples/messaging/src/org/jboss/messaging/example/SimpleClient.java	2008-11-11 12:27:28 UTC (rev 5338)
+++ trunk/examples/messaging/src/org/jboss/messaging/example/SimpleClient.java	2008-11-12 12:17:43 UTC (rev 5339)
@@ -45,7 +45,7 @@
       try
       {
          ClientSessionFactory sessionFactory =
-            new ClientSessionFactoryImpl(new TransportConfiguration("org.jboss.messaging.core.remoting.impl.netty.NettyConnectorFactory"));          
+            new ClientSessionFactoryImpl(new TransportConfiguration("org.jboss.messaging.integration.transports.netty.NettyConnectorFactory"));          
          clientSession = sessionFactory.createSession(false, true, true);
          SimpleString queue = new SimpleString("queuejms.testQueue");
          ClientProducer clientProducer = clientSession.createProducer(queue);

Modified: trunk/examples/messaging/src/org/jboss/messaging/example/SimpleExample.java
===================================================================
--- trunk/examples/messaging/src/org/jboss/messaging/example/SimpleExample.java	2008-11-11 12:27:28 UTC (rev 5338)
+++ trunk/examples/messaging/src/org/jboss/messaging/example/SimpleExample.java	2008-11-12 12:17:43 UTC (rev 5339)
@@ -52,13 +52,13 @@
          //create a new server with an TCP transport
          ConfigurationImpl configuration = new ConfigurationImpl();
          configuration.setSecurityEnabled(false);
-         configuration.getAcceptorConfigurations().add(new TransportConfiguration("org.jboss.messaging.core.remoting.impl.netty.NettyAcceptorFactory"));
+         configuration.getAcceptorConfigurations().add(new TransportConfiguration("org.jboss.messaging.integration.transports.netty.NettyAcceptorFactory"));
          messagingService = MessagingServiceImpl.newNullStorageMessagingServer(configuration);
          //start the server
          messagingService.start();
 
          //then we create a client as normal       
-         ClientSessionFactory sessionFactory = new ClientSessionFactoryImpl(new TransportConfiguration("org.jboss.messaging.core.remoting.impl.netty.NettyConnectorFactory"));
+         ClientSessionFactory sessionFactory = new ClientSessionFactoryImpl(new TransportConfiguration("org.jboss.messaging.integration.transports.netty.NettyConnectorFactory"));
          clientSession = sessionFactory.createSession(false, true, true);
          SimpleString atestq = new SimpleString("atestq");
          clientSession.createQueue(atestq, atestq, null, false, true);

Modified: trunk/examples/messaging/src/org/jboss/messaging/example/WildCardClient.java
===================================================================
--- trunk/examples/messaging/src/org/jboss/messaging/example/WildCardClient.java	2008-11-11 12:27:28 UTC (rev 5338)
+++ trunk/examples/messaging/src/org/jboss/messaging/example/WildCardClient.java	2008-11-12 12:17:43 UTC (rev 5339)
@@ -47,7 +47,7 @@
       try
       {
          ClientSessionFactory sessionFactory =
-            new ClientSessionFactoryImpl(new TransportConfiguration("org.jboss.messaging.core.remoting.impl.netty.NettyConnectorFactory"));
+            new ClientSessionFactoryImpl(new TransportConfiguration("org.jboss.messaging.integration.transports.netty.NettyConnectorFactory"));
          clientSession = sessionFactory.createSession(false, true, true);
          SimpleString queue = new SimpleString("queuejms.testQueue");
          SimpleString queue2 = new SimpleString("queuejms.MyQueue");

Modified: trunk/messaging.iml
===================================================================
--- trunk/messaging.iml	2008-11-11 12:27:28 UTC (rev 5338)
+++ trunk/messaging.iml	2008-11-12 12:17:43 UTC (rev 5339)
@@ -97,7 +97,6 @@
         <SOURCES />
       </library>
     </orderEntry>
-    <orderEntryProperties />
   </component>
   <component name="VcsManagerConfiguration">
     <option name="ACTIVE_VCS_NAME" value="svn" />

Modified: trunk/src/config/jbm-beans.xml
===================================================================
--- trunk/src/config/jbm-beans.xml	2008-11-11 12:27:28 UTC (rev 5338)
+++ trunk/src/config/jbm-beans.xml	2008-11-12 12:17:43 UTC (rev 5339)
@@ -11,7 +11,7 @@
       </constructor>
    </bean>
    
-   <bean name="JBMSecurityManager" class="org.jboss.messaging.core.security.impl.JBossASSecurityManager"/>
+   <bean name="JBMSecurityManager" class="org.jboss.messaging.integration.security.JBossASSecurityManager"/>
 
    <!-- <bean name="JBMSecurityManager" class="org.jboss.messaging.core.security.impl.JBMSecurityManagerImpl">
       <constructor>

Modified: trunk/src/config/jbm-configuration.xml
===================================================================
--- trunk/src/config/jbm-configuration.xml	2008-11-11 12:27:28 UTC (rev 5338)
+++ trunk/src/config/jbm-configuration.xml	2008-11-12 12:17:43 UTC (rev 5339)
@@ -42,7 +42,7 @@
       
       <!--
       <backup-connector>
-         <factory-class>org.jboss.messaging.core.remoting.impl.netty.NettyConnectorFactory</factory-class>
+         <factory-class>org.jboss.messaging.integration.transports.netty.NettyConnectorFactory</factory-class>
          <params>
             <param key="jbm.remoting.netty.host" value="localhost" type="String"/>
             <param key="jbm.remoting.netty.port" value="6400" type="Integer"/>
@@ -60,7 +60,7 @@
          </acceptor>
          <!-- Netty standard TCP acceptor -->
          <acceptor>
-            <factory-class>org.jboss.messaging.core.remoting.impl.netty.NettyAcceptorFactory</factory-class>
+            <factory-class>org.jboss.messaging.integration.transports.netty.NettyAcceptorFactory</factory-class>
             <params>	            	            
 	            <param key="jbm.remoting.netty.host" value="localhost" type="String"/>
 	            <param key="jbm.remoting.netty.port" value="5400" type="Integer"/>	            
@@ -73,7 +73,7 @@
          </acceptor>   
          <!-- Netty SSL Acceptor
          <acceptor>
-            <factory-class>org.jboss.messaging.core.remoting.impl.netty.NettyAcceptorFactory</factory-class>
+            <factory-class>org.jboss.messaging.integration.transports.netty.NettyAcceptorFactory</factory-class>
             <params>	            	            
 	            <param key="jbm.remoting.netty.host" value="localhost" type="String"/>
 	            <param key="jbm.remoting.netty.port" value="5500" type="Integer"/>	            
@@ -91,7 +91,7 @@
          -->      
          <!-- Mina Acceptor -->
          <acceptor>
-            <factory-class>org.jboss.messaging.core.remoting.impl.mina.MinaAcceptorFactory</factory-class>
+            <factory-class>org.jboss.messaging.integration.transports.mina.MinaAcceptorFactory</factory-class>
             <params>	            	            
 	            <param key="jbm.remoting.mina.host" value="localhost" type="String"/>
 	            <param key="jbm.remoting.mina.port" value="5600" type="Integer"/>	            

Modified: trunk/src/config/jbm-jndi.xml
===================================================================
--- trunk/src/config/jbm-jndi.xml	2008-11-11 12:27:28 UTC (rev 5338)
+++ trunk/src/config/jbm-jndi.xml	2008-11-12 12:17:43 UTC (rev 5339)
@@ -2,14 +2,14 @@
 
    <connection-factory name="testConnectionFactory">
       <connector>
-         <factory-class>org.jboss.messaging.core.remoting.impl.netty.NettyConnectorFactory</factory-class>
+         <factory-class>org.jboss.messaging.integration.transports.netty.NettyConnectorFactory</factory-class>
       </connector>
       <entry name="testConnectionFactory"/>
    </connection-factory>
 
    <connection-factory name="ConnectionFactory">
       <connector>
-         <factory-class>org.jboss.messaging.core.remoting.impl.netty.NettyConnectorFactory</factory-class>
+         <factory-class>org.jboss.messaging.integration.transports.netty.NettyConnectorFactory</factory-class>
       </connector>
       <entry name="ConnectionFactory"/>
       <entry name="/ConnectionFactory"/>
@@ -20,10 +20,10 @@
 
    <connection-factory name="ClusteredConnectionFactory">
       <connector>
-         <factory-class>org.jboss.messaging.core.remoting.impl.netty.NettyConnectorFactory</factory-class>
+         <factory-class>org.jboss.messaging.integration.transports.netty.NettyConnectorFactory</factory-class>
       </connector>
       <backup-connector>
-         <factory-class>org.jboss.messaging.core.remoting.impl.netty.NettyConnectorFactory</factory-class>
+         <factory-class>org.jboss.messaging.integration.transports.netty.NettyConnectorFactory</factory-class>
          <params>
             <param key="jbm.remoting.netty.host" value="somehost" type="String"/>
          </params>
@@ -36,7 +36,7 @@
 
    <connection-factory name="MyExampleConnectionFactory">
       <connector>
-         <factory-class>org.jboss.messaging.core.remoting.impl.netty.NettyConnectorFactory</factory-class>
+         <factory-class>org.jboss.messaging.integration.transports.netty.NettyConnectorFactory</factory-class>
          <params>
             <param key="jbm.remoting.netty.tcpnodelay" value="true" type="Boolean"/>
          </params>
@@ -83,7 +83,7 @@
    
    <connection-factory name="TestSSLConnectionFactory">
       <connector>
-         <factory-class>org.jboss.messaging.core.remoting.impl.netty.NettyConnectorFactory</factory-class>
+         <factory-class>org.jboss.messaging.integration.transports.netty.NettyConnectorFactory</factory-class>
          <params>
             <param key="jbm.remoting.netty.host" value="localhost" type="String"/>
             <param key="jbm.remoting.netty.port" value="5500" type="Integer"/>	                       

Added: trunk/src/config/logging.properties
===================================================================
--- trunk/src/config/logging.properties	                        (rev 0)
+++ trunk/src/config/logging.properties	2008-11-12 12:17:43 UTC (rev 5339)
@@ -0,0 +1,31 @@
+############################################################
+#  	Default Logging Configuration File
+#
+# You can use a different file by specifying a filename
+# with the java.util.logging.config.file system property.
+# For example java -Djava.util.logging.config.file=myfile
+############################################################
+
+############################################################
+#  	Global properties
+############################################################
+
+# "handlers" specifies a comma separated list of log Handler
+# classes.  These handlers will be installed during VM startup.
+# Note that these classes must be on the system classpath.
+# By default we only configure a ConsoleHandler, which will only
+# show messages at the INFO and above levels.
+handlers=org.jboss.messaging.integration.logging.JBossLoggerHandler
+
+# Default global logging level.
+# This specifies which kinds of events are logged across
+# all loggers.  For any given facility this global level
+# can be overriden by a facility specific level
+# Note that the ConsoleHandler also has a separate level
+# setting to limit messages printed to the console.
+.level= INFO
+
+############################################################
+# Handler specific properties.
+# Describes specific configuration info for Handlers.
+############################################################

Deleted: trunk/src/main/org/jboss/messaging/core/logging/JBMLoggerPlugin.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/logging/JBMLoggerPlugin.java	2008-11-11 12:27:28 UTC (rev 5338)
+++ trunk/src/main/org/jboss/messaging/core/logging/JBMLoggerPlugin.java	2008-11-12 12:17:43 UTC (rev 5339)
@@ -1,113 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005-2008, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */ 
-
-package org.jboss.messaging.core.logging;
-
-import org.jboss.logging.LoggerPlugin;
-
-/**
- * @author <a href="ataylor at redhat.com">Andy Taylor</a>
- */
-public class JBMLoggerPlugin implements LoggerPlugin
-{
-   org.apache.log4j.Logger logger;
-
-   public void init(String s)
-   {
-      logger = org.apache.log4j.Logger.getLogger(s);
-   }
-
-   public boolean isTraceEnabled()
-   {
-      return logger.isTraceEnabled();
-   }
-
-   public void trace(Object o)
-   {
-      logger.trace(o);
-   }
-
-   public void trace(Object o, Throwable throwable)
-   {
-      logger.trace(o, throwable);
-   }
-
-   public boolean isDebugEnabled()
-   {
-      return logger.isDebugEnabled();
-   }
-
-   public void debug(Object o)
-   {
-      logger.debug(o);
-   }
-
-   public void debug(Object o, Throwable throwable)
-   {
-      logger.debug(o, throwable);
-   }
-
-   public boolean isInfoEnabled()
-   {
-      return logger.isInfoEnabled();
-   }
-
-   public void info(Object o)
-   {
-      logger.info(o);
-   }
-
-   public void info(Object o, Throwable throwable)
-   {
-      logger.info(o, throwable);
-   }
-
-   public void warn(Object o)
-   {
-      logger.warn(o);
-   }
-
-   public void warn(Object o, Throwable throwable)
-   {
-      logger.warn(o, throwable);
-   }
-
-   public void error(Object o)
-   {
-      logger.warn(o);
-   }
-
-   public void error(Object o, Throwable throwable)
-   {
-      logger.error(o, throwable);
-   }
-
-   public void fatal(Object o)
-   {
-      logger.fatal(o);
-   }
-
-   public void fatal(Object o, Throwable throwable)
-   {
-      logger.fatal(o, throwable);
-   }
-}

Modified: trunk/src/main/org/jboss/messaging/core/logging/Logger.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/logging/Logger.java	2008-11-11 12:27:28 UTC (rev 5338)
+++ trunk/src/main/org/jboss/messaging/core/logging/Logger.java	2008-11-12 12:17:43 UTC (rev 5339)
@@ -24,6 +24,9 @@
 
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.ConcurrentMap;
+import java.util.logging.Level;
+import java.util.logging.Handler;
+import java.util.logging.LogRecord;
 
 /**
  * 
@@ -36,7 +39,7 @@
  * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
  *
  */
-public class Logger 
+public class Logger
 {
    private static final ConcurrentMap<Class<?>, Logger> loggers = new ConcurrentHashMap<Class<?>, Logger>();
    
@@ -59,90 +62,87 @@
       return logger;
    }
    
-   private final org.jboss.logging.Logger logger;
+   private final java.util.logging.Logger logger;
    
    private Logger(final Class<?> clazz)
    {
-      if(!"org.jboss.logging.Log4jLoggerPlugin.class".equals(org.jboss.logging.Logger.getPluginClassName()))
-      {
-         org.jboss.logging.Logger.setPluginClassName("org.jboss.messaging.core.logging.JBMLoggerPlugin");
-      }
-      logger = org.jboss.logging.Logger.getLogger(clazz);
+      logger = java.util.logging.Logger.getLogger(clazz.getName());
+      logger.setUseParentHandlers(false);
    }
    
    public boolean isInfoEnabled()
    {
-      return logger.isInfoEnabled();
+      return logger.isLoggable(Level.INFO);
    }
    
    public boolean isDebugEnabled()
    {
-      return logger.isDebugEnabled();
+      return logger.isLoggable(Level.FINE);
    }
    
    public boolean isTraceEnabled()
    {
-      return logger.isTraceEnabled();
+      return logger.isLoggable(Level.FINEST);
    }
    
    public void fatal(final Object message)
    {
-      logger.fatal(message);
+     logger.log(Level.SEVERE, message==null?"NULL":message.toString());
    }
    
    public void fatal(final Object message, final Throwable t)
    {
-      logger.fatal(message, t);
+      logger.log(Level.SEVERE, message==null?"NULL":message.toString(), t);
    }
    
    public void error(final Object message)
    {
-      logger.error(message);
+      logger.log(Level.SEVERE, message==null?"NULL":message.toString());
    }
    
    public void error(final Object message, final Throwable t)
    {
-      logger.error(message, t);
+      logger.log(Level.SEVERE, message==null?"NULL":message.toString(), t);
    }
    
    public void warn(final Object message)
    {
-      logger.warn(message);
+      logger.log(Level.WARNING, message==null?"NULL":message.toString());
    }
    
    public void warn(final Object message, final Throwable t)
    {
-      logger.warn(message, t);
+      logger.log(Level.WARNING, message==null?"NULL":message.toString(), t);
    }
    
    public void info(final Object message)
    {
-      logger.info(message);
+      logger.log(Level.INFO, message==null?"NULL":message.toString());
    }
    
    public void info(final Object message, final Throwable t)
    {
-      logger.info(message, t);
+      logger.log(Level.INFO, message==null?"NULL":message.toString(), t);
    }
    
    public void debug(final Object message)
    {
-      logger.debug(message);
+      logger.log(Level.FINE, message==null?"NULL":message.toString());
    }
    
    public void debug(final Object message, final Throwable t)
    {
-      logger.debug(message, t);
+      logger.log(Level.FINE, message==null?"NULL":message.toString(), t);
    }
    
    public void trace(final Object message)
    {
-      logger.trace(message);
+      logger.log(Level.FINEST, message==null?"NULL":message.toString());
    }
    
    public void trace(final Object message, final Throwable t)
    {
-      logger.trace(message, t);
+      logger.log(Level.FINEST, message==null?"NULL":message.toString(), t);
    }
    
 }

Deleted: trunk/src/main/org/jboss/messaging/core/security/impl/JBossASSecurityManager.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/security/impl/JBossASSecurityManager.java	2008-11-11 12:27:28 UTC (rev 5338)
+++ trunk/src/main/org/jboss/messaging/core/security/impl/JBossASSecurityManager.java	2008-11-12 12:17:43 UTC (rev 5339)
@@ -1,186 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005-2008, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */ 
-
-package org.jboss.messaging.core.security.impl;
-
-import java.util.HashSet;
-import java.util.Set;
-
-import javax.naming.InitialContext;
-import javax.security.auth.Subject;
-
-import org.jboss.messaging.core.logging.Logger;
-import org.jboss.messaging.core.security.CheckType;
-import org.jboss.messaging.core.security.JBMSecurityManager;
-import org.jboss.messaging.core.security.Role;
-import org.jboss.messaging.core.server.MessagingComponent;
-import org.jboss.security.AuthenticationManager;
-import org.jboss.security.RealmMapping;
-import org.jboss.security.SimplePrincipal;
-
-/**
- * This implementation delegates to the JBoss AS security interfaces (which in turn use JAAS)
- * It can be used when running JBM in JBoss AS
- *
- * @author <a href="ataylor at redhat.com">Andy Taylor</a>
- * @author <a href="tim.fox at jboss.com">Tim Fox</a>
- */
-public class JBossASSecurityManager implements JBMSecurityManager, MessagingComponent
-{
-   private static final Logger log = Logger.getLogger(JBossASSecurityManager.class);
-
-   // Static --------------------------------------------------------
-
-   // Attributes ----------------------------------------------------
-
-   private boolean trace = log.isTraceEnabled();
-
-   /**
-    * the realmmapping
-    */
-   private RealmMapping realmMapping;
-
-   /**
-    * the JAAS Authentication Manager
-    */
-   private AuthenticationManager authenticationManager;
-
-   /**
-    * The JNDI name of the AuthenticationManager(and RealmMapping since they are the same object).
-    */
-   private String securityDomainName = "java:/jaas/messaging";
-   
-   private boolean started;
-   
-   public boolean validateUser(final String user, final String password)
-   {      
-      SimplePrincipal principal = new SimplePrincipal(user);
-
-      char[] passwordChars = null;
-
-      if (password != null)
-      {
-         passwordChars = password.toCharArray();
-      }
-
-      Subject subject = new Subject();
-
-      return authenticationManager.isValid(principal, passwordChars, subject);
-   }
-
-   public boolean validateUserAndRole(final String user, final String password, final Set<Role> roles, final CheckType checkType)
-   {
-      SimplePrincipal principal = user == null ? null : new SimplePrincipal(user);
-
-      char[] passwordChars = null;
-
-      if (password != null)
-      {
-         passwordChars = password.toCharArray();
-      }
-
-      Subject subject = new Subject();
-
-      boolean authenticated = authenticationManager.isValid(principal, passwordChars, subject);
-      // Authenticate. Successful authentication will place a new SubjectContext on thread local,
-      // which will be used in the authorization process. However, we need to make sure we clean up
-      // thread local immediately after we used the information, otherwise some other people
-      // security my be screwed up, on account of thread local security stack being corrupted.
-      if (authenticated)
-      {
-         SecurityActions.pushSubjectContext(principal, passwordChars, subject);
-         Set<SimplePrincipal> rolePrincipals = getRolePrincipals(checkType, roles);
-
-         authenticated = realmMapping.doesUserHaveRole(principal, rolePrincipals);
-
-         if (trace)
-         {
-            log.trace("user " + user + (authenticated ? " is " : " is NOT ") + "authorized");
-         }
-         SecurityActions.popSubjectContext();
-      }
-      return authenticated;
-   }
-
-   private Set<SimplePrincipal> getRolePrincipals(final CheckType checkType, final Set<Role> roles)
-   {
-      Set<SimplePrincipal> principals = new HashSet<SimplePrincipal>();
-      for (Role role : roles)
-      {
-         if ((checkType.equals(CheckType.CREATE) && role.isCheckType(CheckType.CREATE)) ||
-                 (checkType.equals(CheckType.WRITE) && role.isCheckType(CheckType.WRITE)) ||
-                 (checkType.equals(CheckType.READ) && role.isCheckType(CheckType.READ)))
-         {
-            principals.add(new SimplePrincipal(role.getName()));
-         }
-      }
-      return principals;
-   }
-
-   public void setRealmMapping(final RealmMapping realmMapping)
-   {
-      this.realmMapping = realmMapping;
-   }
-
-   public void setAuthenticationManager(final AuthenticationManager authenticationManager)
-   {
-      this.authenticationManager = authenticationManager;
-   }
-
-   /**
-    * lifecycle method, needs to be called
-    *
-    * @throws Exception
-    */
-   public synchronized void start() throws Exception
-   {
-      if (started)
-      {
-         return;
-      }
-      
-      InitialContext ic = new InitialContext();
-      authenticationManager = (AuthenticationManager) ic.lookup(securityDomainName);
-      realmMapping = (RealmMapping) authenticationManager;
-      
-      started = true;
-   }
-   
-   public synchronized void stop()
-   {
-      if (!started)
-      {
-         return;
-      }
-      started = false;
-   }
-   
-   public synchronized boolean isStarted()
-   {
-      return started;
-   }
-   
-   public void setSecurityDomainName(String securityDomainName)
-   {
-      this.securityDomainName = securityDomainName;
-   }
-}

Deleted: trunk/src/main/org/jboss/messaging/core/security/impl/SecurityActions.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/security/impl/SecurityActions.java	2008-11-11 12:27:28 UTC (rev 5338)
+++ trunk/src/main/org/jboss/messaging/core/security/impl/SecurityActions.java	2008-11-12 12:17:43 UTC (rev 5339)
@@ -1,115 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005-2008, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */ 
-
-package org.jboss.messaging.core.security.impl;
-
-import java.security.AccessController;
-import java.security.Principal;
-import java.security.PrivilegedAction;
-
-import javax.security.auth.Subject;
-
-import org.jboss.security.SecurityAssociation;
-
-
-/** A collection of privileged actions for this package
- * @author Scott.Stark at jboss.org
- * @author <a href="mailto:alex at jboss.org">Alexey Loubyansky</a>
- * @author <a her="mailto:tim.fox at jboss.com">Tim Fox</a>
- * @version $Revison: 1.0$
- */
-class SecurityActions
-{
-	interface PrincipalInfoAction
-	{
-		PrincipalInfoAction PRIVILEGED = new PrincipalInfoAction()
-		{
-			public void push(final Principal principal, final Object credential,
-					           final Subject subject)
-			{
-				AccessController.doPrivileged(
-						new PrivilegedAction()
-						{
-							public Object run()
-							{
-								SecurityAssociation.pushSubjectContext(subject, principal, credential);
-								return null;
-							}
-						}
-				);
-			}
-			public void pop()
-			{
-				AccessController.doPrivileged(
-						new PrivilegedAction()
-						{
-							public Object run()
-							{
-								SecurityAssociation.popSubjectContext();
-								return null;
-							}
-						}
-				);
-			}
-		};
-
-		PrincipalInfoAction NON_PRIVILEGED = new PrincipalInfoAction()
-		{
-			public void push(final Principal principal, final Object credential, final Subject subject)
-			{
-				SecurityAssociation.pushSubjectContext(subject, principal, credential);
-			}
-			public void pop()
-			{
-				SecurityAssociation.popSubjectContext();
-			}
-		};
-
-		void push(Principal principal, Object credential, Subject subject);
-		void pop();
-	}
-
-	static void pushSubjectContext(final Principal principal, final Object credential,
-			                         final Subject subject)
-	{
-		if(System.getSecurityManager() == null)
-		{
-			PrincipalInfoAction.NON_PRIVILEGED.push(principal, credential, subject);
-		}
-		else
-		{
-			PrincipalInfoAction.PRIVILEGED.push(principal, credential, subject);
-		}
-	}
-	
-	static void popSubjectContext()
-	{
-		if (System.getSecurityManager() == null)
-		{
-			PrincipalInfoAction.NON_PRIVILEGED.pop();
-		}
-		else
-		{
-			PrincipalInfoAction.PRIVILEGED.pop();
-		}
-	}
-}

Added: trunk/src/main/org/jboss/messaging/integration/logging/BaseLoggerHandler.java
===================================================================
--- trunk/src/main/org/jboss/messaging/integration/logging/BaseLoggerHandler.java	                        (rev 0)
+++ trunk/src/main/org/jboss/messaging/integration/logging/BaseLoggerHandler.java	2008-11-12 12:17:43 UTC (rev 5339)
@@ -0,0 +1,65 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005-2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.messaging.integration.logging;
+
+import java.util.logging.Handler;
+import java.util.logging.LogRecord;
+import java.util.logging.Level;
+
+/**
+ * @author <a href="mailto:andy.taylor at jboss.org">Andy Taylor</a>
+ */
+public abstract class BaseLoggerHandler extends Handler
+{
+   public static final int SEVERE = 1000;
+
+   public static final int WARNING = 900;
+
+   public static final int INFO = 800;
+
+   public static final int CONFIG = 700;
+
+   public static final int FINE = 500;
+
+   public static final int FINER = 400;
+
+   public static final int FINEST = 300;
+
+   public void publish(LogRecord record)
+   {
+      String loggerName = record.getLoggerName();
+      Level level = record.getLevel();
+      String message = record.getMessage();
+      Throwable throwable = record.getThrown();
+      publish(loggerName, level, message, throwable);
+   }
+
+   abstract void publish(String loggerName, Level level, String message, Throwable throwable);
+
+   public void flush()
+   {
+   }
+
+   public void close() throws SecurityException
+   {
+   }
+}

Copied: trunk/src/main/org/jboss/messaging/integration/logging/JBMLoggerPlugin.java (from rev 5331, trunk/src/main/org/jboss/messaging/core/logging/JBMLoggerPlugin.java)
===================================================================
--- trunk/src/main/org/jboss/messaging/integration/logging/JBMLoggerPlugin.java	                        (rev 0)
+++ trunk/src/main/org/jboss/messaging/integration/logging/JBMLoggerPlugin.java	2008-11-12 12:17:43 UTC (rev 5339)
@@ -0,0 +1,113 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005-2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.messaging.integration.logging;
+
+import org.jboss.logging.LoggerPlugin;
+
+/**
+ * @author <a href="ataylor at redhat.com">Andy Taylor</a>
+ */
+public class JBMLoggerPlugin implements LoggerPlugin
+{
+   org.apache.log4j.Logger logger;
+
+   public void init(String s)
+   {
+      logger = org.apache.log4j.Logger.getLogger(s);
+   }
+
+   public boolean isTraceEnabled()
+   {
+      return logger.isTraceEnabled();
+   }
+
+   public void trace(Object o)
+   {
+      logger.trace(o);
+   }
+
+   public void trace(Object o, Throwable throwable)
+   {
+      logger.trace(o, throwable);
+   }
+
+   public boolean isDebugEnabled()
+   {
+      return logger.isDebugEnabled();
+   }
+
+   public void debug(Object o)
+   {
+      logger.debug(o);
+   }
+
+   public void debug(Object o, Throwable throwable)
+   {
+      logger.debug(o, throwable);
+   }
+
+   public boolean isInfoEnabled()
+   {
+      return logger.isInfoEnabled();
+   }
+
+   public void info(Object o)
+   {
+      logger.info(o);
+   }
+
+   public void info(Object o, Throwable throwable)
+   {
+      logger.info(o, throwable);
+   }
+
+   public void warn(Object o)
+   {
+      logger.warn(o);
+   }
+
+   public void warn(Object o, Throwable throwable)
+   {
+      logger.warn(o, throwable);
+   }
+
+   public void error(Object o)
+   {
+      logger.warn(o);
+   }
+
+   public void error(Object o, Throwable throwable)
+   {
+      logger.error(o, throwable);
+   }
+
+   public void fatal(Object o)
+   {
+      logger.fatal(o);
+   }
+
+   public void fatal(Object o, Throwable throwable)
+   {
+      logger.fatal(o, throwable);
+   }
+}

Added: trunk/src/main/org/jboss/messaging/integration/logging/JBossLoggerHandler.java
===================================================================
--- trunk/src/main/org/jboss/messaging/integration/logging/JBossLoggerHandler.java	                        (rev 0)
+++ trunk/src/main/org/jboss/messaging/integration/logging/JBossLoggerHandler.java	2008-11-12 12:17:43 UTC (rev 5339)
@@ -0,0 +1,118 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005-2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.messaging.integration.logging;
+
+import org.jboss.logging.Logger;
+
+import java.util.logging.Level;
+
+/**
+ * @author <a href="mailto:andy.taylor at jboss.org">Andy Taylor</a>
+ */
+public class JBossLoggerHandler extends BaseLoggerHandler
+{
+   void publish(String loggerName, Level level, String message, Throwable throwable)
+   {
+      if (throwable == null)
+      {
+         switch (level.intValue())
+         {
+            case SEVERE:
+            {
+               Logger.getLogger(loggerName).error(message);
+               break;
+            }
+            case WARNING:
+            {
+               Logger.getLogger(loggerName).warn(message);
+               break;
+            }
+            case INFO:
+            {
+               Logger.getLogger(loggerName).info(message);
+               break;
+            }
+            case CONFIG:
+            {
+               Logger.getLogger(loggerName).info(message);
+               break;
+            }
+            case FINE:
+            {
+               Logger.getLogger(loggerName).debug(message);
+               break;
+            }
+            case FINER:
+            {
+               Logger.getLogger(loggerName).debug(message);
+               break;
+            }
+            case FINEST:
+            {
+               Logger.getLogger(loggerName).trace(message);
+               break;
+            }
+         }
+      }
+      else
+      {
+         switch (level.intValue())
+         {
+            case SEVERE:
+            {
+               Logger.getLogger(loggerName).error(message, throwable);
+               break;
+            }
+            case WARNING:
+            {
+               Logger.getLogger(loggerName).warn(message, throwable);
+               break;
+            }
+            case INFO:
+            {
+               Logger.getLogger(loggerName).info(message, throwable);
+               break;
+            }
+            case CONFIG:
+            {
+               Logger.getLogger(loggerName).info(message, throwable);
+               break;
+            }
+            case FINE:
+            {
+               Logger.getLogger(loggerName).debug(message, throwable);
+               break;
+            }
+            case FINER:
+            {
+               Logger.getLogger(loggerName).debug(message, throwable);
+               break;
+            }
+            case FINEST:
+            {
+               Logger.getLogger(loggerName).trace(message, throwable);
+               break;
+            }
+         }
+      }
+   }
+}

Added: trunk/src/main/org/jboss/messaging/integration/logging/Log4jLoggerHandler.java
===================================================================
--- trunk/src/main/org/jboss/messaging/integration/logging/Log4jLoggerHandler.java	                        (rev 0)
+++ trunk/src/main/org/jboss/messaging/integration/logging/Log4jLoggerHandler.java	2008-11-12 12:17:43 UTC (rev 5339)
@@ -0,0 +1,129 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005-2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.messaging.integration.logging;
+
+import org.apache.log4j.Logger;
+
+import java.util.logging.Level;
+
+/**
+ * @author <a href="mailto:andy.taylor at jboss.org">Andy Taylor</a>
+ */
+public class Log4jLoggerHandler extends BaseLoggerHandler
+{
+   void publish(String loggerName, Level level, String message, Throwable throwable)
+   {
+      if (throwable == null)
+      {
+         switch (level.intValue())
+         {
+            case SEVERE:
+            {
+               Logger.getLogger(loggerName).error(message);
+               break;
+            }
+            case WARNING:
+            {
+               Logger.getLogger(loggerName).warn(message);
+               break;
+            }
+            case INFO:
+            {
+               Logger.getLogger(loggerName).info(message);
+               break;
+            }
+            case CONFIG:
+            {
+               Logger.getLogger(loggerName).info(message);
+               break;
+            }
+            case FINE:
+            {
+               Logger.getLogger(loggerName).debug(message);
+               break;
+            }
+            case FINER:
+            {
+               Logger.getLogger(loggerName).debug(message);
+               break;
+            }
+            case FINEST:
+            {
+               Logger.getLogger(loggerName).trace(message);
+               break;
+            }
+         }
+      }
+      else
+      {
+         switch (level.intValue())
+         {
+            case SEVERE:
+            {
+               Logger.getLogger(loggerName).error(message, throwable);
+               break;
+            }
+            case WARNING:
+            {
+               Logger.getLogger(loggerName).warn(message, throwable);
+               break;
+            }
+            case INFO:
+            {
+               Logger.getLogger(loggerName).info(message, throwable);
+               break;
+            }
+            case CONFIG:
+            {
+               Logger.getLogger(loggerName).info(message, throwable);
+               break;
+            }
+            case FINE:
+            {
+               Logger.getLogger(loggerName).debug(message, throwable);
+               break;
+            }
+            case FINER:
+            {
+               Logger.getLogger(loggerName).debug(message, throwable);
+               break;
+            }
+            case FINEST:
+            {
+               Logger.getLogger(loggerName).trace(message, throwable);
+               break;
+            }
+         }
+      }
+   }
+
+   public void flush()
+   {
+      //no op
+   }
+
+   public void close() throws SecurityException
+   {
+      //no op
+   }
+}
+

Copied: trunk/src/main/org/jboss/messaging/integration/security/JBossASSecurityManager.java (from rev 5338, trunk/src/main/org/jboss/messaging/core/security/impl/JBossASSecurityManager.java)
===================================================================
--- trunk/src/main/org/jboss/messaging/integration/security/JBossASSecurityManager.java	                        (rev 0)
+++ trunk/src/main/org/jboss/messaging/integration/security/JBossASSecurityManager.java	2008-11-12 12:17:43 UTC (rev 5339)
@@ -0,0 +1,186 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005-2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.messaging.integration.security;
+
+import java.util.HashSet;
+import java.util.Set;
+
+import javax.naming.InitialContext;
+import javax.security.auth.Subject;
+
+import org.jboss.messaging.core.logging.Logger;
+import org.jboss.messaging.core.security.CheckType;
+import org.jboss.messaging.core.security.JBMSecurityManager;
+import org.jboss.messaging.core.security.Role;
+import org.jboss.messaging.core.server.MessagingComponent;
+import org.jboss.security.AuthenticationManager;
+import org.jboss.security.RealmMapping;
+import org.jboss.security.SimplePrincipal;
+
+/**
+ * This implementation delegates to the JBoss AS security interfaces (which in turn use JAAS)
+ * It can be used when running JBM in JBoss AS
+ *
+ * @author <a href="ataylor at redhat.com">Andy Taylor</a>
+ * @author <a href="tim.fox at jboss.com">Tim Fox</a>
+ */
+public class JBossASSecurityManager implements JBMSecurityManager, MessagingComponent
+{
+   private static final Logger log = Logger.getLogger(JBossASSecurityManager.class);
+
+   // Static --------------------------------------------------------
+
+   // Attributes ----------------------------------------------------
+
+   private boolean trace = log.isTraceEnabled();
+
+   /**
+    * the realmmapping
+    */
+   private RealmMapping realmMapping;
+
+   /**
+    * the JAAS Authentication Manager
+    */
+   private AuthenticationManager authenticationManager;
+
+   /**
+    * The JNDI name of the AuthenticationManager(and RealmMapping since they are the same object).
+    */
+   private String securityDomainName = "java:/jaas/messaging";
+   
+   private boolean started;
+   
+   public boolean validateUser(final String user, final String password)
+   {      
+      SimplePrincipal principal = new SimplePrincipal(user);
+
+      char[] passwordChars = null;
+
+      if (password != null)
+      {
+         passwordChars = password.toCharArray();
+      }
+
+      Subject subject = new Subject();
+
+      return authenticationManager.isValid(principal, passwordChars, subject);
+   }
+
+   public boolean validateUserAndRole(final String user, final String password, final Set<Role> roles, final CheckType checkType)
+   {
+      SimplePrincipal principal = user == null ? null : new SimplePrincipal(user);
+
+      char[] passwordChars = null;
+
+      if (password != null)
+      {
+         passwordChars = password.toCharArray();
+      }
+
+      Subject subject = new Subject();
+
+      boolean authenticated = authenticationManager.isValid(principal, passwordChars, subject);
+      // Authenticate. Successful authentication will place a new SubjectContext on thread local,
+      // which will be used in the authorization process. However, we need to make sure we clean up
+      // thread local immediately after we used the information, otherwise some other people
+      // security my be screwed up, on account of thread local security stack being corrupted.
+      if (authenticated)
+      {
+         SecurityActions.pushSubjectContext(principal, passwordChars, subject);
+         Set<SimplePrincipal> rolePrincipals = getRolePrincipals(checkType, roles);
+
+         authenticated = realmMapping.doesUserHaveRole(principal, rolePrincipals);
+
+         if (trace)
+         {
+            log.trace("user " + user + (authenticated ? " is " : " is NOT ") + "authorized");
+         }
+         SecurityActions.popSubjectContext();
+      }
+      return authenticated;
+   }
+
+   private Set<SimplePrincipal> getRolePrincipals(final CheckType checkType, final Set<Role> roles)
+   {
+      Set<SimplePrincipal> principals = new HashSet<SimplePrincipal>();
+      for (Role role : roles)
+      {
+         if ((checkType.equals(CheckType.CREATE) && role.isCheckType(CheckType.CREATE)) ||
+                 (checkType.equals(CheckType.WRITE) && role.isCheckType(CheckType.WRITE)) ||
+                 (checkType.equals(CheckType.READ) && role.isCheckType(CheckType.READ)))
+         {
+            principals.add(new SimplePrincipal(role.getName()));
+         }
+      }
+      return principals;
+   }
+
+   public void setRealmMapping(final RealmMapping realmMapping)
+   {
+      this.realmMapping = realmMapping;
+   }
+
+   public void setAuthenticationManager(final AuthenticationManager authenticationManager)
+   {
+      this.authenticationManager = authenticationManager;
+   }
+
+   /**
+    * lifecycle method, needs to be called
+    *
+    * @throws Exception
+    */
+   public synchronized void start() throws Exception
+   {
+      if (started)
+      {
+         return;
+      }
+      
+      InitialContext ic = new InitialContext();
+      authenticationManager = (AuthenticationManager) ic.lookup(securityDomainName);
+      realmMapping = (RealmMapping) authenticationManager;
+      
+      started = true;
+   }
+   
+   public synchronized void stop()
+   {
+      if (!started)
+      {
+         return;
+      }
+      started = false;
+   }
+   
+   public synchronized boolean isStarted()
+   {
+      return started;
+   }
+   
+   public void setSecurityDomainName(String securityDomainName)
+   {
+      this.securityDomainName = securityDomainName;
+   }
+}

Copied: trunk/src/main/org/jboss/messaging/integration/security/SecurityActions.java (from rev 5338, trunk/src/main/org/jboss/messaging/core/security/impl/SecurityActions.java)
===================================================================
--- trunk/src/main/org/jboss/messaging/integration/security/SecurityActions.java	                        (rev 0)
+++ trunk/src/main/org/jboss/messaging/integration/security/SecurityActions.java	2008-11-12 12:17:43 UTC (rev 5339)
@@ -0,0 +1,115 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005-2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.messaging.integration.security;
+
+import java.security.AccessController;
+import java.security.Principal;
+import java.security.PrivilegedAction;
+
+import javax.security.auth.Subject;
+
+import org.jboss.security.SecurityAssociation;
+
+
+/** A collection of privileged actions for this package
+ * @author Scott.Stark at jboss.org
+ * @author <a href="mailto:alex at jboss.org">Alexey Loubyansky</a>
+ * @author <a her="mailto:tim.fox at jboss.com">Tim Fox</a>
+ * @version $Revison: 1.0$
+ */
+class SecurityActions
+{
+	interface PrincipalInfoAction
+	{
+		PrincipalInfoAction PRIVILEGED = new PrincipalInfoAction()
+		{
+			public void push(final Principal principal, final Object credential,
+					           final Subject subject)
+			{
+				AccessController.doPrivileged(
+						new PrivilegedAction()
+						{
+							public Object run()
+							{
+								SecurityAssociation.pushSubjectContext(subject, principal, credential);
+								return null;
+							}
+						}
+				);
+			}
+			public void pop()
+			{
+				AccessController.doPrivileged(
+						new PrivilegedAction()
+						{
+							public Object run()
+							{
+								SecurityAssociation.popSubjectContext();
+								return null;
+							}
+						}
+				);
+			}
+		};
+
+		PrincipalInfoAction NON_PRIVILEGED = new PrincipalInfoAction()
+		{
+			public void push(final Principal principal, final Object credential, final Subject subject)
+			{
+				SecurityAssociation.pushSubjectContext(subject, principal, credential);
+			}
+			public void pop()
+			{
+				SecurityAssociation.popSubjectContext();
+			}
+		};
+
+		void push(Principal principal, Object credential, Subject subject);
+		void pop();
+	}
+
+	static void pushSubjectContext(final Principal principal, final Object credential,
+			                         final Subject subject)
+	{
+		if(System.getSecurityManager() == null)
+		{
+			PrincipalInfoAction.NON_PRIVILEGED.push(principal, credential, subject);
+		}
+		else
+		{
+			PrincipalInfoAction.PRIVILEGED.push(principal, credential, subject);
+		}
+	}
+	
+	static void popSubjectContext()
+	{
+		if (System.getSecurityManager() == null)
+		{
+			PrincipalInfoAction.NON_PRIVILEGED.pop();
+		}
+		else
+		{
+			PrincipalInfoAction.PRIVILEGED.pop();
+		}
+	}
+}


Property changes on: trunk/src/main/org/jboss/messaging/integration/security/SecurityActions.java
___________________________________________________________________
Name: svn:keywords
   + Author Date Id Revision
Name: svn:eol-style
   + native

Copied: trunk/src/main/org/jboss/messaging/integration/transports/mina/FilterChainSupport.java (from rev 5338, trunk/src/main/org/jboss/messaging/core/remoting/impl/mina/FilterChainSupport.java)
===================================================================
--- trunk/src/main/org/jboss/messaging/integration/transports/mina/FilterChainSupport.java	                        (rev 0)
+++ trunk/src/main/org/jboss/messaging/integration/transports/mina/FilterChainSupport.java	2008-11-12 12:17:43 UTC (rev 5339)
@@ -0,0 +1,81 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005-2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.messaging.integration.transports.mina;
+
+import javax.net.ssl.SSLContext;
+
+import org.apache.mina.core.filterchain.DefaultIoFilterChainBuilder;
+import org.apache.mina.filter.codec.ProtocolCodecFilter;
+import org.apache.mina.filter.ssl.SslFilter;
+import org.jboss.messaging.core.remoting.impl.ssl.SSLSupport;
+import org.jboss.messaging.core.remoting.spi.BufferHandler;
+
+/**
+ * @author <a href="mailto:jmesnil at redhat.com">Jeff Mesnil</a>
+ * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
+ * @author <a href="mailto:clebert.suconic at jboss.com">Clebert Suconic</a>
+ */
+public class FilterChainSupport
+{
+   // Constants -----------------------------------------------------
+
+   // Attributes ----------------------------------------------------
+
+   // Static --------------------------------------------------------
+
+   // Constructors --------------------------------------------------
+
+   private FilterChainSupport()
+   {
+   }
+
+   // Public --------------------------------------------------------
+
+   public static void addCodecFilter(final DefaultIoFilterChainBuilder filterChain,
+                                     final BufferHandler handler)
+   {
+      assert filterChain != null;
+
+      filterChain.addLast("codec", new ProtocolCodecFilter(new MinaProtocolCodecFilter(handler)));
+   }
+
+   public static void addSSLFilter(
+         final DefaultIoFilterChainBuilder filterChain, final boolean client,
+         final String keystorePath, final String keystorePassword, final String trustStorePath,
+         final String trustStorePassword) throws Exception
+   {
+      SSLContext context = SSLSupport.getInstance(client, keystorePath, keystorePassword,
+            trustStorePath, trustStorePassword);
+      SslFilter filter = new SslFilter(context);
+      if (client)
+      {
+         filter.setUseClientMode(true);
+         filter.setWantClientAuth(true);
+      }
+      filterChain.addLast("ssl", filter);
+   }
+
+   // Package protected ---------------------------------------------
+
+   // Inner classes -------------------------------------------------
+}

Copied: trunk/src/main/org/jboss/messaging/integration/transports/mina/IoBufferWrapper.java (from rev 5338, trunk/src/main/org/jboss/messaging/core/remoting/impl/mina/IoBufferWrapper.java)
===================================================================
--- trunk/src/main/org/jboss/messaging/integration/transports/mina/IoBufferWrapper.java	                        (rev 0)
+++ trunk/src/main/org/jboss/messaging/integration/transports/mina/IoBufferWrapper.java	2008-11-12 12:17:43 UTC (rev 5339)
@@ -0,0 +1,369 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005-2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.messaging.integration.transports.mina;
+
+import static org.jboss.messaging.util.DataConstants.FALSE;
+import static org.jboss.messaging.util.DataConstants.NOT_NULL;
+import static org.jboss.messaging.util.DataConstants.NULL;
+import static org.jboss.messaging.util.DataConstants.TRUE;
+
+import java.nio.charset.Charset;
+
+import org.apache.mina.core.buffer.IoBuffer;
+import org.jboss.messaging.core.remoting.spi.MessagingBuffer;
+import org.jboss.messaging.util.SimpleString;
+
+/**
+ *
+ * A BufferWrapper
+ *
+ * @author <a href="mailto:jmesnil at redhat.com">Jeff Mesnil</a>
+ * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
+ *
+ */
+public class IoBufferWrapper implements MessagingBuffer
+{
+   // Constants -----------------------------------------------------
+
+   private static final Charset utf8 = Charset.forName("UTF-8");
+
+   // Attributes ----------------------------------------------------
+
+   private final IoBuffer buffer;
+
+   // Static --------------------------------------------------------
+
+   // Constructors --------------------------------------------------
+
+   public IoBufferWrapper(final int size)
+   {
+      buffer = IoBuffer.allocate(size);
+
+      buffer.setAutoExpand(true);
+   }
+
+   public IoBufferWrapper(final IoBuffer buffer)
+   {
+      this.buffer = buffer;
+   }
+
+   // Public --------------------------------------------------------
+
+   // MessagingBuffer implementation ----------------------------------------------
+
+   public byte[] array()
+   {
+      return buffer.array();
+   }
+
+   public int position()
+   {
+      return buffer.position();
+   }
+
+   public void position(final int position)
+   {
+      buffer.position(position);
+   }
+
+   public int limit()
+   {
+      return buffer.limit();
+   }
+
+   public void limit(final int limit)
+   {
+      buffer.limit(limit);
+   }
+
+   public int capacity()
+   {
+      return buffer.capacity();
+   }
+
+   public void flip()
+   {
+      buffer.flip();
+   }
+
+   public MessagingBuffer slice()
+   {
+      return new IoBufferWrapper(buffer.slice());
+   }
+
+   public MessagingBuffer createNewBuffer(int len)
+   {
+      return new IoBufferWrapper(len);
+   }
+
+   public int remaining()
+   {
+      return buffer.remaining();
+   }
+
+   public void rewind()
+   {
+      buffer.rewind();
+   }
+
+   public void putByte(byte byteValue)
+   {
+      buffer.put(byteValue);
+   }
+
+   public void putBytes(final byte[] byteArray)
+   {
+      buffer.put(byteArray);
+   }
+
+   public void putBytes(final byte[] bytes, int offset, int length)
+   {
+      buffer.put(bytes, offset, length);
+   }
+
+   public void putInt(final int intValue)
+   {
+      buffer.putInt(intValue);
+   }
+
+   public void putInt(final int pos, final int intValue)
+   {
+      buffer.putInt(pos, intValue);
+   }
+
+   public void putLong(final long longValue)
+   {
+      buffer.putLong(longValue);
+   }
+
+   public void putFloat(final float floatValue)
+   {
+      buffer.putFloat(floatValue);
+   }
+
+   public void putDouble(final double d)
+   {
+      buffer.putDouble(d);
+   }
+
+   public void putShort(final short s)
+   {
+      buffer.putShort(s);
+   }
+
+   public void putChar(final char chr)
+   {
+      buffer.putChar(chr);
+   }
+
+   public byte getByte()
+   {
+      return buffer.get();
+   }
+
+   public short getUnsignedByte()
+   {
+      return buffer.getUnsigned();
+   }
+
+   public void getBytes(final byte[] b)
+   {
+      buffer.get(b);
+   }
+
+   public void getBytes(final byte[] b, final int offset, final int length)
+   {
+      buffer.get(b, offset, length);
+   }
+
+   public int getInt()
+   {
+      return buffer.getInt();
+   }
+
+   public long getLong()
+   {
+      return buffer.getLong();
+   }
+
+   public float getFloat()
+   {
+      return buffer.getFloat();
+   }
+
+   public short getShort()
+   {
+      return buffer.getShort();
+   }
+
+   public int getUnsignedShort()
+   {
+      return buffer.getUnsignedShort();
+   }
+
+   public double getDouble()
+   {
+      return buffer.getDouble();
+   }
+
+   public char getChar()
+   {
+      return buffer.getChar();
+   }
+
+   public void putBoolean(final boolean b)
+   {
+      if (b)
+      {
+         buffer.put(TRUE);
+      } else
+      {
+         buffer.put(FALSE);
+      }
+   }
+
+   public boolean getBoolean()
+   {
+      byte b = buffer.get();
+      return b == TRUE;
+   }
+
+   public void putString(final String nullableString)
+   {
+      buffer.putInt(nullableString.length());
+
+      for (int i = 0; i < nullableString.length(); i++)
+      {
+         buffer.putChar(nullableString.charAt(i));
+      }
+   }
+
+   public void putNullableString(final String nullableString)
+   {
+      if (nullableString == null)
+      {
+         buffer.put(NULL);
+      }
+      else
+      {
+         buffer.put(NOT_NULL);
+
+         putString(nullableString);
+      }
+   }
+
+   public String getString()
+   {
+      int len = buffer.getInt();
+
+      char[] chars = new char[len];
+
+      for (int i = 0; i < len; i++)
+      {
+         chars[i] = buffer.getChar();
+      }
+
+      return new String(chars);
+   }
+
+   public String getNullableString()
+   {
+      byte check = buffer.get();
+
+      if (check == NULL)
+      {
+         return null;
+      }
+      else
+      {
+         return getString();
+      }
+   }
+
+   public void putUTF(final String str) throws Exception
+   {
+      buffer.putPrefixedString(str, utf8.newEncoder());
+   }
+
+   public void putNullableSimpleString(final SimpleString string)
+   {
+      if (string == null)
+      {
+         buffer.put(NULL);
+      }
+      else
+      {
+         buffer.put(NOT_NULL);
+         putSimpleString(string);
+      }
+   }
+
+   public void putSimpleString(final SimpleString string)
+   {
+      byte[] data = string.getData();
+
+      buffer.putInt(data.length);
+      buffer.put(data);
+   }
+
+   public SimpleString getSimpleString()
+   {
+      int len = buffer.getInt();
+
+      byte[] data = new byte[len];
+      buffer.get(data);
+
+      return new SimpleString(data);
+   }
+
+   public SimpleString getNullableSimpleString()
+   {
+      int b = buffer.get();
+      if (b == NULL)
+      {
+         return null;
+      }
+      else
+      {
+         return getSimpleString();
+      }
+   }
+
+   public String getUTF() throws Exception
+   {
+      return buffer.getPrefixedString(utf8.newDecoder());
+   }
+
+   public Object getUnderlyingBuffer()
+   {
+      return buffer;
+   }
+
+   // Package protected ---------------------------------------------
+
+   // Protected -----------------------------------------------------
+
+   // Private -------------------------------------------------------
+
+   // Inner classes -------------------------------------------------
+}
\ No newline at end of file

Copied: trunk/src/main/org/jboss/messaging/integration/transports/mina/MessagingIOSessionDataStructureFactory.java (from rev 5338, trunk/src/main/org/jboss/messaging/core/remoting/impl/mina/MessagingIOSessionDataStructureFactory.java)
===================================================================
--- trunk/src/main/org/jboss/messaging/integration/transports/mina/MessagingIOSessionDataStructureFactory.java	                        (rev 0)
+++ trunk/src/main/org/jboss/messaging/integration/transports/mina/MessagingIOSessionDataStructureFactory.java	2008-11-12 12:17:43 UTC (rev 5339)
@@ -0,0 +1,167 @@
+/*
+ *  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.jboss.messaging.integration.transports.mina;
+
+import java.util.HashSet;
+import java.util.Queue;
+import java.util.Set;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ConcurrentLinkedQueue;
+import java.util.concurrent.ConcurrentMap;
+
+import org.apache.mina.core.session.IoSession;
+import org.apache.mina.core.session.IoSessionAttributeMap;
+import org.apache.mina.core.session.IoSessionDataStructureFactory;
+import org.apache.mina.core.write.WriteRequest;
+import org.apache.mina.core.write.WriteRequestQueue;
+
+/**
+ *
+ * A MessagingIOSessionDataStructureFactory
+ *
+ * Derived from:
+ * @author The Apache MINA Project (dev at mina.apache.org)
+ *
+ * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
+ *
+ */
+public class MessagingIOSessionDataStructureFactory implements IoSessionDataStructureFactory
+{
+
+   public IoSessionAttributeMap getAttributeMap(IoSession session)
+         throws Exception
+   {
+      return new ConcurrentIoSessionAttributeMap();
+   }
+
+   public WriteRequestQueue getWriteRequestQueue(IoSession session)
+         throws Exception
+   {
+      return new ConcurrentWriteRequestQueue();
+   }
+
+
+   private static class ConcurrentIoSessionAttributeMap implements IoSessionAttributeMap {
+
+      private final ConcurrentMap<Object, Object> attributes = new ConcurrentHashMap<Object, Object>(4);
+
+      public Object getAttribute(IoSession session, Object key, Object defaultValue) {
+          if (key == null) {
+              throw new NullPointerException("key");
+          }
+
+          Object answer = attributes.get(key);
+          if (answer == null) {
+              return defaultValue;
+          } else {
+              return answer;
+          }
+      }
+
+      public Object setAttribute(IoSession session, Object key, Object value) {
+          if (key == null) {
+              throw new NullPointerException("key");
+          }
+
+          if (value == null) {
+              return attributes.remove(key);
+          } else {
+              return attributes.put(key, value);
+          }
+      }
+
+      public Object setAttributeIfAbsent(IoSession session, Object key, Object value) {
+          if (key == null) {
+              throw new NullPointerException("key");
+          }
+
+          if (value == null) {
+              return null;
+          }
+
+          return attributes.putIfAbsent(key, value);
+      }
+
+      public Object removeAttribute(IoSession session, Object key) {
+          if (key == null) {
+              throw new NullPointerException("key");
+          }
+
+          return attributes.remove(key);
+      }
+
+      public boolean removeAttribute(IoSession session, Object key, Object value) {
+          if (key == null) {
+              throw new NullPointerException("key");
+          }
+
+          if (value == null) {
+              return false;
+          }
+
+          return attributes.remove(key, value);
+      }
+
+      public boolean replaceAttribute(IoSession session, Object key, Object oldValue, Object newValue) {
+         return attributes.replace(key, oldValue, newValue);
+      }
+
+      public boolean containsAttribute(IoSession session, Object key) {
+          return attributes.containsKey(key);
+      }
+
+      public Set<Object> getAttributeKeys(IoSession session) {
+          return new HashSet<Object>(attributes.keySet());
+      }
+
+      public void dispose(IoSession session) throws Exception {
+      }
+  }
+
+   private static class ConcurrentWriteRequestQueue implements WriteRequestQueue
+   {
+      private final Queue<WriteRequest> q = new ConcurrentLinkedQueue<WriteRequest>();
+
+      public void dispose(IoSession session) {
+      }
+
+      public void clear(IoSession session) {
+          q.clear();
+      }
+
+      public synchronized boolean isEmpty(IoSession session) {
+          return q.isEmpty();
+      }
+
+      public synchronized void offer(IoSession session, WriteRequest writeRequest) {
+          q.offer(writeRequest);
+      }
+
+      public synchronized WriteRequest poll(IoSession session) {
+          return q.poll();
+      }
+
+      @Override
+      public String toString() {
+          return q.toString();
+      }
+  }
+
+}

Copied: trunk/src/main/org/jboss/messaging/integration/transports/mina/MinaAcceptor.java (from rev 5338, trunk/src/main/org/jboss/messaging/core/remoting/impl/mina/MinaAcceptor.java)
===================================================================
--- trunk/src/main/org/jboss/messaging/integration/transports/mina/MinaAcceptor.java	                        (rev 0)
+++ trunk/src/main/org/jboss/messaging/integration/transports/mina/MinaAcceptor.java	2008-11-12 12:17:43 UTC (rev 5339)
@@ -0,0 +1,248 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005-2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.messaging.integration.transports.mina;
+
+import java.net.InetSocketAddress;
+import java.util.Map;
+
+import org.apache.mina.core.buffer.IoBuffer;
+import org.apache.mina.core.filterchain.DefaultIoFilterChainBuilder;
+import org.apache.mina.core.service.IoHandlerAdapter;
+import org.apache.mina.core.service.IoService;
+import org.apache.mina.core.service.IoServiceListener;
+import org.apache.mina.core.session.IdleStatus;
+import org.apache.mina.core.session.IoSession;
+import org.apache.mina.transport.socket.SocketAcceptor;
+import org.apache.mina.transport.socket.nio.NioSocketAcceptor;
+import org.jboss.messaging.core.exception.MessagingException;
+import org.jboss.messaging.core.logging.Logger;
+import org.jboss.messaging.core.remoting.spi.Acceptor;
+import org.jboss.messaging.core.remoting.spi.BufferHandler;
+import org.jboss.messaging.core.remoting.spi.Connection;
+import org.jboss.messaging.core.remoting.spi.ConnectionLifeCycleListener;
+import org.jboss.messaging.util.ConfigurationHelper;
+
+
+/**
+ * A Mina TCP Acceptor that supports SSL
+ *
+ * @author <a href="ataylor at redhat.com">Andy Taylor</a>
+ * @author <a href="tim.fox at jboss.com">Tim Fox</a>
+ */
+public class MinaAcceptor implements Acceptor
+{
+   public static final Logger log = Logger.getLogger(MinaAcceptor.class);
+   
+   
+   // Attributes ------------------------------------------------------------------------------------
+
+   private SocketAcceptor acceptor;
+
+   private IoServiceListener acceptorListener;
+
+   private final BufferHandler handler;
+
+   private final ConnectionLifeCycleListener listener;
+   
+   private final boolean sslEnabled;
+   
+   private final String host;
+
+   private final int port;
+         
+   private final String keyStorePath;
+ 
+   private final String keyStorePassword;
+   
+   private final String trustStorePath;
+   
+   private final String trustStorePassword;
+   
+   private final boolean tcpNoDelay;
+   
+   private final int tcpSendBufferSize;
+   
+   private final int tcpReceiveBufferSize;
+
+   public MinaAcceptor(final Map<String, Object> configuration, final BufferHandler handler,
+                       final ConnectionLifeCycleListener listener)
+   {
+      this.handler = handler;
+
+      this.listener = listener;
+      
+      this.sslEnabled =
+         ConfigurationHelper.getBooleanProperty(TransportConstants.SSL_ENABLED_PROP_NAME, TransportConstants.DEFAULT_SSL_ENABLED, configuration);
+      this.host =
+         ConfigurationHelper.getStringProperty(TransportConstants.HOST_PROP_NAME, TransportConstants.DEFAULT_HOST, configuration);
+      this.port =
+         ConfigurationHelper.getIntProperty(TransportConstants.PORT_PROP_NAME, TransportConstants.DEFAULT_PORT, configuration);
+      if (sslEnabled)
+      {
+         this.keyStorePath =
+            ConfigurationHelper.getStringProperty(TransportConstants.KEYSTORE_PATH_PROP_NAME, TransportConstants.DEFAULT_KEYSTORE_PATH, configuration);
+         this.keyStorePassword =
+            ConfigurationHelper.getStringProperty(TransportConstants.KEYSTORE_PASSWORD_PROP_NAME, TransportConstants.DEFAULT_KEYSTORE_PASSWORD, configuration);
+         this.trustStorePath =
+            ConfigurationHelper.getStringProperty(TransportConstants.TRUSTSTORE_PATH_PROP_NAME, TransportConstants.DEFAULT_TRUSTSTORE_PATH, configuration);
+         this.trustStorePassword =
+            ConfigurationHelper.getStringProperty(TransportConstants.TRUSTSTORE_PASSWORD_PROP_NAME, TransportConstants.DEFAULT_TRUSTSTORE_PASSWORD, configuration);
+      }   
+      else
+      {
+         this.keyStorePath = null;
+         this.keyStorePassword = null;
+         this.trustStorePath = null;
+         this.trustStorePassword = null; 
+      }
+      
+      this.tcpNoDelay =
+         ConfigurationHelper.getBooleanProperty(TransportConstants.TCP_NODELAY_PROPNAME, TransportConstants.DEFAULT_TCP_NODELAY, configuration);
+      this.tcpSendBufferSize =
+         ConfigurationHelper.getIntProperty(TransportConstants.TCP_SENDBUFFER_SIZE_PROPNAME, TransportConstants.DEFAULT_TCP_SENDBUFFER_SIZE, configuration);
+      this.tcpReceiveBufferSize =
+         ConfigurationHelper.getIntProperty(TransportConstants.TCP_RECEIVEBUFFER_SIZE_PROPNAME, TransportConstants.DEFAULT_TCP_RECEIVEBUFFER_SIZE, configuration);
+     
+   }
+
+   public synchronized void start() throws Exception
+   {
+      if (acceptor != null)
+      {
+         //Already started
+         return;
+      }
+
+      acceptor = new NioSocketAcceptor();
+
+      acceptor.setSessionDataStructureFactory(new MessagingIOSessionDataStructureFactory());
+
+      DefaultIoFilterChainBuilder filterChain = acceptor.getFilterChain();
+
+      if (sslEnabled)
+      {
+         FilterChainSupport.addSSLFilter(filterChain, false, keyStorePath,
+                 keyStorePassword,
+                 trustStorePath,
+                 trustStorePassword);
+      }
+      FilterChainSupport.addCodecFilter(filterChain, handler);
+
+      // Bind
+      acceptor.setDefaultLocalAddress(new InetSocketAddress(host, port));      
+      acceptor.getSessionConfig().setTcpNoDelay(tcpNoDelay);      
+      if (tcpReceiveBufferSize != -1)
+      {
+         acceptor.getSessionConfig().setReceiveBufferSize(tcpReceiveBufferSize);
+      }     
+      if (tcpSendBufferSize != -1)
+      {
+         acceptor.getSessionConfig().setSendBufferSize(tcpSendBufferSize);
+      }
+      acceptor.setReuseAddress(true);
+      acceptor.getSessionConfig().setReuseAddress(true);
+      acceptor.getSessionConfig().setKeepAlive(true);
+      acceptor.setCloseOnDeactivation(false);
+
+      acceptor.setHandler(new MinaHandler());
+      acceptor.bind();
+      acceptorListener = new MinaSessionListener();
+      acceptor.addListener(acceptorListener);
+   }
+
+   public synchronized void stop()
+   {
+      if (acceptor == null)
+      {
+         return;
+      }
+
+      // remove the listener before disposing the acceptor
+      // so that we're not notified when the sessions are destroyed
+      acceptor.removeListener(acceptorListener);
+      acceptor.unbind();
+      acceptor.dispose();
+      acceptor = null;
+   }
+
+   public DefaultIoFilterChainBuilder getFilterChain()
+   {
+      return acceptor.getFilterChain();
+   }
+
+   // Inner classes -----------------------------------------------------------------------------
+
+   private final class MinaHandler extends IoHandlerAdapter
+   {
+      @Override
+      public void exceptionCaught(final IoSession session, final Throwable cause)
+              throws Exception
+      {
+         log.error("caught exception " + cause + " for session " + session, cause);
+
+         MessagingException me = new MessagingException(MessagingException.INTERNAL_ERROR, "MINA exception");
+
+         me.initCause(cause);
+
+         listener.connectionException(session.getId(), me);
+      }
+
+      @Override
+      public void messageReceived(final IoSession session, final Object message)
+              throws Exception
+      {
+         IoBuffer buffer = (IoBuffer) message;
+
+         handler.bufferReceived(session.getId(), new IoBufferWrapper(buffer));
+      }
+   }
+
+   private final class MinaSessionListener implements IoServiceListener
+   {
+
+      public void serviceActivated(final IoService service)
+      {
+      }
+
+      public void serviceDeactivated(final IoService service)
+      {
+      }
+
+      public void serviceIdle(final IoService service, final IdleStatus idleStatus)
+      {
+      }
+
+      public void sessionCreated(final IoSession session)
+      {
+         Connection tc = new MinaConnection(session);
+
+         listener.connectionCreated(tc);
+      }
+
+      public void sessionDestroyed(final IoSession session)
+      {
+         listener.connectionDestroyed(session.getId());
+      }
+   }
+
+}

Copied: trunk/src/main/org/jboss/messaging/integration/transports/mina/MinaAcceptorFactory.java (from rev 5338, trunk/src/main/org/jboss/messaging/core/remoting/impl/mina/MinaAcceptorFactory.java)
===================================================================
--- trunk/src/main/org/jboss/messaging/integration/transports/mina/MinaAcceptorFactory.java	                        (rev 0)
+++ trunk/src/main/org/jboss/messaging/integration/transports/mina/MinaAcceptorFactory.java	2008-11-12 12:17:43 UTC (rev 5339)
@@ -0,0 +1,47 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005-2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.messaging.integration.transports.mina;
+
+import java.util.Map;
+
+import org.jboss.messaging.core.remoting.spi.Acceptor;
+import org.jboss.messaging.core.remoting.spi.AcceptorFactory;
+import org.jboss.messaging.core.remoting.spi.BufferHandler;
+import org.jboss.messaging.core.remoting.spi.ConnectionLifeCycleListener;
+
+/**
+ * 
+ * A MinaAcceptorFactory
+ * 
+ * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
+ *
+ */
+public class MinaAcceptorFactory implements AcceptorFactory
+{
+   public Acceptor createAcceptor(final Map<String, Object> configuration,
+                                  final BufferHandler handler,                                 
+                                  final ConnectionLifeCycleListener listener)
+   {
+      return new MinaAcceptor(configuration, handler, listener);   
+   }
+}

Copied: trunk/src/main/org/jboss/messaging/integration/transports/mina/MinaConnection.java (from rev 5338, trunk/src/main/org/jboss/messaging/core/remoting/impl/mina/MinaConnection.java)
===================================================================
--- trunk/src/main/org/jboss/messaging/integration/transports/mina/MinaConnection.java	                        (rev 0)
+++ trunk/src/main/org/jboss/messaging/integration/transports/mina/MinaConnection.java	2008-11-12 12:17:43 UTC (rev 5339)
@@ -0,0 +1,134 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005-2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.messaging.integration.transports.mina;
+
+import org.apache.mina.core.buffer.IoBuffer;
+import org.apache.mina.core.future.IoFutureListener;
+import org.apache.mina.core.service.IoConnector;
+import org.apache.mina.core.session.IoSession;
+import org.apache.mina.filter.ssl.SslFilter;
+import org.jboss.messaging.core.logging.Logger;
+import org.jboss.messaging.core.remoting.spi.Connection;
+import org.jboss.messaging.core.remoting.spi.MessagingBuffer;
+
+/**
+ * @author <a href="mailto:jmesnil at redhat.com">Jeff Mesnil</a>
+ * @author <a href="mailto:ataylor at redhat.com">Andy Taylor</a>
+ * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
+ * buhnaflagilibrn
+ * @version <tt>$Revision$</tt>
+ */
+public class MinaConnection implements Connection
+{
+   // Constants -----------------------------------------------------
+
+   private static final Logger log = Logger.getLogger(MinaConnection.class);
+
+   // Attributes ----------------------------------------------------
+
+   private final IoSession session;
+
+   private boolean closed;
+
+   // Static --------------------------------------------------------
+
+   // Constructors --------------------------------------------------
+
+   public MinaConnection(final IoSession session)
+   {
+      this.session = session;
+   }
+
+   // Public --------------------------------------------------------
+
+   // Connection implementation ----------------------------
+
+   public synchronized void close()
+   {
+      if (closed)
+      {
+         return;
+      }
+
+      SslFilter sslFilter = (SslFilter) session.getFilterChain().get("ssl");
+
+      if (session.getService() instanceof IoConnector) {
+         if (sslFilter != null)
+         {
+            try
+            {
+               sslFilter.stopSsl(session).awaitUninterruptibly();
+            }
+            catch (Throwable t)
+            {
+               // ignore
+            }
+         }
+         session.close().awaitUninterruptibly();
+      } else {
+         if (sslFilter != null)
+         {
+            try
+            {
+               sslFilter.stopSsl(session).addListener(IoFutureListener.CLOSE);
+            }
+            catch (Throwable t)
+            {
+               // ignore
+            }
+         } else {
+            session.close();
+         }
+      }
+
+      closed = true;
+   }
+
+   public MessagingBuffer createBuffer(int size)
+   {
+      IoBuffer buffer = IoBuffer.allocate(size);
+      buffer.setAutoExpand(true);
+      return new IoBufferWrapper(buffer);
+   }
+
+   public Object getID()
+   {
+      return Long.valueOf(session.getId());
+   }
+
+   public void write(final MessagingBuffer buffer)
+   {
+      session.write(buffer.getUnderlyingBuffer());
+   }
+
+   // Public --------------------------------------------------------
+
+   // Package protected ---------------------------------------------
+
+   // Protected -----------------------------------------------------
+
+   // Private -------------------------------------------------------
+
+   // Inner classes -------------------------------------------------
+
+}

Copied: trunk/src/main/org/jboss/messaging/integration/transports/mina/MinaConnector.java (from rev 5338, trunk/src/main/org/jboss/messaging/core/remoting/impl/mina/MinaConnector.java)
===================================================================
--- trunk/src/main/org/jboss/messaging/integration/transports/mina/MinaConnector.java	                        (rev 0)
+++ trunk/src/main/org/jboss/messaging/integration/transports/mina/MinaConnector.java	2008-11-12 12:17:43 UTC (rev 5339)
@@ -0,0 +1,272 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005-2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.messaging.integration.transports.mina;
+
+import java.net.InetSocketAddress;
+import java.util.Map;
+
+import org.apache.mina.core.buffer.IoBuffer;
+import org.apache.mina.core.filterchain.DefaultIoFilterChainBuilder;
+import org.apache.mina.core.future.ConnectFuture;
+import org.apache.mina.core.service.IoHandlerAdapter;
+import org.apache.mina.core.service.IoService;
+import org.apache.mina.core.service.IoServiceListener;
+import org.apache.mina.core.session.IdleStatus;
+import org.apache.mina.core.session.IoSession;
+import org.apache.mina.transport.socket.SocketConnector;
+import org.apache.mina.transport.socket.SocketSessionConfig;
+import org.apache.mina.transport.socket.nio.NioSocketConnector;
+import org.jboss.messaging.core.exception.MessagingException;
+import org.jboss.messaging.core.logging.Logger;
+import org.jboss.messaging.core.remoting.spi.BufferHandler;
+import org.jboss.messaging.core.remoting.spi.Connection;
+import org.jboss.messaging.core.remoting.spi.ConnectionLifeCycleListener;
+import org.jboss.messaging.core.remoting.spi.Connector;
+import org.jboss.messaging.util.ConfigurationHelper;
+/**
+ *
+ * A MinaConnector
+ *
+ * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
+ *
+ */
+public class MinaConnector implements Connector
+{
+   // Constants -----------------------------------------------------
+
+   private static final Logger log = Logger.getLogger(MinaConnector.class);
+
+   // Attributes ----------------------------------------------------
+
+   private SocketConnector connector;
+
+   private final BufferHandler handler;
+
+   private final ConnectionLifeCycleListener listener;
+   
+   private final boolean sslEnabled;
+   
+   private final String host;
+
+   private final int port;
+         
+   private final String keyStorePath;
+ 
+   private final String keyStorePassword;
+   
+   private final boolean tcpNoDelay;
+   
+   private final int tcpSendBufferSize;
+   
+   private final int tcpReceiveBufferSize;
+
+   // Static --------------------------------------------------------
+
+   // Constructors --------------------------------------------------
+
+   // Public --------------------------------------------------------
+
+   public MinaConnector(final Map<String, Object> configuration,                 
+                        final BufferHandler handler,
+                        final ConnectionLifeCycleListener listener)
+   {
+      if (listener == null)
+      {
+         throw new IllegalArgumentException("Invalid argument null listener");
+      }
+      
+      if (handler == null)
+      {
+         throw new IllegalArgumentException("Invalid argument null handler");
+      }
+
+      this.listener = listener;
+      
+      this.handler = handler;
+      
+      this.sslEnabled =
+         ConfigurationHelper.getBooleanProperty(TransportConstants.SSL_ENABLED_PROP_NAME, TransportConstants.DEFAULT_SSL_ENABLED, configuration);
+      this.host =
+         ConfigurationHelper.getStringProperty(TransportConstants.HOST_PROP_NAME, TransportConstants.DEFAULT_HOST, configuration);
+      this.port =
+         ConfigurationHelper.getIntProperty(TransportConstants.PORT_PROP_NAME, TransportConstants.DEFAULT_PORT, configuration);
+      if (sslEnabled)
+      {
+         this.keyStorePath =
+            ConfigurationHelper.getStringProperty(TransportConstants.KEYSTORE_PATH_PROP_NAME, TransportConstants.DEFAULT_KEYSTORE_PATH, configuration);
+         this.keyStorePassword =
+            ConfigurationHelper.getStringProperty(TransportConstants.KEYSTORE_PASSWORD_PROP_NAME, TransportConstants.DEFAULT_KEYSTORE_PASSWORD, configuration);
+      }   
+      else
+      {
+         this.keyStorePath = null;
+         this.keyStorePassword = null;
+      }
+      
+      this.tcpNoDelay =
+         ConfigurationHelper.getBooleanProperty(TransportConstants.TCP_NODELAY_PROPNAME, TransportConstants.DEFAULT_TCP_NODELAY, configuration);
+      this.tcpSendBufferSize =
+         ConfigurationHelper.getIntProperty(TransportConstants.TCP_SENDBUFFER_SIZE_PROPNAME, TransportConstants.DEFAULT_TCP_SENDBUFFER_SIZE, configuration);
+      this.tcpReceiveBufferSize =
+         ConfigurationHelper.getIntProperty(TransportConstants.TCP_RECEIVEBUFFER_SIZE_PROPNAME, TransportConstants.DEFAULT_TCP_RECEIVEBUFFER_SIZE, configuration);
+
+   }
+
+   public synchronized void start()
+   {
+      if (connector != null)
+      {
+         return;
+      }
+
+      connector = new NioSocketConnector();
+
+      SocketSessionConfig connectorConfig = connector.getSessionConfig();
+
+      DefaultIoFilterChainBuilder filterChain = connector.getFilterChain();
+
+      connector.setSessionDataStructureFactory(new MessagingIOSessionDataStructureFactory());
+
+      connectorConfig.setTcpNoDelay(tcpNoDelay);
+      if (tcpReceiveBufferSize != -1)
+      {
+         connectorConfig.setReceiveBufferSize(tcpReceiveBufferSize);
+      }
+      if (tcpSendBufferSize != -1)
+      {
+         connectorConfig.setSendBufferSize(tcpSendBufferSize);
+      }
+      connectorConfig.setKeepAlive(true);
+      connectorConfig.setReuseAddress(true);
+
+      if (this.sslEnabled)
+      {
+         try
+         {
+            FilterChainSupport.addSSLFilter(filterChain, true, keyStorePath, keyStorePassword, null, null);
+         }
+         catch (Exception e)
+         {
+            IllegalStateException ise = new IllegalStateException("Unable to create MinaConnection for " + host);
+            ise.initCause(e);
+            throw ise;
+         }
+      }
+      FilterChainSupport.addCodecFilter(filterChain, handler);
+
+      connector.setHandler(new MinaHandler());
+
+      connector.addListener(new ServiceListener());
+   }
+   
+   public synchronized void close()
+   {
+      if (connector != null)
+      {
+         connector.dispose();
+      }
+   }
+
+   public Connection createConnection()
+   {
+      InetSocketAddress address = new InetSocketAddress(host, port);
+      ConnectFuture future = connector.connect(address);
+      connector.setDefaultRemoteAddress(address);
+
+      future.awaitUninterruptibly();
+
+      if (future.isConnected())
+      {
+         IoSession session = future.getSession();
+
+         return new MinaConnection(session);
+      }
+      else
+      {
+         return null;
+      }
+   }
+
+   // Public --------------------------------------------------------
+
+   // Package protected ---------------------------------------------
+
+   // Protected -----------------------------------------------------
+
+   // Private -------------------------------------------------------
+
+   // Inner classes -------------------------------------------------
+
+   private final class ServiceListener implements IoServiceListener
+   {
+      private ServiceListener()
+      {
+      }
+
+      public void serviceActivated(IoService service)
+      {
+      }
+
+      public void serviceDeactivated(IoService service)
+      {
+      }
+
+      public void serviceIdle(IoService service, IdleStatus idleStatus)
+      {
+      }
+
+      public void sessionCreated(IoSession session)
+      {
+      }
+
+      public void sessionDestroyed(IoSession session)
+      {
+         listener.connectionDestroyed(session.getId());
+      }
+   }
+
+   private final class MinaHandler extends IoHandlerAdapter
+   {
+      @Override
+      public void exceptionCaught(final IoSession session, final Throwable cause)
+              throws Exception
+      {
+         log.error("caught exception " + cause + " for session " + session, cause);
+
+         MessagingException me = new MessagingException(MessagingException.INTERNAL_ERROR, "MINA exception");
+
+         me.initCause(cause);
+
+         listener.connectionException(session.getId(), me);
+      }
+
+      @Override
+      public void messageReceived(final IoSession session, final Object message)
+              throws Exception
+      {
+         IoBuffer buffer = (IoBuffer) message;
+
+         handler.bufferReceived(session.getId(), new IoBufferWrapper(buffer));
+      }
+   }
+
+}

Copied: trunk/src/main/org/jboss/messaging/integration/transports/mina/MinaConnectorFactory.java (from rev 5338, trunk/src/main/org/jboss/messaging/core/remoting/impl/mina/MinaConnectorFactory.java)
===================================================================
--- trunk/src/main/org/jboss/messaging/integration/transports/mina/MinaConnectorFactory.java	                        (rev 0)
+++ trunk/src/main/org/jboss/messaging/integration/transports/mina/MinaConnectorFactory.java	2008-11-12 12:17:43 UTC (rev 5339)
@@ -0,0 +1,26 @@
+package org.jboss.messaging.integration.transports.mina;
+
+import java.util.Map;
+
+import org.jboss.messaging.core.remoting.spi.BufferHandler;
+import org.jboss.messaging.core.remoting.spi.ConnectionLifeCycleListener;
+import org.jboss.messaging.core.remoting.spi.Connector;
+import org.jboss.messaging.core.remoting.spi.ConnectorFactory;
+
+/**
+ * 
+ * A MinaConnectorFactory
+ * 
+ * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
+ *
+ */
+public class MinaConnectorFactory implements ConnectorFactory
+{
+   public Connector createConnector(final Map<String, Object> configuration,
+                                    final BufferHandler handler,
+                                    final ConnectionLifeCycleListener listener)
+   {
+      return new MinaConnector(configuration, handler, listener);
+   }
+
+}

Copied: trunk/src/main/org/jboss/messaging/integration/transports/mina/MinaProtocolCodecFilter.java (from rev 5338, trunk/src/main/org/jboss/messaging/core/remoting/impl/mina/MinaProtocolCodecFilter.java)
===================================================================
--- trunk/src/main/org/jboss/messaging/integration/transports/mina/MinaProtocolCodecFilter.java	                        (rev 0)
+++ trunk/src/main/org/jboss/messaging/integration/transports/mina/MinaProtocolCodecFilter.java	2008-11-12 12:17:43 UTC (rev 5339)
@@ -0,0 +1,113 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005-2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.messaging.integration.transports.mina;
+
+import static org.jboss.messaging.util.DataConstants.SIZE_INT;
+
+import org.apache.mina.core.buffer.IoBuffer;
+import org.apache.mina.core.session.IoSession;
+import org.apache.mina.filter.codec.CumulativeProtocolDecoder;
+import org.apache.mina.filter.codec.ProtocolCodecFactory;
+import org.apache.mina.filter.codec.ProtocolDecoder;
+import org.apache.mina.filter.codec.ProtocolDecoderOutput;
+import org.apache.mina.filter.codec.ProtocolEncoder;
+import org.apache.mina.filter.codec.ProtocolEncoderOutput;
+import org.jboss.messaging.core.logging.Logger;
+import org.jboss.messaging.core.remoting.spi.BufferHandler;
+
+/**
+ * A Mina ProtocolEncoder used to encode/decode messages.
+ *
+ * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
+ * @author <a href="ataylor at redhat.com">Andy Taylor</a>
+ */
+public class MinaProtocolCodecFilter extends CumulativeProtocolDecoder
+        implements ProtocolEncoder, ProtocolCodecFactory
+{
+   private static final Logger log = Logger.getLogger(MinaProtocolCodecFilter.class);
+
+   private final BufferHandler handler;
+
+   public MinaProtocolCodecFilter(final BufferHandler handler)
+   {
+      this.handler = handler;
+   }
+
+   // ProtocolCodecFactory implementation
+   // -----------------------------------------------------------------------------------
+
+   public ProtocolDecoder getDecoder(final IoSession session)
+   {
+      return this;
+   }
+
+   public ProtocolEncoder getEncoder(final IoSession session)
+   {
+      return this;
+   }
+
+   // ProtocolEncoder implementation ------------------------------------------
+
+   @Override
+   public void dispose(final IoSession session) throws Exception
+   {
+   }
+
+   public void encode(final IoSession session, final Object message,
+                      final ProtocolEncoderOutput out) throws Exception
+   {
+      out.write(message);
+   }
+
+   // CumulativeProtocolDecoder overrides
+   // -------------------------------------------------------------------------------------
+
+   @Override
+   public boolean doDecode(final IoSession session, final IoBuffer in, final ProtocolDecoderOutput out) throws Exception
+   {
+      //TODO - we can avoid this entirely if we maintain fragmented packets in the handler
+
+      int start = in.position();
+
+      int length = handler.isReadyToHandle(new IoBufferWrapper(in));
+
+      if (length == -1)
+      {
+         in.position(start);
+         
+         return false;
+      }
+
+      IoBuffer sliced = in.slice();
+      
+      in.position(start + length + SIZE_INT);
+
+      out.write(sliced);
+
+      return true;
+   }
+}
+
+
+
+

Copied: trunk/src/main/org/jboss/messaging/integration/transports/mina/TransportConstants.java (from rev 5338, trunk/src/main/org/jboss/messaging/core/remoting/impl/mina/TransportConstants.java)
===================================================================
--- trunk/src/main/org/jboss/messaging/integration/transports/mina/TransportConstants.java	                        (rev 0)
+++ trunk/src/main/org/jboss/messaging/integration/transports/mina/TransportConstants.java	2008-11-12 12:17:43 UTC (rev 5339)
@@ -0,0 +1,71 @@
+/*
+  * JBoss, Home of Professional Open Source
+  * Copyright 2005, JBoss Inc., and individual contributors as indicated
+  * by the @authors tag. See the copyright.txt in the distribution for a
+  * full listing of individual contributors.
+  *
+  * This is free software; you can redistribute it and/or modify it
+  * under the terms of the GNU Lesser General Public License as
+  * published by the Free Software Foundation; either version 2.1 of
+  * the License, or (at your option) any later version.
+  *
+  * This software is distributed in the hope that it will be useful,
+  * but WITHOUT ANY WARRANTY; without even the implied warranty of
+  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+  * Lesser General Public License for more details.
+  *
+  * You should have received a copy of the GNU Lesser General Public
+  * License along with this software; if not, write to the Free
+  * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+  * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+  */
+package org.jboss.messaging.integration.transports.mina;
+
+/**
+ * A TransportConstants
+ * 
+ * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
+ *
+ */
+public class TransportConstants
+{
+   public static final String SSL_ENABLED_PROP_NAME = "jbm.remoting.mina.sslenabled";
+   
+   public static final String HOST_PROP_NAME = "jbm.remoting.mina.host";
+   
+   public static final String PORT_PROP_NAME = "jbm.remoting.mina.port";
+   
+   public static final String KEYSTORE_PATH_PROP_NAME = "jbm.remoting.mina.keystorepath";
+   
+   public static final String KEYSTORE_PASSWORD_PROP_NAME = "jbm.remoting.mina.keystorepassword";
+   
+   public static final String TRUSTSTORE_PATH_PROP_NAME = "jbm.remoting.mina.truststorepath";
+   
+   public static final String TRUSTSTORE_PASSWORD_PROP_NAME = "jbm.remoting.mina.truststorepassword";
+   
+   public static final String TCP_NODELAY_PROPNAME = "jbm.remoting.mina.tcpnodelay";
+   
+   public static final String TCP_SENDBUFFER_SIZE_PROPNAME = "jbm.remoting.mina.tcpsendbuffersize";
+   
+   public static final String TCP_RECEIVEBUFFER_SIZE_PROPNAME = "jbm.remoting.mina.tcpreceivebuffersize";
+   
+   public static final boolean DEFAULT_SSL_ENABLED = false;
+   
+   public static final String DEFAULT_HOST = "localhost";
+   
+   public static final int DEFAULT_PORT = 5400;
+   
+   public static final String DEFAULT_KEYSTORE_PATH = "messaging.keystore";
+ 
+   public static final String DEFAULT_KEYSTORE_PASSWORD = "secureexample";    
+ 
+   public static final String DEFAULT_TRUSTSTORE_PATH = "messaging.truststore";
+ 
+   public static final String DEFAULT_TRUSTSTORE_PASSWORD = "secureexample";
+   
+   public static final boolean DEFAULT_TCP_NODELAY = true;
+   
+   public static final int DEFAULT_TCP_SENDBUFFER_SIZE = 32768;
+   
+   public static final int DEFAULT_TCP_RECEIVEBUFFER_SIZE = 32768;  
+}

Copied: trunk/src/main/org/jboss/messaging/integration/transports/netty/ChannelBufferWrapper.java (from rev 5338, trunk/src/main/org/jboss/messaging/core/remoting/impl/netty/ChannelBufferWrapper.java)
===================================================================
--- trunk/src/main/org/jboss/messaging/integration/transports/netty/ChannelBufferWrapper.java	                        (rev 0)
+++ trunk/src/main/org/jboss/messaging/integration/transports/netty/ChannelBufferWrapper.java	2008-11-12 12:17:43 UTC (rev 5339)
@@ -0,0 +1,440 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005-2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.messaging.integration.transports.netty;
+
+import static org.jboss.messaging.util.DataConstants.FALSE;
+import static org.jboss.messaging.util.DataConstants.NOT_NULL;
+import static org.jboss.messaging.util.DataConstants.NULL;
+import static org.jboss.messaging.util.DataConstants.TRUE;
+import static org.jboss.netty.buffer.ChannelBuffers.copiedBuffer;
+import static org.jboss.netty.buffer.ChannelBuffers.dynamicBuffer;
+
+import java.nio.BufferUnderflowException;
+
+import org.jboss.messaging.core.remoting.spi.MessagingBuffer;
+import org.jboss.messaging.util.SimpleString;
+import org.jboss.netty.buffer.ChannelBuffer;
+
+/**
+ * Wraps Netty {@link ChannelBuffer} with {@link MessagingBuffer}.
+ * Because there's neither {@code position()} nor {@code limit()} in a Netty
+ * buffer.  {@link ChannelBuffer#readerIndex()} and {@link ChannelBuffer#writerIndex()}
+ * are used as {@code position} and {@code limit} of the buffer respectively
+ * instead.
+ *
+ * @author <a href="mailto:tlee at redhat.com">Trustin Lee</a>
+ * @author <a href="mailto:jmesnil at redhat.com">Jeff Mesnil</a>
+ * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
+ *
+ * @version $Rev$, $Date$
+ */
+public class ChannelBufferWrapper implements MessagingBuffer
+{
+   // Constants -----------------------------------------------------
+
+   // Attributes ----------------------------------------------------
+
+   private final ChannelBuffer buffer;
+
+   // Static --------------------------------------------------------
+
+   // Constructors --------------------------------------------------
+
+   public ChannelBufferWrapper(final int size)
+   {
+      buffer = dynamicBuffer(size);
+      buffer.writerIndex(buffer.capacity());
+   }
+
+   public ChannelBufferWrapper(final ChannelBuffer buffer)
+   {
+      this.buffer = buffer;
+   }
+
+   // Public --------------------------------------------------------
+
+   // MessagingBuffer implementation ----------------------------------------------
+
+   public byte[] array()
+   {
+      return buffer.toByteBuffer().array();
+   }
+
+   public int position()
+   {
+      return buffer.readerIndex();
+   }
+
+   public void position(final int position)
+   {
+      buffer.readerIndex(position);
+   }
+
+   public int limit()
+   {
+      return buffer.writerIndex();
+   }
+
+   public void limit(final int limit)
+   {
+      buffer.writerIndex(limit);
+   }
+
+   public int capacity()
+   {
+      return buffer.capacity();
+   }
+
+   public void flip()
+   {
+      int oldPosition = position();
+      position(0);
+      limit(oldPosition);
+   }
+
+   public MessagingBuffer slice()
+   {
+      return new ChannelBufferWrapper(buffer.slice());
+   }
+
+   public MessagingBuffer createNewBuffer(int len)
+   {
+      return new ChannelBufferWrapper(len);
+   }
+
+   public int remaining()
+   {
+      return buffer.readableBytes();
+   }
+
+   public void rewind()
+   {
+      position(0);
+      buffer.markReaderIndex();
+   }
+
+   public void putByte(byte byteValue)
+   {
+      flip();
+      buffer.writeByte(byteValue);
+      buffer.readerIndex(buffer.writerIndex());
+   }
+
+   public void putBytes(final byte[] byteArray)
+   {
+      flip();
+      buffer.writeBytes(byteArray);
+      buffer.readerIndex(buffer.writerIndex());
+   }
+
+   public void putBytes(final byte[] bytes, int offset, int length)
+   {
+      flip();
+      buffer.writeBytes(bytes, offset, length);
+      buffer.readerIndex(buffer.writerIndex());
+   }
+
+   public void putInt(final int intValue)
+   {
+      flip();
+      buffer.writeInt(intValue);
+      buffer.readerIndex(buffer.writerIndex());
+   }
+
+   public void putInt(final int pos, final int intValue)
+   {
+      buffer.setInt(pos, intValue);
+   }
+
+   public void putLong(final long longValue)
+   {
+      flip();
+      buffer.writeLong(longValue);
+      buffer.readerIndex(buffer.writerIndex());
+   }
+
+   public void putFloat(final float floatValue)
+   {
+      putInt(Float.floatToIntBits(floatValue));
+   }
+
+   public void putDouble(final double d)
+   {
+      putLong(Double.doubleToLongBits(d));
+   }
+
+   public void putShort(final short s)
+   {
+      flip();
+      buffer.writeShort(s);
+      buffer.readerIndex(buffer.writerIndex());
+   }
+
+   public void putChar(final char chr)
+   {
+      putShort((short) chr);
+   }
+
+   public byte getByte()
+   {
+      try {
+         return buffer.readByte();
+      } catch (IndexOutOfBoundsException e) {
+         throw new BufferUnderflowException();
+      }
+   }
+
+   public short getUnsignedByte()
+   {
+      try {
+         return buffer.readUnsignedByte();
+      } catch (IndexOutOfBoundsException e) {
+         throw new BufferUnderflowException();
+      }
+   }
+
+   public void getBytes(final byte[] b)
+   {
+      try {
+         buffer.readBytes(b);
+      } catch (IndexOutOfBoundsException e) {
+         throw new BufferUnderflowException();
+      }
+   }
+
+   public void getBytes(final byte[] b, final int offset, final int length)
+   {
+      try {
+         buffer.readBytes(b, offset, length);
+      } catch (IndexOutOfBoundsException e) {
+         throw new BufferUnderflowException();
+      }
+   }
+
+   public int getInt()
+   {
+      try {
+         return buffer.readInt();
+      } catch (IndexOutOfBoundsException e) {
+         throw new BufferUnderflowException();
+      }
+   }
+
+   public long getLong()
+   {
+      try {
+         return buffer.readLong();
+      } catch (IndexOutOfBoundsException e) {
+         throw new BufferUnderflowException();
+      }
+   }
+
+   public float getFloat()
+   {
+      return Float.intBitsToFloat(getInt());
+   }
+
+   public short getShort()
+   {
+      try {
+         return buffer.readShort();
+      } catch (IndexOutOfBoundsException e) {
+         throw new BufferUnderflowException();
+      }
+   }
+
+   public int getUnsignedShort()
+   {
+      try {
+         return buffer.readUnsignedShort();
+      } catch (IndexOutOfBoundsException e) {
+         throw new BufferUnderflowException();
+      }
+   }
+
+   public double getDouble()
+   {
+      return Double.longBitsToDouble(getLong());
+   }
+
+   public char getChar()
+   {
+      return (char) getShort();
+   }
+
+   public void putBoolean(final boolean b)
+   {
+      if (b)
+      {
+         putByte(TRUE);
+      } else
+      {
+         putByte(FALSE);
+      }
+   }
+
+   public boolean getBoolean()
+   {
+      byte b = getByte();
+      return b == TRUE;
+   }
+
+   public void putString(final String nullableString)
+   {
+      flip();
+      buffer.writeInt(nullableString.length());
+      for (int i = 0; i < nullableString.length(); i++)
+      {
+         buffer.writeShort((short) nullableString.charAt(i));
+      }
+      buffer.readerIndex(buffer.writerIndex());
+   }
+
+   public void putNullableString(final String nullableString)
+   {
+      if (nullableString == null)
+      {
+         putByte(NULL);
+      }
+      else
+      {
+         putByte(NOT_NULL);
+         putString(nullableString);
+      }
+   }
+
+   public String getString()
+   {
+      int len = getInt();
+
+      char[] chars = new char[len];
+
+      for (int i = 0; i < len; i++)
+      {
+         chars[i] = getChar();
+      }
+
+      return new String(chars);
+   }
+
+   public String getNullableString()
+   {
+      byte check = getByte();
+
+      if (check == NULL)
+      {
+         return null;
+      }
+      else
+      {
+         return getString();
+      }
+   }
+
+   public void putUTF(final String str) throws Exception
+   {
+      ChannelBuffer encoded = copiedBuffer(str, "UTF-8");
+      int length = encoded.readableBytes();
+      if (length >= 65536) {
+         throw new IllegalArgumentException(
+               "the specified string is too long (" + length + ")");
+      }
+
+      flip();
+      buffer.writeShort((short) length);
+      buffer.writeBytes(encoded);
+      buffer.readerIndex(buffer.writerIndex());
+   }
+
+   public void putNullableSimpleString(final SimpleString string)
+   {
+      if (string == null)
+      {
+         putByte(NULL);
+      }
+      else
+      {
+         putByte(NOT_NULL);
+         putSimpleString(string);
+      }
+   }
+
+   public void putSimpleString(final SimpleString string)
+   {
+      byte[] data = string.getData();
+
+      flip();
+      buffer.writeInt(data.length);
+      buffer.writeBytes(data);
+      buffer.readerIndex(buffer.writerIndex());
+   }
+
+   public SimpleString getSimpleString()
+   {
+      int len = getInt();
+
+      byte[] data = new byte[len];
+      getBytes(data);
+
+      return new SimpleString(data);
+   }
+
+   public SimpleString getNullableSimpleString()
+   {
+      int b = getByte();
+      if (b == NULL)
+      {
+         return null;
+      }
+      else
+      {
+         return getSimpleString();
+      }
+   }
+
+   public String getUTF() throws Exception
+   {
+      ChannelBuffer utf8value;
+      try {
+         int length = buffer.readUnsignedShort();
+         utf8value = buffer.readSlice(length);
+      } catch (IndexOutOfBoundsException e) {
+         throw new BufferUnderflowException();
+      }
+
+      return utf8value.toString("UTF-8");
+   }
+
+   public Object getUnderlyingBuffer()
+   {
+      return buffer;
+   }
+
+   // Package protected ---------------------------------------------
+
+   // Protected -----------------------------------------------------
+
+   // Private -------------------------------------------------------
+
+   // Inner classes -------------------------------------------------
+}
\ No newline at end of file


Property changes on: trunk/src/main/org/jboss/messaging/integration/transports/netty/ChannelBufferWrapper.java
___________________________________________________________________
Name: svn:keywords
   + Rev Date
Name: svn:eol-style
   + native

Copied: trunk/src/main/org/jboss/messaging/integration/transports/netty/ChannelPipelineSupport.java (from rev 5338, trunk/src/main/org/jboss/messaging/core/remoting/impl/netty/ChannelPipelineSupport.java)
===================================================================
--- trunk/src/main/org/jboss/messaging/integration/transports/netty/ChannelPipelineSupport.java	                        (rev 0)
+++ trunk/src/main/org/jboss/messaging/integration/transports/netty/ChannelPipelineSupport.java	2008-11-12 12:17:43 UTC (rev 5339)
@@ -0,0 +1,80 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005-2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.messaging.integration.transports.netty;
+
+import javax.net.ssl.SSLContext;
+import javax.net.ssl.SSLEngine;
+
+import org.jboss.messaging.core.remoting.spi.BufferHandler;
+import org.jboss.netty.channel.ChannelPipeline;
+import org.jboss.netty.handler.ssl.SslHandler;
+
+/**
+ * @author <a href="mailto:jmesnil at redhat.com">Jeff Mesnil</a>
+ * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
+ * @author <a href="mailto:clebert.suconic at jboss.com">Clebert Suconic</a>
+ * @author <a href="mailto:tlee at redhat.com">Trustin Lee</a>
+ * @version $Rev$, $Date$
+ */
+public class ChannelPipelineSupport
+{
+   // Constants -----------------------------------------------------
+
+   // Attributes ----------------------------------------------------
+
+   // Static --------------------------------------------------------
+
+   // Constructors --------------------------------------------------
+
+   private ChannelPipelineSupport()
+   {
+      // Unused
+   }
+
+   // Public --------------------------------------------------------
+
+   public static void addCodecFilter(final ChannelPipeline pipeline,
+                                     final BufferHandler handler)
+   {
+      assert pipeline != null;
+      pipeline.addLast("decoder", new MessagingFrameDecoder(handler));
+   }
+
+   public static void addSSLFilter(
+         final ChannelPipeline pipeline, final SSLContext context, final boolean client) throws Exception
+   {
+      SSLEngine engine = context.createSSLEngine();
+      engine.setUseClientMode(client);
+      if (client)
+      {
+         engine.setWantClientAuth(true);
+      }
+
+      SslHandler handler = new SslHandler(engine);
+      pipeline.addLast("ssl", handler);
+   }
+
+   // Package protected ---------------------------------------------
+
+   // Inner classes -------------------------------------------------
+}


Property changes on: trunk/src/main/org/jboss/messaging/integration/transports/netty/ChannelPipelineSupport.java
___________________________________________________________________
Name: svn:keywords
   + Rev Date
Name: svn:eol-style
   + native

Copied: trunk/src/main/org/jboss/messaging/integration/transports/netty/MessagingChannelHandler.java (from rev 5338, trunk/src/main/org/jboss/messaging/core/remoting/impl/netty/MessagingChannelHandler.java)
===================================================================
--- trunk/src/main/org/jboss/messaging/integration/transports/netty/MessagingChannelHandler.java	                        (rev 0)
+++ trunk/src/main/org/jboss/messaging/integration/transports/netty/MessagingChannelHandler.java	2008-11-12 12:17:43 UTC (rev 5339)
@@ -0,0 +1,106 @@
+/*
+ * JBoss, Home of Professional Open Source
+ *
+ * Copyright 2005-2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.messaging.integration.transports.netty;
+
+import org.jboss.messaging.core.exception.MessagingException;
+import org.jboss.messaging.core.logging.Logger;
+import org.jboss.messaging.core.remoting.spi.BufferHandler;
+import org.jboss.messaging.core.remoting.spi.ConnectionLifeCycleListener;
+import org.jboss.netty.buffer.ChannelBuffer;
+import org.jboss.netty.channel.ChannelHandlerContext;
+import org.jboss.netty.channel.ChannelStateEvent;
+import org.jboss.netty.channel.ExceptionEvent;
+import org.jboss.netty.channel.MessageEvent;
+import org.jboss.netty.channel.SimpleChannelHandler;
+
+/**
+ * Common handler implementation for client and server side handler.
+ *
+ * @author <a href="mailto:tlee at redhat.com">Trustin Lee</a>
+ * @version $Rev$, $Date$
+ */
+class MessagingChannelHandler extends SimpleChannelHandler
+{
+   private static final Logger log = Logger.getLogger(MessagingChannelHandler.class);
+
+   private final BufferHandler handler;
+   private final ConnectionLifeCycleListener listener;
+   volatile boolean active;
+
+   MessagingChannelHandler(BufferHandler handler, ConnectionLifeCycleListener listener)
+   {
+      this.handler = handler;
+      this.listener = listener;
+   }
+
+   @Override
+   public void messageReceived(ChannelHandlerContext ctx, MessageEvent e) throws Exception
+   {
+      ChannelBuffer buffer = (ChannelBuffer) e.getMessage();
+      handler.bufferReceived(e.getChannel().getId(), new ChannelBufferWrapper(buffer));
+   }
+
+   @Override
+   public void channelDisconnected(ChannelHandlerContext ctx, ChannelStateEvent e) throws Exception
+   {
+      synchronized (this)
+      {
+         if (active)
+         {
+            listener.connectionDestroyed(e.getChannel().getId());
+            active = false;
+         }
+      }
+   }
+
+   @Override
+   public void channelClosed(ChannelHandlerContext ctx, ChannelStateEvent e) throws Exception
+   {
+      active = false;
+   }
+
+   @Override
+   public void exceptionCaught(ChannelHandlerContext ctx, ExceptionEvent e) throws Exception
+   {
+      log.error(
+            "caught exception " + e.getCause() + " for channel " +
+            e.getChannel(), e.getCause());
+
+      synchronized (this)
+      {
+         if (!active)
+         {
+            return;
+         }
+
+         MessagingException me = new MessagingException(MessagingException.INTERNAL_ERROR, "Netty exception");
+         me.initCause(e.getCause());
+         try {
+            listener.connectionException(e.getChannel().getId(), me);
+            active = false;
+         } catch (Exception ex) {
+            log.error("failed to notify the listener:", ex);
+         }
+      }
+   }
+}


Property changes on: trunk/src/main/org/jboss/messaging/integration/transports/netty/MessagingChannelHandler.java
___________________________________________________________________
Name: svn:keywords
   + Rev Date
Name: svn:eol-style
   + native

Copied: trunk/src/main/org/jboss/messaging/integration/transports/netty/MessagingFrameDecoder.java (from rev 5338, trunk/src/main/org/jboss/messaging/core/remoting/impl/netty/MessagingFrameDecoder.java)
===================================================================
--- trunk/src/main/org/jboss/messaging/integration/transports/netty/MessagingFrameDecoder.java	                        (rev 0)
+++ trunk/src/main/org/jboss/messaging/integration/transports/netty/MessagingFrameDecoder.java	2008-11-12 12:17:43 UTC (rev 5339)
@@ -0,0 +1,74 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005-2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.messaging.integration.transports.netty;
+
+import static org.jboss.messaging.util.DataConstants.SIZE_INT;
+
+import org.jboss.messaging.core.logging.Logger;
+import org.jboss.messaging.core.remoting.spi.BufferHandler;
+import org.jboss.netty.buffer.ChannelBuffer;
+import org.jboss.netty.channel.Channel;
+import org.jboss.netty.channel.ChannelHandlerContext;
+import org.jboss.netty.handler.codec.frame.FrameDecoder;
+
+/**
+ * A Netty FrameDecoder used to decode messages.
+ *
+ * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
+ * @author <a href="ataylor at redhat.com">Andy Taylor</a>
+ * @author <a href="tlee at redhat.com">Trustin Lee</a>
+ *
+ * @version $Revision$, $Date$
+ */
+public class MessagingFrameDecoder extends FrameDecoder
+{
+   private static final Logger log = Logger.getLogger(MessagingFrameDecoder.class);
+
+   
+   private final BufferHandler handler;
+
+   public MessagingFrameDecoder(final BufferHandler handler)
+   {
+      this.handler = handler;
+   }
+
+   // FrameDecoder overrides
+   // -------------------------------------------------------------------------------------
+
+   @Override
+   protected Object decode(ChannelHandlerContext ctx, Channel channel, ChannelBuffer in) throws Exception
+   {
+      //TODO - we can avoid this entirely if we maintain fragmented packets in the handler
+      int start = in.readerIndex();
+
+      int length = handler.isReadyToHandle(new ChannelBufferWrapper(in));
+      if (length == -1)
+      {
+         in.readerIndex(start);
+         return null;
+      }
+
+      in.readerIndex(start + SIZE_INT);
+      return in.readBytes(length);
+   }
+}


Property changes on: trunk/src/main/org/jboss/messaging/integration/transports/netty/MessagingFrameDecoder.java
___________________________________________________________________
Name: svn:keywords
   + Rev Date
Name: svn:eol-style
   + native

Copied: trunk/src/main/org/jboss/messaging/integration/transports/netty/NettyAcceptor.java (from rev 5338, trunk/src/main/org/jboss/messaging/core/remoting/impl/netty/NettyAcceptor.java)
===================================================================
--- trunk/src/main/org/jboss/messaging/integration/transports/netty/NettyAcceptor.java	                        (rev 0)
+++ trunk/src/main/org/jboss/messaging/integration/transports/netty/NettyAcceptor.java	2008-11-12 12:17:43 UTC (rev 5339)
@@ -0,0 +1,287 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005-2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.messaging.integration.transports.netty;
+
+import static org.jboss.netty.channel.Channels.pipeline;
+
+import java.net.InetSocketAddress;
+import java.util.Map;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.TimeUnit;
+
+import javax.net.ssl.SSLContext;
+
+import org.jboss.messaging.core.logging.Logger;
+import org.jboss.messaging.core.remoting.impl.ssl.SSLSupport;
+import org.jboss.messaging.core.remoting.spi.Acceptor;
+import org.jboss.messaging.core.remoting.spi.BufferHandler;
+import org.jboss.messaging.core.remoting.spi.Connection;
+import org.jboss.messaging.core.remoting.spi.ConnectionLifeCycleListener;
+import org.jboss.messaging.util.ConfigurationHelper;
+import org.jboss.messaging.util.JBMThreadFactory;
+import org.jboss.netty.bootstrap.ServerBootstrap;
+import org.jboss.netty.channel.Channel;
+import org.jboss.netty.channel.ChannelFactory;
+import org.jboss.netty.channel.ChannelFuture;
+import org.jboss.netty.channel.ChannelFutureListener;
+import org.jboss.netty.channel.ChannelHandlerContext;
+import org.jboss.netty.channel.ChannelPipeline;
+import org.jboss.netty.channel.ChannelPipelineCoverage;
+import org.jboss.netty.channel.ChannelPipelineFactory;
+import org.jboss.netty.channel.ChannelStateEvent;
+import org.jboss.netty.channel.socket.nio.NioServerSocketChannelFactory;
+import org.jboss.netty.channel.socket.oio.OioServerSocketChannelFactory;
+import org.jboss.netty.handler.ssl.SslHandler;
+
+/**
+ * A Netty TCP Acceptor that supports SSL
+ *
+ * @author <a href="ataylor at redhat.com">Andy Taylor</a>
+ * @author <a href="tim.fox at jboss.com">Tim Fox</a>
+ * @author <a href="tlee at redhat.com">Trustin Lee</a>
+ *
+ * @version $Rev$, $Date$
+ */
+public class NettyAcceptor implements Acceptor
+{
+   private static final Logger log = Logger.getLogger(NettyAcceptor.class);
+   
+   private ExecutorService bossExecutor;
+   private ExecutorService workerExecutor;
+   private ChannelFactory channelFactory;
+   private Channel serverChannel;
+   private ServerBootstrap bootstrap;
+
+   private final BufferHandler handler;
+
+   private final ConnectionLifeCycleListener listener;
+   
+   private final boolean sslEnabled;
+   
+   private final boolean useNio;
+   
+   private final String host;
+
+   private final int port;
+         
+   private final String keyStorePath;
+ 
+   private final String keyStorePassword;
+   
+   private final String trustStorePath;
+   
+   private final String trustStorePassword;
+   
+   private final boolean tcpNoDelay;
+   
+   private final int tcpSendBufferSize;
+   
+   private final int tcpReceiveBufferSize;
+
+   public NettyAcceptor(final Map<String, Object> configuration,  final BufferHandler handler,
+                       final ConnectionLifeCycleListener listener)
+   {   
+      this.handler = handler;
+
+      this.listener = listener;
+      
+      this.sslEnabled =
+         ConfigurationHelper.getBooleanProperty(TransportConstants.SSL_ENABLED_PROP_NAME, TransportConstants.DEFAULT_SSL_ENABLED, configuration);
+      this.useNio = 
+         ConfigurationHelper.getBooleanProperty(TransportConstants.USE_NIO_PROP_NAME, TransportConstants.DEFAULT_USE_NIO, configuration);
+      this.host =
+         ConfigurationHelper.getStringProperty(TransportConstants.HOST_PROP_NAME, TransportConstants.DEFAULT_HOST, configuration);
+      this.port =
+         ConfigurationHelper.getIntProperty(TransportConstants.PORT_PROP_NAME, TransportConstants.DEFAULT_PORT, configuration);
+      if (sslEnabled)
+      {
+         this.keyStorePath =
+            ConfigurationHelper.getStringProperty(TransportConstants.KEYSTORE_PATH_PROP_NAME, TransportConstants.DEFAULT_KEYSTORE_PATH, configuration);
+         this.keyStorePassword =
+            ConfigurationHelper.getStringProperty(TransportConstants.KEYSTORE_PASSWORD_PROP_NAME, TransportConstants.DEFAULT_KEYSTORE_PASSWORD, configuration);
+         this.trustStorePath =
+            ConfigurationHelper.getStringProperty(TransportConstants.TRUSTSTORE_PATH_PROP_NAME, TransportConstants.DEFAULT_TRUSTSTORE_PATH, configuration);
+         this.trustStorePassword =
+            ConfigurationHelper.getStringProperty(TransportConstants.TRUSTSTORE_PASSWORD_PROP_NAME, TransportConstants.DEFAULT_TRUSTSTORE_PASSWORD, configuration);
+      }   
+      else
+      {
+         this.keyStorePath = null;
+         this.keyStorePassword = null;
+         this.trustStorePath = null;
+         this.trustStorePassword = null; 
+      }
+      
+      this.tcpNoDelay =
+         ConfigurationHelper.getBooleanProperty(TransportConstants.TCP_NODELAY_PROPNAME, TransportConstants.DEFAULT_TCP_NODELAY, configuration);
+      this.tcpSendBufferSize =
+         ConfigurationHelper.getIntProperty(TransportConstants.TCP_SENDBUFFER_SIZE_PROPNAME, TransportConstants.DEFAULT_TCP_SENDBUFFER_SIZE, configuration);
+      this.tcpReceiveBufferSize =
+         ConfigurationHelper.getIntProperty(TransportConstants.TCP_RECEIVEBUFFER_SIZE_PROPNAME, TransportConstants.DEFAULT_TCP_RECEIVEBUFFER_SIZE, configuration);
+    
+   }
+
+   public synchronized void start() throws Exception
+   {
+      if (channelFactory != null)
+      {
+         //Already started
+         return;
+      }
+ 
+      bossExecutor = Executors.newCachedThreadPool(new JBMThreadFactory("jbm-netty-acceptor-boss-threads"));
+      workerExecutor = Executors.newCachedThreadPool(new JBMThreadFactory("jbm-netty-acceptor-worker-threads"));
+      if (useNio)
+      {
+         channelFactory = new NioServerSocketChannelFactory(bossExecutor, workerExecutor);
+      }
+      else
+      {
+         channelFactory = new OioServerSocketChannelFactory(bossExecutor, workerExecutor);
+      }
+      bootstrap = new ServerBootstrap(channelFactory);
+
+      final SSLContext context;
+      if (sslEnabled)
+      {
+         try
+         {
+            context = SSLSupport.createServerContext(
+                  keyStorePath,
+                  keyStorePassword,
+                  trustStorePath,
+                  trustStorePassword);
+         }
+         catch (Exception e)
+         {
+            IllegalStateException ise = new IllegalStateException(
+                  "Unable to create NettyAcceptor for " +
+                  host + ":" + port);
+            ise.initCause(e);
+            throw ise;
+         }
+      }
+      else
+      {
+         context = null; // Unused
+      }
+
+      bootstrap.setPipelineFactory(new ChannelPipelineFactory() {
+         public ChannelPipeline getPipeline() throws Exception
+         {
+            ChannelPipeline pipeline = pipeline();
+            if (sslEnabled)
+            {
+               ChannelPipelineSupport.addSSLFilter(pipeline, context, false);
+            }
+            ChannelPipelineSupport.addCodecFilter(pipeline, handler);
+            pipeline.addLast("handler", new MessagingServerChannelHandler(handler, listener));
+            return pipeline;
+         }
+      });
+
+      // Bind
+      bootstrap.setOption("localAddress", new InetSocketAddress(host, port));
+      bootstrap.setOption("child.tcpNoDelay", tcpNoDelay);    
+      if (tcpReceiveBufferSize != -1)
+      {
+         bootstrap.setOption("child.receiveBufferSize", tcpReceiveBufferSize);
+      }     
+      if (tcpSendBufferSize != -1)
+      {
+         bootstrap.setOption("child.sendBufferSize", tcpSendBufferSize);
+      }
+      bootstrap.setOption("reuseAddress", true);
+      bootstrap.setOption("child.reuseAddress", true);
+      bootstrap.setOption("child.keepAlive", true);
+
+      serverChannel = bootstrap.bind();
+   }
+
+   public synchronized void stop()
+   {
+      if (channelFactory == null)
+      {
+         return;
+      }
+
+      serverChannel.close().awaitUninterruptibly();
+      bossExecutor.shutdown();
+      workerExecutor.shutdown();
+      for (;;)
+      {
+         try
+         {
+            if (bossExecutor.awaitTermination(1, TimeUnit.SECONDS))
+            {
+               break;
+            }
+         }
+         catch (InterruptedException e)
+         {
+            // Ignore
+         }
+      }
+      channelFactory = null;
+   }
+
+   // Inner classes -----------------------------------------------------------------------------
+
+   @ChannelPipelineCoverage("one")
+   private final class MessagingServerChannelHandler extends MessagingChannelHandler
+   {
+      MessagingServerChannelHandler(BufferHandler handler, ConnectionLifeCycleListener listener)
+      {
+         super(handler, listener);
+      }
+
+      @Override
+      public void channelConnected(ChannelHandlerContext ctx, ChannelStateEvent e) throws Exception
+      {
+         final Connection tc = new NettyConnection(e.getChannel());
+
+         SslHandler sslHandler = ctx.getPipeline().get(SslHandler.class);
+         if (sslHandler != null)
+         {
+            sslHandler.handshake(e.getChannel()).addListener(new ChannelFutureListener()
+            {
+               public void operationComplete(ChannelFuture future) throws Exception
+               {
+                  if (future.isSuccess()) {
+                     listener.connectionCreated(tc);
+                     active = true;
+                  } else {
+                     future.getChannel().close();
+                  }
+               }
+            });
+         }
+         else
+         {
+            listener.connectionCreated(tc);
+            active = true;
+         }
+      }
+   }
+}


Property changes on: trunk/src/main/org/jboss/messaging/integration/transports/netty/NettyAcceptor.java
___________________________________________________________________
Name: svn:keywords
   + Rev Date
Name: svn:eol-style
   + native

Copied: trunk/src/main/org/jboss/messaging/integration/transports/netty/NettyAcceptorFactory.java (from rev 5338, trunk/src/main/org/jboss/messaging/core/remoting/impl/netty/NettyAcceptorFactory.java)
===================================================================
--- trunk/src/main/org/jboss/messaging/integration/transports/netty/NettyAcceptorFactory.java	                        (rev 0)
+++ trunk/src/main/org/jboss/messaging/integration/transports/netty/NettyAcceptorFactory.java	2008-11-12 12:17:43 UTC (rev 5339)
@@ -0,0 +1,45 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005-2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.messaging.integration.transports.netty;
+
+import java.util.Map;
+
+import org.jboss.messaging.core.remoting.spi.Acceptor;
+import org.jboss.messaging.core.remoting.spi.AcceptorFactory;
+import org.jboss.messaging.core.remoting.spi.BufferHandler;
+import org.jboss.messaging.core.remoting.spi.ConnectionLifeCycleListener;
+
+/**
+ * A NettyAcceptorFactory
+ *
+ * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
+ */
+public class NettyAcceptorFactory implements AcceptorFactory
+{
+   public Acceptor createAcceptor(final Map<String, Object> configuration,
+                                  final BufferHandler handler,
+                                  final ConnectionLifeCycleListener listener)
+   {
+      return new NettyAcceptor(configuration, handler, listener);
+   }
+}


Property changes on: trunk/src/main/org/jboss/messaging/integration/transports/netty/NettyAcceptorFactory.java
___________________________________________________________________
Name: svn:keywords
   + Rev Date
Name: svn:eol-style
   + native

Copied: trunk/src/main/org/jboss/messaging/integration/transports/netty/NettyConnection.java (from rev 5338, trunk/src/main/org/jboss/messaging/core/remoting/impl/netty/NettyConnection.java)
===================================================================
--- trunk/src/main/org/jboss/messaging/integration/transports/netty/NettyConnection.java	                        (rev 0)
+++ trunk/src/main/org/jboss/messaging/integration/transports/netty/NettyConnection.java	2008-11-12 12:17:43 UTC (rev 5339)
@@ -0,0 +1,125 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005-2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.messaging.integration.transports.netty;
+
+import org.jboss.messaging.core.remoting.spi.Connection;
+import org.jboss.messaging.core.remoting.spi.MessagingBuffer;
+import org.jboss.netty.channel.Channel;
+import org.jboss.netty.channel.ChannelFutureListener;
+import org.jboss.netty.handler.ssl.SslHandler;
+
+/**
+ * @author <a href="mailto:jmesnil at redhat.com">Jeff Mesnil</a>
+ * @author <a href="mailto:ataylor at redhat.com">Andy Taylor</a>
+ * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
+ * buhnaflagilibrn
+ * @version <tt>$Revision$</tt>
+ */
+public class NettyConnection implements Connection
+{
+   // Constants -----------------------------------------------------
+
+   // Attributes ----------------------------------------------------
+
+   private final Channel channel;
+
+   private boolean closed;
+
+   // Static --------------------------------------------------------
+
+   // Constructors --------------------------------------------------
+
+   public NettyConnection(final Channel channel)
+   {
+      this.channel = channel;
+   }
+
+   // Public --------------------------------------------------------
+
+   // Connection implementation ----------------------------
+
+   public synchronized void close()
+   {
+      if (closed)
+      {
+         return;
+      }
+
+      SslHandler sslHandler = (SslHandler) channel.getPipeline().get("ssl");
+      if (sslHandler != null)
+      {
+         try
+         {
+            sslHandler.close(channel).addListener(ChannelFutureListener.CLOSE);
+         }
+         catch (Throwable t)
+         {
+            // ignore
+         }
+      } else {
+         channel.close();
+      }
+
+//      This block has been disabled because this method can be called from
+//      the Netty I/O thread.
+//      TODO Netty should be improved to provide a way to determine
+//           if the current code is running in the I/O thread.
+//
+//      if (channel.getParent() == null) {
+//         // A client channel - wait until everything is cleaned up.
+//         // TODO Do not spin - use signal.
+//         MessagingChannelHandler handler = (MessagingChannelHandler) channel.getPipeline().get("handler");
+//         while (handler.active) {
+//            Thread.yield();
+//         }
+//      }
+
+      closed = true;
+   }
+
+   public MessagingBuffer createBuffer(int size)
+   {
+      return new ChannelBufferWrapper(size);
+   }
+
+   public Object getID()
+   {
+      return channel.getId();
+   }
+
+   public void write(final MessagingBuffer buffer)
+   {
+      channel.write(buffer.getUnderlyingBuffer());
+   }
+
+   // Public --------------------------------------------------------
+
+   // Package protected ---------------------------------------------
+
+   // Protected -----------------------------------------------------
+
+   // Private -------------------------------------------------------
+
+   // Inner classes -------------------------------------------------
+
+}


Property changes on: trunk/src/main/org/jboss/messaging/integration/transports/netty/NettyConnection.java
___________________________________________________________________
Name: svn:keywords
   + Rev Date
Name: svn:eol-style
   + native

Copied: trunk/src/main/org/jboss/messaging/integration/transports/netty/NettyConnector.java (from rev 5338, trunk/src/main/org/jboss/messaging/core/remoting/impl/netty/NettyConnector.java)
===================================================================
--- trunk/src/main/org/jboss/messaging/integration/transports/netty/NettyConnector.java	                        (rev 0)
+++ trunk/src/main/org/jboss/messaging/integration/transports/netty/NettyConnector.java	2008-11-12 12:17:43 UTC (rev 5339)
@@ -0,0 +1,314 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005-2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.messaging.integration.transports.netty;
+
+import static org.jboss.netty.channel.Channels.pipeline;
+
+import java.net.InetSocketAddress;
+import java.util.Map;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.TimeUnit;
+
+import javax.net.ssl.SSLContext;
+import javax.net.ssl.SSLException;
+
+import org.jboss.messaging.core.logging.Logger;
+import org.jboss.messaging.core.remoting.impl.ssl.SSLSupport;
+import org.jboss.messaging.core.remoting.spi.BufferHandler;
+import org.jboss.messaging.core.remoting.spi.Connection;
+import org.jboss.messaging.core.remoting.spi.ConnectionLifeCycleListener;
+import org.jboss.messaging.core.remoting.spi.Connector;
+import org.jboss.messaging.util.ConfigurationHelper;
+import org.jboss.messaging.util.JBMThreadFactory;
+import org.jboss.netty.bootstrap.ClientBootstrap;
+import org.jboss.netty.channel.Channel;
+import org.jboss.netty.channel.ChannelFactory;
+import org.jboss.netty.channel.ChannelFuture;
+import org.jboss.netty.channel.ChannelPipeline;
+import org.jboss.netty.channel.ChannelPipelineCoverage;
+import org.jboss.netty.channel.ChannelPipelineFactory;
+import org.jboss.netty.channel.socket.nio.NioClientSocketChannelFactory;
+import org.jboss.netty.channel.socket.oio.OioClientSocketChannelFactory;
+import org.jboss.netty.handler.ssl.SslHandler;
+
+/**
+ *
+ * A NettyConnector
+ *
+ * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
+ * @author <a href="mailto:tlee at redhat.com">Trustin Lee</a>
+ */
+public class NettyConnector implements Connector
+{
+   // Constants -----------------------------------------------------
+
+   private static final Logger log = Logger.getLogger(NettyConnection.class);
+
+   // Attributes ----------------------------------------------------
+
+   private ExecutorService bossExecutor;
+   private ExecutorService workerExecutor;
+   private ChannelFactory  channelFactory;
+   private ClientBootstrap bootstrap;
+
+   private final BufferHandler handler;
+
+   private final ConnectionLifeCycleListener listener;
+   
+   private final boolean sslEnabled;
+   
+   private final boolean useNio;   
+   
+   private final String host;
+
+   private final int port;
+         
+   private final String keyStorePath;
+ 
+   private final String keyStorePassword;
+   
+   private final boolean tcpNoDelay;
+   
+   private final int tcpSendBufferSize;
+   
+   private final int tcpReceiveBufferSize;
+
+   // Static --------------------------------------------------------
+
+   // Constructors --------------------------------------------------
+
+   // Public --------------------------------------------------------
+
+   public NettyConnector(final Map<String, Object> configuration,             
+                         final BufferHandler handler,
+                         final ConnectionLifeCycleListener listener)
+   {
+      if (listener == null)
+      {
+         throw new IllegalArgumentException("Invalid argument null listener");
+      }
+      
+      if (handler == null)
+      {
+         throw new IllegalArgumentException("Invalid argument null handler");
+      }
+
+      this.listener = listener;
+      
+      this.handler = handler;
+      
+      this.sslEnabled =
+         ConfigurationHelper.getBooleanProperty(TransportConstants.SSL_ENABLED_PROP_NAME, TransportConstants.DEFAULT_SSL_ENABLED, configuration);
+      this.useNio = 
+         ConfigurationHelper.getBooleanProperty(TransportConstants.USE_NIO_PROP_NAME, TransportConstants.DEFAULT_USE_NIO, configuration);
+      this.host =
+         ConfigurationHelper.getStringProperty(TransportConstants.HOST_PROP_NAME, TransportConstants.DEFAULT_HOST, configuration);
+      this.port =
+         ConfigurationHelper.getIntProperty(TransportConstants.PORT_PROP_NAME, TransportConstants.DEFAULT_PORT, configuration);
+      if (sslEnabled)
+      {
+         this.keyStorePath =
+            ConfigurationHelper.getStringProperty(TransportConstants.KEYSTORE_PATH_PROP_NAME, TransportConstants.DEFAULT_KEYSTORE_PATH, configuration);
+         this.keyStorePassword =
+            ConfigurationHelper.getStringProperty(TransportConstants.KEYSTORE_PASSWORD_PROP_NAME, TransportConstants.DEFAULT_KEYSTORE_PASSWORD, configuration);
+      }   
+      else
+      {
+         this.keyStorePath = null;
+         this.keyStorePassword = null;
+      }
+      
+      this.tcpNoDelay =
+         ConfigurationHelper.getBooleanProperty(TransportConstants.TCP_NODELAY_PROPNAME, TransportConstants.DEFAULT_TCP_NODELAY, configuration);
+      this.tcpSendBufferSize =
+         ConfigurationHelper.getIntProperty(TransportConstants.TCP_SENDBUFFER_SIZE_PROPNAME, TransportConstants.DEFAULT_TCP_SENDBUFFER_SIZE, configuration);
+      this.tcpReceiveBufferSize =
+         ConfigurationHelper.getIntProperty(TransportConstants.TCP_RECEIVEBUFFER_SIZE_PROPNAME, TransportConstants.DEFAULT_TCP_RECEIVEBUFFER_SIZE, configuration);
+
+   }
+
+   public synchronized void start()
+   {
+      if (channelFactory != null)
+      {
+         return;
+      }
+
+      workerExecutor = Executors.newCachedThreadPool(new JBMThreadFactory("jbm-netty-connector-worker-threads"));
+      if (useNio)
+      {
+         bossExecutor = Executors.newCachedThreadPool(new JBMThreadFactory("jbm-netty-connector-boss-threads"));      
+         channelFactory = new NioClientSocketChannelFactory(bossExecutor, workerExecutor);
+      }
+      else
+      {
+         channelFactory = new OioClientSocketChannelFactory(workerExecutor);
+      }
+      bootstrap = new ClientBootstrap(channelFactory);
+
+      bootstrap.setOption("tcpNoDelay", tcpNoDelay);
+      if (tcpReceiveBufferSize != -1)
+      {
+         bootstrap.setOption("receiveBufferSize", tcpReceiveBufferSize);
+      }
+      if (tcpSendBufferSize != -1)
+      {
+         bootstrap.setOption("sendBufferSize", tcpSendBufferSize);
+      }
+      bootstrap.setOption("keepAlive", true);
+      bootstrap.setOption("reuseAddress", true);
+
+      final SSLContext context;
+      if (sslEnabled)
+      {
+         try
+         {
+            context = SSLSupport.getInstance(true, keyStorePath, keyStorePassword, null, null);
+         }
+         catch (Exception e)
+         {
+            close();
+            IllegalStateException ise = new IllegalStateException(
+                  "Unable to create NettyConnector for " + host);
+            ise.initCause(e);
+            throw ise;
+         }
+      }
+      else
+      {
+         context = null; // Unused
+      }
+
+      bootstrap.setPipelineFactory(new ChannelPipelineFactory() {
+         public ChannelPipeline getPipeline() throws Exception
+         {
+            ChannelPipeline pipeline = pipeline();
+            if (sslEnabled)
+            {
+               ChannelPipelineSupport.addSSLFilter(pipeline, context, true);
+            }
+            ChannelPipelineSupport.addCodecFilter(pipeline, handler);
+            pipeline.addLast("handler", new MessagingClientChannelHandler(handler, listener));
+            return pipeline;
+         }
+      });
+   }
+   
+   public synchronized void close()
+   {
+      if (channelFactory == null)
+      {
+         return;
+      }
+
+      bootstrap = null;
+      channelFactory = null;
+      if (bossExecutor != null)
+      {
+         bossExecutor.shutdown();        
+      }
+      workerExecutor.shutdown();
+      if (bossExecutor != null)
+      {
+         for (;;)
+         {
+            try
+            {
+               if (bossExecutor.awaitTermination(1, TimeUnit.SECONDS))
+               {
+                  break;
+               }
+            }
+            catch (InterruptedException e)
+            {
+               // Ignore
+            }
+         }
+      }     
+   }
+
+   public Connection createConnection()
+   {
+      if (channelFactory == null) {
+         return null;
+      }
+
+      InetSocketAddress address = new InetSocketAddress(host, port);
+      ChannelFuture future = bootstrap.connect(address);
+      future.awaitUninterruptibly();
+
+      if (future.isSuccess())
+      {
+         final Channel ch = future.getChannel();
+         SslHandler sslHandler = ch.getPipeline().get(SslHandler.class);
+         if (sslHandler != null)
+         {
+            try
+            {
+               ChannelFuture handshakeFuture = sslHandler.handshake(ch);
+               handshakeFuture.awaitUninterruptibly();
+               if (handshakeFuture.isSuccess()) {
+                  ch.getPipeline().get(MessagingChannelHandler.class).active = true;
+               } else {
+                  ch.close().awaitUninterruptibly();
+                  return null;
+               }
+            }
+            catch (SSLException e)
+            {
+               ch.close();
+               return null;
+            }
+         }
+         else
+         {
+            ch.getPipeline().get(MessagingChannelHandler.class).active = true;
+         }
+
+         return new NettyConnection(ch);
+      }
+      else
+      {
+         return null;
+      }
+   }
+
+   // Public --------------------------------------------------------
+
+   // Package protected ---------------------------------------------
+
+   // Protected -----------------------------------------------------
+
+   // Private -------------------------------------------------------
+
+   // Inner classes -------------------------------------------------
+
+   @ChannelPipelineCoverage("one")
+   private final class MessagingClientChannelHandler extends MessagingChannelHandler
+   {
+      MessagingClientChannelHandler(BufferHandler handler, ConnectionLifeCycleListener listener)
+      {
+         super(handler, listener);
+      }
+   }
+}


Property changes on: trunk/src/main/org/jboss/messaging/integration/transports/netty/NettyConnector.java
___________________________________________________________________
Name: svn:keywords
   + Rev Date
Name: svn:eol-style
   + native

Copied: trunk/src/main/org/jboss/messaging/integration/transports/netty/NettyConnectorFactory.java (from rev 5338, trunk/src/main/org/jboss/messaging/core/remoting/impl/netty/NettyConnectorFactory.java)
===================================================================
--- trunk/src/main/org/jboss/messaging/integration/transports/netty/NettyConnectorFactory.java	                        (rev 0)
+++ trunk/src/main/org/jboss/messaging/integration/transports/netty/NettyConnectorFactory.java	2008-11-12 12:17:43 UTC (rev 5339)
@@ -0,0 +1,23 @@
+package org.jboss.messaging.integration.transports.netty;
+
+import java.util.Map;
+
+import org.jboss.messaging.core.remoting.spi.BufferHandler;
+import org.jboss.messaging.core.remoting.spi.ConnectionLifeCycleListener;
+import org.jboss.messaging.core.remoting.spi.Connector;
+import org.jboss.messaging.core.remoting.spi.ConnectorFactory;
+
+/**
+ * A NettyConnectorFactory
+ *
+ * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
+ */
+public class NettyConnectorFactory implements ConnectorFactory
+{
+   public Connector createConnector(final Map<String, Object> configuration,
+                                    final BufferHandler handler,
+                                    final ConnectionLifeCycleListener listener)
+   {
+      return new NettyConnector(configuration, handler, listener);
+   }
+}


Property changes on: trunk/src/main/org/jboss/messaging/integration/transports/netty/NettyConnectorFactory.java
___________________________________________________________________
Name: svn:keywords
   + Rev Date
Name: svn:eol-style
   + native

Copied: trunk/src/main/org/jboss/messaging/integration/transports/netty/TransportConstants.java (from rev 5338, trunk/src/main/org/jboss/messaging/core/remoting/impl/netty/TransportConstants.java)
===================================================================
--- trunk/src/main/org/jboss/messaging/integration/transports/netty/TransportConstants.java	                        (rev 0)
+++ trunk/src/main/org/jboss/messaging/integration/transports/netty/TransportConstants.java	2008-11-12 12:17:43 UTC (rev 5339)
@@ -0,0 +1,75 @@
+/*
+  * JBoss, Home of Professional Open Source
+  * Copyright 2005, JBoss Inc., and individual contributors as indicated
+  * by the @authors tag. See the copyright.txt in the distribution for a
+  * full listing of individual contributors.
+  *
+  * This is free software; you can redistribute it and/or modify it
+  * under the terms of the GNU Lesser General Public License as
+  * published by the Free Software Foundation; either version 2.1 of
+  * the License, or (at your option) any later version.
+  *
+  * This software is distributed in the hope that it will be useful,
+  * but WITHOUT ANY WARRANTY; without even the implied warranty of
+  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+  * Lesser General Public License for more details.
+  *
+  * You should have received a copy of the GNU Lesser General Public
+  * License along with this software; if not, write to the Free
+  * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+  * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+  */
+package org.jboss.messaging.integration.transports.netty;
+
+/**
+ * A TransportConstants
+ * 
+ * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
+ *
+ */
+public class TransportConstants
+{
+   public static final String SSL_ENABLED_PROP_NAME = "jbm.remoting.netty.sslenabled";
+   
+   public static final String USE_NIO_PROP_NAME = "jbm.remoting.netty.usenio";
+   
+   public static final String HOST_PROP_NAME = "jbm.remoting.netty.host";
+   
+   public static final String PORT_PROP_NAME = "jbm.remoting.netty.port";
+   
+   public static final String KEYSTORE_PATH_PROP_NAME = "jbm.remoting.netty.keystorepath";
+   
+   public static final String KEYSTORE_PASSWORD_PROP_NAME = "jbm.remoting.netty.keystorepassword";
+   
+   public static final String TRUSTSTORE_PATH_PROP_NAME = "jbm.remoting.netty.truststorepath";
+   
+   public static final String TRUSTSTORE_PASSWORD_PROP_NAME = "jbm.remoting.netty.truststorepassword";
+   
+   public static final String TCP_NODELAY_PROPNAME = "jbm.remoting.netty.tcpnodelay";
+   
+   public static final String TCP_SENDBUFFER_SIZE_PROPNAME = "jbm.remoting.netty.tcpsendbuffersize";
+   
+   public static final String TCP_RECEIVEBUFFER_SIZE_PROPNAME = "jbm.remoting.netty.tcpreceivebuffersize";
+   
+   public static final boolean DEFAULT_SSL_ENABLED = false;
+   
+   public static final boolean DEFAULT_USE_NIO = true;
+   
+   public static final String DEFAULT_HOST = "localhost";
+   
+   public static final int DEFAULT_PORT = 5400;
+   
+   public static final String DEFAULT_KEYSTORE_PATH = "messaging.keystore";
+ 
+   public static final String DEFAULT_KEYSTORE_PASSWORD = "secureexample";    
+ 
+   public static final String DEFAULT_TRUSTSTORE_PATH = "messaging.truststore";
+ 
+   public static final String DEFAULT_TRUSTSTORE_PASSWORD = "secureexample";
+   
+   public static final boolean DEFAULT_TCP_NODELAY = true;
+   
+   public static final int DEFAULT_TCP_SENDBUFFER_SIZE = 32768;
+   
+   public static final int DEFAULT_TCP_RECEIVEBUFFER_SIZE = 32768;  
+}

Modified: trunk/src/main/org/jboss/messaging/jms/client/JBossBytesMessage.java
===================================================================
--- trunk/src/main/org/jboss/messaging/jms/client/JBossBytesMessage.java	2008-11-11 12:27:28 UTC (rev 5338)
+++ trunk/src/main/org/jboss/messaging/jms/client/JBossBytesMessage.java	2008-11-12 12:17:43 UTC (rev 5339)
@@ -32,7 +32,6 @@
 import org.jboss.messaging.core.client.ClientMessage;
 import org.jboss.messaging.core.client.ClientSession;
 import org.jboss.messaging.core.logging.Logger;
-import org.jboss.messaging.core.remoting.impl.mina.IoBufferWrapper;
 
 /**
  * This class implements javax.jms.BytesMessage.
@@ -416,7 +415,7 @@
    {
       super.clearBody();
 
-      body = new IoBufferWrapper(1024);
+      body = body.createNewBuffer(1024);
    }
 
    public long getBodyLength() throws JMSException

Modified: trunk/src/main/org/jboss/messaging/jms/client/JBossStreamMessage.java
===================================================================
--- trunk/src/main/org/jboss/messaging/jms/client/JBossStreamMessage.java	2008-11-11 12:27:28 UTC (rev 5338)
+++ trunk/src/main/org/jboss/messaging/jms/client/JBossStreamMessage.java	2008-11-12 12:17:43 UTC (rev 5339)
@@ -32,7 +32,6 @@
 import org.jboss.messaging.core.client.ClientMessage;
 import org.jboss.messaging.core.client.ClientSession;
 import org.jboss.messaging.core.logging.Logger;
-import org.jboss.messaging.core.remoting.impl.mina.IoBufferWrapper;
 import org.jboss.messaging.util.DataConstants;
 
 /**
@@ -568,7 +567,7 @@
    {
       super.clearBody();
       
-      body = new IoBufferWrapper(1024);
+      body = body.createNewBuffer(1024);
    }
    
    public void doBeforeSend() throws Exception

Modified: trunk/src/main/org/jboss/messaging/jms/server/management/impl/JMSQueueControl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/jms/server/management/impl/JMSQueueControl.java	2008-11-11 12:27:28 UTC (rev 5338)
+++ trunk/src/main/org/jboss/messaging/jms/server/management/impl/JMSQueueControl.java	2008-11-12 12:17:43 UTC (rev 5339)
@@ -33,7 +33,6 @@
 import javax.management.openmbean.CompositeData;
 import javax.management.openmbean.TabularData;
 
-import org.jboss.logging.Logger;
 import org.jboss.messaging.core.exception.MessagingException;
 import org.jboss.messaging.core.filter.Filter;
 import org.jboss.messaging.core.filter.impl.FilterImpl;
@@ -51,6 +50,7 @@
 import org.jboss.messaging.core.server.ServerMessage;
 import org.jboss.messaging.core.settings.HierarchicalRepository;
 import org.jboss.messaging.core.settings.impl.QueueSettings;
+import org.jboss.messaging.core.logging.Logger;
 import org.jboss.messaging.jms.JBossDestination;
 import org.jboss.messaging.jms.JBossQueue;
 import org.jboss.messaging.jms.client.JBossMessage;

Modified: trunk/src/main/org/jboss/messaging/microcontainer/JBMBootstrapServer.java
===================================================================
--- trunk/src/main/org/jboss/messaging/microcontainer/JBMBootstrapServer.java	2008-11-11 12:27:28 UTC (rev 5338)
+++ trunk/src/main/org/jboss/messaging/microcontainer/JBMBootstrapServer.java	2008-11-12 12:17:43 UTC (rev 5339)
@@ -35,6 +35,7 @@
 import org.jboss.kernel.plugins.deployment.xml.BeanXMLDeployer;
 import org.jboss.kernel.spi.config.KernelConfig;
 import org.jboss.kernel.spi.deployment.KernelDeployment;
+import org.jboss.messaging.core.logging.Logger;
 
 /**
  * This is the method in which the JBM server can be deployed externall outside of jBoss. Alternatively a user can embed
@@ -43,6 +44,7 @@
  */
 public class JBMBootstrapServer extends BasicBootstrap
 {
+   private static Logger log = Logger.getLogger(JBMBootstrapServer.class);
    /**
     * The deployer
     */
@@ -66,6 +68,8 @@
     */
    public static void main(final String[] args) throws Exception
    {
+      log.info("Starting server");
+
       JBMBootstrapServer bootstrap = new JBMBootstrapServer(args);
       
       bootstrap.run();

Modified: trunk/tests/jms-tests/src/org/jboss/test/messaging/jms/CTSMiscellaneousTest.java
===================================================================
--- trunk/tests/jms-tests/src/org/jboss/test/messaging/jms/CTSMiscellaneousTest.java	2008-11-11 12:27:28 UTC (rev 5338)
+++ trunk/tests/jms-tests/src/org/jboss/test/messaging/jms/CTSMiscellaneousTest.java	2008-11-12 12:17:43 UTC (rev 5339)
@@ -88,7 +88,7 @@
          bindings.add("StrictTCKConnectionFactory");
 
          getJmsServerManager().createConnectionFactory("StrictTCKConnectionFactory",
-                                                       new TransportConfiguration("org.jboss.messaging.core.remoting.impl.netty.NettyConnectorFactory"),
+                                                       new TransportConfiguration("org.jboss.messaging.integration.transports.netty.NettyConnectorFactory"),
                                                        null,
                                                        ClientSessionFactoryImpl.DEFAULT_PING_PERIOD,                                                       
                                                        ClientSessionFactoryImpl.DEFAULT_CALL_TIMEOUT,

Modified: trunk/tests/jms-tests/src/org/jboss/test/messaging/jms/JMSTestCase.java
===================================================================
--- trunk/tests/jms-tests/src/org/jboss/test/messaging/jms/JMSTestCase.java	2008-11-11 12:27:28 UTC (rev 5338)
+++ trunk/tests/jms-tests/src/org/jboss/test/messaging/jms/JMSTestCase.java	2008-11-12 12:17:43 UTC (rev 5339)
@@ -38,7 +38,7 @@
       // both np and p messages are sent synchronously
 
       getJmsServerManager().createConnectionFactory("testsuitecf",
-                                                    new TransportConfiguration("org.jboss.messaging.core.remoting.impl.netty.NettyConnectorFactory"),
+                                                    new TransportConfiguration("org.jboss.messaging.integration.transports.netty.NettyConnectorFactory"),
                                                     null,
                                                     ClientSessionFactoryImpl.DEFAULT_PING_PERIOD,                                                       
                                                     ClientSessionFactoryImpl.DEFAULT_CALL_TIMEOUT,

Modified: trunk/tests/jms-tests/src/org/jboss/test/messaging/tools/ServerManagement.java
===================================================================
--- trunk/tests/jms-tests/src/org/jboss/test/messaging/tools/ServerManagement.java	2008-11-11 12:27:28 UTC (rev 5338)
+++ trunk/tests/jms-tests/src/org/jboss/test/messaging/tools/ServerManagement.java	2008-11-12 12:17:43 UTC (rev 5339)
@@ -325,7 +325,7 @@
 
       String jgroupsBindAddr = bindAddress;
 
-      sb.append("-D").append(org.jgroups.Global.BIND_ADDR).append("=")
+      sb.append("-D").append("jgroups.bind_addr").append("=")
               .append(jgroupsBindAddr).append(' ');
 
       String database = System.getProperty("test.database");

Modified: trunk/tests/jms-tests/src/org/jboss/test/messaging/tools/container/LocalTestServer.java
===================================================================
--- trunk/tests/jms-tests/src/org/jboss/test/messaging/tools/container/LocalTestServer.java	2008-11-11 12:27:28 UTC (rev 5338)
+++ trunk/tests/jms-tests/src/org/jboss/test/messaging/tools/container/LocalTestServer.java	2008-11-12 12:17:43 UTC (rev 5339)
@@ -537,7 +537,7 @@
       log.info("deploying connection factory with name: " + objectName + " and dupsok: " + dupsOkBatchSize);
                   
       getJMSServerManager().createConnectionFactory(objectName,
-                                                    new TransportConfiguration("org.jboss.messaging.core.remoting.impl.netty.NettyConnectorFactory"),
+                                                    new TransportConfiguration("org.jboss.messaging.integration.transports.netty.NettyConnectorFactory"),
                                                     null,
                                                     ClientSessionFactoryImpl.DEFAULT_PING_PERIOD,                                                       
                                                     ClientSessionFactoryImpl.DEFAULT_CALL_TIMEOUT,

Modified: trunk/tests/src/org/jboss/messaging/tests/integration/base/IntegrationTestBase.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/base/IntegrationTestBase.java	2008-11-11 12:27:28 UTC (rev 5338)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/base/IntegrationTestBase.java	2008-11-12 12:17:43 UTC (rev 5339)
@@ -36,8 +36,8 @@
 import org.jboss.messaging.core.config.impl.ConfigurationImpl;
 import org.jboss.messaging.core.remoting.impl.invm.InVMAcceptorFactory;
 import org.jboss.messaging.core.remoting.impl.invm.InVMConnectorFactory;
-import org.jboss.messaging.core.remoting.impl.netty.NettyAcceptorFactory;
-import org.jboss.messaging.core.remoting.impl.netty.NettyConnectorFactory;
+import org.jboss.messaging.integration.transports.netty.NettyAcceptorFactory;
+import org.jboss.messaging.integration.transports.netty.NettyConnectorFactory;
 import org.jboss.messaging.core.server.MessagingService;
 import org.jboss.messaging.core.server.impl.MessagingServiceImpl;
 import org.jboss.messaging.core.settings.impl.QueueSettings;

Modified: trunk/tests/src/org/jboss/messaging/tests/integration/basic/CoreClientTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/basic/CoreClientTest.java	2008-11-11 12:27:28 UTC (rev 5338)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/basic/CoreClientTest.java	2008-11-12 12:17:43 UTC (rev 5339)
@@ -57,8 +57,8 @@
 
    public void testCoreClient() throws Exception
    {
-      testCoreClient("org.jboss.messaging.core.remoting.impl.mina.MinaAcceptorFactory", "org.jboss.messaging.core.remoting.impl.mina.MinaConnectorFactory");
-      testCoreClient("org.jboss.messaging.core.remoting.impl.netty.NettyAcceptorFactory", "org.jboss.messaging.core.remoting.impl.netty.NettyConnectorFactory");
+      testCoreClient("org.jboss.messaging.integration.transports.mina.MinaAcceptorFactory", "org.jboss.messaging.integration.transports.mina.MinaConnectorFactory");
+      testCoreClient("org.jboss.messaging.integration.transports.netty.NettyAcceptorFactory", "org.jboss.messaging.integration.transports.netty.NettyConnectorFactory");
       testCoreClient("org.jboss.messaging.core.remoting.impl.invm.InVMAcceptorFactory", "org.jboss.messaging.core.remoting.impl.invm.InVMConnectorFactory");
    }
    

Modified: trunk/tests/src/org/jboss/messaging/tests/integration/clientcrash/ClientCrashTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/clientcrash/ClientCrashTest.java	2008-11-11 12:27:28 UTC (rev 5338)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/clientcrash/ClientCrashTest.java	2008-11-12 12:17:43 UTC (rev 5339)
@@ -156,11 +156,11 @@
       ConfigurationImpl config = new ConfigurationImpl();
       config.setSecurityEnabled(false);
       config.getAcceptorConfigurations()
-            .add(new TransportConfiguration("org.jboss.messaging.core.remoting.impl.netty.NettyAcceptorFactory"));
+            .add(new TransportConfiguration("org.jboss.messaging.integration.transports.netty.NettyAcceptorFactory"));
       messagingService = MessagingServiceImpl.newNullStorageMessagingServer(config);
       messagingService.start();
 
-      sf = new ClientSessionFactoryImpl(new TransportConfiguration("org.jboss.messaging.core.remoting.impl.netty.NettyConnectorFactory"),
+      sf = new ClientSessionFactoryImpl(new TransportConfiguration("org.jboss.messaging.integration.transports.netty.NettyConnectorFactory"),
                                         null,
                                         2000,
                                         DEFAULT_CALL_TIMEOUT,

Modified: trunk/tests/src/org/jboss/messaging/tests/integration/clientcrash/ClientExitTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/clientcrash/ClientExitTest.java	2008-11-11 12:27:28 UTC (rev 5338)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/clientcrash/ClientExitTest.java	2008-11-12 12:17:43 UTC (rev 5339)
@@ -100,11 +100,11 @@
    {
       ConfigurationImpl config = new ConfigurationImpl();
       config.setSecurityEnabled(false);
-      config.getAcceptorConfigurations().add(new TransportConfiguration("org.jboss.messaging.core.remoting.impl.netty.NettyAcceptorFactory"));
+      config.getAcceptorConfigurations().add(new TransportConfiguration("org.jboss.messaging.integration.transports.netty.NettyAcceptorFactory"));
       messagingService = MessagingServiceImpl.newNullStorageMessagingServer(config);
       messagingService.start();
 
-      ClientSessionFactory sf = new ClientSessionFactoryImpl(new TransportConfiguration("org.jboss.messaging.core.remoting.impl.netty.NettyConnectorFactory"));
+      ClientSessionFactory sf = new ClientSessionFactoryImpl(new TransportConfiguration("org.jboss.messaging.integration.transports.netty.NettyConnectorFactory"));
       session = sf.createSession(false, true, true);
       session.createQueue(QUEUE, QUEUE, null, false, false);
       consumer = session.createConsumer(QUEUE);

Modified: trunk/tests/src/org/jboss/messaging/tests/integration/clientcrash/CrashClient.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/clientcrash/CrashClient.java	2008-11-11 12:27:28 UTC (rev 5338)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/clientcrash/CrashClient.java	2008-11-12 12:17:43 UTC (rev 5339)
@@ -69,7 +69,7 @@
 
          int numberOfConnections = Integer.parseInt(args[0]);
          
-         ClientSessionFactory sf = new ClientSessionFactoryImpl(new TransportConfiguration("org.jboss.messaging.core.remoting.impl.netty.NettyConnectorFactory"));
+         ClientSessionFactory sf = new ClientSessionFactoryImpl(new TransportConfiguration("org.jboss.messaging.integration.transports.netty.NettyConnectorFactory"));
          ClientSession session = sf.createSession(false, true, true);
          ClientProducer producer = session.createProducer(QUEUE);
          ClientConsumer consumer = session.createConsumer(QUEUE);

Modified: trunk/tests/src/org/jboss/messaging/tests/integration/clientcrash/GracefulClient.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/clientcrash/GracefulClient.java	2008-11-11 12:27:28 UTC (rev 5338)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/clientcrash/GracefulClient.java	2008-11-12 12:17:43 UTC (rev 5339)
@@ -56,7 +56,7 @@
    {
       try
       {
-         ClientSessionFactory sf = new ClientSessionFactoryImpl(new TransportConfiguration("org.jboss.messaging.core.remoting.impl.netty.NettyConnectorFactory"));         
+         ClientSessionFactory sf = new ClientSessionFactoryImpl(new TransportConfiguration("org.jboss.messaging.integration.transports.netty.NettyConnectorFactory"));         
          ClientSession session = sf.createSession(false, true, true);
          ClientProducer producer = session.createProducer(QUEUE);
          ClientConsumer consumer = session.createConsumer(QUEUE);

Modified: trunk/tests/src/org/jboss/messaging/tests/integration/remoting/PingTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/remoting/PingTest.java	2008-11-11 12:27:28 UTC (rev 5338)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/remoting/PingTest.java	2008-11-12 12:17:43 UTC (rev 5339)
@@ -39,7 +39,7 @@
 import org.jboss.messaging.core.remoting.RemotingConnection;
 import org.jboss.messaging.core.remoting.impl.ConnectionManagerImpl;
 import org.jboss.messaging.core.remoting.impl.RemotingConnectionImpl;
-import org.jboss.messaging.core.remoting.impl.netty.NettyConnectorFactory;
+import org.jboss.messaging.integration.transports.netty.NettyConnectorFactory;
 import org.jboss.messaging.core.remoting.impl.wireformat.PacketImpl;
 import org.jboss.messaging.core.remoting.spi.ConnectorFactory;
 import org.jboss.messaging.core.server.MessagingService;
@@ -74,7 +74,7 @@
    protected void setUp() throws Exception
    {
       ConfigurationImpl config = new ConfigurationImpl();
-      config.getAcceptorConfigurations().add(new TransportConfiguration("org.jboss.messaging.core.remoting.impl.netty.NettyAcceptorFactory"));
+      config.getAcceptorConfigurations().add(new TransportConfiguration("org.jboss.messaging.integration.transports.netty.NettyAcceptorFactory"));
       messagingService = MessagingServiceImpl.newNullStorageMessagingServer(config);
       messagingService.start();
    }

Modified: trunk/tests/src/org/jboss/messaging/tests/integration/ssl/CoreClientOverSSL.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/ssl/CoreClientOverSSL.java	2008-11-11 12:27:28 UTC (rev 5338)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/ssl/CoreClientOverSSL.java	2008-11-12 12:17:43 UTC (rev 5339)
@@ -31,7 +31,7 @@
 import org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl;
 import org.jboss.messaging.core.config.TransportConfiguration;
 import org.jboss.messaging.core.logging.Logger;
-import org.jboss.messaging.core.remoting.impl.netty.TransportConstants;
+import org.jboss.messaging.integration.transports.netty.TransportConstants;
 import org.jboss.messaging.jms.client.JBossTextMessage;
 
 /**
@@ -68,7 +68,7 @@
          
          System.out.println("ssl enabled is " + sslEnabled);
         
-         ClientSessionFactory sf = new ClientSessionFactoryImpl(new TransportConfiguration("org.jboss.messaging.core.remoting.impl.netty.NettyConnectorFactory"));        
+         ClientSessionFactory sf = new ClientSessionFactoryImpl(new TransportConfiguration("org.jboss.messaging.integration.transports.netty.NettyConnectorFactory"));        
          sf.getTransportParams().put(TransportConstants.SSL_ENABLED_PROP_NAME, sslEnabled);
          ClientSession session = sf.createSession(false, true, true);
          ClientProducer producer = session.createProducer(CoreClientOverSSLTest.QUEUE);

Modified: trunk/tests/src/org/jboss/messaging/tests/integration/ssl/CoreClientOverSSLTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/ssl/CoreClientOverSSLTest.java	2008-11-11 12:27:28 UTC (rev 5338)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/ssl/CoreClientOverSSLTest.java	2008-11-12 12:17:43 UTC (rev 5339)
@@ -117,7 +117,7 @@
 //      config.setSecurityEnabled(false);
 //      Map<String, Object> params = new HashMap<String, Object>();
 //      params.put(TransportConstants.SSL_ENABLED_PROP_NAME, true);
-//      config.getAcceptorInfos().add(new TransportConfiguration("org.jboss.messaging.core.remoting.impl.netty.NettyAcceptorFactory", params));
+//      config.getAcceptorInfos().add(new TransportConfiguration("org.jboss.messaging.integration.transports.netty.NettyAcceptorFactory", params));
 //      messagingService = MessagingServiceImpl.newNullStorageMessagingServer(config);      
 //      messagingService.start();
 //      ConnectorFactory cf = new NettyConnectorFactory();

Modified: trunk/tests/src/org/jboss/messaging/tests/performance/persistence/StorageManagerTimingTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/performance/persistence/StorageManagerTimingTest.java	2008-11-11 12:27:28 UTC (rev 5338)
+++ trunk/tests/src/org/jboss/messaging/tests/performance/persistence/StorageManagerTimingTest.java	2008-11-12 12:17:43 UTC (rev 5339)
@@ -32,7 +32,7 @@
 import org.jboss.messaging.core.logging.Logger;
 import org.jboss.messaging.core.persistence.impl.journal.JournalStorageManager;
 import org.jboss.messaging.core.remoting.impl.ByteBufferWrapper;
-import org.jboss.messaging.core.remoting.impl.mina.IoBufferWrapper;
+import org.jboss.messaging.integration.transports.mina.IoBufferWrapper;
 import org.jboss.messaging.core.server.JournalType;
 import org.jboss.messaging.core.server.Queue;
 import org.jboss.messaging.core.server.impl.ServerMessageImpl;

Modified: trunk/tests/src/org/jboss/messaging/tests/unit/core/message/impl/MessageImplTestBase.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/unit/core/message/impl/MessageImplTestBase.java	2008-11-11 12:27:28 UTC (rev 5338)
+++ trunk/tests/src/org/jboss/messaging/tests/unit/core/message/impl/MessageImplTestBase.java	2008-11-12 12:17:43 UTC (rev 5339)
@@ -39,7 +39,7 @@
 import org.jboss.messaging.core.logging.Logger;
 import org.jboss.messaging.core.message.Message;
 import org.jboss.messaging.core.remoting.impl.ByteBufferWrapper;
-import org.jboss.messaging.core.remoting.impl.mina.IoBufferWrapper;
+import org.jboss.messaging.integration.transports.mina.IoBufferWrapper;
 import org.jboss.messaging.core.remoting.spi.MessagingBuffer;
 import org.jboss.messaging.core.server.impl.ServerMessageImpl;
 import org.jboss.messaging.tests.util.UnitTestCase;

Modified: trunk/tests/src/org/jboss/messaging/tests/unit/core/remoting/impl/mina/IoBufferWrapper2Test.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/unit/core/remoting/impl/mina/IoBufferWrapper2Test.java	2008-11-11 12:27:28 UTC (rev 5338)
+++ trunk/tests/src/org/jboss/messaging/tests/unit/core/remoting/impl/mina/IoBufferWrapper2Test.java	2008-11-12 12:17:43 UTC (rev 5339)
@@ -22,7 +22,7 @@
 
 package org.jboss.messaging.tests.unit.core.remoting.impl.mina;
 
-import org.jboss.messaging.core.remoting.impl.mina.IoBufferWrapper;
+import org.jboss.messaging.integration.transports.mina.IoBufferWrapper;
 import org.jboss.messaging.core.remoting.spi.MessagingBuffer;
 import org.jboss.messaging.tests.unit.core.remoting.MessagingBufferTestBase;
 

Modified: trunk/tests/src/org/jboss/messaging/tests/unit/core/remoting/impl/mina/IoBufferWrapperTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/unit/core/remoting/impl/mina/IoBufferWrapperTest.java	2008-11-11 12:27:28 UTC (rev 5338)
+++ trunk/tests/src/org/jboss/messaging/tests/unit/core/remoting/impl/mina/IoBufferWrapperTest.java	2008-11-12 12:17:43 UTC (rev 5339)
@@ -23,7 +23,7 @@
 package org.jboss.messaging.tests.unit.core.remoting.impl.mina;
 
 import org.apache.mina.core.buffer.IoBuffer;
-import org.jboss.messaging.core.remoting.impl.mina.IoBufferWrapper;
+import org.jboss.messaging.integration.transports.mina.IoBufferWrapper;
 import org.jboss.messaging.core.remoting.spi.MessagingBuffer;
 import org.jboss.messaging.tests.unit.core.remoting.MessagingBufferTestBase;
 

Modified: trunk/tests/src/org/jboss/messaging/tests/unit/core/remoting/impl/mina/MessagingIOSessionDataStructureFactoryTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/unit/core/remoting/impl/mina/MessagingIOSessionDataStructureFactoryTest.java	2008-11-11 12:27:28 UTC (rev 5338)
+++ trunk/tests/src/org/jboss/messaging/tests/unit/core/remoting/impl/mina/MessagingIOSessionDataStructureFactoryTest.java	2008-11-12 12:17:43 UTC (rev 5339)
@@ -30,7 +30,7 @@
 
 import org.apache.mina.core.session.IoSession;
 import org.apache.mina.core.session.IoSessionAttributeMap;
-import org.jboss.messaging.core.remoting.impl.mina.MessagingIOSessionDataStructureFactory;
+import org.jboss.messaging.integration.transports.mina.MessagingIOSessionDataStructureFactory;
 
 /**
  * @author <a href="mailto:jmesnil at redhat.com">Jeff Mesnil</a>

Modified: trunk/tests/src/org/jboss/messaging/tests/unit/core/remoting/impl/mina/MinaAcceptorFactoryTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/unit/core/remoting/impl/mina/MinaAcceptorFactoryTest.java	2008-11-11 12:27:28 UTC (rev 5338)
+++ trunk/tests/src/org/jboss/messaging/tests/unit/core/remoting/impl/mina/MinaAcceptorFactoryTest.java	2008-11-12 12:17:43 UTC (rev 5339)
@@ -25,8 +25,8 @@
 import java.util.Map;
 
 import org.easymock.EasyMock;
-import org.jboss.messaging.core.remoting.impl.mina.MinaAcceptor;
-import org.jboss.messaging.core.remoting.impl.mina.MinaAcceptorFactory;
+import org.jboss.messaging.integration.transports.mina.MinaAcceptor;
+import org.jboss.messaging.integration.transports.mina.MinaAcceptorFactory;
 import org.jboss.messaging.core.remoting.spi.Acceptor;
 import org.jboss.messaging.core.remoting.spi.BufferHandler;
 import org.jboss.messaging.core.remoting.spi.ConnectionLifeCycleListener;

Modified: trunk/tests/src/org/jboss/messaging/tests/unit/core/remoting/impl/mina/MinaAcceptorTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/unit/core/remoting/impl/mina/MinaAcceptorTest.java	2008-11-11 12:27:28 UTC (rev 5338)
+++ trunk/tests/src/org/jboss/messaging/tests/unit/core/remoting/impl/mina/MinaAcceptorTest.java	2008-11-12 12:17:43 UTC (rev 5339)
@@ -28,7 +28,7 @@
 import org.easymock.EasyMock;
 import org.jboss.messaging.core.config.Configuration;
 import org.jboss.messaging.core.config.impl.ConfigurationImpl;
-import org.jboss.messaging.core.remoting.impl.mina.MinaAcceptor;
+import org.jboss.messaging.integration.transports.mina.MinaAcceptor;
 import org.jboss.messaging.core.remoting.spi.BufferHandler;
 import org.jboss.messaging.core.remoting.spi.ConnectionLifeCycleListener;
 import org.jboss.messaging.tests.util.UnitTestCase;

Modified: trunk/tests/src/org/jboss/messaging/tests/unit/core/remoting/impl/mina/MinaConnectionTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/unit/core/remoting/impl/mina/MinaConnectionTest.java	2008-11-11 12:27:28 UTC (rev 5338)
+++ trunk/tests/src/org/jboss/messaging/tests/unit/core/remoting/impl/mina/MinaConnectionTest.java	2008-11-12 12:17:43 UTC (rev 5339)
@@ -23,7 +23,7 @@
 
 import org.apache.mina.core.session.IoSession;
 import org.easymock.EasyMock;
-import org.jboss.messaging.core.remoting.impl.mina.MinaConnection;
+import org.jboss.messaging.integration.transports.mina.MinaConnection;
 import org.jboss.messaging.core.remoting.spi.MessagingBuffer;
 import org.jboss.messaging.tests.util.UnitTestCase;
 

Modified: trunk/tests/src/org/jboss/messaging/tests/unit/core/remoting/impl/mina/MinaConnectorTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/unit/core/remoting/impl/mina/MinaConnectorTest.java	2008-11-11 12:27:28 UTC (rev 5338)
+++ trunk/tests/src/org/jboss/messaging/tests/unit/core/remoting/impl/mina/MinaConnectorTest.java	2008-11-12 12:17:43 UTC (rev 5339)
@@ -26,7 +26,7 @@
 import java.util.Map;
 
 import org.easymock.EasyMock;
-import org.jboss.messaging.core.remoting.impl.mina.MinaConnector;
+import org.jboss.messaging.integration.transports.mina.MinaConnector;
 import org.jboss.messaging.core.remoting.spi.BufferHandler;
 import org.jboss.messaging.core.remoting.spi.ConnectionLifeCycleListener;
 import org.jboss.messaging.tests.util.UnitTestCase;

Modified: trunk/tests/src/org/jboss/messaging/tests/unit/core/remoting/impl/netty/ChannelBufferWrapper2Test.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/unit/core/remoting/impl/netty/ChannelBufferWrapper2Test.java	2008-11-11 12:27:28 UTC (rev 5338)
+++ trunk/tests/src/org/jboss/messaging/tests/unit/core/remoting/impl/netty/ChannelBufferWrapper2Test.java	2008-11-12 12:17:43 UTC (rev 5339)
@@ -22,7 +22,7 @@
 
 package org.jboss.messaging.tests.unit.core.remoting.impl.netty;
 
-import org.jboss.messaging.core.remoting.impl.netty.ChannelBufferWrapper;
+import org.jboss.messaging.integration.transports.netty.ChannelBufferWrapper;
 import org.jboss.messaging.core.remoting.spi.MessagingBuffer;
 import org.jboss.messaging.tests.unit.core.remoting.MessagingBufferTestBase;
 

Modified: trunk/tests/src/org/jboss/messaging/tests/unit/core/remoting/impl/netty/ChannelBufferWrapperTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/unit/core/remoting/impl/netty/ChannelBufferWrapperTest.java	2008-11-11 12:27:28 UTC (rev 5338)
+++ trunk/tests/src/org/jboss/messaging/tests/unit/core/remoting/impl/netty/ChannelBufferWrapperTest.java	2008-11-12 12:17:43 UTC (rev 5339)
@@ -22,7 +22,7 @@
 
 package org.jboss.messaging.tests.unit.core.remoting.impl.netty;
 
-import org.jboss.messaging.core.remoting.impl.netty.ChannelBufferWrapper;
+import org.jboss.messaging.integration.transports.netty.ChannelBufferWrapper;
 import org.jboss.messaging.core.remoting.spi.MessagingBuffer;
 import org.jboss.messaging.tests.unit.core.remoting.MessagingBufferTestBase;
 import org.jboss.netty.buffer.ChannelBuffer;

Modified: trunk/tests/src/org/jboss/messaging/tests/unit/core/remoting/impl/netty/NettyAcceptorFactoryTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/unit/core/remoting/impl/netty/NettyAcceptorFactoryTest.java	2008-11-11 12:27:28 UTC (rev 5338)
+++ trunk/tests/src/org/jboss/messaging/tests/unit/core/remoting/impl/netty/NettyAcceptorFactoryTest.java	2008-11-12 12:17:43 UTC (rev 5339)
@@ -25,8 +25,8 @@
 import java.util.Map;
 
 import org.easymock.EasyMock;
-import org.jboss.messaging.core.remoting.impl.netty.NettyAcceptor;
-import org.jboss.messaging.core.remoting.impl.netty.NettyAcceptorFactory;
+import org.jboss.messaging.integration.transports.netty.NettyAcceptor;
+import org.jboss.messaging.integration.transports.netty.NettyAcceptorFactory;
 import org.jboss.messaging.core.remoting.spi.Acceptor;
 import org.jboss.messaging.core.remoting.spi.BufferHandler;
 import org.jboss.messaging.core.remoting.spi.ConnectionLifeCycleListener;

Modified: trunk/tests/src/org/jboss/messaging/tests/unit/core/remoting/impl/netty/NettyAcceptorTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/unit/core/remoting/impl/netty/NettyAcceptorTest.java	2008-11-11 12:27:28 UTC (rev 5338)
+++ trunk/tests/src/org/jboss/messaging/tests/unit/core/remoting/impl/netty/NettyAcceptorTest.java	2008-11-12 12:17:43 UTC (rev 5339)
@@ -26,7 +26,7 @@
 import java.util.Map;
 
 import org.easymock.EasyMock;
-import org.jboss.messaging.core.remoting.impl.netty.NettyAcceptor;
+import org.jboss.messaging.integration.transports.netty.NettyAcceptor;
 import org.jboss.messaging.core.remoting.spi.BufferHandler;
 import org.jboss.messaging.core.remoting.spi.ConnectionLifeCycleListener;
 import org.jboss.messaging.tests.util.UnitTestCase;

Modified: trunk/tests/src/org/jboss/messaging/tests/unit/core/remoting/impl/netty/NettyConnectionTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/unit/core/remoting/impl/netty/NettyConnectionTest.java	2008-11-11 12:27:28 UTC (rev 5338)
+++ trunk/tests/src/org/jboss/messaging/tests/unit/core/remoting/impl/netty/NettyConnectionTest.java	2008-11-12 12:17:43 UTC (rev 5339)
@@ -24,7 +24,7 @@
 import java.util.UUID;
 
 import org.easymock.EasyMock;
-import org.jboss.messaging.core.remoting.impl.netty.NettyConnection;
+import org.jboss.messaging.integration.transports.netty.NettyConnection;
 import org.jboss.messaging.core.remoting.spi.MessagingBuffer;
 import org.jboss.messaging.tests.util.UnitTestCase;
 import org.jboss.netty.channel.Channel;

Modified: trunk/tests/src/org/jboss/messaging/tests/unit/core/remoting/impl/netty/NettyConnectorTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/unit/core/remoting/impl/netty/NettyConnectorTest.java	2008-11-11 12:27:28 UTC (rev 5338)
+++ trunk/tests/src/org/jboss/messaging/tests/unit/core/remoting/impl/netty/NettyConnectorTest.java	2008-11-12 12:17:43 UTC (rev 5339)
@@ -26,7 +26,7 @@
 import java.util.Map;
 
 import org.easymock.EasyMock;
-import org.jboss.messaging.core.remoting.impl.netty.NettyConnector;
+import org.jboss.messaging.integration.transports.netty.NettyConnector;
 import org.jboss.messaging.core.remoting.spi.BufferHandler;
 import org.jboss.messaging.core.remoting.spi.ConnectionLifeCycleListener;
 import org.jboss.messaging.tests.util.UnitTestCase;

Modified: trunk/tests/src/org/jboss/messaging/tests/unit/core/security/impl/JBossASSecurityManagerTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/unit/core/security/impl/JBossASSecurityManagerTest.java	2008-11-11 12:27:28 UTC (rev 5338)
+++ trunk/tests/src/org/jboss/messaging/tests/unit/core/security/impl/JBossASSecurityManagerTest.java	2008-11-12 12:17:43 UTC (rev 5339)
@@ -33,7 +33,7 @@
 import org.easymock.IArgumentMatcher;
 import org.jboss.messaging.core.security.CheckType;
 import org.jboss.messaging.core.security.Role;
-import org.jboss.messaging.core.security.impl.JBossASSecurityManager;
+import org.jboss.messaging.integration.security.JBossASSecurityManager;
 import org.jboss.security.AuthenticationManager;
 import org.jboss.security.RealmMapping;
 import org.jboss.security.SimplePrincipal;

Modified: trunk/tests/src/org/jboss/messaging/tests/unit/jms/misc/ManifestTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/unit/jms/misc/ManifestTest.java	2008-11-11 12:27:28 UTC (rev 5338)
+++ trunk/tests/src/org/jboss/messaging/tests/unit/jms/misc/ManifestTest.java	2008-11-12 12:17:43 UTC (rev 5339)
@@ -66,7 +66,7 @@
       log.trace("userDir is " + userDir);
 
       // The jar must be there
-      File file = new File("build/jars", "jboss-messaging.jar");
+      File file = new File("build/jars", "jbm-core.jar");
       assertTrue(file.exists());
 
       // Open the jar and load MANIFEST.MF

Modified: trunk/tests/src/org/jboss/messaging/tests/unit/util/TypedPropertiesTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/unit/util/TypedPropertiesTest.java	2008-11-11 12:27:28 UTC (rev 5338)
+++ trunk/tests/src/org/jboss/messaging/tests/unit/util/TypedPropertiesTest.java	2008-11-12 12:17:43 UTC (rev 5339)
@@ -38,7 +38,7 @@
 
 import junit.framework.TestCase;
 
-import org.jboss.messaging.core.remoting.impl.mina.IoBufferWrapper;
+import org.jboss.messaging.integration.transports.mina.IoBufferWrapper;
 import org.jboss.messaging.core.remoting.spi.MessagingBuffer;
 import org.jboss.messaging.tests.util.UnitTestCase;
 import org.jboss.messaging.util.SimpleString;




More information about the jboss-cvs-commits mailing list