diff options
author | Stephen D. Huston <shuston@apache.org> | 2011-10-21 14:42:12 +0000 |
---|---|---|
committer | Stephen D. Huston <shuston@apache.org> | 2011-10-21 14:42:12 +0000 |
commit | f83677056891e436bf5ba99e79240df2a44528cd (patch) | |
tree | 625bfd644b948e89105630759cf6decb0435354d /dotnet/client-010/wcf/demo/wcfRPC | |
parent | ebfd9ff053b04ab379acfc0fefedee5a31b6d8a5 (diff) | |
download | qpid-python-QPID-2519.tar.gz |
Merged out from trunkQPID-2519
git-svn-id: https://svn.apache.org/repos/asf/qpid/branches/QPID-2519@1187375 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'dotnet/client-010/wcf/demo/wcfRPC')
-rw-r--r-- | dotnet/client-010/wcf/demo/wcfRPC/IUpperCase.cs | 31 | ||||
-rw-r--r-- | dotnet/client-010/wcf/demo/wcfRPC/Program.cs | 113 | ||||
-rw-r--r-- | dotnet/client-010/wcf/demo/wcfRPC/Properties/AssemblyInfo.cs | 57 | ||||
-rw-r--r-- | dotnet/client-010/wcf/demo/wcfRPC/QpidBindingConfigurationElement.cs | 205 | ||||
-rw-r--r-- | dotnet/client-010/wcf/demo/wcfRPC/UpperCase.cs | 33 | ||||
-rw-r--r-- | dotnet/client-010/wcf/demo/wcfRPC/wcfRPC.csproj | 93 |
6 files changed, 0 insertions, 532 deletions
diff --git a/dotnet/client-010/wcf/demo/wcfRPC/IUpperCase.cs b/dotnet/client-010/wcf/demo/wcfRPC/IUpperCase.cs deleted file mode 100644 index 668450948d..0000000000 --- a/dotnet/client-010/wcf/demo/wcfRPC/IUpperCase.cs +++ /dev/null @@ -1,31 +0,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. -* -*/ -using System.ServiceModel; - -namespace org.apache.qpid.wcf.demo.rpc -{ - [ServiceContract] - public interface IUpperCase - { - [OperationContract] - string ToUpperCase(string message); - } -} diff --git a/dotnet/client-010/wcf/demo/wcfRPC/Program.cs b/dotnet/client-010/wcf/demo/wcfRPC/Program.cs deleted file mode 100644 index e2b54a0f61..0000000000 --- a/dotnet/client-010/wcf/demo/wcfRPC/Program.cs +++ /dev/null @@ -1,113 +0,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. -* -*/ - -using System; -using System.ServiceModel; -using System.ServiceModel.Channels; -using System.Threading; -using org.apache.qpid.wcf.model; - - -namespace org.apache.qpid.wcf.demo.rpc -{ - internal class Program - { - private ServiceHost _service; - private ChannelFactory<IUpperCase> fac; - - public void StartService(Binding binding) - { - try - { - Console.WriteLine(" Binding Service..."); - _service = new ServiceHost(typeof (UpperCase), new Uri("soap.amqp:///")); - _service.AddServiceEndpoint(typeof(IUpperCase), binding, "UpperCase"); - _service.Open(); - Thread.Sleep(500); - Console.WriteLine("[DONE]"); - } - catch (Exception e) - { - Console.WriteLine(e); - } - } - - public void StopService() - { - Console.WriteLine(" Stopping Service..."); - _service.Close(); - Console.WriteLine("[DONE]"); - } - - public IUpperCase StartClient(Binding binding) - { - IUpperCase res = null; - try - { - Console.WriteLine(" Starting Client..."); - fac = new ChannelFactory<IUpperCase>(binding, "soap.amqp:///UpperCase"); - fac.Open(); - res = fac.CreateChannel(); - Console.WriteLine("[DONE]"); - } - catch (Exception e) - { - Console.WriteLine(e); - } - return res; - } - - public void StopClient(IUpperCase client) - { - Console.WriteLine(" Stopping Client..."); - ((IChannel) client).Close(); - fac.Close(); - Console.WriteLine("[DONE]"); - } - - private static void Main(string[] args) - { - var p = new Program(); - - Binding binding = new QpidBinding("192.168.1.14", 5673); - p.StartService(binding); - - - IUpperCase calc = p.StartClient(new QpidBinding("192.168.1.14", 5673)); - - string[] messages = {"Twas brillig, and the slithy toves", - "Did gire and gymble in the wabe. ", - "All mimsy were the borogroves, ", - "And the mome raths outgrabe. "}; - foreach (string m in messages) - { - Console.Write(m + " --UperCase--> " ); - Console.Write(calc.ToUpperCase(m)); - Console.WriteLine(); - } - - Console.ReadLine(); - - p.StopClient(calc); - p.StopService(); - } - } -} diff --git a/dotnet/client-010/wcf/demo/wcfRPC/Properties/AssemblyInfo.cs b/dotnet/client-010/wcf/demo/wcfRPC/Properties/AssemblyInfo.cs deleted file mode 100644 index 703fb9fcea..0000000000 --- a/dotnet/client-010/wcf/demo/wcfRPC/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,57 +0,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. - * - */ - -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("Qpid WCF UpperCase")] -[assembly: AssemblyDescription("Built from svn revision number: ")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("Apache Software Foundation")] -[assembly: AssemblyProduct("Qpid WCF UpperCase")] -[assembly: AssemblyCopyright("Apache Software Foundation")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("14ba3707-3fcc-4033-8bbc-0db65c5424f3")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Build and Revision Numbers -// by using the '*' as shown below: -// [assembly: AssemblyVersion("0.5.0.0")] -[assembly: AssemblyVersion("0.5.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/dotnet/client-010/wcf/demo/wcfRPC/QpidBindingConfigurationElement.cs b/dotnet/client-010/wcf/demo/wcfRPC/QpidBindingConfigurationElement.cs deleted file mode 100644 index 1d12868497..0000000000 --- a/dotnet/client-010/wcf/demo/wcfRPC/QpidBindingConfigurationElement.cs +++ /dev/null @@ -1,205 +0,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. -* -*/ - -using System; -using System.Reflection; -using System.ServiceModel.Channels; -using System.ServiceModel.Configuration; -using System.Configuration; - -namespace org.apache.qpid.wcf.model -{ - - /// <remarks> - /// This configuration element should be imported into the client - /// and server configuration files to provide declarative configuration - /// of a AMQP bound service. - /// </remarks> - public sealed class QpidBindingConfigurationElement : StandardBindingElement - { - /// <summary> - /// Creates a new instance of the QpidBindingConfigurationElement - /// Class initialized with values from the specified configuration. - /// </summary> - /// <param name="configurationName"></param> - public QpidBindingConfigurationElement(string configurationName) - : base(configurationName) - { - } - - /// <summary> - /// Creates a new instance of the RabbitMQBindingConfigurationElement Class. - /// </summary> - public QpidBindingConfigurationElement() - : this(null) - { - } - - - protected override void InitializeFrom(Binding binding) - { - base.InitializeFrom(binding); - QpidBinding qpidbinding = binding as QpidBinding; - if (qpidbinding != null) - { - Host = qpidbinding.Host; - OneWayOnly = qpidbinding.OneWayOnly; - TransactionFlowEnabled = qpidbinding.TransactionFlow; - VirtualHost = qpidbinding.VirtualHost; - PortNumber = qpidbinding.PortNumber; - UserName = qpidbinding.UserName; - Password = qpidbinding.Password; - } - } - - protected override void OnApplyConfiguration(Binding binding) - { - if (binding == null) - throw new ArgumentNullException("binding"); - - var qpidbinding = binding as QpidBinding; - if (qpidbinding == null) - { - throw new ArgumentException( - string.Format("Invalid type for binding. Expected {0}, Passed: {1}", - typeof(QpidBinding).AssemblyQualifiedName, - binding.GetType().AssemblyQualifiedName)); - } - - qpidbinding.Host = Host; - qpidbinding.OneWayOnly = OneWayOnly; - qpidbinding.TransactionFlow = TransactionFlowEnabled; - qpidbinding.Password = Password; - qpidbinding.UserName = UserName; - qpidbinding.VirtualHost = VirtualHost; - qpidbinding.PortNumber = PortNumber; - } - - - /// <summary> - /// Specifies the host that the binding should connect to. - /// </summary> - [ConfigurationProperty("host", DefaultValue = "localhost")] - public string Host - { - get { return ((string) base["host"]); } - set { base["host"] = value; } - } - - /// <summary> - /// Specifies the broker port number that the binding should connect to. - /// </summary> - [ConfigurationProperty("port", DefaultValue = "5672")] - public int PortNumber - { - get { return (Convert.ToInt16(base["port"])); } - set { base["port"] = value; } - } - - - /// <summary> - /// Specifies whether or not the CompositeDuplex and ReliableSession - /// binding elements are added to the channel stack. - /// </summary> - [ConfigurationProperty("oneWay", DefaultValue = false)] - public bool OneWayOnly - { - get { return ((bool)base["oneWay"]); } - set { base["oneWay"] = value; } - } - - /// <summary> - /// Password to use when authenticating with the broker - /// </summary> - [ConfigurationProperty("password", DefaultValue = "guest")] - public string Password - { - get { return ((string)base["password"]); } - set { base["password"] = value; } - } - - /// <summary> - /// Specifies whether or not WS-AtomicTransactions are supported by the binding - /// </summary> - [ConfigurationProperty("transactionFlow", DefaultValue = false)] - public bool TransactionFlowEnabled - { - get { return ((bool)base["transactionFlow"]); } - set { base["transactionFlow"] = value; } - } - - /// <summary> - /// The username to use when authenticating with the broker - /// </summary> - [ConfigurationProperty("username", DefaultValue = "guest")] - public string UserName - { - get { return ((string)base["username"]); } - set { base["username"] = value; } - } - - - - - /// <summary> - /// The virtual host to access. - /// </summary> - [ConfigurationProperty("virtualHost", DefaultValue = "test")] - public string VirtualHost - { - get { return ((string)base["virtualHost"]); } - set { base["virtualHost"] = value; } - } - - ///<summary>The security realm to use when calling IModel.AccessRequest</summary> - [ConfigurationProperty("realm", DefaultValue = "plain")] - public string Realm - { - get { return ((string)base["realm"]); } - set { base["realm"] = value; } - } - - protected override Type BindingElementType - { - get { return typeof(QpidBinding); } - } - - protected override ConfigurationPropertyCollection Properties - { - get - { - ConfigurationPropertyCollection configProperties = base.Properties; - foreach (PropertyInfo prop in this.GetType().GetProperties(BindingFlags.DeclaredOnly - | BindingFlags.Public - | BindingFlags.Instance)) - { - foreach (ConfigurationPropertyAttribute attr in prop.GetCustomAttributes(typeof(ConfigurationPropertyAttribute), false)) - { - configProperties.Add( - new ConfigurationProperty(attr.Name, prop.PropertyType, attr.DefaultValue)); - } - } - - return configProperties; - } - } - } -} diff --git a/dotnet/client-010/wcf/demo/wcfRPC/UpperCase.cs b/dotnet/client-010/wcf/demo/wcfRPC/UpperCase.cs deleted file mode 100644 index 3e10926be4..0000000000 --- a/dotnet/client-010/wcf/demo/wcfRPC/UpperCase.cs +++ /dev/null @@ -1,33 +0,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. -* -*/ -using System.ServiceModel; - -namespace org.apache.qpid.wcf.demo.rpc -{ - [ServiceBehavior(InstanceContextMode = InstanceContextMode.PerCall)] - public sealed class UpperCase : IUpperCase - { - public string ToUpperCase(string message) - { - return message.ToUpper(); - } - } -} diff --git a/dotnet/client-010/wcf/demo/wcfRPC/wcfRPC.csproj b/dotnet/client-010/wcf/demo/wcfRPC/wcfRPC.csproj deleted file mode 100644 index e8f7fee8f5..0000000000 --- a/dotnet/client-010/wcf/demo/wcfRPC/wcfRPC.csproj +++ /dev/null @@ -1,93 +0,0 @@ -<?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. - - - --> -<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.30729</ProductVersion> - <SchemaVersion>2.0</SchemaVersion> - <ProjectGuid>{C988F456-1025-486F-9BCD-49C0F83B91DB}</ProjectGuid> - <OutputType>Exe</OutputType> - <AppDesignerFolder>Properties</AppDesignerFolder> - <RootNamespace>wcfRPC</RootNamespace> - <AssemblyName>Qpid WCF UpperCase</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> - </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> - </PropertyGroup> - <ItemGroup> - <Reference Include="System" /> - <Reference Include="System.configuration" /> - <Reference Include="System.Core"> - <RequiredTargetFramework>3.5</RequiredTargetFramework> - </Reference> - <Reference Include="System.Drawing" /> - <Reference Include="System.ServiceModel"> - <RequiredTargetFramework>3.0</RequiredTargetFramework> - </Reference> - <Reference Include="System.Windows.Forms" /> - <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="IUpperCase.cs" /> - <Compile Include="Program.cs" /> - <Compile Include="Properties\AssemblyInfo.cs" /> - <Compile Include="UpperCase.cs" /> - </ItemGroup> - <ItemGroup> - <ProjectReference Include="..\..\wcf.csproj"> - <Project>{F1D80D9D-FE22-4213-A760-BFFDE7D131DD}</Project> - <Name>wcf</Name> - </ProjectReference> - </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 |