[jboss-cvs] JBoss Messaging SVN: r5812 - in trunk/dotnet: JBMClient and 10 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Wed Feb 4 20:20:31 EST 2009


Author: clebert.suconic at jboss.com
Date: 2009-02-04 20:20:31 -0500 (Wed, 04 Feb 2009)
New Revision: 5812

Added:
   trunk/dotnet/JBMClient/JBM.Client.csproj
   trunk/dotnet/JBMClient/exception/
   trunk/dotnet/JBMClient/exception/MessagingException.cs
   trunk/dotnet/JBMClient/remoting/
   trunk/dotnet/JBMClient/remoting/Acceptor.java
   trunk/dotnet/JBMClient/remoting/AcceptorFactory.java
   trunk/dotnet/JBMClient/remoting/BufferHandler.java
   trunk/dotnet/JBMClient/remoting/Channel.cs
   trunk/dotnet/JBMClient/remoting/ChannelHandler.cs
   trunk/dotnet/JBMClient/remoting/Connection.java
   trunk/dotnet/JBMClient/remoting/ConnectionLifeCycleListener.java
   trunk/dotnet/JBMClient/remoting/Connector.java
   trunk/dotnet/JBMClient/remoting/ConnectorFactory.java
   trunk/dotnet/JBMClient/remoting/FailureListener.cs
   trunk/dotnet/JBMClient/remoting/Interceptor.cs
   trunk/dotnet/JBMClient/remoting/MessagingBuffer.java
   trunk/dotnet/JBMClient/remoting/Packet.cs
   trunk/dotnet/JBMClient/remoting/RemotingConnection.cs
   trunk/dotnet/JBMClient/remoting/impl/
   trunk/dotnet/JBMClient/remoting/impl/AbstractBufferHandler.java
   trunk/dotnet/JBMClient/remoting/impl/ByteBufferWrapper.java
   trunk/dotnet/JBMClient/remoting/impl/ExpandingMessagingBuffer.java
   trunk/dotnet/JBMClient/remoting/impl/RemotingConnectionImpl.java
   trunk/dotnet/JBMClient/remoting/impl/RemotingServiceImpl.java
   trunk/dotnet/JBMClient/remoting/impl/invm/
   trunk/dotnet/JBMClient/remoting/impl/invm/InVMAcceptor.java
   trunk/dotnet/JBMClient/remoting/impl/invm/InVMAcceptorFactory.java
   trunk/dotnet/JBMClient/remoting/impl/invm/InVMConnection.java
   trunk/dotnet/JBMClient/remoting/impl/invm/InVMConnector.java
   trunk/dotnet/JBMClient/remoting/impl/invm/InVMConnectorFactory.java
   trunk/dotnet/JBMClient/remoting/impl/invm/InVMRegistry.java
   trunk/dotnet/JBMClient/remoting/impl/invm/TransportConstants.java
   trunk/dotnet/JBMClient/remoting/impl/ssl/
   trunk/dotnet/JBMClient/remoting/impl/ssl/SSLSupport.java
   trunk/dotnet/JBMClient/remoting/impl/wireformat/
   trunk/dotnet/JBMClient/remoting/impl/wireformat/CreateSessionMessage.java
   trunk/dotnet/JBMClient/remoting/impl/wireformat/CreateSessionResponseMessage.java
   trunk/dotnet/JBMClient/remoting/impl/wireformat/MessagingExceptionMessage.java
   trunk/dotnet/JBMClient/remoting/impl/wireformat/NullResponseMessage.java
   trunk/dotnet/JBMClient/remoting/impl/wireformat/PacketImpl.java
   trunk/dotnet/JBMClient/remoting/impl/wireformat/PacketsConfirmedMessage.java
   trunk/dotnet/JBMClient/remoting/impl/wireformat/Ping.java
   trunk/dotnet/JBMClient/remoting/impl/wireformat/Pong.java
   trunk/dotnet/JBMClient/remoting/impl/wireformat/ReattachSessionMessage.java
   trunk/dotnet/JBMClient/remoting/impl/wireformat/ReattachSessionResponseMessage.java
   trunk/dotnet/JBMClient/remoting/impl/wireformat/ReplicateCreateSessionMessage.java
   trunk/dotnet/JBMClient/remoting/impl/wireformat/SessionAcknowledgeMessage.java
   trunk/dotnet/JBMClient/remoting/impl/wireformat/SessionAddDestinationMessage.java
   trunk/dotnet/JBMClient/remoting/impl/wireformat/SessionBindingQueryMessage.java
   trunk/dotnet/JBMClient/remoting/impl/wireformat/SessionBindingQueryResponseMessage.java
   trunk/dotnet/JBMClient/remoting/impl/wireformat/SessionCloseMessage.java
   trunk/dotnet/JBMClient/remoting/impl/wireformat/SessionConsumerCloseMessage.java
   trunk/dotnet/JBMClient/remoting/impl/wireformat/SessionConsumerFlowCreditMessage.java
   trunk/dotnet/JBMClient/remoting/impl/wireformat/SessionContinuationMessage.java
   trunk/dotnet/JBMClient/remoting/impl/wireformat/SessionCreateConsumerMessage.java
   trunk/dotnet/JBMClient/remoting/impl/wireformat/SessionCreateQueueMessage.java
   trunk/dotnet/JBMClient/remoting/impl/wireformat/SessionDeleteQueueMessage.java
   trunk/dotnet/JBMClient/remoting/impl/wireformat/SessionExpiredMessage.java
   trunk/dotnet/JBMClient/remoting/impl/wireformat/SessionFailoverCompleteMessage.java
   trunk/dotnet/JBMClient/remoting/impl/wireformat/SessionQueueQueryMessage.java
   trunk/dotnet/JBMClient/remoting/impl/wireformat/SessionQueueQueryResponseMessage.java
   trunk/dotnet/JBMClient/remoting/impl/wireformat/SessionReceiveContinuationMessage.java
   trunk/dotnet/JBMClient/remoting/impl/wireformat/SessionReceiveMessage.java
   trunk/dotnet/JBMClient/remoting/impl/wireformat/SessionRemoveDestinationMessage.java
   trunk/dotnet/JBMClient/remoting/impl/wireformat/SessionReplicateDeliveryMessage.java
   trunk/dotnet/JBMClient/remoting/impl/wireformat/SessionSendContinuationMessage.java
   trunk/dotnet/JBMClient/remoting/impl/wireformat/SessionSendMessage.java
   trunk/dotnet/JBMClient/remoting/impl/wireformat/SessionXACommitMessage.java
   trunk/dotnet/JBMClient/remoting/impl/wireformat/SessionXAEndMessage.java
   trunk/dotnet/JBMClient/remoting/impl/wireformat/SessionXAForgetMessage.java
   trunk/dotnet/JBMClient/remoting/impl/wireformat/SessionXAGetInDoubtXidsResponseMessage.java
   trunk/dotnet/JBMClient/remoting/impl/wireformat/SessionXAGetTimeoutResponseMessage.java
   trunk/dotnet/JBMClient/remoting/impl/wireformat/SessionXAJoinMessage.java
   trunk/dotnet/JBMClient/remoting/impl/wireformat/SessionXAPrepareMessage.java
   trunk/dotnet/JBMClient/remoting/impl/wireformat/SessionXAResponseMessage.java
   trunk/dotnet/JBMClient/remoting/impl/wireformat/SessionXAResumeMessage.java
   trunk/dotnet/JBMClient/remoting/impl/wireformat/SessionXARollbackMessage.java
   trunk/dotnet/JBMClient/remoting/impl/wireformat/SessionXASetTimeoutMessage.java
   trunk/dotnet/JBMClient/remoting/impl/wireformat/SessionXASetTimeoutResponseMessage.java
   trunk/dotnet/JBMClient/remoting/impl/wireformat/SessionXAStartMessage.java
   trunk/dotnet/JBMClient/remoting/impl/wireformat/XidCodecSupport.java
   trunk/dotnet/JBMClient/remoting/spi/
   trunk/dotnet/JBMClient/remoting/spi/Acceptor.java
   trunk/dotnet/JBMClient/remoting/spi/AcceptorFactory.java
   trunk/dotnet/JBMClient/remoting/spi/BufferHandler.cs
   trunk/dotnet/JBMClient/remoting/spi/Connection.java
   trunk/dotnet/JBMClient/remoting/spi/ConnectionLifeCycleListener.java
   trunk/dotnet/JBMClient/remoting/spi/Connector.java
   trunk/dotnet/JBMClient/remoting/spi/ConnectorFactory.java
   trunk/dotnet/JBMClient/remoting/spi/MessagingBuffer.cs
   trunk/dotnet/JBMClientTest/JBM.Client.Test.csproj
Removed:
   trunk/dotnet/JBMClient/JBMClient.csproj
   trunk/dotnet/JBMClientTest/JBMClientTest.csproj
Modified:
   trunk/dotnet/JBMClient/util/DataConstants.cs
   trunk/dotnet/JBMClient/util/SimpleString.cs
   trunk/dotnet/JBMClientSolution.sln
   trunk/dotnet/JBMClientTest/util/JBMTest.cs
   trunk/dotnet/JBMClientTest/util/SimpleStringTest.cs
Log:
Just a backup

Copied: trunk/dotnet/JBMClient/JBM.Client.csproj (from rev 5807, trunk/dotnet/JBMClient/JBMClient.csproj)
===================================================================
--- trunk/dotnet/JBMClient/JBM.Client.csproj	                        (rev 0)
+++ trunk/dotnet/JBMClient/JBM.Client.csproj	2009-02-05 01:20:31 UTC (rev 5812)
@@ -0,0 +1,90 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <PropertyGroup>
+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+    <ProductVersion>9.0.21022</ProductVersion>
+    <SchemaVersion>2.0</SchemaVersion>
+    <ProjectGuid>{675AD929-BF42-4930-AC39-603D5EC52D58}</ProjectGuid>
+    <OutputType>Library</OutputType>
+    <AppDesignerFolder>Properties</AppDesignerFolder>
+    <RootNamespace>JBM.Client</RootNamespace>
+    <AssemblyName>JBM.Client</AssemblyName>
+    <TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
+    <FileAlignment>512</FileAlignment>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+    <DebugSymbols>true</DebugSymbols>
+    <DebugType>full</DebugType>
+    <Optimize>false</Optimize>
+    <OutputPath>bin\Debug\</OutputPath>
+    <DefineConstants>DEBUG;TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+    <OutputType>Library</OutputType>
+    <AssemblyName>JBMClient</AssemblyName>
+    <RootNamespace>JBMClient</RootNamespace>
+    <AllowUnsafeBlocks>false</AllowUnsafeBlocks>
+    <CheckForOverflowUnderflow>true</CheckForOverflowUnderflow>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+    <DebugType>pdbonly</DebugType>
+    <Optimize>true</Optimize>
+    <OutputPath>bin\Release\</OutputPath>
+    <DefineConstants>TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+    <OutputType>Library</OutputType>
+    <AssemblyName>JBMClient</AssemblyName>
+    <DebugSymbols>true</DebugSymbols>
+    <RootNamespace>JBMClient</RootNamespace>
+    <AllowUnsafeBlocks>false</AllowUnsafeBlocks>
+    <CheckForOverflowUnderflow>true</CheckForOverflowUnderflow>
+  </PropertyGroup>
+  <ItemGroup>
+    <Reference Include="System" />
+    <Reference Include="System.Core">
+      <RequiredTargetFramework>3.5</RequiredTargetFramework>
+    </Reference>
+    <Reference Include="System.Xml.Linq">
+      <RequiredTargetFramework>3.5</RequiredTargetFramework>
+    </Reference>
+    <Reference Include="System.Data.DataSetExtensions">
+      <RequiredTargetFramework>3.5</RequiredTargetFramework>
+    </Reference>
+    <Reference Include="System.Data" />
+    <Reference Include="System.Xml" />
+  </ItemGroup>
+  <ItemGroup>
+    <Compile Include="exception\MessagingException.cs" />
+    <Compile Include="Properties\AssemblyInfo.cs" />
+    <Compile Include="remoting\Channel.cs" />
+    <Compile Include="remoting\ChannelHandler.cs" />
+    <Compile Include="util\DataConstants.cs" />
+    <Compile Include="util\SimpleString.cs" />
+  </ItemGroup>
+  <ItemGroup>
+    <Compile Include="remoting\FailureListener.cs" />
+    <Compile Include="remoting\Interceptor.cs" />
+    <Compile Include="remoting\Packet.cs" />
+  </ItemGroup>
+  <ItemGroup>
+    <Compile Include="remoting\RemotingConnection.cs" />
+    <Content Include="remoting\spi\Acceptor.java" />
+    <Content Include="remoting\spi\AcceptorFactory.java" />
+    <Compile Include="remoting\spi\BufferHandler.cs" />
+    <Content Include="remoting\spi\Connection.java" />
+    <Content Include="remoting\spi\ConnectionLifeCycleListener.java" />
+    <Content Include="remoting\spi\Connector.java" />
+    <Content Include="remoting\spi\ConnectorFactory.java" />
+    <Compile Include="remoting\spi\MessagingBuffer.cs" />
+  </ItemGroup>
+  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+  <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
+       Other similar extension points exist, see Microsoft.Common.targets.
+  <Target Name="BeforeBuild">
+  </Target>
+  <Target Name="AfterBuild">
+  </Target>
+  -->
+</Project>
\ No newline at end of file


Property changes on: trunk/dotnet/JBMClient/JBM.Client.csproj
___________________________________________________________________
Name: svn:mergeinfo
   + 

Deleted: trunk/dotnet/JBMClient/JBMClient.csproj
===================================================================
--- trunk/dotnet/JBMClient/JBMClient.csproj	2009-02-04 22:16:37 UTC (rev 5811)
+++ trunk/dotnet/JBMClient/JBMClient.csproj	2009-02-05 01:20:31 UTC (rev 5812)
@@ -1,71 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
-  <PropertyGroup>
-    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
-    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
-    <ProductVersion>9.0.21022</ProductVersion>
-    <SchemaVersion>2.0</SchemaVersion>
-    <ProjectGuid>{675AD929-BF42-4930-AC39-603D5EC52D58}</ProjectGuid>
-    <OutputType>Library</OutputType>
-    <AppDesignerFolder>Properties</AppDesignerFolder>
-    <RootNamespace>JSMClient</RootNamespace>
-    <AssemblyName>JSMClient</AssemblyName>
-    <TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
-    <FileAlignment>512</FileAlignment>
-  </PropertyGroup>
-  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
-    <DebugSymbols>true</DebugSymbols>
-    <DebugType>full</DebugType>
-    <Optimize>false</Optimize>
-    <OutputPath>bin\Debug\</OutputPath>
-    <DefineConstants>DEBUG;TRACE</DefineConstants>
-    <ErrorReport>prompt</ErrorReport>
-    <WarningLevel>4</WarningLevel>
-    <OutputType>Library</OutputType>
-    <AssemblyName>JSMClient</AssemblyName>
-    <RootNamespace>JSMClient</RootNamespace>
-    <AllowUnsafeBlocks>false</AllowUnsafeBlocks>
-    <CheckForOverflowUnderflow>true</CheckForOverflowUnderflow>
-  </PropertyGroup>
-  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
-    <DebugType>pdbonly</DebugType>
-    <Optimize>true</Optimize>
-    <OutputPath>bin\Release\</OutputPath>
-    <DefineConstants>TRACE</DefineConstants>
-    <ErrorReport>prompt</ErrorReport>
-    <WarningLevel>4</WarningLevel>
-    <OutputType>Library</OutputType>
-    <AssemblyName>JSMClient</AssemblyName>
-    <DebugSymbols>true</DebugSymbols>
-    <RootNamespace>JSMClient</RootNamespace>
-    <AllowUnsafeBlocks>false</AllowUnsafeBlocks>
-    <CheckForOverflowUnderflow>true</CheckForOverflowUnderflow>
-  </PropertyGroup>
-  <ItemGroup>
-    <Reference Include="System" />
-    <Reference Include="System.Core">
-      <RequiredTargetFramework>3.5</RequiredTargetFramework>
-    </Reference>
-    <Reference Include="System.Xml.Linq">
-      <RequiredTargetFramework>3.5</RequiredTargetFramework>
-    </Reference>
-    <Reference Include="System.Data.DataSetExtensions">
-      <RequiredTargetFramework>3.5</RequiredTargetFramework>
-    </Reference>
-    <Reference Include="System.Data" />
-    <Reference Include="System.Xml" />
-  </ItemGroup>
-  <ItemGroup>
-    <Compile Include="Properties\AssemblyInfo.cs" />
-    <Compile Include="util\DataConstants.cs" />
-    <Compile Include="util\SimpleString.cs" />
-  </ItemGroup>
-  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
-  <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
-       Other similar extension points exist, see Microsoft.Common.targets.
-  <Target Name="BeforeBuild">
-  </Target>
-  <Target Name="AfterBuild">
-  </Target>
-  -->
-</Project>
\ No newline at end of file

Added: trunk/dotnet/JBMClient/exception/MessagingException.cs
===================================================================
--- trunk/dotnet/JBMClient/exception/MessagingException.cs	                        (rev 0)
+++ trunk/dotnet/JBMClient/exception/MessagingException.cs	2009-02-05 01:20:31 UTC (rev 5812)
@@ -0,0 +1,77 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace JBoss.JBM.Client.exception
+{
+    public class MessagingException : Exception
+    {
+        // Error codes -------------------------------------------------
+
+        public const int INTERNAL_ERROR = 000;
+
+        public const int UNSUPPORTED_PACKET = 001;
+
+        public const int NOT_CONNECTED = 002;
+
+        public const int CONNECTION_TIMEDOUT = 003;
+
+        public const int INTERRUPTED = 004;
+
+
+        public const int QUEUE_DOES_NOT_EXIST = 100;
+
+        public const int QUEUE_EXISTS = 101;
+
+        public const int OBJECT_CLOSED = 102;
+
+        public const int INVALID_FILTER_EXPRESSION = 103;
+
+        public const int ILLEGAL_STATE = 104;
+
+        public const int SECURITY_EXCEPTION = 105;
+
+        public const int ADDRESS_DOES_NOT_EXIST = 106;
+
+        public const int ADDRESS_EXISTS = 107;
+
+        public const int INCOMPATIBLE_CLIENT_SERVER_VERSIONS = 108;
+
+        public const int SESSION_EXISTS = 109;
+
+        private int code;
+
+        public MessagingException()
+        {
+        }
+
+        public MessagingException(int code)
+        {
+            this.code = code;
+        }
+
+        public MessagingException(int code, String msg)
+            : base(msg)
+        {
+            this.code = code;
+        }
+
+        public MessagingException(int code, String msg, Exception cause)
+            : base(msg, cause)
+        {
+            this.code = code;
+        }
+
+        public int getCode()
+        {
+            return code;
+        }
+
+        public String toString()
+        {
+            return "MessagingException[errorCode=" + code + " message=" + this.Message + "]";
+        }
+
+    }
+}

Added: trunk/dotnet/JBMClient/remoting/Acceptor.java
===================================================================
--- trunk/dotnet/JBMClient/remoting/Acceptor.java	                        (rev 0)
+++ trunk/dotnet/JBMClient/remoting/Acceptor.java	2009-02-05 01:20:31 UTC (rev 5812)
@@ -0,0 +1,37 @@
+/*
+ * 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.remoting.spi;
+
+import org.jboss.messaging.core.server.MessagingComponent;
+
+/**
+ * An Acceptor is used tby the Remoting Service to allow clients to connect. It should take care of dispatchin client requests
+ * to the Remoting Service's Dispatcher.
+ *
+ * @author <a href="ataylor at redhat.com">Andy Taylor</a>
+ * @author <a href="tim.fox at jboss.com">Tim Fox</a>
+ */
+public interface Acceptor extends MessagingComponent
+{
+   void stop();
+}

Added: trunk/dotnet/JBMClient/remoting/AcceptorFactory.java
===================================================================
--- trunk/dotnet/JBMClient/remoting/AcceptorFactory.java	                        (rev 0)
+++ trunk/dotnet/JBMClient/remoting/AcceptorFactory.java	2009-02-05 01:20:31 UTC (rev 5812)
@@ -0,0 +1,36 @@
+/*
+ * 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.remoting.spi;
+
+import java.util.Map;
+
+/**
+ * @author <a href="ataylor at redhat.com">Andy Taylor</a>
+ * @author <a href="tim.fox at jboss.com">Tim Fox</a>
+ */
+public interface AcceptorFactory
+{
+   Acceptor createAcceptor(final Map<String, Object> configuration,
+                           BufferHandler handler,                        
+                           ConnectionLifeCycleListener listener);
+}

Added: trunk/dotnet/JBMClient/remoting/BufferHandler.java
===================================================================
--- trunk/dotnet/JBMClient/remoting/BufferHandler.java	                        (rev 0)
+++ trunk/dotnet/JBMClient/remoting/BufferHandler.java	2009-02-05 01:20:31 UTC (rev 5812)
@@ -0,0 +1,35 @@
+/*
+  * 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.core.remoting.spi;
+
+/**
+ * A BufferHandler
+ * 
+ * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
+ *
+ */
+public interface BufferHandler
+{
+   void bufferReceived(Object connectionID, MessagingBuffer buffer);
+   
+   int isReadyToHandle(MessagingBuffer buffer);
+}

Added: trunk/dotnet/JBMClient/remoting/Channel.cs
===================================================================
--- trunk/dotnet/JBMClient/remoting/Channel.cs	                        (rev 0)
+++ trunk/dotnet/JBMClient/remoting/Channel.cs	2009-02-05 01:20:31 UTC (rev 5812)
@@ -0,0 +1,78 @@
+/*
+ * 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.
+ */
+namespace JBoss.JBM.Client.remoting
+{
+
+
+    /**
+     * A Channel A Channel *does not* support concurrent access by more than one thread!
+     * 
+     * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
+     */
+    public interface Channel
+    {
+        long ID
+        {
+            get;
+        }
+
+        object Lock
+        {
+            get;
+        }
+
+        ChannelHandler Handler
+        {
+            set;
+        }
+
+
+        Channel ReplicatingChannel
+        {
+            get;
+        }
+
+        int LastReceivedCommandID
+        {
+            get;
+        }
+
+
+        void Send(Packet packet);
+
+        Packet SendBlocking(Packet packet);
+
+        // This is only used on server.
+        // Verify if there are possible future use for this
+        //DelayedResult PeplicatePacket(Packet packet);
+
+        //void ReplicateComplete();
+
+        void Close();
+
+        void TransferConnection(RemotingConnection newConnection);
+
+        void ReplayCommands(int lastReceivedCommandID);
+
+        void DoLock();
+
+        void DoUnlock();
+
+        void ReturnBlocking();
+
+        RemotingConnection getConnection();
+
+        void ReplicatingChannelDead();
+
+        void Confirm(Packet packet);
+    }
+}
\ No newline at end of file

Added: trunk/dotnet/JBMClient/remoting/ChannelHandler.cs
===================================================================
--- trunk/dotnet/JBMClient/remoting/ChannelHandler.cs	                        (rev 0)
+++ trunk/dotnet/JBMClient/remoting/ChannelHandler.cs	2009-02-05 01:20:31 UTC (rev 5812)
@@ -0,0 +1,34 @@
+/*
+  * 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.
+  */
+namespace JBoss.JBM.Client.remoting
+{
+    /**
+     * A ChannelHandler
+     * 
+     * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
+     *
+     */
+    public interface ChannelHandler
+    {
+        void HandlePacket(Packet packet);
+    }
+}
\ No newline at end of file

Added: trunk/dotnet/JBMClient/remoting/Connection.java
===================================================================
--- trunk/dotnet/JBMClient/remoting/Connection.java	                        (rev 0)
+++ trunk/dotnet/JBMClient/remoting/Connection.java	2009-02-05 01:20:31 UTC (rev 5812)
@@ -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.core.remoting.spi;
+
+
+
+/**
+ *
+ * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
+ *
+ * @version <tt>$Revision$</tt>
+ *
+ */
+public interface Connection
+{
+   MessagingBuffer createBuffer(int size);
+
+   Object getID();
+
+   void write(MessagingBuffer buffer);
+
+   void close();
+
+   String getRemoteAddress();
+}
\ No newline at end of file

Added: trunk/dotnet/JBMClient/remoting/ConnectionLifeCycleListener.java
===================================================================
--- trunk/dotnet/JBMClient/remoting/ConnectionLifeCycleListener.java	                        (rev 0)
+++ trunk/dotnet/JBMClient/remoting/ConnectionLifeCycleListener.java	2009-02-05 01:20:31 UTC (rev 5812)
@@ -0,0 +1,40 @@
+/*
+ * 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.remoting.spi;
+
+import org.jboss.messaging.core.exception.MessagingException;
+
+/**
+ *
+ * A ConnectionLifeCycleListener
+ *
+ * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
+ *
+ */
+public interface ConnectionLifeCycleListener
+{
+   void connectionCreated(Connection connection);
+
+   void connectionDestroyed(Object connectionID);
+
+   void connectionException(Object connectionID, MessagingException me);
+}

Added: trunk/dotnet/JBMClient/remoting/Connector.java
===================================================================
--- trunk/dotnet/JBMClient/remoting/Connector.java	                        (rev 0)
+++ trunk/dotnet/JBMClient/remoting/Connector.java	2009-02-05 01:20:31 UTC (rev 5812)
@@ -0,0 +1,48 @@
+/*
+ * 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.remoting.spi;
+
+/**
+ * 
+ * A Connector
+ * 
+ * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
+ *
+ */
+public interface Connector
+{
+   void start();
+   
+   void close();
+   
+   boolean isStarted();
+   
+   /**
+    * Create and return a connection from this connector.
+    * 
+    * This method must NOT throw an exception if it fails to create the connection
+    * (e.g. network is not available), in this case it MUST return null
+    * 
+    * @return The connection, or null if unable to create a connection (e.g. network is unavailable)
+    */
+   Connection createConnection();   
+}

Added: trunk/dotnet/JBMClient/remoting/ConnectorFactory.java
===================================================================
--- trunk/dotnet/JBMClient/remoting/ConnectorFactory.java	                        (rev 0)
+++ trunk/dotnet/JBMClient/remoting/ConnectorFactory.java	2009-02-05 01:20:31 UTC (rev 5812)
@@ -0,0 +1,16 @@
+package org.jboss.messaging.core.remoting.spi;
+
+import java.util.Map;
+
+/**
+ * 
+ * A ConnectorFactory
+ * 
+ * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
+ *
+ */
+public interface ConnectorFactory
+{
+   Connector createConnector(Map<String, Object> configuration, BufferHandler handler,                           
+                             ConnectionLifeCycleListener listener);
+}

Added: trunk/dotnet/JBMClient/remoting/FailureListener.cs
===================================================================
--- trunk/dotnet/JBMClient/remoting/FailureListener.cs	                        (rev 0)
+++ trunk/dotnet/JBMClient/remoting/FailureListener.cs	2009-02-05 01:20:31 UTC (rev 5812)
@@ -0,0 +1,40 @@
+/*
+ * 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.
+ */
+
+
+namespace JBoss.JBM.Client.remoting
+{
+    using JBoss.JBM.Client.exception;
+
+    /**
+     * 
+     * A FailureListener
+     * 
+     * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
+     * @author <a href="mailto:jmesnil at redhat.com">Jeff Mesnil</a>
+     * 
+     */
+    public interface FailureListener
+    {
+        bool connectionFailed(MessagingException me);
+    }
+}
\ No newline at end of file

Added: trunk/dotnet/JBMClient/remoting/Interceptor.cs
===================================================================
--- trunk/dotnet/JBMClient/remoting/Interceptor.cs	                        (rev 0)
+++ trunk/dotnet/JBMClient/remoting/Interceptor.cs	2009-02-05 01:20:31 UTC (rev 5812)
@@ -0,0 +1,46 @@
+/*
+ * 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.
+ */
+
+namespace JBoss.JBM.Client.remoting
+{
+    /**
+     *
+     * This is class is a simple way to intercepting server calls on JBoss Messaging.
+     * 
+     * To Add this interceptor, you have to modify jbm-configuration.xml
+     * 
+     * @author clebert.suconic at jboss.com
+     * @author tim.fox at jboss.com
+     */
+    public interface Interceptor
+    {
+        /**
+         * 
+         * @param packet
+         * @param connection
+         * @return true to process the next interceptor and handle the packet,
+         *         false to abort processing of the packet
+         * @throws MessagingException
+         */
+        bool intercept(Packet packet, RemotingConnection connection);
+    }
+}
\ No newline at end of file

Added: trunk/dotnet/JBMClient/remoting/MessagingBuffer.java
===================================================================
--- trunk/dotnet/JBMClient/remoting/MessagingBuffer.java	                        (rev 0)
+++ trunk/dotnet/JBMClient/remoting/MessagingBuffer.java	2009-02-05 01:20:31 UTC (rev 5812)
@@ -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.core.remoting.spi;
+
+import org.jboss.messaging.util.SimpleString;
+
+/**
+ *
+ * A MessagingBuffer
+ *
+ * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
+ *
+ */
+public interface MessagingBuffer
+{
+   void putByte(byte val);
+
+   void putBytes(byte[] bytes);
+
+   void putBytes(byte[] bytes, int offset, int length);
+
+   void putInt(int val);
+
+   void putInt(int pos, int val);
+
+   void putLong(long val);
+
+   void putShort(short val);
+
+   void putDouble(double val);
+
+   void putFloat(float val);
+
+   void putBoolean(boolean val);
+
+   void putChar(char val);
+
+   void putNullableString(String val);
+
+   void putString(String val);
+
+   void putSimpleString(SimpleString val);
+
+   void putNullableSimpleString(SimpleString val);
+
+   void putUTF(String utf) throws Exception;
+
+   byte getByte();
+
+   short getUnsignedByte();
+
+   void getBytes(byte[] bytes);
+
+   void getBytes(byte[] bytes, int offset, int length);
+
+   int getInt();
+
+   long getLong();
+
+   short getShort();
+
+   int getUnsignedShort();
+
+   double getDouble();
+
+   float getFloat();
+
+   boolean getBoolean();
+
+   char getChar();
+
+   String getString();
+
+   String getNullableString();
+
+   SimpleString getSimpleString();
+
+   SimpleString getNullableSimpleString();
+
+   String getUTF() throws Exception;
+
+   byte[] array();
+
+   int remaining();
+
+   int capacity();
+
+   int limit();
+
+   void limit(int limit);
+
+   void flip();
+
+   void position(int position);
+
+   int position();
+
+   void rewind();
+
+   MessagingBuffer slice();
+
+   MessagingBuffer createNewBuffer(int len);
+
+   Object getUnderlyingBuffer();
+}

Added: trunk/dotnet/JBMClient/remoting/Packet.cs
===================================================================
--- trunk/dotnet/JBMClient/remoting/Packet.cs	                        (rev 0)
+++ trunk/dotnet/JBMClient/remoting/Packet.cs	2009-02-05 01:20:31 UTC (rev 5812)
@@ -0,0 +1,78 @@
+/*
+ * 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.
+ */
+
+namespace JBoss.JBM.Client.remoting
+{
+    using JBoss.JBM.Client.remoting.spi;
+
+    /**
+     * 
+     * A Packet
+     * 
+     * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
+     *
+     */
+    public interface Packet
+    {
+        long ChannelID
+        {
+            get;
+            set;
+        }
+
+        bool Response
+        {
+            set;
+            get;
+        }
+
+
+        byte Type
+        {
+            get;
+        }
+
+        int Encode(MessagingBuffer buffer);
+
+        void Decode(MessagingBuffer buffer);
+
+        int PacketSize
+        {
+            get;
+        }
+
+        int RequiredBufferSize
+        {
+            get;
+        }
+
+        bool RequiresConfirmations
+        {
+            get;
+        }
+
+        bool WriteAways
+        {
+            get;
+        }
+    }
+}
\ No newline at end of file

Added: trunk/dotnet/JBMClient/remoting/RemotingConnection.cs
===================================================================
--- trunk/dotnet/JBMClient/remoting/RemotingConnection.cs	                        (rev 0)
+++ trunk/dotnet/JBMClient/remoting/RemotingConnection.cs	2009-02-05 01:20:31 UTC (rev 5812)
@@ -0,0 +1,70 @@
+/*
+ * 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.
+ */
+
+namespace JBoss.JBM.Client.remoting
+{
+    using JBoss.JBM.Client.remoting.spi;
+
+    using System.Collections.Generic;
+
+    using JBoss.JBM.Client.exception;
+
+    /**
+     * A RemotingConnection
+     * 
+     * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
+     * @author <a href="mailto:jmesnil at redhat.com">Jeff Mesnil</a>
+     */
+    public interface RemotingConnection : BufferHandler
+    {
+        object getID();
+
+        string RemoteAddress
+        {
+            get;
+        }
+
+        Channel GetChannel(long channelID, int windowSize, bool block);
+
+        long GenerateChannelID();
+
+        void AddFailureListener(FailureListener listener);
+
+        bool RemoveFailureListener(FailureListener listener);
+
+        List<FailureListener> GetFailureListeners();
+
+        void GetFailureListeners(List<FailureListener> listeners);
+
+        MessagingBuffer CreateBuffer(int size);
+
+        void Fail(MessagingException me);
+
+        void Destroy();
+
+        bool IsExpired(long now);
+
+        void StartPinger();
+
+        void SyncIDGeneratorSequence(long id);
+
+        long GetIDGeneratorSequence();
+
+        void Activate();
+
+        void Freeze();
+
+        RemotingConnection GetReplicatingConnection();
+
+        void SetReplicatingConnection(RemotingConnection connection);
+    }
+}
\ No newline at end of file

Added: trunk/dotnet/JBMClient/remoting/impl/AbstractBufferHandler.java
===================================================================
--- trunk/dotnet/JBMClient/remoting/impl/AbstractBufferHandler.java	                        (rev 0)
+++ trunk/dotnet/JBMClient/remoting/impl/AbstractBufferHandler.java	2009-02-05 01:20:31 UTC (rev 5812)
@@ -0,0 +1,53 @@
+/*
+  * 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.core.remoting.impl;
+
+import static org.jboss.messaging.util.DataConstants.SIZE_INT;
+
+import org.jboss.messaging.core.remoting.spi.BufferHandler;
+import org.jboss.messaging.core.remoting.spi.MessagingBuffer;
+
+/**
+ * A AbstractBufferHandler
+ * 
+ * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
+ *
+ */
+public abstract class AbstractBufferHandler implements BufferHandler
+{
+   public int isReadyToHandle(final MessagingBuffer buffer)
+   {
+      if (buffer.remaining() <= SIZE_INT)
+      {
+         return -1;
+      }
+
+      int length = buffer.getInt();
+
+      if (buffer.remaining() < length)
+      {
+         return -1;
+      }
+
+      return length;
+   }
+}

Added: trunk/dotnet/JBMClient/remoting/impl/ByteBufferWrapper.java
===================================================================
--- trunk/dotnet/JBMClient/remoting/impl/ByteBufferWrapper.java	                        (rev 0)
+++ trunk/dotnet/JBMClient/remoting/impl/ByteBufferWrapper.java	2009-02-05 01:20:31 UTC (rev 5812)
@@ -0,0 +1,370 @@
+/*
+ * 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.remoting.impl;
+
+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.ByteBuffer;
+import java.nio.CharBuffer;
+import java.nio.charset.Charset;
+
+import org.jboss.messaging.core.remoting.spi.MessagingBuffer;
+import org.jboss.messaging.util.SimpleString;
+
+/**
+ * 
+ * A ByteBufferWrapper
+ * 
+ * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
+ * @author <a href="mailto:ataylor at redhat.com">Andy Taylor</a>
+ *
+ */
+public class ByteBufferWrapper implements MessagingBuffer
+{
+   private static final Charset utf8 = Charset.forName("UTF-8");
+   	
+	private ByteBuffer buffer;
+	
+	public ByteBufferWrapper(final ByteBuffer buffer)
+	{
+		this.buffer = buffer;
+	}
+	
+	public ByteBuffer getBuffer()
+	{
+	   return buffer;
+	}
+	
+	public byte[] array()
+   {
+      if(buffer.hasArray())
+      {
+         return buffer.array();
+      }
+      else
+      {
+         byte[] b = new byte[buffer.limit()];
+         buffer.get(b);
+         return b;
+      }
+   }
+    
+	public int position()
+	{
+		return buffer.position();
+	}
+	
+	public void position(final int position)
+   {
+   	buffer.position(position);
+   }
+
+	public int capacity()
+	{
+		return buffer.capacity();
+	}
+
+	public void flip()
+	{
+		buffer.flip();
+	}
+	
+	public MessagingBuffer slice()
+   {
+   	return new ByteBufferWrapper(buffer.slice());
+   }
+
+   public MessagingBuffer createNewBuffer(int len)
+   {
+      return new ByteBufferWrapper(ByteBuffer.allocate(len));
+   }
+
+   public void rewind()
+	{
+		buffer.rewind();
+	}
+
+	public boolean getBoolean()
+	{
+		byte b = buffer.get();
+      return (b == TRUE);
+	}
+
+	public byte getByte()
+	{
+		return buffer.get();
+	}
+	
+	public short getUnsignedByte()
+	{
+	   return (short)(buffer.get() & 0xFF);
+	}
+
+	public void getBytes(byte[] bytes)
+	{
+		buffer.get(bytes);
+	}
+	
+	public void getBytes(byte[] bytes, int offset, int length)
+	{
+		buffer.get(bytes, offset, length);
+	}
+
+	public double getDouble()
+	{
+		return buffer.getDouble();
+	}
+
+	public float getFloat()
+	{
+		return buffer.getFloat();
+	}
+
+	public int getInt()
+	{
+		return buffer.getInt();
+	}
+	
+	public long getLong()
+	{
+		return buffer.getLong();
+	}
+
+	public void putNullableString(final String nullableString)
+	{
+		if (nullableString == null)
+		{
+			buffer.put(NULL);
+		}
+		else
+		{
+			buffer.put(NOT_NULL);
+
+			putString(nullableString);
+		}
+	}
+
+	public String getNullableString()
+	{
+		byte check = buffer.get();
+
+		if (check == NULL)
+		{
+			return null;
+		}
+		else
+		{
+			return getString();
+		}
+	}
+
+	public void putString(final String nullableString)
+	{
+		//We don't encode
+
+		buffer.putInt(nullableString.length());
+
+		for (int i = 0; i < nullableString.length(); i++)
+		{
+			buffer.putChar(nullableString.charAt(i));
+		}      
+	}
+	
+	public void putUTF(final String str) throws Exception
+   {
+		//TODO This is quite inefficient - can be improved using a method similar to what MINA IOBuffer does
+		//(putPrefixedString)
+		ByteBuffer bb = utf8.encode(str);
+   	buffer.putInt(bb.limit() - bb.position());
+   	buffer.put(bb);
+   }
+
+	public short getShort()
+	{
+		return buffer.getShort();
+	}
+	
+	public int getUnsignedShort()
+	{
+	   return buffer.getShort() & 0xFFFF;
+	}
+	
+	public char getChar()
+	{
+		return buffer.getChar();
+	}
+
+	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 void putSimpleString(final SimpleString string)
+   {
+   	byte[] data = string.getData();
+   	
+   	buffer.putInt(data.length);
+   	buffer.put(data);
+   }
+   
+   public SimpleString getNullableSimpleString()
+   {
+   	int b = buffer.get();
+   	if (b == NULL)
+   	{
+   	   return null;
+   	}
+   	else
+   	{
+         return getSimpleString();
+   	}
+   }
+   
+   public void putNullableSimpleString(final SimpleString string)
+   {
+   	if (string == null)
+   	{
+   		buffer.put(NULL);
+   	}
+   	else
+   	{
+   	   buffer.put(NOT_NULL);
+   		putSimpleString(string);
+   	}
+   }
+   
+   public SimpleString getSimpleString()
+   {
+   	int len = buffer.getInt();
+   	
+   	byte[] data = new byte[len];
+   	buffer.get(data);
+   	
+   	return new SimpleString(data);
+   }
+   
+   public String getUTF() throws Exception
+   {
+   	int len = buffer.getInt();
+   	byte[] data = new byte[len];
+   	buffer.get(data);
+   	ByteBuffer bb = ByteBuffer.wrap(data); 
+   	CharBuffer cb = utf8.newDecoder().decode(bb);
+   	return cb.toString();
+   }
+
+	public int limit()
+	{
+		return buffer.limit();
+	}
+	
+	public void limit(final int limit)
+   {
+   	buffer.limit(limit);
+   }
+
+	public void putBoolean(boolean val)
+	{
+		if (val)
+      {
+         buffer.put(TRUE);
+      }
+		else
+      {
+         buffer.put(FALSE);
+      }
+	}
+
+	public void putByte(byte val)
+	{
+		buffer.put(val);
+	}
+
+	public void putBytes(byte[] bytes)
+	{
+		buffer.put(bytes);
+	}
+	
+	public void putBytes(byte[] bytes, int offset, int len)
+	{
+		buffer.put(bytes, offset, len);
+	}
+
+	public void putDouble(double val)
+	{
+		buffer.putDouble(val);
+	}
+
+	public void putFloat(float val)
+	{
+		buffer.putFloat(val);
+	}
+
+	public void putInt(int val)
+	{
+		buffer.putInt(val);
+	}
+	
+	public void putInt(int pos, int val)
+   {
+      buffer.putInt(pos, val);
+   }
+
+	public void putLong(long val)
+	{
+		buffer.putLong(val);
+	}
+
+	public void putShort(short val)
+	{
+		buffer.putShort(val);
+	}
+	
+	public void putChar(char chr)
+	{
+		buffer.putChar(chr);
+	}
+	
+	public int remaining()
+	{
+		return buffer.remaining();
+	}
+
+	public Object getUnderlyingBuffer()
+	{
+	   return buffer;
+	}
+
+}

Added: trunk/dotnet/JBMClient/remoting/impl/ExpandingMessagingBuffer.java
===================================================================
--- trunk/dotnet/JBMClient/remoting/impl/ExpandingMessagingBuffer.java	                        (rev 0)
+++ trunk/dotnet/JBMClient/remoting/impl/ExpandingMessagingBuffer.java	2009-02-05 01:20:31 UTC (rev 5812)
@@ -0,0 +1,388 @@
+/*
+ * 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.remoting.impl;
+
+import static org.jboss.messaging.util.DataConstants.NOT_NULL;
+import static org.jboss.messaging.util.DataConstants.NULL;
+
+import java.nio.ByteBuffer;
+
+import org.jboss.messaging.core.remoting.spi.MessagingBuffer;
+import org.jboss.messaging.util.SimpleString;
+
+/**
+ * A {@link MessagingBuffer} which increases its capacity and length by itself
+ * when there's not enough space for a {@code put} operation.
+ *
+ * @author <a href="mailto:tlee at redhat.com">Trustin Lee</a>
+ * @version $Rev: 4857 $, $Date: 2008-08-21 06:32:30 -0700 (Thu, 21 Aug 2008) $
+ */
+public class ExpandingMessagingBuffer implements MessagingBuffer
+{
+   private ByteBuffer buf;
+
+   public ExpandingMessagingBuffer(ByteBuffer buf) {
+      this.buf = buf;
+   }
+
+   public ExpandingMessagingBuffer(int size) {
+      this(ByteBuffer.allocate(size));
+   }
+
+   public byte[] array()
+   {
+      if(buf.hasArray() && buf.arrayOffset() == 0 && buf.capacity() == buf.array().length)
+      {
+         return buf.array();
+      }
+      else
+      {
+         byte[] b = new byte[remaining()];
+         getBytes(b);
+         return b;
+      }
+   }
+
+   public int capacity()
+   {
+      return buf.capacity();
+   }
+
+   public MessagingBuffer createNewBuffer(int len)
+   {
+      return new ExpandingMessagingBuffer(len);
+   }
+
+   public void flip()
+   {
+      buf.flip();
+   }
+
+   public boolean getBoolean()
+   {
+      return getByte() != 0;
+   }
+
+   public byte getByte()
+   {
+      return buf.get();
+   }
+
+   public void getBytes(byte[] bytes)
+   {
+      buf.get(bytes);
+   }
+
+   public void getBytes(byte[] bytes, int offset, int length)
+   {
+      buf.get(bytes, offset, length);
+   }
+
+   public char getChar()
+   {
+      return buf.getChar();
+   }
+
+   public double getDouble()
+   {
+      return buf.getDouble();
+   }
+
+   public float getFloat()
+   {
+      return buf.getFloat();
+   }
+
+   public int getInt()
+   {
+      return buf.getInt();
+   }
+
+   public long getLong()
+   {
+      return buf.getLong();
+   }
+
+   public SimpleString getNullableSimpleString()
+   {
+      if (getByte() == NULL)
+      {
+         return null;
+      }
+      else
+      {
+         return getSimpleString();
+      }
+   }
+
+   public String getNullableString()
+   {
+      if (getByte() == NULL)
+      {
+         return null;
+      }
+      else
+      {
+         return getString();
+      }
+   }
+
+   public short getShort()
+   {
+      return buf.getShort();
+   }
+
+   public SimpleString getSimpleString()
+   {
+      int len = getInt();
+      byte[] data = new byte[len];
+      getBytes(data);
+      return new SimpleString(data);
+   }
+
+   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 getUTF() throws Exception
+   {
+      int length = getUnsignedShort();
+      byte[] data = new byte[length];
+      getBytes(data);
+      return new String(data, "UTF-8");
+   }
+
+   public short getUnsignedByte()
+   {
+      return (short) (getByte() & 0xFF);
+   }
+
+   public int getUnsignedShort()
+   {
+      return getShort() & 0xFFFF;
+   }
+
+   public int limit()
+   {
+      return buf.limit();
+   }
+
+   public void limit(int limit)
+   {
+      buf.limit(limit);
+   }
+
+   public void position(int position)
+   {
+      buf.position(position);
+   }
+
+   public int position()
+   {
+      return buf.position();
+   }
+
+   public void putBoolean(boolean val)
+   {
+      putByte((byte) (val ? -1 : 0));
+   }
+
+   public void putByte(byte val)
+   {
+      ensureRemaining(1).put(val);
+   }
+
+   public void putBytes(byte[] bytes)
+   {
+      ensureRemaining(bytes.length).put(bytes);
+   }
+
+   public void putBytes(byte[] bytes, int offset, int length)
+   {
+      ensureRemaining(length).put(bytes, offset, length);
+   }
+
+   public void putChar(char val)
+   {
+      ensureRemaining(2).putChar(val);
+   }
+
+   public void putDouble(double val)
+   {
+      ensureRemaining(8).putDouble(val);
+   }
+
+   public void putFloat(float val)
+   {
+      ensureRemaining(4).putFloat(val);
+   }
+
+   public void putInt(int val)
+   {
+      ensureRemaining(4).putInt(val);
+   }
+
+   public void putInt(int pos, int val)
+   {
+      buf.putInt(pos, val);
+   }
+
+   public void putLong(long val)
+   {
+      ensureRemaining(8).putLong(val);
+   }
+
+   public void putNullableSimpleString(SimpleString val)
+   {
+      if (val == null)
+      {
+         ensureRemaining(1).put(NULL);
+      }
+      else
+      {
+         ensureRemaining(5 + (val.length() << 1));
+         buf.put(NOT_NULL);
+         byte[] data = val.getData();
+         ensureRemaining(data.length + 4);
+         buf.putInt(data.length);
+         buf.put(data);
+      }
+   }
+
+   public void putNullableString(String val)
+   {
+      if (val == null)
+      {
+         ensureRemaining(1).put(NULL);
+      }
+      else
+      {
+         ensureRemaining(5 + (val.length() << 1));
+         buf.put(NOT_NULL);
+         buf.putInt(val.length());
+         for (int i = 0; i < val.length(); i++)
+         {
+            buf.putChar(val.charAt(i));
+         }
+      }
+   }
+
+   public void putShort(short val)
+   {
+      ensureRemaining(2).putShort(val);
+   }
+
+   public void putSimpleString(SimpleString val)
+   {
+      byte[] data = val.getData();
+      ensureRemaining(4 + data.length);
+      buf.putInt(data.length);
+      buf.put(data);
+   }
+
+   public void putString(String val)
+   {
+      ensureRemaining(4 + (val.length() << 1));
+      buf.putInt(val.length());
+      for (int i = 0; i < val.length(); i++)
+      {
+         buf.putChar(val.charAt(i));
+      }
+   }
+
+   public void putUTF(String utf) throws Exception
+   {
+      byte[] data = utf.getBytes("UTF-8");
+      if (data.length > 65535) {
+         throw new IllegalArgumentException("String is too long: " + data.length);
+      }
+      ensureRemaining(2 + data.length);
+      buf.putShort((short) data.length);
+      buf.put(data);
+   }
+
+   public int remaining()
+   {
+      return buf.remaining();
+   }
+
+   public void rewind()
+   {
+      buf.rewind();
+   }
+
+   public MessagingBuffer slice()
+   {
+      return new ExpandingMessagingBuffer(buf.slice());
+   }
+   
+   public Object getUnderlyingBuffer()
+   {
+      return buf;
+   }
+
+   private ByteBuffer ensureRemaining(int minRemaining)
+   {
+      int remaining = remaining();
+      if (remaining >= minRemaining)
+      {
+         return buf;
+      }
+
+      int capacity = capacity();
+      int limit = limit();
+      if (capacity - limit >= minRemaining - remaining) {
+         buf.limit(limit + minRemaining - remaining);
+         return buf;
+      }
+
+      int position = position();
+      int minCapacityDifference = minRemaining - remaining;
+      int oldCapacity = capacity();
+      int newCapacity = oldCapacity;
+      for (;;)
+      {
+         newCapacity <<= 1;
+         if (newCapacity - oldCapacity >= minCapacityDifference)
+         {
+            break;
+         }
+      }
+
+      ByteBuffer newBuf = ByteBuffer.allocate(newCapacity);
+      buf.clear();
+      newBuf.put(buf);
+      newBuf.limit(position + minRemaining);
+      newBuf.position(position);
+      buf = newBuf;
+
+      return newBuf;
+   }
+}

Added: trunk/dotnet/JBMClient/remoting/impl/RemotingConnectionImpl.java
===================================================================
--- trunk/dotnet/JBMClient/remoting/impl/RemotingConnectionImpl.java	                        (rev 0)
+++ trunk/dotnet/JBMClient/remoting/impl/RemotingConnectionImpl.java	2009-02-05 01:20:31 UTC (rev 5812)
@@ -0,0 +1,1635 @@
+/*
+ * 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.remoting.impl;
+
+import static org.jboss.messaging.core.remoting.impl.wireformat.PacketImpl.CREATESESSION;
+import static org.jboss.messaging.core.remoting.impl.wireformat.PacketImpl.CREATESESSION_RESP;
+import static org.jboss.messaging.core.remoting.impl.wireformat.PacketImpl.EARLY_RESPONSE;
+import static org.jboss.messaging.core.remoting.impl.wireformat.PacketImpl.EXCEPTION;
+import static org.jboss.messaging.core.remoting.impl.wireformat.PacketImpl.NULL_RESPONSE;
+import static org.jboss.messaging.core.remoting.impl.wireformat.PacketImpl.PACKETS_CONFIRMED;
+import static org.jboss.messaging.core.remoting.impl.wireformat.PacketImpl.PING;
+import static org.jboss.messaging.core.remoting.impl.wireformat.PacketImpl.PONG;
+import static org.jboss.messaging.core.remoting.impl.wireformat.PacketImpl.REATTACH_SESSION;
+import static org.jboss.messaging.core.remoting.impl.wireformat.PacketImpl.REATTACH_SESSION_RESP;
+import static org.jboss.messaging.core.remoting.impl.wireformat.PacketImpl.REPLICATE_CREATESESSION;
+import static org.jboss.messaging.core.remoting.impl.wireformat.PacketImpl.REPLICATION_RESPONSE;
+import static org.jboss.messaging.core.remoting.impl.wireformat.PacketImpl.SESS_ACKNOWLEDGE;
+import static org.jboss.messaging.core.remoting.impl.wireformat.PacketImpl.SESS_ADD_DESTINATION;
+import static org.jboss.messaging.core.remoting.impl.wireformat.PacketImpl.SESS_BINDINGQUERY;
+import static org.jboss.messaging.core.remoting.impl.wireformat.PacketImpl.SESS_BINDINGQUERY_RESP;
+import static org.jboss.messaging.core.remoting.impl.wireformat.PacketImpl.SESS_CLOSE;
+import static org.jboss.messaging.core.remoting.impl.wireformat.PacketImpl.SESS_COMMIT;
+import static org.jboss.messaging.core.remoting.impl.wireformat.PacketImpl.SESS_CONSUMER_CLOSE;
+import static org.jboss.messaging.core.remoting.impl.wireformat.PacketImpl.SESS_CREATECONSUMER;
+import static org.jboss.messaging.core.remoting.impl.wireformat.PacketImpl.SESS_CREATEQUEUE;
+import static org.jboss.messaging.core.remoting.impl.wireformat.PacketImpl.SESS_DELETE_QUEUE;
+import static org.jboss.messaging.core.remoting.impl.wireformat.PacketImpl.SESS_EXPIRED;
+import static org.jboss.messaging.core.remoting.impl.wireformat.PacketImpl.SESS_FAILOVER_COMPLETE;
+import static org.jboss.messaging.core.remoting.impl.wireformat.PacketImpl.SESS_FLOWTOKEN;
+import static org.jboss.messaging.core.remoting.impl.wireformat.PacketImpl.SESS_QUEUEQUERY;
+import static org.jboss.messaging.core.remoting.impl.wireformat.PacketImpl.SESS_QUEUEQUERY_RESP;
+import static org.jboss.messaging.core.remoting.impl.wireformat.PacketImpl.SESS_RECEIVE_CONTINUATION;
+import static org.jboss.messaging.core.remoting.impl.wireformat.PacketImpl.SESS_RECEIVE_MSG;
+import static org.jboss.messaging.core.remoting.impl.wireformat.PacketImpl.SESS_REMOVE_DESTINATION;
+import static org.jboss.messaging.core.remoting.impl.wireformat.PacketImpl.SESS_REPLICATE_DELIVERY;
+import static org.jboss.messaging.core.remoting.impl.wireformat.PacketImpl.SESS_ROLLBACK;
+import static org.jboss.messaging.core.remoting.impl.wireformat.PacketImpl.SESS_SEND;
+import static org.jboss.messaging.core.remoting.impl.wireformat.PacketImpl.SESS_SEND_CONTINUATION;
+import static org.jboss.messaging.core.remoting.impl.wireformat.PacketImpl.SESS_START;
+import static org.jboss.messaging.core.remoting.impl.wireformat.PacketImpl.SESS_STOP;
+import static org.jboss.messaging.core.remoting.impl.wireformat.PacketImpl.SESS_XA_COMMIT;
+import static org.jboss.messaging.core.remoting.impl.wireformat.PacketImpl.SESS_XA_END;
+import static org.jboss.messaging.core.remoting.impl.wireformat.PacketImpl.SESS_XA_FORGET;
+import static org.jboss.messaging.core.remoting.impl.wireformat.PacketImpl.SESS_XA_GET_TIMEOUT;
+import static org.jboss.messaging.core.remoting.impl.wireformat.PacketImpl.SESS_XA_GET_TIMEOUT_RESP;
+import static org.jboss.messaging.core.remoting.impl.wireformat.PacketImpl.SESS_XA_INDOUBT_XIDS;
+import static org.jboss.messaging.core.remoting.impl.wireformat.PacketImpl.SESS_XA_INDOUBT_XIDS_RESP;
+import static org.jboss.messaging.core.remoting.impl.wireformat.PacketImpl.SESS_XA_JOIN;
+import static org.jboss.messaging.core.remoting.impl.wireformat.PacketImpl.SESS_XA_PREPARE;
+import static org.jboss.messaging.core.remoting.impl.wireformat.PacketImpl.SESS_XA_RESP;
+import static org.jboss.messaging.core.remoting.impl.wireformat.PacketImpl.SESS_XA_RESUME;
+import static org.jboss.messaging.core.remoting.impl.wireformat.PacketImpl.SESS_XA_ROLLBACK;
+import static org.jboss.messaging.core.remoting.impl.wireformat.PacketImpl.SESS_XA_SET_TIMEOUT;
+import static org.jboss.messaging.core.remoting.impl.wireformat.PacketImpl.SESS_XA_SET_TIMEOUT_RESP;
+import static org.jboss.messaging.core.remoting.impl.wireformat.PacketImpl.SESS_XA_START;
+import static org.jboss.messaging.core.remoting.impl.wireformat.PacketImpl.SESS_XA_SUSPEND;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.Queue;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ConcurrentLinkedQueue;
+import java.util.concurrent.CopyOnWriteArrayList;
+import java.util.concurrent.ScheduledExecutorService;
+import java.util.concurrent.ScheduledFuture;
+import java.util.concurrent.Semaphore;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.locks.Condition;
+import java.util.concurrent.locks.Lock;
+import java.util.concurrent.locks.ReentrantLock;
+
+import org.jboss.messaging.core.exception.MessagingException;
+import org.jboss.messaging.core.logging.Logger;
+import org.jboss.messaging.core.remoting.Channel;
+import org.jboss.messaging.core.remoting.ChannelHandler;
+import org.jboss.messaging.core.remoting.DelayedResult;
+import org.jboss.messaging.core.remoting.FailureListener;
+import org.jboss.messaging.core.remoting.Interceptor;
+import org.jboss.messaging.core.remoting.Packet;
+import org.jboss.messaging.core.remoting.RemotingConnection;
+import org.jboss.messaging.core.remoting.impl.wireformat.CreateSessionMessage;
+import org.jboss.messaging.core.remoting.impl.wireformat.CreateSessionResponseMessage;
+import org.jboss.messaging.core.remoting.impl.wireformat.MessagingExceptionMessage;
+import org.jboss.messaging.core.remoting.impl.wireformat.NullResponseMessage;
+import org.jboss.messaging.core.remoting.impl.wireformat.PacketImpl;
+import org.jboss.messaging.core.remoting.impl.wireformat.PacketsConfirmedMessage;
+import org.jboss.messaging.core.remoting.impl.wireformat.Ping;
+import org.jboss.messaging.core.remoting.impl.wireformat.Pong;
+import org.jboss.messaging.core.remoting.impl.wireformat.ReattachSessionMessage;
+import org.jboss.messaging.core.remoting.impl.wireformat.ReattachSessionResponseMessage;
+import org.jboss.messaging.core.remoting.impl.wireformat.ReplicateCreateSessionMessage;
+import org.jboss.messaging.core.remoting.impl.wireformat.SessionAcknowledgeMessage;
+import org.jboss.messaging.core.remoting.impl.wireformat.SessionAddDestinationMessage;
+import org.jboss.messaging.core.remoting.impl.wireformat.SessionBindingQueryMessage;
+import org.jboss.messaging.core.remoting.impl.wireformat.SessionBindingQueryResponseMessage;
+import org.jboss.messaging.core.remoting.impl.wireformat.SessionCloseMessage;
+import org.jboss.messaging.core.remoting.impl.wireformat.SessionConsumerCloseMessage;
+import org.jboss.messaging.core.remoting.impl.wireformat.SessionConsumerFlowCreditMessage;
+import org.jboss.messaging.core.remoting.impl.wireformat.SessionCreateConsumerMessage;
+import org.jboss.messaging.core.remoting.impl.wireformat.SessionCreateQueueMessage;
+import org.jboss.messaging.core.remoting.impl.wireformat.SessionDeleteQueueMessage;
+import org.jboss.messaging.core.remoting.impl.wireformat.SessionExpiredMessage;
+import org.jboss.messaging.core.remoting.impl.wireformat.SessionFailoverCompleteMessage;
+import org.jboss.messaging.core.remoting.impl.wireformat.SessionQueueQueryMessage;
+import org.jboss.messaging.core.remoting.impl.wireformat.SessionQueueQueryResponseMessage;
+import org.jboss.messaging.core.remoting.impl.wireformat.SessionReceiveContinuationMessage;
+import org.jboss.messaging.core.remoting.impl.wireformat.SessionReceiveMessage;
+import org.jboss.messaging.core.remoting.impl.wireformat.SessionRemoveDestinationMessage;
+import org.jboss.messaging.core.remoting.impl.wireformat.SessionReplicateDeliveryMessage;
+import org.jboss.messaging.core.remoting.impl.wireformat.SessionSendContinuationMessage;
+import org.jboss.messaging.core.remoting.impl.wireformat.SessionSendMessage;
+import org.jboss.messaging.core.remoting.impl.wireformat.SessionXACommitMessage;
+import org.jboss.messaging.core.remoting.impl.wireformat.SessionXAEndMessage;
+import org.jboss.messaging.core.remoting.impl.wireformat.SessionXAForgetMessage;
+import org.jboss.messaging.core.remoting.impl.wireformat.SessionXAGetInDoubtXidsResponseMessage;
+import org.jboss.messaging.core.remoting.impl.wireformat.SessionXAGetTimeoutResponseMessage;
+import org.jboss.messaging.core.remoting.impl.wireformat.SessionXAJoinMessage;
+import org.jboss.messaging.core.remoting.impl.wireformat.SessionXAPrepareMessage;
+import org.jboss.messaging.core.remoting.impl.wireformat.SessionXAResponseMessage;
+import org.jboss.messaging.core.remoting.impl.wireformat.SessionXAResumeMessage;
+import org.jboss.messaging.core.remoting.impl.wireformat.SessionXARollbackMessage;
+import org.jboss.messaging.core.remoting.impl.wireformat.SessionXASetTimeoutMessage;
+import org.jboss.messaging.core.remoting.impl.wireformat.SessionXASetTimeoutResponseMessage;
+import org.jboss.messaging.core.remoting.impl.wireformat.SessionXAStartMessage;
+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.core.remoting.spi.ConnectorFactory;
+import org.jboss.messaging.core.remoting.spi.MessagingBuffer;
+import org.jboss.messaging.util.SimpleIDGenerator;
+
+/**
+ * @author <a href="tim.fox at jboss.com">Tim Fox</a>
+ * @author <a href="mailto:jmesnil at redhat.com">Jeff Mesnil</a>
+ * @version <tt>$Revision: 5792 $</tt> $Id: RemotingConnectionImpl.java 5792 2009-02-03 09:07:23Z timfox $
+ */
+public class RemotingConnectionImpl extends AbstractBufferHandler implements RemotingConnection
+{
+   // Constants
+   // ------------------------------------------------------------------------------------
+
+   private static final Logger log = Logger.getLogger(RemotingConnectionImpl.class);
+
+   // Static
+   // ---------------------------------------------------------------------------------------
+
+   public static RemotingConnection createConnection(final ConnectorFactory connectorFactory,
+                                                     final Map<String, Object> params,
+                                                     final long callTimeout,
+                                                     final long pingInterval,
+                                                     final long connectionTTL,
+                                                     final ScheduledExecutorService pingExecutor,
+                                                     final ConnectionLifeCycleListener listener)
+   {
+      DelegatingBufferHandler handler = new DelegatingBufferHandler();
+
+      Connector connector = connectorFactory.createConnector(params, handler, listener);
+
+      connector.start();
+
+      Connection tc = connector.createConnection();
+
+      if (tc == null)
+      {
+         throw new IllegalStateException("Failed to connect");
+      }
+
+      RemotingConnection connection = new RemotingConnectionImpl(tc,
+                                                                 callTimeout,
+                                                                 pingInterval,
+                                                                 connectionTTL,
+                                                                 pingExecutor,
+                                                                 null);
+
+      handler.conn = connection;
+
+      return connection;
+   }
+
+   private static class DelegatingBufferHandler extends AbstractBufferHandler
+   {
+      RemotingConnection conn;
+
+      public void bufferReceived(final Object connectionID, final MessagingBuffer buffer)
+      {
+         conn.bufferReceived(connectionID, buffer);
+      }
+   }
+
+   // Attributes
+   // -----------------------------------------------------------------------------------
+
+   private final Connection transportConnection;
+
+   private final Map<Long, ChannelImpl> channels = new ConcurrentHashMap<Long, ChannelImpl>();
+
+   private final List<FailureListener> failureListeners = new CopyOnWriteArrayList<FailureListener>();
+
+   private final long blockingCallTimeout;
+
+   private Runnable pinger;
+
+   private final List<Interceptor> interceptors;
+
+   private ScheduledFuture<?> future;
+
+   private boolean firstTime = true;
+
+   private volatile boolean gotPong;
+
+   private volatile boolean destroyed;
+
+   private volatile boolean stopPinging;
+
+   private volatile long expireTime = -1;
+
+   private final Channel pingChannel;
+
+   private volatile RemotingConnection replicatingConnection;
+
+   private volatile boolean active;
+
+   private final boolean client;
+
+   private final long pingPeriod;
+
+   // How long without a ping before the connection times out
+   private final long connectionTTL;
+
+   private final ScheduledExecutorService pingExecutor;
+
+   // Channels 0-9 are reserved for the system
+   // 0 is for pinging
+   // 1 is for session creation and attachment
+   private volatile SimpleIDGenerator idGenerator = new SimpleIDGenerator(10);
+
+   private boolean idGeneratorSynced = false;
+
+   private final Object transferLock = new Object();
+
+   private final ChannelHandler ppHandler = new PingPongHandler();
+
+   private boolean frozen;
+
+   private final Object failLock = new Object();
+
+   // debug only stuff
+
+   private boolean createdActive;
+
+   // Constructors
+   // ---------------------------------------------------------------------------------
+
+   /*
+    * Create a client side connection
+    */
+   public RemotingConnectionImpl(final Connection transportConnection,
+                                 final long blockingCallTimeout,
+                                 final long pingPeriod,
+                                 final long connectionTTL,
+                                 final ScheduledExecutorService pingExecutor,
+                                 final List<Interceptor> interceptors)
+   {
+      this(transportConnection,
+           blockingCallTimeout,
+           pingPeriod,
+           connectionTTL,
+           pingExecutor,
+           interceptors,
+           null,
+           true,
+           true);
+   }
+
+   /*
+    * Create a server side connection
+    */
+   public RemotingConnectionImpl(final Connection transportConnection,
+                                 final List<Interceptor> interceptors,
+                                 final RemotingConnection replicatingConnection,
+                                 final boolean active,
+                                 final long connectionTTL)
+
+   {
+      this(transportConnection, -1, -1, connectionTTL, null, interceptors, replicatingConnection, active, false);
+   }
+
+   private RemotingConnectionImpl(final Connection transportConnection,
+                                  final long blockingCallTimeout,
+                                  final long pingPeriod,
+                                  final long connectionTTL,
+                                  final ScheduledExecutorService pingExecutor,
+                                  final List<Interceptor> interceptors,
+                                  final RemotingConnection replicatingConnection,
+                                  final boolean active,
+                                  final boolean client)
+
+   {      
+      this.transportConnection = transportConnection;
+
+      this.blockingCallTimeout = blockingCallTimeout;
+
+      this.interceptors = interceptors;
+
+      this.replicatingConnection = replicatingConnection;
+
+      if (replicatingConnection != null)
+      {
+         replicatingConnection.addFailureListener(new ReplicatingConnectionFailureListener());
+      }
+
+      this.active = active;
+
+      this.pingPeriod = pingPeriod;
+
+      this.connectionTTL = connectionTTL;
+
+      this.pingExecutor = pingExecutor;
+
+      // Channel zero is reserved for pinging
+      pingChannel = getChannel(0, -1, false);
+
+      pingChannel.setHandler(ppHandler);
+
+      this.client = client;
+
+      this.createdActive = active;
+   }
+
+   public void startPinger()
+   {
+      if (pingPeriod != -1)
+      {
+         pinger = new Pinger();
+
+         future = pingExecutor.scheduleWithFixedDelay(pinger, 0, pingPeriod, TimeUnit.MILLISECONDS);
+      }
+      else
+      {
+         pinger = null;
+      }
+   }
+
+   // RemotingConnection implementation
+   // ------------------------------------------------------------
+
+   public List<FailureListener> getFailureListeners()
+   {
+      return new ArrayList<FailureListener>(failureListeners);
+   }
+
+   public void setFailureListeners(final List<FailureListener> listeners)
+   {
+      this.failureListeners.clear();
+
+      this.failureListeners.addAll(listeners);
+   }
+
+   public Object getID()
+   {
+      return transportConnection.getID();
+   }
+
+   public String getRemoteAddress()
+   {
+      return transportConnection.getRemoteAddress();
+   }
+
+   public synchronized Channel getChannel(final long channelID, final int windowSize, final boolean block)
+   {
+      ChannelImpl channel = channels.get(channelID);
+
+      if (channel == null)
+      {
+         channel = new ChannelImpl(this, channelID, windowSize, block);
+
+         channels.put(channelID, channel);
+      }
+
+      return channel;
+   }
+
+   public void addFailureListener(final FailureListener listener)
+   {
+      if (listener == null)
+      {
+         throw new IllegalStateException("FailureListener cannot be null");
+      }
+
+      failureListeners.add(listener);
+   }
+
+   public boolean removeFailureListener(final FailureListener listener)
+   {
+      if (listener == null)
+      {
+         throw new IllegalStateException("FailureListener cannot be null");
+      }
+
+      return failureListeners.remove(listener);
+   }
+
+   public MessagingBuffer createBuffer(final int size)
+   {
+      return transportConnection.createBuffer(size);
+   }
+
+   public RemotingConnection getReplicatingConnection()
+   {
+      return replicatingConnection;
+   }
+
+   public void setReplicatingConnection(final RemotingConnection connection)
+   {
+      this.replicatingConnection = connection;
+   }
+
+   /*
+    * This can be called concurrently by more than one thread so needs to be locked
+    */
+   public void fail(final MessagingException me)
+   {
+      synchronized (failLock)
+      {
+         if (destroyed)
+         {
+            return;
+         }
+         
+         destroyed = true;
+      }
+
+      log.warn("Connection failed " + System.identityHashCode(this) + " " + me.getMessage());
+
+      // Then call the listeners
+      callListeners(me);
+
+      internalClose();   
+   }
+
+   public void destroy()
+   {
+      synchronized (failLock)
+      {
+         if (destroyed)
+         {
+            return;
+         }
+         
+         destroyed = true;
+      }
+
+      internalClose();
+
+      // TODO: https://jira.jboss.org/jira/browse/JBMESSAGING-1421
+      // This affects clustering, so I'm keeping this out for now
+      // We need to inform Listeners about the connection being closed
+      // callListeners(null);      
+   }
+
+   public boolean isExpired(final long now)
+   {
+      return expireTime != -1 && now >= expireTime;
+   }
+
+   public long generateChannelID()
+   {
+      return idGenerator.generateID();
+   }
+
+   /* For testing only */
+   public void stopPingingAfterOne()
+   {
+      stopPinging = true;
+   }
+
+   public synchronized void syncIDGeneratorSequence(final long id)
+   {
+      if (!idGeneratorSynced)
+      {
+         idGenerator = new SimpleIDGenerator(id);
+
+         idGeneratorSynced = true;
+      }
+   }
+
+   public long getIDGeneratorSequence()
+   {
+      return idGenerator.getCurrentID();
+   }
+
+   // Buffer Handler implementation
+   // ----------------------------------------------------
+
+   public void bufferReceived(final Object connectionID, final MessagingBuffer buffer)
+   {
+      final Packet packet = decode(buffer);
+      
+      synchronized (transferLock)
+      {
+         if (!frozen)
+         {
+            final ChannelImpl channel = channels.get(packet.getChannelID());
+
+            if (channel != null)
+            {
+               channel.handlePacket(packet);
+            }
+         }
+      }
+   }
+
+   public void activate()
+   {
+      active = true;
+   }
+
+   public void freeze()
+   {
+      // Prevent any more packets being handled on this connection
+
+      synchronized (transferLock)
+      {
+         frozen = true;
+      }
+   }
+
+   // Package protected
+   // ----------------------------------------------------------------------------
+
+   // Protected
+   // ------------------------------------------------------------------------------------
+
+   // Private
+   // --------------------------------------------------------------------------------------
+
+   private void callListeners(final MessagingException me)
+   {
+      final List<FailureListener> listenersClone = new ArrayList<FailureListener>(failureListeners);
+
+      for (final FailureListener listener : listenersClone)
+      {
+         try
+         {
+            boolean callNext = listener.connectionFailed(me);
+
+            if (!callNext)
+            {
+               break;
+            }
+         }
+         catch (final Throwable t)
+         {
+            // Failure of one listener to execute shouldn't prevent others
+            // from
+            // executing
+            log.error("Failed to execute failure listener", t);
+         }
+      }
+   }
+
+   private void internalClose()
+   {
+      if (future != null)
+      {
+         future.cancel(false);
+      }
+
+      pingChannel.close();
+
+      // We close the underlying transport connection
+      transportConnection.close();
+
+      if (replicatingConnection != null)
+      {
+         replicatingConnection.destroy();
+      }
+
+      for (Channel channel : channels.values())
+      {
+         channel.close();
+      }
+   }
+
+   private Packet decode(final MessagingBuffer in)
+   {
+      final byte packetType = in.getByte();
+
+      Packet packet;
+
+      switch (packetType)
+      {
+         case PING:
+         {
+            packet = new Ping();
+            break;
+         }
+         case PONG:
+         {
+            packet = new PacketImpl(PacketImpl.PONG);
+            break;
+         }
+         case EXCEPTION:
+         {
+            packet = new MessagingExceptionMessage();
+            break;
+         }
+         case PACKETS_CONFIRMED:
+         {
+            packet = new PacketsConfirmedMessage();
+            break;
+         }
+         case REPLICATION_RESPONSE:
+         {
+            packet = new PacketImpl(REPLICATION_RESPONSE);
+            break;
+         }
+         case CREATESESSION:
+         {
+            packet = new CreateSessionMessage();
+            break;
+         }
+         case REPLICATE_CREATESESSION:
+         {
+            packet = new ReplicateCreateSessionMessage();
+            break;
+         }
+         case CREATESESSION_RESP:
+         {
+            packet = new CreateSessionResponseMessage();
+            break;
+         }
+         case REATTACH_SESSION:
+         {
+            packet = new ReattachSessionMessage();
+            break;
+         }
+         case REATTACH_SESSION_RESP:
+         {
+            packet = new ReattachSessionResponseMessage();
+            break;
+         }
+         case SESS_FAILOVER_COMPLETE:
+         {
+            packet = new SessionFailoverCompleteMessage();
+            break;
+         }
+         case SESS_CLOSE:
+         {
+            packet = new SessionCloseMessage();
+            break;
+         }
+         case SESS_CREATECONSUMER:
+         {
+            packet = new SessionCreateConsumerMessage();
+            break;
+         }
+         case SESS_ACKNOWLEDGE:
+         {
+            packet = new SessionAcknowledgeMessage();
+            break;
+         }
+         case SESS_EXPIRED:
+         {
+            packet = new SessionExpiredMessage();
+            break;
+         }
+         case SESS_COMMIT:
+         {
+            packet = new PacketImpl(PacketImpl.SESS_COMMIT);
+            break;
+         }
+         case SESS_ROLLBACK:
+         {
+            packet = new PacketImpl(PacketImpl.SESS_ROLLBACK);
+            break;
+         }
+         case SESS_QUEUEQUERY:
+         {
+            packet = new SessionQueueQueryMessage();
+            break;
+         }
+         case SESS_QUEUEQUERY_RESP:
+         {
+            packet = new SessionQueueQueryResponseMessage();
+            break;
+         }
+         case SESS_CREATEQUEUE:
+         {
+            packet = new SessionCreateQueueMessage();
+            break;
+         }
+         case SESS_DELETE_QUEUE:
+         {
+            packet = new SessionDeleteQueueMessage();
+            break;
+         }
+         case SESS_ADD_DESTINATION:
+         {
+            packet = new SessionAddDestinationMessage();
+            break;
+         }
+         case SESS_REMOVE_DESTINATION:
+         {
+            packet = new SessionRemoveDestinationMessage();
+            break;
+         }
+         case SESS_BINDINGQUERY:
+         {
+            packet = new SessionBindingQueryMessage();
+            break;
+         }
+         case SESS_BINDINGQUERY_RESP:
+         {
+            packet = new SessionBindingQueryResponseMessage();
+            break;
+         }
+         case SESS_XA_START:
+         {
+            packet = new SessionXAStartMessage();
+            break;
+         }
+         case SESS_XA_END:
+         {
+            packet = new SessionXAEndMessage();
+            break;
+         }
+         case SESS_XA_COMMIT:
+         {
+            packet = new SessionXACommitMessage();
+            break;
+         }
+         case SESS_XA_PREPARE:
+         {
+            packet = new SessionXAPrepareMessage();
+            break;
+         }
+         case SESS_XA_RESP:
+         {
+            packet = new SessionXAResponseMessage();
+            break;
+         }
+         case SESS_XA_ROLLBACK:
+         {
+            packet = new SessionXARollbackMessage();
+            break;
+         }
+         case SESS_XA_JOIN:
+         {
+            packet = new SessionXAJoinMessage();
+            break;
+         }
+         case SESS_XA_SUSPEND:
+         {
+            packet = new PacketImpl(PacketImpl.SESS_XA_SUSPEND);
+            break;
+         }
+         case SESS_XA_RESUME:
+         {
+            packet = new SessionXAResumeMessage();
+            break;
+         }
+         case SESS_XA_FORGET:
+         {
+            packet = new SessionXAForgetMessage();
+            break;
+         }
+         case SESS_XA_INDOUBT_XIDS:
+         {
+            packet = new PacketImpl(PacketImpl.SESS_XA_INDOUBT_XIDS);
+            break;
+         }
+         case SESS_XA_INDOUBT_XIDS_RESP:
+         {
+            packet = new SessionXAGetInDoubtXidsResponseMessage();
+            break;
+         }
+         case SESS_XA_SET_TIMEOUT:
+         {
+            packet = new SessionXASetTimeoutMessage();
+            break;
+         }
+         case SESS_XA_SET_TIMEOUT_RESP:
+         {
+            packet = new SessionXASetTimeoutResponseMessage();
+            break;
+         }
+         case SESS_XA_GET_TIMEOUT:
+         {
+            packet = new PacketImpl(PacketImpl.SESS_XA_GET_TIMEOUT);
+            break;
+         }
+         case SESS_XA_GET_TIMEOUT_RESP:
+         {
+            packet = new SessionXAGetTimeoutResponseMessage();
+            break;
+         }
+         case SESS_START:
+         {
+            packet = new PacketImpl(PacketImpl.SESS_START);
+            break;
+         }
+         case SESS_STOP:
+         {
+            packet = new PacketImpl(PacketImpl.SESS_STOP);
+            break;
+         }
+         case SESS_FLOWTOKEN:
+         {
+            packet = new SessionConsumerFlowCreditMessage();
+            break;
+         }
+         case SESS_SEND:
+         {
+            packet = new SessionSendMessage();
+            break;
+         }
+         case SESS_RECEIVE_MSG:
+         {
+            packet = new SessionReceiveMessage();
+            break;
+         }
+         case SESS_CONSUMER_CLOSE:
+         {
+            packet = new SessionConsumerCloseMessage();
+            break;
+         }
+         case NULL_RESPONSE:
+         {
+            packet = new NullResponseMessage();
+            break;
+         }
+         case SESS_RECEIVE_CONTINUATION:
+         {
+            packet = new SessionReceiveContinuationMessage();
+            break;
+         }
+         case SESS_SEND_CONTINUATION:
+         {
+            packet = new SessionSendContinuationMessage();
+            break;
+         }
+         case SESS_REPLICATE_DELIVERY:
+         {
+            packet = new SessionReplicateDeliveryMessage();
+            break;
+         }
+         default:
+         {
+            throw new IllegalArgumentException("Invalid type: " + packetType);
+         }
+      }
+
+      packet.decode(in);
+
+      return packet;
+   }
+
+   // Inner classes
+   // --------------------------------------------------------------------------------
+
+   // Needs to be static so we can re-assign it to another remotingconnection
+   private static class ChannelImpl implements Channel
+   {
+      private final long id;
+
+      private ChannelHandler handler;
+
+      private Packet response;
+
+      private final java.util.Queue<Packet> resendCache;
+
+      private volatile int firstStoredCommandID;
+
+      private volatile int lastReceivedCommandID = -1;
+
+      private Channel replicatingChannel;
+
+      private volatile RemotingConnectionImpl connection;
+
+      private volatile boolean closed;
+
+      private final Lock lock = new ReentrantLock();
+
+      private final Condition sendCondition = lock.newCondition();
+
+      private final Condition failoverCondition = lock.newCondition();
+
+      private final Object sendLock = new Object();
+
+      private final Object sendBlockingLock = new Object();
+
+      private final Object replicationLock = new Object();
+
+      private boolean failingOver;
+
+      private final Queue<DelayedResult> responseActions = new ConcurrentLinkedQueue<DelayedResult>();
+
+      private final int windowSize;
+
+      private final int confWindowSize;
+
+      private final Semaphore sendSemaphore;
+
+      private int receivedBytes;
+
+      private ChannelImpl(final RemotingConnectionImpl connection,
+                          final long id,
+                          final int windowSize,
+                          final boolean block)
+      {
+         this.connection = connection;
+
+         this.id = id;
+
+         if (connection.replicatingConnection != null && id != 0)
+         {
+            // We don't redirect the ping channel
+
+            replicatingChannel = connection.replicatingConnection.getChannel(id, -1, false);
+
+            replicatingChannel.setHandler(new ReplicatedPacketsConfirmedChannelHandler());
+         }
+         this.windowSize = windowSize;
+
+         this.confWindowSize = (int)(0.75 * windowSize);
+
+         if (this.windowSize != -1)
+         {
+            resendCache = new ConcurrentLinkedQueue<Packet>();
+
+            if (block)
+            {
+               sendSemaphore = new Semaphore(windowSize, true);
+            }
+            else
+            {
+               sendSemaphore = null;
+            }
+         }
+         else
+         {
+            resendCache = null;
+
+            sendSemaphore = null;
+         }
+      }
+
+      public long getID()
+      {
+         return id;
+      }
+
+      public int getLastReceivedCommandID()
+      {
+         return lastReceivedCommandID;
+      }
+
+      public Lock getLock()
+      {
+         return lock;
+      }
+
+      public void returnBlocking()
+      {
+         lock.lock();
+
+         try
+         {
+            response = new PacketImpl(EARLY_RESPONSE);
+
+            sendCondition.signal();
+         }
+         finally
+         {
+            lock.unlock();
+         }
+      }
+
+      // This must never called by more than one thread concurrently
+      public void send(final Packet packet)
+      {
+         synchronized (sendLock)
+         {
+            packet.setChannelID(id);
+
+            final MessagingBuffer buffer = connection.transportConnection.createBuffer(packet.getRequiredBufferSize());
+
+            int size = packet.encode(buffer);
+
+            // Must block on semaphore outside the main lock or this can prevent failover from occurring
+            if (sendSemaphore != null && packet.getType() != PACKETS_CONFIRMED)
+            {
+               try
+               {
+                  sendSemaphore.acquire(size);
+               }
+               catch (InterruptedException e)
+               {
+                  throw new IllegalStateException("Semaphore interrupted");
+               }
+            }
+
+            lock.lock();
+
+            try
+            {
+               while (failingOver)
+               {
+                  // TODO - don't hardcode this timeout
+                  try
+                  {
+                     failoverCondition.await(10000, TimeUnit.MILLISECONDS);
+                  }
+                  catch (InterruptedException e)
+                  {
+                  }
+               }
+
+               if (resendCache != null && packet.isRequiresConfirmations())
+               {
+                  resendCache.add(packet);
+               }
+
+               if (connection.active || packet.isWriteAlways())
+               {              
+                  connection.transportConnection.write(buffer);
+               }
+            }
+            finally
+            {
+               lock.unlock();
+            }
+         }
+      }
+
+      public Packet sendBlocking(final Packet packet) throws MessagingException
+      {
+         if (closed)
+         {
+            throw new MessagingException(MessagingException.NOT_CONNECTED, "Connection is destroyed");
+         }
+
+         if (connection.blockingCallTimeout == -1)
+         {
+            throw new IllegalStateException("Cannot do a blocking call timeout on a server side connection");
+         }
+
+         // Synchronized since can't be called concurrently by more than one thread and this can occur
+         // E.g. blocking acknowledge() from inside a message handler at some time as other operation on main thread
+         synchronized (sendBlockingLock)
+         {
+            packet.setChannelID(id);
+
+            final MessagingBuffer buffer = connection.transportConnection.createBuffer(packet.getRequiredBufferSize());
+
+            int size = packet.encode(buffer);
+
+            // Must block on semaphore outside the main lock or this can prevent failover from occurring
+            if (sendSemaphore != null)
+            {
+               try
+               {
+                  sendSemaphore.acquire(size);
+               }
+               catch (InterruptedException e)
+               {
+                  throw new IllegalStateException("Semaphore interrupted");
+               }
+            }
+
+            lock.lock();
+
+            try
+            {
+               while (failingOver)
+               {
+                  // TODO - don't hardcode this timeout
+                  try
+                  {
+                     failoverCondition.await(10000, TimeUnit.MILLISECONDS);
+                  }
+                  catch (InterruptedException e)
+                  {
+                  }
+               }
+
+               response = null;
+
+               if (resendCache != null && packet.isRequiresConfirmations())
+               {
+                  resendCache.add(packet);
+               }
+
+               connection.transportConnection.write(buffer);
+
+               long toWait = connection.blockingCallTimeout;
+
+               long start = System.currentTimeMillis();
+
+               while (response == null && toWait > 0)
+               {
+                  try
+                  {
+                     sendCondition.await(toWait, TimeUnit.MILLISECONDS);
+                  }
+                  catch (InterruptedException e)
+                  {
+                  }
+
+                  final long now = System.currentTimeMillis();
+
+                  toWait -= now - start;
+
+                  start = now;
+               }
+
+               if (response == null)
+               {
+                  throw new MessagingException(MessagingException.CONNECTION_TIMEDOUT,
+                                               "Timed out waiting for response when sending packet " + packet.getType());
+               }
+
+               if (response.getType() == PacketImpl.EXCEPTION)
+               {
+                  final MessagingExceptionMessage mem = (MessagingExceptionMessage)response;
+
+                  throw mem.getException();
+               }
+               else
+               {
+                  return response;
+               }
+            }
+            finally
+            {
+               lock.unlock();
+            }
+         }
+      }
+
+      // Must be synchronized since can be called by incoming session commands but also by deliveries
+      // Also needs to be synchronized with respect to replicatingChannelDead
+      public DelayedResult replicatePacket(final Packet packet)
+      {
+         synchronized (replicationLock)
+         {
+            if (replicatingChannel != null)
+            {
+               DelayedResult result = new DelayedResult();
+
+               responseActions.add(result);
+
+               responseActionCount++;
+
+               replicatingChannel.send(packet);
+
+               return result;
+            }
+            else
+            {
+               return null;
+            }
+         }
+      }
+
+      // The replicating connection has died (backup has died)
+      public void replicatingChannelDead()
+      {
+         synchronized (replicationLock)
+         {
+            replicatingChannel = null;
+
+            // Execute all the response actions now
+
+            while (true)
+            {
+               DelayedResult result = responseActions.poll();
+
+               if (result != null)
+               {
+                  result.replicated();
+               }
+               else
+               {
+                  break;
+               }
+            }
+
+            responseActionCount = 0;
+         }
+      }
+
+      public void replicateComplete()
+      {      
+         if (!connection.active)
+         {
+            // We're on backup so send back a replication response
+
+            Packet packet = new PacketImpl(REPLICATION_RESPONSE);
+
+            packet.setChannelID(id);
+
+            doWrite(packet);
+         }
+      }
+
+      // This will never get called concurrently by more than one thread
+
+      private int responseActionCount;
+
+      // TODO it's not ideal synchronizing this since it forms a contention point with replication
+      // but we need to do this to protect it w.r.t. the check on replicatingChannel
+      public void replicateResponseReceived()
+      {
+         DelayedResult result = null;
+
+         synchronized (replicationLock)
+         {
+            if (replicatingChannel != null)
+            {
+               result = responseActions.poll();
+
+               if (result == null)
+               {
+                  throw new IllegalStateException("Cannot find response action");
+               }
+            }
+         }
+
+         // Must execute outside of lock
+         if (result != null)
+         {
+            result.replicated();
+
+            // TODO - we can optimise this not to lock every time - only if waiting for all replications to return
+            synchronized (replicationLock)
+            {
+               responseActionCount--;
+
+               if (responseActionCount == 0)
+               {
+                  replicationLock.notify();
+               }
+            }
+         }
+      }
+
+      private void waitForAllReplicationResponse()
+      {
+         synchronized (replicationLock)
+         {
+            if (replicatingChannel != null)
+            {
+               long toWait = 10000; // TODO don't hardcode timeout
+
+               long start = System.currentTimeMillis();
+
+               while (responseActionCount > 0 && toWait > 0)
+               {
+                  try
+                  {
+                     replicationLock.wait();
+                  }
+                  catch (InterruptedException e)
+                  {
+                  }
+
+                  long now = System.currentTimeMillis();
+
+                  toWait -= now - start;
+
+                  start = now;
+               }
+
+               if (toWait <= 0)
+               {
+                  log.warn("Timed out waiting for replication responses to return");
+               }
+            }
+         }
+      }
+
+      public void setHandler(final ChannelHandler handler)
+      {
+         this.handler = handler;
+      }
+
+      public void close()
+      {
+         if (closed)
+         {
+            return;
+         }
+
+         if (!connection.destroyed && connection.channels.remove(id) == null)
+         {
+            throw new IllegalArgumentException("Cannot find channel with id " + id + " to close");
+         }
+
+         if (replicatingChannel != null)
+         {
+            replicatingChannel.close();
+         }
+
+         closed = true;
+      }
+
+      public Channel getReplicatingChannel()
+      {
+         return replicatingChannel;
+      }
+
+      public void transferConnection(final RemotingConnection newConnection)
+      {
+         // Needs to synchronize on the connection to make sure no packets from
+         // the old connection get processed after transfer has occurred
+         synchronized (connection.transferLock)
+         {
+            connection.channels.remove(id);
+
+            // If we're reconnecting to a live node which is replicated then there will be a replicating channel
+            // too. We need to then make sure that all replication responses come back since packets aren't
+            // considered confirmed until response comes back and is processed. Otherwise responses to previous
+            // message sends could come back after reconnection resulting in clients resending same message
+            // since it wasn't confirmed yet.
+            waitForAllReplicationResponse();
+
+            // And switch it
+
+            final RemotingConnectionImpl rnewConnection = (RemotingConnectionImpl)newConnection;
+
+            if (rnewConnection.channels.containsKey(id))
+            {
+               throw new IllegalStateException("Backup connection already has channel with id " + id);
+            }
+
+            rnewConnection.channels.put(id, this);
+
+            connection = rnewConnection;
+         }
+      }
+
+      public void replayCommands(final int otherLastReceivedCommandID)
+      {
+         clearUpTo(otherLastReceivedCommandID);
+
+         for (final Packet packet : resendCache)
+         {
+            doWrite(packet);
+         }
+      }
+
+      public void lock()
+      {
+         lock.lock();
+
+         failingOver = true;
+
+         lock.unlock();
+      }
+
+      public void unlock()
+      {
+         lock.lock();
+
+         failingOver = false;
+
+         failoverCondition.signalAll();
+
+         lock.unlock();
+      }
+
+      public RemotingConnection getConnection()
+      {
+         return connection;
+      }
+
+      private void handlePacket(final Packet packet)
+      {     
+         if (packet.getType() == PACKETS_CONFIRMED)
+         {
+            if (resendCache != null)
+            {
+               final PacketsConfirmedMessage msg = (PacketsConfirmedMessage)packet;
+
+               clearUpTo(msg.getCommandID());
+            }
+            else if (replicatingChannel != null)
+            {
+               replicatingChannel.send(packet);
+            }
+            else
+            {
+               handler.handlePacket(packet);
+            }
+
+            return;
+         }
+         else
+         {
+            if (connection.interceptors != null)
+            {
+               for (final Interceptor interceptor : connection.interceptors)
+               {
+                  try
+                  {
+                     boolean callNext = interceptor.intercept(packet, connection);
+
+                     if (!callNext)
+                     {
+                        // abort
+
+                        return;
+                     }
+                  }
+                  catch (final Throwable e)
+                  {
+                     log.warn("Failure in calling interceptor: " + interceptor, e);
+                  }
+               }
+            }
+
+            if (packet.isResponse())
+            {           
+               response = packet;
+
+               confirm(packet);
+
+               lock.lock();
+
+               try
+               {
+                  sendCondition.signal();
+               }
+               finally
+               {
+                  lock.unlock();
+               }
+            }
+            else if (handler != null)
+            {
+               handler.handlePacket(packet);
+            }
+         }
+      }
+
+      private void doWrite(final Packet packet)
+      {
+         final MessagingBuffer buffer = connection.transportConnection.createBuffer(packet.getRequiredBufferSize());
+
+         packet.encode(buffer);
+
+         connection.transportConnection.write(buffer);
+      }
+
+      public void confirm(final Packet packet)
+      {
+         if (resendCache != null && packet.isRequiresConfirmations())
+         {
+            lastReceivedCommandID++;
+
+            receivedBytes += packet.getPacketSize();
+
+            if (receivedBytes >= confWindowSize)
+            {
+               receivedBytes = 0;
+
+               if (connection.active)
+               {
+                  final Packet confirmed = new PacketsConfirmedMessage(lastReceivedCommandID);
+
+                  confirmed.setChannelID(id);
+
+                  doWrite(confirmed);
+               }
+            }
+         }
+      }
+
+      private void clearUpTo(final int lastReceivedCommandID)
+      {
+         final int numberToClear = 1 + lastReceivedCommandID - firstStoredCommandID;
+
+         if (numberToClear == -1)
+         {
+            throw new IllegalArgumentException("Invalid lastReceivedCommandID: " + lastReceivedCommandID);
+         }
+
+         int sizeToFree = 0;
+
+         for (int i = 0; i < numberToClear; i++)
+         {
+            final Packet packet = resendCache.poll();
+
+            if (packet == null)
+            {
+               throw new IllegalStateException(System.identityHashCode(this) + " Can't find packet to clear: " +
+                                               " last received command id " +
+                                               lastReceivedCommandID +
+                                               " first stored command id " +
+                                               firstStoredCommandID +
+                                               " cache size " +
+                                               this.resendCache.size() +
+                                               " channel id " +
+                                               id +
+                                               " client " +
+                                               connection.client +
+                                               " created active " +
+                                               connection.createdActive);
+            }
+
+            if (packet.getType() != PACKETS_CONFIRMED)
+            {
+               sizeToFree += packet.getPacketSize();
+            }
+         }
+
+         firstStoredCommandID += numberToClear;
+
+         if (sendSemaphore != null)
+         {
+            sendSemaphore.release(sizeToFree);
+         }
+      }
+
+      private class ReplicatedPacketsConfirmedChannelHandler implements ChannelHandler
+      {
+         public void handlePacket(final Packet packet)
+         {
+            switch (packet.getType())
+            {
+               case REPLICATION_RESPONSE:
+               {
+                  replicateResponseReceived();
+
+                  break;
+               }
+               default:
+               {
+                  throw new IllegalArgumentException("Invalid packet " + packet);
+               }
+            }
+         }
+      }
+   }
+
+   private class Pinger implements Runnable
+   {
+      public synchronized void run()
+      {
+         if (!firstTime && !gotPong)
+         {
+            // Error - didn't get pong back
+            final MessagingException me = new MessagingException(MessagingException.NOT_CONNECTED,
+                                                                 "Did not receive pong from server, active " + createdActive +
+                                                                          " client " +
+                                                                          client);
+
+            fail(me);
+         }
+
+         gotPong = false;
+
+         firstTime = false;
+
+         // Send ping
+         final Packet ping = new Ping(connectionTTL);
+
+         pingChannel.send(ping);
+      }
+   }
+
+   private class PingPongHandler implements ChannelHandler
+   {
+      public void handlePacket(final Packet packet)
+      {
+         final byte type = packet.getType();
+
+         if (type == PONG)
+         {
+            gotPong = true;
+
+            if (stopPinging)
+            {
+               future.cancel(true);
+            }
+         }
+         else if (type == PING)
+         {
+            // connectionTTL if specified on the server overrides any value specified in the ping.
+
+            long connectionTTLToUse = connectionTTL != -1 ? connectionTTL : ((Ping)packet).getExpirePeriod();
+
+            expireTime = System.currentTimeMillis() + connectionTTLToUse;
+
+            // Parameter is placeholder for future
+            final Packet pong = new Pong(-1);
+
+            pingChannel.send(pong);
+         }
+         else
+         {
+            throw new IllegalArgumentException("Invalid packet: " + packet);
+         }
+      }
+   }
+
+   private class ReplicatingConnectionFailureListener implements FailureListener
+   {
+      public boolean connectionFailed(final MessagingException me)
+      {
+         synchronized (RemotingConnectionImpl.this)
+         {
+            for (Channel channel : channels.values())
+            {
+               channel.replicatingChannelDead();
+            }
+         }
+
+         return true;
+      }
+   }
+}

Added: trunk/dotnet/JBMClient/remoting/impl/RemotingServiceImpl.java
===================================================================
--- trunk/dotnet/JBMClient/remoting/impl/RemotingServiceImpl.java	                        (rev 0)
+++ trunk/dotnet/JBMClient/remoting/impl/RemotingServiceImpl.java	2009-02-05 01:20:31 UTC (rev 5812)
@@ -0,0 +1,370 @@
+/*
+ * 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.remoting.impl;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.Timer;
+import java.util.TimerTask;
+import java.util.concurrent.ConcurrentHashMap;
+
+import org.jboss.messaging.core.config.Configuration;
+import org.jboss.messaging.core.config.TransportConfiguration;
+import org.jboss.messaging.core.exception.MessagingException;
+import org.jboss.messaging.core.logging.Logger;
+import org.jboss.messaging.core.management.ManagementService;
+import org.jboss.messaging.core.remoting.Channel;
+import org.jboss.messaging.core.remoting.ChannelHandler;
+import org.jboss.messaging.core.remoting.Interceptor;
+import org.jboss.messaging.core.remoting.RemotingConnection;
+import org.jboss.messaging.core.remoting.RemotingService;
+import org.jboss.messaging.core.remoting.impl.invm.InVMAcceptorFactory;
+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.Connection;
+import org.jboss.messaging.core.remoting.spi.ConnectionLifeCycleListener;
+import org.jboss.messaging.core.remoting.spi.MessagingBuffer;
+import org.jboss.messaging.core.server.MessagingServer;
+import org.jboss.messaging.core.server.impl.MessagingServerPacketHandler;
+
+/**
+ * @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>
+ * @version <tt>$Revision$</tt>
+ */
+public class RemotingServiceImpl implements RemotingService, ConnectionLifeCycleListener
+{
+   // Constants -----------------------------------------------------
+
+   private static final Logger log = Logger.getLogger(RemotingServiceImpl.class);
+
+   // Attributes ----------------------------------------------------
+
+   private volatile boolean started = false;
+
+   private final Set<TransportConfiguration> transportConfigs;
+
+   private final List<Interceptor> interceptors = new ArrayList<Interceptor>();
+
+   private final Set<Acceptor> acceptors = new HashSet<Acceptor>();
+
+   private final Map<Object, RemotingConnection> connections = new ConcurrentHashMap<Object, RemotingConnection>();
+
+   private Timer failedConnectionTimer;
+
+   private TimerTask failedConnectionsTask;
+
+   private final long connectionScanPeriod;
+   
+   private final long connectionTTL;
+
+   private final boolean jmxEnabled;
+
+   private final BufferHandler bufferHandler = new DelegatingBufferHandler();
+
+   private volatile boolean backup;
+
+   private volatile MessagingServer server;
+
+   private ManagementService managementService;
+
+   
+   // Static --------------------------------------------------------
+
+   // Constructors --------------------------------------------------
+
+   public RemotingServiceImpl(final Configuration config)
+   {
+      transportConfigs = config.getAcceptorConfigurations();
+
+      ClassLoader loader = Thread.currentThread().getContextClassLoader();
+      for (String interceptorClass : config.getInterceptorClassNames())
+      {
+         try
+         {
+            Class<?> clazz = loader.loadClass(interceptorClass);
+            interceptors.add((Interceptor)clazz.newInstance());
+         }
+         catch (Exception e)
+         {
+            log.warn("Error instantiating interceptor \"" + interceptorClass + "\"", e);
+         }
+      }
+
+      connectionScanPeriod = config.getConnectionScanPeriod();
+      
+      connectionTTL = config.getConnectionTTLOverride();
+
+      backup = config.isBackup();  
+      
+      jmxEnabled= config.isJMXManagementEnabled();
+   }
+
+   // RemotingService implementation -------------------------------
+
+   public void setManagementService(final ManagementService managementService)
+   {
+      this.managementService = managementService;
+   }
+   
+   public synchronized void start() throws Exception
+   {
+      if (started)
+      {
+         return;
+      }
+      
+
+      // when JMX is enabled, it requires a INVM acceptor to send the core messages
+      // corresponding to the JMX management operations (@see ReplicationAwareStandardMBeanWrapper)
+      if (jmxEnabled)
+      {
+         boolean invmAcceptorConfigured = false;
+         for (TransportConfiguration config : transportConfigs)
+         {
+            if (InVMAcceptorFactory.class.getName().equals(config.getFactoryClassName()))
+            {
+               invmAcceptorConfigured = true;
+            }
+         }
+         if (!invmAcceptorConfigured)
+         {
+            transportConfigs.add(new TransportConfiguration(InVMAcceptorFactory.class.getName(), new HashMap<String, Object>(), "in-vm"));
+         }
+      }
+
+      ClassLoader loader = Thread.currentThread().getContextClassLoader();
+
+      for (TransportConfiguration info : transportConfigs)
+      {
+         try
+         {
+            Class<?> clazz = loader.loadClass(info.getFactoryClassName());
+
+            AcceptorFactory factory = (AcceptorFactory)clazz.newInstance();
+
+            Acceptor acceptor = factory.createAcceptor(info.getParams(), bufferHandler, this);
+
+            acceptors.add(acceptor);
+
+            if (managementService != null)
+            {
+               managementService.registerAcceptor(acceptor, info);
+            }
+         }
+         catch (Exception e)
+         {
+            log.warn("Error instantiating acceptor \"" + info.getFactoryClassName() + "\"", e);
+         }
+      }
+
+      for (Acceptor a : acceptors)
+      {
+         a.start();
+      }
+      
+      failedConnectionTimer = new Timer(true);
+
+      failedConnectionsTask = new FailedConnectionsTask();
+   
+      failedConnectionTimer.schedule(failedConnectionsTask, connectionScanPeriod, connectionScanPeriod);
+
+      started = true;
+   }
+
+   public synchronized void stop()
+   {
+      if (!started)
+      {
+         return;
+      }
+
+      if (failedConnectionTimer != null)
+      {
+         failedConnectionsTask.cancel();
+
+         failedConnectionsTask = null;
+         
+         failedConnectionTimer.cancel();
+         
+         failedConnectionTimer = null;
+      }
+
+      for (Acceptor acceptor : acceptors)
+      {
+         acceptor.stop();
+      }
+      
+      acceptors.clear();
+      
+      connections.clear();
+
+      started = false;
+   }
+   
+   public boolean isStarted()
+   {
+      return started;
+   }
+
+   public RemotingConnection getConnection(final Object remotingConnectionID)
+   {
+      return connections.get(remotingConnectionID);
+   }
+
+   public synchronized Set<RemotingConnection> getConnections()
+   {
+      return new HashSet<RemotingConnection>(connections.values());
+   }
+
+   public void setMessagingServer(final MessagingServer server)
+   {
+      this.server = server;
+   }
+
+   public void setBackup(final boolean backup)
+   {
+      this.backup = backup;
+   }
+
+   // ConnectionLifeCycleListener implementation -----------------------------------
+
+   public void connectionCreated(final Connection connection)
+   {
+      if (server == null)
+      {
+         throw new IllegalStateException("Unable to create connection, server hasn't finished starting up");
+      }
+      
+      RemotingConnection replicatingConnection = server.getReplicatingConnection();
+
+      RemotingConnection rc = new RemotingConnectionImpl(connection,                                                                                             
+                                                         interceptors,
+                                                         replicatingConnection,
+                                                         !backup,
+                                                         connectionTTL);
+
+      Channel channel1 = rc.getChannel(1,  -1, false);
+
+      ChannelHandler handler = new MessagingServerPacketHandler(server, channel1, rc);
+
+      channel1.setHandler(handler);
+
+      Object id = connection.getID();
+
+      connections.put(id, rc);
+   }
+
+   public void connectionDestroyed(final Object connectionID)
+   {
+      RemotingConnection conn = connections.remove(connectionID);
+      
+      if (conn != null)
+      {
+         conn.destroy();
+      }      
+   }
+
+   public void connectionException(final Object connectionID, final MessagingException me)
+   {
+      RemotingConnection rc = connections.remove(connectionID);
+
+      if (rc != null)
+      {
+         rc.fail(me);
+      }     
+   }
+
+   public void addInterceptor(final Interceptor interceptor)
+   {
+      interceptors.add(interceptor);
+   }
+
+   public boolean removeInterceptor(final Interceptor interceptor)
+   {
+      return interceptors.remove(interceptor);
+   }
+
+   // Public --------------------------------------------------------
+
+   // Package protected ---------------------------------------------
+
+   // Protected -----------------------------------------------------
+
+   // Private -------------------------------------------------------
+
+   // Inner classes -------------------------------------------------
+
+   private class FailedConnectionsTask extends TimerTask
+   {
+      private boolean cancelled;
+
+      @Override
+      public synchronized void run()
+      {
+         if (cancelled)
+         {
+            return;
+         }
+
+         Set<RemotingConnection> failedConnections = new HashSet<RemotingConnection>();
+
+         long now = System.currentTimeMillis();
+
+         for (RemotingConnection conn : connections.values())
+         {
+            if (conn.isExpired(now))
+            {
+               failedConnections.add(conn);
+            }
+         }
+
+         for (RemotingConnection conn : failedConnections)
+         {
+            MessagingException me = new MessagingException(MessagingException.CONNECTION_TIMEDOUT,
+                                                           "Did not receive ping on connection. It is likely a client has exited or crashed without " + "closing its connection, or the network between the server and client has failed. The connection will now be closed.");
+
+            conn.fail(me);
+         }
+      }
+
+      @Override
+      public synchronized boolean cancel()
+      {
+         cancelled = true;
+
+         return super.cancel();
+      }
+
+   }
+
+   private class DelegatingBufferHandler extends AbstractBufferHandler
+   {
+      public void bufferReceived(final Object connectionID, final MessagingBuffer buffer)
+      {
+         RemotingConnection conn = connections.get(connectionID);
+
+         if (conn != null)
+         {
+            conn.bufferReceived(connectionID, buffer);
+         }
+      }
+   }
+
+}
\ No newline at end of file

Added: trunk/dotnet/JBMClient/remoting/impl/invm/InVMAcceptor.java
===================================================================
--- trunk/dotnet/JBMClient/remoting/impl/invm/InVMAcceptor.java	                        (rev 0)
+++ trunk/dotnet/JBMClient/remoting/impl/invm/InVMAcceptor.java	2009-02-05 01:20:31 UTC (rev 5812)
@@ -0,0 +1,174 @@
+/*
+  * 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.core.remoting.impl.invm;
+
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ConcurrentMap;
+
+import org.jboss.messaging.core.exception.MessagingException;
+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 InVMAcceptor
+ * 
+ * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
+ *
+ */
+public class InVMAcceptor implements Acceptor
+{   
+   private final int id;
+   
+   private final BufferHandler handler;
+   
+   private final ConnectionLifeCycleListener listener;
+   
+   private ConcurrentMap<String, Connection> connections = new ConcurrentHashMap<String, Connection>();
+   
+   private volatile boolean started;
+   
+   public InVMAcceptor(final Map<String, Object> configuration, final BufferHandler handler,
+                       final ConnectionLifeCycleListener listener)
+   {
+      this.handler = handler;
+      
+      this.listener = listener;   
+      
+      this.id = ConfigurationHelper.getIntProperty(TransportConstants.SERVER_ID_PROP_NAME, 0, configuration);
+   }
+   
+   public synchronized void start() throws Exception
+   {      
+      if (started)
+      {
+         return;
+      }
+      
+      InVMRegistry registry = InVMRegistry.instance;
+      
+      registry.registerAcceptor(id, this);
+      
+      started = true;
+   }
+
+   public synchronized void stop()
+   {   
+      if (!started)
+      {
+         return;
+      }
+      
+      for (Connection connection: connections.values())
+      {
+         listener.connectionDestroyed(connection.getID());
+      }
+      
+      connections.clear();
+      
+      InVMRegistry.instance.unregisterAcceptor(id);
+      
+      started = true;
+   }
+   
+   public boolean isStarted()
+   {
+      return started;
+   }
+
+   public BufferHandler getHandler()
+   {
+      if (!started)
+      {
+         throw new IllegalStateException("Acceptor is not started");
+      }
+      
+      return handler;
+   }
+   
+   public void connect(final String connectionID, final BufferHandler remoteHandler,
+                       final InVMConnector connector)
+   {
+      if (!started)
+      {
+         throw new IllegalStateException("Acceptor is not started");
+      }
+      
+      new InVMConnection(id, connectionID, remoteHandler, new Listener(connector));               
+   }
+   
+   public void disconnect(final String connectionID)
+   {
+      if (!started)
+      {
+         throw new IllegalStateException("Acceptor is not started");
+      }
+      
+      Connection conn = connections.get(connectionID);
+      
+      if (conn != null)
+      {
+         conn.close();
+      }            
+   }
+   
+   private class Listener implements ConnectionLifeCycleListener
+   {
+      private final InVMConnector connector;
+      
+      Listener(final InVMConnector connector)
+      {
+         this.connector = connector;
+      }
+      
+      public void connectionCreated(final Connection connection)
+      {
+         if (connections.putIfAbsent((String)connection.getID(), connection) != null)
+         {
+            throw new IllegalArgumentException("Connection already exists with id " + connection.getID());
+         }
+         
+         listener.connectionCreated(connection);
+      }
+
+      public void connectionDestroyed(final Object connectionID)
+      {
+         if (connections.remove(connectionID) != null)
+         {                    
+            //Remove on the other side too
+            connector.disconnect((String)connectionID);
+            
+            listener.connectionDestroyed(connectionID);
+         }
+      }
+
+      public void connectionException(final Object connectionID, final MessagingException me)
+      {
+         listener.connectionException(connectionID, me);
+      }
+      
+   }
+   
+}

Added: trunk/dotnet/JBMClient/remoting/impl/invm/InVMAcceptorFactory.java
===================================================================
--- trunk/dotnet/JBMClient/remoting/impl/invm/InVMAcceptorFactory.java	                        (rev 0)
+++ trunk/dotnet/JBMClient/remoting/impl/invm/InVMAcceptorFactory.java	2009-02-05 01:20:31 UTC (rev 5812)
@@ -0,0 +1,46 @@
+/*
+  * 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.core.remoting.impl.invm;
+
+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 InVMAcceptorFactory
+ * 
+ * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
+ *
+ */
+public class InVMAcceptorFactory implements AcceptorFactory
+{
+
+   public Acceptor createAcceptor(final Map<String, Object> configuration,
+            final BufferHandler handler, final ConnectionLifeCycleListener listener)
+   {
+      return new InVMAcceptor(configuration, handler, listener);
+   }
+
+}

Added: trunk/dotnet/JBMClient/remoting/impl/invm/InVMConnection.java
===================================================================
--- trunk/dotnet/JBMClient/remoting/impl/invm/InVMConnection.java	                        (rev 0)
+++ trunk/dotnet/JBMClient/remoting/impl/invm/InVMConnection.java	2009-02-05 01:20:31 UTC (rev 5812)
@@ -0,0 +1,143 @@
+/*
+  * 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.core.remoting.impl.invm;
+
+import java.nio.ByteBuffer;
+import java.util.concurrent.Executor;
+import java.util.concurrent.Executors;
+
+import org.jboss.messaging.core.logging.Logger;
+import org.jboss.messaging.core.remoting.impl.ByteBufferWrapper;
+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.MessagingBuffer;
+import org.jboss.messaging.util.ExecutorFactory;
+import org.jboss.messaging.util.JBMThreadFactory;
+import org.jboss.messaging.util.OrderedExecutorFactory;
+import org.jboss.messaging.util.UUIDGenerator;
+
+/**
+ * A InVMConnection
+ * 
+ * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
+ *
+ */
+public class InVMConnection implements Connection
+{
+   private static final Logger log = Logger.getLogger(InVMConnection.class);
+
+   private final BufferHandler handler;
+
+   private final ConnectionLifeCycleListener listener;
+
+   private final String id;
+
+   private boolean closed;
+   
+   private final int serverID;
+
+   private static final ExecutorFactory factory =
+      new OrderedExecutorFactory(Executors.newCachedThreadPool(new JBMThreadFactory("JBM-InVM-Transport-Threads")));
+
+   private final Executor executor;
+
+   public InVMConnection(final int serverID, final BufferHandler handler, final ConnectionLifeCycleListener listener)
+   {      
+      this(serverID, UUIDGenerator.getInstance().generateSimpleStringUUID().toString(), handler, listener);
+   }
+
+   public InVMConnection(final int serverID, final String id, final BufferHandler handler, final ConnectionLifeCycleListener listener)
+   {
+      this.serverID = serverID;
+      
+      this.handler = handler;
+
+      this.listener = listener;
+
+      this.id = id;
+
+      executor = factory.getExecutor();
+
+      listener.connectionCreated(this);
+   }
+
+   public synchronized void close()
+   {
+      if (closed)
+      {
+         return;
+      }
+      
+      //We can't wait for the executor to finish processing, since if the connection is closed on failover on the server
+      //and there are other replication requests still in progress and blocked because of the failover
+      //then it will time out waiting for close.
+      //Instead we let the executor complete after close but ignore the actions
+
+      listener.connectionDestroyed(id);
+
+      closed = true;
+   }
+
+   public MessagingBuffer createBuffer(final int size)
+   {
+      return new ByteBufferWrapper(ByteBuffer.allocate(size));
+   }
+
+   public Object getID()
+   {
+      return id;
+   }
+
+   public void write(final MessagingBuffer buffer)
+   {
+      executor.execute(new Runnable()
+      {
+         public void run()
+         {
+            try
+            {
+               if (!closed)
+               {
+                  buffer.getInt(); // read and discard
+                  handler.bufferReceived(id, buffer);
+               }
+               else
+               {
+                  //Ignore - buffer came in after connection is closed
+               }               
+            }
+            catch (Exception e)
+            {
+               final String msg = "Failed to write to handler";
+               log.error(msg, e);
+               throw new IllegalStateException(msg, e);
+            }
+         }
+      });
+   }
+
+   public String getRemoteAddress()
+   {
+      return "invm:" + serverID;
+   }
+}

Added: trunk/dotnet/JBMClient/remoting/impl/invm/InVMConnector.java
===================================================================
--- trunk/dotnet/JBMClient/remoting/impl/invm/InVMConnector.java	                        (rev 0)
+++ trunk/dotnet/JBMClient/remoting/impl/invm/InVMConnector.java	2009-02-05 01:20:31 UTC (rev 5812)
@@ -0,0 +1,195 @@
+/*
+  * 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.core.remoting.impl.invm;
+
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ConcurrentMap;
+
+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 InVMConnector
+ * 
+ * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
+ *
+ */
+public class InVMConnector implements Connector
+{
+   public static final Logger log = Logger.getLogger(InVMConnector.class);
+   
+   //Used for testing failure only
+   public static volatile boolean failOnCreateConnection;
+   public static volatile int numberOfFailures = -1;
+   private static volatile int failures;
+   public static synchronized void resetFailures()
+   {
+      failures = 0;
+      failOnCreateConnection = false;
+      numberOfFailures = -1;
+   }
+   private static synchronized void incFailures()
+   {
+      failures++;
+      if (failures == numberOfFailures)
+      {
+         resetFailures();
+      }
+   }
+
+   protected final int id;
+   
+   private final BufferHandler handler;
+   
+   private final ConnectionLifeCycleListener listener;
+   
+   private final InVMAcceptor acceptor;
+   
+   private ConcurrentMap<String, Connection> connections = new ConcurrentHashMap<String, Connection>();
+   
+   private volatile boolean started;
+   
+   public InVMConnector(final Map<String, Object> configuration,
+                        final BufferHandler handler,
+                        final ConnectionLifeCycleListener listener)
+   {
+      this.listener = listener;
+      
+      this.id = ConfigurationHelper.getIntProperty(TransportConstants.SERVER_ID_PROP_NAME, 0, configuration);
+      
+      this.handler = handler;
+      
+      InVMRegistry registry = InVMRegistry.instance;
+      
+      acceptor = registry.getAcceptor(id);
+      
+      if (acceptor == null)
+      {
+         throw new IllegalStateException("Cannot connect to invm acceptor with id " + id + " has it been started?");
+      }
+   }
+
+   public synchronized void close()
+   {      
+      if (!started)
+      {
+         return;
+      }
+      
+      for (Connection connection: connections.values())
+      {
+         listener.connectionDestroyed(connection.getID());
+      }
+      
+      connections.clear();
+      
+      started = false;
+   }
+   
+   public boolean isStarted()
+   {
+      return started;
+   }
+
+   public Connection createConnection()
+   {
+      if (failOnCreateConnection)
+      {
+         incFailures();
+         //For testing only
+         return null;
+      }
+      
+      Connection conn = internalCreateConnection(acceptor.getHandler(), new Listener());
+      
+      acceptor.connect((String)conn.getID(), handler, this);
+           
+      return conn;
+   }
+   public synchronized void start()
+   {          
+      started = true;
+   }
+   
+   public BufferHandler getHandler()
+   {
+      return handler;
+   }
+   
+   public void disconnect(final String connectionID)
+   {
+      if (!started)
+      {
+         throw new IllegalStateException("Acceptor is not started");
+      }
+      
+      Connection conn = connections.get(connectionID);
+      
+      if (conn != null)
+      {
+         conn.close();
+      }
+   }
+
+   // This may be an injection point for mocks on tests
+   protected Connection internalCreateConnection(final BufferHandler handler, final ConnectionLifeCycleListener listener)
+   {
+      return new InVMConnection(id, handler, listener);
+   }
+      
+   private class Listener implements ConnectionLifeCycleListener
+   {
+      public void connectionCreated(final Connection connection)
+      {         
+         if (connections.putIfAbsent((String)connection.getID(), connection) != null)
+         {
+            throw new IllegalArgumentException("Connection already exists with id " + connection.getID());
+         }
+           
+         listener.connectionCreated(connection);
+      }
+
+      public void connectionDestroyed(final Object connectionID)
+      {         
+         if (connections.remove(connectionID) != null)
+         {                     
+            //Close the correspond connection on the other side
+            acceptor.disconnect((String)connectionID);
+            
+            listener.connectionDestroyed(connectionID);
+         }
+      }
+
+      public void connectionException(final Object connectionID, final MessagingException me)
+      {
+         listener.connectionException(connectionID, me);
+      }
+      
+   }
+
+}

Added: trunk/dotnet/JBMClient/remoting/impl/invm/InVMConnectorFactory.java
===================================================================
--- trunk/dotnet/JBMClient/remoting/impl/invm/InVMConnectorFactory.java	                        (rev 0)
+++ trunk/dotnet/JBMClient/remoting/impl/invm/InVMConnectorFactory.java	2009-02-05 01:20:31 UTC (rev 5812)
@@ -0,0 +1,46 @@
+/*
+  * 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.core.remoting.impl.invm;
+
+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 InVMConnectorFactory
+ * 
+ * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
+ *
+ */
+public class InVMConnectorFactory implements ConnectorFactory
+{
+   public Connector createConnector(final Map<String, Object> configuration,
+                                    final BufferHandler handler,
+                                    final ConnectionLifeCycleListener listener)
+   {      
+      return new InVMConnector(configuration, handler, listener);
+   }
+
+}

Added: trunk/dotnet/JBMClient/remoting/impl/invm/InVMRegistry.java
===================================================================
--- trunk/dotnet/JBMClient/remoting/impl/invm/InVMRegistry.java	                        (rev 0)
+++ trunk/dotnet/JBMClient/remoting/impl/invm/InVMRegistry.java	2009-02-05 01:20:31 UTC (rev 5812)
@@ -0,0 +1,73 @@
+/*
+  * 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.core.remoting.impl.invm;
+
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ConcurrentMap;
+
+import org.jboss.messaging.core.logging.Logger;
+
+/**
+ * A InVMRegistry
+ * 
+ * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
+ *
+ */
+public class InVMRegistry
+{
+   private static final Logger log = Logger.getLogger(InVMRegistry.class);
+
+   public static final InVMRegistry instance = new InVMRegistry();
+
+   private ConcurrentMap<Integer, InVMAcceptor> acceptors = new ConcurrentHashMap<Integer, InVMAcceptor>();
+
+   public void registerAcceptor(final int id, final InVMAcceptor acceptor)
+   {     
+      if (acceptors.putIfAbsent(id, acceptor) != null)
+      {
+         throw new IllegalArgumentException("Acceptor with id " + id + " already registered");
+      }
+   }
+
+   public void unregisterAcceptor(final int id)
+   {      
+      if (acceptors.remove(id) == null)
+      {
+         throw new IllegalArgumentException("Acceptor with id " + id + " not registered");
+      }
+   }
+
+   public InVMAcceptor getAcceptor(final int id)
+   {
+      return acceptors.get(id);
+   }
+
+   public void clear()
+   {
+      this.acceptors.clear();
+   }
+
+   public int size()
+   {
+      return this.acceptors.size();
+   }
+}

Added: trunk/dotnet/JBMClient/remoting/impl/invm/TransportConstants.java
===================================================================
--- trunk/dotnet/JBMClient/remoting/impl/invm/TransportConstants.java	                        (rev 0)
+++ trunk/dotnet/JBMClient/remoting/impl/invm/TransportConstants.java	2009-02-05 01:20:31 UTC (rev 5812)
@@ -0,0 +1,33 @@
+/*
+  * 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.core.remoting.impl.invm;
+
+/**
+ * A TransportConstants
+ * 
+ * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
+ *
+ */
+public class TransportConstants
+{
+   public static final String SERVER_ID_PROP_NAME = "jbm.remoting.invm.serverid";
+}

Added: trunk/dotnet/JBMClient/remoting/impl/ssl/SSLSupport.java
===================================================================
--- trunk/dotnet/JBMClient/remoting/impl/ssl/SSLSupport.java	                        (rev 0)
+++ trunk/dotnet/JBMClient/remoting/impl/ssl/SSLSupport.java	2009-02-05 01:20:31 UTC (rev 5812)
@@ -0,0 +1,207 @@
+/*
+ * 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.remoting.impl.ssl;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.security.GeneralSecurityException;
+import java.security.KeyStore;
+import java.security.SecureRandom;
+import java.security.cert.X509Certificate;
+
+import javax.net.ssl.KeyManager;
+import javax.net.ssl.KeyManagerFactory;
+import javax.net.ssl.SSLContext;
+import javax.net.ssl.TrustManager;
+import javax.net.ssl.TrustManagerFactory;
+import javax.net.ssl.X509TrustManager;
+
+/**
+ * @author <a href="mailto:jmesnil at redhat.com">Jeff Mesnil</a>
+ * 
+ * @version <tt>$Revision$</tt>
+ * 
+ */
+public class SSLSupport
+{
+   // Constants -----------------------------------------------------
+
+   // Attributes ----------------------------------------------------
+
+   // Static --------------------------------------------------------
+
+   // Constructors --------------------------------------------------
+
+   // Public --------------------------------------------------------
+
+   public static SSLContext createServerContext(String keystorePath,
+         String keystorePassword, String trustStorePath,
+         String trustStorePassword) throws Exception
+   {
+
+      // Initialize the SSLContext to work with our key managers.
+      SSLContext sslContext = SSLContext.getInstance("TLS");
+      KeyManager[] keyManagers = loadKeyManagers(keystorePath, keystorePassword);
+      TrustManager[] trustManagers = loadTrustManager(false, trustStorePath,
+            trustStorePassword);
+      sslContext.init(keyManagers, trustManagers, new SecureRandom());
+
+      return sslContext;
+   }
+
+   public static SSLContext createClientContext(String keystorePath,
+         String keystorePassword) throws Exception
+   {
+      SSLContext context = SSLContext.getInstance("TLS");
+      KeyManager[] keyManagers = loadKeyManagers(keystorePath, keystorePassword);
+      TrustManager[] trustManagers = loadTrustManager(true,  null, null);
+      context.init(keyManagers, trustManagers, new SecureRandom());
+      return context;
+   }
+
+   public static SSLContext getInstance(boolean client, String keystorePath,
+         String keystorePassword, String trustStorePath,
+         String trustStorePassword) throws GeneralSecurityException, Exception
+   {
+      if (client)
+      {
+         return createClientContext(keystorePath, keystorePassword);
+      } else
+      {
+         return createServerContext(keystorePath, keystorePassword,
+               trustStorePath, trustStorePassword);
+      }
+   }
+
+   // Package protected ---------------------------------------------
+
+   // Protected -----------------------------------------------------
+
+   // Private -------------------------------------------------------
+
+   private static TrustManager[] loadTrustManager(boolean clientMode,
+         String trustStorePath, String trustStorePassword) throws Exception
+   {
+      if (clientMode)
+      {
+         // we are in client mode and do not want to perform server cert
+         // authentication
+         // return a trust manager that trusts all certs
+         return new TrustManager[] { new X509TrustManager()
+         {
+            public void checkClientTrusted(X509Certificate[] chain,
+                  String authType)
+            {
+            }
+
+            public void checkServerTrusted(X509Certificate[] chain,
+                  String authType)
+            {
+            }
+
+            public X509Certificate[] getAcceptedIssuers()
+            {
+               return null;
+            }
+         } };
+      } else
+      {
+         TrustManagerFactory trustMgrFactory;
+         KeyStore trustStore = SSLSupport.loadKeystore(trustStorePath,
+               trustStorePassword);
+         trustMgrFactory = TrustManagerFactory.getInstance(TrustManagerFactory
+               .getDefaultAlgorithm());
+         trustMgrFactory.init(trustStore);
+         return trustMgrFactory.getTrustManagers();
+      }
+   }
+
+   private static KeyStore loadKeystore(String keystorePath,
+         String keystorePassword) throws Exception
+   {
+      assert keystorePath != null;
+      assert keystorePassword != null;
+      
+      KeyStore ks = KeyStore.getInstance("JKS");
+      InputStream in = null;
+      try
+      {
+         URL keystoreURL = validateStoreURL(keystorePath);
+         ks.load(keystoreURL.openStream(), keystorePassword.toCharArray());
+      } finally
+      {
+         if (in != null)
+         {
+            try
+            {
+               in.close();
+            } catch (IOException ignored)
+            {
+            }
+         }
+      }
+      return ks;
+   }
+
+   private static KeyManager[] loadKeyManagers(String keystorePath,
+         String keystorePassword) throws Exception
+   {
+      KeyManagerFactory kmf = KeyManagerFactory.getInstance(KeyManagerFactory
+            .getDefaultAlgorithm());
+      KeyStore ks = loadKeystore(keystorePath, keystorePassword);
+      kmf.init(ks, keystorePassword.toCharArray());
+
+      return kmf.getKeyManagers();
+   }
+
+   private static URL validateStoreURL(String storePath) throws Exception
+   {
+      assert storePath != null;
+      
+      // First see if this is a URL
+      try
+      {
+         return new URL(storePath);
+      } catch (MalformedURLException e)
+      {
+         File file = new File(storePath);
+         if (file.exists() == true && file.isFile())
+         {
+            return file.toURL();
+         } else
+         {
+            URL url = Thread.currentThread().getContextClassLoader()
+                  .getResource(storePath);
+            if (url != null)
+               return url;
+         }
+      }
+
+      throw new Exception("Failed to find a store at " + storePath);
+   }
+
+   // Inner classes -------------------------------------------------
+}

Added: trunk/dotnet/JBMClient/remoting/impl/wireformat/CreateSessionMessage.java
===================================================================
--- trunk/dotnet/JBMClient/remoting/impl/wireformat/CreateSessionMessage.java	                        (rev 0)
+++ trunk/dotnet/JBMClient/remoting/impl/wireformat/CreateSessionMessage.java	2009-02-05 01:20:31 UTC (rev 5812)
@@ -0,0 +1,225 @@
+/*
+ * 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.remoting.impl.wireformat;
+
+import org.jboss.messaging.core.remoting.spi.MessagingBuffer;
+
+/**
+ * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
+ * @author <a href="mailto:jmesnil at redhat.com">Jeff Mesnil</a>.
+ * 
+ * @version <tt>$Revision$</tt>
+ */
+public class CreateSessionMessage extends PacketImpl
+{
+   // Constants -----------------------------------------------------
+
+   // Attributes ----------------------------------------------------
+   
+   private String name;
+   
+   private long sessionChannelID;
+   
+   private int version;
+   
+   private String username;
+   
+   private String password;
+   
+   private int minLargeMessageSize;
+   
+   private boolean xa;
+   
+   private boolean autoCommitSends;
+   
+   private boolean autoCommitAcks;
+
+   private boolean preAcknowledge;
+   
+   private int windowSize;
+
+   // Static --------------------------------------------------------
+
+   // Constructors --------------------------------------------------
+
+   public CreateSessionMessage(final String name, final long sessionChannelID,
+                               final int version, final String username, final String password,
+                               final int minLargeMessageSize, 
+                               final boolean xa, final boolean autoCommitSends,
+                               final boolean autoCommitAcks, final boolean preAcknowledge, final int windowSize)
+   {
+      super(CREATESESSION);
+      
+      this.name = name;
+      
+      this.sessionChannelID = sessionChannelID;
+      
+      this.version = version;
+
+      this.username = username;
+      
+      this.password = password;
+      
+      this.minLargeMessageSize = minLargeMessageSize;
+      
+      this.xa = xa;
+      
+      this.autoCommitSends = autoCommitSends;
+      
+      this.autoCommitAcks = autoCommitAcks;
+      
+      this.windowSize = windowSize;
+
+      this.preAcknowledge = preAcknowledge;
+   }
+   
+   public CreateSessionMessage()
+   {
+      super(CREATESESSION);
+   }
+
+   // Public --------------------------------------------------------
+
+   public String getName()
+   {
+      return name;
+   }
+   
+   public long getSessionChannelID()
+   {      
+      return sessionChannelID;
+   }
+   
+   public int getVersion()
+   {
+      return version;
+   }
+   
+   public String getUsername()
+   {
+      return username;
+   }
+   
+   public String getPassword()
+   {
+      return password;
+   }
+   
+   public boolean isXA()
+   {
+      return xa;
+   }
+
+   public boolean isAutoCommitSends()
+   {
+      return this.autoCommitSends;
+   }
+   
+   public boolean isAutoCommitAcks()
+   {
+      return this.autoCommitAcks;
+   }
+
+   public boolean isPreAcknowledge()
+   {
+      return preAcknowledge;
+   }
+
+   public int getWindowSize()
+   {
+      return this.windowSize;
+   }
+   
+   public void encodeBody(final MessagingBuffer buffer)
+   {
+      buffer.putString(name);
+      buffer.putLong(sessionChannelID);
+      buffer.putInt(version);
+      buffer.putNullableString(username);
+      buffer.putNullableString(password);
+      buffer.putInt(minLargeMessageSize);
+      buffer.putBoolean(xa);
+      buffer.putBoolean(autoCommitSends);
+      buffer.putBoolean(autoCommitAcks);
+      buffer.putInt(windowSize);
+      buffer.putBoolean(preAcknowledge);
+   }
+   
+   public void decodeBody(final MessagingBuffer buffer)
+   {
+      name = buffer.getString();
+      sessionChannelID = buffer.getLong();
+      version = buffer.getInt();
+      username = buffer.getNullableString();
+      password = buffer.getNullableString();
+      minLargeMessageSize = buffer.getInt();
+      xa = buffer.getBoolean();
+      autoCommitSends = buffer.getBoolean();
+      autoCommitAcks = buffer.getBoolean();
+      windowSize = buffer.getInt();
+      preAcknowledge = buffer.getBoolean();
+   }
+   
+   public boolean equals(Object other)
+   {
+      if (other instanceof CreateSessionMessage == false)
+      {
+         return false;
+      }
+            
+      CreateSessionMessage r = (CreateSessionMessage)other;
+      
+      boolean matches = super.equals(other) &&
+                        this.name.equals(r.name) &&
+                        this.sessionChannelID == r.sessionChannelID &&
+                        this.version == r.version &&
+                        this.xa == r.xa &&
+                        this.autoCommitSends == r.autoCommitSends &&
+                        this.autoCommitAcks == r.autoCommitAcks &&
+                        (this.username == null ? r.username == null : this.username.equals(r.username)) &&
+                        (this.password == null ? r.password == null : this.password.equals(r.password));
+         
+      return matches;
+   }
+   
+   public final boolean isRequiresConfirmations()
+   {
+      return false;
+   }
+
+   /**
+    * @return
+    */
+   public int getMinLargeMessageSize()
+   {
+      return minLargeMessageSize;
+   }
+   
+   // Package protected ---------------------------------------------
+
+   // Protected -----------------------------------------------------
+
+   // Private -------------------------------------------------------
+
+   // Inner classes -------------------------------------------------
+}

Added: trunk/dotnet/JBMClient/remoting/impl/wireformat/CreateSessionResponseMessage.java
===================================================================
--- trunk/dotnet/JBMClient/remoting/impl/wireformat/CreateSessionResponseMessage.java	                        (rev 0)
+++ trunk/dotnet/JBMClient/remoting/impl/wireformat/CreateSessionResponseMessage.java	2009-02-05 01:20:31 UTC (rev 5812)
@@ -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.core.remoting.impl.wireformat;
+
+import org.jboss.messaging.core.remoting.spi.MessagingBuffer;
+
+/**
+ * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
+ * @author <a href="mailto:jmesnil at redhat.com">Jeff Mesnil</a>.
+ * 
+ * @version <tt>$Revision$</tt>
+ */
+public class CreateSessionResponseMessage extends PacketImpl
+{
+   // Constants -----------------------------------------------------
+
+   // Attributes ----------------------------------------------------
+
+   private int serverVersion;
+   
+   // Static --------------------------------------------------------
+
+   // Constructors --------------------------------------------------
+
+   public CreateSessionResponseMessage(final int serverVersion)
+   {
+      super(CREATESESSION_RESP);
+
+      this.serverVersion = serverVersion;
+   }
+   
+   public CreateSessionResponseMessage()
+   {
+      super(CREATESESSION_RESP);
+   }
+
+   // Public --------------------------------------------------------
+   
+   public boolean isResponse()
+   {
+      return true;
+   }
+   
+   public int getServerVersion()
+   {
+      return serverVersion;
+   }
+   
+   public void encodeBody(final MessagingBuffer buffer)
+   {
+      buffer.putInt(serverVersion);      
+   }
+   
+   public void decodeBody(final MessagingBuffer buffer)
+   {
+      serverVersion = buffer.getInt();
+   }
+
+   public boolean equals(Object other)
+   {
+      if (other instanceof CreateSessionResponseMessage == false)
+      {
+         return false;
+      }
+            
+      CreateSessionResponseMessage r = (CreateSessionResponseMessage)other;
+      
+      boolean matches = super.equals(other) &&     
+                        this.serverVersion == r.serverVersion;
+      
+      return matches;
+   }
+   
+   public final boolean isRequiresConfirmations()
+   {
+      return false;
+   }
+
+   // Package protected ---------------------------------------------
+
+   // Protected -----------------------------------------------------
+
+   // Private -------------------------------------------------------
+
+   // Inner classes -------------------------------------------------
+}

Added: trunk/dotnet/JBMClient/remoting/impl/wireformat/MessagingExceptionMessage.java
===================================================================
--- trunk/dotnet/JBMClient/remoting/impl/wireformat/MessagingExceptionMessage.java	                        (rev 0)
+++ trunk/dotnet/JBMClient/remoting/impl/wireformat/MessagingExceptionMessage.java	2009-02-05 01:20:31 UTC (rev 5812)
@@ -0,0 +1,109 @@
+/*
+ * 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.remoting.impl.wireformat;
+
+import org.jboss.messaging.core.exception.MessagingException;
+import org.jboss.messaging.core.remoting.spi.MessagingBuffer;
+
+/**
+ * @author <a href="mailto:jmesnil at redhat.com">Jeff Mesnil</a>
+ * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
+ * 
+ * @version <tt>$Revision$</tt>
+ * 
+ */
+public class MessagingExceptionMessage extends PacketImpl
+{
+   // Constants -----------------------------------------------------
+
+   // Attributes ----------------------------------------------------
+
+   private MessagingException exception;
+
+   // Static --------------------------------------------------------
+
+   // Constructors --------------------------------------------------
+
+   public MessagingExceptionMessage(final MessagingException exception)
+   {
+      super(EXCEPTION);
+
+      this.exception = exception;
+   }
+
+   public MessagingExceptionMessage()
+   {
+      super(EXCEPTION);
+   }
+
+   // Public --------------------------------------------------------
+
+   public boolean isResponse()
+   {
+      return true;
+   }
+
+   public MessagingException getException()
+   {
+      return exception;
+   }
+
+   public void encodeBody(final MessagingBuffer buffer)
+   {
+      buffer.putInt(exception.getCode());
+      buffer.putNullableString(exception.getMessage());
+   }
+
+   public void decodeBody(final MessagingBuffer buffer)
+   {
+      int code = buffer.getInt();
+      String msg = buffer.getNullableString();
+      exception = new MessagingException(code, msg);
+   }
+
+   @Override
+   public String toString()
+   {
+      return getParentString() + ", exception= " + exception + "]";
+   }
+
+   public boolean equals(Object other)
+   {
+      if (other instanceof MessagingExceptionMessage == false)
+      {
+         return false;
+      }
+
+      MessagingExceptionMessage r = (MessagingExceptionMessage)other;
+
+      return super.equals(other) && this.exception.equals(r.exception);
+   }
+
+   // Package protected ---------------------------------------------
+
+   // Protected -----------------------------------------------------
+
+   // Private -------------------------------------------------------
+
+   // Inner classes -------------------------------------------------
+}

Added: trunk/dotnet/JBMClient/remoting/impl/wireformat/NullResponseMessage.java
===================================================================
--- trunk/dotnet/JBMClient/remoting/impl/wireformat/NullResponseMessage.java	                        (rev 0)
+++ trunk/dotnet/JBMClient/remoting/impl/wireformat/NullResponseMessage.java	2009-02-05 01:20:31 UTC (rev 5812)
@@ -0,0 +1,50 @@
+/*
+ * 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.remoting.impl.wireformat;
+
+
+/**
+ * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
+ * @version <tt>$Revision$</tt>
+ */
+public class NullResponseMessage extends PacketImpl
+{
+   // Constants -----------------------------------------------------
+
+   // Attributes ----------------------------------------------------
+
+   // Static --------------------------------------------------------
+
+   // Constructors --------------------------------------------------
+
+   public NullResponseMessage()
+   {
+      super(NULL_RESPONSE);
+   }
+   
+   // Public --------------------------------------------------------
+
+   @Override
+   public boolean isResponse()
+   {
+      return true;
+   }
+
+   // Package protected ---------------------------------------------
+
+   // Protected -----------------------------------------------------
+
+   // Private -------------------------------------------------------
+
+   // Inner classes -------------------------------------------------
+}

Added: trunk/dotnet/JBMClient/remoting/impl/wireformat/PacketImpl.java
===================================================================
--- trunk/dotnet/JBMClient/remoting/impl/wireformat/PacketImpl.java	                        (rev 0)
+++ trunk/dotnet/JBMClient/remoting/impl/wireformat/PacketImpl.java	2009-02-05 01:20:31 UTC (rev 5812)
@@ -0,0 +1,271 @@
+/*
+ * 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.remoting.impl.wireformat;
+
+import org.jboss.messaging.core.logging.Logger;
+import org.jboss.messaging.core.remoting.Packet;
+import org.jboss.messaging.core.remoting.spi.MessagingBuffer;
+import org.jboss.messaging.util.DataConstants;
+
+/**
+ * @author <a href="mailto:jmesnil at redhat.com">Jeff Mesnil</a>
+ * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
+ * @version <tt>$Revision$</tt>
+ */
+public class PacketImpl implements Packet
+{
+   // Constants -------------------------------------------------------------------------
+
+   private static final Logger log = Logger.getLogger(PacketImpl.class);
+
+   public static final int DEFAULT_PACKET_SIZE = 1024;
+   
+   // The minimal size for all the packets, Common data for all the packets (look at PacketImpl.encode)
+   protected static final int BASIC_PACKET_SIZE = DataConstants.SIZE_INT + DataConstants.SIZE_BYTE + DataConstants.SIZE_LONG;
+
+   private long channelID;
+
+   private final byte type;
+   
+   private int size;
+
+   // The packet types
+   // -----------------------------------------------------------------------------------
+
+   public static final byte PING = 10;
+
+   public static final byte PONG = 11;
+
+   // Miscellaneous
+   public static final byte EXCEPTION = 20;
+
+   public static final byte NULL_RESPONSE = 21;
+
+   public static final byte PACKETS_CONFIRMED = 22;
+
+   public static final byte REPLICATION_RESPONSE = 23;
+
+   public static final byte EARLY_RESPONSE = 24;
+
+   // Server
+   public static final byte CREATESESSION = 30;
+
+   public static final byte CREATESESSION_RESP = 31;
+
+   public static final byte REATTACH_SESSION = 32;
+
+   public static final byte REATTACH_SESSION_RESP = 33;
+
+   public static final byte REPLICATE_CREATESESSION = 34;
+
+   // Session
+   public static final byte SESS_CREATECONSUMER = 40;
+
+   public static final byte SESS_ACKNOWLEDGE = 44;
+   
+   public static final byte SESS_EXPIRED = 45;
+
+   public static final byte SESS_COMMIT = 46;
+
+   public static final byte SESS_ROLLBACK = 47;
+
+   public static final byte SESS_QUEUEQUERY = 48;
+
+   public static final byte SESS_QUEUEQUERY_RESP = 49;
+
+   public static final byte SESS_CREATEQUEUE = 50;
+
+   public static final byte SESS_DELETE_QUEUE = 51;
+
+   public static final byte SESS_ADD_DESTINATION = 52;
+
+   public static final byte SESS_REMOVE_DESTINATION = 53;
+
+   public static final byte SESS_BINDINGQUERY = 54;
+
+   public static final byte SESS_BINDINGQUERY_RESP = 55;
+
+   public static final byte SESS_XA_START = 56;
+
+   public static final byte SESS_XA_END = 57;
+
+   public static final byte SESS_XA_COMMIT = 58;
+
+   public static final byte SESS_XA_PREPARE = 59;
+
+   public static final byte SESS_XA_RESP = 60;
+
+   public static final byte SESS_XA_ROLLBACK = 61;
+
+   public static final byte SESS_XA_JOIN = 62;
+
+   public static final byte SESS_XA_SUSPEND = 63;
+
+   public static final byte SESS_XA_RESUME = 64;
+
+   public static final byte SESS_XA_FORGET = 65;
+
+   public static final byte SESS_XA_INDOUBT_XIDS = 66;
+
+   public static final byte SESS_XA_INDOUBT_XIDS_RESP = 67;
+
+   public static final byte SESS_XA_SET_TIMEOUT = 68;
+
+   public static final byte SESS_XA_SET_TIMEOUT_RESP = 69;
+
+   public static final byte SESS_XA_GET_TIMEOUT = 70;
+
+   public static final byte SESS_XA_GET_TIMEOUT_RESP = 71;
+
+   public static final byte SESS_START = 72;
+
+   public static final byte SESS_STOP = 73;
+
+   public static final byte SESS_CLOSE = 74;
+
+   public static final byte SESS_FLOWTOKEN = 75;
+
+   public static final byte SESS_SEND = 76;
+
+   public static final byte SESS_SEND_CONTINUATION = 77;
+
+   public static final byte SESS_CONSUMER_CLOSE = 78;
+
+   public static final byte SESS_RECEIVE_MSG = 79;
+
+   public static final byte SESS_RECEIVE_CONTINUATION = 80;
+
+   public static final byte SESS_FAILOVER_COMPLETE = 81;
+
+   public static final byte SESS_REPLICATE_DELIVERY = 82;
+
+   // Static --------------------------------------------------------
+
+   public PacketImpl(final byte type)
+   {
+      this.type = type;
+   }
+
+   // Public --------------------------------------------------------
+
+   
+   public byte getType()
+   {
+      return type;
+   }
+
+   public long getChannelID()
+   {
+      return channelID;
+   }
+
+   public void setChannelID(final long channelID)
+   {
+      this.channelID = channelID;
+   }
+   
+   public int encode(final MessagingBuffer buffer)
+   {
+      // The standard header fields
+      buffer.putInt(0); // The length gets filled in at the end
+      buffer.putByte(type);
+      buffer.putLong(channelID);
+
+      encodeBody(buffer);
+
+      size = buffer.position();
+      
+      // The length doesn't include the actual length byte
+      int len = size - DataConstants.SIZE_INT;
+
+      buffer.putInt(0, len);
+
+      buffer.flip();
+      
+      return size;
+   }
+
+   public void decode(final MessagingBuffer buffer)
+   {
+      channelID = buffer.getLong();
+
+      decodeBody(buffer);
+      
+      size = buffer.position();
+   }
+   
+   public final int getPacketSize()
+   {
+      return size;
+   }
+   
+   public int getRequiredBufferSize()
+   {
+      return DEFAULT_PACKET_SIZE;
+   }
+
+   public boolean isResponse()
+   {
+      return false;
+   }
+
+   public void encodeBody(final MessagingBuffer buffer)
+   {
+   }
+
+   public void decodeBody(final MessagingBuffer buffer)
+   {
+   }
+
+   public boolean isRequiresConfirmations()
+   {
+      return true;
+   }
+
+   public boolean isWriteAlways()
+   {
+      return false;
+   }
+
+   @Override
+   public String toString()
+   {
+      return getParentString() + "]";
+   }
+
+   @Override
+   public boolean equals(final Object other)
+   {
+      if (other instanceof PacketImpl == false)
+      {
+         return false;
+      }
+
+      PacketImpl r = (PacketImpl)other;
+
+      return r.type == type && r.channelID == channelID;
+   }
+
+   // Package protected ---------------------------------------------
+
+   protected String getParentString()
+   {
+      return "PACKET[type=" + type + ", channelID=" + channelID + "]";
+   }
+
+   // Protected -----------------------------------------------------
+
+   // Private -------------------------------------------------------
+
+   // Inner classes -------------------------------------------------
+}

Added: trunk/dotnet/JBMClient/remoting/impl/wireformat/PacketsConfirmedMessage.java
===================================================================
--- trunk/dotnet/JBMClient/remoting/impl/wireformat/PacketsConfirmedMessage.java	                        (rev 0)
+++ trunk/dotnet/JBMClient/remoting/impl/wireformat/PacketsConfirmedMessage.java	2009-02-05 01:20:31 UTC (rev 5812)
@@ -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.core.remoting.impl.wireformat;
+
+import org.jboss.messaging.core.remoting.spi.MessagingBuffer;
+
+/**
+ * 
+ * A PacketsConfirmedMessage
+ * 
+ * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
+ *
+ */
+public class PacketsConfirmedMessage extends PacketImpl
+{
+   // Constants -----------------------------------------------------
+
+   // Attributes ----------------------------------------------------
+
+   private int commandID;
+         
+   // Static --------------------------------------------------------
+
+   // Constructors --------------------------------------------------
+
+   public PacketsConfirmedMessage(final int commandID)
+   {
+      super(PACKETS_CONFIRMED);
+
+      this.commandID = commandID;
+   }
+   
+   public PacketsConfirmedMessage()
+   {
+      super(PACKETS_CONFIRMED);
+   }
+
+   // Public --------------------------------------------------------
+
+   public int getCommandID()
+   {
+      return this.commandID;
+   }
+   
+   public void encodeBody(final MessagingBuffer buffer)
+   {
+      buffer.putInt(commandID);
+   }
+   
+   public void decodeBody(final MessagingBuffer buffer)
+   {
+      commandID = buffer.getInt();
+   }
+   
+   @Override
+   public String toString()
+   {
+      return getParentString() + ", commandID=" + commandID + "]";
+   }
+   
+   public boolean equals(Object other)
+   {
+      if (other instanceof PacketsConfirmedMessage == false)
+      {
+         return false;
+      }
+            
+      PacketsConfirmedMessage r = (PacketsConfirmedMessage)other;
+      
+      return super.equals(other) && this.commandID == r.commandID;
+   }
+   
+   public final boolean isRequiresConfirmations()
+   {
+      return false;
+   }
+   
+   // Package protected ---------------------------------------------
+
+   // Protected -----------------------------------------------------
+
+   // Private -------------------------------------------------------
+
+   // Inner classes -------------------------------------------------
+}
+

Added: trunk/dotnet/JBMClient/remoting/impl/wireformat/Ping.java
===================================================================
--- trunk/dotnet/JBMClient/remoting/impl/wireformat/Ping.java	                        (rev 0)
+++ trunk/dotnet/JBMClient/remoting/impl/wireformat/Ping.java	2009-02-05 01:20:31 UTC (rev 5812)
@@ -0,0 +1,108 @@
+/*
+ * 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.remoting.impl.wireformat;
+
+import org.jboss.messaging.core.remoting.spi.MessagingBuffer;
+
+/**
+ * 
+ * A Ping
+ * 
+ * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
+ *
+ */
+public class Ping extends PacketImpl
+{
+   // Constants -----------------------------------------------------
+
+   // Attributes ----------------------------------------------------
+
+   private long expirePeriod;
+
+   // Static --------------------------------------------------------
+
+   // Constructors --------------------------------------------------
+
+   public Ping(final long expirePeriod)
+   {
+      super(PING);
+
+      this.expirePeriod = expirePeriod;
+   }
+   
+   public Ping()
+   {
+      super(PING);
+   }
+
+   // Public --------------------------------------------------------
+
+   public long getExpirePeriod()
+   {
+      return expirePeriod;
+   }
+   
+   public void encodeBody(final MessagingBuffer buffer)
+   {
+      buffer.putLong(expirePeriod);
+   }
+   
+   public void decodeBody(final MessagingBuffer buffer)
+   {
+      expirePeriod = buffer.getLong();
+   }
+
+   @Override
+   public String toString()
+   {
+      StringBuffer buf = new StringBuffer(getParentString());
+      buf.append(", expirePeriod=" + expirePeriod);
+      buf.append("]");
+      return buf.toString();
+   }
+   
+   public boolean equals(Object other)
+   {
+      if (other instanceof Ping == false)
+      {
+         return false;
+      }
+            
+      Ping r = (Ping)other;
+      
+      return super.equals(other) && this.expirePeriod == r.expirePeriod;
+   }
+   
+   public final boolean isRequiresConfirmations()
+   {
+      return false;
+   }
+
+   // Package protected ---------------------------------------------
+
+   // Protected -----------------------------------------------------
+
+   // Private -------------------------------------------------------
+
+   // Inner classes -------------------------------------------------
+}

Added: trunk/dotnet/JBMClient/remoting/impl/wireformat/Pong.java
===================================================================
--- trunk/dotnet/JBMClient/remoting/impl/wireformat/Pong.java	                        (rev 0)
+++ trunk/dotnet/JBMClient/remoting/impl/wireformat/Pong.java	2009-02-05 01:20:31 UTC (rev 5812)
@@ -0,0 +1,120 @@
+/*
+ * 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.remoting.impl.wireformat;
+
+import org.jboss.messaging.core.remoting.spi.MessagingBuffer;
+
+/**
+ * 
+ * A Pong
+ * 
+ * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
+ *
+ */
+public class Pong extends PacketImpl
+{
+   // Constants -----------------------------------------------------
+
+   // Attributes ----------------------------------------------------
+
+   //This is reserved for future use - for now we also pass back -1 - meaning "don't change period"
+   private long newPeriod;
+
+   // Static --------------------------------------------------------
+
+   // Constructors --------------------------------------------------
+
+   public Pong(final long newPeriod)
+   {
+      super(PONG);
+
+      this.newPeriod = newPeriod;
+   }
+   
+   public Pong()
+   {
+      super(PONG);
+   }
+
+   // Public --------------------------------------------------------
+
+   public boolean isResponse()
+   {
+      return true;
+   }
+   
+   public long getNewPeriod()
+   {
+      return newPeriod;
+   }
+   
+   public void encodeBody(final MessagingBuffer buffer)
+   {
+      buffer.putLong(newPeriod);
+   }
+   
+   public void decodeBody(final MessagingBuffer buffer)
+   {
+      newPeriod = buffer.getLong();
+   }
+   
+   public boolean isWriteAlways()
+   {
+      return true;
+   }
+
+   @Override
+   public String toString()
+   {
+      StringBuffer buf = new StringBuffer(getParentString());
+      buf.append(", newPeriod=" + newPeriod);
+      buf.append("]");
+      return buf.toString();
+   }
+   
+   public boolean equals(Object other)
+   {
+      if (other instanceof Pong == false)
+      {
+         return false;
+      }
+            
+      Pong r = (Pong)other;
+      
+      return super.equals(other) && this.newPeriod == r.newPeriod;
+   }
+   
+   public final boolean isRequiresConfirmations()
+   {
+      return false;
+   }
+
+   // Package protected ---------------------------------------------
+
+   // Protected -----------------------------------------------------
+
+   // Private -------------------------------------------------------
+
+   // Inner classes -------------------------------------------------
+}
+

Added: trunk/dotnet/JBMClient/remoting/impl/wireformat/ReattachSessionMessage.java
===================================================================
--- trunk/dotnet/JBMClient/remoting/impl/wireformat/ReattachSessionMessage.java	                        (rev 0)
+++ trunk/dotnet/JBMClient/remoting/impl/wireformat/ReattachSessionMessage.java	2009-02-05 01:20:31 UTC (rev 5812)
@@ -0,0 +1,111 @@
+/*
+ * 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.remoting.impl.wireformat;
+
+import org.jboss.messaging.core.remoting.spi.MessagingBuffer;
+
+/**
+ * 
+ * A ReattachSessionMessage
+ * 
+ * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
+ *
+ */
+public class ReattachSessionMessage extends PacketImpl
+{
+   // Constants -----------------------------------------------------
+
+   // Attributes ----------------------------------------------------
+
+   private String name;
+   
+   private int lastReceivedCommandID;
+   
+   // Static --------------------------------------------------------
+
+   // Constructors --------------------------------------------------
+
+   public ReattachSessionMessage(final String name, final int lastReceivedCommandID)
+   {
+      super(REATTACH_SESSION);
+
+      this.name = name;
+      
+      this.lastReceivedCommandID = lastReceivedCommandID;
+   }
+   
+   public ReattachSessionMessage()
+   {
+      super(REATTACH_SESSION);
+   }
+
+   // Public --------------------------------------------------------
+
+   public String getName()
+   {
+      return name;
+   }
+   
+   public int getLastReceivedCommandID()
+   {
+      return lastReceivedCommandID;
+   }
+   
+   public void encodeBody(final MessagingBuffer buffer)
+   {
+      buffer.putString(name);
+      buffer.putInt(lastReceivedCommandID);
+   }
+   
+   public void decodeBody(final MessagingBuffer buffer)
+   {
+      name = buffer.getString();
+      lastReceivedCommandID = buffer.getInt();
+   }
+
+   public boolean equals(Object other)
+   {
+      if (other instanceof ReattachSessionMessage == false)
+      {
+         return false;
+      }
+            
+      ReattachSessionMessage r = (ReattachSessionMessage)other;
+      
+      return super.equals(other) && this.name.equals(r.name);
+   }
+   
+   public final boolean isRequiresConfirmations()
+   {
+      return false;
+   }
+
+   // Package protected ---------------------------------------------
+
+   // Protected -----------------------------------------------------
+
+   // Private -------------------------------------------------------
+
+   // Inner classes -------------------------------------------------
+}
+

Added: trunk/dotnet/JBMClient/remoting/impl/wireformat/ReattachSessionResponseMessage.java
===================================================================
--- trunk/dotnet/JBMClient/remoting/impl/wireformat/ReattachSessionResponseMessage.java	                        (rev 0)
+++ trunk/dotnet/JBMClient/remoting/impl/wireformat/ReattachSessionResponseMessage.java	2009-02-05 01:20:31 UTC (rev 5812)
@@ -0,0 +1,117 @@
+/*
+ * 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.remoting.impl.wireformat;
+
+import org.jboss.messaging.core.remoting.spi.MessagingBuffer;
+
+/**
+ * 
+ * A ReattachSessionResponseMessage
+ * 
+ * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
+ *
+ */
+public class ReattachSessionResponseMessage extends PacketImpl
+{
+   // Constants -----------------------------------------------------
+
+   // Attributes ----------------------------------------------------
+
+   private int lastReceivedCommandID;
+   
+   //Is this flag really necessary - try removing it
+   private boolean removed;
+   
+   // Static --------------------------------------------------------
+
+   // Constructors --------------------------------------------------
+
+   public ReattachSessionResponseMessage(final int lastReceivedCommandID, final boolean removed)
+   {
+      super(REATTACH_SESSION_RESP);
+
+      this.lastReceivedCommandID = lastReceivedCommandID;
+      
+      this.removed = removed;
+   }
+   
+   public ReattachSessionResponseMessage()
+   {
+      super(REATTACH_SESSION_RESP);
+   }
+
+   // Public --------------------------------------------------------
+
+   public int getLastReceivedCommandID()
+   {
+      return lastReceivedCommandID;
+   }
+   
+   public boolean isRemoved()
+   {
+      return removed;
+   }
+   
+   public void encodeBody(final MessagingBuffer buffer)
+   { 
+      buffer.putInt(lastReceivedCommandID);
+      buffer.putBoolean(removed);
+   }
+   
+   public void decodeBody(final MessagingBuffer buffer)
+   { 
+      lastReceivedCommandID = buffer.getInt();
+      removed = buffer.getBoolean();
+   }
+   
+   public boolean isResponse()
+   {      
+      return true;
+   }
+
+   public boolean equals(Object other)
+   {
+      if (other instanceof ReattachSessionResponseMessage == false)
+      {
+         return false;
+      }
+            
+      ReattachSessionResponseMessage r = (ReattachSessionResponseMessage)other;
+      
+      return super.equals(other) && this.lastReceivedCommandID == r.lastReceivedCommandID;
+   }
+   
+   public final boolean isRequiresConfirmations()
+   {
+      return false;
+   }
+
+   // Package protected ---------------------------------------------
+
+   // Protected -----------------------------------------------------
+
+   // Private -------------------------------------------------------
+
+   // Inner classes -------------------------------------------------
+}
+

Added: trunk/dotnet/JBMClient/remoting/impl/wireformat/ReplicateCreateSessionMessage.java
===================================================================
--- trunk/dotnet/JBMClient/remoting/impl/wireformat/ReplicateCreateSessionMessage.java	                        (rev 0)
+++ trunk/dotnet/JBMClient/remoting/impl/wireformat/ReplicateCreateSessionMessage.java	2009-02-05 01:20:31 UTC (rev 5812)
@@ -0,0 +1,229 @@
+/*
+ * 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.remoting.impl.wireformat;
+
+import org.jboss.messaging.core.remoting.spi.MessagingBuffer;
+
+/**
+ * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
+ * @author <a href="mailto:jmesnil at redhat.com">Jeff Mesnil</a>.
+ * 
+ * @version <tt>$Revision$</tt>
+ */
+public class ReplicateCreateSessionMessage extends PacketImpl
+{
+   // Constants -----------------------------------------------------
+
+   // Attributes ----------------------------------------------------
+
+   private String name;
+
+   private long sessionChannelID;
+
+   private int version;
+
+   private String username;
+
+   private String password;
+   
+   private int minLargeMessageSize;
+
+   private boolean xa;
+
+   private boolean autoCommitSends;
+
+   private boolean autoCommitAcks;
+
+   private boolean preAcknowledge;
+   
+   private int windowSize;
+
+   // Static --------------------------------------------------------
+
+   // Constructors --------------------------------------------------
+
+   public ReplicateCreateSessionMessage(final String name,
+                                        final long sessionChannelID,
+                                        final int version,
+                                        final String username,
+                                        final String password,
+                                        final int minLargeMessageSize,
+                                        final boolean xa,
+                                        final boolean autoCommitSends,
+                                        final boolean autoCommitAcks,
+                                        final boolean preAcknowledge,
+                                        final int windowSize)
+   {
+      super(REPLICATE_CREATESESSION);
+
+      this.name = name;
+
+      this.sessionChannelID = sessionChannelID;
+
+      this.version = version;
+
+      this.username = username;
+
+      this.password = password;
+      
+      this.minLargeMessageSize = minLargeMessageSize;
+
+      this.xa = xa;
+
+      this.autoCommitSends = autoCommitSends;
+
+      this.autoCommitAcks = autoCommitAcks;
+
+      this.preAcknowledge = preAcknowledge;
+
+      this.windowSize = windowSize;
+   }
+
+   public ReplicateCreateSessionMessage()
+   {
+      super(REPLICATE_CREATESESSION);
+   }
+
+   // Public --------------------------------------------------------
+
+   public String getName()
+   {
+      return name;
+   }
+
+   public long getSessionChannelID()
+   {
+      return sessionChannelID;
+   }
+
+   public int getVersion()
+   {
+      return version;
+   }
+
+   public String getUsername()
+   {
+      return username;
+   }
+
+   public String getPassword()
+   {
+      return password;
+   }
+   
+   public int getMinLargeMessageSize()
+   {
+      return minLargeMessageSize;
+   }
+
+   public boolean isXA()
+   {
+      return xa;
+   }
+
+   public boolean isAutoCommitSends()
+   {
+      return this.autoCommitSends;
+   }
+
+   public boolean isAutoCommitAcks()
+   {
+      return this.autoCommitAcks;
+   }
+
+   public boolean isPreAcknowledge()
+   {
+      return preAcknowledge;
+   }
+
+   public int getWindowSize()
+   {
+      return this.windowSize;
+   }
+
+   public void encodeBody(final MessagingBuffer buffer)
+   {
+      buffer.putString(name);
+      buffer.putLong(sessionChannelID);
+      buffer.putInt(version);
+      buffer.putNullableString(username);
+      buffer.putNullableString(password);
+      buffer.putInt(minLargeMessageSize);
+      buffer.putBoolean(xa);
+      buffer.putBoolean(autoCommitSends);
+      buffer.putBoolean(autoCommitAcks);
+      buffer.putInt(windowSize);
+      buffer.putBoolean(preAcknowledge);
+   }
+
+   public void decodeBody(final MessagingBuffer buffer)
+   {
+      name = buffer.getString();
+      sessionChannelID = buffer.getLong();
+      version = buffer.getInt();
+      username = buffer.getNullableString();
+      password = buffer.getNullableString();
+      minLargeMessageSize = buffer.getInt();
+      xa = buffer.getBoolean();
+      autoCommitSends = buffer.getBoolean();
+      autoCommitAcks = buffer.getBoolean();
+      windowSize = buffer.getInt();
+      preAcknowledge = buffer.getBoolean();
+   }
+
+   public boolean equals(Object other)
+   {
+      if (other instanceof ReplicateCreateSessionMessage == false)
+      {
+         return false;
+      }
+
+      ReplicateCreateSessionMessage r = (ReplicateCreateSessionMessage)other;
+
+      boolean matches = super.equals(other) && this.name.equals(r.name) &&
+                        this.sessionChannelID == r.sessionChannelID &&
+                        this.version == r.version &&
+                        this.xa == r.xa &&
+                        this.autoCommitSends == r.autoCommitSends &&
+                        this.autoCommitAcks == r.autoCommitAcks &&
+                        (this.username == null ? r.username == null : this.username.equals(r.username)) &&
+                        (this.password == null ? r.password == null : this.password.equals(r.password)) &&
+                        this.minLargeMessageSize == r.minLargeMessageSize &&
+                        this.windowSize == r.windowSize;
+
+      return matches;
+   }
+
+   public final boolean isRequiresConfirmations()
+   {
+      return false;
+   }
+
+   // Package protected ---------------------------------------------
+
+   // Protected -----------------------------------------------------
+
+   // Private -------------------------------------------------------
+
+   // Inner classes -------------------------------------------------
+}

Added: trunk/dotnet/JBMClient/remoting/impl/wireformat/SessionAcknowledgeMessage.java
===================================================================
--- trunk/dotnet/JBMClient/remoting/impl/wireformat/SessionAcknowledgeMessage.java	                        (rev 0)
+++ trunk/dotnet/JBMClient/remoting/impl/wireformat/SessionAcknowledgeMessage.java	2009-02-05 01:20:31 UTC (rev 5812)
@@ -0,0 +1,108 @@
+/*
+ * 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.remoting.impl.wireformat;
+
+import org.jboss.messaging.core.remoting.spi.MessagingBuffer;
+
+/**
+ * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
+ * @version <tt>$Revision$</tt>
+ */
+public class SessionAcknowledgeMessage extends PacketImpl
+{
+   // Constants -----------------------------------------------------
+
+   // Attributes ----------------------------------------------------
+
+   private long consumerID;
+
+   private long messageID;
+
+   private boolean requiresResponse;
+   
+   // Static --------------------------------------------------------
+
+   // Constructors --------------------------------------------------
+
+   public SessionAcknowledgeMessage(final long consumerID, final long messageID, final boolean requiresResponse)
+   {
+      super(SESS_ACKNOWLEDGE);
+
+      this.consumerID = consumerID;
+
+      this.messageID = messageID;
+
+      this.requiresResponse = requiresResponse;
+   }
+
+   public SessionAcknowledgeMessage()
+   {
+      super(SESS_ACKNOWLEDGE);
+   }
+
+   // Public --------------------------------------------------------
+
+   public long getConsumerID()
+   {
+      return consumerID;
+   }
+
+   public long getMessageID()
+   {
+      return messageID;
+   }
+
+   public boolean isRequiresResponse()
+   {
+      return requiresResponse;
+   }
+
+   public void encodeBody(final MessagingBuffer buffer)
+   {
+      buffer.putLong(consumerID);
+
+      buffer.putLong(messageID);
+
+      buffer.putBoolean(requiresResponse);
+   }
+
+   public void decodeBody(final MessagingBuffer buffer)
+   {
+      consumerID = buffer.getLong();
+
+      messageID = buffer.getLong();
+
+      requiresResponse = buffer.getBoolean();
+   }
+
+   public boolean equals(Object other)
+   {
+      if (other instanceof SessionAcknowledgeMessage == false)
+      {
+         return false;
+      }
+
+      SessionAcknowledgeMessage r = (SessionAcknowledgeMessage)other;
+
+      return super.equals(other) && this.consumerID == r.consumerID &&
+             this.messageID == r.messageID &&
+             this.requiresResponse == r.requiresResponse;
+   }
+   // Package protected ---------------------------------------------
+
+   // Protected -----------------------------------------------------
+
+   // Private -------------------------------------------------------
+
+   // Inner classes -------------------------------------------------
+}

Added: trunk/dotnet/JBMClient/remoting/impl/wireformat/SessionAddDestinationMessage.java
===================================================================
--- trunk/dotnet/JBMClient/remoting/impl/wireformat/SessionAddDestinationMessage.java	                        (rev 0)
+++ trunk/dotnet/JBMClient/remoting/impl/wireformat/SessionAddDestinationMessage.java	2009-02-05 01:20:31 UTC (rev 5812)
@@ -0,0 +1,127 @@
+/*
+ * 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.remoting.impl.wireformat;
+
+import org.jboss.messaging.core.remoting.spi.MessagingBuffer;
+import org.jboss.messaging.util.SimpleString;
+
+
+/**
+ * 
+ * A SessionAddDestinationMessage
+ * 
+ * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
+ *
+ */
+public class SessionAddDestinationMessage extends PacketImpl
+{
+   // Constants -----------------------------------------------------
+
+   // Attributes ----------------------------------------------------
+   
+   private SimpleString address;
+   
+   private boolean durable;
+   
+   private boolean temporary;
+   
+   // Static --------------------------------------------------------
+
+   // Constructors --------------------------------------------------
+
+   public SessionAddDestinationMessage(final SimpleString address, final boolean durable, final boolean temp)
+   {
+      super(SESS_ADD_DESTINATION);
+      
+      this.address = address;
+      
+      this.durable = durable;
+      
+      this.temporary = temp;
+   }
+   
+   public SessionAddDestinationMessage()
+   {
+      super(SESS_ADD_DESTINATION);
+   }
+
+   // Public --------------------------------------------------------
+   
+   public SimpleString getAddress()
+   {
+      return address;
+   }
+   
+   public boolean isDurable()
+   {
+   	return durable;
+   }
+   
+   public boolean isTemporary()
+   {
+      return temporary;
+   }
+   
+   public void encodeBody(final MessagingBuffer buffer)
+   {
+      buffer.putSimpleString(address);
+      buffer.putBoolean(durable);
+      buffer.putBoolean(temporary);
+   }
+   
+   public void decodeBody(final MessagingBuffer buffer)
+   {
+      address = buffer.getSimpleString();
+      durable = buffer.getBoolean();
+      temporary = buffer.getBoolean();
+   }
+   
+   @Override
+   public String toString()
+   {
+      return getParentString() + ", address=" + address + ", temp=" + durable +"]";
+   }
+   
+   public boolean equals(Object other)
+   {
+      if (other instanceof SessionAddDestinationMessage == false)
+      {
+         return false;
+      }
+            
+      SessionAddDestinationMessage r = (SessionAddDestinationMessage)other;
+      
+      return super.equals(other) && this.address.equals(r.address) &&
+             this.durable == r.durable &&
+             this.temporary == r.temporary;
+   }
+   
+   // Package protected ---------------------------------------------
+
+   // Protected -----------------------------------------------------
+
+   // Private -------------------------------------------------------
+
+   // Inner classes -------------------------------------------------
+}
+

Added: trunk/dotnet/JBMClient/remoting/impl/wireformat/SessionBindingQueryMessage.java
===================================================================
--- trunk/dotnet/JBMClient/remoting/impl/wireformat/SessionBindingQueryMessage.java	                        (rev 0)
+++ trunk/dotnet/JBMClient/remoting/impl/wireformat/SessionBindingQueryMessage.java	2009-02-05 01:20:31 UTC (rev 5812)
@@ -0,0 +1,79 @@
+/*
+ * 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.remoting.impl.wireformat;
+
+import org.jboss.messaging.core.remoting.spi.MessagingBuffer;
+import org.jboss.messaging.util.SimpleString;
+
+
+/**
+ * 
+ * A SessionQueueQueryMessage
+ * 
+ * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
+ *
+ */
+public class SessionBindingQueryMessage extends PacketImpl
+{
+   private SimpleString address;
+
+   public SessionBindingQueryMessage(final SimpleString address)
+   {
+      super(SESS_BINDINGQUERY);
+
+      this.address = address;            
+   }
+   
+   public SessionBindingQueryMessage()
+   {
+      super(SESS_BINDINGQUERY);          
+   }
+
+   public SimpleString getAddress()
+   {
+      return address;
+   }
+   
+   public void encodeBody(final MessagingBuffer buffer)
+   {
+      buffer.putSimpleString(address);
+   }
+   
+   public void decodeBody(final MessagingBuffer buffer)
+   {
+      address = buffer.getSimpleString();
+   }
+   
+   public boolean equals(Object other)
+   {
+      if (other instanceof SessionBindingQueryMessage == false)
+      {
+         return false;
+      }
+            
+      SessionBindingQueryMessage r = (SessionBindingQueryMessage)other;
+      
+      return super.equals(other) && this.address.equals(r.address);
+   }
+   
+}

Added: trunk/dotnet/JBMClient/remoting/impl/wireformat/SessionBindingQueryResponseMessage.java
===================================================================
--- trunk/dotnet/JBMClient/remoting/impl/wireformat/SessionBindingQueryResponseMessage.java	                        (rev 0)
+++ trunk/dotnet/JBMClient/remoting/impl/wireformat/SessionBindingQueryResponseMessage.java	2009-02-05 01:20:31 UTC (rev 5812)
@@ -0,0 +1,128 @@
+/*
+ * 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.remoting.impl.wireformat;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.jboss.messaging.core.remoting.spi.MessagingBuffer;
+import org.jboss.messaging.util.SimpleString;
+
+/**
+ * 
+ * A SessionBindingQueryResponseMessage
+ * 
+ * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
+ *
+ */
+public class SessionBindingQueryResponseMessage extends PacketImpl
+{
+   private boolean exists;
+   
+   private List<SimpleString> queueNames;
+   
+   public SessionBindingQueryResponseMessage(final boolean exists, final List<SimpleString> queueNames)
+   {
+      super(SESS_BINDINGQUERY_RESP);
+
+      this.exists = exists;
+
+      this.queueNames = queueNames;
+   }
+   
+   public SessionBindingQueryResponseMessage()
+   {
+      super(SESS_BINDINGQUERY_RESP);
+   }
+   
+   public boolean isResponse()
+   {
+      return true;
+   }
+
+   public boolean isExists()
+   {
+      return exists;
+   }
+
+   public List<SimpleString> getQueueNames()
+   {
+      return this.queueNames;
+   }
+   
+   public void encodeBody(final MessagingBuffer buffer)
+   {
+      buffer.putBoolean(exists);
+      buffer.putInt(queueNames.size());      
+      for (SimpleString queueName: queueNames)
+      {
+         buffer.putSimpleString(queueName);
+      }      
+   }
+   
+   public void decodeBody(final MessagingBuffer buffer)
+   {
+      exists = buffer.getBoolean();      
+      int numQueues = buffer.getInt();      
+      queueNames = new ArrayList<SimpleString>(numQueues);      
+      for (int i = 0; i < numQueues; i++)
+      {
+         queueNames.add(buffer.getSimpleString());
+      }          
+   }
+   
+   public boolean equals(Object other)
+   {
+      if (other instanceof SessionBindingQueryResponseMessage == false)
+      {
+         return false;
+      }
+            
+      SessionBindingQueryResponseMessage r = (SessionBindingQueryResponseMessage)other;
+      
+      if (super.equals(other) && this.exists == r.exists)
+      {
+         if (this.queueNames.size() == r.queueNames.size())
+         {
+            for (int i = 0; i < queueNames.size(); i++)
+            {
+               if (!this.queueNames.get(i).equals(r.queueNames.get(i)))
+               {
+                  return false;
+               }
+            }
+         }
+         else
+         {
+            return false;
+         }
+      }
+      else
+      {
+         return false;
+      }
+      
+      return true;
+   }
+   
+}

Added: trunk/dotnet/JBMClient/remoting/impl/wireformat/SessionCloseMessage.java
===================================================================
--- trunk/dotnet/JBMClient/remoting/impl/wireformat/SessionCloseMessage.java	                        (rev 0)
+++ trunk/dotnet/JBMClient/remoting/impl/wireformat/SessionCloseMessage.java	2009-02-05 01:20:31 UTC (rev 5812)
@@ -0,0 +1,57 @@
+/*
+ * 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.remoting.impl.wireformat;
+
+
+/**
+ * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
+ * @version <tt>$Revision$</tt>
+ */
+public class SessionCloseMessage extends PacketImpl
+{
+   // Constants -----------------------------------------------------
+
+   // Attributes ----------------------------------------------------
+
+   // Static --------------------------------------------------------
+
+   // Constructors --------------------------------------------------
+
+   public SessionCloseMessage()
+   {
+      super(SESS_CLOSE);
+   }
+
+   // Public --------------------------------------------------------
+ 
+   @Override
+   public boolean equals(final Object other)
+   {
+      if (other instanceof SessionCloseMessage == false)
+      {
+         return false;
+      }
+
+      SessionCloseMessage r = (SessionCloseMessage)other;
+
+      return super.equals(other);
+   }     
+   
+   // Package protected ---------------------------------------------
+
+   // Protected -----------------------------------------------------
+
+   // Private -------------------------------------------------------
+
+   // Inner classes -------------------------------------------------
+}

Added: trunk/dotnet/JBMClient/remoting/impl/wireformat/SessionConsumerCloseMessage.java
===================================================================
--- trunk/dotnet/JBMClient/remoting/impl/wireformat/SessionConsumerCloseMessage.java	                        (rev 0)
+++ trunk/dotnet/JBMClient/remoting/impl/wireformat/SessionConsumerCloseMessage.java	2009-02-05 01:20:31 UTC (rev 5812)
@@ -0,0 +1,97 @@
+/*
+ * 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.remoting.impl.wireformat;
+
+import org.jboss.messaging.core.remoting.spi.MessagingBuffer;
+
+/**
+ * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
+ * 
+ * @version <tt>$Revision$</tt>
+ */
+public class SessionConsumerCloseMessage extends PacketImpl
+{
+   // Constants -----------------------------------------------------
+
+   // Attributes ----------------------------------------------------
+
+   private long consumerID;
+   
+   // Static --------------------------------------------------------
+
+   // Constructors --------------------------------------------------
+
+   public SessionConsumerCloseMessage(final long objectID)
+   {
+      super(SESS_CONSUMER_CLOSE);
+
+      this.consumerID = objectID;
+   }
+   
+   public SessionConsumerCloseMessage()
+   {
+      super(SESS_CONSUMER_CLOSE);
+   }
+
+   // Public --------------------------------------------------------
+
+   public long getConsumerID()
+   {
+      return consumerID;
+   }
+   
+   public void encodeBody(final MessagingBuffer buffer)
+   {
+      buffer.putLong(consumerID);
+   }
+   
+   public void decodeBody(final MessagingBuffer buffer)
+   {
+      consumerID = buffer.getLong();
+   }
+   
+   @Override
+   public String toString()
+   {
+      return getParentString() + ", consumerID=" + consumerID + "]";
+   }
+   
+   public boolean equals(Object other)
+   {
+      if (other instanceof SessionConsumerCloseMessage == false)
+      {
+         return false;
+      }
+            
+      SessionConsumerCloseMessage r = (SessionConsumerCloseMessage)other;
+      
+      return super.equals(other) && this.consumerID == r.consumerID;
+   }
+   // Package protected ---------------------------------------------
+
+   // Protected -----------------------------------------------------
+
+   // Private -------------------------------------------------------
+
+   // Inner classes -------------------------------------------------
+}

Added: trunk/dotnet/JBMClient/remoting/impl/wireformat/SessionConsumerFlowCreditMessage.java
===================================================================
--- trunk/dotnet/JBMClient/remoting/impl/wireformat/SessionConsumerFlowCreditMessage.java	                        (rev 0)
+++ trunk/dotnet/JBMClient/remoting/impl/wireformat/SessionConsumerFlowCreditMessage.java	2009-02-05 01:20:31 UTC (rev 5812)
@@ -0,0 +1,110 @@
+/*
+ * 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.remoting.impl.wireformat;
+
+import org.jboss.messaging.core.remoting.spi.MessagingBuffer;
+
+/**
+ * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
+ * @author <a href="mailto:jmesnil at redhat.com">Jeff Mesnil</a>.
+ * 
+ * @version <tt>$Revision$</tt>
+ */
+public class SessionConsumerFlowCreditMessage extends PacketImpl
+{
+   // Constants -----------------------------------------------------
+
+   // Attributes ----------------------------------------------------
+
+   private long consumerID;
+   
+   private int credits;
+   
+   // Static --------------------------------------------------------
+
+   // Constructors --------------------------------------------------
+
+   public SessionConsumerFlowCreditMessage(final long consumerID, final int credits)
+   {
+      super(SESS_FLOWTOKEN);
+
+      this.consumerID = consumerID;
+      
+      this.credits = credits;
+   }
+   
+   public SessionConsumerFlowCreditMessage()
+   {
+      super(SESS_FLOWTOKEN);
+   }
+
+   // Public --------------------------------------------------------
+
+   public long getConsumerID()
+   {
+      return consumerID;
+   }
+   
+   public int getCredits()
+   {
+      return credits;
+   }
+   
+   public void encodeBody(final MessagingBuffer buffer)
+   {
+      buffer.putLong(consumerID);
+      buffer.putInt(credits);
+   }
+   
+   public void decodeBody(final MessagingBuffer buffer)
+   {
+      consumerID = buffer.getLong();
+      credits = buffer.getInt();
+   }
+
+   @Override
+   public String toString()
+   {
+      return getParentString() + ", consumerID=" + consumerID + ", credits=" + credits + "]";
+   }
+   
+   public boolean equals(Object other)
+   {
+      if (other instanceof SessionConsumerFlowCreditMessage == false)
+      {
+         return false;
+      }
+            
+      SessionConsumerFlowCreditMessage r = (SessionConsumerFlowCreditMessage)other;
+      
+      return super.equals(other) && this.credits == r.credits
+       && this.consumerID == r.consumerID;
+   }
+   // Package protected ---------------------------------------------
+
+   // Protected -----------------------------------------------------
+
+   // Private -------------------------------------------------------
+
+   // Inner classes -------------------------------------------------
+}

Added: trunk/dotnet/JBMClient/remoting/impl/wireformat/SessionContinuationMessage.java
===================================================================
--- trunk/dotnet/JBMClient/remoting/impl/wireformat/SessionContinuationMessage.java	                        (rev 0)
+++ trunk/dotnet/JBMClient/remoting/impl/wireformat/SessionContinuationMessage.java	2009-02-05 01:20:31 UTC (rev 5812)
@@ -0,0 +1,116 @@
+/*
+ * 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.remoting.impl.wireformat;
+
+import org.jboss.messaging.core.remoting.spi.MessagingBuffer;
+import org.jboss.messaging.util.DataConstants;
+
+/**
+ * A SessionContinuationMessage
+ *
+ * @author <a href="mailto:clebert.suconic at jboss.org">Clebert Suconic</a>
+ * 
+ * Created Dec 5, 2008 10:08:40 AM
+ *
+ *
+ */
+public abstract class SessionContinuationMessage extends PacketImpl
+{
+
+   // Constants -----------------------------------------------------
+
+   public static final int SESSION_CONTINUATION_BASE_SIZE = BASIC_PACKET_SIZE + DataConstants.SIZE_INT +
+                                                            DataConstants.SIZE_BOOLEAN;
+
+   // Attributes ----------------------------------------------------
+
+   protected byte[] body;
+
+   protected boolean continues;
+
+   // Static --------------------------------------------------------
+
+   // Constructors --------------------------------------------------
+
+   public SessionContinuationMessage(byte type, final byte[] body, final boolean continues)
+   {
+      super(type);
+      this.body = body;
+      this.continues = continues;
+   }
+
+   public SessionContinuationMessage(byte type)
+   {
+      super(type);
+   }
+
+   // Public --------------------------------------------------------
+
+   /**
+    * @return the body
+    */
+   public byte[] getBody()
+   {
+      return body;
+   }
+
+   /**
+    * @return the continues
+    */
+   public boolean isContinues()
+   {
+      return continues;
+   }
+
+   @Override
+   public int getRequiredBufferSize()
+   {
+      return SESSION_CONTINUATION_BASE_SIZE + body.length; 
+   }
+
+   @Override
+   public void encodeBody(final MessagingBuffer buffer)
+   {
+      buffer.putInt(body.length);
+      buffer.putBytes(body);
+      buffer.putBoolean(continues);
+   }
+
+   @Override
+   public void decodeBody(final MessagingBuffer buffer)
+   {
+      int size = buffer.getInt();
+      body = new byte[size];
+      buffer.getBytes(body);
+      continues = buffer.getBoolean();
+   }
+
+   // Package protected ---------------------------------------------
+
+   // Protected -----------------------------------------------------
+
+   // Private -------------------------------------------------------
+
+   // Inner classes -------------------------------------------------
+
+}

Added: trunk/dotnet/JBMClient/remoting/impl/wireformat/SessionCreateConsumerMessage.java
===================================================================
--- trunk/dotnet/JBMClient/remoting/impl/wireformat/SessionCreateConsumerMessage.java	                        (rev 0)
+++ trunk/dotnet/JBMClient/remoting/impl/wireformat/SessionCreateConsumerMessage.java	2009-02-05 01:20:31 UTC (rev 5812)
@@ -0,0 +1,128 @@
+/*
+ * 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.remoting.impl.wireformat;
+
+import org.jboss.messaging.core.remoting.spi.MessagingBuffer;
+import org.jboss.messaging.util.SimpleString;
+
+
+/**
+ * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
+ *
+ * @version <tt>$Revision$</tt>
+ */
+public class SessionCreateConsumerMessage extends PacketImpl
+{
+   // Constants -----------------------------------------------------
+
+   // Attributes ----------------------------------------------------
+
+   private SimpleString queueName;
+
+   private SimpleString filterString;
+
+   private boolean browseOnly;
+
+
+   // Static --------------------------------------------------------
+
+   // Constructors --------------------------------------------------
+
+   public SessionCreateConsumerMessage(final SimpleString queueName, final SimpleString filterString,
+   		                              final boolean browseOnly)
+   {
+      super(SESS_CREATECONSUMER);
+
+      this.queueName = queueName;
+      this.filterString = filterString;
+      this.browseOnly = browseOnly;
+   }
+
+   public SessionCreateConsumerMessage()
+   {
+      super(SESS_CREATECONSUMER);
+   }
+
+   // Public --------------------------------------------------------
+
+   @Override
+   public String toString()
+   {
+      StringBuffer buff = new StringBuffer(getParentString());
+      buff.append(", queueName=" + queueName);
+      buff.append(", filterString=" + filterString);
+      buff.append("]");
+      return buff.toString();
+   }
+
+   public SimpleString getQueueName()
+   {
+      return queueName;
+   }
+
+   public SimpleString getFilterString()
+   {
+      return filterString;
+   }
+
+   public boolean isBrowseOnly()
+   {
+      return browseOnly;
+   }
+
+   public void encodeBody(final MessagingBuffer buffer)
+   {
+      buffer.putSimpleString(queueName);
+      buffer.putNullableSimpleString(filterString);
+      buffer.putBoolean(browseOnly);
+   }
+
+   public void decodeBody(final MessagingBuffer buffer)
+   {
+      queueName = buffer.getSimpleString();
+      filterString = buffer.getNullableSimpleString();
+      browseOnly = buffer.getBoolean();
+   }
+
+   public boolean equals(Object other)
+   {
+      if (other instanceof SessionCreateConsumerMessage == false)
+      {
+         return false;
+      }
+            
+      SessionCreateConsumerMessage r = (SessionCreateConsumerMessage)other;
+      
+      return super.equals(other) && 
+             this.queueName.equals(r.queueName) &&
+             this.filterString == null ? r.filterString == null : this.filterString.equals(r.filterString);                           
+   }
+   
+   // Package protected ---------------------------------------------
+
+   // Protected -----------------------------------------------------
+
+   // Private -------------------------------------------------------
+
+   // Inner classes -------------------------------------------------
+}

Added: trunk/dotnet/JBMClient/remoting/impl/wireformat/SessionCreateQueueMessage.java
===================================================================
--- trunk/dotnet/JBMClient/remoting/impl/wireformat/SessionCreateQueueMessage.java	                        (rev 0)
+++ trunk/dotnet/JBMClient/remoting/impl/wireformat/SessionCreateQueueMessage.java	2009-02-05 01:20:31 UTC (rev 5812)
@@ -0,0 +1,147 @@
+/*
+ * 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.remoting.impl.wireformat;
+
+import org.jboss.messaging.core.remoting.spi.MessagingBuffer;
+import org.jboss.messaging.util.SimpleString;
+
+/**
+ * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
+
+ * @version <tt>$Revision$</tt>
+ */
+public class SessionCreateQueueMessage extends PacketImpl
+{
+   // Constants -----------------------------------------------------
+
+   // Attributes ----------------------------------------------------
+
+   private SimpleString address;
+   private SimpleString queueName;
+   private SimpleString filterString;
+   private boolean durable;
+   private boolean temporary;
+
+   // Static --------------------------------------------------------
+
+   // Constructors --------------------------------------------------
+
+   public SessionCreateQueueMessage(final SimpleString address, final SimpleString queueName,
+   		final SimpleString filterString, final boolean durable, final boolean temporary)
+   {
+      super(SESS_CREATEQUEUE);
+
+      this.address = address;
+      this.queueName = queueName;
+      this.filterString = filterString;
+      this.durable = durable;
+      this.temporary = temporary;
+   }
+   
+   public SessionCreateQueueMessage()
+   {
+      super(SESS_CREATEQUEUE);
+   }
+
+   // Public --------------------------------------------------------
+
+   @Override
+   public String toString()
+   {
+      StringBuffer buff = new StringBuffer(getParentString());
+      buff.append(", address=" + address);
+      buff.append(", queueName=" + queueName);
+      buff.append(", filterString=" + filterString);
+      buff.append(", durable=" + durable);
+      buff.append(", temporary=" + temporary);
+      buff.append("]");
+      return buff.toString();
+   }
+   
+   public SimpleString getAddress()
+   {
+      return address;
+   }
+
+   public SimpleString getQueueName()
+   {
+      return queueName;
+   }
+
+   public SimpleString getFilterString()
+   {
+      return filterString;
+   }
+
+   public boolean isDurable()
+   {
+      return durable;
+   }
+   
+   public boolean isTemporary()
+   {
+      return temporary;
+   }
+    
+   public void encodeBody(final MessagingBuffer buffer)
+   {
+      buffer.putSimpleString(address);
+      buffer.putSimpleString(queueName);
+      buffer.putNullableSimpleString(filterString);
+      buffer.putBoolean(durable);
+      buffer.putBoolean(temporary);
+   }
+   
+   public void decodeBody(final MessagingBuffer buffer)
+   {
+      address = buffer.getSimpleString();
+      queueName = buffer.getSimpleString();
+      filterString = buffer.getNullableSimpleString();
+      durable = buffer.getBoolean();
+      temporary = buffer.getBoolean();
+   }
+   
+   public boolean equals(Object other)
+   {
+      if (other instanceof SessionCreateQueueMessage == false)
+      {
+         return false;
+      }
+            
+      SessionCreateQueueMessage r = (SessionCreateQueueMessage)other;
+      
+      return super.equals(other) && r.address.equals(this.address) && 
+             r.queueName.equals(this.queueName) &&
+             (r.filterString == null ? this.filterString == null : r.filterString.equals(this.filterString)) &&
+             r.durable == this.durable &&
+             r.temporary == this.temporary;
+   }
+
+   // Package protected ---------------------------------------------
+
+   // Protected -----------------------------------------------------
+
+   // Private -------------------------------------------------------
+
+   // Inner classes -------------------------------------------------
+}

Added: trunk/dotnet/JBMClient/remoting/impl/wireformat/SessionDeleteQueueMessage.java
===================================================================
--- trunk/dotnet/JBMClient/remoting/impl/wireformat/SessionDeleteQueueMessage.java	                        (rev 0)
+++ trunk/dotnet/JBMClient/remoting/impl/wireformat/SessionDeleteQueueMessage.java	2009-02-05 01:20:31 UTC (rev 5812)
@@ -0,0 +1,102 @@
+/*
+ * 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.remoting.impl.wireformat;
+
+import org.jboss.messaging.core.remoting.spi.MessagingBuffer;
+import org.jboss.messaging.util.SimpleString;
+
+/**
+ * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
+
+ * @version <tt>$Revision$</tt>
+ */
+public class SessionDeleteQueueMessage extends PacketImpl
+{
+   // Constants -----------------------------------------------------
+
+   // Attributes ----------------------------------------------------
+
+   private SimpleString queueName;
+
+   // Static --------------------------------------------------------
+
+   // Constructors --------------------------------------------------
+
+   public SessionDeleteQueueMessage(final SimpleString queueName)
+   {
+      super(SESS_DELETE_QUEUE);
+
+      this.queueName = queueName;
+   }
+   
+   public SessionDeleteQueueMessage()
+   {
+      super(SESS_DELETE_QUEUE);
+   }
+
+   // Public --------------------------------------------------------
+
+   @Override
+   public String toString()
+   {
+      StringBuffer buff = new StringBuffer(getParentString());
+      buff.append(", queueName=" + queueName);
+      buff.append("]");
+      return buff.toString();
+   }
+   
+   public SimpleString getQueueName()
+   {
+      return queueName;
+   }
+      
+   public void encodeBody(final MessagingBuffer buffer)
+   {
+      buffer.putSimpleString(queueName);
+   }
+   
+   public void decodeBody(final MessagingBuffer buffer)
+   {
+      queueName = buffer.getSimpleString();
+   }
+
+   public boolean equals(Object other)
+   {
+      if (other instanceof SessionDeleteQueueMessage == false)
+      {
+         return false;
+      }
+            
+      SessionDeleteQueueMessage r = (SessionDeleteQueueMessage)other;
+      
+      return super.equals(other) && r.queueName.equals(this.queueName);
+   }
+
+   // Package protected ---------------------------------------------
+
+   // Protected -----------------------------------------------------
+
+   // Private -------------------------------------------------------
+
+   // Inner classes -------------------------------------------------
+}

Added: trunk/dotnet/JBMClient/remoting/impl/wireformat/SessionExpiredMessage.java
===================================================================
--- trunk/dotnet/JBMClient/remoting/impl/wireformat/SessionExpiredMessage.java	                        (rev 0)
+++ trunk/dotnet/JBMClient/remoting/impl/wireformat/SessionExpiredMessage.java	2009-02-05 01:20:31 UTC (rev 5812)
@@ -0,0 +1,93 @@
+/*
+ * 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.remoting.impl.wireformat;
+
+import org.jboss.messaging.core.remoting.spi.MessagingBuffer;
+
+/**
+ * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
+ * @version <tt>$Revision$</tt>
+ */
+public class SessionExpiredMessage extends PacketImpl
+{
+   // Constants -----------------------------------------------------
+
+   // Attributes ----------------------------------------------------
+
+   private long consumerID;
+
+   private long messageID;
+
+   // Static --------------------------------------------------------
+
+   // Constructors --------------------------------------------------
+
+   public SessionExpiredMessage(final long consumerID, final long messageID)
+   {
+      super(SESS_EXPIRED);
+
+      this.consumerID = consumerID;
+
+      this.messageID = messageID;
+   }
+
+   public SessionExpiredMessage()
+   {
+      super(SESS_EXPIRED);
+   }
+
+   // Public --------------------------------------------------------
+
+   public long getConsumerID()
+   {
+      return consumerID;
+   }
+
+   public long getMessageID()
+   {
+      return messageID;
+   }
+
+   public void encodeBody(final MessagingBuffer buffer)
+   {
+      buffer.putLong(consumerID);
+
+      buffer.putLong(messageID);
+   }
+
+   public void decodeBody(final MessagingBuffer buffer)
+   {
+      consumerID = buffer.getLong();
+
+      messageID = buffer.getLong();
+   }
+
+   public boolean equals(Object other)
+   {
+      if (other instanceof SessionExpiredMessage == false)
+      {
+         return false;
+      }
+
+      SessionExpiredMessage r = (SessionExpiredMessage)other;
+
+      return super.equals(other) && this.consumerID == r.consumerID && this.messageID == r.messageID;
+   }
+   // Package protected ---------------------------------------------
+
+   // Protected -----------------------------------------------------
+
+   // Private -------------------------------------------------------
+
+   // Inner classes -------------------------------------------------
+}

Added: trunk/dotnet/JBMClient/remoting/impl/wireformat/SessionFailoverCompleteMessage.java
===================================================================
--- trunk/dotnet/JBMClient/remoting/impl/wireformat/SessionFailoverCompleteMessage.java	                        (rev 0)
+++ trunk/dotnet/JBMClient/remoting/impl/wireformat/SessionFailoverCompleteMessage.java	2009-02-05 01:20:31 UTC (rev 5812)
@@ -0,0 +1,100 @@
+/*
+ * 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.remoting.impl.wireformat;
+
+import org.jboss.messaging.core.remoting.spi.MessagingBuffer;
+
+/**
+ * 
+ * A SessionFailoverCompleteMessage
+ * 
+ * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
+ *
+ */
+public class SessionFailoverCompleteMessage extends PacketImpl
+{
+   // Constants -----------------------------------------------------
+
+   // Attributes ----------------------------------------------------
+
+   private String name;
+   
+   // Static --------------------------------------------------------
+
+   // Constructors --------------------------------------------------
+
+   public SessionFailoverCompleteMessage(final String name)
+   {
+      super(SESS_FAILOVER_COMPLETE);
+
+      this.name = name;
+   }
+   
+   public SessionFailoverCompleteMessage()
+   {
+      super(SESS_FAILOVER_COMPLETE);
+   }
+
+   // Public --------------------------------------------------------
+
+   public String getName()
+   {
+      return name;
+   }
+   
+   public void encodeBody(final MessagingBuffer buffer)
+   {
+      buffer.putString(name);
+   }
+   
+   public void decodeBody(final MessagingBuffer buffer)
+   {
+      name = buffer.getString();
+   }
+   
+   public boolean isRequiresConfirmations()
+   {
+      return false;
+   }
+
+   public boolean equals(Object other)
+   {
+      if (other instanceof SessionFailoverCompleteMessage == false)
+      {
+         return false;
+      }
+            
+      SessionFailoverCompleteMessage r = (SessionFailoverCompleteMessage)other;
+      
+      return super.equals(other) && this.name.equals(r.name);
+   }
+   
+   // Package protected ---------------------------------------------
+
+   // Protected -----------------------------------------------------
+
+   // Private -------------------------------------------------------
+
+   // Inner classes -------------------------------------------------
+}
+

Added: trunk/dotnet/JBMClient/remoting/impl/wireformat/SessionQueueQueryMessage.java
===================================================================
--- trunk/dotnet/JBMClient/remoting/impl/wireformat/SessionQueueQueryMessage.java	                        (rev 0)
+++ trunk/dotnet/JBMClient/remoting/impl/wireformat/SessionQueueQueryMessage.java	2009-02-05 01:20:31 UTC (rev 5812)
@@ -0,0 +1,79 @@
+/*
+ * 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.remoting.impl.wireformat;
+
+import org.jboss.messaging.core.remoting.spi.MessagingBuffer;
+import org.jboss.messaging.util.SimpleString;
+
+
+/**
+ * 
+ * A SessionQueueQueryMessage
+ * 
+ * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
+ *
+ */
+public class SessionQueueQueryMessage extends PacketImpl
+{
+   private SimpleString queueName;
+
+   public SessionQueueQueryMessage(final SimpleString queueName)
+   {
+      super(SESS_QUEUEQUERY);
+
+      this.queueName = queueName;            
+   }
+   
+   public SessionQueueQueryMessage()
+   {
+      super(SESS_QUEUEQUERY);        
+   }
+
+   public SimpleString getQueueName()
+   {
+      return queueName;
+   }
+   
+   public void encodeBody(final MessagingBuffer buffer)
+   {
+      buffer.putSimpleString(queueName);
+   }
+   
+   public void decodeBody(final MessagingBuffer buffer)
+   {
+      queueName = buffer.getSimpleString();
+   }
+   
+   public boolean equals(Object other)
+   {
+      if (other instanceof SessionQueueQueryMessage == false)
+      {
+         return false;
+      }
+            
+      SessionQueueQueryMessage r = (SessionQueueQueryMessage)other;
+      
+      return super.equals(other) && r.queueName.equals(this.queueName);
+   }
+   
+}

Added: trunk/dotnet/JBMClient/remoting/impl/wireformat/SessionQueueQueryResponseMessage.java
===================================================================
--- trunk/dotnet/JBMClient/remoting/impl/wireformat/SessionQueueQueryResponseMessage.java	                        (rev 0)
+++ trunk/dotnet/JBMClient/remoting/impl/wireformat/SessionQueueQueryResponseMessage.java	2009-02-05 01:20:31 UTC (rev 5812)
@@ -0,0 +1,158 @@
+/*
+ * 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.remoting.impl.wireformat;
+
+import org.jboss.messaging.core.remoting.spi.MessagingBuffer;
+import org.jboss.messaging.util.SimpleString;
+
+/**
+ * 
+ * A SessionQueueQueryResponseMessage
+ * 
+ * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
+ *
+ */
+public class SessionQueueQueryResponseMessage extends PacketImpl
+{
+   private boolean exists;
+
+   private boolean durable;
+
+   private int consumerCount;
+
+   private int messageCount;
+
+   private SimpleString filterString;
+
+   private SimpleString address;
+
+   public SessionQueueQueryResponseMessage(final boolean durable,
+                                           final int consumerCount,
+                                           final int messageCount,
+                                           final SimpleString filterString,
+                                           final SimpleString address)
+   {
+      this(durable, consumerCount, messageCount, filterString, address, true);
+   }
+
+   public SessionQueueQueryResponseMessage()
+   {
+      this(false, 0, 0, null, null, false);
+   }
+
+   private SessionQueueQueryResponseMessage(final boolean durable,
+                                            final int consumerCount,
+                                            final int messageCount,
+                                            final SimpleString filterString,
+                                            final SimpleString address,
+                                            final boolean exists)
+   {
+      super(SESS_QUEUEQUERY_RESP);
+
+      this.durable = durable;
+
+      this.consumerCount = consumerCount;
+
+      this.messageCount = messageCount;
+
+      this.filterString = filterString;
+
+      this.address = address;
+
+      this.exists = exists;
+   }
+
+   public boolean isResponse()
+   {
+      return true;
+   }
+
+   public boolean isExists()
+   {
+      return exists;
+   }
+
+   public boolean isDurable()
+   {
+      return durable;
+   }
+
+   public int getConsumerCount()
+   {
+      return consumerCount;
+   }
+
+   public int getMessageCount()
+   {
+      return messageCount;
+   }
+
+   public SimpleString getFilterString()
+   {
+      return filterString;
+   }
+
+   public SimpleString getAddress()
+   {
+      return address;
+   }
+
+   public void encodeBody(final MessagingBuffer buffer)
+   {
+      buffer.putBoolean(exists);
+      buffer.putBoolean(durable);
+      buffer.putInt(consumerCount);
+      buffer.putInt(messageCount);
+      buffer.putNullableSimpleString(filterString);
+      buffer.putNullableSimpleString(address);
+   }
+
+   public void decodeBody(final MessagingBuffer buffer)
+   {
+      exists = buffer.getBoolean();
+      durable = buffer.getBoolean();
+      consumerCount = buffer.getInt();
+      messageCount = buffer.getInt();
+      filterString = buffer.getNullableSimpleString();
+      address = buffer.getNullableSimpleString();
+   }
+
+   public boolean equals(Object other)
+   {
+      if (other instanceof SessionQueueQueryResponseMessage == false)
+      {
+         return false;
+      }
+
+      SessionQueueQueryResponseMessage r = (SessionQueueQueryResponseMessage)other;
+
+      return super.equals(other) && this.exists == r.exists &&
+             this.durable == r.durable &&
+             this.consumerCount == r.consumerCount &&
+             this.messageCount == r.messageCount &&
+             this.filterString == null ? r.filterString == null
+                                      : this.filterString.equals(r.filterString) && this.address == null ? r.address == null
+                                                                                                        : this.address.equals(r.address);
+   }
+
+}

Added: trunk/dotnet/JBMClient/remoting/impl/wireformat/SessionReceiveContinuationMessage.java
===================================================================
--- trunk/dotnet/JBMClient/remoting/impl/wireformat/SessionReceiveContinuationMessage.java	                        (rev 0)
+++ trunk/dotnet/JBMClient/remoting/impl/wireformat/SessionReceiveContinuationMessage.java	2009-02-05 01:20:31 UTC (rev 5812)
@@ -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.core.remoting.impl.wireformat;
+
+import org.jboss.messaging.core.remoting.spi.MessagingBuffer;
+import org.jboss.messaging.util.DataConstants;
+
+/**
+ * A SessionSendContinuationMessage
+ *
+ * @author <a href="mailto:clebert.suconic at jboss.org">Clebert Suconic</a>
+ * 
+ * Created Dec 4, 2008 12:25:14 PM
+ *
+ *
+ */
+public class SessionReceiveContinuationMessage extends SessionContinuationMessage
+{
+
+   // Constants -----------------------------------------------------
+
+   public static final int SESSION_RECEIVE_CONTINUATION_BASE_SIZE = SESSION_CONTINUATION_BASE_SIZE + DataConstants.SIZE_LONG;
+   
+   // Attributes ----------------------------------------------------
+
+   private long consumerID;
+
+   // Static --------------------------------------------------------
+
+   // Constructors --------------------------------------------------
+
+   /**
+    * @param type
+    */
+   public SessionReceiveContinuationMessage()
+   {
+      super(SESS_RECEIVE_CONTINUATION);
+   }
+
+   /**
+    * @param type
+    * @param body
+    * @param continues
+    * @param requiresResponse
+    */
+   public SessionReceiveContinuationMessage(final long consumerID,
+                                            final byte[] body,
+                                            final boolean continues,
+                                            final boolean requiresResponse)
+   {
+      super(SESS_RECEIVE_CONTINUATION, body, continues);
+      this.consumerID = consumerID;
+   }
+
+   /**
+    * @return the consumerID
+    */
+   public long getConsumerID()
+   {
+      return consumerID;
+   }
+
+   // Public --------------------------------------------------------
+
+   @Override
+   public int getRequiredBufferSize()
+   {
+      return SESSION_RECEIVE_CONTINUATION_BASE_SIZE + body.length; 
+   }
+
+   @Override
+   public void encodeBody(final MessagingBuffer buffer)
+   {
+      super.encodeBody(buffer);
+      buffer.putLong(consumerID);
+   }
+
+   @Override
+   public void decodeBody(final MessagingBuffer buffer)
+   {
+      super.decodeBody(buffer);
+      consumerID = buffer.getLong();
+   }
+
+   // Package protected ---------------------------------------------
+
+   // Protected -----------------------------------------------------
+
+   // Private -------------------------------------------------------
+
+   // Inner classes -------------------------------------------------
+
+}

Added: trunk/dotnet/JBMClient/remoting/impl/wireformat/SessionReceiveMessage.java
===================================================================
--- trunk/dotnet/JBMClient/remoting/impl/wireformat/SessionReceiveMessage.java	                        (rev 0)
+++ trunk/dotnet/JBMClient/remoting/impl/wireformat/SessionReceiveMessage.java	2009-02-05 01:20:31 UTC (rev 5812)
@@ -0,0 +1,197 @@
+/*
+ * 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.remoting.impl.wireformat;
+
+import org.jboss.messaging.core.client.impl.ClientMessageImpl;
+import org.jboss.messaging.core.client.impl.ClientMessageInternal;
+import org.jboss.messaging.core.logging.Logger;
+import org.jboss.messaging.core.remoting.spi.MessagingBuffer;
+import org.jboss.messaging.core.server.ServerMessage;
+import org.jboss.messaging.util.DataConstants;
+
+/**
+ * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
+ * @author <a href="mailto:ovidiu at feodorov.com">Ovidiu Feodorov</a>
+ * @author <a href="mailto:jmesnil at redhat.com">Jeff Mesnil</a>
+ * 
+ * @version <tt>$Revision$</tt>
+ */
+public class SessionReceiveMessage extends PacketImpl
+{
+   // Constants -----------------------------------------------------
+
+   public static final int SESSION_RECEIVE_MESSAGE_LARGE_MESSAGE_SIZE = BASIC_PACKET_SIZE + DataConstants.SIZE_LONG +
+                                                                       DataConstants.SIZE_INT +
+                                                                       DataConstants.SIZE_BOOLEAN +
+                                                                       DataConstants.SIZE_INT;
+
+   private static final Logger log = Logger.getLogger(SessionReceiveMessage.class);
+
+   // Attributes ----------------------------------------------------
+
+   private long consumerID;
+
+   private boolean largeMessage;
+
+   private byte[] largeMessageHeader;
+
+   private ClientMessageInternal clientMessage;
+
+   private ServerMessage serverMessage;
+
+   private int deliveryCount;
+
+   // Static --------------------------------------------------------
+
+   // Constructors --------------------------------------------------
+
+   public SessionReceiveMessage(final long consumerID, final byte[] largeMessageHeader, final int deliveryCount)
+   {
+      super(SESS_RECEIVE_MSG);
+
+      this.consumerID = consumerID;
+
+      this.largeMessageHeader = largeMessageHeader;
+
+      this.deliveryCount = deliveryCount;
+
+      this.largeMessage = true;
+   }
+
+   public SessionReceiveMessage(final long consumerID, final ServerMessage message, final int deliveryCount)
+   {
+      super(SESS_RECEIVE_MSG);
+
+      this.consumerID = consumerID;
+
+      this.serverMessage = message;
+
+      this.clientMessage = null;
+
+      this.deliveryCount = deliveryCount;
+
+      this.largeMessage = false;
+   }
+
+   public SessionReceiveMessage()
+   {
+      super(SESS_RECEIVE_MSG);
+   }
+
+   // Public --------------------------------------------------------
+
+   public long getConsumerID()
+   {
+      return consumerID;
+   }
+
+   public ClientMessageInternal getClientMessage()
+   {
+      return clientMessage;
+   }
+
+   public ServerMessage getServerMessage()
+   {
+      return serverMessage;
+   }
+
+   public byte[] getLargeMessageHeader()
+   {
+      return largeMessageHeader;
+   }
+
+   /**
+    * @return the largeMessage
+    */
+   public boolean isLargeMessage()
+   {
+      return largeMessage;
+   }
+
+   public int getDeliveryCount()
+   {
+      return deliveryCount;
+   }
+
+   public int getRequiredBufferSize()
+   {
+      if (largeMessage)
+      {
+         return SESSION_RECEIVE_MESSAGE_LARGE_MESSAGE_SIZE + largeMessageHeader.length;
+      }
+      else
+      {
+         return BASIC_PACKET_SIZE + DataConstants.SIZE_LONG +
+                DataConstants.SIZE_INT +
+                DataConstants.SIZE_BOOLEAN +
+                serverMessage.getEncodeSize();
+      }
+   }
+   public void encodeBody(final MessagingBuffer buffer)
+   {
+      buffer.putLong(consumerID);
+      buffer.putInt(deliveryCount);
+      buffer.putBoolean(largeMessage);
+      if (largeMessage)
+      {
+         buffer.putInt(largeMessageHeader.length);
+         buffer.putBytes(largeMessageHeader);
+      }
+      else
+      {
+         serverMessage.encode(buffer);
+      }
+   }
+
+   public void decodeBody(final MessagingBuffer buffer)
+   {
+      // TODO can be optimised
+
+      consumerID = buffer.getLong();
+
+      deliveryCount = buffer.getInt();
+
+      largeMessage = buffer.getBoolean();
+
+      if (largeMessage)
+      {
+         int size = buffer.getInt();
+         largeMessageHeader = new byte[size];
+         buffer.getBytes(largeMessageHeader);
+      }
+      else
+      {
+         clientMessage = new ClientMessageImpl(deliveryCount);
+         clientMessage.decode(buffer);
+         clientMessage.getBody().flip();
+      }
+   }
+
+   // Package protected ---------------------------------------------
+
+   // Protected -----------------------------------------------------
+
+   // Private -------------------------------------------------------
+
+   // Inner classes -------------------------------------------------
+}

Added: trunk/dotnet/JBMClient/remoting/impl/wireformat/SessionRemoveDestinationMessage.java
===================================================================
--- trunk/dotnet/JBMClient/remoting/impl/wireformat/SessionRemoveDestinationMessage.java	                        (rev 0)
+++ trunk/dotnet/JBMClient/remoting/impl/wireformat/SessionRemoveDestinationMessage.java	2009-02-05 01:20:31 UTC (rev 5812)
@@ -0,0 +1,116 @@
+/*
+ * 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.remoting.impl.wireformat;
+
+import org.jboss.messaging.core.remoting.spi.MessagingBuffer;
+import org.jboss.messaging.util.SimpleString;
+
+
+/**
+ * 
+ * A SessionRemoveDestinationMessage
+ * 
+ * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
+ *
+ */
+public class SessionRemoveDestinationMessage extends PacketImpl
+{
+   // Constants -----------------------------------------------------
+
+   // Attributes ----------------------------------------------------
+   
+   private SimpleString address;
+   
+   private boolean durable;
+   
+   // Static --------------------------------------------------------
+
+   // Constructors --------------------------------------------------
+   
+   public SessionRemoveDestinationMessage(final SimpleString address, final boolean durable)
+   {
+      super(SESS_REMOVE_DESTINATION);
+      
+      this.address = address;
+      
+      this.durable = durable;
+   }
+   
+   public SessionRemoveDestinationMessage()
+   {
+      super(SESS_REMOVE_DESTINATION);
+   }
+
+   // Public --------------------------------------------------------
+   
+   public SimpleString getAddress()
+   {
+      return address;
+   }
+   
+   public boolean isDurable()
+   {
+   	return durable;
+   }
+   
+   public void encodeBody(final MessagingBuffer buffer)
+   {
+      buffer.putSimpleString(address);
+      buffer.putBoolean(durable);
+   }
+   
+   public void decodeBody(final MessagingBuffer buffer)
+   {
+      address = buffer.getSimpleString();
+      durable = buffer.getBoolean();
+   }
+        
+   @Override
+   public String toString()
+   {
+      return getParentString() + ", address=" + address + ", temp=" + durable + "]";
+   }
+   
+   public boolean equals(Object other)
+   {
+      if (other instanceof SessionRemoveDestinationMessage == false)
+      {
+         return false;
+      }
+            
+      SessionRemoveDestinationMessage r = (SessionRemoveDestinationMessage)other;
+      
+      return super.equals(other) && this.address.equals(r.address) &&
+             this.durable == r.durable;
+   }
+   
+   // Package protected ---------------------------------------------
+
+   // Protected -----------------------------------------------------
+
+   // Private -------------------------------------------------------
+
+   // Inner classes -------------------------------------------------
+}
+
+

Added: trunk/dotnet/JBMClient/remoting/impl/wireformat/SessionReplicateDeliveryMessage.java
===================================================================
--- trunk/dotnet/JBMClient/remoting/impl/wireformat/SessionReplicateDeliveryMessage.java	                        (rev 0)
+++ trunk/dotnet/JBMClient/remoting/impl/wireformat/SessionReplicateDeliveryMessage.java	2009-02-05 01:20:31 UTC (rev 5812)
@@ -0,0 +1,99 @@
+/*
+ * 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.remoting.impl.wireformat;
+
+import org.jboss.messaging.core.remoting.spi.MessagingBuffer;
+
+/**
+ * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
+ * @version <tt>$Revision$</tt>
+ */
+public class SessionReplicateDeliveryMessage extends PacketImpl
+{
+   // Constants -----------------------------------------------------
+
+   // Attributes ----------------------------------------------------
+
+   private long consumerID;
+
+   private long messageID;
+
+   // Static --------------------------------------------------------
+
+   // Constructors --------------------------------------------------
+
+   public SessionReplicateDeliveryMessage(final long consumerID, final long messageID)
+   {
+      super(SESS_REPLICATE_DELIVERY);
+
+      this.consumerID = consumerID;
+
+      this.messageID = messageID;
+   }
+
+   public SessionReplicateDeliveryMessage()
+   {
+      super(SESS_REPLICATE_DELIVERY);
+   }
+
+   // Public --------------------------------------------------------
+
+   public long getConsumerID()
+   {
+      return consumerID;
+   }
+
+   public long getMessageID()
+   {
+      return messageID;
+   }
+
+   public void encodeBody(final MessagingBuffer buffer)
+   {
+      buffer.putLong(consumerID);
+
+      buffer.putLong(messageID);
+   }
+
+   public void decodeBody(final MessagingBuffer buffer)
+   {
+      consumerID = buffer.getLong();
+
+      messageID = buffer.getLong();
+   }
+   
+   public boolean isRequiresConfirmations()
+   {      
+      return false;
+   }
+
+   public boolean equals(Object other)
+   {
+      if (other instanceof SessionReplicateDeliveryMessage == false)
+      {
+         return false;
+      }
+
+      SessionReplicateDeliveryMessage r = (SessionReplicateDeliveryMessage)other;
+
+      return super.equals(other) && this.consumerID == r.consumerID && this.messageID == r.messageID;
+   }
+   
+   // Package protected ---------------------------------------------
+
+   // Protected -----------------------------------------------------
+
+   // Private -------------------------------------------------------
+
+   // Inner classes -------------------------------------------------
+}

Added: trunk/dotnet/JBMClient/remoting/impl/wireformat/SessionSendContinuationMessage.java
===================================================================
--- trunk/dotnet/JBMClient/remoting/impl/wireformat/SessionSendContinuationMessage.java	                        (rev 0)
+++ trunk/dotnet/JBMClient/remoting/impl/wireformat/SessionSendContinuationMessage.java	2009-02-05 01:20:31 UTC (rev 5812)
@@ -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.core.remoting.impl.wireformat;
+
+import org.jboss.messaging.core.remoting.spi.MessagingBuffer;
+import org.jboss.messaging.util.DataConstants;
+
+
+/**
+ * A SessionSendContinuationMessage
+ *
+ * @author <a href="mailto:clebert.suconic at jboss.org">Clebert Suconic</a>
+ * 
+ * Created Dec 4, 2008 12:25:14 PM
+ *
+ *
+ */
+public class SessionSendContinuationMessage extends SessionContinuationMessage
+{
+
+   // Constants -----------------------------------------------------
+
+   // Attributes ----------------------------------------------------
+
+   private boolean requiresResponse;
+
+   // Static --------------------------------------------------------
+
+   // Constructors --------------------------------------------------
+
+   /**
+    * @param type
+    */
+   public SessionSendContinuationMessage()
+   {
+      super(SESS_SEND_CONTINUATION);
+   }
+
+   /**
+    * @param type
+    * @param body
+    * @param continues
+    * @param requiresResponse
+    */
+   public SessionSendContinuationMessage(final byte[] body,
+                                         final boolean continues,
+                                         final boolean requiresResponse)
+   {
+      super(SESS_SEND_CONTINUATION, body, continues);
+      this.requiresResponse = requiresResponse;
+   }
+
+
+   // Public --------------------------------------------------------
+   
+   /**
+    * @return the requiresResponse
+    */
+   public boolean isRequiresResponse()
+   {
+      return requiresResponse;
+   }
+
+   @Override
+   public int getRequiredBufferSize()
+   {
+      return super.getRequiredBufferSize() + DataConstants.SIZE_BOOLEAN;
+   }
+
+   @Override
+   public void encodeBody(final MessagingBuffer buffer)
+   {
+      super.encodeBody(buffer);
+      buffer.putBoolean(requiresResponse);
+   }
+
+   @Override
+   public void decodeBody(final MessagingBuffer buffer)
+   {
+      super.decodeBody(buffer);
+      requiresResponse = buffer.getBoolean();
+   }
+
+
+   // Package protected ---------------------------------------------
+
+   // Protected -----------------------------------------------------
+
+   // Private -------------------------------------------------------
+
+   // Inner classes -------------------------------------------------
+
+}

Added: trunk/dotnet/JBMClient/remoting/impl/wireformat/SessionSendMessage.java
===================================================================
--- trunk/dotnet/JBMClient/remoting/impl/wireformat/SessionSendMessage.java	                        (rev 0)
+++ trunk/dotnet/JBMClient/remoting/impl/wireformat/SessionSendMessage.java	2009-02-05 01:20:31 UTC (rev 5812)
@@ -0,0 +1,251 @@
+/*
+ * 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.remoting.impl.wireformat;
+
+import org.jboss.messaging.core.message.Message;
+import org.jboss.messaging.core.remoting.spi.MessagingBuffer;
+import org.jboss.messaging.core.server.ServerMessage;
+import org.jboss.messaging.core.server.impl.ServerMessageImpl;
+import org.jboss.messaging.util.DataConstants;
+
+/**
+ * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
+ * @author <a href="mailto:jmesnil at redhat.com">Jeff Mesnil</a>
+ * @author <a href="mailto:csuconic at redhat.com">Clebert Suconic</a>
+ * 
+ * @version <tt>$Revision$</tt>
+ */
+public class SessionSendMessage extends PacketImpl
+{
+   // Constants -----------------------------------------------------
+
+   // Attributes ----------------------------------------------------
+
+   private Message clientMessage;
+
+   private boolean largeMessage;
+
+   /** Used only if largeMessage */
+   private byte[] largeMessageHeader;
+   
+   /** We need to set the MessageID when replicating this on the server */
+   private long largeMessageId = -1;
+
+   private ServerMessage serverMessage;
+
+   private boolean requiresResponse;
+
+   // Static --------------------------------------------------------
+
+   // Constructors --------------------------------------------------
+
+   public SessionSendMessage(final Message message, final boolean requiresResponse)
+   {
+      super(SESS_SEND);
+
+      clientMessage = message;
+
+      this.requiresResponse = requiresResponse;
+
+      largeMessage = false;
+   }
+
+   public SessionSendMessage(final byte[] largeMessageHeader, final boolean requiresResponse)
+   {
+      super(SESS_SEND);
+
+      this.largeMessageHeader = largeMessageHeader;
+
+      this.requiresResponse = requiresResponse;
+
+      largeMessage = true;
+   }
+
+   public SessionSendMessage()
+   {
+      super(SESS_SEND);
+   }
+
+   // Public --------------------------------------------------------
+
+   
+   public boolean isLargeMessage()
+   {
+      return largeMessage;
+   }
+   
+   public Message getClientMessage()
+   {
+      return clientMessage;
+   }
+
+   public ServerMessage getServerMessage()
+   {
+      return serverMessage;
+   }
+
+   public byte[] getLargeMessageHeader()
+   {
+      return largeMessageHeader;
+   }
+
+   public boolean isRequiresResponse()
+   {
+      return requiresResponse;
+   }
+   
+   /**
+    * @return the largeMessageId
+    */
+   public long getMessageID()
+   {
+      if (largeMessage)
+      {
+         return largeMessageId;
+      }
+      else
+      {
+         return serverMessage.getMessageID();
+      }
+   }
+
+   /**
+    * @param largeMessageId the largeMessageId to set
+    */
+   public void setMessageID(long id)
+   {
+      if (largeMessage)
+      {
+         this.largeMessageId = id;
+      }
+      else
+      {
+         serverMessage.setMessageID(id);
+      }
+   }
+
+   @Override
+   public void encodeBody(final MessagingBuffer buffer)
+   {
+      buffer.putBoolean(largeMessage);
+
+      if (largeMessage)
+      {
+         buffer.putInt(largeMessageHeader.length);
+         buffer.putBytes(largeMessageHeader);
+         
+         if (largeMessageId > 0)
+         {
+            buffer.putBoolean(true);
+            buffer.putLong(largeMessageId);
+         }
+         else
+         {
+            buffer.putBoolean(false);
+         }
+      }
+      else if (clientMessage != null)
+      {
+         clientMessage.encode(buffer);
+      }
+      else
+      {
+         // If we're replicating a buffer to a backup node then we encode the serverMessage not the clientMessage
+         serverMessage.encode(buffer);
+      }
+
+      buffer.putBoolean(requiresResponse);
+   }
+
+   @Override
+   public void decodeBody(final MessagingBuffer buffer)
+   {
+      largeMessage = buffer.getBoolean();
+
+      if (largeMessage)
+      {
+         int largeMessageLength = buffer.getInt();
+
+         largeMessageHeader = new byte[largeMessageLength];
+
+         buffer.getBytes(largeMessageHeader);
+         
+         final boolean largeMessageIDFilled = buffer.getBoolean();
+         
+         if (largeMessageIDFilled)
+         {
+            this.largeMessageId = buffer.getLong();
+         }
+         else
+         {
+            this.largeMessageId = -1;
+         }
+      }
+      else
+      {
+         // TODO can be optimised
+
+         serverMessage = new ServerMessageImpl();
+         
+         clientMessage = serverMessage;
+
+         serverMessage.decode(buffer);
+
+         serverMessage.getBody().flip();
+
+         requiresResponse = buffer.getBoolean();
+      }
+   }
+
+   @Override
+   public int getRequiredBufferSize()
+   {
+      if (largeMessage)
+      {
+         return BASIC_PACKET_SIZE +
+                // IsLargeMessage
+                DataConstants.SIZE_BOOLEAN +
+                // BufferSize
+                DataConstants.SIZE_INT +
+                // Bytes sent
+                largeMessageHeader.length +
+                // LargeMessageID (if > 0) and a boolean statying if the largeMessageID is set
+                DataConstants.SIZE_BOOLEAN + (largeMessageId >= 0 ? DataConstants.SIZE_LONG : 0) + 
+                DataConstants.SIZE_BOOLEAN;
+      }
+      else
+      {
+         return DataConstants.SIZE_BOOLEAN + BASIC_PACKET_SIZE +
+                clientMessage.getEncodeSize() +
+                DataConstants.SIZE_BOOLEAN;
+      }
+   }
+
+   // Package protected ---------------------------------------------
+
+   // Protected -----------------------------------------------------
+
+   // Private -------------------------------------------------------
+
+   // Inner classes -------------------------------------------------
+}

Added: trunk/dotnet/JBMClient/remoting/impl/wireformat/SessionXACommitMessage.java
===================================================================
--- trunk/dotnet/JBMClient/remoting/impl/wireformat/SessionXACommitMessage.java	                        (rev 0)
+++ trunk/dotnet/JBMClient/remoting/impl/wireformat/SessionXACommitMessage.java	2009-02-05 01:20:31 UTC (rev 5812)
@@ -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.core.remoting.impl.wireformat;
+
+import javax.transaction.xa.Xid;
+
+import org.jboss.messaging.core.remoting.spi.MessagingBuffer;
+
+
+/**
+ * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
+ * 
+ * @version <tt>$Revision$</tt>
+ */
+public class SessionXACommitMessage extends PacketImpl
+{
+   // Constants -----------------------------------------------------
+
+   // Attributes ----------------------------------------------------
+   
+   private boolean onePhase;
+   
+   private Xid xid;
+   
+   // Static --------------------------------------------------------
+
+   // Constructors --------------------------------------------------
+
+   public SessionXACommitMessage(final Xid xid, final boolean onePhase)
+   {
+      super(SESS_XA_COMMIT);
+      
+      this.xid = xid;
+      this.onePhase = onePhase;
+   }
+   
+   public SessionXACommitMessage()
+   {
+      super(SESS_XA_COMMIT);
+   }
+
+   // Public --------------------------------------------------------
+ 
+   public Xid getXid()
+   {
+      return xid;
+   }
+   
+   public boolean isOnePhase()
+   {
+      return onePhase;
+   }
+   
+   public void encodeBody(final MessagingBuffer buffer)
+   {
+      XidCodecSupport.encodeXid(xid, buffer);
+      buffer.putBoolean(onePhase);
+   }
+   
+   public void decodeBody(final MessagingBuffer buffer)
+   {
+      xid = XidCodecSupport.decodeXid(buffer);
+      onePhase = buffer.getBoolean();
+   }
+
+   @Override
+   public String toString()
+   {
+      return getParentString() + ", xid=" + xid + ", onePhase=" + onePhase + "]";
+   }
+   
+   public boolean equals(Object other)
+   {
+      if (other instanceof SessionXACommitMessage == false)
+      {
+         return false;
+      }
+            
+      SessionXACommitMessage r = (SessionXACommitMessage)other;
+      
+      return super.equals(other) && this.xid.equals(r.xid) &&
+             this.onePhase == r.onePhase;
+   }
+   
+   // Package protected ---------------------------------------------
+
+   // Protected -----------------------------------------------------
+
+   // Private -------------------------------------------------------
+
+   // Inner classes -------------------------------------------------
+}
+

Added: trunk/dotnet/JBMClient/remoting/impl/wireformat/SessionXAEndMessage.java
===================================================================
--- trunk/dotnet/JBMClient/remoting/impl/wireformat/SessionXAEndMessage.java	                        (rev 0)
+++ trunk/dotnet/JBMClient/remoting/impl/wireformat/SessionXAEndMessage.java	2009-02-05 01:20:31 UTC (rev 5812)
@@ -0,0 +1,114 @@
+/*
+ * 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.remoting.impl.wireformat;
+
+import javax.transaction.xa.Xid;
+
+import org.jboss.messaging.core.remoting.spi.MessagingBuffer;
+
+
+/**
+ * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
+ * 
+ * @version <tt>$Revision$</tt>
+ */
+public class SessionXAEndMessage extends PacketImpl
+{
+   // Constants -----------------------------------------------------
+
+   // Attributes ----------------------------------------------------
+   
+   private Xid xid;
+   
+   private boolean failed;
+   
+   // Static --------------------------------------------------------
+
+   // Constructors --------------------------------------------------
+
+   public SessionXAEndMessage(final Xid xid, final boolean failed)
+   {
+      super(SESS_XA_END);
+      
+      this.xid = xid;
+      
+      this.failed = failed;
+   }
+   
+   public SessionXAEndMessage()
+   {
+      super(SESS_XA_END);
+   }
+
+   // Public --------------------------------------------------------
+   
+   public boolean isFailed()
+   {
+      return failed;
+   }
+   
+   public Xid getXid()
+   {
+      return xid;
+   }
+   
+   public void encodeBody(final MessagingBuffer buffer)
+   {
+      XidCodecSupport.encodeXid(xid, buffer);
+      buffer.putBoolean(failed);
+   }
+   
+   public void decodeBody(final MessagingBuffer buffer)
+   {
+      xid = XidCodecSupport.decodeXid(buffer);
+      failed = buffer.getBoolean();
+   }
+
+   @Override
+   public String toString()
+   {
+      return getParentString() + ", xid=" + xid + ", failed=" + failed + "]";
+   }
+   
+   public boolean equals(Object other)
+   {
+      if (other instanceof SessionXAEndMessage == false)
+      {
+         return false;
+      }
+            
+      SessionXAEndMessage r = (SessionXAEndMessage)other;
+      
+      return super.equals(other) && this.xid.equals(r.xid) &&
+             this.failed == r.failed;
+   }
+
+   // Package protected ---------------------------------------------
+
+   // Protected -----------------------------------------------------
+
+   // Private -------------------------------------------------------
+
+   // Inner classes -------------------------------------------------
+}
+

Added: trunk/dotnet/JBMClient/remoting/impl/wireformat/SessionXAForgetMessage.java
===================================================================
--- trunk/dotnet/JBMClient/remoting/impl/wireformat/SessionXAForgetMessage.java	                        (rev 0)
+++ trunk/dotnet/JBMClient/remoting/impl/wireformat/SessionXAForgetMessage.java	2009-02-05 01:20:31 UTC (rev 5812)
@@ -0,0 +1,97 @@
+/*
+ * 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.remoting.impl.wireformat;
+
+import javax.transaction.xa.Xid;
+
+import org.jboss.messaging.core.remoting.spi.MessagingBuffer;
+
+
+/**
+ * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
+ * 
+ * @version <tt>$Revision$</tt>
+ */
+public class SessionXAForgetMessage extends PacketImpl
+{
+   // Constants -----------------------------------------------------
+
+   // Attributes ----------------------------------------------------
+   
+   private Xid xid;
+      
+   // Static --------------------------------------------------------
+
+   // Constructors --------------------------------------------------
+
+   public SessionXAForgetMessage(final Xid xid)
+   {
+      super(SESS_XA_FORGET);
+      
+      this.xid = xid;
+   }
+   
+   public SessionXAForgetMessage()
+   {
+      super(SESS_XA_FORGET);
+   }
+
+   // Public --------------------------------------------------------
+   
+   public Xid getXid()
+   {
+      return xid;
+   }
+   
+   public void encodeBody(final MessagingBuffer buffer)
+   {
+      XidCodecSupport.encodeXid(xid, buffer);
+   }
+   
+   public void decodeBody(final MessagingBuffer buffer)
+   {
+      xid = XidCodecSupport.decodeXid(buffer);
+   }
+   
+   public boolean equals(Object other)
+   {
+      if (other instanceof SessionXAForgetMessage == false)
+      {
+         return false;
+      }
+            
+      SessionXAForgetMessage r = (SessionXAForgetMessage)other;
+      
+      return super.equals(other) && this.xid.equals(r.xid);
+   }
+   
+   // Package protected ---------------------------------------------
+
+   // Protected -----------------------------------------------------
+
+   // Private -------------------------------------------------------
+
+   // Inner classes -------------------------------------------------
+}
+
+

Added: trunk/dotnet/JBMClient/remoting/impl/wireformat/SessionXAGetInDoubtXidsResponseMessage.java
===================================================================
--- trunk/dotnet/JBMClient/remoting/impl/wireformat/SessionXAGetInDoubtXidsResponseMessage.java	                        (rev 0)
+++ trunk/dotnet/JBMClient/remoting/impl/wireformat/SessionXAGetInDoubtXidsResponseMessage.java	2009-02-05 01:20:31 UTC (rev 5812)
@@ -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.core.remoting.impl.wireformat;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.transaction.xa.Xid;
+
+import org.jboss.messaging.core.remoting.spi.MessagingBuffer;
+
+
+/**
+ * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
+ * 
+ * @version <tt>$Revision$</tt>
+ */
+public class SessionXAGetInDoubtXidsResponseMessage extends PacketImpl
+{
+   // Constants -----------------------------------------------------
+
+   // Attributes ----------------------------------------------------
+   
+   private List<Xid> xids;
+   
+   // Static --------------------------------------------------------
+
+   // Constructors --------------------------------------------------
+
+   public SessionXAGetInDoubtXidsResponseMessage(final List<Xid> xids)
+   {
+      super(SESS_XA_INDOUBT_XIDS_RESP);
+      
+      this.xids = xids;
+   }
+   
+   public SessionXAGetInDoubtXidsResponseMessage()
+   {
+      super(SESS_XA_INDOUBT_XIDS_RESP);
+   }
+
+   // Public --------------------------------------------------------
+  
+   public boolean isResponse()
+   {
+      return true;
+   }
+   
+   public List<Xid> getXids()
+   {
+      return xids;
+   }
+
+   public void encodeBody(final MessagingBuffer buffer)
+   {
+      buffer.putInt(xids.size());
+
+      for (Xid xid: xids)
+      {
+         XidCodecSupport.encodeXid(xid, buffer);
+      }    
+   }
+   
+   public void decodeBody(final MessagingBuffer buffer)
+   {
+      int len = buffer.getInt();
+      xids = new ArrayList<Xid>(len);      
+      for (int i = 0; i < len; i++)
+      {
+         Xid xid = XidCodecSupport.decodeXid(buffer);
+         
+         xids.add(xid);
+      }      
+   }
+   
+   public boolean equals(Object other)
+   {
+      if (other instanceof SessionXAGetInDoubtXidsResponseMessage == false)
+      {
+         return false;
+      }
+            
+      SessionXAGetInDoubtXidsResponseMessage r = (SessionXAGetInDoubtXidsResponseMessage)other;
+      
+      if (super.equals(other))
+      {
+         if (this.xids.size() == r.xids.size())
+         {
+            for (int i = 0; i < xids.size(); i++)
+            {
+               if (!xids.get(i).equals(r.xids.get(i)))
+               {
+                  return false;
+               }
+            }
+         }
+      }
+      else
+      {
+         return false;
+      }
+      return true;
+   }
+   
+   // Package protected ---------------------------------------------
+
+   // Protected -----------------------------------------------------
+
+   // Private -------------------------------------------------------
+
+   // Inner classes -------------------------------------------------
+}
+
+

Added: trunk/dotnet/JBMClient/remoting/impl/wireformat/SessionXAGetTimeoutResponseMessage.java
===================================================================
--- trunk/dotnet/JBMClient/remoting/impl/wireformat/SessionXAGetTimeoutResponseMessage.java	                        (rev 0)
+++ trunk/dotnet/JBMClient/remoting/impl/wireformat/SessionXAGetTimeoutResponseMessage.java	2009-02-05 01:20:31 UTC (rev 5812)
@@ -0,0 +1,100 @@
+/*
+ * 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.remoting.impl.wireformat;
+
+import org.jboss.messaging.core.remoting.spi.MessagingBuffer;
+
+
+
+/**
+ * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
+ * 
+ * @version <tt>$Revision$</tt>
+ */
+public class SessionXAGetTimeoutResponseMessage extends PacketImpl
+{
+   // Constants -----------------------------------------------------
+
+   // Attributes ----------------------------------------------------
+   
+   private int timeoutSeconds;
+   
+   // Static --------------------------------------------------------
+
+   // Constructors --------------------------------------------------
+
+   public SessionXAGetTimeoutResponseMessage(final int timeoutSeconds)
+   {
+      super(SESS_XA_GET_TIMEOUT_RESP);
+      
+      this.timeoutSeconds = timeoutSeconds;
+   }
+   
+   public SessionXAGetTimeoutResponseMessage()
+   {
+      super(SESS_XA_GET_TIMEOUT_RESP);
+   }
+   
+   // Public --------------------------------------------------------
+   
+   public boolean isResponse()
+   {
+      return true;
+   }
+   
+   public int getTimeoutSeconds()
+   {
+      return this.timeoutSeconds;
+   }
+   
+   public void encodeBody(final MessagingBuffer buffer)
+   {
+      buffer.putInt(timeoutSeconds);  
+   }
+   
+   public void decodeBody(final MessagingBuffer buffer)
+   {
+      timeoutSeconds = buffer.getInt(); 
+   }
+   
+   public boolean equals(Object other)
+   {
+      if (other instanceof SessionXAGetTimeoutResponseMessage == false)
+      {
+         return false;
+      }
+            
+      SessionXAGetTimeoutResponseMessage r = (SessionXAGetTimeoutResponseMessage)other;
+      
+      return super.equals(other) && this.timeoutSeconds == r.timeoutSeconds;     
+   }
+
+   // Package protected ---------------------------------------------
+
+   // Protected -----------------------------------------------------
+
+   // Private -------------------------------------------------------
+
+   // Inner classes -------------------------------------------------
+}
+

Added: trunk/dotnet/JBMClient/remoting/impl/wireformat/SessionXAJoinMessage.java
===================================================================
--- trunk/dotnet/JBMClient/remoting/impl/wireformat/SessionXAJoinMessage.java	                        (rev 0)
+++ trunk/dotnet/JBMClient/remoting/impl/wireformat/SessionXAJoinMessage.java	2009-02-05 01:20:31 UTC (rev 5812)
@@ -0,0 +1,96 @@
+/*
+ * 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.remoting.impl.wireformat;
+
+import javax.transaction.xa.Xid;
+
+import org.jboss.messaging.core.remoting.spi.MessagingBuffer;
+
+
+/**
+ * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
+ * 
+ * @version <tt>$Revision$</tt>
+ */
+public class SessionXAJoinMessage extends PacketImpl
+{
+   // Constants -----------------------------------------------------
+
+   // Attributes ----------------------------------------------------
+   
+   private Xid xid;
+   
+   // Static --------------------------------------------------------
+
+   // Constructors --------------------------------------------------
+
+   public SessionXAJoinMessage(final Xid xid)
+   {
+      super(SESS_XA_JOIN);
+      
+      this.xid = xid;
+   }
+   
+   public SessionXAJoinMessage()
+   {
+      super(SESS_XA_JOIN);
+   }
+
+   // Public --------------------------------------------------------
+   
+   public Xid getXid()
+   {
+      return xid;
+   }
+   
+   public void encodeBody(final MessagingBuffer buffer)
+   {
+      XidCodecSupport.encodeXid(xid, buffer);
+   }
+   
+   public void decodeBody(final MessagingBuffer buffer)
+   {
+      xid = XidCodecSupport.decodeXid(buffer);
+   }
+   
+   public boolean equals(Object other)
+   {
+      if (other instanceof SessionXAJoinMessage == false)
+      {
+         return false;
+      }
+            
+      SessionXAJoinMessage r = (SessionXAJoinMessage)other;
+      
+      return super.equals(other) && this.xid.equals(r.xid);
+   }
+   
+   // Package protected ---------------------------------------------
+
+   // Protected -----------------------------------------------------
+
+   // Private -------------------------------------------------------
+
+   // Inner classes -------------------------------------------------
+}
+

Added: trunk/dotnet/JBMClient/remoting/impl/wireformat/SessionXAPrepareMessage.java
===================================================================
--- trunk/dotnet/JBMClient/remoting/impl/wireformat/SessionXAPrepareMessage.java	                        (rev 0)
+++ trunk/dotnet/JBMClient/remoting/impl/wireformat/SessionXAPrepareMessage.java	2009-02-05 01:20:31 UTC (rev 5812)
@@ -0,0 +1,96 @@
+/*
+ * 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.remoting.impl.wireformat;
+
+import javax.transaction.xa.Xid;
+
+import org.jboss.messaging.core.remoting.spi.MessagingBuffer;
+
+
+/**
+ * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
+ * 
+ * @version <tt>$Revision$</tt>
+ */
+public class SessionXAPrepareMessage extends PacketImpl
+{
+   // Constants -----------------------------------------------------
+
+   // Attributes ----------------------------------------------------
+   
+   private Xid xid;
+   
+   // Static --------------------------------------------------------
+
+   // Constructors --------------------------------------------------
+
+   public SessionXAPrepareMessage(final Xid xid)
+   {
+      super(SESS_XA_PREPARE);
+      
+      this.xid = xid;
+   }
+   
+   public SessionXAPrepareMessage()
+   {
+      super(SESS_XA_PREPARE);
+   }
+
+   // Public --------------------------------------------------------
+   
+   public Xid getXid()
+   {
+      return xid;
+   }
+   
+   public void encodeBody(final MessagingBuffer buffer)
+   {
+      XidCodecSupport.encodeXid(xid, buffer);
+   }
+   
+   public void decodeBody(final MessagingBuffer buffer)
+   {
+      xid = XidCodecSupport.decodeXid(buffer);
+   }
+   
+   public boolean equals(Object other)
+   {
+      if (other instanceof SessionXAPrepareMessage == false)
+      {
+         return false;
+      }
+            
+      SessionXAPrepareMessage r = (SessionXAPrepareMessage)other;
+      
+      return super.equals(other) && this.xid.equals(r.xid);
+   }
+
+   // Package protected ---------------------------------------------
+
+   // Protected -----------------------------------------------------
+
+   // Private -------------------------------------------------------
+
+   // Inner classes -------------------------------------------------
+}
+

Added: trunk/dotnet/JBMClient/remoting/impl/wireformat/SessionXAResponseMessage.java
===================================================================
--- trunk/dotnet/JBMClient/remoting/impl/wireformat/SessionXAResponseMessage.java	                        (rev 0)
+++ trunk/dotnet/JBMClient/remoting/impl/wireformat/SessionXAResponseMessage.java	2009-02-05 01:20:31 UTC (rev 5812)
@@ -0,0 +1,122 @@
+/*
+ * 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.remoting.impl.wireformat;
+
+import org.jboss.messaging.core.remoting.spi.MessagingBuffer;
+
+
+/**
+ * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
+ * 
+ * @version <tt>$Revision$</tt>
+ */
+public class SessionXAResponseMessage extends PacketImpl
+{
+   // Constants -----------------------------------------------------
+
+   // Attributes ----------------------------------------------------
+   
+   private boolean error;
+   
+   private int responseCode;
+   
+   private String message;
+      
+   // Static --------------------------------------------------------
+
+   // Constructors --------------------------------------------------
+
+   public SessionXAResponseMessage(final boolean isError, final int responseCode, final String message)
+   {
+      super(SESS_XA_RESP);
+      
+      this.error = isError;
+      
+      this.responseCode = responseCode;
+      
+      this.message = message;
+   }
+   
+   public SessionXAResponseMessage()
+   {
+      super(SESS_XA_RESP);
+   }
+
+   // Public --------------------------------------------------------
+
+   public boolean isResponse()
+   {
+      return true;
+   }
+   
+   public boolean isError()
+   {
+      return error;
+   }
+   
+   public int getResponseCode()
+   {
+      return this.responseCode;
+   }
+   
+   public String getMessage()
+   {
+      return message;
+   }
+   
+   public void encodeBody(final MessagingBuffer buffer)
+   {
+      buffer.putBoolean(error);      
+      buffer.putInt(responseCode);      
+      buffer.putNullableString(message);
+   }
+   
+   public void decodeBody(final MessagingBuffer buffer)
+   {
+      error = buffer.getBoolean();      
+      responseCode = buffer.getInt();      
+      message = buffer.getNullableString();
+   }
+   
+   public boolean equals(Object other)
+   {
+      if (other instanceof SessionXAResponseMessage == false)
+      {
+         return false;
+      }
+            
+      SessionXAResponseMessage r = (SessionXAResponseMessage)other;
+      
+      return super.equals(other) && this.error == r.error && this.responseCode == r.responseCode &&
+         this.message.equals(r.message);
+   }
+
+   // Package protected ---------------------------------------------
+
+   // Protected -----------------------------------------------------
+
+   // Private -------------------------------------------------------
+
+   // Inner classes -------------------------------------------------
+}
+

Added: trunk/dotnet/JBMClient/remoting/impl/wireformat/SessionXAResumeMessage.java
===================================================================
--- trunk/dotnet/JBMClient/remoting/impl/wireformat/SessionXAResumeMessage.java	                        (rev 0)
+++ trunk/dotnet/JBMClient/remoting/impl/wireformat/SessionXAResumeMessage.java	2009-02-05 01:20:31 UTC (rev 5812)
@@ -0,0 +1,96 @@
+/*
+ * 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.remoting.impl.wireformat;
+
+import javax.transaction.xa.Xid;
+
+import org.jboss.messaging.core.remoting.spi.MessagingBuffer;
+
+
+/**
+ * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
+ * 
+ * @version <tt>$Revision$</tt>
+ */
+public class SessionXAResumeMessage extends PacketImpl
+{
+   // Constants -----------------------------------------------------
+
+   // Attributes ----------------------------------------------------
+   
+   private Xid xid;
+   
+   // Static --------------------------------------------------------
+
+   // Constructors --------------------------------------------------
+
+   public SessionXAResumeMessage(final Xid xid)
+   {
+      super(SESS_XA_RESUME);
+      
+      this.xid = xid;
+   }
+   
+   public SessionXAResumeMessage()
+   {
+      super(SESS_XA_RESUME);
+   }
+
+   // Public --------------------------------------------------------
+   
+   public Xid getXid()
+   {
+      return xid;
+   }
+   
+   public void encodeBody(final MessagingBuffer buffer)
+   {
+      XidCodecSupport.encodeXid(xid, buffer);
+   }
+   
+   public void decodeBody(final MessagingBuffer buffer)
+   {
+      xid = XidCodecSupport.decodeXid(buffer);
+   }
+   
+   public boolean equals(Object other)
+   {
+      if (other instanceof SessionXAResumeMessage == false)
+      {
+         return false;
+      }
+            
+      SessionXAResumeMessage r = (SessionXAResumeMessage)other;
+      
+      return super.equals(other) &&  this.xid.equals(r.xid);
+   }
+   
+   // Package protected ---------------------------------------------
+
+   // Protected -----------------------------------------------------
+
+   // Private -------------------------------------------------------
+
+   // Inner classes -------------------------------------------------
+}
+

Added: trunk/dotnet/JBMClient/remoting/impl/wireformat/SessionXARollbackMessage.java
===================================================================
--- trunk/dotnet/JBMClient/remoting/impl/wireformat/SessionXARollbackMessage.java	                        (rev 0)
+++ trunk/dotnet/JBMClient/remoting/impl/wireformat/SessionXARollbackMessage.java	2009-02-05 01:20:31 UTC (rev 5812)
@@ -0,0 +1,96 @@
+/*
+ * 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.remoting.impl.wireformat;
+
+import javax.transaction.xa.Xid;
+
+import org.jboss.messaging.core.remoting.spi.MessagingBuffer;
+
+
+/**
+ * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
+ * 
+ * @version <tt>$Revision$</tt>
+ */
+public class SessionXARollbackMessage extends PacketImpl
+{
+   // Constants -----------------------------------------------------
+
+   // Attributes ----------------------------------------------------
+   
+   private Xid xid;
+   
+   // Static --------------------------------------------------------
+
+   // Constructors --------------------------------------------------
+
+   public SessionXARollbackMessage(final Xid xid)
+   {
+      super(SESS_XA_ROLLBACK);
+      
+      this.xid = xid;
+   }
+   
+   public SessionXARollbackMessage()
+   {
+      super(SESS_XA_ROLLBACK);
+   }
+
+   // Public --------------------------------------------------------
+   
+   public Xid getXid()
+   {
+      return xid;
+   }
+   
+   public void encodeBody(final MessagingBuffer buffer)
+   {
+      XidCodecSupport.encodeXid(xid, buffer);
+   }
+   
+   public void decodeBody(final MessagingBuffer buffer)
+   {
+      xid = XidCodecSupport.decodeXid(buffer);
+   }
+   
+   public boolean equals(Object other)
+   {
+      if (other instanceof SessionXARollbackMessage == false)
+      {
+         return false;
+      }
+            
+      SessionXARollbackMessage r = (SessionXARollbackMessage)other;
+      
+      return super.equals(other) && this.xid.equals(r.xid);
+   }
+   
+   // Package protected ---------------------------------------------
+
+   // Protected -----------------------------------------------------
+
+   // Private -------------------------------------------------------
+
+   // Inner classes -------------------------------------------------
+}
+

Added: trunk/dotnet/JBMClient/remoting/impl/wireformat/SessionXASetTimeoutMessage.java
===================================================================
--- trunk/dotnet/JBMClient/remoting/impl/wireformat/SessionXASetTimeoutMessage.java	                        (rev 0)
+++ trunk/dotnet/JBMClient/remoting/impl/wireformat/SessionXASetTimeoutMessage.java	2009-02-05 01:20:31 UTC (rev 5812)
@@ -0,0 +1,95 @@
+/*
+ * 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.remoting.impl.wireformat;
+
+import org.jboss.messaging.core.remoting.spi.MessagingBuffer;
+
+
+
+/**
+ * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
+ * 
+ * @version <tt>$Revision$</tt>
+ */
+public class SessionXASetTimeoutMessage extends PacketImpl
+{
+   // Constants -----------------------------------------------------
+
+   // Attributes ----------------------------------------------------
+   
+   private int timeoutSeconds;
+   
+   // Static --------------------------------------------------------
+
+   // Constructors --------------------------------------------------
+
+   public SessionXASetTimeoutMessage(final int timeoutSeconds)
+   {
+      super(SESS_XA_SET_TIMEOUT);
+      
+      this.timeoutSeconds = timeoutSeconds;
+   }
+   
+   public SessionXASetTimeoutMessage()
+   {
+      super(SESS_XA_SET_TIMEOUT);
+   }
+   
+   // Public --------------------------------------------------------
+   
+   public int getTimeoutSeconds()
+   {
+      return this.timeoutSeconds;
+   }
+   
+   public void encodeBody(final MessagingBuffer buffer)
+   {
+      buffer.putInt(timeoutSeconds);
+   }
+   
+   public void decodeBody(final MessagingBuffer buffer)
+   {
+      timeoutSeconds = buffer.getInt();
+   }
+   
+   public boolean equals(Object other)
+   {
+      if (other instanceof SessionXASetTimeoutMessage == false)
+      {
+         return false;
+      }
+            
+      SessionXASetTimeoutMessage r = (SessionXASetTimeoutMessage)other;
+      
+      return super.equals(other) && this.timeoutSeconds == r.timeoutSeconds;
+   }
+
+   // Package protected ---------------------------------------------
+
+   // Protected -----------------------------------------------------
+
+   // Private -------------------------------------------------------
+
+   // Inner classes -------------------------------------------------
+}
+

Added: trunk/dotnet/JBMClient/remoting/impl/wireformat/SessionXASetTimeoutResponseMessage.java
===================================================================
--- trunk/dotnet/JBMClient/remoting/impl/wireformat/SessionXASetTimeoutResponseMessage.java	                        (rev 0)
+++ trunk/dotnet/JBMClient/remoting/impl/wireformat/SessionXASetTimeoutResponseMessage.java	2009-02-05 01:20:31 UTC (rev 5812)
@@ -0,0 +1,98 @@
+/*
+ * 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.remoting.impl.wireformat;
+
+import org.jboss.messaging.core.remoting.spi.MessagingBuffer;
+
+
+/**
+ * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
+ * 
+ * @version <tt>$Revision$</tt>
+ */
+public class SessionXASetTimeoutResponseMessage extends PacketImpl
+{
+   // Constants -----------------------------------------------------
+
+   // Attributes ----------------------------------------------------
+   
+   private boolean ok;
+   
+   // Static --------------------------------------------------------
+
+   // Constructors --------------------------------------------------
+
+   public SessionXASetTimeoutResponseMessage(final boolean ok)
+   {
+      super(SESS_XA_SET_TIMEOUT_RESP);
+      
+      this.ok = ok;
+   }
+   
+   public SessionXASetTimeoutResponseMessage()
+   {
+      super(SESS_XA_SET_TIMEOUT_RESP);
+   }
+   
+   // Public --------------------------------------------------------
+   
+   public boolean isResponse()
+   {
+      return true;
+   }
+   
+   public boolean isOK()
+   {
+      return ok;
+   }
+   
+   public void encodeBody(final MessagingBuffer buffer)
+   {
+      buffer.putBoolean(ok);
+   }
+   
+   public void decodeBody(final MessagingBuffer buffer)
+   {
+      ok = buffer.getBoolean();
+   }
+   
+   public boolean equals(Object other)
+   {
+      if (other instanceof SessionXASetTimeoutResponseMessage == false)
+      {
+         return false;
+      }
+            
+      SessionXASetTimeoutResponseMessage r = (SessionXASetTimeoutResponseMessage)other;
+      
+      return super.equals(other) && this.ok == r.ok;  
+   }
+   
+   // Package protected ---------------------------------------------
+
+   // Protected -----------------------------------------------------
+
+   // Private -------------------------------------------------------
+
+   // Inner classes -------------------------------------------------
+}

Added: trunk/dotnet/JBMClient/remoting/impl/wireformat/SessionXAStartMessage.java
===================================================================
--- trunk/dotnet/JBMClient/remoting/impl/wireformat/SessionXAStartMessage.java	                        (rev 0)
+++ trunk/dotnet/JBMClient/remoting/impl/wireformat/SessionXAStartMessage.java	2009-02-05 01:20:31 UTC (rev 5812)
@@ -0,0 +1,96 @@
+/*
+ * 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.remoting.impl.wireformat;
+
+import javax.transaction.xa.Xid;
+
+import org.jboss.messaging.core.remoting.spi.MessagingBuffer;
+
+
+/**
+ * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
+ * 
+ * @version <tt>$Revision$</tt>
+ */
+public class SessionXAStartMessage extends PacketImpl
+{
+   // Constants -----------------------------------------------------
+
+   // Attributes ----------------------------------------------------
+   
+   private Xid xid;
+   
+   // Static --------------------------------------------------------
+
+   // Constructors --------------------------------------------------
+
+   public SessionXAStartMessage(final Xid xid)
+   {
+      super(SESS_XA_START);
+      
+      this.xid = xid;
+   }
+   
+   public SessionXAStartMessage()
+   {
+      super(SESS_XA_START);
+   }
+
+   // Public --------------------------------------------------------
+   
+   public Xid getXid()
+   {
+      return xid;
+   }
+   
+   public void encodeBody(final MessagingBuffer buffer)
+   {
+      XidCodecSupport.encodeXid(xid, buffer);
+   }
+   
+   public void decodeBody(final MessagingBuffer buffer)
+   {
+      xid = XidCodecSupport.decodeXid(buffer);
+   }
+   
+   public boolean equals(Object other)
+   {
+      if (other instanceof SessionXAStartMessage == false)
+      {
+         return false;
+      }
+            
+      SessionXAStartMessage r = (SessionXAStartMessage)other;
+      
+      return super.equals(other) && this.xid.equals(r.xid);
+   }
+
+   // Package protected ---------------------------------------------
+
+   // Protected -----------------------------------------------------
+
+   // Private -------------------------------------------------------
+
+   // Inner classes -------------------------------------------------
+}
+

Added: trunk/dotnet/JBMClient/remoting/impl/wireformat/XidCodecSupport.java
===================================================================
--- trunk/dotnet/JBMClient/remoting/impl/wireformat/XidCodecSupport.java	                        (rev 0)
+++ trunk/dotnet/JBMClient/remoting/impl/wireformat/XidCodecSupport.java	2009-02-05 01:20:31 UTC (rev 5812)
@@ -0,0 +1,84 @@
+/*
+ * 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.remoting.impl.wireformat;
+
+import javax.transaction.xa.Xid;
+
+import org.jboss.messaging.core.remoting.spi.MessagingBuffer;
+import org.jboss.messaging.core.transaction.impl.XidImpl;
+import org.jboss.messaging.util.DataConstants;
+
+/**
+ * @author <a href="mailto:jmesnil at redhat.com">Jeff Mesnil</a>
+ *
+ * @version <tt>$Revision$</tt>
+ *
+ */
+public class XidCodecSupport
+{
+
+   // Constants -----------------------------------------------------
+
+   // Attributes ----------------------------------------------------
+
+   // Static --------------------------------------------------------
+
+   public static void encodeXid(final Xid xid, final MessagingBuffer out)
+   {
+      out.putInt(xid.getFormatId());
+      out.putInt(xid.getBranchQualifier().length);
+      out.putBytes(xid.getBranchQualifier());
+      out.putInt(xid.getGlobalTransactionId().length);
+      out.putBytes(xid.getGlobalTransactionId());
+   }
+
+   public static Xid decodeXid(final MessagingBuffer in)
+   {
+      int formatID = in.getInt();
+      byte[] bq = new byte[in.getInt()];
+      in.getBytes(bq);
+      byte[] gtxid = new byte[in.getInt()];
+      in.getBytes(gtxid);      
+      Xid xid = new XidImpl(bq, formatID, gtxid);      
+      return xid;
+   }
+
+   public static int getXidEncodeLength(final Xid xid)
+   {
+      return DataConstants.SIZE_INT * 3 +
+            xid.getBranchQualifier().length +
+            xid.getGlobalTransactionId().length;
+   }
+
+   // Constructors --------------------------------------------------
+
+   // Public --------------------------------------------------------
+
+   // Package protected ---------------------------------------------
+
+   // Protected -----------------------------------------------------
+
+   // Private -------------------------------------------------------
+
+   // Inner classes -------------------------------------------------
+}

Added: trunk/dotnet/JBMClient/remoting/spi/Acceptor.java
===================================================================
--- trunk/dotnet/JBMClient/remoting/spi/Acceptor.java	                        (rev 0)
+++ trunk/dotnet/JBMClient/remoting/spi/Acceptor.java	2009-02-05 01:20:31 UTC (rev 5812)
@@ -0,0 +1,37 @@
+/*
+ * 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.remoting.spi;
+
+import org.jboss.messaging.core.server.MessagingComponent;
+
+/**
+ * An Acceptor is used tby the Remoting Service to allow clients to connect. It should take care of dispatchin client requests
+ * to the Remoting Service's Dispatcher.
+ *
+ * @author <a href="ataylor at redhat.com">Andy Taylor</a>
+ * @author <a href="tim.fox at jboss.com">Tim Fox</a>
+ */
+public interface Acceptor extends MessagingComponent
+{
+   void stop();
+}

Added: trunk/dotnet/JBMClient/remoting/spi/AcceptorFactory.java
===================================================================
--- trunk/dotnet/JBMClient/remoting/spi/AcceptorFactory.java	                        (rev 0)
+++ trunk/dotnet/JBMClient/remoting/spi/AcceptorFactory.java	2009-02-05 01:20:31 UTC (rev 5812)
@@ -0,0 +1,36 @@
+/*
+ * 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.remoting.spi;
+
+import java.util.Map;
+
+/**
+ * @author <a href="ataylor at redhat.com">Andy Taylor</a>
+ * @author <a href="tim.fox at jboss.com">Tim Fox</a>
+ */
+public interface AcceptorFactory
+{
+   Acceptor createAcceptor(final Map<String, Object> configuration,
+                           BufferHandler handler,                        
+                           ConnectionLifeCycleListener listener);
+}

Added: trunk/dotnet/JBMClient/remoting/spi/BufferHandler.cs
===================================================================
--- trunk/dotnet/JBMClient/remoting/spi/BufferHandler.cs	                        (rev 0)
+++ trunk/dotnet/JBMClient/remoting/spi/BufferHandler.cs	2009-02-05 01:20:31 UTC (rev 5812)
@@ -0,0 +1,37 @@
+/*
+  * 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.
+  */
+namespace JBoss.JBM.Client.remoting.spi
+{
+
+    /**
+     * A BufferHandler
+     * 
+     * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
+     *
+     */
+    public interface BufferHandler
+    {
+        void BufferReceived(object connectionID, MessagingBuffer buffer);
+
+        int IsReadyToHandle(MessagingBuffer buffer);
+    }
+}
\ No newline at end of file

Added: trunk/dotnet/JBMClient/remoting/spi/Connection.java
===================================================================
--- trunk/dotnet/JBMClient/remoting/spi/Connection.java	                        (rev 0)
+++ trunk/dotnet/JBMClient/remoting/spi/Connection.java	2009-02-05 01:20:31 UTC (rev 5812)
@@ -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.core.remoting.spi;
+
+
+
+/**
+ *
+ * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
+ *
+ * @version <tt>$Revision$</tt>
+ *
+ */
+public interface Connection
+{
+   MessagingBuffer createBuffer(int size);
+
+   Object getID();
+
+   void write(MessagingBuffer buffer);
+
+   void close();
+
+   String getRemoteAddress();
+}
\ No newline at end of file

Added: trunk/dotnet/JBMClient/remoting/spi/ConnectionLifeCycleListener.java
===================================================================
--- trunk/dotnet/JBMClient/remoting/spi/ConnectionLifeCycleListener.java	                        (rev 0)
+++ trunk/dotnet/JBMClient/remoting/spi/ConnectionLifeCycleListener.java	2009-02-05 01:20:31 UTC (rev 5812)
@@ -0,0 +1,40 @@
+/*
+ * 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.remoting.spi;
+
+import org.jboss.messaging.core.exception.MessagingException;
+
+/**
+ *
+ * A ConnectionLifeCycleListener
+ *
+ * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
+ *
+ */
+public interface ConnectionLifeCycleListener
+{
+   void connectionCreated(Connection connection);
+
+   void connectionDestroyed(Object connectionID);
+
+   void connectionException(Object connectionID, MessagingException me);
+}

Added: trunk/dotnet/JBMClient/remoting/spi/Connector.java
===================================================================
--- trunk/dotnet/JBMClient/remoting/spi/Connector.java	                        (rev 0)
+++ trunk/dotnet/JBMClient/remoting/spi/Connector.java	2009-02-05 01:20:31 UTC (rev 5812)
@@ -0,0 +1,48 @@
+/*
+ * 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.remoting.spi;
+
+/**
+ * 
+ * A Connector
+ * 
+ * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
+ *
+ */
+public interface Connector
+{
+   void start();
+   
+   void close();
+   
+   boolean isStarted();
+   
+   /**
+    * Create and return a connection from this connector.
+    * 
+    * This method must NOT throw an exception if it fails to create the connection
+    * (e.g. network is not available), in this case it MUST return null
+    * 
+    * @return The connection, or null if unable to create a connection (e.g. network is unavailable)
+    */
+   Connection createConnection();   
+}

Added: trunk/dotnet/JBMClient/remoting/spi/ConnectorFactory.java
===================================================================
--- trunk/dotnet/JBMClient/remoting/spi/ConnectorFactory.java	                        (rev 0)
+++ trunk/dotnet/JBMClient/remoting/spi/ConnectorFactory.java	2009-02-05 01:20:31 UTC (rev 5812)
@@ -0,0 +1,16 @@
+package org.jboss.messaging.core.remoting.spi;
+
+import java.util.Map;
+
+/**
+ * 
+ * A ConnectorFactory
+ * 
+ * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
+ *
+ */
+public interface ConnectorFactory
+{
+   Connector createConnector(Map<String, Object> configuration, BufferHandler handler,                           
+                             ConnectionLifeCycleListener listener);
+}

Added: trunk/dotnet/JBMClient/remoting/spi/MessagingBuffer.cs
===================================================================
--- trunk/dotnet/JBMClient/remoting/spi/MessagingBuffer.cs	                        (rev 0)
+++ trunk/dotnet/JBMClient/remoting/spi/MessagingBuffer.cs	2009-02-05 01:20:31 UTC (rev 5812)
@@ -0,0 +1,126 @@
+/*
+ * 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.
+ */
+
+namespace JBoss.JBM.Client.remoting.spi
+{
+    using JBoss.JBM.Client.util;
+
+    /**
+     *
+     * A MessagingBuffer
+     *
+     * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
+     *
+     */
+    public interface MessagingBuffer
+    {
+        void PutByte(byte val);
+
+        void PutBytes(byte[] bytes);
+
+        void PutBytes(byte[] bytes, int offset, int length);
+
+        void PutInt(int val);
+
+        void PutInt(int pos, int val);
+
+        void PutLong(long val);
+
+        void PutShort(short val);
+
+        void PutDouble(double val);
+
+        void PutFloat(float val);
+
+        void PutBoolean(bool val);
+
+        void PutChar(char val);
+
+        void PutNullableString(string val);
+
+        void PutString(string val);
+
+        void PutSimpleString(SimpleString val);
+
+        void PutNullableSimpleString(SimpleString val);
+
+        void PutUTF(string utf);
+
+        byte GetByte();
+
+        short GetUnsignedByte();
+
+        void GetBytes(byte[] bytes);
+
+        void GetBytes(byte[] bytes, int offset, int length);
+
+        int GetInt();
+
+        long GetLong();
+
+        short GetShort();
+
+        int GetUnsignedShort();
+
+        double GetDouble();
+
+        float GetFloat();
+
+        bool GetBoolean();
+
+        char GetChar();
+
+        string GetString();
+
+        string GetNullableString();
+
+        SimpleString GetSimpleString();
+
+        SimpleString getNullableSimpleString();
+
+        string GetUTF();
+
+        byte[] ToArray();
+
+        int Remaining();
+
+        int Capacity();
+
+        int Limit();
+
+        void limit(int limit);
+
+        void Flip();
+
+        void Position(int position);
+
+        int Position();
+
+        void Rewind();
+
+        MessagingBuffer Slice();
+
+        MessagingBuffer CreateNewBuffer(int len);
+
+        object GetUnderlyingBuffer();
+    }
+}
\ No newline at end of file

Modified: trunk/dotnet/JBMClient/util/DataConstants.cs
===================================================================
--- trunk/dotnet/JBMClient/util/DataConstants.cs	2009-02-04 22:16:37 UTC (rev 5811)
+++ trunk/dotnet/JBMClient/util/DataConstants.cs	2009-02-05 01:20:31 UTC (rev 5812)
@@ -3,7 +3,7 @@
 using System.Linq;
 using System.Text;
 
-namespace JSMClient.util
+namespace JBoss.JBM.Client.util
 {
     public class DataConstants
     {

Modified: trunk/dotnet/JBMClient/util/SimpleString.cs
===================================================================
--- trunk/dotnet/JBMClient/util/SimpleString.cs	2009-02-04 22:16:37 UTC (rev 5811)
+++ trunk/dotnet/JBMClient/util/SimpleString.cs	2009-02-05 01:20:31 UTC (rev 5812)
@@ -1,158 +1,158 @@
-/*
- * 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.
- */
-
-
-using System;
-using System.Collections;
-using System.Collections.Generic;
-using System.Linq;
+/*
+ * 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.
+ */
+
+
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using System.Linq;
 using System.Text;
 
-namespace JSMClient.util
-{
-    /**
-     * 
-     * A SimpleString
-     * 
-     * A simple String class that can store all characters, and stores as simple byte[],
-     * this minimises expensive copying between String objects
-     * 
-     * @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 SimpleString : IComparable
-    {
-        // Attributes
-        // ------------------------------------------------------------------------
-        private byte[] data;
-
-        private int hash;
-
-        // Cache the string
-        private string str;
-
-        // Static
-        // ----------------------------------------------------------------------
-
-        /**
-         * Returns a SimpleString constructed from the <code>string</code> parameter.
-         * If <code>string</code> is <code>null</code>, the return value will be <code>null</code> too.
-         */
-        public static SimpleString ToSimpleString(string value)
-        {
-            if (value == null)
-            {
-                return null;
-            }
-            return new SimpleString(value);
-        }
-
-        // Constructors
-        // ----------------------------------------------------------------------
-
-        public SimpleString(string value)
-        {
-
-            int j = 0;
-
-            char[] characters = value.ToCharArray();
-
-            int len = characters.Length;
-
-            data = new byte[len << 1];
-
-            for (int i = 0; i < len; i++)
-            {
-                char c = characters[i];
-
-                byte low = (byte)(c & 0xFF); // low byte
-
-                data[j++] = low;
-
-                byte high = (byte)(c >> 8 & 0xFF); // high byte
-
-                data[j++] = high;
-            }
-
-            str = value;
-        }
-
-        public SimpleString(byte[] data)
-        {
-            this.data = data;
-        }
-
-        // CharSequence implementation
-        // ---------------------------------------------------------------------------
-
-        public int Length
-        {
-            get
-            {
-                return data.Length >> 1;
-            }
-        }
-
-        public char CharAt(int pos)
-        {
-            if (pos < 0 || pos >= data.Length >> 1)
-            {
-                throw new IndexOutOfRangeException();
-            }
-            pos <<= 1;
-
-            return (char)(data[pos] | data[pos + 1] << 8);
-        }
-
-        public SimpleString SubSequence(int start, int end)
-        {
-            int len = data.Length >> 1;
-
-            if (end < start || start < 0 || end > len)
-            {
-                throw new IndexOutOfRangeException();
-            }
-            else
-            {
-                int newlen = (end - start) << 1;
-                byte[] bytes = new byte[newlen];
-
-                Array.Copy(data, start << 1, bytes, 0, newlen);
-
-                return new SimpleString(bytes);
-            }
-        }
-
-        // Comparable implementation -------------------------------------
-
-        public int CompareTo(Object o)
-        {
-            return this.ToString().CompareTo(o.ToString());
-        }
-
-        // Public
-        // ---------------------------------------------------------------------------
+namespace JBoss.JBM.Client.util
+{
+    /**
+     * 
+     * A SimpleString
+     * 
+     * A simple String class that can store all characters, and stores as simple byte[],
+     * this minimises expensive copying between String objects
+     * 
+     * @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 SimpleString : IComparable
+    {
+        // Attributes
+        // ------------------------------------------------------------------------
+        private byte[] data;
 
+        private int hash;
+
+        // Cache the string
+        private string str;
+
+        // Static
+        // ----------------------------------------------------------------------
+
+        /**
+         * Returns a SimpleString constructed from the <code>string</code> parameter.
+         * If <code>string</code> is <code>null</code>, the return value will be <code>null</code> too.
+         */
+        public static SimpleString ToSimpleString(string value)
+        {
+            if (value == null)
+            {
+                return null;
+            }
+            return new SimpleString(value);
+        }
+
+        // Constructors
+        // ----------------------------------------------------------------------
+
+        public SimpleString(string value)
+        {
+
+            int j = 0;
+
+            char[] characters = value.ToCharArray();
+
+            int len = characters.Length;
+
+            data = new byte[len << 1];
+
+            for (int i = 0; i < len; i++)
+            {
+                char c = characters[i];
+
+                byte low = (byte)(c & 0xFF); // low byte
+
+                data[j++] = low;
+
+                byte high = (byte)(c >> 8 & 0xFF); // high byte
+
+                data[j++] = high;
+            }
+
+            str = value;
+        }
+
+        public SimpleString(byte[] data)
+        {
+            this.data = data;
+        }
+
+        // CharSequence implementation
+        // ---------------------------------------------------------------------------
+
+        public int Length
+        {
+            get
+            {
+                return data.Length >> 1;
+            }
+        }
+
+        public char CharAt(int pos)
+        {
+            if (pos < 0 || pos >= data.Length >> 1)
+            {
+                throw new IndexOutOfRangeException();
+            }
+            pos <<= 1;
+
+            return (char)(data[pos] | data[pos + 1] << 8);
+        }
+
+        public SimpleString SubSequence(int start, int end)
+        {
+            int len = data.Length >> 1;
+
+            if (end < start || start < 0 || end > len)
+            {
+                throw new IndexOutOfRangeException();
+            }
+            else
+            {
+                int newlen = (end - start) << 1;
+                byte[] bytes = new byte[newlen];
+
+                Array.Copy(data, start << 1, bytes, 0, newlen);
+
+                return new SimpleString(bytes);
+            }
+        }
+
+        // Comparable implementation -------------------------------------
+
+        public int CompareTo(Object o)
+        {
+            return this.ToString().CompareTo(o.ToString());
+        }
+
+        // Public
+        // ---------------------------------------------------------------------------
+
 		public byte[] Data
 		{
 			get
@@ -163,199 +163,199 @@
 			{
 				this.data = value;
 			}
-		}
-
-        public bool StartsWith(SimpleString other)
-        {
-            byte[] otherdata = other.data;
-
-            if (otherdata.Length > this.data.Length)
-            {
-                return false;
-            }
-
-            for (int i = 0; i < otherdata.Length; i++)
-            {
-                if (this.data[i] != otherdata[i])
-                {
-                    return false;
-                }
-            }
-
-            return true;
-        }
-
-
-        public override string ToString()
-        {
-            if (str == null)
-            {
-                int len = data.Length >> 1;
-
-                char[] chars = new char[len];
-
-                int j = 0;
-
-                for (int i = 0; i < len; i++)
-                {
-                    int low = data[j++] & 0xFF;
-
-                    int high = (data[j++] << 8) & 0xFF00;
-
-                    chars[i] = (char)(low | high);
-                }
-
-                str = new String(chars);
-            }
-
-            return str;
-        }
-
-        public override bool Equals(Object other)
-        {
-            if (other is SimpleString)
-            {
-                SimpleString s = (SimpleString)other;
-
-                if (data.Length != s.data.Length)
-                {
-                    return false;
-                }
-
-                for (int i = 0; i < data.Length; i++)
-                {
-                    if (data[i] != s.data[i])
-                    {
-                        return false;
-                    }
-                }
-
-                return true;
-            }
-            else
-            {
-                return false;
-            }
-        }
-
-        public override int GetHashCode()
-        {
-            if (hash == 0)
-            {
-                for (int i = 0; i < data.Length; i++)
-                {
-                    hash = (31 * hash + data[i]) % (int.MaxValue>>5);
-                }
-            }
-
-            return hash;
-        }
-
-        public SimpleString[] Split(char delim)
-        {
-            if (!Contains(delim))
-            {
-                return new SimpleString[] { this };
-            }
-            else
-            {
-                IList<SimpleString> all = new List<SimpleString>();
-                int lasPos = 0;
-                for (int i = 0; i < data.Length; i += 2)
-                {
-                    byte low = (byte)(delim & 0xFF); // low byte
-                    byte high = (byte)(delim >> 8 & 0xFF); // high byte
-                    if (data[i] == low && data[i + 1] == high)
-                    {
-                        byte[] bytes = new byte[i - lasPos];
-                        Array.Copy(data, lasPos, bytes, 0, bytes.Length);
-                        lasPos = i + 2;
-                        all.Add(new SimpleString(bytes));
-                    }
-                }
-                byte[] bytes2 = new byte[data.Length - lasPos];
-                Array.Copy(data, lasPos, bytes2, 0, bytes2.Length);
-                all.Add(new SimpleString(bytes2));
-                return all.ToArray();
-            }
-        }
-
-        public bool Contains(char c)
-        {
-            for (int i = 0; i < data.Length; i += 2)
-            {
-                byte low = (byte)(c & 0xFF); // low byte
-                byte high = (byte)(c >> 8 & 0xFF); // high byte
-                if (data[i] == low && data[i + 1] == high)
-                {
-                    return true;
-                }
-            }
-            return false;
-        }
-
-        public SimpleString Concat(SimpleString toAdd)
-        {
-
-            byte[] bytes = new byte[data.Length + toAdd.Data.Length];
-            Array.Copy(data, 0, bytes, 0, data.Length);
-            Array.Copy(toAdd.Data, 0, bytes, data.Length, toAdd.Data.Length);
-            return new SimpleString(bytes);
-        }
-
-        public SimpleString Concat(char c)
-        {
-            byte[] bytes = new byte[data.Length + 2];
-            Array.Copy(data, 0, bytes, 0, data.Length);
-            bytes[data.Length] = (byte)(c & 0xFF);
-            bytes[data.Length + 1] = (byte)(c >> 8 & 0xFF);
-            return new SimpleString(bytes);
-        }
-
-        public static int SizeofString(SimpleString str)
-        {
-
-            return DataConstants.SIZE_INT + str.data.Length;
-        }
-
-        public static int SizeofNullableString(SimpleString str)
-        {
-            if (str == null)
-            {
-                return 1;
-            }
-            else
-            {
-                return 1 + SizeofString(str);
-            }
-        }
-
-        public void GetChars(int srcBegin, int srcEnd, char[] dst, int dstBegin)
-        {
-            if (srcBegin < 0)
-            {
-                throw new IndexOutOfRangeException("Invalid initialIndex: " + srcBegin);
-            }
-            if (srcEnd > this.Length)
-            {
-                throw new IndexOutOfRangeException("Invalid endIndex: " + srcEnd);
-            }
-            if (srcBegin > srcEnd)
-            {
-                throw new IndexOutOfRangeException("Invalid Length: " + (srcEnd - srcBegin));
-            }
-
-            int j = 0;
-
-            for (int i = srcBegin; i < srcEnd - srcBegin; i++)
-            {
-                int low = data[j++] & 0xFF;
-
-                int high = (data[j++] << 8) & 0xFF00;
-
-                dst[i] = (char)(low | high);
-            }
-        }
-
-    }
-}
+		}
+
+        public bool StartsWith(SimpleString other)
+        {
+            byte[] otherdata = other.data;
+
+            if (otherdata.Length > this.data.Length)
+            {
+                return false;
+            }
+
+            for (int i = 0; i < otherdata.Length; i++)
+            {
+                if (this.data[i] != otherdata[i])
+                {
+                    return false;
+                }
+            }
+
+            return true;
+        }
+
+
+        public override string ToString()
+        {
+            if (str == null)
+            {
+                int len = data.Length >> 1;
+
+                char[] chars = new char[len];
+
+                int j = 0;
+
+                for (int i = 0; i < len; i++)
+                {
+                    int low = data[j++] & 0xFF;
+
+                    int high = (data[j++] << 8) & 0xFF00;
+
+                    chars[i] = (char)(low | high);
+                }
+
+                str = new String(chars);
+            }
+
+            return str;
+        }
+
+        public override bool Equals(Object other)
+        {
+            if (other is SimpleString)
+            {
+                SimpleString s = (SimpleString)other;
+
+                if (data.Length != s.data.Length)
+                {
+                    return false;
+                }
+
+                for (int i = 0; i < data.Length; i++)
+                {
+                    if (data[i] != s.data[i])
+                    {
+                        return false;
+                    }
+                }
+
+                return true;
+            }
+            else
+            {
+                return false;
+            }
+        }
+
+        public override int GetHashCode()
+        {
+            if (hash == 0)
+            {
+                for (int i = 0; i < data.Length; i++)
+                {
+                    hash = (31 * hash + data[i]) % (int.MaxValue>>5);
+                }
+            }
+
+            return hash;
+        }
+
+        public SimpleString[] Split(char delim)
+        {
+            if (!Contains(delim))
+            {
+                return new SimpleString[] { this };
+            }
+            else
+            {
+                IList<SimpleString> all = new List<SimpleString>();
+                int lasPos = 0;
+                for (int i = 0; i < data.Length; i += 2)
+                {
+                    byte low = (byte)(delim & 0xFF); // low byte
+                    byte high = (byte)(delim >> 8 & 0xFF); // high byte
+                    if (data[i] == low && data[i + 1] == high)
+                    {
+                        byte[] bytes = new byte[i - lasPos];
+                        Array.Copy(data, lasPos, bytes, 0, bytes.Length);
+                        lasPos = i + 2;
+                        all.Add(new SimpleString(bytes));
+                    }
+                }
+                byte[] bytes2 = new byte[data.Length - lasPos];
+                Array.Copy(data, lasPos, bytes2, 0, bytes2.Length);
+                all.Add(new SimpleString(bytes2));
+                return all.ToArray();
+            }
+        }
+
+        public bool Contains(char c)
+        {
+            for (int i = 0; i < data.Length; i += 2)
+            {
+                byte low = (byte)(c & 0xFF); // low byte
+                byte high = (byte)(c >> 8 & 0xFF); // high byte
+                if (data[i] == low && data[i + 1] == high)
+                {
+                    return true;
+                }
+            }
+            return false;
+        }
+
+        public SimpleString Concat(SimpleString toAdd)
+        {
+
+            byte[] bytes = new byte[data.Length + toAdd.Data.Length];
+            Array.Copy(data, 0, bytes, 0, data.Length);
+            Array.Copy(toAdd.Data, 0, bytes, data.Length, toAdd.Data.Length);
+            return new SimpleString(bytes);
+        }
+
+        public SimpleString Concat(char c)
+        {
+            byte[] bytes = new byte[data.Length + 2];
+            Array.Copy(data, 0, bytes, 0, data.Length);
+            bytes[data.Length] = (byte)(c & 0xFF);
+            bytes[data.Length + 1] = (byte)(c >> 8 & 0xFF);
+            return new SimpleString(bytes);
+        }
+
+        public static int SizeofString(SimpleString str)
+        {
+
+            return DataConstants.SIZE_INT + str.data.Length;
+        }
+
+        public static int SizeofNullableString(SimpleString str)
+        {
+            if (str == null)
+            {
+                return 1;
+            }
+            else
+            {
+                return 1 + SizeofString(str);
+            }
+        }
+
+        public void GetChars(int srcBegin, int srcEnd, char[] dst, int dstBegin)
+        {
+            if (srcBegin < 0)
+            {
+                throw new IndexOutOfRangeException("Invalid initialIndex: " + srcBegin);
+            }
+            if (srcEnd > this.Length)
+            {
+                throw new IndexOutOfRangeException("Invalid endIndex: " + srcEnd);
+            }
+            if (srcBegin > srcEnd)
+            {
+                throw new IndexOutOfRangeException("Invalid Length: " + (srcEnd - srcBegin));
+            }
+
+            int j = 0;
+
+            for (int i = srcBegin; i < srcEnd - srcBegin; i++)
+            {
+                int low = data[j++] & 0xFF;
+
+                int high = (data[j++] << 8) & 0xFF00;
+
+                dst[i] = (char)(low | high);
+            }
+        }
+
+    }
+}

Modified: trunk/dotnet/JBMClientSolution.sln
===================================================================
--- trunk/dotnet/JBMClientSolution.sln	2009-02-04 22:16:37 UTC (rev 5811)
+++ trunk/dotnet/JBMClientSolution.sln	2009-02-05 01:20:31 UTC (rev 5812)
@@ -4,13 +4,13 @@
 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{18364D7F-A814-4360-9BF1-FBD18737B399}"
 	ProjectSection(SolutionItems) = preProject
 		JBMClientSolution.vsmdi = JBMClientSolution.vsmdi
-		JSMClient.vsmdi = JSMClient.vsmdi
+		JBMClient.vsmdi = JBMClient.vsmdi
 		LocalTestRun.testrunconfig = LocalTestRun.testrunconfig
 	EndProjectSection
 EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "JBMClient", "JBMClient\JBMClient.csproj", "{675AD929-BF42-4930-AC39-603D5EC52D58}"
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "JBM.Client", "JBMClient\JBM.Client.csproj", "{675AD929-BF42-4930-AC39-603D5EC52D58}"
 EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "JBMClientTest", "JBMClientTest\JBMClientTest.csproj", "{D6A96159-0551-41C2-9E94-1F253F79AD39}"
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "JBM.Client.Test", "JBMClientTest\JBM.Client.Test.csproj", "{D6A96159-0551-41C2-9E94-1F253F79AD39}"
 EndProject
 Global
 	GlobalSection(SubversionScc) = preSolution

Copied: trunk/dotnet/JBMClientTest/JBM.Client.Test.csproj (from rev 5807, trunk/dotnet/JBMClientTest/JBMClientTest.csproj)
===================================================================
--- trunk/dotnet/JBMClientTest/JBM.Client.Test.csproj	                        (rev 0)
+++ trunk/dotnet/JBMClientTest/JBM.Client.Test.csproj	2009-02-05 01:20:31 UTC (rev 5812)
@@ -0,0 +1,77 @@
+<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <PropertyGroup>
+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+    <ProductVersion>9.0.21022</ProductVersion>
+    <SchemaVersion>2.0</SchemaVersion>
+    <ProjectGuid>{D6A96159-0551-41C2-9E94-1F253F79AD39}</ProjectGuid>
+    <OutputType>Library</OutputType>
+    <AppDesignerFolder>Properties</AppDesignerFolder>
+    <RootNamespace>JBM.Client.Test</RootNamespace>
+    <AssemblyName>JBM.Client.Test</AssemblyName>
+    <TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
+    <FileAlignment>512</FileAlignment>
+    <ProjectTypeGuids>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+    <StartupObject>
+    </StartupObject>
+    <ApplicationIcon>
+    </ApplicationIcon>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+    <DebugSymbols>true</DebugSymbols>
+    <DebugType>full</DebugType>
+    <Optimize>false</Optimize>
+    <OutputPath>bin\Debug\</OutputPath>
+    <DefineConstants>DEBUG;TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+    <OutputType>Library</OutputType>
+    <AssemblyName>JBMClientTest</AssemblyName>
+    <RootNamespace>JBMClientTest</RootNamespace>
+    <AllowUnsafeBlocks>false</AllowUnsafeBlocks>
+    <CheckForOverflowUnderflow>true</CheckForOverflowUnderflow>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+    <DebugType>pdbonly</DebugType>
+    <Optimize>true</Optimize>
+    <OutputPath>bin\Release\</OutputPath>
+    <DefineConstants>TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+    <OutputType>Library</OutputType>
+    <AssemblyName>JBMClientTest</AssemblyName>
+    <DebugSymbols>true</DebugSymbols>
+    <RootNamespace>JBMClientTest</RootNamespace>
+    <AllowUnsafeBlocks>false</AllowUnsafeBlocks>
+    <CheckForOverflowUnderflow>true</CheckForOverflowUnderflow>
+  </PropertyGroup>
+  <ItemGroup>
+    <Reference Include="nunit.framework, Version=2.4.8.0, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77" />
+    <Reference Include="System" />
+    <Reference Include="System.Core">
+      <RequiredTargetFramework>3.5</RequiredTargetFramework>
+    </Reference>
+  </ItemGroup>
+  <ItemGroup>
+    <Compile Include="Properties\AssemblyInfo.cs" />
+    <Compile Include="util\JBMTest.cs" />
+    <Compile Include="util\SimpleStringTest.cs" />
+  </ItemGroup>
+  <ItemGroup>
+    <Content Include="AuthoringTests.txt" />
+  </ItemGroup>
+  <ItemGroup>
+    <ProjectReference Include="..\JBMClient\JBM.Client.csproj">
+      <Project>{675AD929-BF42-4930-AC39-603D5EC52D58}</Project>
+      <Name>JBM.Client</Name>
+    </ProjectReference>
+  </ItemGroup>
+  <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
+  <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
+       Other similar extension points exist, see Microsoft.Common.targets.
+  <Target Name="BeforeBuild">
+  </Target>
+  <Target Name="AfterBuild">
+  </Target>
+  -->
+</Project>
\ No newline at end of file


Property changes on: trunk/dotnet/JBMClientTest/JBM.Client.Test.csproj
___________________________________________________________________
Name: svn:mergeinfo
   + 

Deleted: trunk/dotnet/JBMClientTest/JBMClientTest.csproj
===================================================================
--- trunk/dotnet/JBMClientTest/JBMClientTest.csproj	2009-02-04 22:16:37 UTC (rev 5811)
+++ trunk/dotnet/JBMClientTest/JBMClientTest.csproj	2009-02-05 01:20:31 UTC (rev 5812)
@@ -1,77 +0,0 @@
-<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
-  <PropertyGroup>
-    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
-    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
-    <ProductVersion>9.0.21022</ProductVersion>
-    <SchemaVersion>2.0</SchemaVersion>
-    <ProjectGuid>{D6A96159-0551-41C2-9E94-1F253F79AD39}</ProjectGuid>
-    <OutputType>Library</OutputType>
-    <AppDesignerFolder>Properties</AppDesignerFolder>
-    <RootNamespace>JMSClientTest</RootNamespace>
-    <AssemblyName>JMSClientTest</AssemblyName>
-    <TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
-    <FileAlignment>512</FileAlignment>
-    <ProjectTypeGuids>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
-    <StartupObject>
-    </StartupObject>
-    <ApplicationIcon>
-    </ApplicationIcon>
-  </PropertyGroup>
-  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
-    <DebugSymbols>true</DebugSymbols>
-    <DebugType>full</DebugType>
-    <Optimize>false</Optimize>
-    <OutputPath>bin\Debug\</OutputPath>
-    <DefineConstants>DEBUG;TRACE</DefineConstants>
-    <ErrorReport>prompt</ErrorReport>
-    <WarningLevel>4</WarningLevel>
-    <OutputType>Library</OutputType>
-    <AssemblyName>JMSClientTest</AssemblyName>
-    <RootNamespace>JMSClientTest</RootNamespace>
-    <AllowUnsafeBlocks>false</AllowUnsafeBlocks>
-    <CheckForOverflowUnderflow>true</CheckForOverflowUnderflow>
-  </PropertyGroup>
-  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
-    <DebugType>pdbonly</DebugType>
-    <Optimize>true</Optimize>
-    <OutputPath>bin\Release\</OutputPath>
-    <DefineConstants>TRACE</DefineConstants>
-    <ErrorReport>prompt</ErrorReport>
-    <WarningLevel>4</WarningLevel>
-    <OutputType>Library</OutputType>
-    <AssemblyName>JMSClientTest</AssemblyName>
-    <DebugSymbols>true</DebugSymbols>
-    <RootNamespace>JMSClientTest</RootNamespace>
-    <AllowUnsafeBlocks>false</AllowUnsafeBlocks>
-    <CheckForOverflowUnderflow>true</CheckForOverflowUnderflow>
-  </PropertyGroup>
-  <ItemGroup>
-    <Reference Include="System" />
-    <Reference Include="System.Core">
-      <RequiredTargetFramework>3.5</RequiredTargetFramework>
-    </Reference>
-    <Reference Include="nunit.framework, Version=2.4.7.0, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77" />
-  </ItemGroup>
-  <ItemGroup>
-    <Compile Include="Properties\AssemblyInfo.cs" />
-    <Compile Include="util\JBMTest.cs" />
-    <Compile Include="util\SimpleStringTest.cs" />
-  </ItemGroup>
-  <ItemGroup>
-    <Content Include="AuthoringTests.txt" />
-  </ItemGroup>
-  <ItemGroup>
-    <ProjectReference Include="..\JBMClient\JBMClient.csproj">
-      <Project>{675AD929-BF42-4930-AC39-603D5EC52D58}</Project>
-      <Name>JBMClient</Name>
-    </ProjectReference>
-  </ItemGroup>
-  <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
-  <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
-       Other similar extension points exist, see Microsoft.Common.targets.
-  <Target Name="BeforeBuild">
-  </Target>
-  <Target Name="AfterBuild">
-  </Target>
-  -->
-</Project>
\ No newline at end of file

Modified: trunk/dotnet/JBMClientTest/util/JBMTest.cs
===================================================================
--- trunk/dotnet/JBMClientTest/util/JBMTest.cs	2009-02-04 22:16:37 UTC (rev 5811)
+++ trunk/dotnet/JBMClientTest/util/JBMTest.cs	2009-02-05 01:20:31 UTC (rev 5812)
@@ -4,7 +4,7 @@
 using System.Text;
 using NUnit.Framework;
 
-namespace JMSClientTest.util
+namespace JBoss.JBM.Test.util
 {
     public class JBMTest
     {

Modified: trunk/dotnet/JBMClientTest/util/SimpleStringTest.cs
===================================================================
--- trunk/dotnet/JBMClientTest/util/SimpleStringTest.cs	2009-02-04 22:16:37 UTC (rev 5811)
+++ trunk/dotnet/JBMClientTest/util/SimpleStringTest.cs	2009-02-05 01:20:31 UTC (rev 5812)
@@ -3,9 +3,9 @@
 using System.Collections.Generic;
 using System.Linq;
 using NUnit.Framework;
-using JSMClient.util;
+using JBoss.JBM.Client.util;
 
-namespace JMSClientTest.util
+namespace JBoss.JBM.Test.util
 {
     /// <summary>
     /// Summary description for SimpleStringTest




More information about the jboss-cvs-commits mailing list