You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@juddi.apache.org by al...@apache.org on 2013/11/11 02:14:23 UTC

svn commit: r1540580 - in /juddi/trunk: juddi-client.net/juddi-client.net-sample/ juddi-client.net/juddi-client.net-sample/juddi/ juddi-client.net/juddi-client.net/ juddi-client.net/juddi-client.net/bindings/ juddi-client.net/juddi-client.net/org.apach...

Author: alexoree
Date: Mon Nov 11 01:14:22 2013
New Revision: 1540580

URL: http://svn.apache.org/r1540580
Log:
JUDDI-567 subscription callbacks added
JUDDI-703 added an extra line to log already issued auth token get requests

Added:
    juddi/trunk/juddi-client.net/juddi-client.net-sample/SubscriptionCallbackExample.cs
    juddi/trunk/juddi-client.net/juddi-client.net/org.apache.juddi.v3.client.subscription/
    juddi/trunk/juddi-client.net/juddi-client.net/org.apache.juddi.v3.client.subscription/ISubscriptionCallback.cs
    juddi/trunk/juddi-client.net/juddi-client.net/org.apache.juddi.v3.client.subscription/SubscriptionCallbackListener.cs
    juddi/trunk/juddi-client.net/juddi-client.net/org.apache.juddi.v3.client.subscription/UDDISubscriptionListenerService.cs
Modified:
    juddi/trunk/juddi-client.net/juddi-client.net-sample/App.config
    juddi/trunk/juddi-client.net/juddi-client.net-sample/Program.cs
    juddi/trunk/juddi-client.net/juddi-client.net-sample/ServiceVersioning.cs
    juddi/trunk/juddi-client.net/juddi-client.net-sample/SimpleInquiry.cs
    juddi/trunk/juddi-client.net/juddi-client.net-sample/WadlImport.cs
    juddi/trunk/juddi-client.net/juddi-client.net-sample/WsdlImport.cs
    juddi/trunk/juddi-client.net/juddi-client.net-sample/findendpoints.cs
    juddi/trunk/juddi-client.net/juddi-client.net-sample/juddi-client.net-sample-mono.csproj
    juddi/trunk/juddi-client.net/juddi-client.net-sample/juddi-client.net-sample.csproj
    juddi/trunk/juddi-client.net/juddi-client.net-sample/juddi/saveClerkExample.cs
    juddi/trunk/juddi-client.net/juddi-client.net-sample/juddi/saveNodeExample.cs
    juddi/trunk/juddi-client.net/juddi-client.net-sample/uddi.xml
    juddi/trunk/juddi-client.net/juddi-client.net/bindings/datamodel.cs
    juddi/trunk/juddi-client.net/juddi-client.net/juddi-client.net-mono.csproj
    juddi/trunk/juddi-client.net/juddi-client.net/juddi-client.net.csproj
    juddi/trunk/juddi-client.net/juddi-client.net/org.apache.juddi.v3.client.config/ClientConfig.cs
    juddi/trunk/juddi-client.net/juddi-client.net/org.apache.juddi.v3.client.config/UDDIClerk.cs
    juddi/trunk/juddi-client.net/juddi-client.net/org.apache.juddi.v3.client.crypto/DigSigUtil.cs
    juddi/trunk/juddi-core/src/main/java/org/apache/juddi/api/impl/UDDISecurityImpl.java
    juddi/trunk/juddi-gui/src/main/java/org/apache/juddi/webconsole/hub/UddiHub.java

Modified: juddi/trunk/juddi-client.net/juddi-client.net-sample/App.config
URL: http://svn.apache.org/viewvc/juddi/trunk/juddi-client.net/juddi-client.net-sample/App.config?rev=1540580&r1=1540579&r2=1540580&view=diff
==============================================================================
--- juddi/trunk/juddi-client.net/juddi-client.net-sample/App.config (original)
+++ juddi/trunk/juddi-client.net/juddi-client.net-sample/App.config Mon Nov 11 01:14:22 2013
@@ -7,4 +7,26 @@
 
     <add key="org.apache.juddi.v3.client.log.logger.file" value="pathToOutputFile" />
   </appSettings>
+
+  <system.serviceModel>
+    <bindings>
+      <basicHttpBinding>
+        <binding name="UDDISubscriptionListenerServiceSoapBinding"  ></binding>
+      </basicHttpBinding>
+    </bindings>
+   
+    <services>
+      <service
+        name="org.apache.juddi.v3.client.subscription.SubscriptionCallbackListener">
+        <endpoint
+           binding="basicHttpBinding"
+           bindingConfiguration="UDDISubscriptionListenerServiceSoapBinding"
+           bindingName="UDDISubscriptionListenerServiceSoapBinding"
+           bindingNamespace="org.apache.juddi.v3.client.subscription" 
+           contract="org.apache.juddi.v3.client.subscription.wcf.UDDI_SubscriptionListener_PortType" >
+        </endpoint>
+      
+      </service>
+    </services>
+  </system.serviceModel>
 </configuration>
\ No newline at end of file

Modified: juddi/trunk/juddi-client.net/juddi-client.net-sample/Program.cs
URL: http://svn.apache.org/viewvc/juddi/trunk/juddi-client.net/juddi-client.net-sample/Program.cs?rev=1540580&r1=1540579&r2=1540580&view=diff
==============================================================================
--- juddi/trunk/juddi-client.net/juddi-client.net-sample/Program.cs (original)
+++ juddi/trunk/juddi-client.net/juddi-client.net-sample/Program.cs Mon Nov 11 01:14:22 2013
@@ -33,6 +33,7 @@ namespace org.apache.juddi.client.sample
             Console.Out.WriteLine("6) Find_endpoints");
             Console.Out.WriteLine("7) jUDDI specific - Save Node");
             Console.Out.WriteLine("8) jUDDI specific - Save Clerk");
+            Console.Out.WriteLine("9) Subscription callbacks");
             Console.Out.Write("Enter selection> ");
             String selection = Console.In.ReadLine();
             selection = selection.Trim();
@@ -52,6 +53,8 @@ namespace org.apache.juddi.client.sample
                 saveNodeExample.main(args);
             else if (selection.Equals("8"))
                 saveClerkExample.main(args);
+            else if (selection.Equals("9"))
+                SubscriptionCallbackExample.Run(args);
             Console.WriteLine("Press any key to exit");
             Console.Read();
 

Modified: juddi/trunk/juddi-client.net/juddi-client.net-sample/ServiceVersioning.cs
URL: http://svn.apache.org/viewvc/juddi/trunk/juddi-client.net/juddi-client.net-sample/ServiceVersioning.cs?rev=1540580&r1=1540579&r2=1540580&view=diff
==============================================================================
--- juddi/trunk/juddi-client.net/juddi-client.net-sample/ServiceVersioning.cs (original)
+++ juddi/trunk/juddi-client.net/juddi-client.net-sample/ServiceVersioning.cs Mon Nov 11 01:14:22 2013
@@ -1,4 +1,20 @@
-using org.apache.juddi.v3.client;
+/*
+ * Copyright 2001-2008 The Apache Software Foundation.
+ * 
+ * Licensed 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;
 using org.apache.juddi.v3.client.config;
 using org.apache.juddi.v3.client.transport;
 using org.uddi.apiv3;
@@ -144,11 +160,11 @@ namespace org.apache.juddi.client.sample
             // create a client and read the config in the archive; 
             // you can use your config file name
             client = new UDDIClient("uddi.xml");
-            clerk = client.getClerk("default");
+            clerk = client.getClerk("default_non_root");
             // a UddiClient can be a client to multiple UDDI nodes, so 
             // supply the nodeName (defined in your uddi.xml.
             // The transport can be WS, inVM, RMI etc which is defined in the uddi.xml
-            Transport transport = client.getTransport("default");
+            Transport transport = client.getTransport("default_non_root");
             // Now you create a reference to the UDDI API
             security = transport.getUDDISecurityService();
             inquiry = transport.getUDDIInquiryService();

Modified: juddi/trunk/juddi-client.net/juddi-client.net-sample/SimpleInquiry.cs
URL: http://svn.apache.org/viewvc/juddi/trunk/juddi-client.net/juddi-client.net-sample/SimpleInquiry.cs?rev=1540580&r1=1540579&r2=1540580&view=diff
==============================================================================
--- juddi/trunk/juddi-client.net/juddi-client.net-sample/SimpleInquiry.cs (original)
+++ juddi/trunk/juddi-client.net/juddi-client.net-sample/SimpleInquiry.cs Mon Nov 11 01:14:22 2013
@@ -46,13 +46,13 @@ namespace org.apache.juddi.client.sample
                 clerkManager = new UDDIClient("uddi.xml");
                 UDDIClientContainer.addClient(clerkManager);
 
-                transport = clerkManager.getTransport("default");
+                transport = clerkManager.getTransport("default_non_root");
 
-                org.uddi.apiv3.UDDI_Security_SoapBinding security = transport.getUDDISecurityService();
-                org.uddi.apiv3.UDDI_Inquiry_SoapBinding inquiry = transport.getUDDIInquiryService();
-                org.uddi.apiv3.UDDI_Publication_SoapBinding publish = transport.getUDDIPublishService();
+                UDDI_Security_SoapBinding security = transport.getUDDISecurityService();
+                UDDI_Inquiry_SoapBinding inquiry = transport.getUDDIInquiryService();
+                UDDI_Publication_SoapBinding publish = transport.getUDDIPublishService();
 
-                clerk = clerkManager.getClerk("default");
+                clerk = clerkManager.getClerk("default_non_root");
 
 
                 find_business fb = new find_business();

Added: juddi/trunk/juddi-client.net/juddi-client.net-sample/SubscriptionCallbackExample.cs
URL: http://svn.apache.org/viewvc/juddi/trunk/juddi-client.net/juddi-client.net-sample/SubscriptionCallbackExample.cs?rev=1540580&view=auto
==============================================================================
--- juddi/trunk/juddi-client.net/juddi-client.net-sample/SubscriptionCallbackExample.cs (added)
+++ juddi/trunk/juddi-client.net/juddi-client.net-sample/SubscriptionCallbackExample.cs Mon Nov 11 01:14:22 2013
@@ -0,0 +1,127 @@
+/*
+ * Copyright 2001-2008 The Apache Software Foundation.
+ * 
+ * Licensed 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;
+using org.apache.juddi.v3.client.config;
+using org.apache.juddi.v3.client.subscription;
+using org.apache.juddi.v3.client.transport;
+using org.uddi.apiv3;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading;
+
+namespace org.apache.juddi.client.sample
+{
+    class SubscriptionCallbackExample : ISubscriptionCallback
+    {
+        public void HandleCallback(uddi.apiv3.subscriptionResultsList body)
+        {
+            Console.Out.WriteLine("HandleCallback received " + body.Item);
+        }
+
+        public void NotifyEndpointStopped()
+        {
+            Console.Out.WriteLine("NotifyEndpointStopped, Callback endpoint stopped");
+        }
+
+        public static void Run(string[] args)
+        {
+
+            UDDIClient clerkManager = null;
+            Transport transport = null;
+            UDDIClerk clerk = null;
+            try
+            {
+                clerkManager = new UDDIClient("uddi.xml");
+                UDDIClientContainer.addClient(clerkManager);
+
+                transport = clerkManager.getTransport("default_non_root");
+
+                UDDI_Security_SoapBinding security = transport.getUDDISecurityService();
+                UDDI_Inquiry_SoapBinding inquiry = transport.getUDDIInquiryService();
+                UDDI_Publication_SoapBinding publish = transport.getUDDIPublishService();
+
+                clerk = clerkManager.getClerk("default_non_root");
+
+
+                //this part just confirms that the keydomain exists for our new service and binding template
+                String keydomain = null;
+                if (clerkManager.getClientConfig().getConfiguration() != null &&
+                     clerkManager.getClientConfig().getConfiguration().client != null &&
+                     clerkManager.getClientConfig().getConfiguration().client.subscriptionCallbacks != null &&
+                     clerkManager.getClientConfig().getConfiguration().client.subscriptionCallbacks.keyDomain != null)
+                    keydomain = clerkManager.getClientConfig().getConfiguration().client.subscriptionCallbacks.keyDomain;
+                else
+                    keydomain = "uddi:org.apache.demos";
+                tModel createKeyGenator = UDDIClerk.createKeyGenator(keydomain + ":keygenerator", "Test domain", "en");
+                clerk.register(createKeyGenator);
+
+                //we'll also create a business and a service here so that we can hook in our callback endpoint
+                businessEntity be = new businessEntity();
+                
+                be.businessKey = keydomain + ":coolbizexample";
+                be.name = new name[] { new name("Coolbiz Inc", "en") };
+                be.businessServices = new businessService[] { new businessService() };
+                be.businessServices[0].businessKey = keydomain + ":coolbizexample";
+                be.businessServices[0].serviceKey = keydomain + ":coolbizexample-service";
+                be.businessServices[0].name = new name[] { new name("Coolbiz Service", "en") };
+                clerk.register(be);
+
+
+                bindingTemplate start = SubscriptionCallbackListener.start(clerkManager, "default_non_root");
+                Console.WriteLine("Started and waiting for inbound traffic");
+                //bkeep alive
+                DateTime stop = DateTime.Now.Add(new TimeSpan(0, 0, 10));
+                while (DateTime.Now < stop)
+                {
+                    Thread.Sleep(1000);
+                }
+                Console.WriteLine("Stopping");
+                SubscriptionCallbackListener.stop(clerkManager, "default_non_root", start.bindingKey);
+
+                //get rid of it once we're done
+                clerk.unRegisterBusiness(keydomain + ":coolbizexample");
+                clerk.unRegisterTModel(createKeyGenator.tModelKey);
+            }
+            catch (Exception ex)
+            {
+                while (ex != null)
+                {
+                    System.Console.WriteLine("Error! " + ex.Message);
+                    ex = ex.InnerException;
+                }
+            }
+            finally
+            {
+                if (transport != null && transport is IDisposable)
+                {
+                    ((IDisposable)transport).Dispose();
+                }
+                if (clerk != null)
+                    clerk.Dispose();
+            }
+
+
+
+
+        }
+
+
+    }
+}

Modified: juddi/trunk/juddi-client.net/juddi-client.net-sample/WadlImport.cs
URL: http://svn.apache.org/viewvc/juddi/trunk/juddi-client.net/juddi-client.net-sample/WadlImport.cs?rev=1540580&r1=1540579&r2=1540580&view=diff
==============================================================================
--- juddi/trunk/juddi-client.net/juddi-client.net-sample/WadlImport.cs (original)
+++ juddi/trunk/juddi-client.net/juddi-client.net-sample/WadlImport.cs Mon Nov 11 01:14:22 2013
@@ -44,13 +44,13 @@ namespace org.apache.juddi.client.sample
                 clerkManager = new UDDIClient("uddi.xml");
                 UDDIClientContainer.addClient(clerkManager);
 
-                transport = clerkManager.getTransport("default");
+                transport = clerkManager.getTransport("default_non_root");
 
-                org.uddi.apiv3.UDDI_Security_SoapBinding security = transport.getUDDISecurityService();
-                org.uddi.apiv3.UDDI_Inquiry_SoapBinding inquiry = transport.getUDDIInquiryService();
-                org.uddi.apiv3.UDDI_Publication_SoapBinding publish = transport.getUDDIPublishService();
+                UDDI_Security_SoapBinding security = transport.getUDDISecurityService();
+                UDDI_Inquiry_SoapBinding inquiry = transport.getUDDIInquiryService();
+                UDDI_Publication_SoapBinding publish = transport.getUDDIPublishService();
 
-                clerk = clerkManager.getClerk("default");
+                clerk = clerkManager.getClerk("default_non_root");
 
                 //Wadl Import example
 

Modified: juddi/trunk/juddi-client.net/juddi-client.net-sample/WsdlImport.cs
URL: http://svn.apache.org/viewvc/juddi/trunk/juddi-client.net/juddi-client.net-sample/WsdlImport.cs?rev=1540580&r1=1540579&r2=1540580&view=diff
==============================================================================
--- juddi/trunk/juddi-client.net/juddi-client.net-sample/WsdlImport.cs (original)
+++ juddi/trunk/juddi-client.net/juddi-client.net-sample/WsdlImport.cs Mon Nov 11 01:14:22 2013
@@ -36,7 +36,7 @@ namespace org.apache.juddi.client.sample
         {
             String wsdlURL = "http://wsf.cdyne.com/WeatherWS/Weather.asmx?WSDL";
             ReadWSDL wsi = new ReadWSDL();
-            org.xmlsoap.schemas.easyWsdl.tDefinitions wsdlDefinition = wsi.readWSDL(
+            tDefinitions wsdlDefinition = wsi.readWSDL(
                 // "http://localhost/UDDI_API_V31.wsdl"
                 wsdlURL
                 );
@@ -65,6 +65,7 @@ namespace org.apache.juddi.client.sample
             Console.Out.WriteLine(new PrintUDDI<save_tModel>().print(st));
 
 
+            //TODO register the stuff
         }
     }
 }

Modified: juddi/trunk/juddi-client.net/juddi-client.net-sample/findendpoints.cs
URL: http://svn.apache.org/viewvc/juddi/trunk/juddi-client.net/juddi-client.net-sample/findendpoints.cs?rev=1540580&r1=1540579&r2=1540580&view=diff
==============================================================================
--- juddi/trunk/juddi-client.net/juddi-client.net-sample/findendpoints.cs (original)
+++ juddi/trunk/juddi-client.net/juddi-client.net-sample/findendpoints.cs Mon Nov 11 01:14:22 2013
@@ -36,13 +36,13 @@ namespace org.apache.juddi.client.sample
                clerkManager = new UDDIClient("uddi.xml");
                UDDIClientContainer.addClient(clerkManager);
 
-               transport = clerkManager.getTransport("default");
+               transport = clerkManager.getTransport("default_non_root");
 
-               org.uddi.apiv3.UDDI_Security_SoapBinding security = transport.getUDDISecurityService();
-               org.uddi.apiv3.UDDI_Inquiry_SoapBinding inquiry = transport.getUDDIInquiryService();
-               org.uddi.apiv3.UDDI_Publication_SoapBinding publish = transport.getUDDIPublishService();
+               UDDI_Security_SoapBinding security = transport.getUDDISecurityService();
+               UDDI_Inquiry_SoapBinding inquiry = transport.getUDDIInquiryService();
+               UDDI_Publication_SoapBinding publish = transport.getUDDIPublishService();
 
-               clerk = clerkManager.getClerk("default");
+               clerk = clerkManager.getClerk("default_non_root");
 
 
                find_business fb = new find_business();

Modified: juddi/trunk/juddi-client.net/juddi-client.net-sample/juddi-client.net-sample-mono.csproj
URL: http://svn.apache.org/viewvc/juddi/trunk/juddi-client.net/juddi-client.net-sample/juddi-client.net-sample-mono.csproj?rev=1540580&r1=1540579&r2=1540580&view=diff
==============================================================================
--- juddi/trunk/juddi-client.net/juddi-client.net-sample/juddi-client.net-sample-mono.csproj (original)
+++ juddi/trunk/juddi-client.net/juddi-client.net-sample/juddi-client.net-sample-mono.csproj Mon Nov 11 01:14:22 2013
@@ -36,6 +36,8 @@
     <Reference Include="System" />
     <Reference Include="System.Core" />
     <Reference Include="System.Data" />
+ <Reference Include="System.Runtime.Serialization" />
+    <Reference Include="System.ServiceModel" />
     <Reference Include="System.Web.Services" />
     <Reference Include="System.Xml" />
   </ItemGroup>
@@ -48,6 +50,7 @@
     <Compile Include="Properties\AssemblyInfo.cs" />
  <Compile Include="ServiceVersioning.cs" />
     <Compile Include="SimpleInquiry.cs" />
+ <Compile Include="SubscriptionCallbackExample.cs" />
     <Compile Include="WadlImport.cs" />
     <Compile Include="WsdlImport.cs" />
   </ItemGroup>
@@ -58,7 +61,10 @@
     </Content>
   </ItemGroup>
   <ItemGroup>
-    <None Include="App.config" />
+    <Content Include="App.config">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+      <SubType>Designer</SubType>
+    </Content>
   </ItemGroup>
   <ItemGroup>
     <ProjectReference Include="..\juddi-client.net\juddi-client.net-mono.csproj">

Modified: juddi/trunk/juddi-client.net/juddi-client.net-sample/juddi-client.net-sample.csproj
URL: http://svn.apache.org/viewvc/juddi/trunk/juddi-client.net/juddi-client.net-sample/juddi-client.net-sample.csproj?rev=1540580&r1=1540579&r2=1540580&view=diff
==============================================================================
--- juddi/trunk/juddi-client.net/juddi-client.net-sample/juddi-client.net-sample.csproj (original)
+++ juddi/trunk/juddi-client.net/juddi-client.net-sample/juddi-client.net-sample.csproj Mon Nov 11 01:14:22 2013
@@ -36,6 +36,8 @@
     <Reference Include="System" />
     <Reference Include="System.Core" />
     <Reference Include="System.Data" />
+    <Reference Include="System.Runtime.Serialization" />
+    <Reference Include="System.ServiceModel" />
     <Reference Include="System.Web.Services" />
     <Reference Include="System.Xml" />
   </ItemGroup>
@@ -48,6 +50,7 @@
     <Compile Include="Properties\AssemblyInfo.cs" />
     <Compile Include="ServiceVersioning.cs" />
     <Compile Include="SimpleInquiry.cs" />
+    <Compile Include="SubscriptionCallbackExample.cs" />
     <Compile Include="WadlImport.cs" />
     <Compile Include="WsdlImport.cs" />
   </ItemGroup>
@@ -58,7 +61,10 @@
     </Content>
   </ItemGroup>
   <ItemGroup>
-    <None Include="App.config" />
+    <Content Include="App.config">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+      <SubType>Designer</SubType>
+    </Content>
   </ItemGroup>
   <ItemGroup>
     <ProjectReference Include="..\juddi-client.net\juddi-client.net.csproj">

Modified: juddi/trunk/juddi-client.net/juddi-client.net-sample/juddi/saveClerkExample.cs
URL: http://svn.apache.org/viewvc/juddi/trunk/juddi-client.net/juddi-client.net-sample/juddi/saveClerkExample.cs?rev=1540580&r1=1540579&r2=1540580&view=diff
==============================================================================
--- juddi/trunk/juddi-client.net/juddi-client.net-sample/juddi/saveClerkExample.cs (original)
+++ juddi/trunk/juddi-client.net/juddi-client.net-sample/juddi/saveClerkExample.cs Mon Nov 11 01:14:22 2013
@@ -39,9 +39,9 @@ namespace org.apache.juddi.client.sample
 
                 transport = clerkManager.getTransport("default");
 
-                org.uddi.apiv3.UDDI_Security_SoapBinding security = transport.getUDDISecurityService();
-                org.uddi.apiv3.UDDI_Inquiry_SoapBinding inquiry = transport.getUDDIInquiryService();
-                org.uddi.apiv3.UDDI_Publication_SoapBinding publish = transport.getUDDIPublishService();
+                UDDI_Security_SoapBinding security = transport.getUDDISecurityService();
+                UDDI_Inquiry_SoapBinding inquiry = transport.getUDDIInquiryService();
+                UDDI_Publication_SoapBinding publish = transport.getUDDIPublishService();
                 JUDDIApiService juddi= transport.getJUDDIApiService();
 
                 clerk = clerkManager.getClerk("default");

Modified: juddi/trunk/juddi-client.net/juddi-client.net-sample/juddi/saveNodeExample.cs
URL: http://svn.apache.org/viewvc/juddi/trunk/juddi-client.net/juddi-client.net-sample/juddi/saveNodeExample.cs?rev=1540580&r1=1540579&r2=1540580&view=diff
==============================================================================
--- juddi/trunk/juddi-client.net/juddi-client.net-sample/juddi/saveNodeExample.cs (original)
+++ juddi/trunk/juddi-client.net/juddi-client.net-sample/juddi/saveNodeExample.cs Mon Nov 11 01:14:22 2013
@@ -40,9 +40,9 @@ namespace org.apache.juddi.client.sample
 
                 transport = clerkManager.getTransport("default");
 
-                org.uddi.apiv3.UDDI_Security_SoapBinding security = transport.getUDDISecurityService();
-                org.uddi.apiv3.UDDI_Inquiry_SoapBinding inquiry = transport.getUDDIInquiryService();
-                org.uddi.apiv3.UDDI_Publication_SoapBinding publish = transport.getUDDIPublishService();
+               UDDI_Security_SoapBinding security = transport.getUDDISecurityService();
+               UDDI_Inquiry_SoapBinding inquiry = transport.getUDDIInquiryService();
+               UDDI_Publication_SoapBinding publish = transport.getUDDIPublishService();
                 JUDDIApiService juddi= transport.getJUDDIApiService();
 
                 clerk = clerkManager.getClerk("default");

Modified: juddi/trunk/juddi-client.net/juddi-client.net-sample/uddi.xml
URL: http://svn.apache.org/viewvc/juddi/trunk/juddi-client.net/juddi-client.net-sample/uddi.xml?rev=1540580&r1=1540579&r2=1540580&view=diff
==============================================================================
--- juddi/trunk/juddi-client.net/juddi-client.net-sample/uddi.xml (original)
+++ juddi/trunk/juddi-client.net/juddi-client.net-sample/uddi.xml Mon Nov 11 01:14:22 2013
@@ -3,6 +3,7 @@
   <reloadDelay>5000</reloadDelay>
   <client name="test-client">
     <nodes>
+        <!-- hint, there can be more than one "node"-->
       <node isHomeJUDDI="true">
         <!-- required 'default' node -->
         <name>default</name>
@@ -34,29 +35,47 @@
         <factoryURLPkgs>not used</factoryURLPkgs>
         <factoryNamingProvider>not used</factoryNamingProvider>
       </node>
-      <node>
-        <name>med</name>
-        <description>jUDDI node in other Department</description>
+
+      <node isHomeJUDDI="true">
+        <!-- required 'default' node -->
+        <name>default_non_root</name>
+        <description>Main jUDDI node</description>
+        <properties>
+          <!-- for a live instance of jUDDI, use this url
+          <property name="serverName" value="uddi-jbossoverlord.rhcloud.com" />
+          <property name="serverPort" value="80" />-->
+
+          <!-- for a dev instance of jUDDI, use this url -->
+          <property name="serverName" value="localhost" />
+          <property name="serverPort" value="8080" />
+
+          <!-- for UDDI nodes that use HTTP u/p, using the following 
+					<property name="basicAuthUsername" value="root" />
+					<property name="basicAuthPassword" value="password" />
+					<property name="basicAuthPasswordIsEncrypted" value="false" />
+					<property name="basicAuthPasswordCryptoProvider" value="org.apache.juddi.v3.client.crypto.AES128Cryptor (an example)" />-->
+        </properties>
         <proxyTransport>org.apache.juddi.v3.client.transport.AspNetTransport</proxyTransport>
-        <custodyTransferUrl>http://med:8080/juddiv3/services/custody-transfer?wsdl</custodyTransferUrl>
-        <inquiryUrl>http://med:8080/juddiv3/services/inquiry?wsdl</inquiryUrl>
-        <publishUrl>http://med:8080/juddiv3/services/publish?wsdl</publishUrl>
-        <securityUrl>http://med:8080/juddiv3/services/security?wsdl</securityUrl>
-        <subscriptionUrl>http://med:8080/juddiv3/services/subscription?wsdl</subscriptionUrl>
-        <subscriptionListenerUrl>http://med:8080/juddiv3/services/subscription-listener?wsdl</subscriptionListenerUrl>
-        <juddiApiUrl>http://med:8080/juddiv3/services/juddi-api?wsdl</juddiApiUrl>
+        <custodyTransferUrl>http://${serverName}:${serverPort}/juddiv3/services/custody-transfer?wsdl</custodyTransferUrl>
+        <inquiryUrl>http://${serverName}:${serverPort}/juddiv3/services/inquiry?wsdl</inquiryUrl>
+        <publishUrl>http://${serverName}:${serverPort}/juddiv3/services/publish?wsdl</publishUrl>
+        <securityUrl>http://${serverName}:${serverPort}/juddiv3/services/security?wsdl</securityUrl>
+        <subscriptionUrl>http://${serverName}:${serverPort}/juddiv3/services/subscription?wsdl</subscriptionUrl>
+        <subscriptionListenerUrl>http://${serverName}:${serverPort}/juddiv3/services/subscription-listener?wsdl</subscriptionListenerUrl>
+        <juddiApiUrl>http://${serverName}:${serverPort}/juddiv3/services/juddi-api?wsdl</juddiApiUrl>
         <factoryInitial>not used</factoryInitial>
         <factoryURLPkgs>not used</factoryURLPkgs>
         <factoryNamingProvider>not used</factoryNamingProvider>
-
       </node>
     </nodes>
 
     <clerks registerOnStartup="false">
+      <!-- one clerk for each node is required-->
       <clerk name="default" node="default" publisher="root" password="root"  isPasswordEncrypted="false" cryptoProvider=""/>
-      <clerk name="medroot" node="med"     publisher="root" password="root"  isPasswordEncrypted="false" cryptoProvider=""/>
+      <clerk name="default_non_root" node="default_non_root"     publisher="uddi" password="uddi"  isPasswordEncrypted="false" cryptoProvider=""/>
       <xregister>
-        <servicebinding bindingKey="uddi:juddi.apache.org:servicebindings-subscriptionlistener-ws" fromClerk="default" toClerk="medroot"/>
+        <!-- automatic registration on start. this only triggers when registerOnStartup=true-->
+        <servicebinding bindingKey="uddi:juddi.apache.org:servicebindings-subscriptionlistener-ws" fromClerk="default" toClerk="default_non_root"/>
       </xregister>
       
     </clerks>
@@ -78,10 +97,10 @@
       <checkRevocationOCSP>false</checkRevocationOCSP>
     </signature>
     <subscriptionCallbacks>
-      <keyDomain>uddi:org.apache.juddi</keyDomain>
+      <keyDomain>uddi:org.apache.demos</keyDomain>
       <listenUrl>http://localhost:4444/callback</listenUrl>
-      <autoRegisterBindingTemplate>false</autoRegisterBindingTemplate>
-      <autoRegisterBusinessServiceKey>uddi:org.apache.juddi:callbackServices</autoRegisterBusinessServiceKey>
+      <autoRegisterBindingTemplate>true</autoRegisterBindingTemplate>
+      <autoRegisterBusinessServiceKey>uddi:org.apache.demos:coolbizexample-service</autoRegisterBusinessServiceKey>
       <signatureBehavior>DoNothing</signatureBehavior>
     </subscriptionCallbacks>
     <XtoWsdl>

Modified: juddi/trunk/juddi-client.net/juddi-client.net/bindings/datamodel.cs
URL: http://svn.apache.org/viewvc/juddi/trunk/juddi-client.net/juddi-client.net/bindings/datamodel.cs?rev=1540580&r1=1540579&r2=1540580&view=diff
==============================================================================
--- juddi/trunk/juddi-client.net/juddi-client.net/bindings/datamodel.cs (original)
+++ juddi/trunk/juddi-client.net/juddi-client.net/bindings/datamodel.cs Mon Nov 11 01:14:22 2013
@@ -484,7 +484,10 @@ namespace org.uddi.apiv3
             }
         }
 
-        /// <remarks/>
+       
+        /// <summary>
+        /// assertionStatusReport,bindingDetail,businessDetail,businessList,relatedBusinessesList,serviceDetail,serviceList,tModelDetail, or tModelList
+        /// </summary>
         [System.Xml.Serialization.XmlElementAttribute("assertionStatusReport", typeof(assertionStatusReport), Namespace = "urn:uddi-org:api_v3")]
         [System.Xml.Serialization.XmlElementAttribute("bindingDetail", typeof(bindingDetail), Namespace = "urn:uddi-org:api_v3")]
         [System.Xml.Serialization.XmlElementAttribute("businessDetail", typeof(businessDetail), Namespace = "urn:uddi-org:api_v3")]

Modified: juddi/trunk/juddi-client.net/juddi-client.net/juddi-client.net-mono.csproj
URL: http://svn.apache.org/viewvc/juddi/trunk/juddi-client.net/juddi-client.net/juddi-client.net-mono.csproj?rev=1540580&r1=1540579&r2=1540580&view=diff
==============================================================================
--- juddi/trunk/juddi-client.net/juddi-client.net/juddi-client.net-mono.csproj (original)
+++ juddi/trunk/juddi-client.net/juddi-client.net/juddi-client.net-mono.csproj Mon Nov 11 01:14:22 2013
@@ -37,6 +37,7 @@
     <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" />
@@ -78,6 +79,13 @@
     <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\AspNetTransport.cs" />
     <Compile Include="org.apache.juddi.v3.client\ConsoleLogger.cs" />
     <Compile Include="org.apache.juddi.v3.client\EventLogger.cs" />

Modified: juddi/trunk/juddi-client.net/juddi-client.net/juddi-client.net.csproj
URL: http://svn.apache.org/viewvc/juddi/trunk/juddi-client.net/juddi-client.net/juddi-client.net.csproj?rev=1540580&r1=1540579&r2=1540580&view=diff
==============================================================================
--- juddi/trunk/juddi-client.net/juddi-client.net/juddi-client.net.csproj (original)
+++ juddi/trunk/juddi-client.net/juddi-client.net/juddi-client.net.csproj Mon Nov 11 01:14:22 2013
@@ -37,6 +37,7 @@
     <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" />
@@ -78,6 +79,13 @@
     <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\AspNetTransport.cs" />
     <Compile Include="org.apache.juddi.v3.client\ConsoleLogger.cs" />
     <Compile Include="org.apache.juddi.v3.client\EventLogger.cs" />

Modified: juddi/trunk/juddi-client.net/juddi-client.net/org.apache.juddi.v3.client.config/ClientConfig.cs
URL: http://svn.apache.org/viewvc/juddi/trunk/juddi-client.net/juddi-client.net/org.apache.juddi.v3.client.config/ClientConfig.cs?rev=1540580&r1=1540579&r2=1540580&view=diff
==============================================================================
--- juddi/trunk/juddi-client.net/juddi-client.net/org.apache.juddi.v3.client.config/ClientConfig.cs (original)
+++ juddi/trunk/juddi-client.net/juddi-client.net/org.apache.juddi.v3.client.config/ClientConfig.cs Mon Nov 11 01:14:22 2013
@@ -404,5 +404,10 @@ namespace org.apache.juddi.v3.client.con
         {
             return configurationFile;
         }
+
+        public Properties  getDigitalSignatureConfiguration()
+        {
+            throw new NotImplementedException();
+        }
     }
 }

Modified: juddi/trunk/juddi-client.net/juddi-client.net/org.apache.juddi.v3.client.config/UDDIClerk.cs
URL: http://svn.apache.org/viewvc/juddi/trunk/juddi-client.net/juddi-client.net/org.apache.juddi.v3.client.config/UDDIClerk.cs?rev=1540580&r1=1540579&r2=1540580&view=diff
==============================================================================
--- juddi/trunk/juddi-client.net/juddi-client.net/org.apache.juddi.v3.client.config/UDDIClerk.cs (original)
+++ juddi/trunk/juddi-client.net/juddi-client.net/org.apache.juddi.v3.client.config/UDDIClerk.cs Mon Nov 11 01:14:22 2013
@@ -202,7 +202,7 @@ namespace org.apache.juddi.v3.client.con
 
                 //List<org.uddi.apiv3.subscription> subscriptions = new List<org.uddi.apiv3.subscription>();
                 //subscriptions.Add(subscription);
-                ss.subscription = new subscription[1];
+                ss.subscription = new org.uddi.apiv3.subscription[1];
                 ss.subscription[0] = subscription;
                 //holder.value = subscriptions;
                 using (UDDI_Subscription_SoapBinding sub = getUDDINode().getTransport().getUDDISubscriptionService(node.subscriptionUrl))

Modified: juddi/trunk/juddi-client.net/juddi-client.net/org.apache.juddi.v3.client.crypto/DigSigUtil.cs
URL: http://svn.apache.org/viewvc/juddi/trunk/juddi-client.net/juddi-client.net/org.apache.juddi.v3.client.crypto/DigSigUtil.cs?rev=1540580&r1=1540579&r2=1540580&view=diff
==============================================================================
--- juddi/trunk/juddi-client.net/juddi-client.net/org.apache.juddi.v3.client.crypto/DigSigUtil.cs (original)
+++ juddi/trunk/juddi-client.net/juddi-client.net/org.apache.juddi.v3.client.crypto/DigSigUtil.cs Mon Nov 11 01:14:22 2013
@@ -13,6 +13,13 @@ namespace org.apache.juddi.v3.client.cry
     /// <author><a href="mailto:alexoree@apache.org">Alex O'Ree</a></author> 
     public class DigSigUtil
     {
+        private config.Properties properties;
+
+        public DigSigUtil(config.Properties properties)
+        {
+            // TODO: Complete member initialization
+            this.properties = properties;
+        }
         /// <summary>
         ///
         /// Verifies the signature on an enveloped digital signature on a UDDI
@@ -33,5 +40,10 @@ namespace org.apache.juddi.v3.client.cry
             OutErrorMessage = "";
             return false;
         }
+
+        internal uddi.apiv3.bindingTemplate signUddiEntity(object bt)
+        {
+            throw new NotImplementedException();
+        }
     }
 }

Added: juddi/trunk/juddi-client.net/juddi-client.net/org.apache.juddi.v3.client.subscription/ISubscriptionCallback.cs
URL: http://svn.apache.org/viewvc/juddi/trunk/juddi-client.net/juddi-client.net/org.apache.juddi.v3.client.subscription/ISubscriptionCallback.cs?rev=1540580&view=auto
==============================================================================
--- juddi/trunk/juddi-client.net/juddi-client.net/org.apache.juddi.v3.client.subscription/ISubscriptionCallback.cs (added)
+++ juddi/trunk/juddi-client.net/juddi-client.net/org.apache.juddi.v3.client.subscription/ISubscriptionCallback.cs Mon Nov 11 01:14:22 2013
@@ -0,0 +1,31 @@
+using org.uddi.apiv3;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace org.apache.juddi.v3.client.subscription
+{
+    /// <summary>
+    /// This is an interface for creating asynchronous callback clientsfor the
+    /// UDDI Subscription API.
+    /// @since 3.2
+    /// @author <a href="mailto:alexoree@apache.org">Alex O'Ree</a>
+    /// @see SubscriptionCallbackListener
+    /// </summary>
+    public interface ISubscriptionCallback
+    {
+        /// <summary>
+        /// Called when a UDDI server notifies us that something has changed. 
+     /// Implementations should never block.
+        /// </summary>
+        /// <param name="body"></param>
+         void HandleCallback(subscriptionResultsList body);
+
+        
+        /// <summary>
+        /// Called when the callback endpoint is stopped
+        /// </summary>
+         void NotifyEndpointStopped();
+    }
+}

Added: juddi/trunk/juddi-client.net/juddi-client.net/org.apache.juddi.v3.client.subscription/SubscriptionCallbackListener.cs
URL: http://svn.apache.org/viewvc/juddi/trunk/juddi-client.net/juddi-client.net/org.apache.juddi.v3.client.subscription/SubscriptionCallbackListener.cs?rev=1540580&view=auto
==============================================================================
--- juddi/trunk/juddi-client.net/juddi-client.net/org.apache.juddi.v3.client.subscription/SubscriptionCallbackListener.cs (added)
+++ juddi/trunk/juddi-client.net/juddi-client.net/org.apache.juddi.v3.client.subscription/SubscriptionCallbackListener.cs Mon Nov 11 01:14:22 2013
@@ -0,0 +1,634 @@
+/*
+ * Copyright 2001-2008 The Apache Software Foundation.
+ * 
+ * Licensed 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.log;
+using org.apache.juddi.v3.client.subscription.wcf;
+using org.uddi.apiv3;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Runtime.CompilerServices;
+using System.Text;
+using org.apache.juddi.client.org.apache.juddi.v3.client.subscription;
+using System.Security;
+using System.ServiceModel;
+using org.apache.juddi.v3.client.config;
+using org.apache.juddi.v3.client.transport;
+using org.apache.juddi.v3.client.crypto;
+using System.Net;
+
+namespace org.apache.juddi.v3.client.subscription
+{
+    /// <summary>
+    /// WebService which implements the UDDI v3 SubscriptionListener API. 
+    /// This service will be called by the UDDI registry when any change to a Service or BindingTemplate call in to it.
+    /// </summary>
+    /// Usage scenario
+    /// Usethis call for when you need to be notified from a UDDI server that either a UDDI entity was created, changed, or deleted via the UDDI Subscription web service. This class will start up an embedded Jetty server (built into the JRE). You can then register your code to be notified of any inbound messages received from the UDDI server asynchronously. Here's some sample code.
+    /// <pre>
+    /// 
+    /*
+    /// 
+    /// UDDIClient clerkManager = null;
+            Transport transport = null;
+            UDDIClerk clerk = null;
+            try
+            {
+                clerkManager = new UDDIClient("uddi.xml");
+                UDDIClientContainer.addClient(clerkManager);
+
+                transport = clerkManager.getTransport("default");
+
+                UDDI_Security_SoapBinding security = transport.getUDDISecurityService();
+                UDDI_Inquiry_SoapBinding inquiry = transport.getUDDIInquiryService();
+                UDDI_Publication_SoapBinding publish = transport.getUDDIPublishService();
+
+                clerk = clerkManager.getClerk("default");
+
+                tModel createKeyGenator = UDDIClerk.createKeyGenator("uddi:org.apache.juddi:test:keygenerator", "Test domain", "en");
+                clerk.register(createKeyGenator);
+                bindingTemplate start = SubscriptionCallbackListener.start(clerkManager, "default");
+                //bkeep alive
+                DateTime stop = DateTime.Now.Add(new TimeSpan(0, 1, 0));
+                while (DateTime.Now < stop)
+                {
+                    Thread.Sleep(1000);
+
+                }
+                SubscriptionCallbackListener.stop(c, "default", start.bindingKey);
+            }
+            catch (Exception ex)
+            {
+                while (ex != null)
+                {
+                    System.Console.WriteLine("Error! " + ex.Message);
+                    ex = ex.InnerException;
+                }
+            }
+            finally
+            {
+                if (transport != null && transport is IDisposable)
+                {
+                    ((IDisposable)transport).Dispose();
+                }
+                if (clerk != null)
+                    clerk.Dispose();
+            }
+*/
+    /// </pre>
+    /// 
+    [ServiceBehaviorAttribute( AutomaticSessionShutdown=false, ConcurrencyMode=ConcurrencyMode.Single, Name="SubscriptionCallbackListener",
+        Namespace="org.apache.juddi.v3.client.subscription", IncludeExceptionDetailInFaults=false, InstanceContextMode=InstanceContextMode.Single, ValidateMustUnderstand=false,
+        AddressFilterMode=AddressFilterMode.Any)]
+    public class SubscriptionCallbackListener : UDDI_SubscriptionListener_PortType
+    {
+        public SubscriptionCallbackListener()
+        {
+            AppDomain.CurrentDomain.ProcessExit += new EventHandler(CurrentDomain_ProcessExit);
+
+        }
+
+
+
+        protected static SubscriptionCallbackListener getInstance()
+        {
+            return instance;
+        }
+        private static Log log = LogFactory.getLog(typeof(SubscriptionCallbackListener));
+        private static List<ISubscriptionCallback> callbacks = new List<ISubscriptionCallback>();
+        private static SubscriptionCallbackListener instance = null;
+        private static ServiceHost ep = null;
+
+        private static String callback = null;
+
+        /**
+         * gets the current callback url, may be null if the endpoint isn't started
+         * yet
+         *
+         * @return
+         */
+        public static String getCallbackURL()
+        {
+            return callback;
+
+        }
+
+
+        /**
+    * Starts a embedded WCF web server (comes with .NET) using the
+    * Endpoint API.
+    *
+    * @param endpoint this is the url that a UDDI server would use to connect
+    * to the client's subscription listener service Recommend specifying a port
+    * that is firewall friendly
+    * @param callbackBusinessService - optional. if specified, a binding
+    * template is appended to the business service and returned. The new
+    * binding template is annotated for subscription callbacks.
+    * @return null, if and only if callbackBusinessService was null, otherwise
+    * the modified callbackBusinessService is returned. Clients can then use it
+    * to continue the registration process.
+    * @throws ServiceAlreadyStartedException
+    * @throws SecurityException
+    * @see Endpoint
+    */
+        [MethodImpl(MethodImplOptions.Synchronized)]
+        public static bindingTemplate start(UDDIClient client, String cfg_node_name, String endpoint,
+                String keydomain, bool autoregister, String serviceKey,
+                SignatureBehavior behavior)
+        {
+
+
+            if (instance == null)
+            {
+                instance = new SubscriptionCallbackListener();
+            }
+
+            if (ep != null && ep.State == CommunicationState.Opened)
+            {
+                throw new ServiceAlreadyStartedException();
+            }
+
+
+            Uri url = null;
+            try
+            {
+                url = new Uri(endpoint);
+            }
+            catch (Exception ex)
+            {
+                log.warn("Callback endpoint couldn't be parsed, generating a random one: " + ex.Message);
+                url = new Uri("http://" + GetHostname() + ":" + GetRandomPort(4000) + "/" + Guid.NewGuid().ToString());
+            }
+            endpoint = url.ToString();
+            //if (endpoint == null || endpoint.equals("")) {
+            //    endpoint = "http://" + GetHostname() + ":" + GetRandomPort(url.getPort()) + "/" + UUID.randomUUID().toString();
+
+            int attempts = 5;
+            if (ep == null)
+            {
+                while ((ep == null || ep.State != CommunicationState.Opened) && attempts > 0)
+                {
+                    try
+                    {
+                        if (endpoint.Contains("localhost"))
+                            endpoint = endpoint.Replace("localhost", GetHostname());
+                        ep = new ServiceHost(instance, new Uri[] { new Uri(endpoint) });
+                        //ep = Endpoint.publish(endpoint, instance);
+                        ep.Open();
+                        callback = endpoint;
+                    }
+                    catch (Exception be)
+                    {
+                        log.info("trouble starting callback at " + endpoint + ", trying again with a random port: " + be.Message);
+                        log.debug(be);
+                        attempts--;
+                        //if (be instanceof java.net.BindException) {
+                        url = new Uri("http://" + url.Host + ":" + GetRandomPort(url.Port) + "/" + url.PathAndQuery);
+                        endpoint = url.ToString();
+
+                    }
+                }
+            }
+            if (ep == null || ep.State != CommunicationState.Opened)
+            {
+                log.warn("Unable to start callback endpoint, aborting");
+                throw new SecurityException("unable to start endpoint, view previous errors for reason");
+            }
+
+            log.info("Endpoint started at " + callback);
+
+            bindingTemplate bt = new bindingTemplate();
+            bt.Item = (new accessPoint(callback, "endPoint"));
+
+            tModelInstanceInfo instanceInfo = new tModelInstanceInfo();
+            instanceInfo.tModelKey = ("uddi:uddi.org:transport:http");
+            bt.tModelInstanceDetails = new tModelInstanceInfo[] { instanceInfo };
+
+            bt.serviceKey = (serviceKey);
+            if (keydomain.EndsWith(":"))
+            {
+                bt.bindingKey = (keydomain + GetHostname() + "_Subscription_Callback");
+            }
+            else
+            {
+                bt.bindingKey = (keydomain + ":" + GetHostname() + "_Subscription_Callback");
+            }
+
+            if (autoregister)
+            {
+                bt = registerBinding(client, cfg_node_name, bt, behavior);
+            }
+
+            return bt;
+
+        }
+
+        private static int GetRandomPort(int oldport)
+        {
+            if (oldport <= 0)
+            {
+                oldport = 4000;
+            }
+            return oldport + new Random().Next(99);
+
+        }
+
+        /// <summary>
+        /// Starts a subscription callback service using the juddi client config
+        /// file's settings
+        /// </summary>
+        /// <param name="client"></param>
+        /// <param name="cfg_node_name"></param>
+        /// <returns></returns>
+        [MethodImpl(MethodImplOptions.Synchronized)]
+        public static bindingTemplate start(UDDIClient client, String cfg_node_name)
+        {
+
+            bool reg = client.getClientConfig().getConfiguration().client.subscriptionCallbacks.autoRegisterBindingTemplate;
+            String endpoint = client.getClientConfig().getConfiguration().client.subscriptionCallbacks.listenUrl;
+            String kd = client.getClientConfig().getConfiguration().client.subscriptionCallbacks.keyDomain;
+            String key = client.getClientConfig().getConfiguration().client.subscriptionCallbacks.autoRegisterBusinessServiceKey;
+            String sbs = client.getClientConfig().getConfiguration().client.subscriptionCallbacks.signatureBehavior;
+            SignatureBehavior sb = SignatureBehavior.DoNothing;
+            try
+            {
+                sb = (SignatureBehavior)Enum.Parse(typeof(SignatureBehavior), sbs);
+            }
+            catch (Exception ex)
+            {
+                log.warn("Unable to parse config setting for SignatureBehavior, defaulting to DoNothing", ex);
+            }
+
+            return start(client, cfg_node_name, endpoint, kd, reg, key, sb);
+        }
+
+
+
+        /**
+    * Registers a UDDI binding template that represents the subscription
+    * callback endpoint
+    *
+    * @param client
+    * @param cfg_node_name
+    * @param bt - Binding Template
+    * @param behavior
+    * @return
+    * @throws ServiceAlreadyStartedException
+    * @throws SecurityException
+    * @throws ConfigurationException
+    * @throws TransportException
+    * @throws DispositionReportFaultMessage
+    * @throws RemoteException
+    * @throws UnexpectedException
+    * @throws RegistrationAbortedException
+    * @throws UnableToSignException
+    */
+        public static bindingTemplate registerBinding(UDDIClient client, String cfg_node_name, bindingTemplate bt, SignatureBehavior behavior)
+        {
+            log.info("Attempting to register binding " + bt.bindingKey);
+            UDDIClerk clerk = client.getClerk(cfg_node_name);
+            Transport tp = client.getTransport(cfg_node_name);
+            UDDI_Inquiry_SoapBinding uddiInquiryService = tp.getUDDIInquiryService();
+            UDDI_Publication_SoapBinding uddiPublishService = tp.getUDDIPublishService();
+
+
+            String token = clerk.getAuthToken(clerk.getUDDINode().getSecurityUrl());
+
+            switch (behavior)
+            {
+                case SignatureBehavior.AbortIfSigned:
+                    if (CheckExistingBindingForSignature(bt.bindingKey, uddiInquiryService, token, behavior))
+                    {
+                        throw new RegistrationAbortedException("Aborting, Either the item exists and is signed");
+                    }
+                    if (CheckServiceAndParentForSignature(bt.serviceKey, uddiInquiryService, token))
+                    {
+                        throw new RegistrationAbortedException("Aborting, Either the service or busness is signed");
+                    }
+                    break;
+                case SignatureBehavior.DoNothing:
+                    break;
+                case SignatureBehavior.SignAlways:
+                    try
+                    {
+                        DigSigUtil ds = new DigSigUtil(client.getClientConfig().getDigitalSignatureConfiguration());
+                        bt = ds.signUddiEntity(bt);
+                    }
+                    catch (Exception ex)
+                    {
+                        log.error("Unable to sign", ex);
+                        throw new UnableToSignException(ex);
+                    }
+
+                    break;
+                case SignatureBehavior.SignOnlyIfParentIsntSigned:
+                    if (!CheckServiceAndParentForSignature(bt.serviceKey, uddiInquiryService, token))
+                    {
+                        try
+                        {
+                            DigSigUtil ds = new DigSigUtil(client.getClientConfig().getDigitalSignatureConfiguration());
+                            bt = ds.signUddiEntity(bt);
+                        }
+                        catch (Exception ex)
+                        {
+                            log.error("Unable to sign", ex);
+                            throw new UnableToSignException(ex);
+                        }
+                    }
+                    break;
+            }
+            save_binding sb = new save_binding();
+            sb.authInfo = (token);
+            sb.bindingTemplate = new bindingTemplate[] { bt };
+
+            bindingDetail saveBinding = uddiPublishService.save_binding(sb);
+            log.info("Binding registered successfully");
+            if (saveBinding.bindingTemplate == null || saveBinding.bindingTemplate.Length > 1)
+            {
+                throw new UnexpectedResponseException("The number of binding templates returned was unexpected, count=" + (saveBinding.bindingTemplate == null ? "none" : saveBinding.bindingTemplate.Length.ToString()));
+            }
+            return saveBinding.bindingTemplate[0];
+        }
+
+
+
+        private static bool CheckServiceAndParentForSignature(String serviceKey, UDDI_Inquiry_SoapBinding uddiInquiryService, String token)
+        {
+            get_serviceDetail gsd = new get_serviceDetail();
+            gsd.authInfo = (token);
+            gsd.serviceKey = new string[] { serviceKey };
+            String bizkey = null;
+            try
+            {
+                serviceDetail serviceDetail = uddiInquiryService.get_serviceDetail(gsd);
+                if (serviceDetail != null && serviceDetail.businessService != null)
+                {
+                    {
+                        bizkey = serviceDetail.businessService[0].businessKey;
+                        if (serviceDetail.businessService[0].Signature != null && serviceDetail.businessService[0].Signature.Length > 0)
+                        {
+                            log.info("the service with key=" + serviceKey + " exists and is digitally signed");
+                            return true;
+                        }
+                    }
+                }
+            }
+            catch (Exception ex)
+            {
+                log.info("Error caught checking for the existence of and if a signature is present for service key " + serviceKey, ex);
+                throw new UnexpectedResponseException("Error caught checking for the existence of and if a signature is present for service key " + serviceKey, ex);
+            }
+            if (bizkey == null)
+            {
+                throw new UnexpectedResponseException("The service with key " + serviceKey + " parent's business key could not be determined. This is unexpected");
+            }
+            get_businessDetail gbd = new get_businessDetail();
+            gbd.authInfo = (token);
+            gbd.businessKey = new string[] { bizkey };
+            try
+            {
+                businessDetail businessDetail = uddiInquiryService.get_businessDetail(gbd);
+                if (businessDetail != null && businessDetail.businessEntity != null)
+                {
+                    if (businessDetail.businessEntity[0].Signature != null && businessDetail.businessEntity[0].Signature.Length > 0)
+                    {
+                        log.info("the business with key=" + bizkey + " exists and is digitally signed");
+                        return true;
+                    }
+                }
+            }
+            catch (Exception ex)
+            {
+                log.info("Error caught checking for the existence of and if a signature is present for business key " + bizkey, ex);
+                throw new UnexpectedResponseException("Error caught checking for the existence of and if a signature is present for business key " + bizkey, ex);
+            }
+            return false;
+        }
+
+
+        /**
+         * return true if and only if the binding exists and is signed
+         *
+         * @param bindingKey
+         * @param uddiInquiryService
+         * @param token
+         * @param behavior
+         * @return
+         */
+        private static bool CheckExistingBindingForSignature(String bindingKey, UDDI_Inquiry_SoapBinding uddiInquiryService, String token, SignatureBehavior behavior)
+        {
+            get_bindingDetail gbd = new get_bindingDetail();
+            gbd.authInfo = (token);
+            gbd.bindingKey = new string[] { bindingKey };
+            try
+            {
+                bindingDetail bindingDetail = uddiInquiryService.get_bindingDetail(gbd);
+                if (bindingDetail != null
+                        && bindingDetail.bindingTemplate != null
+                        && bindingDetail.bindingTemplate.Length > 0
+                        && bindingDetail.bindingTemplate[0].Signature != null
+                        && bindingDetail.bindingTemplate[0].Signature.Length > 0)
+                {
+                    log.info("the binding template with key=" + bindingKey + " exists and is digitally signed");
+                }
+                return true;
+            }
+            catch (Exception ex)
+            {
+                log.debug("Error caught checking for the existence of and if a signature is present for binding key " + bindingKey + " this may be ignorable", ex);
+            }
+            return false;
+        }
+
+        private void CurrentDomain_ProcessExit(object sender, EventArgs e)
+        {
+            if (ep != null && ep.State == CommunicationState.Opened)
+            {
+                log.error("Hey, someone should tell the developer to call SubscriptionCallbackListern.stop(...) before ending the program. Stopping endpoint at " + callback);
+                unregisterAllCallbacks();
+                ep.Close();
+                ep = null;
+                callback = null;
+            }
+        }
+        public uddi.apiv3.dispositionReport notify_subscriptionListener(uddi.apiv3.notify_subscriptionListener body)
+        {
+            for (int i = 0; i < callbacks.Count; i++)
+            {
+                try
+                {
+                    callbacks[i].HandleCallback(body.subscriptionResultsList);
+                }
+                catch (Exception ex)
+                {
+                    log.warn("Your implementation on ISubscriptionCallback is faulty and threw an error, contact the developer", ex);
+                }
+            }
+            dispositionReport r = new dispositionReport();
+            r.result = new result[] { new result() };
+            return r;
+
+        }
+
+
+
+        [MethodImpl(MethodImplOptions.Synchronized)]
+        protected static void unregisterAllCallbacks()
+        {
+            if (callbacks != null)
+            {
+                log.info("Notifying all subscribing classes, count=" + callbacks.Count);
+                for (int i = 0; i < callbacks.Count; i++)
+                {
+                    if (callbacks[(i)] != null)
+                    {
+                        try
+                        {
+                            callbacks[(i)].NotifyEndpointStopped();
+                        }
+                        catch (Exception ex)
+                        {
+                            log.warn("Your implementation on ISubscriptionCallback is faulty and threw an error, contact the developer", ex);
+                        }
+                    }
+                }
+                callbacks.Clear();
+            }
+
+        }
+
+        /**
+         * This effectively stops the endpoint address and notifies all
+         * ISubscriptionCallback clients that the endpoint as been stopped. After it
+         * has been stopped, call ISubscriptionCallback are removed from the
+         * callback list. If unable to remove an auto registered binding template,
+         * no exception will be thrown
+         */
+        [MethodImpl(MethodImplOptions.Synchronized)]
+        public static void stop(UDDIClient client, String cfg_node_name, String bindingKey)
+        {
+            //stop the service
+            if (ep != null && ep.State == CommunicationState.Opened)
+            {
+                log.warn("Stopping jUDDI Subscription callback endpoint at " + callback);
+                ep.Close();
+                if (ep.State != CommunicationState.Closed && ep.State != CommunicationState.Closing)
+                {
+                    log.error("Unable to stop the endpoint. the port may be locked until this process terminates");
+                }
+                ep = null;
+                callback = null;
+            }
+            unregisterAllCallbacks();
+
+            if (client.getClientConfig().getConfiguration().client != null &&
+                client.getClientConfig().getConfiguration().client.subscriptionCallbacks != null &&
+                client.getClientConfig().getConfiguration().client.subscriptionCallbacks.signatureBehavior != null &&
+                client.getClientConfig().getConfiguration().client.subscriptionCallbacks.signatureBehavior.Equals("true", StringComparison.CurrentCultureIgnoreCase) &&
+                bindingKey != null)
+            {
+                log.info("Attempting to unregister the binding");
+                try
+                {
+                    UDDIClerk clerk = client.getClerk(cfg_node_name);
+                    Transport tp = client.getTransport(cfg_node_name);
+                    String token = clerk.getAuthToken(clerk.getUDDINode().getSecurityUrl());
+                    UDDI_Publication_SoapBinding uddiPublishService = tp.getUDDIPublishService();
+                    delete_binding db = new delete_binding();
+                    db.authInfo = (token);
+                    db.bindingKey = new string[] { (bindingKey) };
+                    uddiPublishService.delete_binding(db);
+                }
+                catch (Exception ex)
+                {
+                    log.error("Unable to unregister binding " + bindingKey, ex);
+                }
+            }
+
+
+            //TODO optionally kill the subscription?
+            //get all subscriptions from the uddi node, 
+            //loop through and deduce which ones are pointed at this endpoint
+            //then remove them
+        }
+        private static String GetHostname()
+        {
+            try
+            {
+                return Dns.GetHostName();
+            }
+            catch (Exception ex)
+            {
+                return "HOST_UNKNOWN";
+            }
+        }
+
+        /**
+     * config parameter
+     */
+        public static readonly String PROPERTY_LISTENURL = "client.subscriptionCallbacks.listenUrl";
+        /**
+         * config parameter
+         */
+        public static readonly String PROPERTY_KEYDOMAIN = "client.subscriptionCallbacks.keyDomain";
+        /**
+         * config parameter true/false
+         */
+        public static readonly String PROPERTY_AUTOREG_BT = "client.subscriptionCallbacks.autoRegisterBindingTemplate";
+        /**
+         * config parameter business key
+         */
+        public static readonly String PROPERTY_AUTOREG_SERVICE_KEY = "client.subscriptionCallbacks.autoRegisterBusinessServiceKey";
+        /**
+         * config parameter
+         *
+         * @see SignatureBehavior
+         */
+        public static readonly String PROPERTY_SIGNATURE_BEHAVIOR = "client.subscriptionCallbacks.signatureBehavior";
+
+    }
+    /**
+    * This defines how the automatic subscription binding template is suppose
+    * to behave
+    */
+    public enum SignatureBehavior
+    {
+
+        /**
+         * Aborts the save request if either the entity exists and is already
+         * signed, or if any parent uddi element is signed
+         */
+        AbortIfSigned,
+        /**
+         * Signs this element. Warning: It may cause signatures of parent
+         * elements to become invalid. If unable to sign, an exception will be
+         * thrown
+         */
+        SignAlways,
+        /**
+         * Signs this element, but only if parents are not signed. If unable to
+         * sign, an exception will be thrown
+         */
+        SignOnlyIfParentIsntSigned,
+        /**
+         * Do nothing, don't sign it and don't check if a parent item is signed
+         * or not.
+         */
+        DoNothing
+    }
+
+}

Added: juddi/trunk/juddi-client.net/juddi-client.net/org.apache.juddi.v3.client.subscription/UDDISubscriptionListenerService.cs
URL: http://svn.apache.org/viewvc/juddi/trunk/juddi-client.net/juddi-client.net/org.apache.juddi.v3.client.subscription/UDDISubscriptionListenerService.cs?rev=1540580&view=auto
==============================================================================
--- juddi/trunk/juddi-client.net/juddi-client.net/org.apache.juddi.v3.client.subscription/UDDISubscriptionListenerService.cs (added)
+++ juddi/trunk/juddi-client.net/juddi-client.net/org.apache.juddi.v3.client.subscription/UDDISubscriptionListenerService.cs Mon Nov 11 01:14:22 2013
@@ -0,0 +1,51 @@
+/*
+ * Copyright 2001-2008 The Apache Software Foundation.
+ * 
+ * Licensed 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.
+ *
+ */
+
+//------------------------------------------------------------------------------
+// <auto-generated>
+//     This code was generated by a tool.
+//     Runtime Version:4.0.30319.18052
+//
+//     Changes to this file may cause incorrect behavior and will be lost if
+//     the code is regenerated.
+// </auto-generated>
+//------------------------------------------------------------------------------
+
+using org.uddi.apiv3;
+using System.ServiceModel;
+namespace org.apache.juddi.v3.client.subscription.wcf
+{
+    /// <summary>
+    /// This interface is an adaptation to enable WCF style self hosted services while using
+    /// ASP.NET generated XML classes
+    /// </summary>
+
+    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
+    [System.ServiceModel.ServiceContractAttribute(Namespace = "urn:uddi-org:v3_service")]
+    public interface UDDI_SubscriptionListener_PortType
+    {
+
+        // CODEGEN: Generating message contract since the operation notify_subscriptionListener is neither RPC nor document wrapped.
+        [System.ServiceModel.OperationContractAttribute(Action = "notify_subscriptionListener", ReplyAction = "*")]
+        [System.ServiceModel.XmlSerializerFormatAttribute()]
+        dispositionReport notify_subscriptionListener(notify_subscriptionListener request);
+    }
+
+
+
+
+}
\ No newline at end of file

Modified: juddi/trunk/juddi-core/src/main/java/org/apache/juddi/api/impl/UDDISecurityImpl.java
URL: http://svn.apache.org/viewvc/juddi/trunk/juddi-core/src/main/java/org/apache/juddi/api/impl/UDDISecurityImpl.java?rev=1540580&r1=1540579&r2=1540580&view=diff
==============================================================================
--- juddi/trunk/juddi-core/src/main/java/org/apache/juddi/api/impl/UDDISecurityImpl.java (original)
+++ juddi/trunk/juddi-core/src/main/java/org/apache/juddi/api/impl/UDDISecurityImpl.java Mon Nov 11 01:14:22 2013
@@ -116,6 +116,8 @@ public class UDDISecurityImpl extends Au
 
 	public AuthToken getAuthToken(GetAuthToken body)
 			throws DispositionReportFaultMessage {
+            
+                logger.info("AUDIT: AuthToken request for " + body.getUserID() + " from " + getRequestorsIPAddress());
 		Authenticator authenticator = AuthenticatorFactory.getAuthenticator();
 		
 		String publisherId = authenticator.authenticate(body.getUserID(), body.getCred());
@@ -142,17 +144,14 @@ public class UDDISecurityImpl extends Au
 			// Generate auth token and store it!
 			String authInfo = AUTH_TOKEN_PREFIX + UUID.randomUUID();
 			org.apache.juddi.model.AuthToken modelAuthToken = new org.apache.juddi.model.AuthToken();
-			if (authInfo != null) {
-				modelAuthToken.setAuthToken(authInfo);
-				modelAuthToken.setCreated(new Date());
-				modelAuthToken.setLastUsed(new Date());
-				modelAuthToken.setAuthorizedName(publisherId);
-				modelAuthToken.setNumberOfUses(0);
-				modelAuthToken.setTokenState(AUTHTOKEN_ACTIVE);
-                                modelAuthToken.setIPAddress(this.getRequestorsIPAddress());
-                    
-				em.persist(modelAuthToken);
-			}
+                        modelAuthToken.setAuthToken(authInfo);
+                        modelAuthToken.setCreated(new Date());
+                        modelAuthToken.setLastUsed(new Date());
+                        modelAuthToken.setAuthorizedName(publisherId);
+                        modelAuthToken.setNumberOfUses(0);
+                        modelAuthToken.setTokenState(AUTHTOKEN_ACTIVE);
+                        modelAuthToken.setIPAddress(this.getRequestorsIPAddress());
+                        em.persist(modelAuthToken);
 
 			org.uddi.api_v3.AuthToken apiAuthToken = new org.uddi.api_v3.AuthToken();
 

Modified: juddi/trunk/juddi-gui/src/main/java/org/apache/juddi/webconsole/hub/UddiHub.java
URL: http://svn.apache.org/viewvc/juddi/trunk/juddi-gui/src/main/java/org/apache/juddi/webconsole/hub/UddiHub.java?rev=1540580&r1=1540579&r2=1540580&view=diff
==============================================================================
--- juddi/trunk/juddi-gui/src/main/java/org/apache/juddi/webconsole/hub/UddiHub.java (original)
+++ juddi/trunk/juddi-gui/src/main/java/org/apache/juddi/webconsole/hub/UddiHub.java Mon Nov 11 01:14:22 2013
@@ -328,7 +328,7 @@ public class UddiHub implements Serializ
                     && session.getAttribute("password") != null) {
                 req.setUserID((String) session.getAttribute("username"));
                 req.setCred(AES.Decrypt((String) session.getAttribute("password"), (String) properties.get("key")));
-                log.info("AUDIT: fetching auth token for " + req.getUserID() + " security enable is " + ((security == null) ? "null" : "active"));
+                log.info("AUDIT: fetching auth token for " + req.getUserID() + " Auth Mode is " + ((security == null) ? "HTTO" : "AUTH_TOKEN"));
                 try {
                     AuthToken authToken = security.getAuthToken(req);
                     token = authToken.getAuthInfo();



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@juddi.apache.org
For additional commands, e-mail: commits-help@juddi.apache.org