http://git-wip-us.apache.org/repos/asf/juddi/blob/0833b028/juddi-client.net/juddi-client.net/juddi-client.net.csproj ---------------------------------------------------------------------- diff --git a/juddi-client.net/juddi-client.net/juddi-client.net.csproj b/juddi-client.net/juddi-client.net/juddi-client.net.csproj index 448e6ee..43f080f 100644 --- a/juddi-client.net/juddi-client.net/juddi-client.net.csproj +++ b/juddi-client.net/juddi-client.net/juddi-client.net.csproj @@ -1,132 +1,152 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" /> - <PropertyGroup> - <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> - <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> - <ProjectGuid>{C3D005CD-6C26-49FD-A4D8-08699B66AF6F}</ProjectGuid> - <OutputType>Library</OutputType> - <AppDesignerFolder>Properties</AppDesignerFolder> - <RootNamespace>org.apache.juddi.client</RootNamespace> - <AssemblyName>juddi-dotnet-client</AssemblyName> - <TargetFrameworkVersion>v3.5</TargetFrameworkVersion> - <FileAlignment>512</FileAlignment> - <TargetFrameworkProfile /> - </PropertyGroup> - <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> - <DebugSymbols>true</DebugSymbols> - <DebugType>full</DebugType> - <Optimize>true</Optimize> - <OutputPath>bin\Debug\</OutputPath> - <DefineConstants>DEBUG;TRACE</DefineConstants> - <ErrorReport>prompt</ErrorReport> - <WarningLevel>4</WarningLevel> - <RunCodeAnalysis>true</RunCodeAnalysis> - <DocumentationFile>bin\Debug\juddi-dotnet-client.XML</DocumentationFile> - </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.Core" /> - <Reference Include="System.configuration" /> - <Reference Include="System.Runtime.Serialization" /> - <Reference Include="System.Security" /> - <Reference Include="System.ServiceModel" /> - <Reference Include="System.Web.Services" /> - <Reference Include="System.Data" /> - <Reference Include="System.Xml" /> - </ItemGroup> - <ItemGroup> - <Compile Include="bindings\datamodel.cs" /> - <Compile Include="bindings\events.cs" /> - <Compile Include="bindings\ext.cs" /> - <Compile Include="bindings\JUDDIApiService.cs" /> - <Compile Include="bindings\UDDIv2_Service.cs" /> - <Compile Include="org.apache.juddi.jaxb\PrintJUDDI.cs" /> - <Compile Include="org.apache.juddi.jaxb\PrintUDDI.cs" /> - <Compile Include="org.apache.juddi.v3.client.annotations\AnnotationProcessor.cs" /> - <Compile Include="org.apache.juddi.v3.client.annotations\UDDIService.cs" /> - <Compile Include="org.apache.juddi.v3.client.annotations\UDDIServiceBinding.cs" /> - <Compile Include="org.apache.juddi.v3.client.config\BackgroundRegistration.cs" /> - <Compile Include="org.apache.juddi.v3.client.config\ClientConfig.cs" /> - <Compile Include="org.apache.juddi.v3.client.config\Properties.cs" /> - <Compile Include="org.apache.juddi.v3.client.config\Property.cs" /> - <Compile Include="org.apache.juddi.v3.client.config\TokenResolver.cs" /> - <Compile Include="org.apache.juddi.v3.client.config\uddi-client-ext.cs" /> - <Compile Include="org.apache.juddi.v3.client.config\uddi-client.cs" /> - <Compile Include="org.apache.juddi.v3.client.config\UDDIClerk.cs" /> - <Compile Include="org.apache.juddi.v3.client.config\UDDIKeyConvention.cs" /> - <Compile Include="org.apache.juddi.v3.client.config\UDDINode.cs" /> - <Compile Include="org.apache.juddi.v3.client.config\XmlConfiguration.cs" /> - <Compile Include="org.apache.juddi.v3.client.config\XRegistration.cs" /> - <Compile Include="org.apache.juddi.v3.client.cryptor\AES128Cryptor.cs" /> - <Compile Include="org.apache.juddi.v3.client.cryptor\AES256Cryptor.cs" /> - <Compile Include="org.apache.juddi.v3.client.cryptor\AESCryptor.cs" /> - <Compile Include="org.apache.juddi.v3.client.cryptor\Cryptor.cs" /> - <Compile Include="org.apache.juddi.v3.client.cryptor\CryptorFactory.cs" /> - <Compile Include="org.apache.juddi.v3.client.cryptor\DigSigUtil.cs" /> - <Compile Include="org.apache.juddi.v3.client.cryptor\TripleDESCryptor.cs" /> - <Compile Include="org.apache.juddi.v3.client.ext.wsdm\WSDMQosConstants.cs" /> - <Compile Include="org.apache.juddi.v3.client.mapping\Common2UDDI.cs" /> - <Compile Include="org.apache.juddi.v3.client.mapping\easyWsdl.cs" /> - <Compile Include="org.apache.juddi.v3.client.mapping\MapUDDIv2to3.cs" /> - <Compile Include="org.apache.juddi.v3.client.mapping\MapUDDIv3to2.cs" /> - <Compile Include="org.apache.juddi.v3.client.mapping\ServiceRegistrationResponse.cs" /> - <Compile Include="org.apache.juddi.v3.client.mapping\URLLocalizer.cs" /> - <Compile Include="org.apache.juddi.v3.client.mapping\wadl.cs" /> - <Compile Include="org.apache.juddi.v3.client.mapping\WADL2UDDI.cs" /> - <Compile Include="org.apache.juddi.v3.client.mapping\wsdl.cs" /> - <Compile Include="org.apache.juddi.v3.client.mapping\WSDL2UDDI.cs" /> - <Compile Include="org.apache.juddi.v3.client.mapping\XMLSchema.cs" /> - <Compile Include="org.apache.juddi.v3.client.subscription\ISubscriptionCallback.cs" /> - <Compile Include="org.apache.juddi.v3.client.subscription\RegistrationAbortedException.cs" /> - <Compile Include="org.apache.juddi.v3.client.subscription\ServiceAlreadyStartedException.cs" /> - <Compile Include="org.apache.juddi.v3.client.subscription\SubscriptionCallbackListener.cs" /> - <Compile Include="org.apache.juddi.v3.client.subscription\UDDISubscriptionListenerService.cs" /> - <Compile Include="org.apache.juddi.v3.client.subscription\UnableToSignException.cs" /> - <Compile Include="org.apache.juddi.v3.client.subscription\UnexpectedResponseException.cs" /> - <Compile Include="org.apache.juddi.v3.client.transport.wrapper\Inquiry3to2.cs"> - <SubType>Component</SubType> - </Compile> - <Compile Include="org.apache.juddi.v3.client.transport.wrapper\Publish3to2.cs" /> - <Compile Include="org.apache.juddi.v3.client.transport.wrapper\Security3to2.cs" /> - <Compile Include="org.apache.juddi.v3.client.transport\AspNetTransport.cs" /> - <Compile Include="org.apache.juddi.v3.client.transport\AspNetv2TranslationTransport.cs" /> - <Compile Include="org.apache.juddi.v3.client.util\TModelInstanceDetailsComparator.cs" /> - <Compile Include="org.apache.juddi.v3.client\ConsoleLogger.cs" /> - <Compile Include="org.apache.juddi.v3.client\EventLogger.cs" /> - <Compile Include="org.apache.juddi.v3.client\FileLogger.cs" /> - <Compile Include="org.apache.juddi.v3.client\Log.cs" /> - <Compile Include="org.apache.juddi.v3.client\LogFactory.cs" /> - <Compile Include="org.apache.juddi.v3.client\LogLevel.cs" /> - <Compile Include="org.apache.juddi.v3.client\Release.cs" /> - <Compile Include="org.apache.juddi.v3.client.transport\Transport.cs" /> - <Compile Include="org.apache.juddi.v3.client.config\UDDIClient.cs" /> - <Compile Include="org.apache.juddi.v3.client.config\UDDIClientContainer.cs" /> - <Compile Include="Properties\AssemblyInfo.cs" /> - <Compile Include="bindings\bindings.cs"> - <SubType>Component</SubType> - </Compile> - <Compile Include="org.apache.juddi.v3.client\UDDIConstants.cs" /> - <Compile Include="org.apache.juddi.v3.client\UDDIService.cs" /> - </ItemGroup> - <ItemGroup> - <WCFMetadata Include="Service References\" /> - </ItemGroup> - <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 +<?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="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <ProjectGuid>{C3D005CD-6C26-49FD-A4D8-08699B66AF6F}</ProjectGuid> + <OutputType>Library</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <RootNamespace>org.apache.juddi.client</RootNamespace> + <AssemblyName>juddi-dotnet-client</AssemblyName> + <TargetFrameworkVersion>v3.5</TargetFrameworkVersion> + <FileAlignment>512</FileAlignment> + <TargetFrameworkProfile /> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + <DebugSymbols>true</DebugSymbols> + <DebugType>full</DebugType> + <Optimize>true</Optimize> + <OutputPath>bin\Debug\</OutputPath> + <DefineConstants>DEBUG;TRACE</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + <RunCodeAnalysis>true</RunCodeAnalysis> + <DocumentationFile>bin\Debug\juddi-dotnet-client.XML</DocumentationFile> + </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.Core" /> + <Reference Include="System.configuration" /> + <Reference Include="System.Runtime.Serialization" /> + <Reference Include="System.Security" /> + <Reference Include="System.ServiceModel" /> + <Reference Include="System.Web.Services" /> + <Reference Include="System.Data" /> + <Reference Include="System.Xml" /> + </ItemGroup> + <ItemGroup> + <Compile Include="bindings\datamodel.cs" /> + <Compile Include="bindings\events.cs" /> + <Compile Include="bindings\ext.cs" /> + <Compile Include="bindings\JUDDIApiService.cs" /> + <Compile Include="bindings\UDDIv2_Service.cs" /> + <Compile Include="org.apache.juddi.jaxb\PrintJUDDI.cs" /> + <Compile Include="org.apache.juddi.jaxb\PrintUDDI.cs" /> + <Compile Include="org.apache.juddi.v3.client.annotations\AnnotationProcessor.cs" /> + <Compile Include="org.apache.juddi.v3.client.annotations\UDDIService.cs" /> + <Compile Include="org.apache.juddi.v3.client.annotations\UDDIServiceBinding.cs" /> + <Compile Include="org.apache.juddi.v3.client.config\BackgroundRegistration.cs" /> + <Compile Include="org.apache.juddi.v3.client.config\ClientConfig.cs" /> + <Compile Include="org.apache.juddi.v3.client.config\Properties.cs" /> + <Compile Include="org.apache.juddi.v3.client.config\Property.cs" /> + <Compile Include="org.apache.juddi.v3.client.config\TokenResolver.cs" /> + <Compile Include="org.apache.juddi.v3.client.config\uddi-client-ext.cs" /> + <Compile Include="org.apache.juddi.v3.client.config\uddi-client.cs" /> + <Compile Include="org.apache.juddi.v3.client.config\UDDIClerk.cs" /> + <Compile Include="org.apache.juddi.v3.client.config\UDDIKeyConvention.cs" /> + <Compile Include="org.apache.juddi.v3.client.config\UDDINode.cs" /> + <Compile Include="org.apache.juddi.v3.client.config\XmlConfiguration.cs" /> + <Compile Include="org.apache.juddi.v3.client.config\XRegistration.cs" /> + <Compile Include="org.apache.juddi.v3.client.cryptor\AES128Cryptor.cs" /> + <Compile Include="org.apache.juddi.v3.client.cryptor\AES256Cryptor.cs" /> + <Compile Include="org.apache.juddi.v3.client.cryptor\AESCryptor.cs" /> + <Compile Include="org.apache.juddi.v3.client.cryptor\Cryptor.cs" /> + <Compile Include="org.apache.juddi.v3.client.cryptor\CryptorFactory.cs" /> + <Compile Include="org.apache.juddi.v3.client.cryptor\DigSigUtil.cs" /> + <Compile Include="org.apache.juddi.v3.client.cryptor\TripleDESCryptor.cs" /> + <Compile Include="org.apache.juddi.v3.client.ext.wsdm\WSDMQosConstants.cs" /> + <Compile Include="org.apache.juddi.v3.client.mapping\Common2UDDI.cs" /> + <Compile Include="org.apache.juddi.v3.client.mapping\easyWsdl.cs" /> + <Compile Include="org.apache.juddi.v3.client.mapping\MapUDDIv2to3.cs" /> + <Compile Include="org.apache.juddi.v3.client.mapping\MapUDDIv3to2.cs" /> + <Compile Include="org.apache.juddi.v3.client.mapping\ServiceRegistrationResponse.cs" /> + <Compile Include="org.apache.juddi.v3.client.mapping\URLLocalizer.cs" /> + <Compile Include="org.apache.juddi.v3.client.mapping\wadl.cs" /> + <Compile Include="org.apache.juddi.v3.client.mapping\WADL2UDDI.cs" /> + <Compile Include="org.apache.juddi.v3.client.mapping\wsdl.cs" /> + <Compile Include="org.apache.juddi.v3.client.mapping\WSDL2UDDI.cs" /> + <Compile Include="org.apache.juddi.v3.client.mapping\XMLSchema.cs" /> + <Compile Include="org.apache.juddi.v3.client.subscription\ISubscriptionCallback.cs" /> + <Compile Include="org.apache.juddi.v3.client.subscription\RegistrationAbortedException.cs" /> + <Compile Include="org.apache.juddi.v3.client.subscription\ServiceAlreadyStartedException.cs" /> + <Compile Include="org.apache.juddi.v3.client.subscription\SubscriptionCallbackListener.cs" /> + <Compile Include="org.apache.juddi.v3.client.subscription\UDDISubscriptionListenerService.cs" /> + <Compile Include="org.apache.juddi.v3.client.subscription\UnableToSignException.cs" /> + <Compile Include="org.apache.juddi.v3.client.subscription\UnexpectedResponseException.cs" /> + <Compile Include="org.apache.juddi.v3.client.transport.wrapper\Inquiry3to2.cs"> + <SubType>Component</SubType> + </Compile> + <Compile Include="org.apache.juddi.v3.client.transport.wrapper\Publish3to2.cs" /> + <Compile Include="org.apache.juddi.v3.client.transport.wrapper\Security3to2.cs" /> + <Compile Include="org.apache.juddi.v3.client.transport\AspNetTransport.cs" /> + <Compile Include="org.apache.juddi.v3.client.transport\AspNetv2TranslationTransport.cs" /> + <Compile Include="org.apache.juddi.v3.client.util\TModelInstanceDetailsComparator.cs" /> + <Compile Include="org.apache.juddi.v3.client\ConsoleLogger.cs" /> + <Compile Include="org.apache.juddi.v3.client\EventLogger.cs" /> + <Compile Include="org.apache.juddi.v3.client\FileLogger.cs" /> + <Compile Include="org.apache.juddi.v3.client\Log.cs" /> + <Compile Include="org.apache.juddi.v3.client\LogFactory.cs" /> + <Compile Include="org.apache.juddi.v3.client\LogLevel.cs" /> + <Compile Include="org.apache.juddi.v3.client\Release.cs" /> + <Compile Include="org.apache.juddi.v3.client.transport\Transport.cs" /> + <Compile Include="org.apache.juddi.v3.client.config\UDDIClient.cs" /> + <Compile Include="org.apache.juddi.v3.client.config\UDDIClientContainer.cs" /> + <Compile Include="Properties\AssemblyInfo.cs" /> + <Compile Include="bindings\bindings.cs"> + <SubType>Component</SubType> + </Compile> + <Compile Include="org.apache.juddi.v3.client\UDDIConstants.cs" /> + <Compile Include="org.apache.juddi.v3.client\UDDIService.cs" /> + </ItemGroup> + <ItemGroup> + <WCFMetadata Include="Service References\" /> + </ItemGroup> + <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>
http://git-wip-us.apache.org/repos/asf/juddi/blob/0833b028/juddi-client.net/juddi-client.net/org.apache.juddi.v3.client.annotations/AnnotationProcessor.cs ---------------------------------------------------------------------- diff --git a/juddi-client.net/juddi-client.net/org.apache.juddi.v3.client.annotations/AnnotationProcessor.cs b/juddi-client.net/juddi-client.net/org.apache.juddi.v3.client.annotations/AnnotationProcessor.cs index c07008e..f70c015 100644 --- a/juddi-client.net/juddi-client.net/org.apache.juddi.v3.client.annotations/AnnotationProcessor.cs +++ b/juddi-client.net/juddi-client.net/org.apache.juddi.v3.client.annotations/AnnotationProcessor.cs @@ -1,241 +1,260 @@ -using org.apache.juddi.v3.client.annotations; -using org.apache.juddi.v3.client.log; -using org.uddi.apiv3; -using System; -using System.Collections.Generic; - -using System.Text; -using System.Web.Services; - -namespace org.apache.juddi.v3.client.config -{ - class AnnotationProcessor - { - static Log log = LogFactory.getLog(typeof(AnnotationProcessor)); - private static readonly String KEYED_REFERENCE = "keyedReference="; - private static readonly String KEY_NAME = "keyName="; - private static readonly String KEY_VALUE = "keyValue="; - private static readonly String TMODEL_KEY = "tModelKey="; - - public List<businessService> readServiceAnnotations(string[] classes, Properties properties) - { - List<businessService> items = new List<businessService>(); - - if (classes != null) - { - foreach (string s in classes) - { - businessService b = readServiceAnnotations(s, properties); - if (b != null) - items.Add(b); - } - - } - return items; - - } - - public businessService readServiceAnnotations(String classWithAnnotations, Properties properties) - { - - Type t = Type.GetType(classWithAnnotations, false, true); - if (t != null) - { - businessService service = new businessService(); - object[] attrib = t.GetCustomAttributes(typeof(UDDIService), true); - - object[] ws = t.GetCustomAttributes(typeof(System.Web.Services.WebServiceBindingAttribute), true); - WebServiceBindingAttribute webServiceAnnotation = null; - if (ws != null && ws.Length > 0) - { - webServiceAnnotation = ((WebServiceBindingAttribute[])ws)[0]; - } - if (attrib != null && attrib.Length > 0) - { - - UDDIService[] bits = attrib as UDDIService[]; - UDDIService uddiService = bits[0]; - name n = new name(); - n.lang = uddiService.lang; - service.businessKey = (TokenResolver.replaceTokens(uddiService.businessKey, properties)); - service.serviceKey = (TokenResolver.replaceTokens(uddiService.serviceKey, properties)); - if (!"".Equals(uddiService.serviceName, StringComparison.CurrentCultureIgnoreCase)) - { - n.Value = (TokenResolver.replaceTokens(uddiService.serviceName, properties)); - } - else if (webServiceAnnotation != null && !"".Equals(webServiceAnnotation.Name)) - { - n.Value = (webServiceAnnotation.Name); - } - else - { - n.Value = (classWithAnnotations); - } - service.name = new name[] { n }; - description d = new description(); - d.lang = (uddiService.lang); - d.Value = (TokenResolver.replaceTokens(uddiService.description, properties)); - service.description = new description[] { d }; - - //categoryBag on the service - if (!"".Equals(uddiService.categoryBag)) - { - categoryBag categoryBag = parseCategoryBag(uddiService.categoryBag); - service.categoryBag = (categoryBag); - } - - //bindingTemplate on service - bindingTemplate bindingTemplate = parseServiceBinding(classWithAnnotations, uddiService.lang, webServiceAnnotation, properties); - if (bindingTemplate != null) - { - bindingTemplate.serviceKey = (service.serviceKey); - if (service.bindingTemplates == null) - { - service.bindingTemplates = new bindingTemplate[] { bindingTemplate }; - } - else - { - List<bindingTemplate> l = new List<bindingTemplate>(); - l.AddRange(service.bindingTemplates); - l.Add(bindingTemplate); - service.bindingTemplates = l.ToArray(); - } - } - - return service; - } - else - { - log.error("Missing UDDIService annotation in class " + classWithAnnotations); - } - } - log.error("Unable to load type " + classWithAnnotations); - return null; - - } - - - - private bindingTemplate parseServiceBinding(string classWithAnnotations, string lang, WebServiceBindingAttribute webServiceAnnotation, Properties properties) - { - - bindingTemplate bindingTemplate = null; - Type t = Type.GetType(classWithAnnotations, false, false); - UDDIServiceBinding uddiServiceBinding = null; - object[] attrib = t.GetCustomAttributes(typeof(UDDIServiceBinding), true); - if (attrib != null && attrib.Length > 0) - uddiServiceBinding = attrib[0] as UDDIServiceBinding; - - //= (UDDIServiceBinding) classWithAnnotations.getAnnotation(UDDIServiceBinding.class); - //binding - if (uddiServiceBinding != null) - { - bindingTemplate = new bindingTemplate(); - - bindingTemplate.bindingKey = (TokenResolver.replaceTokens(uddiServiceBinding.bindingKey, properties)); - - String bindingLang = (lang); - if (uddiServiceBinding.lang != null) - { - bindingLang = TokenResolver.replaceTokens(uddiServiceBinding.lang, properties); - } - description bindingDescription = new description(); - bindingDescription.lang = (bindingLang); - bindingDescription.Value = (TokenResolver.replaceTokens(uddiServiceBinding.description, properties)); - bindingTemplate.description = new description[] { (bindingDescription) }; - - accessPoint accessPoint = new accessPoint(); - accessPoint.useType = (AccessPointType.wsdlDeployment.ToString()); - if (!"".Equals(uddiServiceBinding.accessPointType)) - { - accessPoint.useType = (uddiServiceBinding.accessPointType); - } - if (!"".Equals(uddiServiceBinding.accessPoint)) - { - String endPoint = uddiServiceBinding.accessPoint; - endPoint = TokenResolver.replaceTokens(endPoint, properties); - log.debug("AccessPoint EndPoint=" + endPoint); - accessPoint.Value = (endPoint); - } - else if (webServiceAnnotation != null && webServiceAnnotation.Location != null) - { - accessPoint.Value = (webServiceAnnotation.Location); - } - bindingTemplate.Item = (accessPoint); - - //tModelKeys on the binding - if (!"".Equals(uddiServiceBinding.tModelKeys)) - { - String[] tModelKeys = uddiServiceBinding.tModelKeys.Split(','); - foreach (String tModelKey in tModelKeys) - { - tModelInstanceInfo instanceInfo = new tModelInstanceInfo(); - instanceInfo.tModelKey = (tModelKey); - if (bindingTemplate.tModelInstanceDetails == null) - { - bindingTemplate.tModelInstanceDetails = (new tModelInstanceInfo[] { instanceInfo }); - } - List<tModelInstanceInfo> l = new List<tModelInstanceInfo>(); - l.AddRange(bindingTemplate.tModelInstanceDetails); - l.Add(instanceInfo); - bindingTemplate.tModelInstanceDetails = l.ToArray(); - - } - } - //categoryBag on the binding - if (!"".Equals(uddiServiceBinding.categoryBag)) - { - categoryBag categoryBag = parseCategoryBag(uddiServiceBinding.categoryBag); - bindingTemplate.categoryBag = (categoryBag); - } - } - else - { - log.error("Missing UDDIServiceBinding annotation in class " + classWithAnnotations); - } - return bindingTemplate; - } - - private categoryBag parseCategoryBag(string categoryBagStr) - { - - categoryBag cb = new categoryBag(); - log.debug("CategoryBag Annotation=" + cb); - if (!"".Equals(categoryBagStr)) - { - List<keyedReference> cbs = new List<keyedReference>(); - String[] sections = categoryBagStr.Split(','); - foreach (String section in sections) - { - if (section.StartsWith(KEYED_REFERENCE)) - { - String keyedReferenceStr = section.Substring(KEYED_REFERENCE.Length, section.Length); - log.debug("Found KeyedReference=" + keyedReferenceStr); - String[] keyedReferences = keyedReferenceStr.Split(';'); - keyedReference keyedReference = new keyedReference(); - foreach (String key in keyedReferences) - { - if (key.StartsWith(KEY_NAME)) keyedReference.keyName = (key.Substring(KEY_NAME.Length, key.Length)); - if (key.StartsWith(KEY_VALUE)) keyedReference.keyValue = (key.Substring(KEY_VALUE.Length, key.Length)); - if (key.StartsWith(TMODEL_KEY)) keyedReference.tModelKey = (key.Substring(TMODEL_KEY.Length, key.Length)); - } - log.debug("KeyedReference = " + KEY_NAME + keyedReference.keyName + " " - + KEY_VALUE + keyedReference.keyValue + " " - + TMODEL_KEY + keyedReference.tModelKey); - cbs.Add(keyedReference); - } - else - { - log.warn("Ignoring " + section); - //TODO add support for KeyedReferenceGroups? - } - } - cb.Items = cbs.ToArray(); - } - return cb; - } - } -} - - - +/* + * 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 org.apache.juddi.v3.client.annotations; +using org.apache.juddi.v3.client.log; +using org.uddi.apiv3; +using System; +using System.Collections.Generic; + +using System.Text; +using System.Web.Services; + +namespace org.apache.juddi.v3.client.config +{ + class AnnotationProcessor + { + static Log log = LogFactory.getLog(typeof(AnnotationProcessor)); + private static readonly String KEYED_REFERENCE = "keyedReference="; + private static readonly String KEY_NAME = "keyName="; + private static readonly String KEY_VALUE = "keyValue="; + private static readonly String TMODEL_KEY = "tModelKey="; + + public List<businessService> readServiceAnnotations(string[] classes, Properties properties) + { + List<businessService> items = new List<businessService>(); + + if (classes != null) + { + foreach (string s in classes) + { + businessService b = readServiceAnnotations(s, properties); + if (b != null) + items.Add(b); + } + + } + return items; + + } + + public businessService readServiceAnnotations(String classWithAnnotations, Properties properties) + { + + Type t = Type.GetType(classWithAnnotations, false, true); + if (t != null) + { + businessService service = new businessService(); + object[] attrib = t.GetCustomAttributes(typeof(UDDIService), true); + + object[] ws = t.GetCustomAttributes(typeof(System.Web.Services.WebServiceBindingAttribute), true); + WebServiceBindingAttribute webServiceAnnotation = null; + if (ws != null && ws.Length > 0) + { + webServiceAnnotation = ((WebServiceBindingAttribute[])ws)[0]; + } + if (attrib != null && attrib.Length > 0) + { + + UDDIService[] bits = attrib as UDDIService[]; + UDDIService uddiService = bits[0]; + name n = new name(); + n.lang = uddiService.lang; + service.businessKey = (TokenResolver.replaceTokens(uddiService.businessKey, properties)); + service.serviceKey = (TokenResolver.replaceTokens(uddiService.serviceKey, properties)); + if (!"".Equals(uddiService.serviceName, StringComparison.CurrentCultureIgnoreCase)) + { + n.Value = (TokenResolver.replaceTokens(uddiService.serviceName, properties)); + } + else if (webServiceAnnotation != null && !"".Equals(webServiceAnnotation.Name)) + { + n.Value = (webServiceAnnotation.Name); + } + else + { + n.Value = (classWithAnnotations); + } + service.name = new name[] { n }; + description d = new description(); + d.lang = (uddiService.lang); + d.Value = (TokenResolver.replaceTokens(uddiService.description, properties)); + service.description = new description[] { d }; + + //categoryBag on the service + if (!"".Equals(uddiService.categoryBag)) + { + categoryBag categoryBag = parseCategoryBag(uddiService.categoryBag); + service.categoryBag = (categoryBag); + } + + //bindingTemplate on service + bindingTemplate bindingTemplate = parseServiceBinding(classWithAnnotations, uddiService.lang, webServiceAnnotation, properties); + if (bindingTemplate != null) + { + bindingTemplate.serviceKey = (service.serviceKey); + if (service.bindingTemplates == null) + { + service.bindingTemplates = new bindingTemplate[] { bindingTemplate }; + } + else + { + List<bindingTemplate> l = new List<bindingTemplate>(); + l.AddRange(service.bindingTemplates); + l.Add(bindingTemplate); + service.bindingTemplates = l.ToArray(); + } + } + + return service; + } + else + { + log.error("Missing UDDIService annotation in class " + classWithAnnotations); + } + } + log.error("Unable to load type " + classWithAnnotations); + return null; + + } + + + + private bindingTemplate parseServiceBinding(string classWithAnnotations, string lang, WebServiceBindingAttribute webServiceAnnotation, Properties properties) + { + + bindingTemplate bindingTemplate = null; + Type t = Type.GetType(classWithAnnotations, false, false); + UDDIServiceBinding uddiServiceBinding = null; + object[] attrib = t.GetCustomAttributes(typeof(UDDIServiceBinding), true); + if (attrib != null && attrib.Length > 0) + uddiServiceBinding = attrib[0] as UDDIServiceBinding; + + //= (UDDIServiceBinding) classWithAnnotations.getAnnotation(UDDIServiceBinding.class); + //binding + if (uddiServiceBinding != null) + { + bindingTemplate = new bindingTemplate(); + + bindingTemplate.bindingKey = (TokenResolver.replaceTokens(uddiServiceBinding.bindingKey, properties)); + + String bindingLang = (lang); + if (uddiServiceBinding.lang != null) + { + bindingLang = TokenResolver.replaceTokens(uddiServiceBinding.lang, properties); + } + description bindingDescription = new description(); + bindingDescription.lang = (bindingLang); + bindingDescription.Value = (TokenResolver.replaceTokens(uddiServiceBinding.description, properties)); + bindingTemplate.description = new description[] { (bindingDescription) }; + + accessPoint accessPoint = new accessPoint(); + accessPoint.useType = (AccessPointType.wsdlDeployment.ToString()); + if (!"".Equals(uddiServiceBinding.accessPointType)) + { + accessPoint.useType = (uddiServiceBinding.accessPointType); + } + if (!"".Equals(uddiServiceBinding.accessPoint)) + { + String endPoint = uddiServiceBinding.accessPoint; + endPoint = TokenResolver.replaceTokens(endPoint, properties); + log.debug("AccessPoint EndPoint=" + endPoint); + accessPoint.Value = (endPoint); + } + else if (webServiceAnnotation != null && webServiceAnnotation.Location != null) + { + accessPoint.Value = (webServiceAnnotation.Location); + } + bindingTemplate.Item = (accessPoint); + + //tModelKeys on the binding + if (!"".Equals(uddiServiceBinding.tModelKeys)) + { + String[] tModelKeys = uddiServiceBinding.tModelKeys.Split(','); + foreach (String tModelKey in tModelKeys) + { + tModelInstanceInfo instanceInfo = new tModelInstanceInfo(); + instanceInfo.tModelKey = (tModelKey); + if (bindingTemplate.tModelInstanceDetails == null) + { + bindingTemplate.tModelInstanceDetails = (new tModelInstanceInfo[] { instanceInfo }); + } + List<tModelInstanceInfo> l = new List<tModelInstanceInfo>(); + l.AddRange(bindingTemplate.tModelInstanceDetails); + l.Add(instanceInfo); + bindingTemplate.tModelInstanceDetails = l.ToArray(); + + } + } + //categoryBag on the binding + if (!"".Equals(uddiServiceBinding.categoryBag)) + { + categoryBag categoryBag = parseCategoryBag(uddiServiceBinding.categoryBag); + bindingTemplate.categoryBag = (categoryBag); + } + } + else + { + log.error("Missing UDDIServiceBinding annotation in class " + classWithAnnotations); + } + return bindingTemplate; + } + + private categoryBag parseCategoryBag(string categoryBagStr) + { + + categoryBag cb = new categoryBag(); + log.debug("CategoryBag Annotation=" + cb); + if (!"".Equals(categoryBagStr)) + { + List<keyedReference> cbs = new List<keyedReference>(); + String[] sections = categoryBagStr.Split(','); + foreach (String section in sections) + { + if (section.StartsWith(KEYED_REFERENCE)) + { + String keyedReferenceStr = section.Substring(KEYED_REFERENCE.Length, section.Length); + log.debug("Found KeyedReference=" + keyedReferenceStr); + String[] keyedReferences = keyedReferenceStr.Split(';'); + keyedReference keyedReference = new keyedReference(); + foreach (String key in keyedReferences) + { + if (key.StartsWith(KEY_NAME)) keyedReference.keyName = (key.Substring(KEY_NAME.Length, key.Length)); + if (key.StartsWith(KEY_VALUE)) keyedReference.keyValue = (key.Substring(KEY_VALUE.Length, key.Length)); + if (key.StartsWith(TMODEL_KEY)) keyedReference.tModelKey = (key.Substring(TMODEL_KEY.Length, key.Length)); + } + log.debug("KeyedReference = " + KEY_NAME + keyedReference.keyName + " " + + KEY_VALUE + keyedReference.keyValue + " " + + TMODEL_KEY + keyedReference.tModelKey); + cbs.Add(keyedReference); + } + else + { + log.warn("Ignoring " + section); + //TODO add support for KeyedReferenceGroups? + } + } + cb.Items = cbs.ToArray(); + } + return cb; + } + } +} + + + http://git-wip-us.apache.org/repos/asf/juddi/blob/0833b028/juddi-client.net/juddi-client.net/org.apache.juddi.v3.client.annotations/UDDIService.cs ---------------------------------------------------------------------- diff --git a/juddi-client.net/juddi-client.net/org.apache.juddi.v3.client.annotations/UDDIService.cs b/juddi-client.net/juddi-client.net/org.apache.juddi.v3.client.annotations/UDDIService.cs index 5a7fc39..dd0d47a 100644 --- a/juddi-client.net/juddi-client.net/org.apache.juddi.v3.client.annotations/UDDIService.cs +++ b/juddi-client.net/juddi-client.net/org.apache.juddi.v3.client.annotations/UDDIService.cs @@ -1,31 +1,50 @@ -using System; -using System.Collections.Generic; - -using System.Text; - -namespace org.apache.juddi.v3.client.annotations -{ - [System.AttributeUsage(System.AttributeTargets.Interface | System.AttributeTargets.Class, AllowMultiple = false)] - public class UDDIService : System.Attribute - { - public UDDIService() - { - this.lang = "en"; - businessKey = ""; - serviceName = ""; - categoryBag = ""; - } - /** Name of the Service, this can be omitted if one is specified in a WebService annotation */ - public String serviceName { get; set; } - /** Description of the Service */ - public String description { get; set; } - /** Unique key of this service */ - public String serviceKey { get; set; } - /** Unique key of the business to which this Service belongs. */ - public String businessKey { get; set; } - /** Language code i.e.: en, fr, nl. */ - public String lang { get; set; } - /** List of KeyedReferences */ - public String categoryBag { get; set; } - } -} +/* + * 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.Collections.Generic; + +using System.Text; + +namespace org.apache.juddi.v3.client.annotations +{ + [System.AttributeUsage(System.AttributeTargets.Interface | System.AttributeTargets.Class, AllowMultiple = false)] + public class UDDIService : System.Attribute + { + public UDDIService() + { + this.lang = "en"; + businessKey = ""; + serviceName = ""; + categoryBag = ""; + } + /** Name of the Service, this can be omitted if one is specified in a WebService annotation */ + public String serviceName { get; set; } + /** Description of the Service */ + public String description { get; set; } + /** Unique key of this service */ + public String serviceKey { get; set; } + /** Unique key of the business to which this Service belongs. */ + public String businessKey { get; set; } + /** Language code i.e.: en, fr, nl. */ + public String lang { get; set; } + /** List of KeyedReferences */ + public String categoryBag { get; set; } + } +} http://git-wip-us.apache.org/repos/asf/juddi/blob/0833b028/juddi-client.net/juddi-client.net/org.apache.juddi.v3.client.annotations/UDDIServiceBinding.cs ---------------------------------------------------------------------- diff --git a/juddi-client.net/juddi-client.net/org.apache.juddi.v3.client.annotations/UDDIServiceBinding.cs b/juddi-client.net/juddi-client.net/org.apache.juddi.v3.client.annotations/UDDIServiceBinding.cs index 8e4e004..5531803 100644 --- a/juddi-client.net/juddi-client.net/org.apache.juddi.v3.client.annotations/UDDIServiceBinding.cs +++ b/juddi-client.net/juddi-client.net/org.apache.juddi.v3.client.annotations/UDDIServiceBinding.cs @@ -1,45 +1,64 @@ -using System; -using System.Collections.Generic; - -using System.Text; - -namespace org.apache.juddi.v3.client.annotations -{ - /// <summary> - /// Use this class to annotate your services programmatically. When your server start up, you can then automatically register endpoints using - /// this mechanism. - /// </summary> - /// <see>UDDIClient.registerAnnotatedServices</see> - [System.AttributeUsage(System.AttributeTargets.Class, AllowMultiple = false)] - public class UDDIServiceBinding : System.Attribute - { - /// <summary> - /// defaults to "en" lang - /// </summary> - public UDDIServiceBinding() - { - lang = "en"; - bindingKey = ""; - description = ""; - accessPoint = ""; - tModelKeys = ""; - categoryBag = ""; - accessPointType = "wsdlDeployment"; - } - /** name which can be referenced by TModelInstanceRegistration, this key is not send - * down to the UDDI Registry. */ - public String bindingKey { get; set; } - /** Description of the ServiceBinding. */ - public String description { get; set; } - /** AccessPoint Type, which could be one of endPoint, wsdlDeployment, bindingTemplate, hostingDirector */ - public String accessPointType { get; set; } - /** The URL of the accessPoint. */ - public String accessPoint { get; set; } - /** Language code i.e.: en, fr, nl. */ - public String lang { get; set; } - /** Comma separated list of tModel Keys */ - public String tModelKeys { get; set; } - /** List of KeyedReferences */ - public String categoryBag { get; set; } - } -} +/* + * 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.Collections.Generic; + +using System.Text; + +namespace org.apache.juddi.v3.client.annotations +{ + /// <summary> + /// Use this class to annotate your services programmatically. When your server start up, you can then automatically register endpoints using + /// this mechanism. + /// </summary> + /// <see>UDDIClient.registerAnnotatedServices</see> + [System.AttributeUsage(System.AttributeTargets.Class, AllowMultiple = false)] + public class UDDIServiceBinding : System.Attribute + { + /// <summary> + /// defaults to "en" lang + /// </summary> + public UDDIServiceBinding() + { + lang = "en"; + bindingKey = ""; + description = ""; + accessPoint = ""; + tModelKeys = ""; + categoryBag = ""; + accessPointType = "wsdlDeployment"; + } + /** name which can be referenced by TModelInstanceRegistration, this key is not send + * down to the UDDI Registry. */ + public String bindingKey { get; set; } + /** Description of the ServiceBinding. */ + public String description { get; set; } + /** AccessPoint Type, which could be one of endPoint, wsdlDeployment, bindingTemplate, hostingDirector */ + public String accessPointType { get; set; } + /** The URL of the accessPoint. */ + public String accessPoint { get; set; } + /** Language code i.e.: en, fr, nl. */ + public String lang { get; set; } + /** Comma separated list of tModel Keys */ + public String tModelKeys { get; set; } + /** List of KeyedReferences */ + public String categoryBag { get; set; } + } +} --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@juddi.apache.org For additional commands, e-mail: commits-h...@juddi.apache.org