activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jgo...@apache.org
Subject svn commit: r709503 [2/4] - in /activemq/activemq-dotnet/Apache.NMS.WCF: ./ branches/ tags/ trunk/ trunk/lib/ trunk/lib/net-3.5/ trunk/src/ trunk/src/main/ trunk/src/main/csharp/ trunk/src/main/csharp/Configuration/ trunk/src/main/ndoc/ trunk/src/test/...
Date Fri, 31 Oct 2008 17:43:12 GMT
Added: activemq/activemq-dotnet/Apache.NMS.WCF/trunk/nant.build
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.WCF/trunk/nant.build?rev=709503&view=auto
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.WCF/trunk/nant.build (added)
+++ activemq/activemq-dotnet/Apache.NMS.WCF/trunk/nant.build Fri Oct 31 10:43:10 2008
@@ -0,0 +1,120 @@
+<?xml version="1.0" ?>
+<!--
+	Licensed to the Apache Software Foundation (ASF) under one or more
+	contributor license agreements.  See the NOTICE file distributed with
+	this work for additional information regarding copyright ownership.
+	The ASF licenses this file to You under the Apache License, Version 2.0
+	(the "License"); you may not use this file except in compliance with
+	the License.  You may obtain a copy of the License at
+
+	http://www.apache.org/licenses/LICENSE-2.0
+
+	Unless required by applicable law or agreed to in writing, software
+	distributed under the License is distributed on an "AS IS" BASIS,
+	WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+	See the License for the specific language governing permissions and
+	limitations under the License.
+-->
+<project name="Apache.NMS.ActiveMQ.WCF" default="compile-all" xmlns="http://nant.sourceforge.net/release/0.85/nant.xsd">
+
+	<!-- ============================================================================================ -->
+	<!--      I N I T I A L I Z A T I O N                                                             -->
+	<!-- ============================================================================================ -->
+	<property name="basedir" value="${project::get-base-directory()}"/>
+	<property name="project.name" value="Apache.NMS.ActiveMQ.WCF"/>
+	<property name="project.group" value="org.apache.activemq"/>
+	<property name="project.version"  value="1.1.0" unless="${property::exists('project.version')}"/>
+	<property name="project.short_description" value="WCF Provider for ActiveMQ Class Library"/>
+	<property name="project.description" value="WCF Provider for ActiveMQ Class Library (.Net Messaging Library Implementation): An implementation of Windows Communications Framework API for ActiveMQ"/>
+
+	<!-- Repository organized as: organization/module/version/plaform/artifact, platform might be something like 'all' or 'net-2.0/release' -->
+	<property name="nunit.dll" value="${basedir}/lib/${current.build.framework}/nunit.framework.dll" dynamic="true"/>
+	<property name="nunit.extensions.dll" value="${basedir}/lib/${current.build.framework}/nunit.framework.extensions.dll" dynamic="true"/>
+	<property name="Apache.NMS.dll" value="${basedir}/vendor/Apache.NMS/${current.build.framework}/Apache.NMS.dll" dynamic="true"/>
+	<property name="Apache.NMS.pdb" value="${basedir}/vendor/Apache.NMS/${current.build.framework}/Apache.NMS.pdb" dynamic="true"/>
+	<property name="Apache.NMS.Test.dll" value="${basedir}/vendor/Apache.NMS/${current.build.framework}//Apache.NMS.Test.dll" dynamic="true"/>
+	<property name="Apache.NMS.Test.pdb" value="${basedir}/vendor/Apache.NMS/${current.build.framework}/Apache.NMS.Test.pdb" dynamic="true"/>
+	<property name="Apache.NMS.ActiveMQ.dll" value="${basedir}/vendor/Apache.NMS.ActiveMQ/${current.build.framework}/Apache.NMS.ActiveMQ.dll" dynamic="true"/>
+	<property name="Apache.NMS.ActiveMQ.pdb" value="${basedir}/vendor/Apache.NMS.ActiveMQ/${current.build.framework}/Apache.NMS.ActiveMQ.pdb" dynamic="true"/>
+	<property name="Apache.NMS.ActiveMQ.Test.dll" value="${basedir}/vendor/Apache.NMS.ActiveMQ/${current.build.framework}/Apache.NMS.ActiveMQ.Test.dll" dynamic="true"/>
+	<property name="Apache.NMS.ActiveMQ.Test.pdb" value="${basedir}/vendor/Apache.NMS.ActiveMQ/${current.build.framework}/Apache.NMS.ActiveMQ.Test.pdb" dynamic="true"/>
+
+	<target name="dependency-init" description="Initializes build dependencies">
+		<if test="${not file::exists(Apache.NMS.dll)}">
+			<echo message="Apache.NMS assembly for ${current.build.framework.name} is not available. Build skipped." />
+			<property name="build.skip" value="true"/>
+		</if>
+		<if test="${not file::exists(Apache.NMS.ActiveMQ.dll)}">
+			<echo message="Apache.NMS.ActiveMQ assembly for ${current.build.framework.name} is not available. Build skipped." />
+			<property name="build.skip" value="true"/>
+		</if>
+
+		<property name="net-3.0-referencepath" value="${environment::get-folder-path('ProgramFiles')}\Reference Assemblies\Microsoft\Framework\v3.0\" />
+		<property name="net-3.0-installed" value="${directory::exists(net-3.0-referencepath)}" />
+
+		<assemblyfileset failonempty="true" id="dependencies">
+			<include name="mscorlib.dll" asis="true"/>
+			<include name="System.dll" asis="true"/>
+			<include name="System.configuration.dll" asis="true"/>
+			<include if="${net-3.0-installed}" name="${net-3.0-referencepath}\System.Runtime.Serialization.dll" />
+			<include if="${net-3.0-installed}" name="${net-3.0-referencepath}\System.ServiceModel.dll" />
+			<include name="System.Web.Services.dll" asis="true"/>
+			<include name="System.Xml.dll" asis="true"/>
+			<include name="${Apache.NMS.dll}" asis="true"/>
+			<include name="${Apache.NMS.ActiveMQ.dll}" asis="true"/>
+		</assemblyfileset>
+
+		<assemblyfileset failonempty="true" id="test.dependencies">
+			<include name="mscorlib.dll" asis="true"/>
+			<include name="System.dll" asis="true"/>
+			<include name="System.configuration.dll" asis="true"/>
+			<include if="${net-3.0-installed}" name="${net-3.0-referencepath}\System.Runtime.Serialization.dll" />
+			<include if="${net-3.0-installed}" name="${net-3.0-referencepath}\System.ServiceModel.dll" />
+			<include name="System.Web.Services.dll" asis="true"/>
+			<include name="System.Xml.dll" asis="true"/>
+			<include name="${Apache.NMS.dll}"/>
+			<include name="${Apache.NMS.Test.dll}"/>
+			<include name="${Apache.NMS.ActiveMQ.dll}"/>
+			<include name="${build.bin.dir}/${project.name}.dll"/>
+			<include name="${nunit.dll}"/>
+			<include name="${nunit.extensions.dll}"/>
+		</assemblyfileset>
+
+		<fileset id="content.filenames">
+			<include name="LICENSE.txt"/>
+			<include name="NOTICE.txt"/>
+			<include name="nmsprovider-*.config"/>
+			<include name="${Apache.NMS.dll}"/>
+			<include name="${Apache.NMS.pdb}"/>
+			<include name="${Apache.NMS.Test.dll}"/>
+			<include name="${Apache.NMS.Test.pdb}"/>
+			<include name="${Apache.NMS.ActiveMQ.dll}"/>
+			<include name="${Apache.NMS.ActiveMQ.pdb}"/>
+			<include name="${Apache.NMS.ActiveMQ.Test.dll}"/>
+			<include name="${Apache.NMS.ActiveMQ.Test.pdb}"/>
+			<include name="${nunit.dll}"/>
+			<include name="${nunit.extensions.dll}"/>
+		</fileset>
+
+		<fileset id="install.filenames">
+			<include name="${project.name}.dll"/>
+			<include name="nmsprovider-*.config"/>
+		</fileset>
+
+		<fileset id="deploy.filenames">
+			<include name="LICENSE.txt"/>
+			<include name="NOTICE.txt"/>
+			<include name="${build.bin.dir}/${project.name}.dll"/>
+			<include name="${build.bin.dir}/${project.name}.?db"/>
+			<include name="${build.bin.dir}/${project.name}.xml"/>
+			<include name="${build.bin.dir}/${project.name}.Test.dll"/>
+			<include name="${build.bin.dir}/${project.name}.Test.?db"/>
+			<include name="${build.bin.dir}/${project.name}.Test.xml"/>
+			<include name="${build.bin.dir}/nmsprovider-*.config"/>
+		</fileset>
+	</target>
+
+	<!-- Load the common target definitions  -->
+	<include buildfile="${basedir}/nant-common.xml"/>
+
+</project>
\ No newline at end of file

Added: activemq/activemq-dotnet/Apache.NMS.WCF/trunk/nmsprovider-test.config
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.WCF/trunk/nmsprovider-test.config?rev=709503&view=auto
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.WCF/trunk/nmsprovider-test.config (added)
+++ activemq/activemq-dotnet/Apache.NMS.WCF/trunk/nmsprovider-test.config Fri Oct 31 10:43:10 2008
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<!--
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements.  See the NOTICE file distributed with
+* this work for additional information regarding copyright ownership.
+* The ASF licenses this file to You under the Apache License, Version 2.0
+* (the "License"); you may not use this file except in compliance with
+* the License.  You may obtain a copy of the License at
+*
+*     http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+-->
+<configuration>
+	<defaultURI value="activemq:tcp://activemqhost:61616"/>
+
+	<maxInactivityDurationURI value="activemq:tcp://activemqhost:61616?wireFormat.MaxInactivityDuration=30000"/>
+
+	<openWireURI value="activemq:tcp://activemqhost:61616">
+		<factoryParams>
+			<param type="string" value="OpenWireTestClient"/>
+		</factoryParams>
+		<userName value="guest"/>
+		<passWord value="guest"/>
+	</openWireURI>
+</configuration>

Propchange: activemq/activemq-dotnet/Apache.NMS.WCF/trunk/src/
------------------------------------------------------------------------------
    bugtraq:label = Issue#:

Propchange: activemq/activemq-dotnet/Apache.NMS.WCF/trunk/src/
------------------------------------------------------------------------------
--- bugtraq:message (added)
+++ bugtraq:message Fri Oct 31 10:43:10 2008
@@ -0,0 +1 @@
+Fixes [AMQNET-%BUGID%]. (See https://issues.apache.org/activemq/browse/AMQNET-%BUGID%)

Propchange: activemq/activemq-dotnet/Apache.NMS.WCF/trunk/src/
------------------------------------------------------------------------------
    bugtraq:url = https://issues.apache.org/activemq/browse/AMQNET-%BUGID%

Propchange: activemq/activemq-dotnet/Apache.NMS.WCF/trunk/src/main/
------------------------------------------------------------------------------
    bugtraq:label = Issue#:

Propchange: activemq/activemq-dotnet/Apache.NMS.WCF/trunk/src/main/
------------------------------------------------------------------------------
--- bugtraq:message (added)
+++ bugtraq:message Fri Oct 31 10:43:10 2008
@@ -0,0 +1 @@
+Fixes [AMQNET-%BUGID%]. (See https://issues.apache.org/activemq/browse/AMQNET-%BUGID%)

Propchange: activemq/activemq-dotnet/Apache.NMS.WCF/trunk/src/main/
------------------------------------------------------------------------------
    bugtraq:url = https://issues.apache.org/activemq/browse/AMQNET-%BUGID%

Propchange: activemq/activemq-dotnet/Apache.NMS.WCF/trunk/src/main/csharp/
------------------------------------------------------------------------------
    bugtraq:label = Issue#:

Propchange: activemq/activemq-dotnet/Apache.NMS.WCF/trunk/src/main/csharp/
------------------------------------------------------------------------------
--- bugtraq:message (added)
+++ bugtraq:message Fri Oct 31 10:43:10 2008
@@ -0,0 +1 @@
+Fixes [AMQNET-%BUGID%]. (See https://issues.apache.org/activemq/browse/AMQNET-%BUGID%)

Propchange: activemq/activemq-dotnet/Apache.NMS.WCF/trunk/src/main/csharp/
------------------------------------------------------------------------------
    bugtraq:url = https://issues.apache.org/activemq/browse/AMQNET-%BUGID%

Added: activemq/activemq-dotnet/Apache.NMS.WCF/trunk/src/main/csharp/AsyncResult.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.WCF/trunk/src/main/csharp/AsyncResult.cs?rev=709503&view=auto
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.WCF/trunk/src/main/csharp/AsyncResult.cs (added)
+++ activemq/activemq-dotnet/Apache.NMS.WCF/trunk/src/main/csharp/AsyncResult.cs Fri Oct 31 10:43:10 2008
@@ -0,0 +1,323 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+using System;
+using System.Diagnostics;
+using System.Threading;
+
+namespace Apache.NMS.WCF
+{
+	/// <summary>
+	/// A generic base class for IAsyncResult implementations
+	/// that wraps a ManualResetEvent.
+	/// </summary>
+	internal abstract class AsyncResult : IAsyncResult
+	{
+		private readonly AsyncCallback _callback;
+		private readonly object _state;
+		private readonly object _thisLock;
+		private bool _completedSynchronously;
+		private bool _endCalled;
+		private Exception _exception;
+		private bool _isCompleted;
+		private ManualResetEvent _manualResetEvent;
+
+		/// <summary>
+		/// Initializes a new instance of the <see cref="AsyncResult"/> class.
+		/// </summary>
+		/// <param name="callback">The callback.</param>
+		/// <param name="state">The state.</param>
+		protected AsyncResult(AsyncCallback callback, object state)
+		{
+			_callback = callback;
+			_state = state;
+			_thisLock = new object();
+		}
+
+		/// <summary>
+		/// Gets a user-defined object that qualifies or contains information about an asynchronous operation.
+		/// </summary>
+		/// <value></value>
+		/// <returns>
+		/// A user-defined object that qualifies or contains information about an asynchronous operation.
+		/// </returns>
+		public object AsyncState
+		{
+			get { return _state; }
+		}
+
+		/// <summary>
+		/// Gets a <see cref="T:System.Threading.WaitHandle"/> that is used to wait for an asynchronous operation to complete.
+		/// </summary>
+		/// <value></value>
+		/// <returns>
+		/// A <see cref="T:System.Threading.WaitHandle"/> that is used to wait for an asynchronous operation to complete.
+		/// </returns>
+		public WaitHandle AsyncWaitHandle
+		{
+			get
+			{
+				if (_manualResetEvent != null)
+				{
+					return _manualResetEvent;
+				}
+
+				lock (ThisLock)
+				{
+					if (_manualResetEvent == null)
+					{
+						_manualResetEvent = new ManualResetEvent(_isCompleted);
+					}
+				}
+
+				return _manualResetEvent;
+			}
+		}
+
+		/// <summary>
+		/// Gets a value that indicates whether the asynchronous operation completed synchronously.
+		/// </summary>
+		/// <value></value>
+		/// <returns>true if the asynchronous operation completed synchronously; otherwise, false.
+		/// </returns>
+		public bool CompletedSynchronously
+		{
+			get { return _completedSynchronously; }
+		}
+
+		/// <summary>
+		/// Gets a value that indicates whether the asynchronous operation has completed.
+		/// </summary>
+		/// <value></value>
+		/// <returns>true if the operation is complete; otherwise, false.
+		/// </returns>
+		public bool IsCompleted
+		{
+			get { return _isCompleted; }
+		}
+
+		/// <summary>
+		/// Gets an object lock.
+		/// </summary>
+		/// <value>The object lock.</value>
+		private object ThisLock
+		{
+			get { return _thisLock; }
+		}
+
+		// Call this version of complete when your asynchronous operation is complete.  This will update the state
+		// of the operation and notify the callback.
+		/// <summary>
+		/// Completes the specified completed synchronously.
+		/// </summary>
+		/// <param name="completedSynchronously">if set to <see langword="true"/> [completed synchronously].</param>
+		protected void Complete(bool completedSynchronously)
+		{
+			if (_isCompleted)
+			{
+				throw new InvalidOperationException("Cannot call Complete twice");
+			}
+
+			_completedSynchronously = completedSynchronously;
+
+			if (completedSynchronously)
+			{
+				// If we completedSynchronously, then there's no chance that the manualResetEvent was created so
+				// we don't need to worry about a race
+				Debug.Assert(_manualResetEvent == null, "No ManualResetEvent should be created for a synchronous AsyncResult.");
+				_isCompleted = true;
+			}
+			else
+			{
+				lock (ThisLock)
+				{
+					_isCompleted = true;
+					if (_manualResetEvent != null)
+					{
+						_manualResetEvent.Set();
+					}
+				}
+			}
+
+			// If the callback throws, there is an error in the callback implementation
+			if (_callback != null)
+			{
+				_callback(this);
+			}
+		}
+
+		/// <summary>
+		/// Call this version of complete if you raise an exception during processing.  In addition to notifying
+		/// the callback, it will capture the exception and store it to be thrown during AsyncResult.End.
+		/// </summary>
+		/// <param name="completedSynchronously">if set to <see langword="true"/> [completed synchronously].</param>
+		/// <param name="exception">The exception.</param>
+		protected void Complete(bool completedSynchronously, Exception exception)
+		{
+			_exception = exception;
+			Complete(completedSynchronously);
+		}
+
+		/// <summary>
+		/// End should be called when the End function for the asynchronous operation is complete. It
+		/// ensures the asynchronous operation is complete, and does some common validation.
+		/// </summary>
+		/// <typeparam name="TAsyncResult">The type of the async result.</typeparam>
+		/// <param name="result">The result.</param>
+		/// <returns></returns>
+		protected static TAsyncResult End<TAsyncResult>(IAsyncResult result) where TAsyncResult : AsyncResult
+		{
+			if (result == null)
+			{
+				throw new ArgumentNullException("result");
+			}
+
+			TAsyncResult asyncResult = result as TAsyncResult;
+
+			if (asyncResult == null)
+			{
+				throw new ArgumentException("Invalid async messageBody.", "result");
+			}
+
+			if (asyncResult._endCalled)
+			{
+				throw new InvalidOperationException("Async object already ended.");
+			}
+
+			asyncResult._endCalled = true;
+
+			if (!asyncResult._isCompleted)
+			{
+				asyncResult.AsyncWaitHandle.WaitOne();
+			}
+
+			if (asyncResult._manualResetEvent != null)
+			{
+				asyncResult._manualResetEvent.Close();
+			}
+
+			if (asyncResult._exception != null)
+			{
+				throw asyncResult._exception;
+			}
+
+			return asyncResult;
+		}
+	}
+
+	/// <summary>
+	/// An AsyncResult that completes as soon as it is instantiated.
+	/// </summary>
+	internal class CompletedAsyncResult : AsyncResult
+	{
+		/// <summary>
+		/// Initializes a new instance of the <see cref="CompletedAsyncResult"/> class.
+		/// </summary>
+		/// <param name="callback">The callback.</param>
+		/// <param name="state">The state.</param>
+		public CompletedAsyncResult(AsyncCallback callback, object state) : base(callback, state)
+		{
+			Complete(true);
+		}
+
+		/// <summary>
+		/// Ends the specified result.
+		/// </summary>
+		/// <param name="result">The result.</param>
+		public static void End(IAsyncResult result)
+		{
+			End<CompletedAsyncResult>(result);
+		}
+	}
+
+	//A strongly typed AsyncResult
+	internal abstract class TypedAsyncResult<T> : AsyncResult
+	{
+		private T _data;
+
+		/// <summary>
+		/// Initializes a new instance of the <see cref="TypedAsyncResult&lt;T&gt;"/> class.
+		/// </summary>
+		/// <param name="callback">The callback.</param>
+		/// <param name="state">The state.</param>
+		protected TypedAsyncResult(AsyncCallback callback, object state) : base(callback, state)
+		{
+		}
+
+		/// <summary>
+		/// Gets the data.
+		/// </summary>
+		/// <value>The data.</value>
+		public T Data
+		{
+			get { return _data; }
+		}
+
+		/// <summary>
+		/// Completes the specified data.
+		/// </summary>
+		/// <param name="data">The data.</param>
+		/// <param name="completedSynchronously">if set to <see langword="true"/> [completed synchronously].</param>
+		protected void Complete(T data, bool completedSynchronously)
+		{
+			_data = data;
+			Complete(completedSynchronously);
+		}
+
+		/// <summary>
+		/// Ends the specified result.
+		/// </summary>
+		/// <param name="result">The result.</param>
+		/// <returns></returns>
+		public static T End(IAsyncResult result)
+		{
+			TypedAsyncResult<T> typedResult = End<TypedAsyncResult<T>>(result);
+			return typedResult.Data;
+		}
+	}
+
+	//A strongly typed AsyncResult that completes as soon as it is instantiated.
+	internal class TypedCompletedAsyncResult<T> : TypedAsyncResult<T>
+	{
+		/// <summary>
+		/// Initializes a new instance of the <see cref="TypedCompletedAsyncResult&lt;T&gt;"/> class.
+		/// </summary>
+		/// <param name="data">The data.</param>
+		/// <param name="callback">The callback.</param>
+		/// <param name="state">The state.</param>
+		public TypedCompletedAsyncResult(T data, AsyncCallback callback, object state) : base(callback, state)
+		{
+			Complete(data, true);
+		}
+
+		/// <summary>
+		/// Finishes the async request.
+		/// </summary>
+		/// <param name="result">The result.</param>
+		/// <returns></returns>
+		public new static T End(IAsyncResult result)
+		{
+			TypedCompletedAsyncResult<T> completedResult = result as TypedCompletedAsyncResult<T>;
+			if (completedResult == null)
+			{
+				throw new ArgumentException("Invalid async messageBody.", "messageBody");
+			}
+
+			return TypedAsyncResult<T>.End(completedResult);
+		}
+	}
+}
\ No newline at end of file

Added: activemq/activemq-dotnet/Apache.NMS.WCF/trunk/src/main/csharp/CommonAssemblyInfo.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.WCF/trunk/src/main/csharp/CommonAssemblyInfo.cs?rev=709503&view=auto
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.WCF/trunk/src/main/csharp/CommonAssemblyInfo.cs (added)
+++ activemq/activemq-dotnet/Apache.NMS.WCF/trunk/src/main/csharp/CommonAssemblyInfo.cs Fri Oct 31 10:43:10 2008
@@ -0,0 +1,28 @@
+using System;
+using System.Reflection;
+using System.Runtime.InteropServices;
+
+//------------------------------------------------------------------------------
+// <auto-generated>
+//     This code was generated by a tool.
+//     Runtime Version:2.0.50727.3053
+//
+//     Changes to this file may cause incorrect behavior and will be lost if
+//     the code is regenerated.
+// </auto-generated>
+//------------------------------------------------------------------------------
+
+[assembly: ComVisibleAttribute(false)]
+[assembly: CLSCompliantAttribute(true)]
+[assembly: AssemblyTitleAttribute("WCF Provider for ActiveMQ Class Library")]
+[assembly: AssemblyDescriptionAttribute("WCF Provider for ActiveMQ Class Library (.Net Messaging Library Implementation): " +
+    "An implementation of Windows Communications Framework API for ActiveMQ")]
+[assembly: AssemblyConfigurationAttribute("SNAPSHOT")]
+[assembly: AssemblyCompanyAttribute("http://activemq.apache.org/nms")]
+[assembly: AssemblyProductAttribute("WCF Provider for ActiveMQ Class Library")]
+[assembly: AssemblyCopyrightAttribute("Copyright (C) 2005-2008 Apache Software Foundation")]
+[assembly: AssemblyTrademarkAttribute("")]
+[assembly: AssemblyCultureAttribute("")]
+[assembly: AssemblyVersionAttribute("1.1.0")]
+[assembly: AssemblyInformationalVersionAttribute("1.1.0")]
+

Propchange: activemq/activemq-dotnet/Apache.NMS.WCF/trunk/src/main/csharp/Configuration/
------------------------------------------------------------------------------
    bugtraq:label = Issue#:

Propchange: activemq/activemq-dotnet/Apache.NMS.WCF/trunk/src/main/csharp/Configuration/
------------------------------------------------------------------------------
--- bugtraq:message (added)
+++ bugtraq:message Fri Oct 31 10:43:10 2008
@@ -0,0 +1 @@
+Fixes [AMQNET-%BUGID%]. (See https://issues.apache.org/activemq/browse/AMQNET-%BUGID%)

Propchange: activemq/activemq-dotnet/Apache.NMS.WCF/trunk/src/main/csharp/Configuration/
------------------------------------------------------------------------------
    bugtraq:url = https://issues.apache.org/activemq/browse/AMQNET-%BUGID%

Added: activemq/activemq-dotnet/Apache.NMS.WCF/trunk/src/main/csharp/Configuration/AddressingVersions.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.WCF/trunk/src/main/csharp/Configuration/AddressingVersions.cs?rev=709503&view=auto
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.WCF/trunk/src/main/csharp/Configuration/AddressingVersions.cs (added)
+++ activemq/activemq-dotnet/Apache.NMS.WCF/trunk/src/main/csharp/Configuration/AddressingVersions.cs Fri Oct 31 10:43:10 2008
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+namespace Apache.NMS.WCF
+{
+	/// <summary>
+	/// Constants used for addressing namespaces.
+	/// </summary>
+	internal class AddressingVersions
+	{
+		/// <summary>
+		/// WS Addressing 1.0.
+		/// </summary>
+		public const string WSAddressing10NameSpace = "http://www.w3.org/2005/08/addressing";
+
+		/// <summary>
+		/// WS Addressing (August 2004).
+		/// </summary>
+		public const string WSAddressingAugust2004NameSpace = "http://schemas.xmlsoap.org/ws/2004/08/addressing";
+	}
+}

Added: activemq/activemq-dotnet/Apache.NMS.WCF/trunk/src/main/csharp/Configuration/NmsBinding.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.WCF/trunk/src/main/csharp/Configuration/NmsBinding.cs?rev=709503&view=auto
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.WCF/trunk/src/main/csharp/Configuration/NmsBinding.cs (added)
+++ activemq/activemq-dotnet/Apache.NMS.WCF/trunk/src/main/csharp/Configuration/NmsBinding.cs Fri Oct 31 10:43:10 2008
@@ -0,0 +1,164 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+using System;
+using System.Configuration;
+using System.Globalization;
+using System.ServiceModel.Channels;
+
+namespace Apache.NMS.WCF
+{
+	/// <summary>
+	/// The standard binding for NMS.
+	/// </summary>
+	public class NmsBinding : Binding
+	{
+		#region Constructors
+
+		/// <summary>
+		/// Initializes a new instance of the <see cref="NmsBinding"/> class.
+		/// </summary>
+		/// <remarks>
+		/// The default transport is set to <see cref="NmsTransportBindingElement" />, while the
+		/// default message encoding is set to <see cref="TextMessageEncodingBindingElement" />.
+		/// </remarks>
+		public NmsBinding()
+		{
+			_messageElement = new TextMessageEncodingBindingElement();
+			_transportElement = new NmsTransportBindingElement();
+		}
+
+		/// <summary>
+		/// Initializes a new instance of the <see cref="NmsBinding"/> class.
+		/// </summary>
+		/// <param name="configurationName">Name of the configuration.</param>
+		/// <remarks>
+		/// The default transport is set to <see cref="NmsTransportBindingElement" />, while the
+		/// default message encoding is set to <see cref="TextMessageEncodingBindingElement" />.
+		/// </remarks>
+		public NmsBinding(string configurationName) : this()
+		{
+			ApplyConfiguration(configurationName);
+		}
+
+		#endregion
+
+		#region Public properties
+
+		/// <summary>
+		/// This property encapsulates the message encoding used for this custom
+		/// channel implementation.
+		/// </summary>
+		/// <value>The message element.</value>
+		public MessageEncodingBindingElement MessageElement
+		{
+			get { return _messageElement; } 
+			set { _messageElement = value; }
+		}
+
+		/// <summary>
+		/// Gets or sets the transport element.
+		/// </summary>
+		/// <value>The transport element.</value>
+		public NmsTransportBindingElement TransportElement
+		{
+			get { return _transportElement; }
+			set { _transportElement = value; }
+		}
+
+		/// <summary>
+		/// Gets or sets the name of the destination.
+		/// </summary>
+		/// <value>The name of the destination.</value>
+		public string Destination
+		{ 
+			get { return _destination; }
+			set { _destination = value; }
+		}
+
+		/// <summary>
+		/// Gets or sets the name of the message topic (used for publish-subscribe operations).
+		/// </summary>
+		/// <value>The name of the topic.</value>
+		public DestinationType DestinationType
+		{
+			get { return _destinationType; }
+			set { _destinationType = value; }
+		}
+
+		#endregion
+
+		#region Public methods
+
+		/// <summary>
+		/// When overridden in a derived class, creates a collection that contains the binding elements that are part of the current binding.
+		/// </summary>
+		/// <returns>
+		/// A <see cref="T:System.Collections.Generic.ICollection`1"></see> object of type <see cref="T:System.ServiceModel.Channels.BindingElement"></see> that contains the binding elements from the current binding object in the correct order.
+		/// </returns>
+		public override BindingElementCollection CreateBindingElements()
+		{
+			_transportElement.Destination = Destination;
+			_transportElement.DestinationType = DestinationType;
+
+			BindingElementCollection elements = new BindingElementCollection();
+			elements.Add(_messageElement);
+			elements.Add(_transportElement);
+			return elements.Clone();
+		}
+
+		/// <summary>
+		/// When implemented in a derived class, sets the URI scheme that specifies the transport used by the channel and listener factories that are built by the bindings.
+		/// </summary>
+		/// <value></value>
+		/// <returns>The URI scheme that is used by the channels or listeners that are created by the factories built by the current binding.</returns>
+		public override string Scheme
+		{
+			get { return TransportElement.Scheme; }
+		}
+
+		#endregion
+
+		#region Private methods
+
+		/// <summary>
+		/// Applies the configuration.
+		/// </summary>
+		/// <param name="configurationName">Name of the configuration.</param>
+		private void ApplyConfiguration(string configurationName)
+		{
+			NmsBindingCollection section = (NmsBindingCollection)ConfigurationManager.GetSection(NmsConstants.NmsBindingSectionName);
+			NmsBindingElement element = section.Bindings[configurationName];
+			if (element == null)
+			{
+				throw new ConfigurationErrorsException(String.Format(CultureInfo.CurrentCulture, "There is no binding named {0} at {1}.", configurationName, section.BindingName));
+			}
+			element.ApplyConfiguration(this);
+		}
+
+		#endregion
+
+		#region Private members
+
+		private MessageEncodingBindingElement _messageElement;
+		private NmsTransportBindingElement _transportElement;
+		private string _destination;
+		private DestinationType _destinationType;
+
+		#endregion
+	}
+}
\ No newline at end of file

Added: activemq/activemq-dotnet/Apache.NMS.WCF/trunk/src/main/csharp/Configuration/NmsBindingCollection.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.WCF/trunk/src/main/csharp/Configuration/NmsBindingCollection.cs?rev=709503&view=auto
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.WCF/trunk/src/main/csharp/Configuration/NmsBindingCollection.cs (added)
+++ activemq/activemq-dotnet/Apache.NMS.WCF/trunk/src/main/csharp/Configuration/NmsBindingCollection.cs Fri Oct 31 10:43:10 2008
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+using System.ServiceModel.Configuration;
+
+namespace Apache.NMS.WCF
+{
+	/// <summary>
+	/// A collection of <see cref="NmsBindingElement" /> objects.
+	/// </summary>
+	public class NmsBindingCollection : StandardBindingCollectionElement<NmsBinding, NmsBindingElement>
+	{
+	}
+}

Added: activemq/activemq-dotnet/Apache.NMS.WCF/trunk/src/main/csharp/Configuration/NmsBindingElement.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.WCF/trunk/src/main/csharp/Configuration/NmsBindingElement.cs?rev=709503&view=auto
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.WCF/trunk/src/main/csharp/Configuration/NmsBindingElement.cs (added)
+++ activemq/activemq-dotnet/Apache.NMS.WCF/trunk/src/main/csharp/Configuration/NmsBindingElement.cs Fri Oct 31 10:43:10 2008
@@ -0,0 +1,144 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+using System;
+using System.Configuration;
+using System.Globalization;
+using System.ServiceModel.Channels;
+using System.ServiceModel.Configuration;
+
+namespace Apache.NMS.WCF
+{
+	/// <summary>
+	/// Configuration element for the <see cref="NmsBinding" />, allowing the overriding of default values.
+	/// </summary>
+	public class NmsBindingElement : StandardBindingElement
+	{
+		#region Constructors
+
+		/// <summary>
+		/// Initializes a new instance of the <see cref="NmsBindingElement"/> class.
+		/// </summary>
+		public NmsBindingElement() : this(null)
+		{
+		}
+
+		/// <summary>
+		/// Initializes a new instance of the <see cref="NmsBindingElement"/> class.
+		/// </summary>
+		/// <param name="configurationName">Name of the configuration.</param>
+		public NmsBindingElement(string configurationName) : base(configurationName)
+		{
+		}
+
+		#endregion
+
+		#region Public properties
+
+		/// <summary>
+		/// Gets or sets the name of the message destination.
+		/// </summary>
+		/// <value>The name of the message destination.</value>
+		[ConfigurationProperty(NmsConfigurationStrings.Destination, IsRequired = true)]
+		public string Destination
+		{
+			get { return (string)base[NmsConfigurationStrings.Destination]; }
+			set { base[NmsConfigurationStrings.Destination] = value; }
+		}
+
+		/// <summary>
+		/// Gets or sets the type of the message destination.
+		/// </summary>
+		/// <value>The type of the message destination (may be either <c>queue</c> or <c>topic</c>, and temporary 
+		/// or permanent versions of either).</value>
+		[ConfigurationProperty(NmsConfigurationStrings.DestinationType, DefaultValue = NmsConfigurationDefaults.Destination)]
+		public DestinationType DestinationType
+		{
+			get { return (DestinationType)Enum.Parse(typeof(DestinationType), base[NmsConfigurationStrings.DestinationType].ToString(), true); }
+			set { base[NmsConfigurationStrings.DestinationType] = value; }
+		}
+
+		#endregion
+
+		#region Protected methods
+
+		/// <summary>
+		/// Gets a <see cref="T:System.Configuration.ConfigurationPropertyCollection"/> instance that contains a collection of <see cref="T:System.Configuration.ConfigurationProperty"/> objects that can be attributes or <see cref="T:System.Configuration.ConfigurationElement"/> objects of this configuration element.
+		/// </summary>
+		/// <value></value>
+		/// <returns>A <see cref="T:System.Configuration.ConfigurationPropertyCollection"/> instance that contains a collection of <see cref="T:System.Configuration.ConfigurationProperty"/> objects that can be attributes or <see cref="T:System.Configuration.ConfigurationElement"/> objects of this configuration element.</returns>
+		protected override ConfigurationPropertyCollection Properties
+		{
+			get
+			{
+				ConfigurationPropertyCollection properties = base.Properties;
+				properties.Add(new ConfigurationProperty(NmsConfigurationStrings.Destination, typeof(string), null, ConfigurationPropertyOptions.IsRequired));
+				properties.Add(new ConfigurationProperty(NmsConfigurationStrings.DestinationType, typeof(DestinationType), NmsConfigurationDefaults.Destination));
+				return properties;
+			}
+		}
+
+		/// <summary>
+		/// Initializes this binding configuration element with the content of the specified binding.
+		/// </summary>
+		/// <param name="binding">A binding.</param>
+		/// <exception cref="T:System.ArgumentNullException">
+		/// 	<paramref name="binding"/> is null.</exception>
+		/// <exception cref="T:System.ArgumentException">The type of this binding element is different from the type specified by <paramref name="binding"/>.</exception>
+		protected override void InitializeFrom(Binding binding)
+		{
+			base.InitializeFrom(binding);
+			NmsBinding nmsBinding = (NmsBinding)binding;
+			Destination = nmsBinding.Destination;
+			DestinationType = nmsBinding.DestinationType;
+		}
+
+		/// <summary>
+		/// Called when the content of a specified binding element is applied to this binding configuration element.
+		/// </summary>
+		/// <param name="binding">A binding.</param>
+		protected override void OnApplyConfiguration(Binding binding)
+		{
+			if (binding == null)
+			{
+				throw new ArgumentNullException("binding");
+			}
+
+			if (binding.GetType() != typeof(NmsBinding))
+			{
+				throw new ArgumentException(String.Format(CultureInfo.CurrentCulture, "Invalid type for binding. Expected tpye: {0}. Type passed in: {1}.", typeof(NmsBinding).AssemblyQualifiedName, binding.GetType().AssemblyQualifiedName));
+			}
+
+			NmsBinding nmsBinding = (NmsBinding)binding;
+			nmsBinding.Destination = Destination;
+			nmsBinding.DestinationType = DestinationType;
+		}
+
+		/// <summary>
+		/// When overridden in a derived class, gets the <see cref="T:System.Type" /> object that represents the custom binding element. 
+		/// </summary>
+		/// <returns>
+		/// A <see cref="T:System.Type" /> object that represents the custom binding type.
+		/// </returns>
+		protected override Type BindingElementType
+		{
+			get { return typeof(NmsBinding); }
+		}
+
+		#endregion
+	}
+}

Added: activemq/activemq-dotnet/Apache.NMS.WCF/trunk/src/main/csharp/Configuration/NmsConfigurationDefaults.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.WCF/trunk/src/main/csharp/Configuration/NmsConfigurationDefaults.cs?rev=709503&view=auto
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.WCF/trunk/src/main/csharp/Configuration/NmsConfigurationDefaults.cs (added)
+++ activemq/activemq-dotnet/Apache.NMS.WCF/trunk/src/main/csharp/Configuration/NmsConfigurationDefaults.cs Fri Oct 31 10:43:10 2008
@@ -0,0 +1,30 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+namespace Apache.NMS.WCF
+{
+	/// <summary>
+	/// Constants used as default configuration settings.
+	/// </summary>
+	internal class NmsConfigurationDefaults
+	{
+		/// <summary>
+		/// The default message destination type.
+		/// </summary>
+		public const DestinationType Destination = DestinationType.Queue;
+	}
+}

Added: activemq/activemq-dotnet/Apache.NMS.WCF/trunk/src/main/csharp/Configuration/NmsConfigurationStrings.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.WCF/trunk/src/main/csharp/Configuration/NmsConfigurationStrings.cs?rev=709503&view=auto
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.WCF/trunk/src/main/csharp/Configuration/NmsConfigurationStrings.cs (added)
+++ activemq/activemq-dotnet/Apache.NMS.WCF/trunk/src/main/csharp/Configuration/NmsConfigurationStrings.cs Fri Oct 31 10:43:10 2008
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+namespace Apache.NMS.WCF
+{
+	/// <summary>
+	/// Constants used for WCF configuration of the NMS provider.
+	/// </summary>
+	internal class NmsConfigurationStrings
+	{
+		/// <summary>
+		/// The XML configuration attribute name of the <c>Destination</c> property.
+		/// </summary>
+		public const string Destination = "destination";
+
+		/// <summary>
+		/// The XML configuration attribute name of the <c>DestinationType</c> property.
+		/// </summary>
+		public const string DestinationType = "destinationType";
+	}
+}

Added: activemq/activemq-dotnet/Apache.NMS.WCF/trunk/src/main/csharp/Configuration/NmsConstants.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.WCF/trunk/src/main/csharp/Configuration/NmsConstants.cs?rev=709503&view=auto
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.WCF/trunk/src/main/csharp/Configuration/NmsConstants.cs (added)
+++ activemq/activemq-dotnet/Apache.NMS.WCF/trunk/src/main/csharp/Configuration/NmsConstants.cs Fri Oct 31 10:43:10 2008
@@ -0,0 +1,61 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+using System.ServiceModel.Channels;
+
+namespace Apache.NMS.WCF
+{
+	/// <summary>
+	/// Constants used in the NMS WCF provider.
+	/// </summary>
+	internal class NmsConstants
+	{
+		private static readonly MessageEncoderFactory factory;
+
+		/// <summary>
+		/// Initializes the <see cref="NmsConstants"/> class.
+		/// </summary>
+		static NmsConstants()
+		{
+			factory = new TextMessageEncodingBindingElement().CreateMessageEncoderFactory();
+		}
+
+		/// <summary>
+		/// Gets the default message encoder factory.
+		/// </summary>
+		/// <value>The default message encoder factory.</value>
+		public static MessageEncoderFactory DefaultMessageEncoderFactory
+		{
+			get { return factory; }
+		}
+
+		/// <summary>
+		/// The transport scheme to use with NMS.
+		/// </summary>
+		public const string TransportScheme = "tcp";
+
+		/// <summary>
+		/// The name of the NMS binding configuration section.
+		/// </summary>
+		public const string NmsBindingSectionName = "system.serviceModel/bindings/nmsBinding";
+
+		/// <summary>
+		/// The name of the NMS transport configuration section.
+		/// </summary>
+		public const string NmsTransportSectionName = "nmsTransport";
+	}
+}

Added: activemq/activemq-dotnet/Apache.NMS.WCF/trunk/src/main/csharp/Configuration/NmsTransportBindingElement.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.WCF/trunk/src/main/csharp/Configuration/NmsTransportBindingElement.cs?rev=709503&view=auto
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.WCF/trunk/src/main/csharp/Configuration/NmsTransportBindingElement.cs (added)
+++ activemq/activemq-dotnet/Apache.NMS.WCF/trunk/src/main/csharp/Configuration/NmsTransportBindingElement.cs Fri Oct 31 10:43:10 2008
@@ -0,0 +1,369 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+using System;
+using System.IO;
+using System.ServiceModel;
+using System.ServiceModel.Channels;
+using System.ServiceModel.Description;
+using System.Web.Services.Description;
+using System.Xml;
+
+namespace Apache.NMS.WCF
+{
+	/// <summary>
+	/// key class to specify the custom transport class and its schema.
+	/// Its key role in the WCF is to be the 'factory of factories'.  It determines what shape
+	/// the channel will be.  In this case by returning channel factory (for the client) that returns a IOutputChannel
+	/// and a channel listener (for the server) that returns a IInputChannel, this class determines
+	/// that this implementation is a datagram 'shape'.
+	/// </summary>
+	public class NmsTransportBindingElement : TransportBindingElement, IWsdlExportExtension, IPolicyExportExtension
+	{
+		#region Constructors
+
+		/// <summary>
+		/// Initializes a new instance of the <see cref="NmsTransportBindingElement"/> class.
+		/// </summary>
+		public NmsTransportBindingElement()
+		{
+			Console.WriteLine(".");
+		}
+
+		/// <summary>
+		/// Initializes a new instance of the <see cref="NmsTransportBindingElement"/> class.
+		/// </summary>
+		/// <param name="element">The element.</param>
+		protected NmsTransportBindingElement(NmsTransportBindingElement element)
+		{
+			ManualAddressing = element.ManualAddressing;
+			Destination = element.Destination;
+			DestinationType = element.DestinationType;
+		}
+
+		#endregion
+
+		#region Public properties
+
+		/// <summary>
+		/// Gets or sets the name of the message destination.
+		/// </summary>
+		/// <value>The name of the message destination.</value>
+		public string Destination
+		{
+			get { return _destination; }
+			set { _destination = value; }
+		}
+
+		/// <summary>
+		/// Gets or sets the type of the message destination.
+		/// </summary>
+		/// <value>The type of the message destination (may be either <c>queue</c> or <c>topic</c>, and temporary 
+		/// or permanent versions of either).</value>
+		public DestinationType DestinationType
+		{
+			get { return _destinationType; }
+			set { _destinationType = value; }
+		}
+
+		#endregion
+
+		#region Public methods
+
+		/// <summary>
+		/// Determines whether this instance can build a channel factory in the specified context.
+		/// In this case an implementation of IOutputChannel.
+		/// </summary>
+		/// <typeparam name="TChannel">The type of the channel.</typeparam>
+		/// <param name="context">The context.</param>
+		/// <returns>
+		/// 	<c>true</c> if this instance [can build channel factory] the specified context; otherwise, <c>false</c>.
+		/// </returns>
+		public override bool CanBuildChannelFactory<TChannel>(BindingContext context)
+		{
+			return (typeof(TChannel) == typeof(IOutputChannel));
+		}
+
+		/// <summary>
+		/// Determines whether this instance can build a channel listener in the specified context.
+		/// In this case in implementation that will return an IInputChannel.
+		/// </summary>
+		/// <typeparam name="TChannel">The type of the channel.</typeparam>
+		/// <param name="context">The context.</param>
+		/// <returns>
+		/// 	<c>true</c> if this instance [can build channel listener] the specified context; otherwise, <c>false</c>.
+		/// </returns>
+		/// <exception cref="ArgumentException">the requested channel does not implement <see cref="IReplyChannel" />.</exception>
+		public override bool CanBuildChannelListener<TChannel>(BindingContext context)
+		{
+			return (typeof(TChannel) == typeof(IInputChannel));
+		}
+
+		/// <summary>
+		/// Builds the channel factory.
+		/// </summary>
+		/// <typeparam name="TChannel">The type of the channel.</typeparam>
+		/// <param name="context">The context.</param>
+		/// <returns></returns>
+		/// <exception cref="ArgumentException">the requested channel does not implement <see cref="IReplyChannel" />.</exception>
+		public override IChannelFactory<TChannel> BuildChannelFactory<TChannel>(BindingContext context)
+		{
+			if (context == null)
+			{
+				throw new ArgumentNullException("context");
+			}
+			if (!CanBuildChannelFactory<TChannel>(context))
+			{
+				throw new ArgumentException(String.Format("Unsupported channel type: {0}.", typeof(TChannel).Name));
+			}
+			return (IChannelFactory<TChannel>)new NmsChannelFactory(this, context);
+		}
+
+		/// <summary>
+		/// Builds the channel listener.
+		/// </summary>
+		/// <typeparam name="TChannel">The type of the channel.</typeparam>
+		/// <param name="context">The context.</param>
+		/// <returns></returns>
+		public override IChannelListener<TChannel> BuildChannelListener<TChannel>(BindingContext context)
+		{
+			if (context == null)
+			{
+				throw new ArgumentNullException("context");
+			}
+			if (!CanBuildChannelListener<TChannel>(context))
+			{
+				throw new ArgumentException(String.Format("Unsupported channel type: {0}.", typeof(TChannel).Name));
+			}
+			return (IChannelListener<TChannel>)new NmsChannelListener(this, context);
+		}
+
+		/// <summary>
+		/// Gets the URI scheme for the transport.
+		/// </summary>
+		/// <value></value>
+		/// <returns>Returns the URI scheme for the transport, which varies depending on what derived class implements this method.</returns>
+		public override string Scheme
+		{
+			get { return NmsConstants.TransportScheme; }
+		}
+
+		/// <summary>
+		/// When overridden in a derived class, returns a copy of the binding element object.
+		/// </summary>
+		/// <returns>
+		/// A <see cref="T:System.ServiceModel.Channels.BindingElement"></see> object that is a deep clone of the original.
+		/// </returns>
+		public override BindingElement Clone()
+		{
+			return new NmsTransportBindingElement(this);
+		}
+
+		/// <summary>
+		/// Gets the property.
+		/// </summary>
+		/// <typeparam name="T"></typeparam>
+		/// <param name="context">The context.</param>
+		/// <returns></returns>
+		public override T GetProperty<T>(BindingContext context)
+		{
+			if (context == null)
+			{
+				throw new ArgumentNullException("context");
+			}
+
+			return context.GetInnerProperty<T>();
+		}
+
+		#endregion
+
+		#region Implementation of IWsdlExportExtension
+
+		/// <summary>
+		/// Writes custom Web Services Description Language (WSDL) elements into the generated WSDL for a contract.
+		/// </summary>
+		/// <param name="exporter">The <see cref="T:System.ServiceModel.Description.WsdlExporter" /> that exports the contract information.</param>
+		/// <param name="context">Provides mappings from exported WSDL elements to the contract description.</param>
+		public void ExportContract(WsdlExporter exporter, WsdlContractConversionContext context)
+		{
+		}
+
+		/// <summary>
+		/// Writes custom Web Services Description Language (WSDL) elements into the generated WSDL for an endpoint.
+		/// </summary>
+		/// <param name="exporter">The <see cref="T:System.ServiceModel.Description.WsdlExporter" /> that exports the endpoint information.</param>
+		/// <param name="context">Provides mappings from exported WSDL elements to the endpoint description.</param>
+		public void ExportEndpoint(WsdlExporter exporter, WsdlEndpointConversionContext context)
+		{
+			BindingElementCollection bindingElements = context.Endpoint.Binding.CreateBindingElements();
+			MessageEncodingBindingElement encodingBindingElement = bindingElements.Find<MessageEncodingBindingElement>() ?? new TextMessageEncodingBindingElement();
+
+			if (context.WsdlPort != null)
+			{
+				AddAddressToWsdlPort(context.WsdlPort, context.Endpoint.Address, encodingBindingElement.MessageVersion.Addressing);
+			}
+		}
+
+		#endregion
+
+		#region Implementation of IPolicyExportExtension
+
+		/// <summary>
+		/// Implement to include for exporting a custom policy assertion about bindings.
+		/// </summary>
+		/// <param name="exporter">The <see cref="T:System.ServiceModel.Description.MetadataExporter" /> that you can use to modify the exporting process.</param>
+		/// <param name="context">The <see cref="T:System.ServiceModel.Description.PolicyConversionContext" /> that you can use to insert your custom policy assertion.</param>
+		public void ExportPolicy(MetadataExporter exporter, PolicyConversionContext context)
+		{
+			if (exporter == null)
+			{
+				throw new ArgumentNullException("exporter");
+			}
+
+			if (context == null)
+			{
+				throw new ArgumentNullException("context");
+			}
+
+			bool createdNew = false;
+			MessageEncodingBindingElement encodingBindingElement = context.BindingElements.Find<MessageEncodingBindingElement>();
+			if (encodingBindingElement == null)
+			{
+				createdNew = true;
+				encodingBindingElement = new TextMessageEncodingBindingElement();
+			}
+
+			if (createdNew && encodingBindingElement is IPolicyExportExtension)
+			{
+				((IPolicyExportExtension)encodingBindingElement).ExportPolicy(exporter, context);
+			}
+
+			AddWSAddressingAssertion(context, encodingBindingElement.MessageVersion.Addressing);
+		}
+
+		/// <summary>
+		/// Adds the address to WSDL port.
+		/// </summary>
+		/// <param name="wsdlPort">The WSDL port.</param>
+		/// <param name="endpointAddress">The endpoint address.</param>
+		/// <param name="addressing">The addressing.</param>
+		private static void AddAddressToWsdlPort(Port wsdlPort, EndpointAddress endpointAddress, AddressingVersion addressing)
+		{
+			if (addressing == AddressingVersion.None)
+			{
+				return;
+			}
+
+			MemoryStream memoryStream = new MemoryStream();
+			XmlWriter xmlWriter = XmlWriter.Create(memoryStream);
+			xmlWriter.WriteStartElement("temp");
+
+			if (addressing == AddressingVersion.WSAddressing10)
+			{
+				xmlWriter.WriteAttributeString("xmlns", "wsa10", null, AddressingVersions.WSAddressing10NameSpace);
+			}
+			else if (addressing == AddressingVersion.WSAddressingAugust2004)
+			{
+				xmlWriter.WriteAttributeString("xmlns", "wsa", null, AddressingVersions.WSAddressingAugust2004NameSpace);
+			}
+			else
+			{
+				throw new InvalidOperationException("This addressing version is not supported:\n" + addressing);
+			}
+
+			endpointAddress.WriteTo(addressing, xmlWriter);
+			xmlWriter.WriteEndElement();
+
+			xmlWriter.Flush();
+			memoryStream.Seek(0, SeekOrigin.Begin);
+
+			XmlReader xmlReader = XmlReader.Create(memoryStream);
+			xmlReader.MoveToContent();
+
+			XmlElement endpointReference = (XmlElement)XmlDoc.ReadNode(xmlReader).ChildNodes[0];
+
+			wsdlPort.Extensions.Add(endpointReference);
+		}
+
+		/// <summary>
+		/// Adds the WS addressing assertion.
+		/// </summary>
+		/// <param name="context">The context.</param>
+		/// <param name="addressing">The addressing.</param>
+		static void AddWSAddressingAssertion(PolicyConversionContext context, AddressingVersion addressing)
+		{
+			XmlElement addressingAssertion;
+
+			if (addressing == AddressingVersion.WSAddressing10)
+			{
+				addressingAssertion = XmlDoc.CreateElement("wsaw", "UsingAddressing", "http://www.w3.org/2006/05/addressing/wsdl");
+			}
+			else if (addressing == AddressingVersion.WSAddressingAugust2004)
+			{
+				addressingAssertion = XmlDoc.CreateElement("wsap", "UsingAddressing", AddressingVersions.WSAddressingAugust2004NameSpace + "/policy");
+			}
+			else if (addressing == AddressingVersion.None)
+			{
+				// do nothing
+				addressingAssertion = null;
+			}
+			else
+			{
+				throw new InvalidOperationException("This addressing version is not supported:\n" + addressing);
+			}
+
+			if (addressingAssertion != null)
+			{
+				context.GetBindingAssertions().Add(addressingAssertion);
+			}
+		}
+
+		/// <summary>
+		/// Gets the XML doc.
+		/// </summary>
+		static XmlDocument XmlDoc
+		{
+			get
+			{
+				if (_xmlDocument == null)
+				{
+					NameTable nameTable = new NameTable();
+					nameTable.Add("Policy");
+					nameTable.Add("All");
+					nameTable.Add("ExactlyOne");
+					nameTable.Add("PolicyURIs");
+					nameTable.Add("Id");
+					nameTable.Add("UsingAddressing");
+					nameTable.Add("UsingAddressing");
+					_xmlDocument = new XmlDocument(nameTable);
+				}
+				return _xmlDocument;
+			}
+		}
+
+		private static XmlDocument _xmlDocument;
+
+		#endregion
+
+		#region Private members
+
+		private string _destination;
+		private DestinationType _destinationType;
+
+		#endregion
+	}
+}

Added: activemq/activemq-dotnet/Apache.NMS.WCF/trunk/src/main/csharp/Configuration/NmsTransportElement.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.WCF/trunk/src/main/csharp/Configuration/NmsTransportElement.cs?rev=709503&view=auto
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.WCF/trunk/src/main/csharp/Configuration/NmsTransportElement.cs (added)
+++ activemq/activemq-dotnet/Apache.NMS.WCF/trunk/src/main/csharp/Configuration/NmsTransportElement.cs Fri Oct 31 10:43:10 2008
@@ -0,0 +1,148 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+using System;
+using System.ServiceModel.Channels;
+using System.ServiceModel.Configuration;
+using System.Configuration;
+
+namespace Apache.NMS.WCF
+{
+	/// <summary>
+	/// Configuration section for NMS.
+	/// </summary>
+	public class NmsTransportElement : BindingElementExtensionElement
+	{
+		#region Public properties
+
+		/// <summary>
+		/// Gets or sets the name of the message destination.
+		/// </summary>
+		/// <value>The name of the message destination.</value>
+		[ConfigurationProperty(NmsConfigurationStrings.Destination, IsRequired = true)]
+		public string Destination
+		{
+			get { return (string)base[NmsConfigurationStrings.Destination]; }
+			set { base[NmsConfigurationStrings.Destination] = value; 
+			}
+		}
+
+		/// <summary>
+		/// Gets or sets the type of the message destination.
+		/// </summary>
+		/// <value>The type of the message destination (may be either <c>queue</c> or <c>topic</c>, and temporary 
+		/// or permanent versions of either).</value>
+		[ConfigurationProperty(NmsConfigurationStrings.DestinationType, DefaultValue = NmsConfigurationDefaults.Destination)]
+		public DestinationType DestinationType
+		{
+			get { return (DestinationType)Enum.Parse(typeof(DestinationType), base[NmsConfigurationStrings.DestinationType].ToString(), true); }
+			set { base[NmsConfigurationStrings.DestinationType] = value; }
+		}
+
+		#endregion
+
+		#region Configuration overrides
+
+		/// <summary>
+		/// When overridden in a derived class, gets the <see cref="T:System.Type" /> object that represents the custom binding element. 
+		/// </summary>
+		/// <returns>
+		/// A <see cref="T:System.Type" /> object that represents the custom binding type.
+		/// </returns>
+		public override Type BindingElementType
+		{
+			get { return typeof(NmsTransportBindingElement); }
+		}
+
+		/// <summary>
+		/// When overridden in a derived class, returns a custom binding element object. 
+		/// </summary>
+		/// <returns>
+		/// A custom <see cref="T:System.ServiceModel.Channels.BindingElement" /> object.
+		/// </returns>
+		protected override BindingElement CreateBindingElement()
+		{
+			NmsTransportBindingElement bindingElement = new NmsTransportBindingElement();
+			this.ApplyConfiguration(bindingElement);
+			return bindingElement;
+		}
+
+		#endregion
+
+		/// <summary>
+		/// Applies the content of a specified binding element to this binding configuration element.
+		/// </summary>
+		/// <param name="bindingElement">A binding element.</param>
+		/// <exception cref="T:System.ArgumentNullException">
+		/// 	<paramref name="transportElement"/> is null.</exception>
+		public override void ApplyConfiguration(BindingElement bindingElement)
+		{
+			base.ApplyConfiguration(bindingElement);
+
+			NmsTransportBindingElement nmsBindingElement = (NmsTransportBindingElement)bindingElement;
+			nmsBindingElement.Destination = Destination;
+			nmsBindingElement.DestinationType = DestinationType;
+		}
+
+		/// <summary>
+		/// Copies the content of the specified configuration element to this configuration element.
+		/// </summary>
+		/// <param name="from">The configuration element to be copied.</param>
+		/// <exception cref="T:System.ArgumentNullException">
+		/// 	<paramref name="from"/> is null.</exception>
+		/// <exception cref="T:System.Configuration.ConfigurationErrorsException">The configuration file is read-only.</exception>
+		public override void CopyFrom(ServiceModelExtensionElement from)
+		{
+			base.CopyFrom(from);
+
+			NmsTransportElement source = (NmsTransportElement)from;
+			Destination = source.Destination;
+			DestinationType = source.DestinationType;
+		}
+
+		/// <summary>
+		/// Initializes this binding configuration section with the content of the specified binding element.
+		/// </summary>
+		/// <param name="bindingElement">A binding element.</param>
+		protected override void InitializeFrom(BindingElement bindingElement)
+		{
+			base.InitializeFrom(bindingElement);
+
+			NmsTransportBindingElement nmsBindingElement = (NmsTransportBindingElement)bindingElement;
+			Destination = nmsBindingElement.Destination;
+			DestinationType = nmsBindingElement.DestinationType;
+		}
+
+		/// <summary>
+		/// Gets the collection of properties.
+		/// </summary>
+		/// <value></value>
+		/// <returns>
+		/// The <see cref="T:System.Configuration.ConfigurationPropertyCollection"/> of properties for the element.
+		/// </returns>
+		protected override ConfigurationPropertyCollection Properties
+		{
+			get
+			{
+				ConfigurationPropertyCollection properties = base.Properties;
+				properties.Add(new ConfigurationProperty(NmsConfigurationStrings.Destination, typeof(string), null, ConfigurationPropertyOptions.IsRequired));
+				properties.Add(new ConfigurationProperty(NmsConfigurationStrings.DestinationType, typeof(DestinationType), NmsConfigurationDefaults.Destination));
+				return properties;
+			}
+		}
+	}
+}

Added: activemq/activemq-dotnet/Apache.NMS.WCF/trunk/src/main/csharp/ConnectionFactoryManager.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.WCF/trunk/src/main/csharp/ConnectionFactoryManager.cs?rev=709503&view=auto
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.WCF/trunk/src/main/csharp/ConnectionFactoryManager.cs (added)
+++ activemq/activemq-dotnet/Apache.NMS.WCF/trunk/src/main/csharp/ConnectionFactoryManager.cs Fri Oct 31 10:43:10 2008
@@ -0,0 +1,80 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+using System;
+using Apache.NMS;
+using Apache.NMS.ActiveMQ;
+using System.Diagnostics;
+
+namespace Apache.NMS.WCF
+{
+	/// <summary>
+	/// Manages connections to the ActiveMQ messaging service.
+	/// </summary>
+	public class ConnectionFactoryManager
+	{
+		#region Constructors
+
+		/// <summary>
+		/// Initializes a new instance of the <see cref="ConnectionFactoryManager"/> class.
+		/// </summary>
+		private ConnectionFactoryManager()
+		{
+		}
+
+		/// <summary>
+		/// Gets the instance.
+		/// </summary>
+		/// <returns></returns>
+		public static ConnectionFactoryManager GetInstance()
+		{
+			if (_instance == null)
+			{
+				_instance = new ConnectionFactoryManager();
+			}
+			return _instance;
+		}
+
+		#endregion
+
+		#region Public methods
+
+		/// <summary>
+		/// Creates the connection.
+		/// </summary>
+		/// <param name="connection">The connection.</param>
+		/// <returns></returns>
+		public IConnection CreateConnection(Uri connection)
+		{
+			lock (this)
+			{
+				Console.WriteLine("Connecting to {0}{1}{2}", connection.Scheme, Uri.SchemeDelimiter, connection.Authority);
+				primaryFactory = new ConnectionFactory(connection);
+				return primaryFactory.CreateConnection();
+			}
+		}
+
+		#endregion
+
+		#region Private members
+
+		private static ConnectionFactoryManager _instance;
+		private IConnectionFactory primaryFactory;
+
+		#endregion
+	}
+}
\ No newline at end of file



Mime
View raw message