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 2015/03/27 12:40:35 UTC

[1/5] juddi git commit: JUDDI-931 CLI client

Repository: juddi
Updated Branches:
  refs/heads/master bcd3c0771 -> 9dafe4e83


http://git-wip-us.apache.org/repos/asf/juddi/blob/9dafe4e8/juddi-client-cli/src/main/java/org/apache/juddi/v3/client/cli/WadlImport.java
----------------------------------------------------------------------
diff --git a/juddi-client-cli/src/main/java/org/apache/juddi/v3/client/cli/WadlImport.java b/juddi-client-cli/src/main/java/org/apache/juddi/v3/client/cli/WadlImport.java
new file mode 100644
index 0000000..8ce7e32
--- /dev/null
+++ b/juddi-client-cli/src/main/java/org/apache/juddi/v3/client/cli/WadlImport.java
@@ -0,0 +1,197 @@
+/*
+ * Copyright 2001-2013 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.
+ *
+ */
+package org.apache.juddi.v3.client.cli;
+
+import java.io.File;
+import java.net.URL;
+import java.util.List;
+import java.util.Properties;
+import java.util.Set;
+
+import javax.xml.namespace.QName;
+
+import org.apache.juddi.jaxb.PrintUDDI;
+import org.apache.juddi.v3.client.config.UDDIClerk;
+import org.apache.juddi.v3.client.config.UDDIClient;
+import org.apache.juddi.v3.client.config.UDDIClientContainer;
+import org.apache.juddi.v3.client.mapping.URLLocalizerDefaultImpl;
+import org.apache.juddi.v3.client.mapping.wadl.Application;
+import org.apache.juddi.v3.client.mapping.wadl.WADL2UDDI;
+import org.apache.juddi.v3.client.transport.Transport;
+import org.apache.juddi.v3_service.JUDDIApiPortType;
+import org.uddi.api_v3.AuthToken;
+import org.uddi.api_v3.BusinessDetail;
+import org.uddi.api_v3.BusinessEntity;
+import org.uddi.api_v3.BusinessService;
+import org.uddi.api_v3.BusinessServices;
+import org.uddi.api_v3.GetAuthToken;
+import org.uddi.api_v3.Name;
+import org.uddi.api_v3.SaveBusiness;
+import org.uddi.api_v3.SaveService;
+import org.uddi.api_v3.SaveTModel;
+import org.uddi.api_v3.TModel;
+import org.uddi.v3_service.UDDIPublicationPortType;
+import org.uddi.v3_service.UDDISecurityPortType;
+
+/**
+ * This class shows how to perform a WSDL2UDDI import manually. More
+ * specifically, this is WSDL2UDDI without using annotations.
+ *
+ * @author <a href="mailto:alexoree@apache.org">Alex O'Ree</a>
+ */
+public class WadlImport {
+
+        static PrintUDDI<TModel> pTModel = new PrintUDDI<TModel>();
+        static Properties properties = new Properties();
+
+        private static UDDISecurityPortType security = null;
+        private static JUDDIApiPortType juddiApi = null;
+        private static UDDIPublicationPortType publish = null;
+
+        public void Fire(String pathOrURL, String businessKey, String token, Transport transport) throws Exception {
+
+                if (transport == null) {
+                // create a manager and read the config in the archive; 
+                        // you can use your config file name
+                        UDDIClient clerkManager = new UDDIClient("META-INF/simple-publish-uddi.xml");
+                        transport = clerkManager.getTransport();
+                }
+                // Now you create a reference to the UDDI API
+                security = transport.getUDDISecurityService();
+                publish = transport.getUDDIPublishService();
+
+                if (token == null) {
+                        //step one, get a token
+                        GetAuthToken getAuthTokenRoot = new GetAuthToken();
+                        getAuthTokenRoot.setUserID("uddi");
+                        getAuthTokenRoot.setCred("uddi");
+
+                        // Making API call that retrieves the authentication token for the 'root' user.
+                        AuthToken rootAuthToken = security.getAuthToken(getAuthTokenRoot);
+                        token = rootAuthToken.getAuthInfo();
+                }
+
+                //step two, identify the key used for all your stuff
+                //you must have a key generator created already
+                //here, we are assuming that you don't have one
+                //NOTE: these are some of the publically available WSDLs that were used to test WSDL2UDDI
+                //publish.saveTModel(stm);
+                //step three, we have two options
+                //1) import the wsdl's services into a brand new business
+                //2) import the wsdl's services into an existing business
+                //in either case, we're going to have to parse the WSDL
+                //Application app = WADL2UDDI.parseWadl(new URL("http://server/wsdl.wsdl"), "username", "password", clerkManager.getClientConfig().isX_To_Wsdl_Ignore_SSL_Errors() );
+                Application app = null;
+                if (!pathOrURL.startsWith("http")) {
+                        File f = new File("test.wadl");
+                        if (!f.exists()) {
+                                System.out.println(pathOrURL + " doesn't exist!");
+                                return;
+                        } else {
+                                System.out.println("Attempting to parse " + f.getAbsolutePath());
+                                app = WADL2UDDI.parseWadl(f);
+                        }
+                } else {
+                        app = WADL2UDDI.parseWadl(new URL(pathOrURL));
+                }
+
+                List<URL> urls = WADL2UDDI.getBaseAddresses(app);
+                URL url = urls.get(0);
+                String domain = url.getHost();
+                PrintUDDI<TModel> tmodelPrinter = new PrintUDDI<TModel>();
+                TModel keygen = UDDIClerk.createKeyGenator("uddi:" + domain + ":keygenerator", domain, "en");
+
+                //save the keygen
+                SaveTModel stm = new SaveTModel();
+                stm.setAuthInfo(token);
+                stm.getTModel().add(keygen);
+                System.out.println("Saving the following tModel keygen");
+                System.out.println(tmodelPrinter.print(keygen));
+                publish.saveTModel(stm);
+
+                properties.put("keyDomain", domain);
+                properties.put("businessName", domain);
+                properties.put("serverName", url.getHost());
+                properties.put("serverPort", url.getPort());
+                //wsdlURL = wsdlDefinition.getDocumentBaseURI();
+                WADL2UDDI wadl2UDDI = new WADL2UDDI(null, new URLLocalizerDefaultImpl(), properties);
+
+                BusinessService businessServices = wadl2UDDI.createBusinessService(new QName(domain, domain), app);
+
+                Set<TModel> portTypeTModels = wadl2UDDI.createWADLPortTypeTModels(pathOrURL, app);
+
+                // Set<TModel> createWSDLBindingTModels = wadl2UDDI.createWSDLBindingTModels(wsdlURL, allBindings);
+                //When parsing a WSDL, there's really two things going on
+                //1) convert a bunch of stuff (the portTypes) to tModels
+                //2) convert the service definition to a BusinessService
+                //Since the service depends on the tModel, we have to save the tModels first
+                stm = new SaveTModel();
+                stm.setAuthInfo(token);
+
+                TModel[] tmodels = portTypeTModels.toArray(new TModel[0]);
+                for (int i = 0; i < tmodels.length; i++) {
+                        System.out.println(tmodelPrinter.print(tmodels[i]));
+                        stm.getTModel().add(tmodels[i]);
+                }
+
+                tmodels = wadl2UDDI.createWADLTModels(pathOrURL, app).toArray(new TModel[0]);
+                for (int i = 0; i < tmodels.length; i++) {
+                        System.out.println(tmodelPrinter.print(tmodels[i]));
+                        stm.getTModel().add(tmodels[i]);
+                }
+                //important, you'll need to save your new tModels, or else saving the business/service may fail
+                System.out.println("Saving the following tModels " + stm.getTModel().size());
+                publish.saveTModel(stm);
+
+                //finaly, we're ready to save all of the services defined in the WSDL
+                //again, we're creating a new business, if you have one already, look it up using the Inquiry getBusinessDetails
+                PrintUDDI<BusinessService> servicePrinter = new PrintUDDI<BusinessService>();
+
+                System.out.println("here's our new service: " + servicePrinter.print(businessServices));
+
+                if (businessKey == null || businessKey.length() == 0) {
+                        BusinessEntity be = new BusinessEntity();
+                        be.setBusinessKey(businessServices.getBusinessKey());
+                        be.getName().add(new Name());
+                        be.getName().get(0).setValue(domain);
+                        be.getName().get(0).setLang("en");
+                        be.setBusinessServices(new BusinessServices());
+                        be.getBusinessServices().getBusinessService().add(businessServices);
+                        SaveBusiness sb = new SaveBusiness();
+                        sb.setAuthInfo(token);
+                        sb.getBusinessEntity().add(be);
+                        BusinessDetail saveBusiness = publish.saveBusiness(sb);
+                        System.out.println("new business created, key = " + saveBusiness.getBusinessEntity().get(0).getBusinessKey());
+                }
+                SaveService ss = new SaveService();
+                ss.setAuthInfo(token);
+                businessServices.setBusinessKey(businessKey);
+                ss.getBusinessService().add(businessServices);
+                publish.saveService(ss);
+                System.out.println("Saved! " + businessServices.getServiceKey());
+
+                //and we're done
+                //Be sure to report any problems to the jUDDI JIRA bug tracker at 
+                //https://issues.apache.org/jira/browse/JUDDI
+        }
+
+        public static void main(String[] args) throws Exception {
+
+                new WadlImport().Fire("http://svn.apache.org/repos/asf/cxf/trunk/systests/jaxrs/src/test/resources/wadl/bookstoreImportResource.wadl", null, null, null);
+
+        }
+}

http://git-wip-us.apache.org/repos/asf/juddi/blob/9dafe4e8/juddi-client-cli/src/main/java/org/apache/juddi/v3/client/cli/WsdlImport.java
----------------------------------------------------------------------
diff --git a/juddi-client-cli/src/main/java/org/apache/juddi/v3/client/cli/WsdlImport.java b/juddi-client-cli/src/main/java/org/apache/juddi/v3/client/cli/WsdlImport.java
new file mode 100644
index 0000000..6688983
--- /dev/null
+++ b/juddi-client-cli/src/main/java/org/apache/juddi/v3/client/cli/WsdlImport.java
@@ -0,0 +1,214 @@
+/*
+ * Copyright 2001-2013 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.
+ *
+ */
+package org.apache.juddi.v3.client.cli;
+
+import java.net.URL;
+import java.util.Map;
+import java.util.Properties;
+import java.util.Set;
+
+import javax.wsdl.Definition;
+import javax.wsdl.PortType;
+import javax.xml.namespace.QName;
+
+import org.apache.juddi.jaxb.PrintUDDI;
+import org.apache.juddi.v3.client.config.UDDIClerk;
+import org.apache.juddi.v3.client.config.UDDIClient;
+import org.apache.juddi.v3.client.config.UDDIClientContainer;
+import org.apache.juddi.v3.client.mapping.URLLocalizerDefaultImpl;
+import org.apache.juddi.v3.client.mapping.wsdl.ReadWSDL;
+import org.apache.juddi.v3.client.mapping.wsdl.WSDL2UDDI;
+import org.apache.juddi.v3.client.transport.Transport;
+import org.apache.juddi.v3_service.JUDDIApiPortType;
+import org.uddi.api_v3.AuthToken;
+import org.uddi.api_v3.BusinessDetail;
+import org.uddi.api_v3.BusinessEntity;
+import org.uddi.api_v3.BusinessService;
+import org.uddi.api_v3.BusinessServices;
+import org.uddi.api_v3.GetAuthToken;
+import org.uddi.api_v3.Name;
+import org.uddi.api_v3.SaveBusiness;
+import org.uddi.api_v3.SaveService;
+import org.uddi.api_v3.SaveTModel;
+import org.uddi.api_v3.TModel;
+import org.uddi.v3_service.UDDIPublicationPortType;
+import org.uddi.v3_service.UDDISecurityPortType;
+
+/**
+ * This class shows how to perform a WSDL2UDDI import manually. More
+ * specifically, this is WSDL2UDDI without using annotations.
+ *
+ * @author <a href="mailto:alexoree@apache.org">Alex O'Ree</a>
+ */
+public class WsdlImport {
+
+        static PrintUDDI<TModel> pTModel = new PrintUDDI<TModel>();
+        static Properties properties = new Properties();
+        static String wsdlURL = null;
+        private static UDDISecurityPortType security = null;
+        private static JUDDIApiPortType juddiApi = null;
+        private static UDDIPublicationPortType publish = null;
+
+        public static void main(String[] args) throws Exception {
+                new WsdlImport().Fire("http://svn.apache.org/repos/asf/juddi/trunk/uddi-ws/src/main/resources/juddi_api_v1.wsdl", null, null, null);
+        }
+
+        public void Fire(String pathOrURL, String businessKey, String token, Transport transport) throws Exception {
+
+                if (transport == null) {
+                // create a manager and read the config in the archive; 
+                        // you can use your config file name
+                        UDDIClient clerkManager = new UDDIClient("META-INF/simple-publish-uddi.xml");
+                        transport = clerkManager.getTransport();
+                }
+                // Now you create a reference to the UDDI API
+                security = transport.getUDDISecurityService();
+                publish = transport.getUDDIPublishService();
+
+                if (token == null) {
+                        //step one, get a token
+                        GetAuthToken getAuthTokenRoot = new GetAuthToken();
+                        getAuthTokenRoot.setUserID("uddi");
+                        getAuthTokenRoot.setCred("uddi");
+
+                        // Making API call that retrieves the authentication token for the 'root' user.
+                        AuthToken rootAuthToken = security.getAuthToken(getAuthTokenRoot);
+                        token = rootAuthToken.getAuthInfo();
+                }
+
+                //step two, identify the key used for all your stuff
+                //you must have a key generator created already
+                //here, we are assuming that you don't have one
+                //NOTE: these are some of the publically available WSDLs that were used to test WSDL2UDDI
+                //URL url = new URL("http://wsf.cdyne.com/WeatherWS/Weather.asmx?WSDL");
+                //http://www.bccs.uni.no/~pve002/wsdls/ebi-mafft.wsdl");
+                //http://www.webservicex.net/GenericNAICS.asmx?WSDL");
+                //http://www.webservicex.net/stockquote.asmx?WSDL");
+                //http://www.webservicex.com/globalweather.asmx?WSDL");
+                //http://graphical.weather.gov/xml/SOAP_server/ndfdXMLserver.php?wsdl");
+                String domain = "localhost";
+                int port = 80;
+                if (pathOrURL.startsWith("http")) {
+                        URL url = new URL(pathOrURL);
+                        domain = url.getHost();
+                        port = url.getPort();
+                        if (port == -1) {
+                                if (pathOrURL.startsWith("https://")) {
+                                        port = 443;
+                                }
+                                if (pathOrURL.startsWith("http://")) {
+                                        port = 80;
+                                }
+
+                        }
+                }
+
+                TModel keygen = UDDIClerk.createKeyGenator("uddi:" + domain + ":keygenerator", domain, "en");
+                //save the keygen
+                SaveTModel stm = new SaveTModel();
+                stm.setAuthInfo(token);
+                stm.getTModel().add(keygen);
+                System.out.println("Saving key gen " + keygen.getTModelKey());
+                publish.saveTModel(stm);
+                System.out.println("Saved!");
+
+                //step three, we have two options
+                //1) import the wsdl's services into a brand new business
+                //2) import the wsdl's services into an existing business
+                //in either case, we're going to have to parse the WSDL
+                ReadWSDL rw = new ReadWSDL();
+                Definition wsdlDefinition = null;
+                if (pathOrURL.startsWith("http")) {
+                        wsdlDefinition = rw.readWSDL(new URL(pathOrURL));
+                } else {
+                        wsdlDefinition = rw.readWSDL(pathOrURL);
+                }
+
+                if (wsdlDefinition == null) {
+                        System.out.println("There was an error parsing the WSDL!");
+                        return;
+                }
+                properties.put("keyDomain", domain);
+                properties.put("businessName", domain);
+                properties.put("serverName", domain);
+                properties.put("serverPort", port);
+                wsdlURL = wsdlDefinition.getDocumentBaseURI();
+                WSDL2UDDI wsdl2UDDI = new WSDL2UDDI(null, new URLLocalizerDefaultImpl(), properties);
+                BusinessServices businessServices = wsdl2UDDI.createBusinessServices(wsdlDefinition);
+                @SuppressWarnings("unchecked")
+                Map<QName, PortType> portTypes = (Map<QName, PortType>) wsdlDefinition.getAllPortTypes();
+                Set<TModel> portTypeTModels = wsdl2UDDI.createWSDLPortTypeTModels(wsdlURL, portTypes);
+                Map allBindings = wsdlDefinition.getAllBindings();
+                Set<TModel> createWSDLBindingTModels = wsdl2UDDI.createWSDLBindingTModels(wsdlURL, allBindings);
+        //When parsing a WSDL, there's really two things going on
+                //1) convert a bunch of stuff (the portTypes) to tModels
+                //2) convert the service definition to a BusinessService
+
+                //Since the service depends on the tModel, we have to save the tModels first
+                stm = new SaveTModel();
+                stm.setAuthInfo(token);
+
+                TModel[] tmodels = portTypeTModels.toArray(new TModel[0]);
+                for (int i = 0; i < tmodels.length; i++) {
+                        stm.getTModel().add(tmodels[i]);
+                }
+
+                tmodels = createWSDLBindingTModels.toArray(new TModel[0]);
+                for (int i = 0; i < tmodels.length; i++) {
+                        stm.getTModel().add(tmodels[i]);
+                }
+
+                //important, you'll need to save your new tModels first, or else saving the business/service may fail
+                System.out.println(new PrintUDDI<SaveTModel>().print(stm));
+                System.out.println("Saving " + stm.getTModel().size() + " tModels");
+                publish.saveTModel(stm);
+                System.out.println("Saved!");
+
+                if (businessKey == null || businessKey.length() == 0) {
+                        SaveBusiness sb = new SaveBusiness();
+                        sb.setAuthInfo(token);
+                        BusinessEntity be = new BusinessEntity();
+                        be.setBusinessKey(businessServices.getBusinessService().get(0).getBusinessKey());
+                        be.getName().add(new Name());
+                        be.getName().get(0).setValue(domain);
+                        be.getName().get(0).setLang("en");
+                        sb.getBusinessEntity().add(be);
+                        BusinessDetail saveBusiness = publish.saveBusiness(sb);
+                        businessKey = saveBusiness.getBusinessEntity().get(0).getBusinessKey();
+                        System.out.println("new business created key= " + businessKey);
+                }
+
+                //finaly, we're ready to save all of the services defined in the WSDL
+                //again, we're creating a new business, if you have one already, look it up using the Inquiry getBusinessDetails
+                SaveService ss = new SaveService();
+                ss.setAuthInfo(token);
+                for (int i = 0; i < businessServices.getBusinessService().size(); i++) {
+                        businessServices.getBusinessService().get(i).setBusinessKey(businessKey);
+                        ss.getBusinessService().add(businessServices.getBusinessService().get(i));
+
+                }
+
+                System.out.println("Here's our new service(s): " + new PrintUDDI<SaveService>().print(ss));
+
+                publish.saveService(ss);
+                System.out.println("Saved!");
+
+                //and we're done
+                //Be sure to report any problems to the jUDDI JIRA bug tracker at 
+                //https://issues.apache.org/jira/browse/JUDDI
+        }
+}

http://git-wip-us.apache.org/repos/asf/juddi/blob/9dafe4e8/juddi-client-cli/src/main/java/org/apache/juddi/v3/client/cli/testStrings.java
----------------------------------------------------------------------
diff --git a/juddi-client-cli/src/main/java/org/apache/juddi/v3/client/cli/testStrings.java b/juddi-client-cli/src/main/java/org/apache/juddi/v3/client/cli/testStrings.java
new file mode 100644
index 0000000..d79f240
--- /dev/null
+++ b/juddi-client-cli/src/main/java/org/apache/juddi/v3/client/cli/testStrings.java
@@ -0,0 +1,73 @@
+/*
+ * Copyright 2001-2013 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.
+ *
+ */
+package org.apache.juddi.v3.client.cli;
+
+import java.util.concurrent.atomic.AtomicReference;
+import javax.xml.ws.Holder;
+
+/**
+ * A simple program to illistrate how to pass by "reference" vs by "value" in
+ * Java. Or more accurately, how to persist changes on method parameters to the
+ * caller. Written mostly because I forget it frequently and use this as
+ * reference material.
+ *
+ * @author <a href="mailto:alexoree@apache.org">Alex O'Ree</a>
+ */
+public class testStrings {
+
+    public static void main(String[] args) {
+        String str = "hi";
+        System.out.println(str);                                                //hi
+        System.out.println(Test1(str));                                         //hir
+        System.out.println(Test2(str));                                         //hix
+        Test3(str);
+        System.out.println(str);                                                //hi no change
+        Holder<String> holder = new Holder<String>();
+        holder.value = str;
+        Test4(holder);
+        System.out.println(str);                                                //hi no change
+        System.out.println(holder.value);                                       //hiw changed persists
+
+        AtomicReference<String> astr = new AtomicReference<String>();
+        astr.set(str);
+        Test5(astr);
+        System.out.println(str);                                                //hi no change
+        System.out.println(astr.get());                                         //hit change persists
+
+    }
+
+    static String Test1(String s) {
+        return s + "r";
+    }
+
+    static String Test2(String s) {
+        s += "x";
+        return s;
+    }
+
+    static void Test3(String s) {
+        s += "z";
+    }
+
+    static void Test4(Holder<String> s) {
+        s.value += "w";
+    }
+
+    static void Test5(AtomicReference<String> s) {
+        s.set(s.get() + "t");
+    }
+}

http://git-wip-us.apache.org/repos/asf/juddi/blob/9dafe4e8/juddi-client-cli/src/main/resources/META-INF/simple-publish-uddi.xml
----------------------------------------------------------------------
diff --git a/juddi-client-cli/src/main/resources/META-INF/simple-publish-uddi.xml b/juddi-client-cli/src/main/resources/META-INF/simple-publish-uddi.xml
new file mode 100644
index 0000000..9d071a6
--- /dev/null
+++ b/juddi-client-cli/src/main/resources/META-INF/simple-publish-uddi.xml
@@ -0,0 +1,149 @@
+<?xml version="1.0" encoding="UTF-8"  ?>
+
+<!--
+/*
+ * 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.
+ *
+ -->
+<uddi xmlns="urn:juddi-apache-org:v3_client" xsi:schemaLocation="classpath:/xsd/uddi-client.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema">
+        <reloadDelay>5000</reloadDelay>
+        <client name="example-client">
+                <nodes>
+                        <node isHomeJUDDI="true">
+                                <!-- required 'default' node -->
+                                <name>default</name> 
+                                <properties>
+                                        <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>
+                                <description>Main jUDDI node</description>
+                                <!-- JAX-WS Transport -->
+                                <proxyTransport>org.apache.juddi.v3.client.transport.JAXWSTransport</proxyTransport>
+                                <custodyTransferUrl>http://${serverName}:${serverPort}/juddiv3/services/custody-transfer</custodyTransferUrl>
+                                <inquiryUrl>http://${serverName}:${serverPort}/juddiv3/services/inquiry</inquiryUrl>
+                                <inquiryRESTUrl>http://${serverName}:${serverPort}/juddiv3/services/inquiryRest</inquiryRESTUrl>
+                                <publishUrl>http://${serverName}:${serverPort}/juddiv3/services/publish</publishUrl>
+                                <securityUrl>http://${serverName}:${serverPort}/juddiv3/services/security</securityUrl>
+                                <subscriptionUrl>http://${serverName}:${serverPort}/juddiv3/services/subscription</subscriptionUrl>
+                                <subscriptionListenerUrl>http://${serverName}:${serverPort}/juddiv3/services/subscription-listener</subscriptionListenerUrl>
+                                <juddiApiUrl>http://${serverName}:${serverPort}/juddiv3/services/juddi-api</juddiApiUrl>
+                                <replicationUrl>https://${serverName}:8443/juddiv3replication/services/replication</replicationUrl>
+                        </node>
+                        <node>
+                                <!-- required 'default' node -->
+                                <name>uddi:another.juddi.apache.org:node2</name> 
+                                <properties>
+                                        <property name="serverName" value="localhost"/>
+                                        <property name="serverPort" value="9080"/>
+                                        
+                                        <!-- 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>
+                                <description>juddi node on 9080</description>
+                                <!-- JAX-WS Transport -->
+                                <proxyTransport>org.apache.juddi.v3.client.transport.JAXWSTransport</proxyTransport>
+                                <custodyTransferUrl>http://${serverName}:${serverPort}/juddiv3/services/custody-transfer</custodyTransferUrl>
+                                <inquiryUrl>http://${serverName}:${serverPort}/juddiv3/services/inquiry</inquiryUrl>
+                                <inquiryRESTUrl>http://${serverName}:${serverPort}/juddiv3/services/inquiryRest</inquiryRESTUrl>
+                                <publishUrl>http://${serverName}:${serverPort}/juddiv3/services/publish</publishUrl>
+                                <securityUrl>http://${serverName}:${serverPort}/juddiv3/services/security</securityUrl>
+                                <subscriptionUrl>http://${serverName}:${serverPort}/juddiv3/services/subscription</subscriptionUrl>
+                                <subscriptionListenerUrl>http://${serverName}:${serverPort}/juddiv3/services/subscription-listener</subscriptionListenerUrl>
+                                <juddiApiUrl>http://${serverName}:${serverPort}/juddiv3/services/juddi-api</juddiApiUrl>
+                                <replicationUrl>https://${serverName}:9443/juddiv3replication/services/replication</replicationUrl>
+                        </node>
+                        
+                        <node>
+                                <!-- required 'default' node -->
+                                <name>uddi:yet.another.juddi.apache.org:node3</name> 
+                                <properties>
+                                        <property name="serverName" value="localhost"/>
+                                        <property name="serverPort" value="10080"/>
+                                        
+                                        <!-- 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>
+                                <description>juddi node on 10080</description>
+                                <!-- JAX-WS Transport -->
+                                <proxyTransport>org.apache.juddi.v3.client.transport.JAXWSTransport</proxyTransport>
+                                <custodyTransferUrl>http://${serverName}:${serverPort}/juddiv3/services/custody-transfer</custodyTransferUrl>
+                                <inquiryUrl>http://${serverName}:${serverPort}/juddiv3/services/inquiry</inquiryUrl>
+                                <inquiryRESTUrl>http://${serverName}:${serverPort}/juddiv3/services/inquiryRest</inquiryRESTUrl>
+                                <publishUrl>http://${serverName}:${serverPort}/juddiv3/services/publish</publishUrl>
+                                <securityUrl>http://${serverName}:${serverPort}/juddiv3/services/security</securityUrl>
+                                <subscriptionUrl>http://${serverName}:${serverPort}/juddiv3/services/subscription</subscriptionUrl>
+                                <subscriptionListenerUrl>http://${serverName}:${serverPort}/juddiv3/services/subscription-listener</subscriptionListenerUrl>
+                                <juddiApiUrl>http://${serverName}:${serverPort}/juddiv3/services/juddi-api</juddiApiUrl>
+                                <replicationUrl>https://${serverName}:10443/juddiv3replication/services/replication</replicationUrl>
+                        </node>
+                </nodes>
+                <clerks registerOnStartup="false">
+                        <clerk name="default" node="default" publisher="uddi" password="uddi"  isPasswordEncrypted="false" cryptoProvider=""/>
+                </clerks>
+                <signature>
+                        <!-- signing stuff -->
+                        <signingKeyStorePath>keystore.jks</signingKeyStorePath>
+                        <signingKeyStoreType>JKS</signingKeyStoreType>
+                        <signingKeyStoreFilePassword 
+                                isPasswordEncrypted="false" 
+                                cryptoProvider="org.apache.juddi.v3.client.crypto.AES128Cryptor">password</signingKeyStoreFilePassword>
+                        <signingKeyPassword
+                                isPasswordEncrypted="false" 
+                                cryptoProvider="org.apache.juddi.v3.client.crypto.AES128Cryptor">password</signingKeyPassword>
+                        <signingKeyAlias>my special key</signingKeyAlias>
+                        
+                        <canonicalizationMethod>http://www.w3.org/2001/10/xml-exc-c14n#</canonicalizationMethod>
+                        <signatureMethod>http://www.w3.org/2000/09/xmldsig#rsa-sha1</signatureMethod>
+                        <XML_DIGSIG_NS>http://www.w3.org/2000/09/xmldsig#</XML_DIGSIG_NS>
+
+                        <!-- validation stuff 
+                        Used whenever someone views an entity that is signed and validation is required	-->
+                        <!-- if this doesn't exist or is incorrect, the client will atempt to load the standard jdk trust store-->
+                        <trustStorePath>truststore.jks</trustStorePath>
+                        <trustStoreType>JKS</trustStoreType>
+                        <trustStorePassword
+                                isPasswordEncrypted="false" 
+                                cryptoProvider="org.apache.juddi.v3.client.crypto.AES128Cryptor">password</trustStorePassword>
+			
+                        <checkTimestamps>true</checkTimestamps>
+                        <checkTrust>true</checkTrust>
+                        <checkRevocationCRL>true</checkRevocationCRL>
+                        <keyInfoInclusionSubjectDN>true</keyInfoInclusionSubjectDN>
+                        <keyInfoInclusionSerial>true</keyInfoInclusionSerial>
+                        <keyInfoInclusionBase64PublicKey>true</keyInfoInclusionBase64PublicKey>
+                        <digestMethod>http://www.w3.org/2000/09/xmldsig#sha1</digestMethod>
+                </signature>
+        
+                <subscriptionCallbacks>
+                        <keyDomain>uddi:somebusiness</keyDomain>
+                        <listenUrl></listenUrl> <!-- this is to override the generated values -->
+                        <autoRegisterBindingTemplate>true</autoRegisterBindingTemplate>
+                        <autoRegisterBusinessServiceKey>uddi:somebusiness:someservicekey</autoRegisterBusinessServiceKey>
+                        <signatureBehavior>DoNothing</signatureBehavior>
+                </subscriptionCallbacks>
+        </client>
+</uddi>

http://git-wip-us.apache.org/repos/asf/juddi/blob/9dafe4e8/juddi-client-cli/truststore.jks
----------------------------------------------------------------------
diff --git a/juddi-client-cli/truststore.jks b/juddi-client-cli/truststore.jks
new file mode 100644
index 0000000..e751384
Binary files /dev/null and b/juddi-client-cli/truststore.jks differ

http://git-wip-us.apache.org/repos/asf/juddi/blob/9dafe4e8/juddi-client/src/main/java/org/apache/juddi/v3/client/ext/wsdm/WSDMQosConstants.java
----------------------------------------------------------------------
diff --git a/juddi-client/src/main/java/org/apache/juddi/v3/client/ext/wsdm/WSDMQosConstants.java b/juddi-client/src/main/java/org/apache/juddi/v3/client/ext/wsdm/WSDMQosConstants.java
index 81b2f70..ded2528 100644
--- a/juddi-client/src/main/java/org/apache/juddi/v3/client/ext/wsdm/WSDMQosConstants.java
+++ b/juddi-client/src/main/java/org/apache/juddi/v3/client/ext/wsdm/WSDMQosConstants.java
@@ -39,16 +39,25 @@ public abstract class WSDMQosConstants {
          * The number of requests to a given service. (number of requests)
          */
         public static final String METRIC_REQUEST_COUNT_KEY = "urn:wsdm.org:metric:requestcount";
+        /**
+         * The number of requests to a given service. (number of requests)
+         */
         public static final String METRIC_RequestCount = "RequestCount";
         /**
          * The number of replies from a given service. (number of replies)
          */
         public static final String METRIC_REPLY_COUNT_KEY = "urn:wsdm.org:metric:replycount";
+         /**
+         * The number of replies from a given service. (number of replies)
+         */
         public static final String METRIC_ReplyCount = "ReplyCount";
         /**
          * The number of faults from a given service. (number of faults)
          */
         public static final String METRIC_FAULT_COUNT_KEY = "urn:wsdm.org:metric:faultcount";
+        /**
+         * The number of faults from a given service. (number of faults)
+         */
         public static final String METRIC_FaultCount = "FaultCount";
         /**
          * This is the unique identity by which the resource (service) is known
@@ -56,17 +65,29 @@ public abstract class WSDMQosConstants {
          * identification in URI format)
          */
         public static final String IDENTITY_RESOURCE_ID_KEY = "urn:wsdm.org:identity:resourceId";
+        /**
+         * This is the unique identity by which the resource (service) is known
+         * to the management system. It is useful for further queries. (resource
+         * identification in URI format)
+         */
         public static final String IDENTITY_ResourceId = "ResourceId";
         /**
          * Represents the last time this metric was updated. (time value)
          */
         public static final String METRIC_LAST_UPDATE_TIME_KEY = "urn:wsdm.org:metric:lastupdatetime";
+        /**
+         * Represents the last time this metric was updated. (time value)
+         */
         public static final String METRIC_LastUpdateTime = "LastUpdateTime";
         /**
          * Average response time of the service. (numeric value or symbolic
          * rating)
          */
         public static final String QOS_RESPONSE_TIME_AVG_KEY = "urn:wsdm.org:qos:responsetime_average";
+        /**
+         * Average response time of the service. (numeric value or symbolic
+         * rating)
+         */
         public static final String QOS_ResponseTime_Average = "ResponseTime_Average";
         /**
          * Throughput count. (numeric value or symbolic rating)
@@ -77,29 +98,47 @@ public abstract class WSDMQosConstants {
          * Throughput bytes. (numeric value or symbolic rating)
          */
         public static final String QOS_THROUGHPUT_BYTES_KEY = "urn:wsdm.org:qos:throughput_bytes";
+        /**
+         * Throughput bytes. (numeric value or symbolic rating)
+         */
         public static final String QOS_Throughput_bytes = "Throughput_bytes";
         /**
          * Reliability or the measure of. (numeric value or symbolic rating)
          */
         public static final String QOS_RELIABILITY_KEY = "urn:wsdm.org:qos:reliability";
+        /**
+         * Reliability or the measure of. (numeric value or symbolic rating)
+         */
         public static final String QOS_Reliability = "Reliability";
         /**
          * The beginning on the reporting time period used for the information
          * above. (dateTime)
          */
         public static final String QOS_REPORTING_PERIOD_START_KEY = "urn:wsdm.org:qos:reportingperiodstart";
+        /**
+         * The beginning on the reporting time period used for the information
+         * above. (dateTime)
+         */
         public static final String QOS_ReportingPeriodStart = "ReportingPeriodStart";
         /**
          * The end of the reporting time period used for the information above.
          * (dateTime)
          */
         public static final String QOS_REPORTING_PERIOD_END_KEY = "urn:wsdm.org:qos:reportingperiodend";
+        /**
+         * The end of the reporting time period used for the information above.
+         * (dateTime)
+         */
         public static final String QOS_ReportingPeriodEnd = "ReportingPeriodEnd";
         /**
          * How often is this information updated in UDDI (it is not assumed to
          * be realtime). (duration)
          */
         public static final String QOS_UPDATE_INTERVAL_KEY = "urn:wsdm.org:qos:updateinterval";
+        /**
+         * How often is this information updated in UDDI (it is not assumed to
+         * be realtime). (duration)
+         */
         public static final String QOS_UpdateInterval = "UpdateInterval";
 
         public static List<String> getAllQOSKeys() {

http://git-wip-us.apache.org/repos/asf/juddi/blob/9dafe4e8/juddi-client/src/main/java/org/apache/juddi/v3/client/mapping/wsdl/ReadWSDL.java
----------------------------------------------------------------------
diff --git a/juddi-client/src/main/java/org/apache/juddi/v3/client/mapping/wsdl/ReadWSDL.java b/juddi-client/src/main/java/org/apache/juddi/v3/client/mapping/wsdl/ReadWSDL.java
index 706e115..6b9299a 100644
--- a/juddi-client/src/main/java/org/apache/juddi/v3/client/mapping/wsdl/ReadWSDL.java
+++ b/juddi-client/src/main/java/org/apache/juddi/v3/client/mapping/wsdl/ReadWSDL.java
@@ -51,12 +51,15 @@ public class ReadWSDL {
                         File f = new File(fileName);
                         URL url = null;
                         if (f.exists()) {
+                                log.info(fileName + " as a local file doesn't exist.");
                                 url = f.toURI().toURL();
                         } else {
                                 url = ClassUtil.getResource(fileName, this.getClass());
                         }
-                        if (url==null)
+                        if (url==null){
+                                log.info(fileName + " as a class path resource doesn't exist.");
                                 throw new WSDLException("null input", fileName);
+                        }
                         URI uri = url.toURI();
                         WSDLLocator locator = new WSDLLocatorImpl(uri);
                         wsdlDefinition = reader.readWSDL(locator);

http://git-wip-us.apache.org/repos/asf/juddi/blob/9dafe4e8/juddi-client/src/main/java/org/apache/juddi/v3/client/subscription/SubscriptionCallbackListener.java
----------------------------------------------------------------------
diff --git a/juddi-client/src/main/java/org/apache/juddi/v3/client/subscription/SubscriptionCallbackListener.java b/juddi-client/src/main/java/org/apache/juddi/v3/client/subscription/SubscriptionCallbackListener.java
index e1dd5c2..a424e19 100644
--- a/juddi-client/src/main/java/org/apache/juddi/v3/client/subscription/SubscriptionCallbackListener.java
+++ b/juddi-client/src/main/java/org/apache/juddi/v3/client/subscription/SubscriptionCallbackListener.java
@@ -81,10 +81,9 @@ import org.uddi.v3_service.UDDIPublicationPortType;
  * @author <a href="mailto:alexoree@apache.org">Alex O'Ree</a>
  * @since 3.2
  */
-
-@WebService(serviceName="UDDISubscriptionListenerClientService", 
-			endpointInterface="org.uddi.v3_service.UDDISubscriptionListenerPortType",
-			targetNamespace = "urn:uddi-org:v3_service")
+@WebService(serviceName = "UDDISubscriptionListenerClientService",
+        endpointInterface = "org.uddi.v3_service.UDDISubscriptionListenerPortType",
+        targetNamespace = "urn:uddi-org:v3_service")
 public class SubscriptionCallbackListener implements org.uddi.v3_service.UDDISubscriptionListenerPortType, Runnable {
 
         /**
@@ -120,7 +119,7 @@ public class SubscriptionCallbackListener implements org.uddi.v3_service.UDDISub
          * connect to the client's subscription listener service Recommend
          * specifying a port that is firewall friendly
          * @param keydomain
-         
+         *
          * @param autoregister
          * @param behavior
          * @param serviceKey
@@ -133,7 +132,8 @@ public class SubscriptionCallbackListener implements org.uddi.v3_service.UDDISub
          * @throws TransportException
          * @throws DispositionReportFaultMessage
          * @throws java.rmi.UnexpectedException
-         * @throws org.apache.juddi.v3.client.subscription.RegistrationAbortedException
+         * @throws
+         * org.apache.juddi.v3.client.subscription.RegistrationAbortedException
          * @throws java.net.MalformedURLException
          * @throws org.apache.juddi.v3.client.subscription.UnableToSignException
          * @see Endpoint
@@ -158,7 +158,7 @@ public class SubscriptionCallbackListener implements org.uddi.v3_service.UDDISub
                         url = new URL("http://" + GetHostname() + ":" + GetRandomPort(4000) + "/" + UUID.randomUUID().toString());
                 }
                 endpoint = url.toString();
-        //if (endpoint == null || endpoint.equals("")) {
+                //if (endpoint == null || endpoint.equals("")) {
                 //    endpoint = "http://" + GetHostname() + ":" + GetRandomPort(url.getPort()) + "/" + UUID.randomUUID().toString();
 
                 int attempts = 5;
@@ -210,7 +210,8 @@ public class SubscriptionCallbackListener implements org.uddi.v3_service.UDDISub
 
         /**
          * Starts a subscription callback service using the juddi client config
-         * file's settings. This will use the config setting PROPERTY_NODE, or default if not defined
+         * file's settings. This will use the config setting PROPERTY_NODE, or
+         * default if not defined
          *
          * @param client
          * @return a bindingtemplate populated with the relevant information for
@@ -222,19 +223,22 @@ public class SubscriptionCallbackListener implements org.uddi.v3_service.UDDISub
          * @throws DispositionReportFaultMessage
          * @throws UnexpectedException
          * @throws RemoteException
-         * @throws org.apache.juddi.v3.client.subscription.RegistrationAbortedException
+         * @throws
+         * org.apache.juddi.v3.client.subscription.RegistrationAbortedException
          * @throws org.apache.juddi.v3.client.subscription.UnableToSignException
          * @throws java.net.MalformedURLException
          */
         public static synchronized BindingTemplate start(UDDIClient client) throws ServiceAlreadyStartedException, SecurityException, ConfigurationException, TransportException, DispositionReportFaultMessage, UnexpectedException, RemoteException, RegistrationAbortedException, UnableToSignException, MalformedURLException {
-                return start(client, client.getClientConfig().getConfiguration().getString(PROPERTY_NODE,"default"));
+                return start(client, client.getClientConfig().getConfiguration().getString(PROPERTY_NODE, "default"));
         }
+
         /**
          * Starts a subscription callback service using the juddi client config
          * file's settings. This will use the specified node
          *
          * @param client
-         * @param cfg_node_name the node to connect to and perform all operations on
+         * @param cfg_node_name the node to connect to and perform all
+         * operations on
          * @return a bindingtemplate populated with the relevant information for
          * most UDDI servers for asynchronous callbacks.
          * @throws ServiceAlreadyStartedException
@@ -244,25 +248,31 @@ public class SubscriptionCallbackListener implements org.uddi.v3_service.UDDISub
          * @throws DispositionReportFaultMessage
          * @throws UnexpectedException
          * @throws RemoteException
-         * @throws org.apache.juddi.v3.client.subscription.RegistrationAbortedException
+         * @throws
+         * org.apache.juddi.v3.client.subscription.RegistrationAbortedException
          * @throws org.apache.juddi.v3.client.subscription.UnableToSignException
          * @throws java.net.MalformedURLException
          */
         public static synchronized BindingTemplate start(UDDIClient client, String cfg_node_name) throws ServiceAlreadyStartedException, SecurityException, ConfigurationException, TransportException, DispositionReportFaultMessage, UnexpectedException, RemoteException, RegistrationAbortedException, UnableToSignException, MalformedURLException {
 
-                boolean reg = (client.getClientConfig().getConfiguration().getBoolean(PROPERTY_AUTOREG_BT, false));
-                String endpoint = client.getClientConfig().getConfiguration().getString(PROPERTY_LISTENURL);
-                String kd = client.getClientConfig().getConfiguration().getString(PROPERTY_KEYDOMAIN);
-                String key = client.getClientConfig().getConfiguration().getString(PROPERTY_AUTOREG_SERVICE_KEY);
-                String sbs = client.getClientConfig().getConfiguration().getString(PROPERTY_SIGNATURE_BEHAVIOR);
-                SignatureBehavior sb = SignatureBehavior.DoNothing;
                 try {
-                        sb = SignatureBehavior.valueOf(sbs);
-                } catch (Exception ex) {
-                        log.warn("Unable to parse config setting for SignatureBehavior, defaulting to DoNothing", ex);
+                        boolean reg = (client.getClientConfig().getConfiguration().getBoolean(PROPERTY_AUTOREG_BT, false));
+
+                        String endpoint = client.getClientConfig().getConfiguration().getString(PROPERTY_LISTENURL);
+                        String kd = client.getClientConfig().getConfiguration().getString(PROPERTY_KEYDOMAIN);
+                        String key = client.getClientConfig().getConfiguration().getString(PROPERTY_AUTOREG_SERVICE_KEY);
+                        String sbs = client.getClientConfig().getConfiguration().getString(PROPERTY_SIGNATURE_BEHAVIOR);
+                        SignatureBehavior sb = SignatureBehavior.DoNothing;
+                        try {
+                                sb = SignatureBehavior.valueOf(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);
+                } catch (ConfigurationException ex) {
+                        throw new ConfigurationException("failed to some critical settings from the juddi client config file. I won't be able to fire up the subscription callback endpoint ", ex);
                 }
 
-                return start(client, cfg_node_name, endpoint, kd, reg, key, sb);
         }
         private static String callback = null;
 
@@ -308,7 +318,7 @@ public class SubscriptionCallbackListener implements org.uddi.v3_service.UDDISub
          * config parameter
          */
         public static final String PROPERTY_LISTENURL = "client.subscriptionCallbacks.listenUrl";
-                /**
+        /**
          * config parameter, if not defined, default will be used
          */
         public static final String PROPERTY_NODE = "client.subscriptionCallbacks.node";
@@ -547,10 +557,11 @@ public class SubscriptionCallbackListener implements org.uddi.v3_service.UDDISub
         /**
          * This effectively stops the endpoint address and notifies all
          * ISubscriptionCallback clients that the endpoint as been stopped.
-         * After it has been stopped, all ISubscriptionCallback are removed
-         * from the callback list. If the configuration file is set to automatically
-         * register binding templates, the binding template will be unregistered from
-         * the UDDI server
+         * After it has been stopped, all ISubscriptionCallback are removed from
+         * the callback list. If the configuration file is set to automatically
+         * register binding templates, the binding template will be unregistered
+         * from the UDDI server
+         *
          * @param client
          * @param cfg_node_name
          * @param bindingKey
@@ -569,7 +580,7 @@ public class SubscriptionCallbackListener implements org.uddi.v3_service.UDDISub
                 }
                 unregisterAllCallbacks();
                 if (client.getClientConfig().getConfiguration().getBoolean(PROPERTY_AUTOREG_BT, false) && bindingKey != null) {
-                        
+
                         try {
                                 UDDIClerk clerk = client.getClerk(cfg_node_name);
                                 Transport tp = client.getTransport(cfg_node_name);
@@ -585,7 +596,7 @@ public class SubscriptionCallbackListener implements org.uddi.v3_service.UDDISub
                         }
                 }
 
-        //TODO optionally kill the subscription?
+                //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

http://git-wip-us.apache.org/repos/asf/juddi/blob/9dafe4e8/juddi-client/src/main/java/org/apache/juddi/v3/client/transport/JAXWSTransport.java
----------------------------------------------------------------------
diff --git a/juddi-client/src/main/java/org/apache/juddi/v3/client/transport/JAXWSTransport.java b/juddi-client/src/main/java/org/apache/juddi/v3/client/transport/JAXWSTransport.java
index 1c6da05..1593e64 100644
--- a/juddi-client/src/main/java/org/apache/juddi/v3/client/transport/JAXWSTransport.java
+++ b/juddi-client/src/main/java/org/apache/juddi/v3/client/transport/JAXWSTransport.java
@@ -79,7 +79,10 @@ public class JAXWSTransport extends Transport {
                                 inquiryService = service.getUDDIInquiryPort();
                         }
                         Map<String, Object> requestContext = ((BindingProvider) inquiryService).getRequestContext();
+                        if (endpointURL != null) {
+                        
                         requestContext.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, endpointURL);
+                        }
                         setCredentials(requestContext);
                 } catch (Exception e) {
                         throw new TransportException(e.getMessage(), e);
@@ -123,6 +126,7 @@ public class JAXWSTransport extends Transport {
                                 publishService = service.getUDDIPublicationPort();
                         }
                         Map<String, Object> requestContext = ((BindingProvider) publishService).getRequestContext();
+                        if (endpointURL != null)
                         requestContext.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, endpointURL);
                         setCredentials(requestContext);
                 } catch (Exception e) {

http://git-wip-us.apache.org/repos/asf/juddi/blob/9dafe4e8/juddi-examples/more-uddi-samples/src/main/java/org/apache/juddi/samples/SimpleBrowse.java
----------------------------------------------------------------------
diff --git a/juddi-examples/more-uddi-samples/src/main/java/org/apache/juddi/samples/SimpleBrowse.java b/juddi-examples/more-uddi-samples/src/main/java/org/apache/juddi/samples/SimpleBrowse.java
new file mode 100644
index 0000000..0bd8085
--- /dev/null
+++ b/juddi-examples/more-uddi-samples/src/main/java/org/apache/juddi/samples/SimpleBrowse.java
@@ -0,0 +1,359 @@
+/*
+ * Copyright 2001-2010 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.
+ *
+ */
+package org.apache.juddi.example.browse;
+
+import java.util.List;
+import org.apache.juddi.api_v3.AccessPointType;
+import org.apache.juddi.v3.client.UDDIConstants;
+import org.apache.juddi.v3.client.config.UDDIClient;
+import org.apache.juddi.v3.client.transport.Transport;
+import org.uddi.api_v3.AuthToken;
+import org.uddi.api_v3.BindingTemplates;
+import org.uddi.api_v3.BusinessDetail;
+import org.uddi.api_v3.BusinessInfos;
+import org.uddi.api_v3.BusinessList;
+import org.uddi.api_v3.BusinessService;
+import org.uddi.api_v3.CategoryBag;
+import org.uddi.api_v3.Contacts;
+import org.uddi.api_v3.Description;
+import org.uddi.api_v3.DiscardAuthToken;
+import org.uddi.api_v3.FindBusiness;
+import org.uddi.api_v3.GetAuthToken;
+import org.uddi.api_v3.GetBusinessDetail;
+import org.uddi.api_v3.GetServiceDetail;
+import org.uddi.api_v3.KeyedReference;
+import org.uddi.api_v3.Name;
+import org.uddi.api_v3.ServiceDetail;
+import org.uddi.api_v3.ServiceInfos;
+import org.uddi.v3_service.UDDIInquiryPortType;
+import org.uddi.v3_service.UDDISecurityPortType;
+
+/**
+ * A Simple UDDI Browser that dumps basic information to console
+ *
+ * @author <a href="mailto:alexoree@apache.org">Alex O'Ree</a>
+ */
+public class SimpleBrowse {
+
+        private static UDDISecurityPortType security = null;
+        private static UDDIInquiryPortType inquiry = null;
+
+        /**
+         * This sets up the ws proxies using uddi.xml in META-INF
+         */
+        public SimpleBrowse() {
+                try {
+        	// create a manager and read the config in the archive; 
+                        // you can use your config file name
+                        UDDIClient client = new UDDIClient("META-INF/simple-browse-uddi.xml");
+        	// 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");
+                        // Now you create a reference to the UDDI API
+                        security = transport.getUDDISecurityService();
+                        inquiry = transport.getUDDIInquiryService();
+                } catch (Exception e) {
+                        e.printStackTrace();
+                }
+        }
+
+        /**
+         * Main entry point
+         *
+         * @param args
+         */
+        public static void main(String args[]) {
+
+                SimpleBrowse sp = new SimpleBrowse();
+                sp.Browse(args);
+        }
+
+        public void Browse(String[] args) {
+                try {
+
+                        String token = GetAuthKey("uddi", "uddi");
+                        BusinessList findBusiness = GetBusinessList(token);
+                        PrintBusinessInfo(findBusiness.getBusinessInfos());
+                        PrintBusinessDetails(findBusiness.getBusinessInfos(), token);
+                        PrintServiceDetailsByBusiness(findBusiness.getBusinessInfos(), token);
+
+                        security.discardAuthToken(new DiscardAuthToken(token));
+
+                } catch (Exception e) {
+                        e.printStackTrace();
+                }
+        }
+
+        /**
+         * Find all of the registered businesses. This list may be filtered
+         * based on access control rules
+         *
+         * @param token
+         * @return
+         * @throws Exception
+         */
+        private BusinessList GetBusinessList(String token) throws Exception {
+                FindBusiness fb = new FindBusiness();
+                fb.setAuthInfo(token);
+                org.uddi.api_v3.FindQualifiers fq = new org.uddi.api_v3.FindQualifiers();
+                fq.getFindQualifier().add(UDDIConstants.APPROXIMATE_MATCH);
+
+                fb.setFindQualifiers(fq);
+                Name searchname = new Name();
+                searchname.setValue(UDDIConstants.WILDCARD);
+                fb.getName().add(searchname);
+                BusinessList findBusiness = inquiry.findBusiness(fb);
+                return findBusiness;
+
+        }
+
+        /**
+         * Converts category bags of tmodels to a readable string
+         *
+         * @param categoryBag
+         * @return
+         */
+        private String CatBagToString(CategoryBag categoryBag) {
+                StringBuilder sb = new StringBuilder();
+                if (categoryBag == null) {
+                        return "no data";
+                }
+                for (int i = 0; i < categoryBag.getKeyedReference().size(); i++) {
+                        sb.append(KeyedReferenceToString(categoryBag.getKeyedReference().get(i)));
+                }
+                for (int i = 0; i < categoryBag.getKeyedReferenceGroup().size(); i++) {
+                        sb.append("Key Ref Grp: TModelKey=");
+                        for (int k = 0; k < categoryBag.getKeyedReferenceGroup().get(i).getKeyedReference().size(); k++) {
+                                sb.append(KeyedReferenceToString(categoryBag.getKeyedReferenceGroup().get(i).getKeyedReference().get(k)));
+                        }
+                }
+                return sb.toString();
+        }
+
+        private String KeyedReferenceToString(KeyedReference item) {
+                StringBuilder sb = new StringBuilder();
+                sb.append("Key Ref: Name=").
+                        append(item.getKeyName()).
+                        append(" Value=").
+                        append(item.getKeyValue()).
+                        append(" tModel=").
+                        append(item.getTModelKey()).
+                        append(System.getProperty("line.separator"));
+                return sb.toString();
+        }
+
+        private void PrintContacts(Contacts contacts) {
+                if (contacts == null) {
+                        return;
+                }
+                for (int i = 0; i < contacts.getContact().size(); i++) {
+                        System.out.println("Contact " + i + " type:" + contacts.getContact().get(i).getUseType());
+                        for (int k = 0; k < contacts.getContact().get(i).getPersonName().size(); k++) {
+                                System.out.println("Name: " + contacts.getContact().get(i).getPersonName().get(k).getValue());
+                        }
+                        for (int k = 0; k < contacts.getContact().get(i).getEmail().size(); k++) {
+                                System.out.println("Email: " + contacts.getContact().get(i).getEmail().get(k).getValue());
+                        }
+                        for (int k = 0; k < contacts.getContact().get(i).getAddress().size(); k++) {
+                                System.out.println("Address sort code " + contacts.getContact().get(i).getAddress().get(k).getSortCode());
+                                System.out.println("Address use type " + contacts.getContact().get(i).getAddress().get(k).getUseType());
+                                System.out.println("Address tmodel key " + contacts.getContact().get(i).getAddress().get(k).getTModelKey());
+                                for (int x = 0; x < contacts.getContact().get(i).getAddress().get(k).getAddressLine().size(); x++) {
+                                        System.out.println("Address line value " + contacts.getContact().get(i).getAddress().get(k).getAddressLine().get(x).getValue());
+                                        System.out.println("Address line key name " + contacts.getContact().get(i).getAddress().get(k).getAddressLine().get(x).getKeyName());
+                                        System.out.println("Address line key value " + contacts.getContact().get(i).getAddress().get(k).getAddressLine().get(x).getKeyValue());
+                                }
+                        }
+                        for (int k = 0; k < contacts.getContact().get(i).getDescription().size(); k++) {
+                                System.out.println("Desc: " + contacts.getContact().get(i).getDescription().get(k).getValue());
+                        }
+                        for (int k = 0; k < contacts.getContact().get(i).getPhone().size(); k++) {
+                                System.out.println("Phone: " + contacts.getContact().get(i).getPhone().get(k).getValue());
+                        }
+                }
+
+        }
+
+        private void PrintServiceDetail(BusinessService get) {
+                if (get == null) {
+                        return;
+                }
+                System.out.println("Name " + ListToString(get.getName()));
+                System.out.println("Desc " + ListToDescString(get.getDescription()));
+                System.out.println("Key " + (get.getServiceKey()));
+                System.out.println("Cat bag " + CatBagToString(get.getCategoryBag()));
+                if (!get.getSignature().isEmpty()) {
+                        System.out.println("Item is digitally signed");
+                } else {
+                        System.out.println("Item is not digitally signed");
+                }
+                PrintBindingTemplates(get.getBindingTemplates());
+        }
+
+        /**
+         * This function is useful for translating UDDI's somewhat complex data
+         * format to something that is more useful.
+         *
+         * @param bindingTemplates
+         */
+        private void PrintBindingTemplates(BindingTemplates bindingTemplates) {
+                if (bindingTemplates == null) {
+                        return;
+                }
+                for (int i = 0; i < bindingTemplates.getBindingTemplate().size(); i++) {
+                        System.out.println("Binding Key: " + bindingTemplates.getBindingTemplate().get(i).getBindingKey());
+            //TODO The UDDI spec is kind of strange at this point.
+                        //An access point could be a URL, a reference to another UDDI binding key, a hosting redirector (which is 
+                        //esscentially a pointer to another UDDI registry) or a WSDL Deployment
+                        //From an end client's perspective, all you really want is the endpoint.
+                        //http://uddi.org/pubs/uddi_v3.htm#_Ref8977716
+                        //So if you have a wsdlDeployment useType, fetch the wsdl and parse for the invocation URL
+                        //If its hosting director, you'll have to fetch that data from uddi recursively until the leaf node is found
+                        //Consult the UDDI specification for more information
+
+                        if (bindingTemplates.getBindingTemplate().get(i).getAccessPoint() != null) {
+                                System.out.println("Access Point: " + bindingTemplates.getBindingTemplate().get(i).getAccessPoint().getValue() + " type " + bindingTemplates.getBindingTemplate().get(i).getAccessPoint().getUseType());
+                                if (bindingTemplates.getBindingTemplate().get(i).getAccessPoint().getUseType() != null) {
+                                        if (bindingTemplates.getBindingTemplate().get(i).getAccessPoint().getUseType().equalsIgnoreCase(AccessPointType.END_POINT.toString())) {
+                                                System.out.println("Use this access point value as an invocation endpoint.");
+                                        }
+                                        if (bindingTemplates.getBindingTemplate().get(i).getAccessPoint().getUseType().equalsIgnoreCase(AccessPointType.BINDING_TEMPLATE.toString())) {
+                                                System.out.println("Use this access point value as a reference to another binding template.");
+                                        }
+                                        if (bindingTemplates.getBindingTemplate().get(i).getAccessPoint().getUseType().equalsIgnoreCase(AccessPointType.WSDL_DEPLOYMENT.toString())) {
+                                                System.out.println("Use this access point value as a URL to a WSDL document, which presumably will have a real access point defined.");
+                                        }
+                                        if (bindingTemplates.getBindingTemplate().get(i).getAccessPoint().getUseType().equalsIgnoreCase(AccessPointType.HOSTING_REDIRECTOR.toString())) {
+                                                System.out.println("Use this access point value as an Inquiry URL of another UDDI registry, look up the same binding template there (usage varies).");
+                                        }
+                                }
+                        }
+
+                }
+        }
+
+        private enum AuthStyle {
+
+                HTTP_BASIC,
+                HTTP_DIGEST,
+                HTTP_NTLM,
+                UDDI_AUTH,
+                HTTP_CLIENT_CERT
+        }
+
+        /**
+         * Gets a UDDI style auth token, otherwise, appends credentials to the
+         * ws proxies (not yet implemented)
+         *
+         * @param username
+         * @param password
+         * @param style
+         * @return
+         */
+        private String GetAuthKey(String username, String password) {
+                try {
+
+                        GetAuthToken getAuthTokenRoot = new GetAuthToken();
+                        getAuthTokenRoot.setUserID(username);
+                        getAuthTokenRoot.setCred(password);
+
+                        // Making API call that retrieves the authentication token for the user.
+                        AuthToken rootAuthToken = security.getAuthToken(getAuthTokenRoot);
+                        System.out.println(username + " AUTHTOKEN = (don't log auth tokens!");
+                        return rootAuthToken.getAuthInfo();
+                } catch (Exception ex) {
+                        System.out.println("Could not authenticate with the provided credentials " + ex.getMessage());
+                }
+                return null;
+        }
+
+        
+
+        private void PrintBusinessInfo(BusinessInfos businessInfos) {
+                if (businessInfos == null) {
+                        System.out.println("No data returned");
+                } else {
+                        for (int i = 0; i < businessInfos.getBusinessInfo().size(); i++) {
+                                System.out.println("===============================================");
+                                System.out.println("Business Key: " + businessInfos.getBusinessInfo().get(i).getBusinessKey());
+                                System.out.println("Name: " + ListToString(businessInfos.getBusinessInfo().get(i).getName()));
+
+                                System.out.println("Description: " + ListToDescString(businessInfos.getBusinessInfo().get(i).getDescription()));
+                                System.out.println("Services:");
+                                PrintServiceInfo(businessInfos.getBusinessInfo().get(i).getServiceInfos());
+                        }
+                }
+        }
+
+        private String ListToString(List<Name> name) {
+                StringBuilder sb = new StringBuilder();
+                for (int i = 0; i < name.size(); i++) {
+                        sb.append(name.get(i).getValue()).append(" ");
+                }
+                return sb.toString();
+        }
+
+        private String ListToDescString(List<Description> name) {
+                StringBuilder sb = new StringBuilder();
+                for (int i = 0; i < name.size(); i++) {
+                        sb.append(name.get(i).getValue()).append(" ");
+                }
+                return sb.toString();
+        }
+
+        private void PrintServiceInfo(ServiceInfos serviceInfos) {
+                for (int i = 0; i < serviceInfos.getServiceInfo().size(); i++) {
+                        System.out.println("-------------------------------------------");
+                        System.out.println("Service Key: " + serviceInfos.getServiceInfo().get(i).getServiceKey());
+                        System.out.println("Owning Business Key: " + serviceInfos.getServiceInfo().get(i).getBusinessKey());
+                        System.out.println("Name: " + ListToString(serviceInfos.getServiceInfo().get(i).getName()));
+                }
+        }
+
+        private void PrintBusinessDetails(BusinessInfos businessInfos, String token) throws Exception {
+                GetBusinessDetail gbd = new GetBusinessDetail();
+                gbd.setAuthInfo(token);
+                for (int i = 0; i < businessInfos.getBusinessInfo().size(); i++) {
+                        gbd.getBusinessKey().add(businessInfos.getBusinessInfo().get(i).getBusinessKey());
+                }
+                BusinessDetail businessDetail = inquiry.getBusinessDetail(gbd);
+                for (int i = 0; i < businessDetail.getBusinessEntity().size(); i++) {
+                        System.out.println("Business Detail - key: " + businessDetail.getBusinessEntity().get(i).getBusinessKey());
+                        System.out.println("Name: " + ListToString(businessDetail.getBusinessEntity().get(i).getName()));
+                        System.out.println("CategoryBag: " + CatBagToString(businessDetail.getBusinessEntity().get(i).getCategoryBag()));
+                        PrintContacts(businessDetail.getBusinessEntity().get(i).getContacts());
+                }
+        }
+
+        private void PrintServiceDetailsByBusiness(BusinessInfos businessInfos, String token) throws Exception {
+                for (int i = 0; i < businessInfos.getBusinessInfo().size(); i++) {
+                        GetServiceDetail gsd = new GetServiceDetail();
+                        for (int k = 0; k < businessInfos.getBusinessInfo().get(i).getServiceInfos().getServiceInfo().size(); k++) {
+                                gsd.getServiceKey().add(businessInfos.getBusinessInfo().get(i).getServiceInfos().getServiceInfo().get(k).getServiceKey());
+                        }
+                        gsd.setAuthInfo(token);
+                        System.out.println("Fetching data for business " + businessInfos.getBusinessInfo().get(i).getBusinessKey());
+                        ServiceDetail serviceDetail = inquiry.getServiceDetail(gsd);
+                        for (int k = 0; k < serviceDetail.getBusinessService().size(); k++) {
+                                PrintServiceDetail(serviceDetail.getBusinessService().get(k));
+                        }
+                        System.out.println("................");
+
+                }
+        }
+}

http://git-wip-us.apache.org/repos/asf/juddi/blob/9dafe4e8/juddi-rest-cxf/pom.xml
----------------------------------------------------------------------
diff --git a/juddi-rest-cxf/pom.xml b/juddi-rest-cxf/pom.xml
index 9ca8f09..fe06a91 100644
--- a/juddi-rest-cxf/pom.xml
+++ b/juddi-rest-cxf/pom.xml
@@ -24,7 +24,7 @@
 	</parent>
 	<groupId>org.apache.juddi</groupId>
 	<artifactId>juddi-rest-cxf</artifactId>
-	<packaging>bundle</packaging>
+	<packaging>jar</packaging>
 	<name>jUDDI REST Services using Apache CXF</name>
 	<dependencies>
 		<dependency>

http://git-wip-us.apache.org/repos/asf/juddi/blob/9dafe4e8/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 5b6a4c3..11e79b9 100644
--- a/pom.xml
+++ b/pom.xml
@@ -299,6 +299,7 @@ under the License.
         <module>uddi-ws</module>
         <module>uddi-tck-base</module>
         <module>juddi-client</module>
+        <module>juddi-client-cli</module>
         <module>juddi-client-plugins</module>
         <module>uddi-migration-tool</module>
         <module>juddi-core</module>


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


[4/5] juddi git commit: JUDDI-931 CLI client

Posted by al...@apache.org.
http://git-wip-us.apache.org/repos/asf/juddi/blob/9dafe4e8/juddi-client-cli/src/main/java/org/apache/juddi/v3/client/cli/JuddiAdminService.java
----------------------------------------------------------------------
diff --git a/juddi-client-cli/src/main/java/org/apache/juddi/v3/client/cli/JuddiAdminService.java b/juddi-client-cli/src/main/java/org/apache/juddi/v3/client/cli/JuddiAdminService.java
new file mode 100644
index 0000000..b317a4c
--- /dev/null
+++ b/juddi-client-cli/src/main/java/org/apache/juddi/v3/client/cli/JuddiAdminService.java
@@ -0,0 +1,1076 @@
+/*
+ * Copyright 2013 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.
+ */
+package org.apache.juddi.v3.client.cli;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.math.BigInteger;
+import java.rmi.RemoteException;
+import java.security.KeyStore;
+import java.util.List;
+import javax.net.ssl.KeyManagerFactory;
+import javax.net.ssl.SSLContext;
+import javax.xml.bind.JAXB;
+import javax.xml.ws.BindingProvider;
+import org.apache.commons.configuration.ConfigurationException;
+import org.apache.juddi.api_v3.DeleteNode;
+import org.apache.juddi.api_v3.GetFailedReplicationChangeRecordsMessageRequest;
+import org.apache.juddi.api_v3.GetFailedReplicationChangeRecordsMessageResponse;
+import org.apache.juddi.api_v3.Node;
+import org.apache.juddi.api_v3.NodeDetail;
+import org.apache.juddi.api_v3.NodeList;
+import org.apache.juddi.api_v3.SaveNode;
+import org.apache.juddi.jaxb.PrintJUDDI;
+import org.apache.juddi.v3.client.UDDIService;
+import org.apache.juddi.v3.client.config.UDDIClient;
+import org.apache.juddi.v3.client.config.UDDINode;
+import org.apache.juddi.v3.client.cryptor.TransportSecurityHelper;
+import org.apache.juddi.v3.client.transport.Transport;
+import org.apache.juddi.v3.client.transport.TransportException;
+import org.apache.juddi.v3_service.JUDDIApiPortType;
+import org.uddi.api_v3.Contact;
+import org.uddi.api_v3.Description;
+import org.uddi.api_v3.DispositionReport;
+import org.uddi.api_v3.Email;
+import org.uddi.api_v3.GetAuthToken;
+import org.uddi.api_v3.PersonName;
+import org.uddi.api_v3.Phone;
+import org.uddi.repl_v3.ChangeRecordIDType;
+import org.uddi.repl_v3.CommunicationGraph;
+import org.uddi.repl_v3.CommunicationGraph.Edge;
+import org.uddi.repl_v3.DoPing;
+import org.uddi.repl_v3.Operator;
+import org.uddi.repl_v3.OperatorStatusType;
+import org.uddi.repl_v3.ReplicationConfiguration;
+import org.uddi.v3_service.UDDIReplicationPortType;
+import org.uddi.v3_service.UDDISecurityPortType;
+
+/**
+ *
+ * @author Alex O'Ree
+ */
+public class JuddiAdminService {
+
+        //  private static UDDISecurityPortType security = null;
+        //  private static UDDIPublicationPortType publish = null;
+        static JUDDIApiPortType juddi = null;
+        // static UDDIClerk clerk = null;
+        static UDDIClient clerkManager = null;
+
+        public JuddiAdminService(UDDIClient client, Transport transport) {
+                try {
+                        clerkManager = client;
+                        if (transport != null) // create a manager and read the config in the archive; 
+                        // you can use your config file name
+                        // clerkManager = new UDDIClient("META-INF/simple-publish-uddi.xml");
+                        //clerk = clerkManager.getClerk("default");
+                        // The transport can be WS, inVM, RMI etc which is defined in the uddi.xml
+                        {
+                                transport = clerkManager.getTransport();
+                                juddi = transport.getJUDDIApiService();
+                        }
+                        // Now you create a reference to the UDDI API
+                        //security = transport.getUDDISecurityService();
+                        //publish = transport.getUDDIPublishService();
+
+                } catch (Exception e) {
+                        e.printStackTrace();
+                }
+        }
+
+        static Node getCloudInstance() {
+                Node n = new Node();
+                n.setClientName("juddicloud");
+                n.setName("juddicloud");
+                n.setCustodyTransferUrl("http://uddi-jbossoverlord.rhcloud.com/services/custody-transfer");
+                n.setDescription("juddicloud");
+                n.setProxyTransport("org.apache.juddi.v3.client.transport.JAXWSTransport");
+                n.setInquiryUrl("http://uddi-jbossoverlord.rhcloud.com/services/inquiry");
+                n.setJuddiApiUrl("http://uddi-jbossoverlord.rhcloud.com/services/juddi-api");
+                n.setPublishUrl("http://uddi-jbossoverlord.rhcloud.com/services/publish");
+                n.setSecurityUrl("http://uddi-jbossoverlord.rhcloud.com/services/security");
+                n.setSubscriptionListenerUrl("http://uddi-jbossoverlord.rhcloud.com/services/subscription-listener");
+                n.setSubscriptionUrl("http://uddi-jbossoverlord.rhcloud.com/services/subscription");
+                n.setReplicationUrl("uddi-jbossoverlord.rhcloud.com/services/replication");
+                return n;
+        }
+
+        JuddiAdminService(UDDIClient client, Transport transport, String currentNode) {
+                curentnode = currentNode;
+                try {
+                        clerkManager = client;
+                        if (transport == null) // create a manager and read the config in the archive; 
+                        // you can use your config file name
+                        // clerkManager = new UDDIClient("META-INF/simple-publish-uddi.xml");
+                        //clerk = clerkManager.getClerk("default");
+                        // The transport can be WS, inVM, RMI etc which is defined in the uddi.xml
+                        {
+                                transport = clerkManager.getTransport();
+                        }
+                        // Now you create a reference to the UDDI API
+                        //security = transport.getUDDISecurityService();
+                        //publish = transport.getUDDIPublishService();
+                        juddi = transport.getJUDDIApiService();
+                } catch (Exception e) {
+                        e.printStackTrace();
+                }
+        }
+
+        String curentnode = "default";
+
+        /**
+         * registers juddi's cloud node at another node
+         * @param token 
+         */
+        public void quickRegisterRemoteCloud(String token) {
+                try {
+                        // Setting up the values to get an authentication token for the 'root' user ('root' user has admin privileges
+                        // and can save other publishers).
+                        SaveNode node = new SaveNode();
+                        node.setAuthInfo(token);
+
+                        node.getNode().add(getCloudInstance());
+
+                        PrintJUDDI<SaveNode> p = new PrintJUDDI<SaveNode>();
+                        System.out.println("Before sending");
+                        System.out.println(p.print(node));
+                        juddi.saveNode(node);
+                        System.out.println("Saved");
+
+                } catch (Exception e) {
+                        e.printStackTrace();
+                }
+        }
+
+        void setupReplication() {
+                throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
+        }
+
+        void viewRemoteNodes(String authtoken) throws ConfigurationException, TransportException, RemoteException {
+
+                List<Node> uddiNodeList = clerkManager.getClientConfig().getUDDINodeList();
+                System.out.println();
+                System.out.println("Select a node (from *this config)");
+                for (int i = 0; i < uddiNodeList.size(); i++) {
+                        System.out.print(i + 1);
+                        System.out.println(") " + uddiNodeList.get(i).getName() + uddiNodeList.get(i).getDescription());
+                }
+                System.out.println("Node #: ");
+                int index = Integer.parseInt(System.console().readLine()) - 1;
+                String node = uddiNodeList.get(index).getName();
+                Transport transport = clerkManager.getTransport(node);
+
+                JUDDIApiPortType juddiApiService = transport.getJUDDIApiService();
+
+                NodeList allNodes = juddiApiService.getAllNodes(authtoken);
+                if (allNodes == null || allNodes.getNode().isEmpty()) {
+                        System.out.println("No nodes registered!");
+                } else {
+                        for (int i = 0; i < allNodes.getNode().size(); i++) {
+                                System.out.println("_______________________________________________________________________________");
+                                System.out.println("Name :" + allNodes.getNode().get(i).getName());
+                                System.out.println("Inquiry :" + allNodes.getNode().get(i).getInquiryUrl());
+                                System.out.println("Publish :" + allNodes.getNode().get(i).getPublishUrl());
+                                System.out.println("Securit :" + allNodes.getNode().get(i).getSecurityUrl());
+                                System.out.println("Replication :" + allNodes.getNode().get(i).getReplicationUrl());
+                                System.out.println("Subscription :" + allNodes.getNode().get(i).getSubscriptionUrl());
+                                System.out.println("Custody Xfer :" + allNodes.getNode().get(i).getCustodyTransferUrl());
+
+                        }
+                }
+
+        }
+
+        void quickRegisterLocalCloud() throws ConfigurationException {
+                UDDINode node = new UDDINode(getCloudInstance());
+                clerkManager.getClientConfig().addUDDINode(node);
+                clerkManager.getClientConfig().saveConfig();
+                System.out.println();
+                System.out.println("Added and saved.");
+        }
+
+        void registerLocalNodeToRemoteNode(String authtoken, Node cfg, Node publishTo) throws Exception {
+
+                Transport transport = clerkManager.getTransport(publishTo.getName());
+
+                UDDISecurityPortType security2 = transport.getUDDISecurityService();
+                System.out.print("username: ");
+                String uname = System.console().readLine();
+                char passwordArray[] = System.console().readPassword("password: ");
+                GetAuthToken getAuthTokenRoot = new GetAuthToken();
+                getAuthTokenRoot.setUserID(uname);
+                getAuthTokenRoot.setCred(new String(passwordArray));
+                authtoken = security2.getAuthToken(getAuthTokenRoot).getAuthInfo();
+                System.out.println("Success!");
+
+                JUDDIApiPortType juddiApiService = transport.getJUDDIApiService();
+                SaveNode sn = new SaveNode();
+                sn.setAuthInfo(authtoken);
+                sn.getNode().add(cfg);
+                NodeDetail saveNode = juddiApiService.saveNode(sn);
+                JAXB.marshal(saveNode, System.out);
+                System.out.println("Success.");
+
+        }
+
+        void viewReplicationConfig(String authtoken, String node) throws Exception {
+
+                Transport transport = clerkManager.getTransport(node);
+
+                JUDDIApiPortType juddiApiService = transport.getJUDDIApiService();
+                ReplicationConfiguration replicationNodes = juddiApiService.getReplicationNodes(authtoken);
+
+                System.out.println("Current Config:");
+                JAXB.marshal(replicationNodes, System.out);
+
+        }
+
+        void setReplicationConfig(String authtoken) throws Exception {
+                List<Node> uddiNodeList = clerkManager.getClientConfig().getUDDINodeList();
+                System.out.println();
+                System.out.println("Select a node (from *this config)");
+                for (int i = 0; i < uddiNodeList.size(); i++) {
+                        System.out.print(i + 1);
+                        System.out.println(") " + uddiNodeList.get(i).getName() + uddiNodeList.get(i).getDescription());
+                }
+                System.out.println("Node #: ");
+                int index = Integer.parseInt(System.console().readLine()) - 1;
+                String node = uddiNodeList.get(index).getName();
+                Transport transport = clerkManager.getTransport(node);
+
+                JUDDIApiPortType juddiApiService = transport.getJUDDIApiService();
+                System.out.println("fetching...");
+                //NodeList allNodes = juddiApiService.getAllNodes(authtoken);
+                ReplicationConfiguration replicationNodes = null;
+                try {
+                        replicationNodes = juddiApiService.getReplicationNodes(authtoken);
+                } catch (Exception ex) {
+                        System.out.println("Error getting replication config");
+                        ex.printStackTrace();
+                        replicationNodes = new ReplicationConfiguration();
+
+                }
+                String input = "";
+                while (!"d".equalsIgnoreCase(input) && !"q".equalsIgnoreCase(input)) {
+                        System.out.println("Current Config:");
+                        JAXB.marshal(replicationNodes, System.out);
+                        System.out.println("1) Remove a replication node");
+                        System.out.println("2) Add a replication node");
+                        System.out.println("3) Remove an Edge");
+                        System.out.println("4) Add an Edge");
+                        System.out.println("5) Set Registry Contact");
+                        System.out.println("6) Add Operator info");
+                        System.out.println("7) Remove Operator info");
+                        System.out.println("d) Done, save changes");
+                        System.out.println("q) Quit and abandon changes");
+
+                        input = System.console().readLine();
+                        if (input.equalsIgnoreCase("1")) {
+                                menu_RemoveReplicationNode(replicationNodes);
+                        } else if (input.equalsIgnoreCase("2")) {
+                                menu_AddReplicationNode(replicationNodes, juddiApiService, authtoken);
+                        } else if (input.equalsIgnoreCase("d")) {
+                                if (replicationNodes.getCommunicationGraph() == null) {
+                                        replicationNodes.setCommunicationGraph(new CommunicationGraph());
+                                }
+                                if (replicationNodes.getRegistryContact() == null) {
+                                        replicationNodes.setRegistryContact(new ReplicationConfiguration.RegistryContact());
+                                }
+                                if (replicationNodes.getRegistryContact().getContact() == null) {
+                                        replicationNodes.getRegistryContact().setContact(new Contact());
+                                        replicationNodes.getRegistryContact().getContact().getPersonName().add(new PersonName("unknown", null));
+                                }
+
+                                replicationNodes.setSerialNumber(0L);
+                                replicationNodes.setTimeOfConfigurationUpdate("");
+                                replicationNodes.setMaximumTimeToGetChanges(BigInteger.ONE);
+                                replicationNodes.setMaximumTimeToSyncRegistry(BigInteger.ONE);
+
+                                JAXB.marshal(replicationNodes, System.out);
+                                juddiApiService.setReplicationNodes(authtoken, replicationNodes);
+                        }
+
+                }
+                if (input.equalsIgnoreCase("d")) {
+                        //save the changes
+                        DispositionReport setReplicationNodes = juddiApiService.setReplicationNodes(authtoken, replicationNodes);
+                        System.out.println("Saved!, dumping config from the server");
+                        replicationNodes = juddiApiService.getReplicationNodes(authtoken);
+                        JAXB.marshal(replicationNodes, System.out);
+
+                } else {
+                        //quit this sub menu
+                        System.out.println("aborting!");
+                }
+
+        }
+
+        void viewRemoveRemoteNode(String authtoken) throws Exception {
+                List<Node> uddiNodeList = clerkManager.getClientConfig().getUDDINodeList();
+                System.out.println();
+                System.out.println("Select a node (from *this config)");
+                for (int i = 0; i < uddiNodeList.size(); i++) {
+                        System.out.print(i + 1);
+                        System.out.println(") " + uddiNodeList.get(i).getName() + uddiNodeList.get(i).getDescription());
+                }
+                System.out.println("Node #: ");
+                int index = Integer.parseInt(System.console().readLine()) - 1;
+                String node = uddiNodeList.get(index).getName();
+                Transport transport = clerkManager.getTransport(node);
+
+                JUDDIApiPortType juddiApiService = transport.getJUDDIApiService();
+
+                NodeList allNodes = juddiApiService.getAllNodes(authtoken);
+                if (allNodes == null || allNodes.getNode().isEmpty()) {
+                        System.out.println("No nodes registered!");
+                } else {
+                        for (int i = 0; i < allNodes.getNode().size(); i++) {
+                                System.out.println("_______________________________________________________________________________");
+                                System.out.println("(" + i + ") Name :" + allNodes.getNode().get(i).getName());
+                                System.out.println("(" + i + ") Inquiry :" + allNodes.getNode().get(i).getInquiryUrl());
+
+                        }
+
+                        System.out.println("Node to remove from : ");
+                        int nodenum = Integer.parseInt(System.console().readLine());
+                        juddiApiService.deleteNode(new DeleteNode(authtoken, allNodes.getNode().get(nodenum).getName()));
+
+                }
+        }
+
+        private void menu_RemoveReplicationNode(ReplicationConfiguration replicationNodes) {
+                if (replicationNodes.getCommunicationGraph() == null) {
+                        replicationNodes.setCommunicationGraph(new CommunicationGraph());
+                }
+                for (int i = 0; i < replicationNodes.getCommunicationGraph().getNode().size(); i++) {
+                        System.out.println((i + 1) + ") " + replicationNodes.getCommunicationGraph().getNode().get(i));
+                }
+                System.out.println("Node #: ");
+                int index = Integer.parseInt(System.console().readLine()) - 1;
+                replicationNodes.getCommunicationGraph().getNode().remove(index);
+
+        }
+
+        private void menu_AddReplicationNode(ReplicationConfiguration replicationNodes, JUDDIApiPortType juddiApiService, String authtoken) throws Exception {
+
+                if (replicationNodes.getCommunicationGraph() == null) {
+                        replicationNodes.setCommunicationGraph(new CommunicationGraph());
+                }
+
+                Operator op = new Operator();
+                System.out.println("The Operator Node id should be the UDDI Node ID of the new node to replicate with. It should also match the root business key in"
+                        + " the new registry.");
+                System.out.print("Operator Node id: ");
+                op.setOperatorNodeID(System.console().readLine().trim());
+
+                System.out.print("Replication URL: ");
+                op.setSoapReplicationURL(System.console().readLine().trim());
+                op.setOperatorStatus(OperatorStatusType.NEW);
+                System.out.println("The replication node requires at least one point of contact");
+                System.out.print("Number of contacts: ");
+                int index = Integer.parseInt(System.console().readLine());
+                for (int i = 0; i < index; i++) {
+                        System.out.println("_______________________");
+                        System.out.println("Info for contact # " + (i + 1));
+                        op.getContact().add(getContactInfo());
+                }
+                System.out.println("_______________________");
+                System.out.println("Current Operator:");
+                System.out.println("_______________________");
+                JAXB.marshal(op, System.out);
+
+                System.out.print("Confirm adding? (y/n) :");
+                if (System.console().readLine().trim().equalsIgnoreCase("y")) {
+                        replicationNodes.getOperator().add(op);
+                        replicationNodes.getCommunicationGraph().getNode().add(op.getOperatorNodeID());
+
+                }
+        }
+
+        private Contact getContactInfo() {
+                Contact c = new Contact();
+                System.out.print("Use Type (i.e. primary): ");
+                c.setUseType(System.console().readLine().trim());
+                if (c.getUseType().trim().equalsIgnoreCase("")) {
+                        c.setUseType("primary");
+                }
+
+                c.getPersonName().add(getPersonName());
+
+                while (true) {
+                        System.out.println("Thus far:");
+                        JAXB.marshal(c, System.out);
+                        System.out.println("Options:");
+                        System.out.println("\t1) Add PersonName");
+                        System.out.println("\t2) Add Email address");
+                        System.out.println("\t3) Add Phone number");
+                        System.out.println("\t4) Add Description");
+                        System.out.println("\t<enter> Finish and return");
+
+                        System.out.print("> ");
+                        String input = System.console().readLine();
+                        if (input.trim().equalsIgnoreCase("")) {
+                                break;
+                        } else if (input.trim().equalsIgnoreCase("1")) {
+                                c.getPersonName().add(getPersonName());
+                        } else if (input.trim().equalsIgnoreCase("2")) {
+                                c.getEmail().add(getEmail());
+                        } else if (input.trim().equalsIgnoreCase("3")) {
+                                c.getPhone().add(getPhoneNumber());
+                        } else if (input.trim().equalsIgnoreCase("4")) {
+                                c.getDescription().add(getDescription());
+                        }
+                }
+                return c;
+        }
+
+        private PersonName getPersonName() {
+                PersonName pn = new PersonName();
+                System.out.print("Name: ");
+                pn.setValue(System.console().readLine().trim());
+                System.out.print("Language (en): ");
+                pn.setLang(System.console().readLine().trim());
+                if (pn.getLang().equalsIgnoreCase("")) {
+                        pn.setLang("en");
+                }
+
+                return pn;
+        }
+
+        private Email getEmail() {
+                Email pn = new Email();
+                System.out.print("Email address Value: ");
+
+                pn.setValue(System.console().readLine().trim());
+                System.out.print("Use type (i.e. primary): ");
+                pn.setUseType(System.console().readLine().trim());
+                return pn;
+        }
+
+        private Phone getPhoneNumber() {
+
+                Phone pn = new Phone();
+                System.out.print("Phone Value: ");
+
+                pn.setValue(System.console().readLine().trim());
+                System.out.print("Use type (i.e. primary): ");
+                pn.setUseType(System.console().readLine().trim());
+                return pn;
+        }
+
+        private Description getDescription() {
+                Description pn = new Description();
+                System.out.print("Value: ");
+
+                pn.setValue(System.console().readLine().trim());
+                System.out.print("Language (en): ");
+                pn.setLang(System.console().readLine().trim());
+                if (pn.getLang().equalsIgnoreCase("")) {
+                        pn.setLang("en");
+                }
+                return pn;
+        }
+
+        void autoMagic123() throws Exception {
+
+                //1 > 2 >3 >1
+                List<Node> uddiNodeList = clerkManager.getClientConfig().getUDDINodeList();
+
+                Transport transport = clerkManager.getTransport("default");
+                String authtoken = transport.getUDDISecurityService().getAuthToken(new GetAuthToken("root", "root")).getAuthInfo();
+
+                JUDDIApiPortType juddiApiService = transport.getJUDDIApiService();
+                System.out.println("fetching...");
+
+                ReplicationConfiguration replicationNodes = null;
+                try {
+                        replicationNodes = juddiApiService.getReplicationNodes(authtoken);
+                } catch (Exception ex) {
+                        System.out.println("Error getting replication config");
+                        ex.printStackTrace();
+                        replicationNodes = new ReplicationConfiguration();
+
+                }
+                if (replicationNodes.getCommunicationGraph() == null) {
+                        replicationNodes.setCommunicationGraph(new CommunicationGraph());
+                }
+                Operator op = new Operator();
+                op.setOperatorNodeID("uddi:juddi.apache.org:node1");
+                op.setSoapReplicationURL(clerkManager.getClientConfig().getUDDINode("default").getReplicationUrl());
+                op.setOperatorStatus(OperatorStatusType.NORMAL);
+                op.getContact().add(new Contact());
+                op.getContact().get(0).getPersonName().add(new PersonName("bob", "en"));
+                op.getContact().get(0).setUseType("admin");
+                replicationNodes.getOperator().clear();
+                replicationNodes.getOperator().add(op);
+
+                op = new Operator();
+                op.setOperatorNodeID("uddi:another.juddi.apache.org:node2");
+                op.setSoapReplicationURL(clerkManager.getClientConfig().getUDDINode("uddi:another.juddi.apache.org:node2").getReplicationUrl());
+                op.setOperatorStatus(OperatorStatusType.NORMAL);
+                op.getContact().add(new Contact());
+                op.getContact().get(0).getPersonName().add(new PersonName("mary", "en"));
+                op.getContact().get(0).setUseType("admin");
+                replicationNodes.getOperator().add(op);
+                op = new Operator();
+
+                op.setOperatorNodeID("uddi:yet.another.juddi.apache.org:node3");
+                op.setSoapReplicationURL(clerkManager.getClientConfig().getUDDINode("uddi:yet.another.juddi.apache.org:node3").getReplicationUrl());
+                op.setOperatorStatus(OperatorStatusType.NORMAL);
+                op.getContact().add(new Contact());
+                op.getContact().get(0).getPersonName().add(new PersonName("mary", "en"));
+                op.getContact().get(0).setUseType("admin");
+                replicationNodes.getOperator().add(op);
+
+                replicationNodes.getCommunicationGraph().getNode().add("uddi:another.juddi.apache.org:node2");
+                replicationNodes.getCommunicationGraph().getNode().add("uddi:juddi.apache.org:node1");
+                replicationNodes.getCommunicationGraph().getNode().add("uddi:yet.another.juddi.apache.org:node3");
+                replicationNodes.setSerialNumber(0L);
+                replicationNodes.setTimeOfConfigurationUpdate("");
+                replicationNodes.setMaximumTimeToGetChanges(BigInteger.ONE);
+                replicationNodes.setMaximumTimeToSyncRegistry(BigInteger.ONE);
+
+                if (replicationNodes.getRegistryContact().getContact() == null) {
+                        replicationNodes.getRegistryContact().setContact(new Contact());
+                        replicationNodes.getRegistryContact().getContact().getPersonName().add(new PersonName("unknown", null));
+                }
+
+                JAXB.marshal(replicationNodes, System.out);
+                juddiApiService.setReplicationNodes(authtoken, replicationNodes);
+
+                transport = clerkManager.getTransport("uddi:another.juddi.apache.org:node2");
+                authtoken = transport.getUDDISecurityService().getAuthToken(new GetAuthToken("root", "root")).getAuthInfo();
+
+                juddiApiService = transport.getJUDDIApiService();
+                juddiApiService.setReplicationNodes(authtoken, replicationNodes);
+
+                transport = clerkManager.getTransport("uddi:yet.another.juddi.apache.org:node3");
+                authtoken = transport.getUDDISecurityService().getAuthToken(new GetAuthToken("root", "root")).getAuthInfo();
+
+                juddiApiService = transport.getJUDDIApiService();
+                juddiApiService.setReplicationNodes(authtoken, replicationNodes);
+
+        }
+
+        void autoMagicDirected() throws Exception {
+
+                //1 > 2 >3 >1
+                List<Node> uddiNodeList = clerkManager.getClientConfig().getUDDINodeList();
+
+                Transport transport = clerkManager.getTransport("default");
+                String authtoken = transport.getUDDISecurityService().getAuthToken(new GetAuthToken("root", "root")).getAuthInfo();
+
+                JUDDIApiPortType juddiApiService = transport.getJUDDIApiService();
+                System.out.println("fetching...");
+
+                ReplicationConfiguration replicationNodes = null;
+                try {
+                        replicationNodes = juddiApiService.getReplicationNodes(authtoken);
+                } catch (Exception ex) {
+                        System.out.println("Error getting replication config");
+                        ex.printStackTrace();
+                        replicationNodes = new ReplicationConfiguration();
+
+                }
+                if (replicationNodes.getCommunicationGraph() == null) {
+                        replicationNodes.setCommunicationGraph(new CommunicationGraph());
+                }
+                Operator op = new Operator();
+                op.setOperatorNodeID("uddi:juddi.apache.org:node1");
+                op.setSoapReplicationURL(clerkManager.getClientConfig().getUDDINode("default").getReplicationUrl());
+                op.setOperatorStatus(OperatorStatusType.NORMAL);
+                op.getContact().add(new Contact());
+                op.getContact().get(0).getPersonName().add(new PersonName("bob", "en"));
+                op.getContact().get(0).setUseType("admin");
+                replicationNodes.getOperator().clear();
+                replicationNodes.getOperator().add(op);
+
+                op = new Operator();
+                op.setOperatorNodeID("uddi:another.juddi.apache.org:node2");
+                op.setSoapReplicationURL(clerkManager.getClientConfig().getUDDINode("uddi:another.juddi.apache.org:node2").getReplicationUrl());
+                op.setOperatorStatus(OperatorStatusType.NORMAL);
+                op.getContact().add(new Contact());
+                op.getContact().get(0).getPersonName().add(new PersonName("mary", "en"));
+                op.getContact().get(0).setUseType("admin");
+                replicationNodes.getOperator().add(op);
+                op = new Operator();
+
+                op.setOperatorNodeID("uddi:yet.another.juddi.apache.org:node3");
+                op.setSoapReplicationURL(clerkManager.getClientConfig().getUDDINode("uddi:yet.another.juddi.apache.org:node3").getReplicationUrl());
+                op.setOperatorStatus(OperatorStatusType.NORMAL);
+                op.getContact().add(new Contact());
+                op.getContact().get(0).getPersonName().add(new PersonName("mary", "en"));
+                op.getContact().get(0).setUseType("admin");
+                replicationNodes.getOperator().add(op);
+                replicationNodes.getCommunicationGraph().getNode().clear();
+                replicationNodes.getCommunicationGraph().getNode().add("uddi:another.juddi.apache.org:node2");
+                replicationNodes.getCommunicationGraph().getNode().add("uddi:juddi.apache.org:node1");
+                replicationNodes.getCommunicationGraph().getNode().add("uddi:yet.another.juddi.apache.org:node3");
+                replicationNodes.getCommunicationGraph().getEdge().clear();
+                Edge e = new CommunicationGraph.Edge();
+                e.setMessageSender("uddi:juddi.apache.org:node1");
+                e.setMessageReceiver("uddi:another.juddi.apache.org:node2");
+                replicationNodes.getCommunicationGraph().getEdge().add(e);
+
+                e = new CommunicationGraph.Edge();
+                e.setMessageSender("uddi:another.juddi.apache.org:node2");
+                e.setMessageReceiver("uddi:yet.another.juddi.apache.org:node3");
+                replicationNodes.getCommunicationGraph().getEdge().add(e);
+
+                e = new CommunicationGraph.Edge();
+                e.setMessageSender("uddi:yet.another.juddi.apache.org:node3");
+                e.setMessageReceiver("uddi:juddi.apache.org:node1");
+                replicationNodes.getCommunicationGraph().getEdge().add(e);
+
+                replicationNodes.setSerialNumber(0L);
+                replicationNodes.setTimeOfConfigurationUpdate("");
+                replicationNodes.setMaximumTimeToGetChanges(BigInteger.ONE);
+                replicationNodes.setMaximumTimeToSyncRegistry(BigInteger.ONE);
+
+                if (replicationNodes.getRegistryContact().getContact() == null) {
+                        replicationNodes.getRegistryContact().setContact(new Contact());
+                        replicationNodes.getRegistryContact().getContact().getPersonName().add(new PersonName("unknown", null));
+                }
+
+                JAXB.marshal(replicationNodes, System.out);
+
+                juddiApiService.setReplicationNodes(authtoken, replicationNodes);
+                System.out.println("Saved to node1");
+                TestEquals(replicationNodes, juddiApiService.getReplicationNodes(authtoken));
+
+                transport = clerkManager.getTransport("uddi:another.juddi.apache.org:node2");
+                authtoken = transport.getUDDISecurityService().getAuthToken(new GetAuthToken("root", "root")).getAuthInfo();
+                juddiApiService = transport.getJUDDIApiService();
+                juddiApiService.setReplicationNodes(authtoken, replicationNodes);
+                System.out.println("Saved to node2");
+                TestEquals(replicationNodes, juddiApiService.getReplicationNodes(authtoken));
+
+                transport = clerkManager.getTransport("uddi:yet.another.juddi.apache.org:node3");
+                authtoken = transport.getUDDISecurityService().getAuthToken(new GetAuthToken("root", "root")).getAuthInfo();
+                juddiApiService = transport.getJUDDIApiService();
+                juddiApiService.setReplicationNodes(authtoken, replicationNodes);
+                System.out.println("Saved to node3");
+                TestEquals(replicationNodes, juddiApiService.getReplicationNodes(authtoken));
+
+        }
+
+        void autoMagic() throws Exception {
+
+                List<Node> uddiNodeList = clerkManager.getClientConfig().getUDDINodeList();
+
+                Transport transport = clerkManager.getTransport("default");
+                String authtoken = transport.getUDDISecurityService().getAuthToken(new GetAuthToken("root", "root")).getAuthInfo();
+
+                JUDDIApiPortType juddiApiService = transport.getJUDDIApiService();
+                System.out.println("fetching...");
+
+                ReplicationConfiguration replicationNodes = null;
+                try {
+                        replicationNodes = juddiApiService.getReplicationNodes(authtoken);
+                } catch (Exception ex) {
+                        System.out.println("Error getting replication config");
+                        ex.printStackTrace();
+                        replicationNodes = new ReplicationConfiguration();
+
+                }
+                //if (replicationNodes.getCommunicationGraph() == null) {
+                        replicationNodes.setCommunicationGraph(new CommunicationGraph());
+                //}
+                Operator op = new Operator();
+                op.setOperatorNodeID("uddi:juddi.apache.org:node1");
+                op.setSoapReplicationURL(clerkManager.getClientConfig().getUDDINode("default").getReplicationUrl());
+                op.setOperatorStatus(OperatorStatusType.NORMAL);
+                op.getContact().add(new Contact());
+                op.getContact().get(0).getPersonName().add(new PersonName("bob", "en"));
+                op.getContact().get(0).setUseType("admin");
+                replicationNodes.getOperator().clear();
+                replicationNodes.getOperator().add(op);
+
+                op = new Operator();
+                op.setOperatorNodeID("uddi:another.juddi.apache.org:node2");
+                op.setSoapReplicationURL(clerkManager.getClientConfig().getUDDINode("uddi:another.juddi.apache.org:node2").getReplicationUrl());
+                op.setOperatorStatus(OperatorStatusType.NORMAL);
+                op.getContact().add(new Contact());
+                op.getContact().get(0).getPersonName().add(new PersonName("mary", "en"));
+                op.getContact().get(0).setUseType("admin");
+                replicationNodes.getOperator().add(op);
+                replicationNodes.getCommunicationGraph().getNode().add("uddi:another.juddi.apache.org:node2");
+                replicationNodes.getCommunicationGraph().getNode().add("uddi:juddi.apache.org:node1");
+                replicationNodes.setSerialNumber(0L);
+                replicationNodes.setTimeOfConfigurationUpdate("");
+                replicationNodes.setMaximumTimeToGetChanges(BigInteger.ONE);
+                replicationNodes.setMaximumTimeToSyncRegistry(BigInteger.ONE);
+
+                if (replicationNodes.getRegistryContact().getContact() == null) {
+                        replicationNodes.getRegistryContact().setContact(new Contact());
+                        replicationNodes.getRegistryContact().getContact().getPersonName().add(new PersonName("unknown", null));
+                }
+
+                JAXB.marshal(replicationNodes, System.out);
+                juddiApiService.setReplicationNodes(authtoken, replicationNodes);
+
+                transport = clerkManager.getTransport("uddi:another.juddi.apache.org:node2");
+                authtoken = transport.getUDDISecurityService().getAuthToken(new GetAuthToken("root", "root")).getAuthInfo();
+
+                juddiApiService = transport.getJUDDIApiService();
+                juddiApiService.setReplicationNodes(authtoken, replicationNodes);
+
+        }
+
+        void autoMagic3() throws Exception {
+
+                List<Node> uddiNodeList = clerkManager.getClientConfig().getUDDINodeList();
+
+                Transport transport = clerkManager.getTransport("default");
+                String authtoken = transport.getUDDISecurityService().getAuthToken(new GetAuthToken("root", "root")).getAuthInfo();
+
+                JUDDIApiPortType juddiApiService = transport.getJUDDIApiService();
+                System.out.println("fetching...");
+
+                ReplicationConfiguration replicationNodes = null;
+                try {
+                        replicationNodes = juddiApiService.getReplicationNodes(authtoken);
+                } catch (Exception ex) {
+                        System.out.println("Error getting replication config");
+                        ex.printStackTrace();
+                        replicationNodes = new ReplicationConfiguration();
+
+                }
+                if (replicationNodes.getCommunicationGraph() == null) {
+                        replicationNodes.setCommunicationGraph(new CommunicationGraph());
+                }
+                Operator op = new Operator();
+                op.setOperatorNodeID("uddi:juddi.apache.org:node1");
+                op.setSoapReplicationURL(clerkManager.getClientConfig().getUDDINode("default").getReplicationUrl());
+                op.setOperatorStatus(OperatorStatusType.NORMAL);
+                op.getContact().add(new Contact());
+                op.getContact().get(0).getPersonName().add(new PersonName("bob", "en"));
+                op.getContact().get(0).setUseType("admin");
+                replicationNodes.getOperator().clear();
+                replicationNodes.getOperator().add(op);
+
+                op = new Operator();
+                op.setOperatorNodeID("uddi:another.juddi.apache.org:node2");
+                op.setSoapReplicationURL(clerkManager.getClientConfig().getUDDINode("uddi:another.juddi.apache.org:node2").getReplicationUrl());
+                op.setOperatorStatus(OperatorStatusType.NORMAL);
+                op.getContact().add(new Contact());
+                op.getContact().get(0).getPersonName().add(new PersonName("mary", "en"));
+                op.getContact().get(0).setUseType("admin");
+                replicationNodes.getOperator().add(op);
+
+                op = new Operator();
+                op.setOperatorNodeID("uddi:yet.another.juddi.apache.org:node3");
+                op.setSoapReplicationURL(clerkManager.getClientConfig().getUDDINode("uddi:yet.another.juddi.apache.org:node3").getReplicationUrl());
+                op.setOperatorStatus(OperatorStatusType.NORMAL);
+                op.getContact().add(new Contact());
+                op.getContact().get(0).getPersonName().add(new PersonName("mary", "en"));
+                op.getContact().get(0).setUseType("admin");
+                replicationNodes.getOperator().add(op);
+
+                replicationNodes.getCommunicationGraph().getNode().add("uddi:another.juddi.apache.org:node2");
+                replicationNodes.getCommunicationGraph().getNode().add("uddi:yet.another.juddi.apache.org:node3");
+                replicationNodes.getCommunicationGraph().getNode().add("uddi:juddi.apache.org:node1");
+                replicationNodes.setSerialNumber(0L);
+                replicationNodes.setTimeOfConfigurationUpdate("");
+                replicationNodes.setMaximumTimeToGetChanges(BigInteger.ONE);
+                replicationNodes.setMaximumTimeToSyncRegistry(BigInteger.ONE);
+
+                if (replicationNodes.getRegistryContact().getContact() == null) {
+                        replicationNodes.getRegistryContact().setContact(new Contact());
+                        replicationNodes.getRegistryContact().getContact().getPersonName().add(new PersonName("unknown", null));
+                }
+
+                JAXB.marshal(replicationNodes, System.out);
+                juddiApiService.setReplicationNodes(authtoken, replicationNodes);
+
+                transport = clerkManager.getTransport("uddi:another.juddi.apache.org:node2");
+                authtoken = transport.getUDDISecurityService().getAuthToken(new GetAuthToken("root", "root")).getAuthInfo();
+
+                juddiApiService = transport.getJUDDIApiService();
+                juddiApiService.setReplicationNodes(authtoken, replicationNodes);
+
+                transport = clerkManager.getTransport("uddi:yet.another.juddi.apache.org:node3");
+                authtoken = transport.getUDDISecurityService().getAuthToken(new GetAuthToken("root", "root")).getAuthInfo();
+
+                juddiApiService = transport.getJUDDIApiService();
+                juddiApiService.setReplicationNodes(authtoken, replicationNodes);
+
+        }
+
+        /**
+         * gets replication high water mark values
+         * @param transport
+         * @param authtoken
+         * @throws Exception 
+         */
+        void printStatus(Transport transport, String authtoken) throws Exception {
+
+                JUDDIApiPortType juddiApiService = transport.getJUDDIApiService();
+                System.out.println("fetching...");
+
+                ReplicationConfiguration replicationNodes = null;
+                try {
+                        replicationNodes = juddiApiService.getReplicationNodes(authtoken);
+                } catch (Exception ex) {
+                        System.out.println("Error getting replication config");
+                        ex.printStackTrace();
+                        replicationNodes = new ReplicationConfiguration();
+
+                }
+                UDDIReplicationPortType uddiReplicationPort = new UDDIService().getUDDIReplicationPort();
+
+                for (Operator o : replicationNodes.getOperator()) {
+                        System.out.println("*******************\n\rstats for node " + o.getOperatorNodeID());
+                        ((BindingProvider) uddiReplicationPort).getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, o.getSoapReplicationURL());
+
+                        List<ChangeRecordIDType> highWaterMarks = uddiReplicationPort.getHighWaterMarks();
+                        for (ChangeRecordIDType cr : highWaterMarks) {
+                                JAXB.marshal(cr, System.out);
+                        }
+                }
+        }
+
+        void printStatus() throws Exception {
+
+                //List<Node> uddiNodeList = clerkManager.getClientConfig().getUDDINodeList();
+                Transport transport = clerkManager.getTransport("default");
+                String authtoken = transport.getUDDISecurityService().getAuthToken(new GetAuthToken("root", "root")).getAuthInfo();
+
+                JUDDIApiPortType juddiApiService = transport.getJUDDIApiService();
+                System.out.println("fetching...");
+
+                ReplicationConfiguration replicationNodes = null;
+                try {
+                        replicationNodes = juddiApiService.getReplicationNodes(authtoken);
+                } catch (Exception ex) {
+                        System.out.println("Error getting replication config");
+                        ex.printStackTrace();
+                        replicationNodes = new ReplicationConfiguration();
+
+                }
+                UDDIReplicationPortType uddiReplicationPort = new UDDIService().getUDDIReplicationPort();
+
+                for (Operator o : replicationNodes.getOperator()) {
+                        System.out.println("*******************\n\rstats for node " + o.getOperatorNodeID());
+                        ((BindingProvider) uddiReplicationPort).getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, o.getSoapReplicationURL());
+
+                        List<ChangeRecordIDType> highWaterMarks = uddiReplicationPort.getHighWaterMarks();
+                        for (ChangeRecordIDType cr : highWaterMarks) {
+                                JAXB.marshal(cr, System.out);
+                        }
+                }
+
+        }
+
+        private void TestEquals(ReplicationConfiguration setter, ReplicationConfiguration getter) {
+                if (getter == null) {
+                        l("null getter");
+                        return;
+                }
+                if (setter == null) {
+                        l("null setter");
+                        return;
+                }
+                if (getter.getOperator().size() != setter.getOperator().size()) {
+                        l("operator size mismatch");
+                        return;
+                }
+                if (getter.getCommunicationGraph().getNode().size() != setter.getCommunicationGraph().getNode().size()) {
+                        l("comm/node size mismatch");
+                        return;
+                }
+                if (getter.getCommunicationGraph().getEdge().size() != setter.getCommunicationGraph().getEdge().size()) {
+                        l("comm/node size mismatch");
+                        return;
+                }
+
+        }
+
+        private void l(String msg) {
+                System.out.println(msg);
+        }
+
+        void dumpFailedReplicationRecords(String authtoken) throws Exception {
+                GetFailedReplicationChangeRecordsMessageRequest req = new GetFailedReplicationChangeRecordsMessageRequest();
+                req.setAuthInfo(authtoken);
+                req.setMaxRecords(20);
+                req.setOffset(0);
+                GetFailedReplicationChangeRecordsMessageResponse failedReplicationChangeRecords = juddi.getFailedReplicationChangeRecords(req);
+                while (failedReplicationChangeRecords != null
+                        && failedReplicationChangeRecords.getChangeRecords() != null
+                        && !failedReplicationChangeRecords.getChangeRecords().getChangeRecord().isEmpty()) {
+                        for (int i = 0; i < failedReplicationChangeRecords.getChangeRecords().getChangeRecord().size(); i++) {
+                                JAXB.marshal(failedReplicationChangeRecords.getChangeRecords().getChangeRecord().get(i), System.out);
+                        }
+                        req.setOffset(req.getOffset() + failedReplicationChangeRecords.getChangeRecords().getChangeRecord().size());
+                        failedReplicationChangeRecords = juddi.getFailedReplicationChangeRecords(req);
+                }
+        }
+
+        void printStatusSingleNode(Transport transport, String authtoken) throws Exception {
+                String replicationUrl = clerkManager.getClientConfig().getUDDINode(curentnode).getReplicationUrl();
+
+                SSLContext sc = SSLContext.getInstance("SSLv3");
+
+                KeyManagerFactory kmf
+                        = KeyManagerFactory.getInstance(KeyManagerFactory.getDefaultAlgorithm());
+
+                KeyStore ks = KeyStore.getInstance(KeyStore.getDefaultType());
+                ks.load(new FileInputStream(System.getProperty("javax.net.ssl.keyStore")), System.getProperty("javax.net.ssl.keyStorePassword").toCharArray());
+
+                kmf.init(ks, System.getProperty("javax.net.ssl.keyStorePassword").toCharArray());
+
+                sc.init(kmf.getKeyManagers(), null, null);
+
+                UDDIReplicationPortType uddiReplicationPort = new UDDIService().getUDDIReplicationPort();
+                ((BindingProvider) uddiReplicationPort).getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, replicationUrl);
+                ((BindingProvider) uddiReplicationPort).getRequestContext()
+                        .put(
+                                "com.sun.xml.internal.ws.transport.https.client.SSLSocketFactory",
+                                sc.getSocketFactory());
+                /*((BindingProvider) uddiReplicationPort).getRequestContext()
+                 .put(
+                 JAXWSProperties.SSL_SOCKET_FACTORY,
+                 sc.getSocketFactory());*/
+
+                String doPing = uddiReplicationPort.doPing(new DoPing());
+                System.out.println(doPing + ".., success");
+
+        }
+
+        void autoMagicDirectedSSL() throws Exception {
+                //1 > 2 >3 >1
+                List<Node> uddiNodeList = clerkManager.getClientConfig().getUDDINodeList();
+
+                Transport transport = clerkManager.getTransport("default");
+                String authtoken = transport.getUDDISecurityService().getAuthToken(new GetAuthToken("root", "root")).getAuthInfo();
+
+                JUDDIApiPortType juddiApiService = transport.getJUDDIApiService();
+                System.out.println("fetching...");
+
+                ReplicationConfiguration replicationNodes = null;
+                try {
+                        replicationNodes = juddiApiService.getReplicationNodes(authtoken);
+                } catch (Exception ex) {
+                        System.out.println("Error getting replication config");
+                        ex.printStackTrace();
+                        replicationNodes = new ReplicationConfiguration();
+
+                }
+                //if (replicationNodes.getCommunicationGraph() == null) {
+                replicationNodes.setCommunicationGraph(new CommunicationGraph());
+                //}
+                Operator op = new Operator();
+                op.setOperatorNodeID("uddi:juddi.apache.org:node1");
+                op.setSoapReplicationURL(clerkManager.getClientConfig().getUDDINode("default").getReplicationUrl());
+                op.setOperatorStatus(OperatorStatusType.NORMAL);
+                op.getContact().add(new Contact());
+                op.getContact().get(0).getPersonName().add(new PersonName("bob", "en"));
+                op.getContact().get(0).setUseType("admin");
+                replicationNodes.getOperator().clear();
+                replicationNodes.getOperator().add(op);
+
+                op = new Operator();
+                op.setOperatorNodeID("uddi:another.juddi.apache.org:node2");
+                op.setSoapReplicationURL(clerkManager.getClientConfig().getUDDINode("uddi:another.juddi.apache.org:node2").getReplicationUrl());
+                op.setOperatorStatus(OperatorStatusType.NORMAL);
+                op.getContact().add(new Contact());
+                op.getContact().get(0).getPersonName().add(new PersonName("mary", "en"));
+                op.getContact().get(0).setUseType("admin");
+                replicationNodes.getOperator().add(op);
+                op = new Operator();
+
+                op.setOperatorNodeID("uddi:yet.another.juddi.apache.org:node3");
+                op.setSoapReplicationURL(clerkManager.getClientConfig().getUDDINode("uddi:yet.another.juddi.apache.org:node3").getReplicationUrl());
+                op.setOperatorStatus(OperatorStatusType.NORMAL);
+                op.getContact().add(new Contact());
+                op.getContact().get(0).getPersonName().add(new PersonName("mary", "en"));
+                op.getContact().get(0).setUseType("admin");
+                replicationNodes.getOperator().add(op);
+                replicationNodes.getCommunicationGraph().getNode().clear();
+                replicationNodes.getCommunicationGraph().getNode().add("uddi:another.juddi.apache.org:node2");
+                replicationNodes.getCommunicationGraph().getNode().add("uddi:juddi.apache.org:node1");
+                replicationNodes.getCommunicationGraph().getNode().add("uddi:yet.another.juddi.apache.org:node3");
+                replicationNodes.getCommunicationGraph().getEdge().clear();
+                Edge e = new CommunicationGraph.Edge();
+                e.setMessageSender("uddi:juddi.apache.org:node1");
+                e.setMessageReceiver("uddi:another.juddi.apache.org:node2");
+                replicationNodes.getCommunicationGraph().getEdge().add(e);
+
+                e = new CommunicationGraph.Edge();
+                e.setMessageSender("uddi:another.juddi.apache.org:node2");
+                e.setMessageReceiver("uddi:yet.another.juddi.apache.org:node3");
+                replicationNodes.getCommunicationGraph().getEdge().add(e);
+
+                e = new CommunicationGraph.Edge();
+                e.setMessageSender("uddi:yet.another.juddi.apache.org:node3");
+                e.setMessageReceiver("uddi:juddi.apache.org:node1");
+                replicationNodes.getCommunicationGraph().getEdge().add(e);
+
+                replicationNodes.setSerialNumber(0L);
+                replicationNodes.setTimeOfConfigurationUpdate("");
+                replicationNodes.setMaximumTimeToGetChanges(BigInteger.ONE);
+                replicationNodes.setMaximumTimeToSyncRegistry(BigInteger.ONE);
+
+                if (replicationNodes.getRegistryContact().getContact() == null) {
+                        replicationNodes.getRegistryContact().setContact(new Contact());
+                        replicationNodes.getRegistryContact().getContact().getPersonName().add(new PersonName("unknown", null));
+                }
+
+                JAXB.marshal(replicationNodes, System.out);
+
+                juddiApiService.setReplicationNodes(authtoken, replicationNodes);
+                System.out.println("Saved to node1");
+                TestEquals(replicationNodes, juddiApiService.getReplicationNodes(authtoken));
+
+                transport = clerkManager.getTransport("uddi:another.juddi.apache.org:node2");
+                authtoken = transport.getUDDISecurityService().getAuthToken(new GetAuthToken("root", "root")).getAuthInfo();
+                juddiApiService = transport.getJUDDIApiService();
+                juddiApiService.setReplicationNodes(authtoken, replicationNodes);
+                System.out.println("Saved to node2");
+                TestEquals(replicationNodes, juddiApiService.getReplicationNodes(authtoken));
+
+                transport = clerkManager.getTransport("uddi:yet.another.juddi.apache.org:node3");
+                authtoken = transport.getUDDISecurityService().getAuthToken(new GetAuthToken("root", "root")).getAuthInfo();
+                juddiApiService = transport.getJUDDIApiService();
+                juddiApiService.setReplicationNodes(authtoken, replicationNodes);
+                System.out.println("Saved to node3");
+                TestEquals(replicationNodes, juddiApiService.getReplicationNodes(authtoken));
+        }
+
+        void pingAll() throws Exception {
+                List<Node> uddiNodeList = clerkManager.getClientConfig().getUDDINodeList();
+
+                UDDIReplicationPortType uddiReplicationPort = new UDDIService().getUDDIReplicationPort();
+                TransportSecurityHelper.applyTransportSecurity((BindingProvider) uddiReplicationPort);
+
+                for (Node currenteNode : uddiNodeList) {
+                        try {
+                                String replicationUrl = clerkManager.getClientConfig().getUDDINode(currenteNode.getName()).getReplicationUrl();
+                                ((BindingProvider) uddiReplicationPort).getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, replicationUrl);
+                                long now = System.currentTimeMillis();
+                                String doPing = uddiReplicationPort.doPing(new DoPing());
+                                System.out.println(replicationUrl + " " + currenteNode.getName() + " says it's node id is " + doPing + " (took " + (System.currentTimeMillis() - now) + "ms)");
+                        } catch (Exception ex) {
+                                System.out.println("Error! " + currenteNode.getName() + " " + currenteNode.getReplicationUrl());
+                                ex.printStackTrace();
+                        }
+
+                }
+
+        }
+
+}

http://git-wip-us.apache.org/repos/asf/juddi/blob/9dafe4e8/juddi-client-cli/src/main/java/org/apache/juddi/v3/client/cli/SearchByQos.java
----------------------------------------------------------------------
diff --git a/juddi-client-cli/src/main/java/org/apache/juddi/v3/client/cli/SearchByQos.java b/juddi-client-cli/src/main/java/org/apache/juddi/v3/client/cli/SearchByQos.java
new file mode 100644
index 0000000..c31623f
--- /dev/null
+++ b/juddi-client-cli/src/main/java/org/apache/juddi/v3/client/cli/SearchByQos.java
@@ -0,0 +1,272 @@
+/*
+ * Copyright 2013 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.
+ */
+package org.apache.juddi.v3.client.cli;
+
+import java.util.Properties;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import javax.xml.bind.JAXB;
+import org.apache.juddi.api_v3.AccessPointType;
+import org.apache.juddi.jaxb.PrintUDDI;
+import org.apache.juddi.v3.client.UDDIConstants;
+import org.apache.juddi.v3.client.config.UDDIClerk;
+import org.apache.juddi.v3.client.config.UDDIClient;
+import org.apache.juddi.v3.client.config.UDDIClientContainer;
+import org.apache.juddi.v3.client.ext.wsdm.WSDMQosConstants;
+import org.apache.juddi.v3.client.transport.Transport;
+import org.apache.juddi.v3_service.JUDDIApiPortType;
+import org.uddi.api_v3.AccessPoint;
+import org.uddi.api_v3.BindingDetail;
+import org.uddi.api_v3.BindingTemplate;
+import org.uddi.api_v3.BindingTemplates;
+import org.uddi.api_v3.BusinessDetail;
+import org.uddi.api_v3.BusinessEntity;
+import org.uddi.api_v3.BusinessInfos;
+import org.uddi.api_v3.BusinessList;
+import org.uddi.api_v3.BusinessService;
+import org.uddi.api_v3.BusinessServices;
+import org.uddi.api_v3.CategoryBag;
+import org.uddi.api_v3.Contact;
+import org.uddi.api_v3.Contacts;
+import org.uddi.api_v3.DeleteBusiness;
+import org.uddi.api_v3.Description;
+import org.uddi.api_v3.DiscoveryURL;
+import org.uddi.api_v3.DiscoveryURLs;
+import org.uddi.api_v3.FindBinding;
+import org.uddi.api_v3.FindBusiness;
+import org.uddi.api_v3.FindQualifiers;
+import org.uddi.api_v3.FindService;
+import org.uddi.api_v3.FindTModel;
+import org.uddi.api_v3.GetAuthToken;
+import org.uddi.api_v3.GetBusinessDetail;
+import org.uddi.api_v3.IdentifierBag;
+import org.uddi.api_v3.InstanceDetails;
+import org.uddi.api_v3.KeyedReference;
+import org.uddi.api_v3.Name;
+import org.uddi.api_v3.PersonName;
+import org.uddi.api_v3.SaveBusiness;
+import org.uddi.api_v3.SaveTModel;
+import org.uddi.api_v3.ServiceInfos;
+import org.uddi.api_v3.ServiceList;
+import org.uddi.api_v3.TModel;
+import org.uddi.api_v3.TModelBag;
+import org.uddi.api_v3.TModelInstanceDetails;
+import org.uddi.api_v3.TModelInstanceInfo;
+import org.uddi.v3_service.UDDIInquiryPortType;
+import org.uddi.v3_service.UDDIPublicationPortType;
+import org.uddi.v3_service.UDDISecurityPortType;
+
+/**
+ *
+ * @author Alex O'Ree
+ */
+public class SearchByQos {
+
+        static PrintUDDI<TModel> pTModel = new PrintUDDI<TModel>();
+        static Properties properties = new Properties();
+        static String wsdlURL = null;
+        private static UDDISecurityPortType security = null;
+        private static JUDDIApiPortType juddiApi = null;
+        private static UDDIPublicationPortType publish = null;
+        private static UDDIInquiryPortType inquiry;
+
+        public static void doFindService(String token, Transport transport) throws Exception {
+
+                // Now you create a reference to the UDDI API
+                security = transport.getUDDISecurityService();
+                publish = transport.getUDDIPublishService();
+                inquiry = transport.getUDDIInquiryService();
+        //step one, get a token
+                //GetAuthToken getAuthTokenRoot = new GetAuthToken();
+                //getAuthTokenRoot.setUserID("uddi");
+                //getAuthTokenRoot.setCred("uddi");
+
+                // Making API call that retrieves the authentication token for the 'root' user.
+                //String rootAuthToken = clerk.getAuthToken(clerk.getUDDINode().getSecurityUrl());
+                String uddi = token;// security.getAuthToken(getAuthTokenRoot).getAuthInfo();
+
+                ServiceList after = getServiceList(uddi);
+                if (after.getServiceInfos()==null || after.getServiceInfos().getServiceInfo() == null) {
+                        System.out.println("no services returned!");
+                        return;
+                }
+                //PrintUDDI<ServiceList> p = new PrintUDDI<ServiceList>();
+                System.out.println(after.getServiceInfos().getServiceInfo().size() + " services returned!");
+                JAXB.marshal(after,System.out);
+                
+
+        }
+
+        public static void doFindBinding(String token, Transport transport) throws Exception {
+
+                // Now you create a reference to the UDDI API
+                security = transport.getUDDISecurityService();
+                publish = transport.getUDDIPublishService();
+                inquiry = transport.getUDDIInquiryService();
+
+                // Making API call that retrieves the authentication token for the 'root' user.
+                //String rootAuthToken = clerk.getAuthToken(clerk.getUDDINode().getSecurityUrl());
+                String uddi = token;//security.getAuthToken(getAuthTokenRoot).getAuthInfo();
+
+                BindingDetail after = getBindingList(uddi);
+                if (after.getBindingTemplate() == null) {
+                        System.out.println("no bindings returned!");
+                        return;
+                } 
+                PrintUDDI<BindingDetail> p = new PrintUDDI<BindingDetail>();
+
+                System.out.println(p.print(after));
+
+        }
+
+        public static void doFindBusiness(String token, Transport transport) throws Exception {
+                // create a manager and read the config in the archive; 
+                // you can use your config file name
+
+                // Now you create a reference to the UDDI API
+                security = transport.getUDDISecurityService();
+                publish = transport.getUDDIPublishService();
+                inquiry = transport.getUDDIInquiryService();
+                String uddi = token;//security.getAuthToken(getAuthTokenRoot).getAuthInfo();
+
+                BusinessList after2 = getBusinessList(uddi);
+
+                PrintUDDI<BusinessList> p2 = new PrintUDDI<BusinessList>();
+
+                System.out.println(p2.print(after2));
+
+        }
+
+        private static void DeleteIfExists(String key, String authInfo) {
+                GetBusinessDetail gbd = new GetBusinessDetail();
+                gbd.setAuthInfo(authInfo);
+                gbd.getBusinessKey().add(key);
+                boolean found = false;
+                try {
+                        BusinessDetail businessDetail = inquiry.getBusinessDetail(gbd);
+                        if (businessDetail != null
+                                && !businessDetail.getBusinessEntity().isEmpty()
+                                && businessDetail.getBusinessEntity().get(0).getBusinessKey().equals(key)) {
+                                found = true;
+                        }
+                } catch (Exception ex) {
+                }
+                if (found) {
+                        DeleteBusiness db = new DeleteBusiness();
+                        db.setAuthInfo(authInfo);
+                        db.getBusinessKey().add(key);
+                        try {
+                                publish.deleteBusiness(db);
+                        } catch (Exception ex) {
+                                Logger.getLogger(FindBusinessBugHunt.class.getName()).log(Level.SEVERE, null, ex);
+                        }
+                }
+        }
+
+        private static BusinessList getBusinessList(String token) throws Exception {
+                FindBusiness fb = new FindBusiness();
+                fb.setAuthInfo(token);
+                org.uddi.api_v3.FindQualifiers fq = new org.uddi.api_v3.FindQualifiers();
+                fq.getFindQualifier().add(UDDIConstants.APPROXIMATE_MATCH);
+                fq.getFindQualifier().add(UDDIConstants.OR_ALL_KEYS);
+                fb.setFindQualifiers(fq);
+                fb.getName().add((new Name(UDDIConstants.WILDCARD, null)));
+
+                fb.setTModelBag(new TModelBag());
+                fb.getTModelBag().getTModelKey().addAll(WSDMQosConstants.getAllQOSKeys());
+
+                return inquiry.findBusiness(fb);
+        }
+
+        private static ServiceList getServiceList(String token) throws Exception {
+                FindService fb = new FindService();
+                fb.setAuthInfo(token);
+                org.uddi.api_v3.FindQualifiers fq = new org.uddi.api_v3.FindQualifiers();
+                fq.getFindQualifier().add(UDDIConstants.APPROXIMATE_MATCH);
+                fq.getFindQualifier().add(UDDIConstants.OR_ALL_KEYS);
+                fb.setFindQualifiers(fq);
+                fb.getName().add((new Name(UDDIConstants.WILDCARD, null)));
+
+                fb.setTModelBag(new TModelBag());
+                fb.getTModelBag().getTModelKey().addAll(WSDMQosConstants.getAllQOSKeys());
+
+                return inquiry.findService(fb);
+        }
+
+        private static BindingDetail getBindingList(String token) throws Exception {
+                FindBinding fb = new FindBinding();
+                fb.setAuthInfo(token);
+                fb.setTModelBag(new TModelBag());
+                fb.getTModelBag().getTModelKey().addAll(WSDMQosConstants.getAllQOSKeys());
+                fb.setFindQualifiers(new FindQualifiers());
+                fb.getFindQualifiers().getFindQualifier().add(UDDIConstants.OR_ALL_KEYS_TMODEL);
+                return inquiry.findBinding(fb);
+        }
+
+        /**
+         * -
+         * adds a business, service, bt with tmodel instance details with qos
+         * parameters
+         *
+         * @param rootAuthToken
+         * @throws Exception
+         */
+        private static void SaveMary(String rootAuthToken) throws Exception {
+                BusinessEntity be = new BusinessEntity();
+                be.setBusinessKey("uddi:uddi.marypublisher.com:marybusinessone");
+                be.setDiscoveryURLs(new DiscoveryURLs());
+                be.getDiscoveryURLs().getDiscoveryURL().add(new DiscoveryURL("home", "http://www.marybusinessone.com"));
+                be.getDiscoveryURLs().getDiscoveryURL().add(new DiscoveryURL("serviceList", "http://www.marybusinessone.com/services"));
+                be.getName().add(new Name("Mary Doe Enterprises", "en"));
+                be.getName().add(new Name("Maria Negocio Uno", "es"));
+                be.getDescription().add(new Description("This is the description for Mary Business One.", "en"));
+                be.setContacts(new Contacts());
+                Contact c = new Contact();
+                c.setUseType("administrator");
+                c.getPersonName().add(new PersonName("Mary Doe", "en"));
+                c.getPersonName().add(new PersonName("Juan Doe", "es"));
+                c.getDescription().add(new Description("This is the administrator of the service offerings.", "en"));
+                be.getContacts().getContact().add(c);
+                be.setBusinessServices(new BusinessServices());
+                BusinessService bs = new BusinessService();
+                bs.setBusinessKey("uddi:uddi.marypublisher.com:marybusinessone");
+                bs.setServiceKey("uddi:uddi.marypublisher.com:marybusinessoneservice");
+                bs.getName().add(new Name("name!", "en"));
+                bs.setBindingTemplates(new BindingTemplates());
+                BindingTemplate bt = new BindingTemplate();
+                bt.setAccessPoint(new AccessPoint("http://localhost", AccessPointType.WSDL_DEPLOYMENT.toString()));
+                bt.setTModelInstanceDetails(new TModelInstanceDetails());
+                TModelInstanceInfo tii = new TModelInstanceInfo();
+                tii.setTModelKey(WSDMQosConstants.METRIC_FAULT_COUNT_KEY);
+                tii.setInstanceDetails(new InstanceDetails());
+                tii.getInstanceDetails().setInstanceParms("400");
+                bt = UDDIClient.addSOAPtModels(bt);
+                bt.getTModelInstanceDetails().getTModelInstanceInfo().add(tii);
+                bs.getBindingTemplates().getBindingTemplate().add(bt);
+                be.getBusinessServices().getBusinessService().add(bs);
+                SaveBusiness sb = new SaveBusiness();
+                sb.setAuthInfo(rootAuthToken);
+                sb.getBusinessEntity().add(be);
+                publish.saveBusiness(sb);
+        }
+
+        private static void SaveTM(TModel createKeyGenator, String uddi) throws Exception {
+                SaveTModel stm = new SaveTModel();
+                stm.setAuthInfo(uddi);
+                stm.getTModel().add(createKeyGenator);
+                publish.saveTModel(stm);
+        }
+}


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


[5/5] juddi git commit: JUDDI-931 CLI client

Posted by al...@apache.org.
JUDDI-931 CLI client


Project: http://git-wip-us.apache.org/repos/asf/juddi/repo
Commit: http://git-wip-us.apache.org/repos/asf/juddi/commit/9dafe4e8
Tree: http://git-wip-us.apache.org/repos/asf/juddi/tree/9dafe4e8
Diff: http://git-wip-us.apache.org/repos/asf/juddi/diff/9dafe4e8

Branch: refs/heads/master
Commit: 9dafe4e83e9068c2ce8afc8869ed433be885dde7
Parents: bcd3c07
Author: Alex <al...@apache.org>
Authored: Fri Mar 27 07:40:25 2015 -0400
Committer: Alex <al...@apache.org>
Committed: Fri Mar 27 07:40:25 2015 -0400

----------------------------------------------------------------------
 juddi-client-cli/.gitignore                     |    6 +
 juddi-client-cli/README.txt                     |   12 +
 juddi-client-cli/keystore.jks                   |  Bin 0 -> 2253 bytes
 juddi-client-cli/pom.xml                        |  139 +++
 .../cli/CompareByTModelInstanceInfoQOS.java     |  125 ++
 .../apache/juddi/v3/client/cli/EntryPoint.java  |  209 ++++
 .../v3/client/cli/EntryPointSingleNode.java     |  604 ++++++++++
 .../juddi/v3/client/cli/EntryPoitMultiNode.java |  132 +++
 .../v3/client/cli/FindBusinessBugHunt.java      |  208 ++++
 .../juddi/v3/client/cli/JuddiAdminService.java  | 1076 ++++++++++++++++++
 .../apache/juddi/v3/client/cli/SearchByQos.java |  272 +++++
 .../juddi/v3/client/cli/SimpleBrowse.java       |  489 ++++++++
 .../juddi/v3/client/cli/UddiCreatebulk.java     |  210 ++++
 .../v3/client/cli/UddiCustodyTransfer.java      |  166 +++
 .../cli/UddiDigitalSignatureBusiness.java       |  196 ++++
 .../v3/client/cli/UddiDigitalSignatureFile.java |  160 +++
 .../client/cli/UddiDigitalSignatureSearch.java  |  130 +++
 .../client/cli/UddiDigitalSignatureService.java |  189 +++
 .../client/cli/UddiDigitalSignatureTmodel.java  |  173 +++
 .../juddi/v3/client/cli/UddiFindBinding.java    |  106 ++
 .../juddi/v3/client/cli/UddiFindEndpoints.java  |   78 ++
 .../v3/client/cli/UddiGetServiceDetails.java    |   95 ++
 .../juddi/v3/client/cli/UddiKeyGenerator.java   |  104 ++
 .../v3/client/cli/UddiRelatedBusinesses.java    |  154 +++
 .../juddi/v3/client/cli/UddiReplication.java    |  134 +++
 .../juddi/v3/client/cli/UddiSubscribe.java      |  244 ++++
 .../cli/UddiSubscribeAssertionStatus.java       |  163 +++
 .../v3/client/cli/UddiSubscribeValidate.java    |  137 +++
 .../client/cli/UddiSubscriptionManagement.java  |  149 +++
 .../apache/juddi/v3/client/cli/WadlImport.java  |  197 ++++
 .../apache/juddi/v3/client/cli/WsdlImport.java  |  214 ++++
 .../apache/juddi/v3/client/cli/testStrings.java |   73 ++
 .../resources/META-INF/simple-publish-uddi.xml  |  149 +++
 juddi-client-cli/truststore.jks                 |  Bin 0 -> 965 bytes
 .../v3/client/ext/wsdm/WSDMQosConstants.java    |   39 +
 .../juddi/v3/client/mapping/wsdl/ReadWSDL.java  |    5 +-
 .../SubscriptionCallbackListener.java           |   69 +-
 .../v3/client/transport/JAXWSTransport.java     |    4 +
 .../org/apache/juddi/samples/SimpleBrowse.java  |  359 ++++++
 juddi-rest-cxf/pom.xml                          |    2 +-
 pom.xml                                         |    1 +
 41 files changed, 6941 insertions(+), 31 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/juddi/blob/9dafe4e8/juddi-client-cli/.gitignore
----------------------------------------------------------------------
diff --git a/juddi-client-cli/.gitignore b/juddi-client-cli/.gitignore
new file mode 100644
index 0000000..c1a69fd
--- /dev/null
+++ b/juddi-client-cli/.gitignore
@@ -0,0 +1,6 @@
+target
+**/target/*
+**/derby.log
+**/.project
+**/.classpath
+**/.settings/*

http://git-wip-us.apache.org/repos/asf/juddi/blob/9dafe4e8/juddi-client-cli/README.txt
----------------------------------------------------------------------
diff --git a/juddi-client-cli/README.txt b/juddi-client-cli/README.txt
new file mode 100644
index 0000000..262be41
--- /dev/null
+++ b/juddi-client-cli/README.txt
@@ -0,0 +1,12 @@
+This example is a command line demonstration of how to interact with JUDDI and how to use 
+annotate items in UDDI for service or software versioning. 
+
+1. Start the jUDDI-server (juddi-tomcat or juddi-bundle)
+
+2. Check the settings of the META-INF/simple-publish-uddi.xml, to make sure the serverName and serverPort are set correctly.
+
+Note: This is an interactive program. Do not run this from a headless server or from CI/Buildbot/Jenkins
+
+3. mvn clean install -Pinteractive
+
+Follow the onscreen prompts
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/juddi/blob/9dafe4e8/juddi-client-cli/keystore.jks
----------------------------------------------------------------------
diff --git a/juddi-client-cli/keystore.jks b/juddi-client-cli/keystore.jks
new file mode 100644
index 0000000..4367476
Binary files /dev/null and b/juddi-client-cli/keystore.jks differ

http://git-wip-us.apache.org/repos/asf/juddi/blob/9dafe4e8/juddi-client-cli/pom.xml
----------------------------------------------------------------------
diff --git a/juddi-client-cli/pom.xml b/juddi-client-cli/pom.xml
new file mode 100644
index 0000000..77af99d
--- /dev/null
+++ b/juddi-client-cli/pom.xml
@@ -0,0 +1,139 @@
+<?xml version="1.0"?>
+<!--
+* Copyright 2001-2009 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.
+*
+*/ -->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+     <parent>
+        <groupId>org.apache.juddi</groupId>
+        <artifactId>juddi-parent</artifactId>
+        <version>3.3.0-SNAPSHOT</version>
+    </parent> 
+    <groupId>org.apache.juddi</groupId>
+    <artifactId>juddi-client-cli</artifactId>
+    <version>3.3.0-SNAPSHOT</version>
+    <packaging>bundle</packaging>
+
+    <name>jUDDI CLI Client</name>
+    <url>http://maven.apache.org</url>
+    <properties>
+        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+    </properties>
+    <dependencies>
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <version>4.11</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>${project.groupId}</groupId>
+            <artifactId>juddi-client</artifactId>
+            <version>${project.parent.version}</version>
+        </dependency>
+        <!-- a lorem ipsum generator MIT license-->
+        <dependency>
+            <groupId>de.sven-jacobs</groupId>
+            <artifactId>loremipsum</artifactId>
+            <version>1.0</version>
+        </dependency>
+        <dependency>
+            <groupId>commons-cli</groupId>
+            <artifactId>commons-cli</artifactId>
+            <version>1.2</version>
+        </dependency>
+
+            
+    </dependencies>
+    <build>
+        <plugins>
+            <!-- examples are not very useful from a maven repo, so don't put it there -->
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-deploy-plugin</artifactId>
+                <configuration>
+                    <skip>true</skip>
+                </configuration>
+            </plugin>
+            <plugin>
+              <artifactId>maven-assembly-plugin</artifactId>
+              <configuration>
+                <archive>
+                  <manifest>
+                    <mainClass>org.apache.juddi.samples.EntryPoint</mainClass>
+                  </manifest>
+                </archive>
+                <descriptorRefs>
+                  <descriptorRef>jar-with-dependencies</descriptorRef>
+                </descriptorRefs>
+              </configuration>
+              <executions>
+                <execution>
+                  <id>make-assembly</id> <!-- this is used for inheritance merges -->
+                  <phase>package</phase> <!-- bind to the packaging phase -->
+                  <goals>
+                    <goal>single</goal>
+                  </goals>
+                </execution>
+              </executions>
+            </plugin>
+        </plugins>
+    </build>
+    <profiles>
+        <profile>
+            <id>default</id>
+            <activation>
+                <activeByDefault>true</activeByDefault>
+            </activation>
+            <build>
+                <plugins>
+                    <plugin>
+                        <groupId>org.apache.maven.plugins</groupId>
+                        <artifactId>maven-surefire-plugin</artifactId>
+                        <configuration>
+                            <skip>true</skip>
+                        </configuration>
+                    </plugin>
+                </plugins>
+            </build>
+        </profile>
+        <profile>
+            <id>interactive</id>
+            <build>
+                <plugins>
+                    <plugin>
+                        <groupId>org.codehaus.mojo</groupId>
+                        <artifactId>exec-maven-plugin</artifactId>
+                        <version>1.1.1</version>
+                        <executions>
+                            <execution>
+                                <phase>test</phase>
+                                <goals>
+                                    <goal>java</goal>
+                                </goals>
+                                <configuration>
+                                    <mainClass>org.apache.juddi.samples.EntryPoint</mainClass>
+                                </configuration>
+                            </execution>
+                        </executions>
+                    </plugin>
+                </plugins>
+            </build>
+        </profile>
+    </profiles>
+
+
+</project>

http://git-wip-us.apache.org/repos/asf/juddi/blob/9dafe4e8/juddi-client-cli/src/main/java/org/apache/juddi/v3/client/cli/CompareByTModelInstanceInfoQOS.java
----------------------------------------------------------------------
diff --git a/juddi-client-cli/src/main/java/org/apache/juddi/v3/client/cli/CompareByTModelInstanceInfoQOS.java b/juddi-client-cli/src/main/java/org/apache/juddi/v3/client/cli/CompareByTModelInstanceInfoQOS.java
new file mode 100644
index 0000000..b7dc4d9
--- /dev/null
+++ b/juddi-client-cli/src/main/java/org/apache/juddi/v3/client/cli/CompareByTModelInstanceInfoQOS.java
@@ -0,0 +1,125 @@
+/*
+ * Copyright 2013 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.
+ */
+package org.apache.juddi.v3.client.cli;
+
+import org.apache.juddi.api_v3.AccessPointType;
+import org.apache.juddi.v3.client.config.UDDIClient;
+import org.apache.juddi.v3.client.ext.wsdm.WSDMQosConstants;
+import org.apache.juddi.v3.client.compare.TModelInstanceDetailsComparator;
+import org.uddi.api_v3.AccessPoint;
+import org.uddi.api_v3.BindingTemplate;
+import org.uddi.api_v3.BindingTemplates;
+import org.uddi.api_v3.BusinessEntity;
+import org.uddi.api_v3.BusinessService;
+import org.uddi.api_v3.BusinessServices;
+import org.uddi.api_v3.Contact;
+import org.uddi.api_v3.Contacts;
+import org.uddi.api_v3.Description;
+import org.uddi.api_v3.DiscoveryURL;
+import org.uddi.api_v3.DiscoveryURLs;
+import org.uddi.api_v3.InstanceDetails;
+import org.uddi.api_v3.Name;
+import org.uddi.api_v3.PersonName;
+import org.uddi.api_v3.TModelInstanceDetails;
+import org.uddi.api_v3.TModelInstanceInfo;
+
+/**
+ * doesn't make changes to a remote server, just creates a few businesses and compares the two by qos parameters
+ * @author Alex O'Ree
+ */
+public class CompareByTModelInstanceInfoQOS {
+
+    
+    public static void main(String[] args) throws Exception {
+            BusinessEntity mary = CreateMary();
+            BindingTemplate bt1 = mary.getBusinessServices().getBusinessService().get(0).getBindingTemplates().getBindingTemplate().get(0);
+            BindingTemplate bt2 = mary.getBusinessServices().getBusinessService().get(0).getBindingTemplates().getBindingTemplate().get(1);
+            
+            TModelInstanceDetailsComparator tidc = new TModelInstanceDetailsComparator(WSDMQosConstants.METRIC_FAULT_COUNT_KEY, true, false, false);
+            int compare = tidc.compare(bt1.getTModelInstanceDetails(), bt2.getTModelInstanceDetails());
+            if (compare > 0)
+                    System.out.println(mary.getBusinessServices().getBusinessService().get(0).getBindingTemplates().getBindingTemplate().get(0).getAccessPoint().getValue() +
+                            " is greater than " + mary.getBusinessServices().getBusinessService().get(0).getBindingTemplates().getBindingTemplate().get(1).getAccessPoint().getValue());
+            if (compare < 0)
+                    System.out.println(mary.getBusinessServices().getBusinessService().get(0).getBindingTemplates().getBindingTemplate().get(0).getAccessPoint().getValue() +
+                            " is less than " + mary.getBusinessServices().getBusinessService().get(0).getBindingTemplates().getBindingTemplate().get(1).getAccessPoint().getValue());
+            if (compare== 0)
+                    System.out.println(mary.getBusinessServices().getBusinessService().get(0).getBindingTemplates().getBindingTemplate().get(0).getAccessPoint().getValue() +
+                            " is equal to " + mary.getBusinessServices().getBusinessService().get(0).getBindingTemplates().getBindingTemplate().get(1).getAccessPoint().getValue());
+            
+    }
+
+    
+
+    /**
+     * creates a business, service, bt with tmodel instance details with qos
+     * parameters
+     *
+     * @param rootAuthToken
+     * @throws Exception
+     */
+    private static BusinessEntity CreateMary() throws Exception {
+        BusinessEntity be = new BusinessEntity();
+        be.setBusinessKey("uddi:uddi.marypublisher.com:marybusinessone");
+        be.setDiscoveryURLs(new DiscoveryURLs());
+        be.getDiscoveryURLs().getDiscoveryURL().add(new DiscoveryURL("home", "http://www.marybusinessone.com"));
+        be.getDiscoveryURLs().getDiscoveryURL().add(new DiscoveryURL("serviceList", "http://www.marybusinessone.com/services"));
+        be.getName().add(new Name("Mary Doe Enterprises", "en"));
+        be.getName().add(new Name("Maria Negocio Uno", "es"));
+        be.getDescription().add(new Description("This is the description for Mary Business One.", "en"));
+        be.setContacts(new Contacts());
+        Contact c = new Contact();
+        c.setUseType("administrator");
+        c.getPersonName().add(new PersonName("Mary Doe", "en"));
+        c.getPersonName().add(new PersonName("Juan Doe", "es"));
+        c.getDescription().add(new Description("This is the administrator of the service offerings.", "en"));
+        be.getContacts().getContact().add(c);
+        be.setBusinessServices(new BusinessServices());
+        BusinessService bs = new BusinessService();
+        bs.setBusinessKey("uddi:uddi.marypublisher.com:marybusinessone");
+        bs.setServiceKey("uddi:uddi.marypublisher.com:marybusinessoneservice");
+        bs.getName().add(new Name("name!", "en"));
+        bs.setBindingTemplates(new BindingTemplates());
+        BindingTemplate bt = new BindingTemplate();
+        bt.setAccessPoint(new AccessPoint("http://localhost/endpoint1BAD", AccessPointType.WSDL_DEPLOYMENT.toString()));
+        bt.setTModelInstanceDetails(new TModelInstanceDetails());
+        TModelInstanceInfo tii = new TModelInstanceInfo();
+        tii.setTModelKey(WSDMQosConstants.METRIC_FAULT_COUNT_KEY);
+
+        tii.setInstanceDetails(new InstanceDetails());
+        tii.getInstanceDetails().setInstanceParms("400");
+        bt = UDDIClient.addSOAPtModels(bt);
+        bt.getTModelInstanceDetails().getTModelInstanceInfo().add(tii);
+        bs.getBindingTemplates().getBindingTemplate().add(bt);
+        
+        bt = new BindingTemplate();
+        bt.setAccessPoint(new AccessPoint("http://localhost/endpoint2BETTER", AccessPointType.WSDL_DEPLOYMENT.toString()));
+        bt.setTModelInstanceDetails(new TModelInstanceDetails());
+         tii = new TModelInstanceInfo();
+        tii.setTModelKey(WSDMQosConstants.METRIC_FAULT_COUNT_KEY);
+
+        tii.setInstanceDetails(new InstanceDetails());
+        tii.getInstanceDetails().setInstanceParms("4");
+        bt = UDDIClient.addSOAPtModels(bt);
+        bt.getTModelInstanceDetails().getTModelInstanceInfo().add(tii);
+        bs.getBindingTemplates().getBindingTemplate().add(bt);
+        
+        
+        be.getBusinessServices().getBusinessService().add(bs);
+        
+        return be;
+    }
+}

http://git-wip-us.apache.org/repos/asf/juddi/blob/9dafe4e8/juddi-client-cli/src/main/java/org/apache/juddi/v3/client/cli/EntryPoint.java
----------------------------------------------------------------------
diff --git a/juddi-client-cli/src/main/java/org/apache/juddi/v3/client/cli/EntryPoint.java b/juddi-client-cli/src/main/java/org/apache/juddi/v3/client/cli/EntryPoint.java
new file mode 100644
index 0000000..0fbd720
--- /dev/null
+++ b/juddi-client-cli/src/main/java/org/apache/juddi/v3/client/cli/EntryPoint.java
@@ -0,0 +1,209 @@
+/*
+ * Copyright 2014 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.
+ */
+package org.apache.juddi.v3.client.cli;
+
+import java.io.File;
+import org.apache.juddi.v3.client.config.UDDIClient;
+import org.apache.juddi.v3.client.config.UDDINode;
+
+/**
+ *
+ * @author Alex O'Ree
+ */
+public class EntryPoint {
+
+        public static void main(String[] args) throws Exception {
+
+                if (System.getProperty("javax.net.ssl.trustStore") == null) {
+                        File f = new File("../../juddi-tomcat/truststore.jks");
+                        if (f.exists()) {
+                                System.setProperty("javax.net.ssl.trustStore", f.getAbsolutePath());
+
+                        } else {
+                                f = new File("../juddi-tomcat/truststore.jks");
+                                if (f.exists()) {
+                                        System.setProperty("javax.net.ssl.trustStore", f.getAbsolutePath());
+
+                                } else {
+                                        f = new File("./juddi-tomcat/truststore.jks");
+                                        if (f.exists()) {
+                                                System.setProperty("javax.net.ssl.trustStore", f.getAbsolutePath());
+
+                                        }
+                                }
+                        }
+
+                        System.setProperty("javax.net.ssl.trustStorePassword", "password");
+                        //System.setProperty("javax.net.ssl.keyStore", "keystore.jks");
+
+                        //System.setProperty("javax.net.ssl.keyStorePassword", "changeit");
+                }
+                //set up trust store
+
+                String trustStore = System.getProperty("javax.net.ssl.trustStore");
+                if (trustStore == null) {
+                        System.out.println("javax.net.ssl.trustStore is not defined");
+                } else {
+                        System.out.println("javax.net.ssl.trustStore = " + trustStore);
+                }
+
+                if (System.getProperty("javax.net.ssl.keyStore") == null) {
+                        File f = new File("../../juddi-tomcat/keystore.jks");
+                        if (f.exists()) {
+                                System.setProperty("javax.net.ssl.keyStore", f.getAbsolutePath());
+
+                        } else {
+                                f = new File("../juddi-tomcat/keyStore.jks");
+                                if (f.exists()) {
+                                        System.setProperty("javax.net.ssl.keyStore", f.getAbsolutePath());
+
+                                } else {
+                                        f = new File("./juddi-tomcat/keystore.jks");
+                                        if (f.exists()) {
+                                                System.setProperty("javax.net.ssl.keyStore", f.getAbsolutePath());
+
+                                        }
+                                }
+                        }
+
+                        System.setProperty("javax.net.ssl.keyStorePassword", "password");
+                        //System.setProperty("javax.net.ssl.keyStore", "keystore.jks");
+
+                        //System.setProperty("javax.net.ssl.keyStorePassword", "changeit");
+                }
+                //set up trust store
+
+                String keyStore = System.getProperty("javax.net.ssl.trustStore");
+                if (keyStore == null) {
+                        System.out.println("javax.net.ssl.keyStore is not defined");
+                } else {
+                        System.out.println("javax.net.ssl.keyStore = " + trustStore);
+                }
+                //first menu
+                //connect to a node and do work on it
+                //multinode 
+                String input = null;
+                do {
+                        System.out.println("____________________________");
+                        System.out.println("jUDDI Interactive Command Line Interface");
+                        System.out.println("____________________________");
+                        System.out.println(" 1) Connect and login to a Node");
+                        System.out.println(" 2) Multinode and Replication commands");
+                        System.out.println(" 3) Offline code examples");
+                        System.out.println("- [ jUDDI Client (this app) configuration ] -");
+                        //local config management
+                        System.out.println(" 4) Quick add the jUDDI cloud node to *this's configuration file");
+                        System.out.println(" 5) Add a node to *this's configuration file");
+                        System.out.println(" 6) View all registered nodes for this client");
+                        System.out.println(" q) Quit/exit");
+                        System.out.print("jUDDI Main# ");
+                        input = System.console().readLine();
+                        if ("1".equals(input)) {
+                                goSingleNode();
+                        } else if ("2".equals(input)) {
+                                goMultiNode();
+                        } else if ("3".equals(input)) {
+                                goOfflineExamples();
+                        }  else if (input.equals("4")) {
+                                //System.out.println("31) Quick add the jUDDI cloud node to *this's configuration file");
+                                new JuddiAdminService(new UDDIClient(), null).quickRegisterLocalCloud();
+                        } else if (input.equals("5")) {
+                                // System.out.println("32) Add a node to *this's configuration file");
+                                UDDIClient clerkManager = new UDDIClient();
+                                UDDINode node = new UDDINode();
+                                System.out.print("Name (must be unique: ");
+                                node.setClientName(System.console().readLine());
+                                node.setName(node.getClientName());
+                                System.out.print("Description: ");
+                                node.setDescription(System.console().readLine());
+
+                                node.setHomeJUDDI(false);
+                                System.out.print("Inquiry URL: ");
+                                node.setInquiryUrl(System.console().readLine());
+
+                                System.out.print("Inquiry REST URL (optional): ");
+                                node.setInquiryRESTUrl(System.console().readLine());
+
+                                System.out.print("jUDDI API URL (optional): ");
+                                node.setJuddiApiUrl(System.console().readLine());
+                                System.out.print("Custody Transfer URL: ");
+                                node.setCustodyTransferUrl(System.console().readLine());
+                                System.out.print("Publish URL: ");
+                                node.setPublishUrl(System.console().readLine());
+                                System.out.print("Replication URL: ");
+                                node.setReplicationUrl(System.console().readLine());
+                                System.out.print("Security URL: ");
+                                node.setSecurityUrl(System.console().readLine());
+                                System.out.print("Subscription URL: ");
+                                node.setSubscriptionUrl(System.console().readLine());
+
+                                System.out.print("Subscription Listener URL: ");
+                                node.setSubscriptionListenerUrl(System.console().readLine());
+
+                                System.out.print("Transport (defaults to JAXWS): ");
+                                node.setProxyTransport(System.console().readLine());
+                                if (node.getProxyTransport() == null || node.getProxyTransport().trim().equalsIgnoreCase("")) {
+                                        node.setProxyTransport(org.apache.juddi.v3.client.transport.JAXWSTransport.class.getCanonicalName());
+                                }
+                                System.out.print("Factory Initial (optional): ");
+                                node.setFactoryInitial(System.console().readLine());
+                                System.out.print("Factory Naming Provider (optional): ");
+                                node.setFactoryNamingProvider(System.console().readLine());
+                                System.out.print("Factory URL Packages (optional): ");
+                                node.setFactoryURLPkgs(System.console().readLine());
+
+                                clerkManager.getClientConfig().addUDDINode(node);
+                                clerkManager.getClientConfig().saveConfig();
+                                System.out.println("Saved.");
+                        }
+                } while (!"q".equalsIgnoreCase(input));
+        }
+
+        static void goMultiNode() throws Exception {
+                EntryPoitMultiNode.goMultiNode();
+        }
+
+        static void goSingleNode() throws Exception {
+                EntryPointSingleNode.goSingleNode();
+
+        }
+
+        private static void goOfflineExamples() throws Exception {
+                String input = null;
+                do {
+                        System.out.println("____________________________");
+                        System.out.println("Offline/Code Examples (you'll want to look at the source for some of these");
+                        System.out.println("____________________________");
+                        System.out.println(" 1) Compare Two Binding/tModelInstanceInfo - QOS Code Example");
+                        System.out.println("2) Digitally sign a UDDI entity from a file.");
+                        System.out.println(" q) Quit/exit");
+                        System.out.print("#");
+                        input = System.console().readLine();
+                        processOffline(input);
+                } while (!"q".equalsIgnoreCase(input));
+
+        }
+
+        private static void processOffline(String input) throws Exception {
+                if (input.equals("1")) {
+                        CompareByTModelInstanceInfoQOS.main(null);
+                }
+                if (input.equals("2")) {
+                        new UddiDigitalSignatureFile().Fire(null, null, null);
+                }
+        }
+
+}

http://git-wip-us.apache.org/repos/asf/juddi/blob/9dafe4e8/juddi-client-cli/src/main/java/org/apache/juddi/v3/client/cli/EntryPointSingleNode.java
----------------------------------------------------------------------
diff --git a/juddi-client-cli/src/main/java/org/apache/juddi/v3/client/cli/EntryPointSingleNode.java b/juddi-client-cli/src/main/java/org/apache/juddi/v3/client/cli/EntryPointSingleNode.java
new file mode 100644
index 0000000..309e525
--- /dev/null
+++ b/juddi-client-cli/src/main/java/org/apache/juddi/v3/client/cli/EntryPointSingleNode.java
@@ -0,0 +1,604 @@
+/*
+ * Copyright 2015 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.
+ */
+package org.apache.juddi.v3.client.cli;
+
+import java.util.List;
+import org.apache.juddi.api_v3.Node;
+import org.apache.juddi.v3.client.UDDIConstants;
+import org.apache.juddi.v3.client.config.UDDIClient;
+import org.apache.juddi.v3.client.config.UDDINode;
+import org.apache.juddi.v3.client.transport.Transport;
+import org.uddi.api_v3.BusinessList;
+import org.uddi.api_v3.DeleteBusiness;
+import org.uddi.api_v3.DeleteService;
+import org.uddi.api_v3.DeleteTModel;
+import org.uddi.api_v3.DiscardAuthToken;
+import org.uddi.api_v3.FindBusiness;
+import org.uddi.api_v3.FindQualifiers;
+import org.uddi.api_v3.FindService;
+import org.uddi.api_v3.FindTModel;
+import org.uddi.api_v3.GetAuthToken;
+import org.uddi.api_v3.Name;
+import org.uddi.api_v3.ServiceList;
+import org.uddi.api_v3.TModelList;
+import org.uddi.v3_service.UDDIInquiryPortType;
+import org.uddi.v3_service.UDDISecurityPortType;
+
+/**
+ *
+ * @author alex
+ */
+public class EntryPointSingleNode {
+
+        static void goSingleNode() throws Exception {
+                String currentNode = "default";
+                UDDIClient clerkManager = new UDDIClient("META-INF/simple-publish-uddi.xml");
+
+                List<Node> uddiNodeList = clerkManager.getClientConfig().getUDDINodeList();
+                System.out.println();
+
+                System.out.println("Nodes:");
+                for (int i = 0; i < uddiNodeList.size(); i++) {
+                        System.out.println((i + 1) + ") Node name: " + uddiNodeList.get(i).getName());
+                }
+                System.out.print("Destination Node: ");
+                int index = Integer.parseInt(System.console().readLine()) - 1;
+
+                currentNode = uddiNodeList.get(index).getName();
+                Transport transport = clerkManager.getTransport(currentNode);
+                authtoken = login(currentNode, transport);
+                String input = null;
+                do {
+                        System.out.println(" 1) Login");
+                        System.out.println(" 2) Print auth token");
+                        System.out.println(" 3) Logout (discard auth token)");
+
+                        System.out.println("- [ Searching and Browsing ] -");
+                        System.out.println(" 4) List all Businesses (XML)");
+                        System.out.println(" 5) List all Businesses (Human readable)");
+                        System.out.println(" 6) List all Services (XML)");
+                        System.out.println(" 7) List all Services (Human readable)");
+                        System.out.println(" 8) List all tModels (XML)");
+                        System.out.println(" 9) List all tModels (Human readable)");
+                        System.out.println("10) Find a Business");
+                        System.out.println("11) Find a Service");
+                        System.out.println("12) Find a tModel");
+
+                        System.out.println("13) Find Binding by QOS Parameters (Binding/tModelInstanceInfo)");
+                        System.out.println("14) Find Business by QOS Parameters (Binding/tModelInstanceInfo)");
+                        System.out.println("15) Find Service by QOS Parameters (Binding/tModelInstanceInfo)");
+                        System.out.println("16) Find a Binding, lists all bindings for all services");
+                        System.out.println("17) Find Endpoints of a service (given the key)");
+                        System.out.println("18) Get the details of a service");
+                        System.out.println("19) UDDI Digital Signatures - Search for Signed Items");
+
+                        System.out.println("- [ Publishing ] -");
+                        System.out.println("20) Make a Key Generator tModel");
+                        System.out.println("21) UDDI Create Bulk (makes N business with N services) (create for load testing)");
+                        System.out.println("22) WSDL2UDDI - Register a service from a WSDL document (business key required)");
+                        System.out.println("23) WADL2UDDI - Register a service from a WADL document (business key required)");
+                        System.out.println("24) UDDI Custody Transfer (within a single node)");
+
+                        System.out.println("25) UDDI Digital Signatures - Sign a Business");
+                        System.out.println("26) UDDI Digital Signatures - Sign a Service");
+                        System.out.println("27) UDDI Digital Signatures - Sign a tModel");
+
+                        System.out.println("28) Create a Business Relationship Between two users and two Businesses(Publisher Assertion)");
+
+                        System.out.println("- [ Subscriptions ] -");
+                        System.out.println("29) Subscriptions - Asynchronous, listens for all changes (req stored credentials)");
+                        System.out.println("30) Subscriptions - Synchronous");
+                        System.out.println("31) Print Subscriptions");
+                        System.out.println("32) Delete a subscription");
+                        System.out.println("33) Delete all subscriptions");
+                        System.out.println("34) Subscriptions - Asynchronous, publisher assertion subscriptions");
+
+                        System.out.println("- [ Replication ] -");
+                        System.out.println("35) Replication - do_ping");
+                        System.out.println("36) Replication - get high watermarks");
+                        System.out.println("37) Replication - get change records");
+                        System.out.println("38) Replication - get failed change records (jUDDI only)");
+
+                        //remote config management - juddi only
+                        System.out.println("- [ jUDDI Configuration Management ] -");
+                        System.out.println("39) Quick register the jUDDI cloud node to the current node");
+                        System.out.println("40) Register the a locally defined node to another jUDDI server");
+                        System.out.println("41) View all registered remote nodes on a jUDDI server");
+                        System.out.println("42) UnRegister a node on a jUDDI server");
+
+                        //juddi only
+                        System.out.println("43) View the replication config from the current jUDDI server");
+                        System.out.println("44) Set the replication config on a remote jUDDI server");
+                        System.out.println("45) Prints the current replication status of a given node");
+                        System.out.println("46) Periodic publisher, 1biz+1svc every 5 seconds");
+
+                        //deleters
+                        System.out.println("47) Bulk delete business");
+                        System.out.println("48) Bulk delete services");
+                        System.out.println("49) Bulk delete tModels");
+
+                        System.out.println("q) quit");
+                        System.out.print(username + "@" + currentNode + "# ");
+                        input = System.console().readLine();
+                        try {
+                                processInput(input, currentNode, transport, clerkManager);
+                        } catch (Exception ex) {
+                                ex.printStackTrace();
+                        }
+                } while (!input.equalsIgnoreCase("q"));
+        }
+        private static String authtoken = null;
+        static String password;
+        static String username;
+
+        private static String login(String currentNode, Transport transport) throws Exception {
+                System.out.println("Options:");
+                System.out.println("1) Enter a username/password for auth token");
+                System.out.println("2) Enter a username/password for HTTP based logins");
+                System.out.println("3) Enter a username/password for use stored credentials");
+                System.out.print("Login Method: ");
+                String input = System.console().readLine();
+                if ("1".equalsIgnoreCase(input)) {
+                        UDDISecurityPortType security = null;
+                        security = transport.getUDDISecurityService();
+                        System.out.print(currentNode + "# username: ");
+                        username = System.console().readLine();
+                        char passwordArray[] = System.console().readPassword(currentNode + "# password: ");
+                        GetAuthToken getAuthTokenRoot = new GetAuthToken();
+                        getAuthTokenRoot.setUserID(username);
+                        password = new String(passwordArray);
+                        getAuthTokenRoot.setCred((password));
+                        String lauthtoken = security.getAuthToken(getAuthTokenRoot).getAuthInfo();
+                        System.out.println("Success!");
+                        return lauthtoken;
+                } else if ("2".equalsIgnoreCase(input)) {
+                        System.out.println("not implemented yet!");
+
+                } else if ("3".equalsIgnoreCase(input)) {
+                        System.out.println("not implemented yet!");
+                } else {
+                        System.out.println("Aborted!");
+                }
+                return null;
+
+        }
+
+        private static void processInput(final String input, final String currentNode, final Transport transport, UDDIClient client) throws Exception {
+                if (input == null) {
+                        return;
+                }
+                if (input.equals("1")) {
+                        authtoken = login(currentNode, transport);
+                } else if (input.equals("2")) {
+                        System.out.println("Token info: " + authtoken);
+                } else if (input.equals("3")) {
+                        if (authtoken != null) {
+                                UDDISecurityPortType security = null;
+                                security = transport.getUDDISecurityService();
+                                DiscardAuthToken getAuthTokenRoot = new DiscardAuthToken();
+                                getAuthTokenRoot.setAuthInfo(authtoken);
+                                security.discardAuthToken(getAuthTokenRoot);
+                                System.out.println("Success!");
+                        }
+                } else if (input.equals("4")) {
+                        new SimpleBrowse(transport).printBusinessList(authtoken, null, true);
+                } else if (input.equals("5")) {
+                        new SimpleBrowse(transport).printBusinessList(authtoken, null, false);
+                } else if (input.equals("6")) {
+                        new SimpleBrowse(transport).printServiceList(authtoken, null, true);
+                } else if (input.equals("7")) {
+                        new SimpleBrowse(transport).printServiceList(authtoken, null, false);
+                } else if (input.equals("8")) {
+                        new SimpleBrowse(transport).printTModelList(authtoken, null, true);
+                } else if (input.equals("9")) {
+                        new SimpleBrowse(transport).printTModelList(authtoken, null, false);
+                } else if (input.equals("10")) {
+                        System.out.print("Tip: (use % for wildcard searches)");
+                        System.out.print("Name to search for: ");
+                        String url = (System.console().readLine());
+                        new SimpleBrowse(transport).printBusinessList(authtoken, url, false);
+                } else if (input.equals("11")) {
+                        System.out.print("Tip: (use % for wildcard searches)");
+                        System.out.print("Name to search for: ");
+                        String url = (System.console().readLine());
+                        new SimpleBrowse(transport).printServiceList(authtoken, url, false);
+                } else if (input.equals("12")) {
+                        System.out.print("Tip: (use % for wildcard searches)");
+                        System.out.print("Name to search for: ");
+                        String url = (System.console().readLine());
+                        new SimpleBrowse(transport).printTModelList(authtoken, url, false);
+                } else if (input.equals("13")) {
+                        SearchByQos.doFindBinding(authtoken, transport);
+                } else if (input.equals("14")) {
+                        SearchByQos.doFindBusiness(authtoken, transport);
+                } else if (input.equals("15")) {
+                        SearchByQos.doFindService(authtoken, transport);
+                } else if (input.equals("16")) {
+                        new UddiFindBinding().Fire(authtoken);
+                } else if (input.equals("17")) {
+                        System.out.print("Service key to parse the endpoints: ");
+                        String key = (System.console().readLine());
+                        new UddiFindEndpoints().Fire(authtoken, key);
+                } else if (input.equals("18")) {
+                        System.out.print("Service key: ");
+                        String key = (System.console().readLine());
+                        new UddiGetServiceDetails().Fire(authtoken, key);
+                } else if (input.equals("19")) {
+                        new UddiDigitalSignatureSearch().Fire(authtoken);
+                } else if (input.equals("20")) {
+                        System.out.print("Get FQDN: ");
+                        String key = (System.console().readLine());
+                        new UddiKeyGenerator().Fire(authtoken, key);
+                } else if (input.equals("21")) {
+
+                        System.out.print("businesses: ");
+                        int biz = Integer.parseInt(System.console().readLine());
+                        System.out.print("servicesPerBusiness: ");
+                        int svc = Integer.parseInt(System.console().readLine());
+                        new UddiCreatebulk(transport, false, currentNode).publishBusiness(authtoken, biz, svc, username);
+                } else if (input.equals("22")) {
+                        System.out.print("Path or URL to WSDL file: ");
+                        String url = (System.console().readLine());
+                        System.out.print("Business key to attach to: ");
+                        String key = (System.console().readLine());
+                        new WsdlImport().Fire(url, key, authtoken, transport);
+                } else if (input.equals("23")) {
+                        System.out.print("Path or URL to WADL file: ");
+                        String url = (System.console().readLine());
+                        System.out.print("Business key to attach to: ");
+                        String key = (System.console().readLine());
+                        new WadlImport().Fire(url, key, authtoken, transport);
+                } else if (input.equals("24")) {
+                        UDDISecurityPortType security = null;
+                        security = transport.getUDDISecurityService();
+
+                        System.out.print("Transfer from username: ");
+                        String uname = (System.console().readLine());
+                        char passwordArray[] = System.console().readPassword("password: ");
+                        GetAuthToken getAuthTokenRoot = new GetAuthToken();
+                        getAuthTokenRoot.setUserID(uname);
+                        getAuthTokenRoot.setCred(new String(passwordArray));
+                        String authtokenFrom = security.getAuthToken(getAuthTokenRoot).getAuthInfo();
+                        System.out.println("Success!");
+
+                        System.out.print("Transfer to username: ");
+                        String uname2 = (System.console().readLine());
+                        char passwordArray2[] = System.console().readPassword("password: ");
+                        getAuthTokenRoot = new GetAuthToken();
+                        getAuthTokenRoot.setUserID(uname2);
+                        getAuthTokenRoot.setCred(new String(passwordArray2));
+                        String authtokenFrom2 = security.getAuthToken(getAuthTokenRoot).getAuthInfo();
+                        System.out.println("Success!");
+                        System.out.print("business/tModel key to transfer: ");
+                        String key = (System.console().readLine());
+                        new UddiCustodyTransfer().TransferBusiness(uname, authtokenFrom, uname2, authtokenFrom2, key);
+                } else if (input.equals("25")) {
+                        System.out.print("Business key to sign: ");
+                        String key = (System.console().readLine());
+                        new UddiDigitalSignatureBusiness().Fire(authtoken, key);
+                } else if (input.equals("26")) {
+                        System.out.print("Service key to sign: ");
+                        String key = (System.console().readLine());
+                        new UddiDigitalSignatureService().Fire(authtoken, key);
+                } else if (input.equals("27")) {
+                        System.out.print("tModel key to sign: ");
+                        String key = (System.console().readLine());
+                        new UddiDigitalSignatureTmodel().Fire(authtoken, key);
+                } else if (input.equals("28")) {
+                        UDDISecurityPortType security = null;
+
+                        security = transport.getUDDISecurityService();
+
+                        System.out.print("1st Business username: ");
+                        String uname = (System.console().readLine());
+                        char passwordArray[] = System.console().readPassword("password: ");
+                        GetAuthToken getAuthTokenRoot = new GetAuthToken();
+                        getAuthTokenRoot.setUserID(uname);
+                        getAuthTokenRoot.setCred(new String(passwordArray));
+                        String authtokenFrom = security.getAuthToken(getAuthTokenRoot).getAuthInfo();
+                        System.out.println("Success!");
+
+                        System.out.print(uname + "'s business : ");
+                        String key = (System.console().readLine());
+
+                        System.out.print("2st Business username: ");
+                        String uname2 = (System.console().readLine());
+                        char passwordArray2[] = System.console().readPassword("password: ");
+                        getAuthTokenRoot = new GetAuthToken();
+                        getAuthTokenRoot.setUserID(uname2);
+                        getAuthTokenRoot.setCred(new String(passwordArray2));
+                        String authtokenFrom2 = security.getAuthToken(getAuthTokenRoot).getAuthInfo();
+                        System.out.println("Success!");
+
+                        System.out.print(uname2 + "'s business : ");
+                        String key2 = (System.console().readLine());
+
+                        System.out.print("relationship (parent-child, peer-peer,or identity) : ");
+                        String relationship = (System.console().readLine());
+                        new UddiRelatedBusinesses().Fire(key, authtokenFrom, key2, authtokenFrom2, relationship);
+                } else if (input.equals("29")) {
+                        new UddiSubscribe(client, currentNode, transport).Fire();
+
+                } else if (input.equals("30")) {
+                        System.out.print("Subscription key: ");
+                        String key = (System.console().readLine());
+                        System.out.println("Fetching results for the past 30 days...");
+                        new UddiSubscribeValidate(transport).go(authtoken, input);
+                } else if (input.equals("31")) {
+                        new UddiSubscriptionManagement(transport).PrintSubscriptions(authtoken);
+                } else if (input.equals("32")) {
+                        System.out.print("Subscription key: ");
+                        String key2 = (System.console().readLine());
+                        new UddiSubscriptionManagement(transport).DeleteSubscription(authtoken, key2);
+                } else if (input.equals("33")) {
+                        new UddiSubscriptionManagement(transport).DeleteAllSubscriptions(authtoken);
+                } else if (input.equals("34")) {
+                        new UddiSubscribeAssertionStatus(transport).Fire(currentNode);
+
+                } else if (input.equals("35")) {
+
+                        new UddiReplication(client, currentNode).DoPing();
+
+                } else if (input.equals("36")) {
+                        //System.out.println("28) Replication - get high watermarks");
+                        new UddiReplication(client, currentNode).GetHighWatermarks();
+
+                } else if (input.equals("37")) {
+                        //System.out.println("29) Replication - get change records");
+
+                        System.out.print("Change ID to fetch: ");
+                        String id = (System.console().readLine());
+
+                        System.out.print("Node id of something in the replication graph: ");
+                        String src = (System.console().readLine());
+
+                        new UddiReplication(client, currentNode).GetChangeRecords(Long.parseLong(id), src);
+
+                } else if ("38".equals(input)) {
+                        new JuddiAdminService(client, transport).dumpFailedReplicationRecords(authtoken);
+                } else if (input.equals("39")) {
+
+                        new JuddiAdminService(client, transport).quickRegisterRemoteCloud(authtoken);
+                } else if (input.equals("40")) {
+
+                        //System.out.println("32) Register a *this node to a jUDDI server");
+                        UDDIClient clerkManager = new UDDIClient();
+                        List<Node> uddiNodeList = clerkManager.getClientConfig().getUDDINodeList();
+                        System.out.println();
+
+                        System.out.println("Locally defined nodes:");
+                        for (int i = 0; i < uddiNodeList.size(); i++) {
+                                System.out.println("________________________________________________________________________________");
+                                System.out.println((i + 1) + ") Node name: " + uddiNodeList.get(i).getName());
+                                System.out.println((i + 1) + ") Node description: " + uddiNodeList.get(i).getDescription());
+                                System.out.println((i + 1) + ") Transport: " + uddiNodeList.get(i).getProxyTransport());
+                                System.out.println((i + 1) + ") jUDDI URL: " + uddiNodeList.get(i).getJuddiApiUrl());
+                        }
+                        System.out.println("Local Source Node: ");
+                        int index = Integer.parseInt(System.console().readLine()) - 1;
+
+                        System.out.println("Remote Destination(s):");
+                        for (int i = 0; i < uddiNodeList.size(); i++) {
+                                System.out.println("________________________________________________________________________________");
+                                System.out.println((i + 1) + ") Node name: " + uddiNodeList.get(i).getName());
+                                System.out.println((i + 1) + ") Node description: " + uddiNodeList.get(i).getDescription());
+                                System.out.println((i + 1) + ") Transport: " + uddiNodeList.get(i).getProxyTransport());
+                                System.out.println((i + 1) + ") jUDDI URL: " + uddiNodeList.get(i).getJuddiApiUrl());
+                        }
+                        System.out.println("Remote Destination Node to publish to: ");
+                        int index2 = Integer.parseInt(System.console().readLine()) - 1;
+
+                        new JuddiAdminService(client, transport).registerLocalNodeToRemoteNode(authtoken, uddiNodeList.get(index), uddiNodeList.get(index2));
+
+                } else if (input.equals("41")) {
+
+                        // System.out.println("33) View all register remote nodes on a jUDDI server");
+                        new JuddiAdminService(client, transport).viewRemoteNodes(authtoken);
+                } /*  if (input.equals("35")) {
+                 UDDIClient clerkManager = new UDDIClient("META-INF/simple-publish-uddi.xml");
+                 List<Node> uddiNodeList = clerkManager.getClientConfig().getUDDINodeList();
+                 for (int i = 0; i < uddiNodeList.size(); i++) {
+                 System.out.println("________________________________________________________________________________");
+                 System.out.println("Client name: " + uddiNodeList.get(i).getClientName());
+                 System.out.println("Node name: " + uddiNodeList.get(i).getName());
+                 System.out.println("Node description: " + uddiNodeList.get(i).getDescription());
+                 System.out.println("Transport: " + uddiNodeList.get(i).getProxyTransport());
+                 System.out.println(i + ") jUDDI URL: " + uddiNodeList.get(i).getJuddiApiUrl());
+
+                 }
+
+                 }*/ else if (input.equals("42")) {
+
+                        new JuddiAdminService(client, transport).viewRemoveRemoteNode(authtoken);
+                        //System.out.println("35) UnRegister a node on a jUDDI server");
+                } else if (input.equals("43")) {
+                        new JuddiAdminService(client, transport).viewReplicationConfig(authtoken, currentNode);
+                } else if (input.equals("44")) {
+                        new JuddiAdminService(client, transport).setReplicationConfig(authtoken);
+                } else if (input.equals("45")) {
+                        new JuddiAdminService(client, transport).printStatus(transport, authtoken);
+                } else if (input.equals("46")) {
+                        //TODO current counts
+                        UDDIInquiryPortType uddiInquiryService = transport.getUDDIInquiryService();
+                        FindBusiness fb = new FindBusiness();
+                        fb.setAuthInfo(authtoken);
+                        fb.getName().add(new Name(UDDIConstants.WILDCARD, null));
+                        fb.setFindQualifiers(new FindQualifiers());
+                        fb.getFindQualifiers().getFindQualifier().add(UDDIConstants.APPROXIMATE_MATCH);
+                        fb.setMaxRows(1);
+                        fb.setListHead(0);
+                        BusinessList findBusiness = uddiInquiryService.findBusiness(fb);
+                        System.out.println("current business counts "
+                                + findBusiness.getListDescription().getActualCount() + " "
+                                + findBusiness.getListDescription().getIncludeCount() + " "
+                                + findBusiness.getListDescription().getListHead());
+                        FindService fs = new FindService();
+                        fs.setAuthInfo(authtoken);
+                        fs.getName().add(new Name(UDDIConstants.WILDCARD, null));
+                        fs.setFindQualifiers(new FindQualifiers());
+                        fs.getFindQualifiers().getFindQualifier().add(UDDIConstants.APPROXIMATE_MATCH);
+                        fs.setMaxRows(1);
+                        fs.setListHead(0);
+                        ServiceList findService = uddiInquiryService.findService(fs);
+                        System.out.println("current service counts "
+                                + findService.getListDescription().getActualCount() + " "
+                                + findService.getListDescription().getIncludeCount() + " "
+                                + findService.getListDescription().getListHead());
+
+                        running = true;
+                        createdServices = 0;
+                        createdBusinesses = 0;
+
+                        new Thread(new Runnable() {
+                                @Override
+                                public void run() {
+                                        UddiCreatebulk uddiCreatebulk = new UddiCreatebulk(transport, false, currentNode);
+                                        while (running) {
+                                                try {
+                                                        uddiCreatebulk.publishBusiness(authtoken, 1, 1, username);
+                                                        createdBusinesses++;
+                                                        createdServices++;
+                                                        Thread.sleep(5000);
+                                                } catch (Exception ex) {
+                                                        System.out.println("eception caught, assuming it's an expired token, attempting to reauthenticate " + ex.getMessage());
+                                                        //potentially an expired token, reauthenticate
+                                                        try {
+                                                                UDDISecurityPortType security = null;
+                                                                security = transport.getUDDISecurityService();
+
+                                                                GetAuthToken getAuthTokenRoot = new GetAuthToken();
+                                                                getAuthTokenRoot.setUserID(username);
+                                                                getAuthTokenRoot.setCred((password));
+                                                                authtoken = security.getAuthToken(getAuthTokenRoot).getAuthInfo();
+                                                        } catch (Exception x) {
+                                                                System.out.println("unable to reauthenticate, aborting!");
+                                                                ex.printStackTrace();
+                                                                running = false;
+                                                        }
+
+                                                }
+                                        }
+                                }
+                        }).start();
+                        System.out.println("Started, press <Enter> to stop!");
+                        System.console().readLine();
+                        running = false;
+
+                        System.out.println("before business counts "
+                                + findBusiness.getListDescription().getActualCount());
+
+                        fb.setAuthInfo(authtoken);
+                        BusinessList afterfindBusiness = uddiInquiryService.findBusiness(fb);
+                        System.out.println("after business counts "
+                                + afterfindBusiness.getListDescription().getActualCount());
+                        System.out.println("actual created " + createdBusinesses);
+                        System.out.println("Delta = " + (afterfindBusiness.getListDescription().getActualCount() - findBusiness.getListDescription().getActualCount()));
+
+                        System.out.println("before service counts "
+                                + findService.getListDescription().getActualCount());
+
+                        fs.setAuthInfo(authtoken);
+                        ServiceList afterfindService = uddiInquiryService.findService(fs);
+                        System.out.println("after service counts "
+                                + afterfindService.getListDescription().getActualCount());
+                        System.out.println("actual created " + createdServices);
+                        System.out.println("delta = " + (afterfindService.getListDescription().getActualCount() - findService.getListDescription().getActualCount()));
+                        if ((afterfindService.getListDescription().getActualCount() - findService.getListDescription().getActualCount()) == createdServices) {
+                                System.out.println("success");
+                        } else {
+                                System.out.println("failure!");
+                        }
+
+                } else if (input.equals("47")) {
+                        System.out.println("We'll run a search first, then the results will be deleted (after confirmation). Use % as a wild card");
+                        System.out.print("Search query: ");
+                        String key = (System.console().readLine());
+                        FindBusiness fb = new FindBusiness();
+                        fb.setFindQualifiers(new FindQualifiers());
+                        fb.getFindQualifiers().getFindQualifier().add(UDDIConstants.APPROXIMATE_MATCH);
+                        fb.getName().add(new Name(key, null));
+                        BusinessList findBusiness = transport.getUDDIInquiryService().findBusiness(fb);
+
+                        DeleteBusiness db = new DeleteBusiness();
+                        db.setAuthInfo(authtoken);
+                        for (int i = 0; i < findBusiness.getBusinessInfos().getBusinessInfo().size(); i++) {
+                                db.getBusinessKey().add(findBusiness.getBusinessInfos().getBusinessInfo().get(i).getBusinessKey());
+                                System.out.println(findBusiness.getBusinessInfos().getBusinessInfo().get(i).getBusinessKey() + " " + findBusiness.getBusinessInfos().getBusinessInfo().get(i).getName().get(0).getValue());
+                        }
+                        System.out.print("The above businesses will be deleted, are you sure? (y/n) : ");
+                        key = (System.console().readLine());
+                        if ("y".equalsIgnoreCase(key.trim().toLowerCase())) {
+                                transport.getUDDIPublishService().deleteBusiness(db);
+                                System.out.println("done.");
+                        }else
+                                System.out.println("aborted.");
+                }
+                else if (input.equals("48")) {
+                        System.out.println("We'll run a search first, then the results will be deleted (after confirmation). Use % as a wild card");
+                        System.out.print("Search query: ");
+                        String key = (System.console().readLine());
+                        
+                        FindService fb = new FindService();
+                        fb.setFindQualifiers(new FindQualifiers());
+                        fb.getFindQualifiers().getFindQualifier().add(UDDIConstants.APPROXIMATE_MATCH);
+                        fb.getName().add(new Name(key, null));
+                        ServiceList findBusiness = transport.getUDDIInquiryService().findService(fb);
+
+                        DeleteService db = new DeleteService();
+                        db.setAuthInfo(authtoken);
+                        for (int i = 0; i < findBusiness.getServiceInfos().getServiceInfo().size(); i++) {
+                                db.getServiceKey().add(findBusiness.getServiceInfos().getServiceInfo().get(i).getServiceKey());
+                                System.out.println(findBusiness.getServiceInfos().getServiceInfo().get(i).getServiceKey() + " " + findBusiness.getServiceInfos().getServiceInfo().get(i).getName().get(0).getValue());
+                        }
+                        System.out.print("The above services will be deleted, are you sure? (y/n) : ");
+                        key = (System.console().readLine());
+                        if ("y".equalsIgnoreCase(key.trim().toLowerCase())) {
+                                transport.getUDDIPublishService().deleteService(db);
+                                System.out.println("done.");
+                        }else
+                                System.out.println("aborted.");
+                }
+                else if (input.equals("49")) {
+                        System.out.println("We'll run a search first, then the results will be deleted (after confirmation). Use % as a wild card");
+                        System.out.print("Search query: ");
+                        String key = (System.console().readLine());
+                        FindTModel fb = new FindTModel();
+                        fb.setFindQualifiers(new FindQualifiers());
+                        fb.getFindQualifiers().getFindQualifier().add(UDDIConstants.APPROXIMATE_MATCH);
+                        fb.setName(new Name(key, null));
+                        TModelList findBusiness = transport.getUDDIInquiryService().findTModel(fb);
+
+                        DeleteTModel db = new DeleteTModel();
+                        db.setAuthInfo(authtoken);
+                        for (int i = 0; i < findBusiness.getTModelInfos().getTModelInfo().size(); i++) {
+                                db.getTModelKey().add(findBusiness.getTModelInfos().getTModelInfo().get(i).getTModelKey());
+                                System.out.println(findBusiness.getTModelInfos().getTModelInfo().get(i).getTModelKey() + " " + findBusiness.getTModelInfos().getTModelInfo().get(i).getName().getValue());
+                        }
+                        System.out.print("The above tModels will be deleted, are you sure? (y/n) : ");
+                        key = (System.console().readLine());
+                        if ("y".equalsIgnoreCase(key.trim().toLowerCase())) {
+                                transport.getUDDIPublishService().deleteTModel(db);
+                                System.out.println("done.");
+                        }else
+                                System.out.println("aborted.");
+                }
+
+        }
+        static boolean running = true;
+        static int createdServices = 0;
+        static int createdBusinesses = 0;
+
+}

http://git-wip-us.apache.org/repos/asf/juddi/blob/9dafe4e8/juddi-client-cli/src/main/java/org/apache/juddi/v3/client/cli/EntryPoitMultiNode.java
----------------------------------------------------------------------
diff --git a/juddi-client-cli/src/main/java/org/apache/juddi/v3/client/cli/EntryPoitMultiNode.java b/juddi-client-cli/src/main/java/org/apache/juddi/v3/client/cli/EntryPoitMultiNode.java
new file mode 100644
index 0000000..fbb5808
--- /dev/null
+++ b/juddi-client-cli/src/main/java/org/apache/juddi/v3/client/cli/EntryPoitMultiNode.java
@@ -0,0 +1,132 @@
+/*
+ * Copyright 2015 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.
+ */
+package org.apache.juddi.v3.client.cli;
+
+import java.util.List;
+import org.apache.juddi.api_v3.Node;
+import org.apache.juddi.v3.client.UDDIConstants;
+import org.apache.juddi.v3.client.config.UDDIClient;
+import org.apache.juddi.v3.client.transport.Transport;
+import org.uddi.api_v3.BusinessList;
+import org.uddi.api_v3.FindBusiness;
+import org.uddi.api_v3.FindQualifiers;
+import org.uddi.api_v3.FindService;
+import org.uddi.api_v3.FindTModel;
+import org.uddi.api_v3.Name;
+import org.uddi.api_v3.ServiceList;
+import org.uddi.api_v3.TModelList;
+import org.uddi.v3_service.UDDIInquiryPortType;
+
+/**
+ *
+ * @author alex
+ */
+public class EntryPoitMultiNode {
+
+        static void goMultiNode() throws Exception {
+                String currentNode = "default";
+                UDDIClient clerkManager = new UDDIClient("META-INF/simple-publish-uddi.xml");
+
+                List<Node> uddiNodeList = clerkManager.getClientConfig().getUDDINodeList();
+                String input = null;
+                do {
+                        System.out.println("1) Sets undirected replication two instances of jUDDI");
+                        System.out.println("2) Sets undirected replication 3 instances of jUDDI");
+                        System.out.println("3) Sets directed replication between 3 instances of jUDDI");
+                        System.out.println("4) Prints the replication status for all nodes");
+                        System.out.println("5) Prints the business, service, and tmodels counts");
+                        System.out.println("6) Ping all nodes");
+
+                        System.out.println("q) quit");
+                        System.out.print("Selection: ");
+                        input = System.console().readLine();
+
+                        processInput(input, clerkManager);
+
+                } while (!input.equalsIgnoreCase("q"));
+        }
+
+        private static void processInput(String input, UDDIClient clerkManager) throws Exception {
+                if (input.equals("1")) {
+
+                        new JuddiAdminService(clerkManager, null).autoMagic();
+                        List<Node> uddiNodeList = clerkManager.getClientConfig().getUDDINodeList();
+                        for (int i = 0; i < uddiNodeList.size(); i++) {
+                                new UddiCreatebulk(uddiNodeList.get(i).getName()).publishBusiness(null, 1, 1, "root@" + uddiNodeList.get(i).getName());
+                        }
+                        //new UddiCreatebulk("uddi:another.juddi.apache.org:node2").publishBusiness(null, 1, 1);
+                } else if (input.equals("2")) {
+
+                        new JuddiAdminService(clerkManager, null).autoMagic3();
+                        List<Node> uddiNodeList = clerkManager.getClientConfig().getUDDINodeList();
+                        for (int i = 0; i < uddiNodeList.size(); i++) {
+                                new UddiCreatebulk(uddiNodeList.get(i).getName()).publishBusiness(null, 1, 1, "root@" + uddiNodeList.get(i).getName());
+                        }
+                        //new UddiCreatebulk("uddi:another.juddi.apache.org:node2").publishBusiness(null, 1, 1);
+                } else if (input.equals("3")) {
+                        new JuddiAdminService(clerkManager, null).autoMagicDirected();
+
+                        List<Node> uddiNodeList = clerkManager.getClientConfig().getUDDINodeList();
+                        for (int i = 0; i < uddiNodeList.size(); i++) {
+                                new UddiCreatebulk(uddiNodeList.get(i).getName()).publishBusiness(null, 1, 1, "root@" + uddiNodeList.get(i).getName());
+                        }
+                } else if (input.equals("4")) {
+                        new JuddiAdminService(clerkManager, null).printStatus();
+                } else if (input.equals("5")) {
+                        List<Node> uddiNodeList = clerkManager.getClientConfig().getUDDINodeList();
+                        for (Node n : uddiNodeList) {
+                                UDDIInquiryPortType uddiInquiryService = clerkManager.getTransport(n.getName()).getUDDIInquiryService();
+
+                                FindBusiness fb = new FindBusiness();
+
+                                fb.getName().add(new Name(UDDIConstants.WILDCARD, null));
+                                fb.setFindQualifiers(new FindQualifiers());
+                                fb.getFindQualifiers().getFindQualifier().add(UDDIConstants.APPROXIMATE_MATCH);
+                                fb.setMaxRows(1);
+                                fb.setListHead(0);
+                                BusinessList findBusiness = uddiInquiryService.findBusiness(fb);
+                                System.out.println(n.getName() + " business count "
+                                        + findBusiness.getListDescription().getActualCount());
+                                FindService fs = new FindService();
+
+                                fs.getName().add(new Name(UDDIConstants.WILDCARD, null));
+                                fs.setFindQualifiers(new FindQualifiers());
+                                fs.getFindQualifiers().getFindQualifier().add(UDDIConstants.APPROXIMATE_MATCH);
+                                fs.setMaxRows(1);
+                                fs.setListHead(0);
+                                ServiceList findService = uddiInquiryService.findService(fs);
+                                System.out.println(n.getName() + " service count "
+                                        + findService.getListDescription().getActualCount());
+
+                                FindTModel ft = new FindTModel();
+                                ft.setName(new Name(UDDIConstants.WILDCARD, null));
+                                ft.setFindQualifiers(new FindQualifiers());
+                                ft.getFindQualifiers().getFindQualifier().add(UDDIConstants.APPROXIMATE_MATCH);
+                                ft.setMaxRows(1);
+                                ft.setListHead(0);
+                                TModelList findTModel = uddiInquiryService.findTModel(ft);
+                                System.out.println(n.getName() + " tModel count "
+                                        + findTModel.getListDescription().getActualCount());
+
+                        }
+                        System.out.println();
+                } else if (input.equals("6")) {
+                        new JuddiAdminService(clerkManager, null).pingAll();
+                }
+
+        }
+
+}

http://git-wip-us.apache.org/repos/asf/juddi/blob/9dafe4e8/juddi-client-cli/src/main/java/org/apache/juddi/v3/client/cli/FindBusinessBugHunt.java
----------------------------------------------------------------------
diff --git a/juddi-client-cli/src/main/java/org/apache/juddi/v3/client/cli/FindBusinessBugHunt.java b/juddi-client-cli/src/main/java/org/apache/juddi/v3/client/cli/FindBusinessBugHunt.java
new file mode 100644
index 0000000..834b4b1
--- /dev/null
+++ b/juddi-client-cli/src/main/java/org/apache/juddi/v3/client/cli/FindBusinessBugHunt.java
@@ -0,0 +1,208 @@
+/*
+ * 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.
+ */
+package org.apache.juddi.v3.client.cli;
+
+import java.util.Properties;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import org.apache.juddi.jaxb.PrintUDDI;
+import org.apache.juddi.v3.client.UDDIConstants;
+import org.apache.juddi.v3.client.config.UDDIClerk;
+import org.apache.juddi.v3.client.config.UDDIClient;
+import org.apache.juddi.v3.client.transport.Transport;
+import org.apache.juddi.v3_service.JUDDIApiPortType;
+import org.uddi.api_v3.BusinessDetail;
+import org.uddi.api_v3.BusinessEntity;
+import org.uddi.api_v3.BusinessInfos;
+import org.uddi.api_v3.BusinessList;
+import org.uddi.api_v3.Contact;
+import org.uddi.api_v3.Contacts;
+import org.uddi.api_v3.DeleteBusiness;
+import org.uddi.api_v3.Description;
+import org.uddi.api_v3.DiscoveryURL;
+import org.uddi.api_v3.DiscoveryURLs;
+import org.uddi.api_v3.FindBusiness;
+import org.uddi.api_v3.GetAuthToken;
+import org.uddi.api_v3.GetBusinessDetail;
+import org.uddi.api_v3.Name;
+import org.uddi.api_v3.PersonName;
+import org.uddi.api_v3.SaveBusiness;
+import org.uddi.api_v3.SaveTModel;
+import org.uddi.api_v3.TModel;
+import org.uddi.v3_service.UDDIInquiryPortType;
+import org.uddi.v3_service.UDDIPublicationPortType;
+import org.uddi.v3_service.UDDISecurityPortType;
+
+/**
+ *
+ * @author Alex O'Ree
+ */
+public class FindBusinessBugHunt {
+
+    static PrintUDDI<TModel> pTModel = new PrintUDDI<TModel>();
+    static Properties properties = new Properties();
+    static String wsdlURL = null;
+    private static UDDISecurityPortType security = null;
+    private static JUDDIApiPortType juddiApi = null;
+    private static UDDIPublicationPortType publish = null;
+    private static UDDIInquiryPortType inquiry;
+
+    public static void main(String[] args) throws Exception {
+
+        // create a manager and read the config in the archive; 
+        // you can use your config file name
+        UDDIClient clerkManager = new UDDIClient("META-INF/simple-publish-uddi.xml");
+        UDDIClerk clerk = clerkManager.getClerk("default");
+        // a ClerkManager 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 = clerkManager.getTransport();
+        // Now you create a reference to the UDDI API
+        security = transport.getUDDISecurityService();
+        publish = transport.getUDDIPublishService();
+        inquiry = transport.getUDDIInquiryService();
+        //step one, get a token
+        GetAuthToken getAuthTokenRoot = new GetAuthToken();
+        getAuthTokenRoot.setUserID("uddi");
+        getAuthTokenRoot.setCred("uddi");
+
+        // Making API call that retrieves the authentication token for the 'root' user.
+        String rootAuthToken = clerk.getAuthToken(clerk.getUDDINode().getSecurityUrl());
+        String uddi = security.getAuthToken(getAuthTokenRoot).getAuthInfo();
+
+        System.out.println("killing mary's business if it exists");
+        //first check is Mary's business exists and delete
+        DeleteIfExists("uddi:uddi.marypublisher.com:marybusinessone", uddi);
+
+        System.out.println("making mary's tmodel key gen");
+        //make the key gen since our test case uses some custom keys
+        TModel createKeyGenator = UDDIClerk.createKeyGenator("uddi.marypublisher.com", "mary key gen", "en");
+        //clerk.register(createKeyGenator);
+        System.out.println("saving...");
+        SaveTM(createKeyGenator, uddi);
+
+
+        System.out.println("fetching business list");
+        BusinessList before = getBusinessList(uddi);
+        if (before.getBusinessInfos() == null) {
+            System.out.println("before no businesses returned!");
+            before.setBusinessInfos(new BusinessInfos());
+        } else {
+            System.out.println(before.getBusinessInfos().getBusinessInfo().size() + " businesses returned before");
+        }
+
+        System.out.println("saving mary");
+        SaveMary(uddi);
+
+        BusinessList after = getBusinessList(uddi);
+        if (after.getBusinessInfos() == null) {
+            System.out.println("after no businesses returned!");
+            after.setBusinessInfos(new BusinessInfos());
+        } else {
+            System.out.println(after.getBusinessInfos().getBusinessInfo().size() + " businesses returned after");
+        }
+        PrintUDDI<BusinessList> p = new PrintUDDI<BusinessList>();
+        if (before.getBusinessInfos().getBusinessInfo().size()
+                < after.getBusinessInfos().getBusinessInfo().size()) {
+            System.out.println("hey it worked as advertised, double checking");
+            if (CheckFor(after, "uddi:uddi.marypublisher.com:marybusinessone")) {
+                System.out.println("ok!");
+            } else {
+                System.out.println("no good!");
+            }
+        } else {
+
+            System.out.println("something's not right, here's the before service listing");
+            System.out.println(p.print(before));
+            System.out.println(p.print(after));
+        }
+
+    }
+
+    private static void DeleteIfExists(String key, String authInfo) {
+        GetBusinessDetail gbd = new GetBusinessDetail();
+        gbd.setAuthInfo(authInfo);
+        gbd.getBusinessKey().add(key);
+        boolean found = false;
+        try {
+            BusinessDetail businessDetail = inquiry.getBusinessDetail(gbd);
+            if (businessDetail != null
+                    && !businessDetail.getBusinessEntity().isEmpty()
+                    && businessDetail.getBusinessEntity().get(0).getBusinessKey().equals(key)) {
+                found = true;
+            }
+        } catch (Exception ex) {
+        }
+        if (found) {
+            DeleteBusiness db = new DeleteBusiness();
+            db.setAuthInfo(authInfo);
+            db.getBusinessKey().add(key);
+            try {
+                publish.deleteBusiness(db);
+            } catch (Exception ex) {
+                Logger.getLogger(FindBusinessBugHunt.class.getName()).log(Level.SEVERE, null, ex);
+            }
+        }
+    }
+
+    private static BusinessList getBusinessList(String token) throws Exception {
+        FindBusiness fb = new FindBusiness();
+        fb.setAuthInfo(token);
+        org.uddi.api_v3.FindQualifiers fq = new org.uddi.api_v3.FindQualifiers();
+        fq.getFindQualifier().add(UDDIConstants.APPROXIMATE_MATCH);
+        fb.setFindQualifiers(fq);
+        fb.getName().add((new Name(UDDIConstants.WILDCARD, null)));
+        return inquiry.findBusiness(fb);
+    }
+
+    private static void SaveMary(String rootAuthToken) throws Exception {
+        BusinessEntity be = new BusinessEntity();
+        be.setBusinessKey("uddi:uddi.marypublisher.com:marybusinessone");
+        be.setDiscoveryURLs(new DiscoveryURLs());
+        be.getDiscoveryURLs().getDiscoveryURL().add(new DiscoveryURL("home", "http://www.marybusinessone.com"));
+        be.getDiscoveryURLs().getDiscoveryURL().add(new DiscoveryURL("serviceList", "http://www.marybusinessone.com/services"));
+        be.getName().add(new Name("Mary Doe Enterprises", "en"));
+        be.getName().add(new Name("Maria Negocio Uno", "es"));
+        be.getDescription().add(new Description("This is the description for Mary Business One.", "en"));
+        be.setContacts(new Contacts());
+        Contact c = new Contact();
+        c.setUseType("administrator");
+        c.getPersonName().add(new PersonName("Mary Doe", "en"));
+        c.getPersonName().add(new PersonName("Juan Doe", "es"));
+        c.getDescription().add(new Description("This is the administrator of the service offerings.", "en"));
+        be.getContacts().getContact().add(c);
+        SaveBusiness sb = new SaveBusiness();
+        sb.setAuthInfo(rootAuthToken);
+        sb.getBusinessEntity().add(be);
+        publish.saveBusiness(sb);
+    }
+
+    private static boolean CheckFor(BusinessList list, String key) {
+        for (int i = 0; i < list.getBusinessInfos().getBusinessInfo().size(); i++) {
+            if (list.getBusinessInfos().getBusinessInfo().get(i).getBusinessKey().equalsIgnoreCase(key)) {
+                return true;
+            }
+        }
+        return false;
+    }
+
+    private static void SaveTM(TModel createKeyGenator, String uddi) throws Exception {
+        SaveTModel stm = new SaveTModel();
+        stm.setAuthInfo(uddi);
+        stm.getTModel().add(createKeyGenator);
+        publish.saveTModel(stm);
+    }
+}


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


[2/5] juddi git commit: JUDDI-931 CLI client

Posted by al...@apache.org.
http://git-wip-us.apache.org/repos/asf/juddi/blob/9dafe4e8/juddi-client-cli/src/main/java/org/apache/juddi/v3/client/cli/UddiDigitalSignatureTmodel.java
----------------------------------------------------------------------
diff --git a/juddi-client-cli/src/main/java/org/apache/juddi/v3/client/cli/UddiDigitalSignatureTmodel.java b/juddi-client-cli/src/main/java/org/apache/juddi/v3/client/cli/UddiDigitalSignatureTmodel.java
new file mode 100644
index 0000000..608e8f4
--- /dev/null
+++ b/juddi-client-cli/src/main/java/org/apache/juddi/v3/client/cli/UddiDigitalSignatureTmodel.java
@@ -0,0 +1,173 @@
+/*
+ * Copyright 2001-2013 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.
+ *
+ */
+package org.apache.juddi.v3.client.cli;
+
+import java.util.concurrent.atomic.AtomicReference;
+import org.apache.juddi.v3.client.config.UDDIClient;
+import org.apache.juddi.v3.client.config.UDDIClientContainer;
+import org.apache.juddi.v3.client.cryptor.DigSigUtil;
+import org.apache.juddi.v3.client.transport.Transport;
+import org.uddi.api_v3.*;
+import org.uddi.v3_service.UDDIInquiryPortType;
+import org.uddi.v3_service.UDDIPublicationPortType;
+import org.uddi.v3_service.UDDISecurityPortType;
+
+/**
+ * This class shows you how to digitally sign a tmodel and verify the signature
+ *
+ * @author <a href="mailto:alexoree@apache.org">Alex O'Ree</a>
+ */
+public class UddiDigitalSignatureTmodel {
+
+        private static UDDISecurityPortType security = null;
+        private static UDDIInquiryPortType inquiry = null;
+        private static UDDIPublicationPortType publish = null;
+        private static UDDIClient clerkManager = null;
+
+        /**
+         * This sets up the ws proxies using uddi.xml in META-INF
+         */
+        public UddiDigitalSignatureTmodel() {
+                try {
+                        // create a manager and read the config in the archive; 
+                        // you can use your config file name
+                        clerkManager = new UDDIClient("META-INF/simple-publish-uddi.xml");
+                        Transport transport = clerkManager.getTransport();
+                        // Now you create a reference to the UDDI API
+                        security = transport.getUDDISecurityService();
+                        inquiry = transport.getUDDIInquiryService();
+                        publish = transport.getUDDIPublishService();
+                } catch (Exception e) {
+                        e.printStackTrace();
+                }
+        }
+
+        /**
+         * Main entry point
+         *
+         * @param args
+         */
+        public static void main(String args[]) {
+                UddiDigitalSignatureTmodel sp = new UddiDigitalSignatureTmodel();
+                sp.Fire(null, null);
+        }
+
+        public void Fire(String token, String key) {
+                try {
+                        DigSigUtil ds = null;
+
+                        //option 1), set everything manually
+                        ds = new DigSigUtil();
+                        ds.put(DigSigUtil.SIGNATURE_KEYSTORE_FILE, "keystore.jks");
+                        ds.put(DigSigUtil.SIGNATURE_KEYSTORE_FILETYPE, "JKS");
+                        ds.put(DigSigUtil.SIGNATURE_KEYSTORE_FILE_PASSWORD, "Test");
+                        ds.put(DigSigUtil.SIGNATURE_KEYSTORE_KEY_ALIAS, "Test");
+                        ds.put(DigSigUtil.SIGNATURE_OPTION_CERT_INCLUSION_BASE64, "true");
+
+                        ds.put(DigSigUtil.SIGNATURE_OPTION_CERT_INCLUSION_SERIAL, "true");
+                        ds.put(DigSigUtil.SIGNATURE_OPTION_CERT_INCLUSION_SUBJECTDN, "true");
+                        ds.put(DigSigUtil.TRUSTSTORE_FILE, "truststore.jks");
+                        ds.put(DigSigUtil.TRUSTSTORE_FILETYPE, "JKS");
+                        ds.put(DigSigUtil.TRUSTSTORE_FILE_PASSWORD, "Test");
+
+                        //option 2), load it from the juddi config file
+                        //ds = new DigSigUtil(clerkManager.getClientConfig().getDigitalSignatureConfiguration());
+                        //login
+                        if (token == null) //option, load from juddi config
+                        {
+                                token = GetAuthKey(clerkManager.getClerk("default").getPublisher(),
+                                        clerkManager.getClerk("default").getPassword());
+                        }
+                        if (key==null){
+                                SaveTModel stm = new SaveTModel();
+                                stm.setAuthInfo(token);
+                                TModel tm = new TModel();
+                                tm.setName(new Name("my cool signed tmodel", null));
+                                stm.getTModel().add(tm);
+                                TModelDetail saveTModel = publish.saveTModel(stm);
+                                key = saveTModel.getTModel().get(0).getTModelKey();
+                        }
+
+                        TModel be = GetTmodelDetails(key);
+                        if (!be.getSignature().isEmpty())
+                        {
+                                System.out.println("WARN, the entity with the key " + key + " is already signed! aborting");
+                                return;
+                        }
+                        
+                        //DigSigUtil.JAXB_ToStdOut(be);
+                        System.out.println("signing");
+                        TModel signUDDI_JAXBObject = ds.signUddiEntity(be);
+                        DigSigUtil.JAXB_ToStdOut(signUDDI_JAXBObject);
+                        System.out.println("signed, saving");
+
+                        SaveTModel sb = new SaveTModel();
+                        sb.setAuthInfo(token);
+                        sb.getTModel().add(signUDDI_JAXBObject);
+                        publish.saveTModel(sb);
+                        System.out.println("saved, fetching");
+
+                        be = GetTmodelDetails(key);
+                        DigSigUtil.JAXB_ToStdOut(be);
+                        System.out.println("verifing");
+                        AtomicReference<String> msg = new AtomicReference<String>();
+                        boolean verifySigned_UDDI_JAXB_Object = ds.verifySignedUddiEntity(be, msg);
+                        if (verifySigned_UDDI_JAXB_Object) {
+                                System.out.println("signature validation passed (expected)");
+                        } else {
+                                System.out.println("signature validation failed (not expected)");
+                        }
+                        System.out.println(msg.get());
+
+                } catch (Exception e) {
+                        e.printStackTrace();
+                }
+        }
+
+        private TModel GetTmodelDetails(String key) throws Exception {
+                //   BusinessInfo get
+                GetTModelDetail r = new GetTModelDetail();
+                r.getTModelKey().add(key);
+                return inquiry.getTModelDetail(r).getTModel().get(0);
+        }
+
+        /**
+         * Gets a UDDI style auth token, otherwise, appends credentials to the
+         * ws proxies (not yet implemented)
+         *
+         * @param username
+         * @param password
+         * @param style
+         * @return
+         */
+        private String GetAuthKey(String username, String password) {
+                try {
+
+                        GetAuthToken getAuthTokenRoot = new GetAuthToken();
+                        getAuthTokenRoot.setUserID(username);
+                        getAuthTokenRoot.setCred(password);
+
+                        // Making API call that retrieves the authentication token for the 'root' user.
+                        AuthToken rootAuthToken = security.getAuthToken(getAuthTokenRoot);
+                        System.out.println("root AUTHTOKEN = " + "don't log auth tokens!");
+                        return rootAuthToken.getAuthInfo();
+                } catch (Exception ex) {
+                        System.out.println("Could not authenticate with the provided credentials " + ex.getMessage());
+                }
+                return null;
+        }
+}

http://git-wip-us.apache.org/repos/asf/juddi/blob/9dafe4e8/juddi-client-cli/src/main/java/org/apache/juddi/v3/client/cli/UddiFindBinding.java
----------------------------------------------------------------------
diff --git a/juddi-client-cli/src/main/java/org/apache/juddi/v3/client/cli/UddiFindBinding.java b/juddi-client-cli/src/main/java/org/apache/juddi/v3/client/cli/UddiFindBinding.java
new file mode 100644
index 0000000..e257499
--- /dev/null
+++ b/juddi-client-cli/src/main/java/org/apache/juddi/v3/client/cli/UddiFindBinding.java
@@ -0,0 +1,106 @@
+/*
+ * Copyright 2001-2013 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.
+ *
+ */
+package org.apache.juddi.v3.client.cli;
+
+import org.apache.juddi.v3.client.UDDIConstants;
+import org.apache.juddi.v3.client.config.UDDIClient;
+import org.apache.juddi.v3.client.config.UDDIClientContainer;
+import org.apache.juddi.v3.client.transport.Transport;
+import org.apache.juddi.v3_service.JUDDIApiPortType;
+import org.uddi.api_v3.*;
+import org.uddi.v3_service.UDDIInquiryPortType;
+import org.uddi.v3_service.UDDIPublicationPortType;
+import org.uddi.v3_service.UDDISecurityPortType;
+
+/**
+ * This class shows you how to find an endpoint by searching through all
+ * services
+ *
+ * @author <a href="mailto:alexoree@apache.org">Alex O'Ree</a>
+ */
+public class UddiFindBinding {
+
+        private static UDDISecurityPortType security = null;
+        private static JUDDIApiPortType juddiApi = null;
+        private static UDDIPublicationPortType publish = null;
+        private static UDDIInquiryPortType inquiry = null;
+
+        public UddiFindBinding() {
+                try {
+                        // create a manager and read the config in the archive; 
+                        // you can use your config file name
+                        UDDIClient clerkManager = new UDDIClient("META-INF/simple-publish-uddi.xml");
+                        Transport transport = clerkManager.getTransport();
+                        // Now you create a reference to the UDDI API
+                        security = transport.getUDDISecurityService();
+                        juddiApi = transport.getJUDDIApiService();
+                        publish = transport.getUDDIPublishService();
+                        inquiry = transport.getUDDIInquiryService();
+                } catch (Exception e) {
+                        e.printStackTrace();
+                }
+        }
+
+        public void Fire(String token) {
+                try {
+                        // Setting up the values to get an authentication token for the 'root' user ('root' user has admin privileges
+                        // and can save other publishers).
+                        GetAuthToken getAuthTokenRoot = new GetAuthToken();
+                        getAuthTokenRoot.setUserID("root");
+                        getAuthTokenRoot.setCred("root");
+
+                        if (token == null) {
+                                // Making API call that retrieves the authentication token for the 'root' user.
+                                AuthToken rootAuthToken = security.getAuthToken(getAuthTokenRoot);
+                                System.out.println("root AUTHTOKEN = " + "don't log auth tokens!");
+                                token = rootAuthToken.getAuthInfo();
+                        }
+                        FindService fs = new FindService();
+                        fs.setAuthInfo(token);
+                        fs.getName().add(new Name());
+                        fs.getName().get(0).setValue("%");
+                        fs.setFindQualifiers(new FindQualifiers());
+                        fs.getFindQualifiers().getFindQualifier().add(UDDIConstants.APPROXIMATE_MATCH);
+
+                        ServiceList findService = inquiry.findService(fs);
+                        System.out.println(findService.getServiceInfos().getServiceInfo().size());
+                        GetServiceDetail gs = new GetServiceDetail();
+                        for (int i = 0; i < findService.getServiceInfos().getServiceInfo().size(); i++) {
+                                gs.getServiceKey().add(findService.getServiceInfos().getServiceInfo().get(i).getServiceKey());
+                        }
+
+                        ServiceDetail serviceDetail = inquiry.getServiceDetail(gs);
+                        for (int i = 0; i < serviceDetail.getBusinessService().size(); i++) {
+                                //System.out.println(serviceDetail.getBusinessService().get(i).getBindingTemplates().getBindingTemplate().size());
+                                if (serviceDetail.getBusinessService().get(i).getBindingTemplates() != null) {
+                                        for (int k = 0; k < serviceDetail.getBusinessService().get(i).getBindingTemplates().getBindingTemplate().size(); k++) {
+                                                if (serviceDetail.getBusinessService().get(i).getBindingTemplates().getBindingTemplate().get(k).getAccessPoint() != null) {
+                                                        System.out.println(serviceDetail.getBusinessService().get(i).getBindingTemplates().getBindingTemplate().get(k).getAccessPoint().getValue());
+                                                }
+                                        }
+                                }
+                        }
+                } catch (Exception e) {
+                        e.printStackTrace();
+                }
+        }
+
+        public static void main(String args[]) {
+                UddiFindBinding sp = new UddiFindBinding();
+                sp.Fire(null);
+        }
+}

http://git-wip-us.apache.org/repos/asf/juddi/blob/9dafe4e8/juddi-client-cli/src/main/java/org/apache/juddi/v3/client/cli/UddiFindEndpoints.java
----------------------------------------------------------------------
diff --git a/juddi-client-cli/src/main/java/org/apache/juddi/v3/client/cli/UddiFindEndpoints.java b/juddi-client-cli/src/main/java/org/apache/juddi/v3/client/cli/UddiFindEndpoints.java
new file mode 100644
index 0000000..41fe7f9
--- /dev/null
+++ b/juddi-client-cli/src/main/java/org/apache/juddi/v3/client/cli/UddiFindEndpoints.java
@@ -0,0 +1,78 @@
+/*
+ * Copyright 2001-2013 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.
+ *
+ */
+package org.apache.juddi.v3.client.cli;
+
+import java.util.List;
+import org.apache.juddi.v3.client.config.UDDIClerk;
+import org.apache.juddi.v3.client.config.UDDIClient;
+import org.apache.juddi.v3.client.transport.Transport;
+import org.uddi.v3_service.UDDIInquiryPortType;
+import org.uddi.v3_service.UDDISecurityPortType;
+
+/**
+ * This class show you how get all available Access Points/Endpoints for a
+ * service. This is harder than it sounds due to the complexity of UDDI's data
+ * structure. The output is the list of URLs given a service's key
+ *
+ * @author <a href="mailto:alexoree@apache.org">Alex O'Ree</a>
+ */
+public class UddiFindEndpoints {
+
+        private static UDDISecurityPortType security = null;
+        private static UDDIInquiryPortType inquiry = null;
+        static UDDIClerk clerk = null;
+
+        public UddiFindEndpoints() {
+                try {
+            // create a manager and read the config in the archive; 
+                        // you can use your config file name
+                        UDDIClient clerkManager = new UDDIClient("META-INF/simple-publish-uddi.xml");
+                        clerk = clerkManager.getClerk("default");
+            // a ClerkManager 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 = clerkManager.getTransport();
+                        // Now you create a reference to the UDDI API
+                        security = transport.getUDDISecurityService();
+                        inquiry = transport.getUDDIInquiryService();
+                } catch (Exception e) {
+                        e.printStackTrace();
+                }
+        }
+
+        public void Fire(String authtoken, String key) {
+                try {
+                        if (key == null) {
+                                key = "uddi:juddi.apache.org:services-inquiry";
+                        }
+
+                        List<String> endpoints = clerk.getEndpoints(key);
+                        System.out.println("Endpoints returned: " + endpoints.size());
+                        for (int i = 0; i < endpoints.size(); i++) {
+                                System.out.println(endpoints.get(i));
+                        }
+
+                } catch (Exception e) {
+                        e.printStackTrace();
+                }
+        }
+
+        public static void main(String args[]) {
+                UddiFindEndpoints sp = new UddiFindEndpoints();
+                sp.Fire(null, null);
+        }
+}

http://git-wip-us.apache.org/repos/asf/juddi/blob/9dafe4e8/juddi-client-cli/src/main/java/org/apache/juddi/v3/client/cli/UddiGetServiceDetails.java
----------------------------------------------------------------------
diff --git a/juddi-client-cli/src/main/java/org/apache/juddi/v3/client/cli/UddiGetServiceDetails.java b/juddi-client-cli/src/main/java/org/apache/juddi/v3/client/cli/UddiGetServiceDetails.java
new file mode 100644
index 0000000..fccb9be
--- /dev/null
+++ b/juddi-client-cli/src/main/java/org/apache/juddi/v3/client/cli/UddiGetServiceDetails.java
@@ -0,0 +1,95 @@
+/*
+ * Copyright 2001-2013 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.
+ *
+ */
+package org.apache.juddi.v3.client.cli;
+
+import javax.xml.bind.JAXB;
+import org.apache.juddi.v3.client.config.UDDIClient;
+import org.apache.juddi.v3.client.config.UDDIClientContainer;
+import org.apache.juddi.v3.client.transport.Transport;
+import org.apache.juddi.v3_service.JUDDIApiPortType;
+import org.uddi.api_v3.*;
+import org.uddi.v3_service.UDDIInquiryPortType;
+import org.uddi.v3_service.UDDIPublicationPortType;
+import org.uddi.v3_service.UDDISecurityPortType;
+
+/**
+ * This class show you how to get all available information for service
+ * (excluding OperationalInfo)
+ *
+ * @author <a href="mailto:alexoree@apache.org">Alex O'Ree</a>
+ */
+public class UddiGetServiceDetails {
+
+        private static UDDISecurityPortType security = null;
+        private static JUDDIApiPortType juddiApi = null;
+        private static UDDIPublicationPortType publish = null;
+        private static UDDIInquiryPortType inquiry = null;
+
+        public UddiGetServiceDetails() {
+                try {
+                        // create a manager and read the config in the archive; 
+                        // you can use your config file name
+                        UDDIClient clerkManager = new UDDIClient("META-INF/simple-publish-uddi.xml");
+                        Transport transport = clerkManager.getTransport();
+                        // Now you create a reference to the UDDI API
+                        security = transport.getUDDISecurityService();
+                        juddiApi = transport.getJUDDIApiService();
+                        publish = transport.getUDDIPublishService();
+                        inquiry = transport.getUDDIInquiryService();
+                } catch (Exception e) {
+                        e.printStackTrace();
+                }
+        }
+
+        public void Fire(String token, String key) {
+                if (key == null) {
+                        System.out.println("No key provided!");
+                        return;
+                }
+                try {
+                        // Setting up the values to get an authentication token for the 'root' user ('root' user has admin privileges
+                        // and can save other publishers).
+                        if (token == null) {
+
+                                GetAuthToken getAuthTokenRoot = new GetAuthToken();
+                                getAuthTokenRoot.setUserID("root");
+                                getAuthTokenRoot.setCred("root");
+
+                                // Making API call that retrieves the authentication token for the 'root' user.
+                                AuthToken rootAuthToken = security.getAuthToken(getAuthTokenRoot);
+                                System.out.println("root AUTHTOKEN = " + "don't log auth tokens!");
+                                token = rootAuthToken.getAuthInfo();
+                        }
+                        GetServiceDetail fs = new GetServiceDetail();
+                        fs.setAuthInfo(token);
+                        fs.getServiceKey().add(key);
+                        ServiceDetail serviceDetail = inquiry.getServiceDetail(fs);
+                        if (serviceDetail == null || serviceDetail.getBusinessService().isEmpty()) {
+                                System.out.println("mykey is not registered");
+                        } else {
+                                JAXB.marshal(serviceDetail, System.out);
+                        }
+                } catch (Exception e) {
+                        e.printStackTrace();
+                }
+        }
+
+        public static void main(String args[]) {
+                UddiGetServiceDetails sp = new UddiGetServiceDetails();
+                sp.Fire(null, "uddi:juddi.apache.org:services-inquiry");
+        }
+}

http://git-wip-us.apache.org/repos/asf/juddi/blob/9dafe4e8/juddi-client-cli/src/main/java/org/apache/juddi/v3/client/cli/UddiKeyGenerator.java
----------------------------------------------------------------------
diff --git a/juddi-client-cli/src/main/java/org/apache/juddi/v3/client/cli/UddiKeyGenerator.java b/juddi-client-cli/src/main/java/org/apache/juddi/v3/client/cli/UddiKeyGenerator.java
new file mode 100644
index 0000000..9350e0b
--- /dev/null
+++ b/juddi-client-cli/src/main/java/org/apache/juddi/v3/client/cli/UddiKeyGenerator.java
@@ -0,0 +1,104 @@
+/*
+ * Copyright 2001-2013 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.
+ *
+ */
+package org.apache.juddi.v3.client.cli;
+
+import org.apache.juddi.v3.client.config.UDDIClerk;
+import org.apache.juddi.v3.client.config.UDDIClient;
+import org.apache.juddi.v3.client.config.UDDIClientContainer;
+import org.apache.juddi.v3.client.transport.Transport;
+import org.apache.juddi.v3_service.JUDDIApiPortType;
+import org.uddi.api_v3.*;
+import org.uddi.v3_service.UDDIInquiryPortType;
+import org.uddi.v3_service.UDDIPublicationPortType;
+import org.uddi.v3_service.UDDISecurityPortType;
+
+/**
+ * This is an example how to make a UDDI key generator, which will enable you to
+ * make UDDI v3 keys with (almost) whatever pattern you want
+ *
+ * @author <a href="mailto:alexoree@apache.org">Alex O'Ree</a>
+ */
+public class UddiKeyGenerator {
+
+        private static UDDISecurityPortType security = null;
+        private static JUDDIApiPortType juddiApi = null;
+        private static UDDIPublicationPortType publish = null;
+        private static UDDIInquiryPortType inquiry = null;
+
+        public UddiKeyGenerator() {
+                try {
+            // create a manager and read the config in the archive; 
+                        // you can use your config file name
+                        UDDIClient clerkManager = new UDDIClient("META-INF/simple-publish-uddi.xml");
+                        Transport transport = clerkManager.getTransport();
+                        // Now you create a reference to the UDDI API
+                        security = transport.getUDDISecurityService();
+                        juddiApi = transport.getJUDDIApiService();
+                        publish = transport.getUDDIPublishService();
+                        inquiry = transport.getUDDIInquiryService();
+                } catch (Exception e) {
+                        e.printStackTrace();
+                }
+        }
+
+        public void Fire(String token, String domain) {
+                try {
+            // Setting up the values to get an authentication token for the 'root' user ('root' user has admin privileges
+                        // and can save other publishers).
+                        if (token == null) {
+                                GetAuthToken getAuthTokenRoot = new GetAuthToken();
+                                getAuthTokenRoot.setUserID("uddi");
+                                getAuthTokenRoot.setCred("uddi");
+
+                                // Making API call that retrieves the authentication token for the 'root' user.
+                                AuthToken rootAuthToken = security.getAuthToken(getAuthTokenRoot);
+                                System.out.println("uddi AUTHTOKEN = " + "don't log auth tokens!");
+                                token = rootAuthToken.getAuthInfo();
+                        }
+                        SaveTModel st = new SaveTModel();
+                        st.setAuthInfo(token);
+                        st.getTModel().add(UDDIClerk.createKeyGenator(domain, domain, "en"));
+                        TModelDetail saveTModel = publish.saveTModel(st);
+
+                        System.out.println("Saved!  key = " + saveTModel.getTModel().get(0).getTModelKey());
+                        /*
+            //Hey! tModel Key Generators can be nested too!
+                        st = new SaveTModel();
+                        st.setAuthInfo(rootAuthToken.getAuthInfo());
+                        st.getTModel().add(UDDIClerk.createKeyGenator("uddi:bea.com:servicebus.default:keygenerator", "bea.com:servicebus.default", "en"));
+                        publish.saveTModel(st);
+
+                        // This code block proves that you can create tModels based on a nested keygen
+                        st = new SaveTModel();
+                        TModel m = new TModel();
+                        m.setTModelKey("uddi:bea.com:servicebus.default.proxytest2");
+                        m.setName(new Name("name", "lang"));
+                        st.setAuthInfo(rootAuthToken.getAuthInfo());
+                        st.getTModel().add(m);
+                        publish.saveTModel(st);
+
+                                */
+                } catch (Exception e) {
+                        e.printStackTrace();
+                }
+        }
+
+        public static void main(String args[]) {
+                UddiKeyGenerator sp = new UddiKeyGenerator();
+                sp.Fire(null, "www.juddi.is.cool.org");
+        }
+}

http://git-wip-us.apache.org/repos/asf/juddi/blob/9dafe4e8/juddi-client-cli/src/main/java/org/apache/juddi/v3/client/cli/UddiRelatedBusinesses.java
----------------------------------------------------------------------
diff --git a/juddi-client-cli/src/main/java/org/apache/juddi/v3/client/cli/UddiRelatedBusinesses.java b/juddi-client-cli/src/main/java/org/apache/juddi/v3/client/cli/UddiRelatedBusinesses.java
new file mode 100644
index 0000000..a1ca4d5
--- /dev/null
+++ b/juddi-client-cli/src/main/java/org/apache/juddi/v3/client/cli/UddiRelatedBusinesses.java
@@ -0,0 +1,154 @@
+/*
+ * Copyright 2001-2013 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.
+ *
+ */
+package org.apache.juddi.v3.client.cli;
+
+import java.util.ArrayList;
+import java.util.GregorianCalendar;
+import java.util.List;
+import javax.xml.datatype.DatatypeFactory;
+import javax.xml.datatype.XMLGregorianCalendar;
+import javax.xml.ws.Holder;
+import org.apache.juddi.v3.client.config.UDDIClient;
+import org.apache.juddi.v3.client.transport.Transport;
+import org.apache.juddi.v3_service.JUDDIApiPortType;
+import org.uddi.api_v3.*;
+import org.uddi.v3_service.UDDIPublicationPortType;
+import org.uddi.v3_service.UDDISecurityPortType;
+
+/**
+ * This will create two businesses under different users, then setup a
+ * relationship between the two
+ *
+ * @author <a href="mailto:alexoree@apache.org">Alex O'Ree</a>
+ */
+public class UddiRelatedBusinesses {
+
+        private static UDDISecurityPortType security = null;
+        private static JUDDIApiPortType juddiApi = null;
+        private static UDDIPublicationPortType publish = null;
+
+        public UddiRelatedBusinesses() {
+                try {
+                        // create a manager and read the config in the archive; 
+                        // you can use your config file name
+                        UDDIClient clerkManager = new UDDIClient("META-INF/simple-publish-uddi.xml");
+                        Transport transport = clerkManager.getTransport();
+                        // Now you create a reference to the UDDI API
+                        security = transport.getUDDISecurityService();
+                        juddiApi = transport.getJUDDIApiService();
+                        publish = transport.getUDDIPublishService();
+                } catch (Exception e) {
+                        e.printStackTrace();
+                }
+        }
+
+        public void Fire(String businessKey, String authInfo, String businessKey1, String authInfo1, String relationship) throws Exception {
+                try {
+
+                        DatatypeFactory df = DatatypeFactory.newInstance();
+                        GregorianCalendar gcal = new GregorianCalendar();
+                        gcal.setTimeInMillis(System.currentTimeMillis());
+                        XMLGregorianCalendar xcal = df.newXMLGregorianCalendar(gcal);
+
+                                //ROOT creates half of the relationship
+                        //create a business relationship (publisher assertion)
+                        Holder<List<PublisherAssertion>> x = new Holder<List<PublisherAssertion>>();
+                        PublisherAssertion pa = new PublisherAssertion();
+                        pa.setFromKey(businessKey);
+                        pa.setToKey(businessKey1);
+                        pa.setKeyedReference(new KeyedReference());
+                        pa.getKeyedReference().setKeyName("Subsidiary");
+                        pa.getKeyedReference().setKeyValue(relationship);
+
+                        pa.getKeyedReference().setTModelKey("uddi:uddi.org:relationships");
+                        x.value = new ArrayList<PublisherAssertion>();
+                        x.value.add(pa);
+                        publish.setPublisherAssertions(authInfo, x);
+
+                        //now "UDDI" the user, creates the other half. It has to be mirrored exactly
+                        x = new Holder<List<PublisherAssertion>>();
+                        pa = new PublisherAssertion();
+                        pa.setFromKey(businessKey);
+                        pa.setToKey(businessKey1);
+                        pa.setKeyedReference(new KeyedReference());
+                        pa.getKeyedReference().setKeyName("Subsidiary");
+                        pa.getKeyedReference().setKeyValue(relationship);
+
+                        pa.getKeyedReference().setTModelKey("uddi:uddi.org:relationships");
+                        x.value = new ArrayList<PublisherAssertion>();
+                        x.value.add(pa);
+                        publish.setPublisherAssertions(authInfo1, x);
+
+                        System.out.println("Success!");
+                        /*
+                         * Here's some notes:
+                         * You can use
+                         * List<AssertionStatusItem> assertionStatusReport = publish.getAssertionStatusReport(UDDIAuthToken.getAuthInfo(), CompletionStatus.STATUS_FROM_KEY_INCOMPLETE);
+                         * to determine if there's any assertions/relationships requests that are pending
+                         * this should have one item it in, the relationship that's incomplete
+                         * 
+                         * There's also publish.deletePublisherAssertions();
+                         */
+                } catch (Exception e) {
+                        e.printStackTrace();
+                }
+        }
+
+        public static void main(String args[]) throws Exception {
+                UddiRelatedBusinesses sp = new UddiRelatedBusinesses();
+
+                GetAuthToken getAuthTokenRoot = new GetAuthToken();
+                getAuthTokenRoot.setUserID("root");
+                getAuthTokenRoot.setCred("root");
+
+                // Making API call that retrieves the authentication token for the 'root' user.
+                AuthToken rootAuthToken = security.getAuthToken(getAuthTokenRoot);
+                System.out.println("root AUTHTOKEN = " + "don't log auth tokens!");
+                BusinessEntity rootbiz = sp.CreateBusiness("root");
+
+                getAuthTokenRoot = new GetAuthToken();
+                getAuthTokenRoot.setUserID("uddi");
+                getAuthTokenRoot.setCred("uddi");
+
+                // Making API call that retrieves the authentication token for the 'root' user.
+                AuthToken uddiAuthToken = security.getAuthToken(getAuthTokenRoot);
+                System.out.println("uddi AUTHTOKEN = " + "don't log auth tokens!");
+                BusinessEntity uddibiz = sp.CreateBusiness("uddi");
+
+                //save user uddi's business
+                SaveBusiness sb = new SaveBusiness();
+                sb.setAuthInfo(uddiAuthToken.getAuthInfo());
+                sb.getBusinessEntity().add(uddibiz);
+                BusinessDetail uddibize = publish.saveBusiness(sb);
+
+                sb = new SaveBusiness();
+                sb.setAuthInfo(rootAuthToken.getAuthInfo());
+                sb.getBusinessEntity().add(rootbiz);
+                BusinessDetail rootbize = publish.saveBusiness(sb);
+
+                sp.Fire(rootbize.getBusinessEntity().get(0).getBusinessKey(), rootAuthToken.getAuthInfo(),
+                        uddibize.getBusinessEntity().get(0).getBusinessKey(), uddiAuthToken.getAuthInfo(),
+                        "parent-child");
+        }
+
+        private BusinessEntity CreateBusiness(String user) {
+                BusinessEntity be = new BusinessEntity();
+                be.getName().add(new Name(user + "'s business", null));
+                return be;
+        }
+
+}

http://git-wip-us.apache.org/repos/asf/juddi/blob/9dafe4e8/juddi-client-cli/src/main/java/org/apache/juddi/v3/client/cli/UddiReplication.java
----------------------------------------------------------------------
diff --git a/juddi-client-cli/src/main/java/org/apache/juddi/v3/client/cli/UddiReplication.java b/juddi-client-cli/src/main/java/org/apache/juddi/v3/client/cli/UddiReplication.java
new file mode 100644
index 0000000..3e5175c
--- /dev/null
+++ b/juddi-client-cli/src/main/java/org/apache/juddi/v3/client/cli/UddiReplication.java
@@ -0,0 +1,134 @@
+/*
+ * Copyright 2014 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.
+ */
+package org.apache.juddi.v3.client.cli;
+
+import java.math.BigInteger;
+import java.util.List;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import javax.xml.bind.JAXB;
+import javax.xml.ws.BindingProvider;
+import org.apache.commons.configuration.ConfigurationException;
+import org.apache.juddi.v3.client.UDDIService;
+import org.apache.juddi.v3.client.config.UDDIClient;
+import org.uddi.repl_v3.ChangeRecord;
+import org.uddi.repl_v3.ChangeRecordIDType;
+import org.uddi.repl_v3.ChangeRecords;
+import org.uddi.repl_v3.DoPing;
+import org.uddi.repl_v3.GetChangeRecords;
+import org.uddi.repl_v3.HighWaterMarkVectorType;
+import org.uddi.v3_service.UDDIReplicationPortType;
+
+/**
+ *
+ * @author Alex O'Ree
+ */
+class UddiReplication {
+
+        public UddiReplication(UDDIClient client, String nodename) throws ConfigurationException {
+
+                 uddiReplicationPort = new UDDIService().getUDDIReplicationPort();
+                ((BindingProvider) uddiReplicationPort).getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, client.getClientConfig().getUDDINode(nodename).getReplicationUrl());
+        }
+
+        UDDIReplicationPortType uddiReplicationPort = null;
+
+        String DoPing() {
+                try {
+                        String doPing = uddiReplicationPort.doPing(new DoPing());
+                        System.out.println("Ping Success, remote node's id is " + doPing);
+                        return doPing;
+                } catch (Exception ex) {
+                        Logger.getLogger(UddiReplication.class.getName()).log(Level.SEVERE, null, ex);
+                }
+                return null;
+        }
+
+        void GetHighWatermarks() {
+                try {
+                           List<ChangeRecordIDType> highWaterMarks = uddiReplicationPort.getHighWaterMarks();
+                        System.out.println("Success....");
+                        System.out.println("Node, USN");
+                        for (int i = 0; i < highWaterMarks.size(); i++) {
+                                System.out.println(
+                                        highWaterMarks.get(i).getNodeID() + ", "
+                                        + highWaterMarks.get(i).getOriginatingUSN());
+                        }
+                } catch (Exception ex) {
+                        Logger.getLogger(UddiReplication.class.getName()).log(Level.SEVERE, null, ex);
+                }
+        }
+
+        void GetChangeRecords(Long record, String sourcenode) {
+                try {
+                        HighWaterMarkVectorType highWaterMarkVectorType = new HighWaterMarkVectorType();
+
+                        highWaterMarkVectorType.getHighWaterMark().add(new ChangeRecordIDType(DoPing(), record));
+                        GetChangeRecords req = new GetChangeRecords();
+                        req.setRequestingNode(sourcenode);
+                        req.setChangesAlreadySeen(highWaterMarkVectorType);
+                        req.setResponseLimitCount(BigInteger.valueOf(100));
+                        ChangeRecords res = uddiReplicationPort.getChangeRecords(req);
+                        List<ChangeRecord> changeRecords = res.getChangeRecord();
+                        System.out.println("Success...." + changeRecords.size() + " records returned");
+                        System.out.println("Node, USN, type");
+                        for (int i = 0; i < changeRecords.size(); i++) {
+                                System.out.println(
+                                        changeRecords.get(i).getChangeID().getNodeID() + ", "
+                                        + changeRecords.get(i).getChangeID().getOriginatingUSN() + ": "
+                                        + GetChangeType(changeRecords.get(i)));
+                                JAXB.marshal(changeRecords.get(i), System.out);
+                        }
+                } catch (Exception ex) {
+                        Logger.getLogger(UddiReplication.class.getName()).log(Level.SEVERE, null, ex);
+                }
+        }
+
+        private String GetChangeType(ChangeRecord get) {
+                if (get.getChangeRecordAcknowledgement() != null) {
+                        return "ACK";
+                }
+                if (get.getChangeRecordConditionFailed() != null) {
+                        return "ConditionFailed";
+                }
+                if (get.getChangeRecordCorrection() != null) {
+                        return "Correction";
+                }
+                if (get.getChangeRecordDelete() != null) {
+                        return "Deletion";
+                }
+                if (get.getChangeRecordDeleteAssertion() != null) {
+                        return "Delete Assertion";
+                }
+                if (get.getChangeRecordHide() != null) {
+                        return "Hide tmodel";
+                }
+                if (get.getChangeRecordNewData() != null) {
+                        return "New Data";
+                }
+                if (get.getChangeRecordNewDataConditional() != null) {
+                        return "New data conditional";
+                }
+                if (get.getChangeRecordNull() != null) {
+                        return "Null";
+                }
+                if (get.getChangeRecordPublisherAssertion() != null) {
+                        return "New publisher assertion";
+                }
+                return null;
+        }
+
+}

http://git-wip-us.apache.org/repos/asf/juddi/blob/9dafe4e8/juddi-client-cli/src/main/java/org/apache/juddi/v3/client/cli/UddiSubscribe.java
----------------------------------------------------------------------
diff --git a/juddi-client-cli/src/main/java/org/apache/juddi/v3/client/cli/UddiSubscribe.java b/juddi-client-cli/src/main/java/org/apache/juddi/v3/client/cli/UddiSubscribe.java
new file mode 100644
index 0000000..20d2907
--- /dev/null
+++ b/juddi-client-cli/src/main/java/org/apache/juddi/v3/client/cli/UddiSubscribe.java
@@ -0,0 +1,244 @@
+/*
+ * Copyright 2001-2013 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.
+ *
+ */
+package org.apache.juddi.v3.client.cli;
+
+import javax.xml.datatype.DatatypeFactory;
+import org.apache.juddi.jaxb.PrintUDDI;
+import org.apache.juddi.v3.client.UDDIConstants;
+import org.apache.juddi.v3.client.config.UDDIClerk;
+import org.apache.juddi.v3.client.config.UDDIClient;
+import org.apache.juddi.v3.client.subscription.ISubscriptionCallback;
+import org.apache.juddi.v3.client.subscription.SubscriptionCallbackListener;
+import org.apache.juddi.v3.client.transport.Transport;
+import org.apache.juddi.v3_service.JUDDIApiPortType;
+import org.uddi.api_v3.*;
+import org.uddi.sub_v3.Subscription;
+import org.uddi.sub_v3.SubscriptionFilter;
+import org.uddi.sub_v3.SubscriptionResultsList;
+import org.uddi.v3_service.UDDIInquiryPortType;
+import org.uddi.v3_service.UDDIPublicationPortType;
+import org.uddi.v3_service.UDDISecurityPortType;
+import org.uddi.v3_service.UDDISubscriptionPortType;
+
+/**
+ * Thie class shows you how to create a business and a subscription using UDDI
+ * Subscription asynchronous callbacks
+ *
+ * @author <a href="mailto:alexoree@apache.org">Alex O'Ree</a>
+ */
+public class UddiSubscribe implements ISubscriptionCallback, Runnable {
+
+        private static UDDISecurityPortType security = null;
+        private static JUDDIApiPortType juddiApi = null;
+        private static UDDIPublicationPortType publish = null;
+        private static UDDIInquiryPortType uddiInquiryService = null;
+        private static UDDISubscriptionPortType uddiSubscriptionService = null;
+        boolean callbackRecieved = false;
+        private UDDIClerk clerk = null;
+        private UDDIClient client = null;
+
+        public UddiSubscribe() {
+                try {
+                        // create a manager and read the config in the archive; 
+                        // you can use your config file name
+                        client = new UDDIClient("META-INF/simple-publish-uddi.xml");
+                        clerk = client.getClerk("default");
+                        Transport transport = client.getTransport();
+                        // Now you create a reference to the UDDI API
+                        security = transport.getUDDISecurityService();
+                        juddiApi = transport.getJUDDIApiService();
+                        publish = transport.getUDDIPublishService();
+                        uddiInquiryService = transport.getUDDIInquiryService();
+                        uddiSubscriptionService = transport.getUDDISubscriptionService();
+                } catch (Exception e) {
+                        e.printStackTrace();
+                }
+        }
+        String nodename = "default";
+        public UddiSubscribe(UDDIClient client, String nodename, Transport transport) {
+                try {
+                        // create a manager and read the config in the archive; 
+                        // you can use your config file name
+                        //client = new UDDIClient("META-INF/simple-publish-uddi.xml");
+                        clerk = client.getClerk(nodename);
+                        this.nodename = nodename;
+                        // Now you create a reference to the UDDI API
+                        security = transport.getUDDISecurityService();
+                        juddiApi = transport.getJUDDIApiService();
+                        publish = transport.getUDDIPublishService();
+                        uddiInquiryService = transport.getUDDIInquiryService();
+                        uddiSubscriptionService = transport.getUDDISubscriptionService();
+                } catch (Exception e) {
+                        e.printStackTrace();
+                }
+        }
+
+        public static void main(String args[]) throws Exception {
+                UddiSubscribe sp = new UddiSubscribe();
+                sp.Fire();
+        }
+
+        public void Fire() throws Exception {
+
+                TModel createKeyGenator = UDDIClerk.createKeyGenator("somebusiness", "A test key domain SubscriptionCallbackTest1", "SubscriptionCallbackTest1");
+
+                clerk.register(createKeyGenator);
+                System.out.println("Registered tModel keygen: " + createKeyGenator.getTModelKey());
+
+                //setup the business to attach to
+                BusinessEntity be = new BusinessEntity();
+                be.setBusinessKey("uddi:somebusiness:somebusinesskey");
+                be.getName().add(new Name("somebusiness SubscriptionCallbackTest1", null));
+                be.setBusinessServices(new BusinessServices());
+                BusinessService bs = new BusinessService();
+                bs.setBusinessKey("uddi:somebusiness:somebusinesskey");
+                bs.setServiceKey("uddi:somebusiness:someservicekey");
+                bs.getName().add(new Name("service SubscriptionCallbackTest1", null));
+                be.getBusinessServices().getBusinessService().add(bs);
+                BusinessEntity register = clerk.register(be);
+                System.out.println("Registered business keygen: " + register.getBusinessKey());
+
+                //start up our listener
+                BindingTemplate start = SubscriptionCallbackListener.start(client, nodename);
+
+                //register for callbacks
+                SubscriptionCallbackListener.registerCallback(this);
+
+                Subscription sub = new Subscription();
+                sub.setNotificationInterval(DatatypeFactory.newInstance().newDuration(1000));
+                sub.setBindingKey(start.getBindingKey());
+                sub.setSubscriptionFilter(new SubscriptionFilter());
+                sub.getSubscriptionFilter().setFindBusiness(new FindBusiness());
+                sub.getSubscriptionFilter().getFindBusiness().setFindQualifiers(new FindQualifiers());
+                sub.getSubscriptionFilter().getFindBusiness().getFindQualifiers().getFindQualifier().add(UDDIConstants.APPROXIMATE_MATCH);
+                sub.getSubscriptionFilter().getFindBusiness().getName().add(new Name(UDDIConstants.WILDCARD, null));
+
+                Subscription subscriptionBiz = clerk.register(sub, clerk.getUDDINode().getApiNode());
+
+                System.out.println("Registered FindBusiness subscription key: " + (subscriptionBiz.getSubscriptionKey()) + " bindingkey: " + subscriptionBiz.getBindingKey());
+
+                sub = new Subscription();
+                sub.setNotificationInterval(DatatypeFactory.newInstance().newDuration(1000));
+                sub.setBindingKey(start.getBindingKey());
+                sub.setSubscriptionFilter(new SubscriptionFilter());
+                sub.getSubscriptionFilter().setFindService(new FindService());
+                sub.getSubscriptionFilter().getFindService().setFindQualifiers(new FindQualifiers());
+                sub.getSubscriptionFilter().getFindService().getFindQualifiers().getFindQualifier().add(UDDIConstants.APPROXIMATE_MATCH);
+                sub.getSubscriptionFilter().getFindService().getName().add(new Name(UDDIConstants.WILDCARD, null));
+
+                Subscription subscriptionSvc = clerk.register(sub, clerk.getUDDINode().getApiNode());
+
+                System.out.println("Registered FindService subscription key: " + (subscriptionSvc.getSubscriptionKey()) + " bindingkey: " + subscriptionSvc.getBindingKey());
+
+                sub = new Subscription();
+                sub.setNotificationInterval(DatatypeFactory.newInstance().newDuration(1000));
+                sub.setBindingKey(start.getBindingKey());
+                sub.setSubscriptionFilter(new SubscriptionFilter());
+                sub.getSubscriptionFilter().setFindTModel(new FindTModel());
+                sub.getSubscriptionFilter().getFindTModel().setFindQualifiers(new FindQualifiers());
+                sub.getSubscriptionFilter().getFindTModel().getFindQualifiers().getFindQualifier().add(UDDIConstants.APPROXIMATE_MATCH);
+                sub.getSubscriptionFilter().getFindTModel().setName(new Name(UDDIConstants.WILDCARD, null));
+
+                Subscription subscriptionTM = clerk.register(sub, clerk.getUDDINode().getApiNode());
+
+                System.out.println("Registered FindTModel subscription key: " + (subscriptionTM.getSubscriptionKey()) + " bindingkey: " + subscriptionTM.getBindingKey());
+
+                sub = new Subscription();
+                sub.setNotificationInterval(DatatypeFactory.newInstance().newDuration(1000));
+                sub.setBindingKey(start.getBindingKey());
+                sub.setSubscriptionFilter(new SubscriptionFilter());
+                sub.getSubscriptionFilter().setGetAssertionStatusReport(new GetAssertionStatusReport());
+                sub.getSubscriptionFilter().getGetAssertionStatusReport().setCompletionStatus(CompletionStatus.STATUS_COMPLETE);
+
+                Subscription subscriptionPA = clerk.register(sub, clerk.getUDDINode().getApiNode());
+
+                System.out.println("Registered Completed PublisherAssertion subscription key: " + (subscriptionPA.getSubscriptionKey()) + " bindingkey: " + subscriptionTM.getBindingKey());
+
+                sub = new Subscription();
+                sub.setNotificationInterval(DatatypeFactory.newInstance().newDuration(1000));
+                sub.setBindingKey(start.getBindingKey());
+                sub.setSubscriptionFilter(new SubscriptionFilter());
+                sub.getSubscriptionFilter().setGetAssertionStatusReport(new GetAssertionStatusReport());
+                sub.getSubscriptionFilter().getGetAssertionStatusReport().setCompletionStatus(CompletionStatus.STATUS_FROM_KEY_INCOMPLETE);
+
+                Subscription subscriptionPA2 = clerk.register(sub, clerk.getUDDINode().getApiNode());
+
+                System.out.println("Registered FROM incomplete PublisherAssertion subscription key: " + (subscriptionPA2.getSubscriptionKey()) + " bindingkey: " + subscriptionTM.getBindingKey());
+
+                sub = new Subscription();
+                sub.setNotificationInterval(DatatypeFactory.newInstance().newDuration(1000));
+                sub.setBindingKey(start.getBindingKey());
+                sub.setSubscriptionFilter(new SubscriptionFilter());
+                sub.getSubscriptionFilter().setGetAssertionStatusReport(new GetAssertionStatusReport());
+                sub.getSubscriptionFilter().getGetAssertionStatusReport().setCompletionStatus(CompletionStatus.STATUS_TO_KEY_INCOMPLETE);
+
+                Subscription subscriptionPA3 = clerk.register(sub, clerk.getUDDINode().getApiNode());
+
+                System.out.println("Registered TO incomplete PublisherAssertion subscription key: " + (subscriptionPA3.getSubscriptionKey()) + " bindingkey: " + subscriptionTM.getBindingKey());
+
+                sub = new Subscription();
+                sub.setNotificationInterval(DatatypeFactory.newInstance().newDuration(1000));
+                sub.setBindingKey(start.getBindingKey());
+                sub.setSubscriptionFilter(new SubscriptionFilter());
+                sub.getSubscriptionFilter().setGetAssertionStatusReport(new GetAssertionStatusReport());
+                sub.getSubscriptionFilter().getGetAssertionStatusReport().setCompletionStatus(CompletionStatus.STATUS_BOTH_INCOMPLETE);
+
+                Subscription subscriptionPA4 = clerk.register(sub, clerk.getUDDINode().getApiNode());
+
+                System.out.println("Registered recently deleted PublisherAssertion subscription key: " + (subscriptionPA4.getSubscriptionKey()) + " bindingkey: " + subscriptionTM.getBindingKey());
+
+                System.out.println("Waiting for callbacks. Now would be a good time to launch either another program or juddi-gui to make some changes. Press any key to stop!");
+                //Thread hook = new Thread(this);
+                //  Runtime.getRuntime().addShutdownHook(hook);
+
+                System.in.read();
+
+                SubscriptionCallbackListener.stop(client, nodename, start.getBindingKey());
+                clerk.unRegisterSubscription(subscriptionBiz.getSubscriptionKey());
+                clerk.unRegisterSubscription(subscriptionSvc.getSubscriptionKey());
+                clerk.unRegisterSubscription(subscriptionTM.getSubscriptionKey());
+                clerk.unRegisterSubscription(subscriptionPA.getSubscriptionKey());
+                clerk.unRegisterSubscription(subscriptionPA2.getSubscriptionKey());
+                clerk.unRegisterSubscription(subscriptionPA3.getSubscriptionKey());
+                clerk.unRegisterSubscription(subscriptionPA4.getSubscriptionKey());
+
+                clerk.unRegisterTModel(createKeyGenator.getTModelKey());
+
+                clerk.unRegisterBusiness("uddi:somebusiness:somebusinesskey");
+
+                //Runtime.getRuntime().removeShutdownHook(hook);
+        }
+
+        private boolean running = true;
+        PrintUDDI<SubscriptionResultsList> p = new PrintUDDI<SubscriptionResultsList>();
+
+        @Override
+        public void HandleCallback(SubscriptionResultsList body) {
+                System.out.println("Callback received!");
+                System.out.println(p.print(body));
+        }
+
+        @Override
+        public void NotifyEndpointStopped() {
+                System.out.println("The endpoint was stopped!");
+        }
+
+        @Override
+        public void run() {
+                running = false;
+        }
+}

http://git-wip-us.apache.org/repos/asf/juddi/blob/9dafe4e8/juddi-client-cli/src/main/java/org/apache/juddi/v3/client/cli/UddiSubscribeAssertionStatus.java
----------------------------------------------------------------------
diff --git a/juddi-client-cli/src/main/java/org/apache/juddi/v3/client/cli/UddiSubscribeAssertionStatus.java b/juddi-client-cli/src/main/java/org/apache/juddi/v3/client/cli/UddiSubscribeAssertionStatus.java
new file mode 100644
index 0000000..7440876
--- /dev/null
+++ b/juddi-client-cli/src/main/java/org/apache/juddi/v3/client/cli/UddiSubscribeAssertionStatus.java
@@ -0,0 +1,163 @@
+/*
+ * Copyright 2001-2013 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.
+ *
+ */
+package org.apache.juddi.v3.client.cli;
+
+import javax.xml.datatype.DatatypeFactory;
+import org.apache.juddi.jaxb.PrintUDDI;
+import org.apache.juddi.v3.client.UDDIConstants;
+import org.apache.juddi.v3.client.config.UDDIClerk;
+import org.apache.juddi.v3.client.config.UDDIClient;
+import org.apache.juddi.v3.client.subscription.ISubscriptionCallback;
+import org.apache.juddi.v3.client.subscription.SubscriptionCallbackListener;
+import org.apache.juddi.v3.client.transport.Transport;
+import org.apache.juddi.v3_service.JUDDIApiPortType;
+import org.uddi.api_v3.*;
+import org.uddi.sub_v3.Subscription;
+import org.uddi.sub_v3.SubscriptionFilter;
+import org.uddi.sub_v3.SubscriptionResultsList;
+import org.uddi.v3_service.UDDIInquiryPortType;
+import org.uddi.v3_service.UDDIPublicationPortType;
+import org.uddi.v3_service.UDDISecurityPortType;
+import org.uddi.v3_service.UDDISubscriptionPortType;
+
+/**
+ * Thie class shows you how to create a business and a subscription using UDDI
+ * Subscription asynchronous callbacks for Assertion Status Reports
+ *
+ * @author <a href="mailto:alexoree@apache.org">Alex O'Ree</a>
+ */
+public class UddiSubscribeAssertionStatus implements ISubscriptionCallback, Runnable {
+
+        private static UDDISecurityPortType security = null;
+        private static JUDDIApiPortType juddiApi = null;
+        private static UDDIPublicationPortType publish = null;
+        private static UDDIInquiryPortType uddiInquiryService = null;
+        private static UDDISubscriptionPortType uddiSubscriptionService = null;
+        boolean callbackRecieved = false;
+        private UDDIClerk clerk = null;
+        private UDDIClient client = null;
+
+        public UddiSubscribeAssertionStatus() {
+                try {
+                        // create a manager and read the config in the archive; 
+                        // you can use your config file name
+                        client = new UDDIClient("META-INF/simple-publish-uddi.xml");
+                        clerk = client.getClerk("default");
+                        Transport transport = client.getTransport();
+                        // Now you create a reference to the UDDI API
+                        security = transport.getUDDISecurityService();
+                        juddiApi = transport.getJUDDIApiService();
+                        publish = transport.getUDDIPublishService();
+                        uddiInquiryService = transport.getUDDIInquiryService();
+                        uddiSubscriptionService = transport.getUDDISubscriptionService();
+                } catch (Exception e) {
+                        e.printStackTrace();
+                }
+        }
+
+         public UddiSubscribeAssertionStatus(Transport transport) {
+                try {
+                        // Now you create a reference to the UDDI API
+                        security = transport.getUDDISecurityService();
+                        juddiApi = transport.getJUDDIApiService();
+                        publish = transport.getUDDIPublishService();
+                        uddiInquiryService = transport.getUDDIInquiryService();
+                        uddiSubscriptionService = transport.getUDDISubscriptionService();
+                } catch (Exception e) {
+                        e.printStackTrace();
+                }
+        }
+
+         
+        public static void main(String args[]) throws Exception {
+                UddiSubscribeAssertionStatus sp = new UddiSubscribeAssertionStatus();
+                sp.Fire("default");
+        }
+
+        public void Fire(String nodename) throws Exception {
+
+                TModel createKeyGenator = UDDIClerk.createKeyGenator("somebusiness", "A test key domain SubscriptionCallbackTest1", "SubscriptionCallbackTest1");
+
+                clerk.register(createKeyGenator);
+                System.out.println("Registered tModel keygen: " + createKeyGenator.getTModelKey());
+
+                //setup the business to attach to
+                BusinessEntity be = new BusinessEntity();
+                be.setBusinessKey("uddi:somebusiness:somebusinesskey");
+                be.getName().add(new Name("somebusiness SubscriptionCallbackTest1", null));
+                be.setBusinessServices(new BusinessServices());
+                BusinessService bs = new BusinessService();
+                bs.setBusinessKey("uddi:somebusiness:somebusinesskey");
+                bs.setServiceKey("uddi:somebusiness:someservicekey");
+                bs.getName().add(new Name("service SubscriptionCallbackTest1", null));
+                be.getBusinessServices().getBusinessService().add(bs);
+                BusinessEntity register = clerk.register(be);
+                System.out.println("Registered business keygen: " + register.getBusinessKey());
+
+                //start up our listener
+                BindingTemplate start = SubscriptionCallbackListener.start(client, nodename);
+
+                //register for callbacks
+                SubscriptionCallbackListener.registerCallback(this);
+
+                Subscription sub = new Subscription();
+                sub.setNotificationInterval(DatatypeFactory.newInstance().newDuration(1000));
+                sub.setBindingKey(start.getBindingKey());
+                sub.setSubscriptionFilter(new SubscriptionFilter());
+                sub.getSubscriptionFilter().setGetAssertionStatusReport(new GetAssertionStatusReport());
+                //it's optional
+                
+                //sub.getSubscriptionFilter().getGetAssertionStatusReport().setCompletionStatus(CompletionStatus.STATUS_COMPLETE);
+                Subscription subscriptionBiz = clerk.register(sub, clerk.getUDDINode().getApiNode());
+
+                System.out.println("Registered GetAssertionStatus subscription key: " + (subscriptionBiz.getSubscriptionKey()) + " bindingkey: " + subscriptionBiz.getBindingKey());
+
+                System.out.println("Waiting for callbacks. Now would be a good time to launch either another program or juddi-gui to make some changes. Press any key to stop!");
+                //Thread hook = new Thread(this);
+              //  Runtime.getRuntime().addShutdownHook(hook);
+                
+                        System.in.read();
+                
+                SubscriptionCallbackListener.stop(client, nodename, start.getBindingKey());
+                clerk.unRegisterSubscription(subscriptionBiz.getSubscriptionKey());
+
+                clerk.unRegisterTModel(createKeyGenator.getTModelKey());
+
+                clerk.unRegisterBusiness("uddi:somebusiness:somebusinesskey");
+
+                //Runtime.getRuntime().removeShutdownHook(hook);
+        }
+
+        private boolean running = true;
+        PrintUDDI<SubscriptionResultsList> p = new PrintUDDI<SubscriptionResultsList>();
+
+        @Override
+        public void HandleCallback(SubscriptionResultsList body) {
+                System.out.println("Callback received!");
+                System.out.println(p.print(body));
+        }
+
+        @Override
+        public void NotifyEndpointStopped() {
+                System.out.println("The endpoint was stopped!");
+        }
+
+        @Override
+        public void run() {
+                running = false;
+        }
+}

http://git-wip-us.apache.org/repos/asf/juddi/blob/9dafe4e8/juddi-client-cli/src/main/java/org/apache/juddi/v3/client/cli/UddiSubscribeValidate.java
----------------------------------------------------------------------
diff --git a/juddi-client-cli/src/main/java/org/apache/juddi/v3/client/cli/UddiSubscribeValidate.java b/juddi-client-cli/src/main/java/org/apache/juddi/v3/client/cli/UddiSubscribeValidate.java
new file mode 100644
index 0000000..5afb0e5
--- /dev/null
+++ b/juddi-client-cli/src/main/java/org/apache/juddi/v3/client/cli/UddiSubscribeValidate.java
@@ -0,0 +1,137 @@
+/*
+ * Copyright 2001-2013 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.
+ *
+ */
+package org.apache.juddi.v3.client.cli;
+
+import java.util.Calendar;
+import java.util.GregorianCalendar;
+import javax.xml.datatype.DatatypeFactory;
+import javax.xml.datatype.XMLGregorianCalendar;
+import org.apache.juddi.v3.client.config.UDDIClient;
+import org.apache.juddi.v3.client.transport.Transport;
+import org.apache.juddi.v3_service.JUDDIApiPortType;
+import org.uddi.api_v3.*;
+import org.uddi.sub_v3.CoveragePeriod;
+import org.uddi.sub_v3.GetSubscriptionResults;
+import org.uddi.sub_v3.SubscriptionResultsList;
+import org.uddi.v3_service.UDDIInquiryPortType;
+import org.uddi.v3_service.UDDIPublicationPortType;
+import org.uddi.v3_service.UDDISecurityPortType;
+import org.uddi.v3_service.UDDISubscriptionListenerPortType;
+import org.uddi.v3_service.UDDISubscriptionPortType;
+
+/**
+ * This class shows you how to get the results of an existing subscription in
+ * UDDI.
+ *
+ * @author <a href="mailto:alexoree@apache.org">Alex O'Ree</a>
+ */
+public class UddiSubscribeValidate {
+
+        private static UDDISecurityPortType security = null;
+        private static JUDDIApiPortType juddiApi = null;
+        private static UDDIPublicationPortType publish = null;
+        private static UDDIInquiryPortType uddiInquiryService = null;
+        private static UDDISubscriptionPortType uddiSubscriptionService = null;
+        private static UDDISubscriptionListenerPortType uddiSubscriptionListenerService = null;
+
+        public UddiSubscribeValidate() {
+                try {
+                        // create a manager and read the config in the archive; 
+                        // you can use your config file name
+                        UDDIClient clerkManager = new UDDIClient("META-INF/simple-publish-uddi.xml");
+                        Transport transport = clerkManager.getTransport();
+                        // Now you create a reference to the UDDI API
+                        security = transport.getUDDISecurityService();
+                        juddiApi = transport.getJUDDIApiService();
+                        publish = transport.getUDDIPublishService();
+                        uddiInquiryService = transport.getUDDIInquiryService();
+                        uddiSubscriptionService = transport.getUDDISubscriptionService();
+                        uddiSubscriptionListenerService = transport.getUDDISubscriptionListenerService();
+                } catch (Exception e) {
+                        e.printStackTrace();
+                }
+        }
+        
+          public UddiSubscribeValidate(Transport transport) {
+                try {
+                        // Now you create a reference to the UDDI API
+                        security = transport.getUDDISecurityService();
+                        juddiApi = transport.getJUDDIApiService();
+                        publish = transport.getUDDIPublishService();
+                        uddiInquiryService = transport.getUDDIInquiryService();
+                        uddiSubscriptionService = transport.getUDDISubscriptionService();
+                        uddiSubscriptionListenerService = transport.getUDDISubscriptionListenerService();
+                } catch (Exception e) {
+                        e.printStackTrace();
+                }
+        }
+
+        /**
+         * gets subscription results synchronously
+         *
+         * @param authtoken
+         * @param key
+         */
+        public void go(String authtoken, String key) {
+                if (key == null) {
+                        System.out.println("No key was specified!");
+                        return;
+                }
+                try {
+
+                        // Setting up the values to get an authentication token for the 'root' user ('root' user has admin privileges
+                        // and can save other publishers).
+                        if (authtoken == null) {
+                                GetAuthToken getAuthTokenRoot = new GetAuthToken();
+                                getAuthTokenRoot.setUserID("root");
+                                getAuthTokenRoot.setCred("root");
+
+                                // Making API call that retrieves the authentication token for the 'root' user.
+                                AuthToken rootAuthToken = security.getAuthToken(getAuthTokenRoot);
+                                System.out.println("root AUTHTOKEN = " + "don't log 'em");
+                                authtoken = rootAuthToken.getAuthInfo();
+                        }
+                        DatatypeFactory df = DatatypeFactory.newInstance();
+                        GregorianCalendar gcal = new GregorianCalendar();
+                        gcal.setTimeInMillis(System.currentTimeMillis());
+                        XMLGregorianCalendar xcal = df.newXMLGregorianCalendar(gcal);
+
+                        //
+                        GetSubscriptionResults req = new GetSubscriptionResults();
+                        req.setAuthInfo(authtoken);
+                        //TODO insert your subscription key values here
+                        req.setSubscriptionKey(key);
+                        req.setCoveragePeriod(new CoveragePeriod());
+                        req.getCoveragePeriod().setEndPoint(xcal);
+
+                        gcal = new GregorianCalendar();
+                        //Time range that we want change logs on
+                        gcal.add(Calendar.MONTH, -1);
+                        req.getCoveragePeriod().setStartPoint(df.newXMLGregorianCalendar(gcal));
+                        SubscriptionResultsList subscriptionResults = uddiSubscriptionService.getSubscriptionResults(req);
+                        System.out.println("items modified: " + subscriptionResults.getBusinessDetail().getBusinessEntity().size());
+
+                } catch (Exception e) {
+                        e.printStackTrace();
+                }
+        }
+
+        public static void main(String args[]) {
+                UddiSubscribeValidate sp = new UddiSubscribeValidate();
+                sp.go(null, null);
+        }
+}

http://git-wip-us.apache.org/repos/asf/juddi/blob/9dafe4e8/juddi-client-cli/src/main/java/org/apache/juddi/v3/client/cli/UddiSubscriptionManagement.java
----------------------------------------------------------------------
diff --git a/juddi-client-cli/src/main/java/org/apache/juddi/v3/client/cli/UddiSubscriptionManagement.java b/juddi-client-cli/src/main/java/org/apache/juddi/v3/client/cli/UddiSubscriptionManagement.java
new file mode 100644
index 0000000..6068c14
--- /dev/null
+++ b/juddi-client-cli/src/main/java/org/apache/juddi/v3/client/cli/UddiSubscriptionManagement.java
@@ -0,0 +1,149 @@
+/*
+ * Copyright 2014 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.
+ */
+package org.apache.juddi.v3.client.cli;
+
+import java.util.List;
+import javax.xml.datatype.DatatypeFactory;
+import org.apache.juddi.jaxb.PrintUDDI;
+import org.apache.juddi.v3.client.UDDIConstants;
+import org.apache.juddi.v3.client.config.UDDIClerk;
+import org.apache.juddi.v3.client.config.UDDIClient;
+import org.apache.juddi.v3.client.subscription.SubscriptionCallbackListener;
+import org.apache.juddi.v3.client.transport.Transport;
+import org.apache.juddi.v3_service.JUDDIApiPortType;
+import org.uddi.api_v3.BindingTemplate;
+import org.uddi.api_v3.BusinessEntity;
+import org.uddi.api_v3.BusinessService;
+import org.uddi.api_v3.BusinessServices;
+import org.uddi.api_v3.FindBusiness;
+import org.uddi.api_v3.FindQualifiers;
+import org.uddi.api_v3.FindService;
+import org.uddi.api_v3.FindTModel;
+import org.uddi.api_v3.Name;
+import org.uddi.api_v3.TModel;
+import org.uddi.sub_v3.DeleteSubscription;
+import org.uddi.sub_v3.Subscription;
+import org.uddi.sub_v3.SubscriptionFilter;
+import org.uddi.sub_v3.SubscriptionResultsList;
+import org.uddi.v3_service.UDDIInquiryPortType;
+import org.uddi.v3_service.UDDIPublicationPortType;
+import org.uddi.v3_service.UDDISecurityPortType;
+import org.uddi.v3_service.UDDISubscriptionPortType;
+
+/**
+ *
+ * @author Alex O'Ree
+ */
+public class UddiSubscriptionManagement {
+
+        private static UDDISecurityPortType security = null;
+
+        private static UDDIPublicationPortType publish = null;
+        private static UDDIInquiryPortType uddiInquiryService = null;
+        private static UDDISubscriptionPortType uddiSubscriptionService = null;
+
+        private UDDIClerk clerk = null;
+        private UDDIClient client = null;
+
+        public UddiSubscriptionManagement() {
+                try {
+                        // create a manager and read the config in the archive; 
+                        // you can use your config file name
+                        client = new UDDIClient("META-INF/simple-publish-uddi.xml");
+                        clerk = client.getClerk("default");
+                        Transport transport = client.getTransport();
+                        // Now you create a reference to the UDDI API
+                        security = transport.getUDDISecurityService();
+                        publish = transport.getUDDIPublishService();
+                        uddiInquiryService = transport.getUDDIInquiryService();
+                        uddiSubscriptionService = transport.getUDDISubscriptionService();
+                } catch (Exception e) {
+                        e.printStackTrace();
+                }
+        }
+        
+         public UddiSubscriptionManagement(Transport transport) {
+                try {
+                       
+                        // Now you create a reference to the UDDI API
+                        security = transport.getUDDISecurityService();
+                        publish = transport.getUDDIPublishService();
+                        uddiInquiryService = transport.getUDDIInquiryService();
+                        uddiSubscriptionService = transport.getUDDISubscriptionService();
+                } catch (Exception e) {
+                        e.printStackTrace();
+                }
+        }
+
+        public static void main(String args[]) throws Exception {
+                UddiSubscriptionManagement sp = new UddiSubscriptionManagement();
+                sp.PrintSubscriptions(null);
+        }
+
+        public void PrintSubscriptions(String authtoken) throws Exception {
+
+                if (authtoken == null) {
+                        authtoken = clerk.getAuthToken();
+                }
+                List<Subscription> subscriptions = uddiSubscriptionService.getSubscriptions(authtoken);
+                System.out.println(subscriptions.size() + " subscriptions found");
+                for (int i = 0; i < subscriptions.size(); i++) {
+                        System.out.println("_____________________________________");
+                        
+                        System.out.println(p.print(subscriptions.get(i)));
+                }
+        }
+
+        public void DeleteSubscription(String authtoken, String key) throws Exception {
+
+                if (authtoken == null) {
+                        authtoken = clerk.getAuthToken();
+                }
+                if (key == null) {
+                        System.out.println("No key specified!");
+                        return;
+                }
+                DeleteSubscription ds = new DeleteSubscription();
+                ds.setAuthInfo(authtoken);
+                ds.getSubscriptionKey().add(key);
+                uddiSubscriptionService.deleteSubscription(ds);
+                System.out.println("Deleted!");
+
+        }
+
+        public void DeleteAllSubscriptions(String authtoken) throws Exception {
+
+                if (authtoken == null) {
+                        authtoken = clerk.getAuthToken();
+                }
+                List<Subscription> subscriptions = uddiSubscriptionService.getSubscriptions(authtoken);
+                System.out.println(subscriptions.size() + " subscriptions found");
+                for (int i = 0; i < subscriptions.size(); i++) {
+                        System.out.println("_____________________________________");
+                        System.out.println(subscriptions.get(i).getSubscriptionKey());
+                        DeleteSubscription ds = new DeleteSubscription();
+                        ds.setAuthInfo(authtoken);
+                        ds.getSubscriptionKey().add(subscriptions.get(i).getSubscriptionKey());
+                        uddiSubscriptionService.deleteSubscription(ds);
+                        System.out.println("Deleted!");
+                }
+
+        }
+
+        private boolean running = true;
+        PrintUDDI<Subscription> p = new PrintUDDI<Subscription>();
+
+}


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


[3/5] juddi git commit: JUDDI-931 CLI client

Posted by al...@apache.org.
http://git-wip-us.apache.org/repos/asf/juddi/blob/9dafe4e8/juddi-client-cli/src/main/java/org/apache/juddi/v3/client/cli/SimpleBrowse.java
----------------------------------------------------------------------
diff --git a/juddi-client-cli/src/main/java/org/apache/juddi/v3/client/cli/SimpleBrowse.java b/juddi-client-cli/src/main/java/org/apache/juddi/v3/client/cli/SimpleBrowse.java
new file mode 100644
index 0000000..a933d56
--- /dev/null
+++ b/juddi-client-cli/src/main/java/org/apache/juddi/v3/client/cli/SimpleBrowse.java
@@ -0,0 +1,489 @@
+/*
+ * Copyright 2001-2010 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.
+ *
+ */
+package org.apache.juddi.v3.client.cli;
+
+import java.util.List;
+import javax.xml.bind.JAXB;
+import org.apache.juddi.api_v3.AccessPointType;
+import org.apache.juddi.v3.client.UDDIConstants;
+import org.apache.juddi.v3.client.config.UDDIClient;
+import org.apache.juddi.v3.client.transport.Transport;
+import org.uddi.api_v3.AuthToken;
+import org.uddi.api_v3.BindingTemplates;
+import org.uddi.api_v3.BusinessDetail;
+import org.uddi.api_v3.BusinessInfos;
+import org.uddi.api_v3.BusinessList;
+import org.uddi.api_v3.BusinessService;
+import org.uddi.api_v3.CategoryBag;
+import org.uddi.api_v3.Contacts;
+import org.uddi.api_v3.Description;
+import org.uddi.api_v3.DiscardAuthToken;
+import org.uddi.api_v3.FindBusiness;
+import org.uddi.api_v3.FindQualifiers;
+import org.uddi.api_v3.FindService;
+import org.uddi.api_v3.FindTModel;
+import org.uddi.api_v3.GetAuthToken;
+import org.uddi.api_v3.GetBusinessDetail;
+import org.uddi.api_v3.GetServiceDetail;
+import org.uddi.api_v3.KeyedReference;
+import org.uddi.api_v3.Name;
+import org.uddi.api_v3.ServiceDetail;
+import org.uddi.api_v3.ServiceInfos;
+import org.uddi.api_v3.ServiceList;
+import org.uddi.api_v3.TModelInfo;
+import org.uddi.api_v3.TModelInfos;
+import org.uddi.api_v3.TModelList;
+import org.uddi.v3_service.UDDIInquiryPortType;
+import org.uddi.v3_service.UDDISecurityPortType;
+
+/**
+ * A Simple UDDI Browser that dumps basic information to console
+ *
+ * @author <a href="mailto:alexoree@apache.org">Alex O'Ree</a>
+ */
+public class SimpleBrowse {
+
+        private  UDDISecurityPortType security = null;
+        private  UDDIInquiryPortType inquiry = null;
+
+        /**
+         * This sets up the ws proxies using uddi.xml in META-INF
+         */
+        public SimpleBrowse() {
+                try {
+                        // create a manager and read the config in the archive; 
+                        // you can use your config file name
+                        UDDIClient client = new UDDIClient("META-INF/simple-browse-uddi.xml");
+                        // 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");
+                        // Now you create a reference to the UDDI API
+                        security = transport.getUDDISecurityService();
+                        inquiry = transport.getUDDIInquiryService();
+                } catch (Exception e) {
+                        e.printStackTrace();
+                }
+        }
+
+        /**
+         * Main entry point
+         *
+         * @param args
+         */
+        public static void main(String args[]) {
+
+                SimpleBrowse sp = new SimpleBrowse();
+                sp.Browse(args);
+        }
+
+        public SimpleBrowse(Transport transport) {
+                try {
+
+                        // Now you create a reference to the UDDI API
+                        security = transport.getUDDISecurityService();
+                        inquiry = transport.getUDDIInquiryService();
+                } catch (Exception e) {
+                        e.printStackTrace();
+                }
+        }
+
+        public void Browse(String[] args) {
+                try {
+
+                        String token = GetAuthKey("uddi", "uddi");
+                        BusinessList findBusiness = GetBusinessList(token, null, 0, 100);
+                        PrintBusinessInfo(findBusiness.getBusinessInfos());
+                        PrintBusinessDetails(findBusiness.getBusinessInfos(), token);
+                        PrintServiceDetailsByBusiness(findBusiness.getBusinessInfos(), token);
+
+                        security.discardAuthToken(new DiscardAuthToken(token));
+
+                } catch (Exception e) {
+                        e.printStackTrace();
+                }
+        }
+
+        /**
+         * Find all of the registered businesses. This list may be filtered
+         * based on access control rules
+         *
+         * @param token
+         * @return
+         * @throws Exception
+         */
+        private BusinessList GetBusinessList(String token, String query, int offset, int maxrecords) throws Exception {
+                FindBusiness fb = new FindBusiness();
+                fb.setAuthInfo(token);
+                org.uddi.api_v3.FindQualifiers fq = new org.uddi.api_v3.FindQualifiers();
+                fq.getFindQualifier().add(UDDIConstants.APPROXIMATE_MATCH);
+
+                fb.setFindQualifiers(fq);
+                Name searchname = new Name();
+                if (query == null || query.equalsIgnoreCase("")) {
+                        searchname.setValue(UDDIConstants.WILDCARD);
+                } else {
+                        searchname.setValue(query);
+                }
+                fb.getName().add(searchname);
+                fb.setListHead(offset);
+                fb.setMaxRows(maxrecords);
+                BusinessList findBusiness = inquiry.findBusiness(fb);
+                return findBusiness;
+
+        }
+
+        /**
+         * Converts category bags of tmodels to a readable string
+         *
+         * @param categoryBag
+         * @return
+         */
+        private String CatBagToString(CategoryBag categoryBag) {
+                StringBuilder sb = new StringBuilder();
+                if (categoryBag == null) {
+                        return "no data";
+                }
+                for (int i = 0; i < categoryBag.getKeyedReference().size(); i++) {
+                        sb.append(KeyedReferenceToString(categoryBag.getKeyedReference().get(i)));
+                }
+                for (int i = 0; i < categoryBag.getKeyedReferenceGroup().size(); i++) {
+                        sb.append("Key Ref Grp: TModelKey=");
+                        for (int k = 0; k < categoryBag.getKeyedReferenceGroup().get(i).getKeyedReference().size(); k++) {
+                                sb.append(KeyedReferenceToString(categoryBag.getKeyedReferenceGroup().get(i).getKeyedReference().get(k)));
+                        }
+                }
+                return sb.toString();
+        }
+
+        private String KeyedReferenceToString(KeyedReference item) {
+                StringBuilder sb = new StringBuilder();
+                sb.append("Key Ref: Name=").
+                        append(item.getKeyName()).
+                        append(" Value=").
+                        append(item.getKeyValue()).
+                        append(" tModel=").
+                        append(item.getTModelKey()).
+                        append(System.getProperty("line.separator"));
+                return sb.toString();
+        }
+
+        private void PrintContacts(Contacts contacts) {
+                if (contacts == null) {
+                        return;
+                }
+                for (int i = 0; i < contacts.getContact().size(); i++) {
+                        System.out.println("Contact " + i + " type:" + contacts.getContact().get(i).getUseType());
+                        for (int k = 0; k < contacts.getContact().get(i).getPersonName().size(); k++) {
+                                System.out.println("Name: " + contacts.getContact().get(i).getPersonName().get(k).getValue());
+                        }
+                        for (int k = 0; k < contacts.getContact().get(i).getEmail().size(); k++) {
+                                System.out.println("Email: " + contacts.getContact().get(i).getEmail().get(k).getValue());
+                        }
+                        for (int k = 0; k < contacts.getContact().get(i).getAddress().size(); k++) {
+                                System.out.println("Address sort code " + contacts.getContact().get(i).getAddress().get(k).getSortCode());
+                                System.out.println("Address use type " + contacts.getContact().get(i).getAddress().get(k).getUseType());
+                                System.out.println("Address tmodel key " + contacts.getContact().get(i).getAddress().get(k).getTModelKey());
+                                for (int x = 0; x < contacts.getContact().get(i).getAddress().get(k).getAddressLine().size(); x++) {
+                                        System.out.println("Address line value " + contacts.getContact().get(i).getAddress().get(k).getAddressLine().get(x).getValue());
+                                        System.out.println("Address line key name " + contacts.getContact().get(i).getAddress().get(k).getAddressLine().get(x).getKeyName());
+                                        System.out.println("Address line key value " + contacts.getContact().get(i).getAddress().get(k).getAddressLine().get(x).getKeyValue());
+                                }
+                        }
+                        for (int k = 0; k < contacts.getContact().get(i).getDescription().size(); k++) {
+                                System.out.println("Desc: " + contacts.getContact().get(i).getDescription().get(k).getValue());
+                        }
+                        for (int k = 0; k < contacts.getContact().get(i).getPhone().size(); k++) {
+                                System.out.println("Phone: " + contacts.getContact().get(i).getPhone().get(k).getValue());
+                        }
+                }
+
+        }
+
+        private void PrintServiceDetail(BusinessService get) {
+                if (get == null) {
+                        return;
+                }
+                System.out.println("Name " + ListToString(get.getName()));
+                System.out.println("Desc " + ListToDescString(get.getDescription()));
+                System.out.println("Key " + (get.getServiceKey()));
+                System.out.println("Cat bag " + CatBagToString(get.getCategoryBag()));
+                if (!get.getSignature().isEmpty()) {
+                        System.out.println("Item is digitally signed");
+                } else {
+                        System.out.println("Item is not digitally signed");
+                }
+                PrintBindingTemplates(get.getBindingTemplates());
+        }
+
+        /**
+         * This function is useful for translating UDDI's somewhat complex data
+         * format to something that is more useful.
+         *
+         * @param bindingTemplates
+         */
+        private void PrintBindingTemplates(BindingTemplates bindingTemplates) {
+                if (bindingTemplates == null) {
+                        return;
+                }
+                for (int i = 0; i < bindingTemplates.getBindingTemplate().size(); i++) {
+                        System.out.println("Binding Key: " + bindingTemplates.getBindingTemplate().get(i).getBindingKey());
+                        //TODO The UDDI spec is kind of strange at this point.
+                        //An access point could be a URL, a reference to another UDDI binding key, a hosting redirector (which is 
+                        //esscentially a pointer to another UDDI registry) or a WSDL Deployment
+                        //From an end client's perspective, all you really want is the endpoint.
+                        //http://uddi.org/pubs/uddi_v3.htm#_Ref8977716
+                        //So if you have a wsdlDeployment useType, fetch the wsdl and parse for the invocation URL
+                        //If its hosting director, you'll have to fetch that data from uddi recursively until the leaf node is found
+                        //Consult the UDDI specification for more information
+
+                        if (bindingTemplates.getBindingTemplate().get(i).getAccessPoint() != null) {
+                                System.out.println("Access Point: " + bindingTemplates.getBindingTemplate().get(i).getAccessPoint().getValue() + " type " + bindingTemplates.getBindingTemplate().get(i).getAccessPoint().getUseType());
+                                if (bindingTemplates.getBindingTemplate().get(i).getAccessPoint().getUseType() != null) {
+                                        if (bindingTemplates.getBindingTemplate().get(i).getAccessPoint().getUseType().equalsIgnoreCase(AccessPointType.END_POINT.toString())) {
+                                                System.out.println("Use this access point value as an invocation endpoint.");
+                                        }
+                                        if (bindingTemplates.getBindingTemplate().get(i).getAccessPoint().getUseType().equalsIgnoreCase(AccessPointType.BINDING_TEMPLATE.toString())) {
+                                                System.out.println("Use this access point value as a reference to another binding template.");
+                                        }
+                                        if (bindingTemplates.getBindingTemplate().get(i).getAccessPoint().getUseType().equalsIgnoreCase(AccessPointType.WSDL_DEPLOYMENT.toString())) {
+                                                System.out.println("Use this access point value as a URL to a WSDL document, which presumably will have a real access point defined.");
+                                        }
+                                        if (bindingTemplates.getBindingTemplate().get(i).getAccessPoint().getUseType().equalsIgnoreCase(AccessPointType.HOSTING_REDIRECTOR.toString())) {
+                                                System.out.println("Use this access point value as an Inquiry URL of another UDDI registry, look up the same binding template there (usage varies).");
+                                        }
+                                }
+                        }
+
+                }
+        }
+
+        public void printBusinessList(String authtoken, String searchString, boolean rawXml) throws Exception {
+
+                int offset=0;
+                int maxrecords=100;
+                BusinessList findBusiness = GetBusinessList(authtoken, searchString, offset, maxrecords);
+                while (findBusiness != null && findBusiness.getBusinessInfos() != null
+                        && !findBusiness.getBusinessInfos().getBusinessInfo().isEmpty()) {
+                        if (rawXml) {
+                                JAXB.marshal(findBusiness, System.out);
+                        } else {
+                                PrintBusinessInfo(findBusiness.getBusinessInfos());
+                                PrintBusinessDetails(findBusiness.getBusinessInfos(), authtoken);
+                                PrintServiceDetailsByBusiness(findBusiness.getBusinessInfos(), authtoken);
+                        }
+                        offset = offset + maxrecords;
+                                
+                        findBusiness = GetBusinessList(authtoken, searchString, offset, maxrecords);
+                }
+        }
+        
+        
+        public void printServiceList(String authtoken, String searchString, boolean rawXml) throws Exception {
+
+                int offset=0;
+                int maxrecords=100;
+                ServiceList findBusiness = GetServiceList(authtoken, searchString, offset, maxrecords);
+                while (findBusiness != null && findBusiness.getServiceInfos()!= null
+                        && !findBusiness.getServiceInfos().getServiceInfo().isEmpty()) {
+                        if (rawXml) {
+                                JAXB.marshal(findBusiness, System.out);
+                        } else {
+                                PrintServiceInfo(findBusiness.getServiceInfos());
+                                //PrintBusinessDetails(findBusiness.getBusinessInfos(), authtoken);
+                                //PrintServiceDetailsByBusiness(findBusiness.getBusinessInfos(), authtoken);
+                        }
+                        offset = offset + maxrecords;
+                                
+                        findBusiness = GetServiceList(authtoken, searchString, offset, maxrecords);
+                }
+        }
+
+        private ServiceList GetServiceList(String authtoken, String searchString, int offset, int maxrecords) throws Exception {
+                FindService fs = new FindService();
+                fs.setAuthInfo(authtoken);
+                fs.setListHead(offset);
+                fs.setMaxRows(maxrecords);
+                if (searchString!=null)
+                {
+                        fs.getName().add(new Name("%" + searchString + " %", null));
+                        
+                }
+                else fs.getName().add(new Name(UDDIConstants.WILDCARD, null));
+                fs.setFindQualifiers(new FindQualifiers());
+                fs.getFindQualifiers().getFindQualifier().add(UDDIConstants.APPROXIMATE_MATCH);
+               return inquiry.findService(fs);
+        }
+
+        void printTModelList(String authtoken, String searchString, boolean rawXml) throws Exception{
+                  int offset=0;
+                int maxrecords=100;
+                TModelList findBusiness = GetTmodelList(authtoken, searchString, offset, maxrecords);
+                while (findBusiness != null && findBusiness.getTModelInfos()!= null
+                        && !findBusiness.getTModelInfos().getTModelInfo().isEmpty()) {
+                        if (rawXml) {
+                                JAXB.marshal(findBusiness, System.out);
+                        } else {
+                                PrintTModelInfo(findBusiness.getTModelInfos());
+                                //PrintBusinessDetails(findBusiness.getBusinessInfos(), authtoken);
+                                //PrintServiceDetailsByBusiness(findBusiness.getBusinessInfos(), authtoken);
+                        }
+                        offset = offset + maxrecords;
+                                
+                        findBusiness = GetTmodelList(authtoken, searchString, offset, maxrecords);
+                }
+        }
+
+        private void PrintTModelInfo(TModelInfos tModelInfos) {
+                if (tModelInfos==null){
+                        System.out.println("No data returned");
+                        return;
+                }
+                for (TModelInfo tModelInfo : tModelInfos.getTModelInfo()) {
+                        System.out.println("tModel key: " + tModelInfo.getTModelKey());
+                        System.out.println("tModel name: " + tModelInfo.getName().getLang() + " " + tModelInfo.getName().getValue());
+                       // PrintServiceInfo(null);
+                         for (int k = 0; k < tModelInfo.getDescription().size(); k++) {
+                                System.out.println("Desc: " + tModelInfo.getDescription().get(k).getValue());
+                        }
+                }
+        }
+
+        private TModelList GetTmodelList(String authtoken, String searchString, int offset, int maxrecords) throws Exception {
+                 FindTModel fs = new FindTModel();
+                fs.setAuthInfo(authtoken);
+                fs.setListHead(offset);
+                fs.setMaxRows(maxrecords);
+                if (searchString!=null)
+                {
+                        fs.setName(new Name("%" + searchString + " %", null));
+                        
+                }
+                else fs.setName(new Name(UDDIConstants.WILDCARD, null));
+                fs.setFindQualifiers(new FindQualifiers());
+                fs.getFindQualifiers().getFindQualifier().add(UDDIConstants.APPROXIMATE_MATCH);
+               return inquiry.findTModel(fs);
+        }
+
+        private enum AuthStyle {
+
+                HTTP_BASIC,
+                HTTP_DIGEST,
+                HTTP_NTLM,
+                UDDI_AUTH,
+                HTTP_CLIENT_CERT
+        }
+
+        /**
+         * Gets a UDDI style auth token, otherwise, appends credentials to the
+         * ws proxies (not yet implemented)
+         *
+         * @param username
+         * @param password
+         * @param style
+         * @return
+         */
+        private String GetAuthKey(String username, String password) {
+                try {
+
+                        GetAuthToken getAuthTokenRoot = new GetAuthToken();
+                        getAuthTokenRoot.setUserID(username);
+                        getAuthTokenRoot.setCred(password);
+
+                        // Making API call that retrieves the authentication token for the user.
+                        AuthToken rootAuthToken = security.getAuthToken(getAuthTokenRoot);
+                        System.out.println(username + " AUTHTOKEN = (don't log auth tokens!");
+                        return rootAuthToken.getAuthInfo();
+                } catch (Exception ex) {
+                        System.out.println("Could not authenticate with the provided credentials " + ex.getMessage());
+                }
+                return null;
+        }
+
+        private void PrintBusinessInfo(BusinessInfos businessInfos) {
+                if (businessInfos == null) {
+                        System.out.println("No data returned");
+                } else {
+                        for (int i = 0; i < businessInfos.getBusinessInfo().size(); i++) {
+                                System.out.println("===============================================");
+                                System.out.println("Business Key: " + businessInfos.getBusinessInfo().get(i).getBusinessKey());
+                                System.out.println("Name: " + ListToString(businessInfos.getBusinessInfo().get(i).getName()));
+
+                                System.out.println("Description: " + ListToDescString(businessInfos.getBusinessInfo().get(i).getDescription()));
+                                System.out.println("Services:");
+                                PrintServiceInfo(businessInfos.getBusinessInfo().get(i).getServiceInfos());
+                        }
+                }
+        }
+
+        private String ListToString(List<Name> name) {
+                StringBuilder sb = new StringBuilder();
+                for (int i = 0; i < name.size(); i++) {
+                        sb.append(name.get(i).getValue()).append(" ");
+                }
+                return sb.toString();
+        }
+
+        private String ListToDescString(List<Description> name) {
+                StringBuilder sb = new StringBuilder();
+                for (int i = 0; i < name.size(); i++) {
+                        sb.append(name.get(i).getValue()).append(" ");
+                }
+                return sb.toString();
+        }
+
+        private void PrintServiceInfo(ServiceInfos serviceInfos) {
+                for (int i = 0; i < serviceInfos.getServiceInfo().size(); i++) {
+                        System.out.println("-------------------------------------------");
+                        System.out.println("Service Key: " + serviceInfos.getServiceInfo().get(i).getServiceKey());
+                        System.out.println("Owning Business Key: " + serviceInfos.getServiceInfo().get(i).getBusinessKey());
+                        System.out.println("Name: " + ListToString(serviceInfos.getServiceInfo().get(i).getName()));
+                }
+        }
+
+        private void PrintBusinessDetails(BusinessInfos businessInfos, String token) throws Exception {
+                GetBusinessDetail gbd = new GetBusinessDetail();
+                gbd.setAuthInfo(token);
+                for (int i = 0; i < businessInfos.getBusinessInfo().size(); i++) {
+                        gbd.getBusinessKey().add(businessInfos.getBusinessInfo().get(i).getBusinessKey());
+                }
+                BusinessDetail businessDetail = inquiry.getBusinessDetail(gbd);
+                for (int i = 0; i < businessDetail.getBusinessEntity().size(); i++) {
+                        System.out.println("Business Detail - key: " + businessDetail.getBusinessEntity().get(i).getBusinessKey());
+                        System.out.println("Name: " + ListToString(businessDetail.getBusinessEntity().get(i).getName()));
+                        System.out.println("CategoryBag: " + CatBagToString(businessDetail.getBusinessEntity().get(i).getCategoryBag()));
+                        PrintContacts(businessDetail.getBusinessEntity().get(i).getContacts());
+                }
+        }
+
+        private void PrintServiceDetailsByBusiness(BusinessInfos businessInfos, String token) throws Exception {
+                for (int i = 0; i < businessInfos.getBusinessInfo().size(); i++) {
+                        GetServiceDetail gsd = new GetServiceDetail();
+                        for (int k = 0; k < businessInfos.getBusinessInfo().get(i).getServiceInfos().getServiceInfo().size(); k++) {
+                                gsd.getServiceKey().add(businessInfos.getBusinessInfo().get(i).getServiceInfos().getServiceInfo().get(k).getServiceKey());
+                        }
+                        gsd.setAuthInfo(token);
+                        System.out.println("Fetching data for business " + businessInfos.getBusinessInfo().get(i).getBusinessKey());
+                        ServiceDetail serviceDetail = inquiry.getServiceDetail(gsd);
+                        for (int k = 0; k < serviceDetail.getBusinessService().size(); k++) {
+                                PrintServiceDetail(serviceDetail.getBusinessService().get(k));
+                        }
+                        System.out.println("................");
+
+                }
+        }
+}

http://git-wip-us.apache.org/repos/asf/juddi/blob/9dafe4e8/juddi-client-cli/src/main/java/org/apache/juddi/v3/client/cli/UddiCreatebulk.java
----------------------------------------------------------------------
diff --git a/juddi-client-cli/src/main/java/org/apache/juddi/v3/client/cli/UddiCreatebulk.java b/juddi-client-cli/src/main/java/org/apache/juddi/v3/client/cli/UddiCreatebulk.java
new file mode 100644
index 0000000..e97644c
--- /dev/null
+++ b/juddi-client-cli/src/main/java/org/apache/juddi/v3/client/cli/UddiCreatebulk.java
@@ -0,0 +1,210 @@
+/*
+ * Copyright 2001-2013 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.
+ *
+ */
+package org.apache.juddi.v3.client.cli;
+
+import de.svenjacobs.loremipsum.LoremIpsum;
+import java.util.GregorianCalendar;
+import javax.xml.datatype.DatatypeFactory;
+import javax.xml.datatype.XMLGregorianCalendar;
+import org.apache.juddi.api_v3.AccessPointType;
+import org.apache.juddi.v3.client.UDDIConstants;
+import org.apache.juddi.v3.client.config.UDDIClient;
+import org.apache.juddi.v3.client.transport.Transport;
+import org.uddi.api_v3.*;
+import org.uddi.v3_service.UDDIPublicationPortType;
+import org.uddi.v3_service.UDDISecurityPortType;
+
+/**
+ * This class was used to identify performance issues when a given node has a
+ * large number of UDDI entities. It may not work on some commercial UDDI nodes
+ * due to licensing restrictions (some limit the number of business, services,
+ * etc)
+ *
+ * @author <a href="mailto:alexoree@apache.org">Alex O'Ree</a>
+ */
+public class UddiCreatebulk {
+
+        private static UDDISecurityPortType security = null;
+        private static UDDIPublicationPortType publish = null;
+        String curretNode = null;
+        public UddiCreatebulk(String node) {
+                try {
+                        // create a manager and read the config in the archive; 
+                        // you can use your config file name
+                        UDDIClient clerkManager = new UDDIClient("META-INF/simple-publish-uddi.xml");
+                        Transport transport = clerkManager.getTransport(node);
+                        curretNode=node;
+                        // Now you create a reference to the UDDI API
+                        security = transport.getUDDISecurityService();
+                        publish = transport.getUDDIPublishService();
+                } catch (Exception e) {
+                        e.printStackTrace();
+                }
+        }
+        
+        public UddiCreatebulk(Transport transport, boolean notused, String node) {
+                try {
+                       curretNode=node;
+                        security = transport.getUDDISecurityService();
+                        publish = transport.getUDDIPublishService();
+                } catch (Exception e) {
+                        e.printStackTrace();
+                }
+        }
+
+        /**
+         * bulk creates businesses, services and binding templates
+         * @param token if null, root/root will be used to authenticate
+         * @param businesses
+         * @param servicesPerBusiness
+         * @param user purely for display purposes
+         */
+        public void publishBusiness(String token, int businesses, int servicesPerBusiness, String user) {
+                try {
+                        // Setting up the values to get an authentication token for the 'root' user ('root' user has admin privileges
+                        // and can save other publishers).
+                        if (token == null) {
+                                GetAuthToken getAuthTokenRoot = new GetAuthToken();
+                                getAuthTokenRoot.setUserID("root");
+                                getAuthTokenRoot.setCred("root");
+
+                                // Making API call that retrieves the authentication token for the 'root' user.
+                                AuthToken rootAuthToken = security.getAuthToken(getAuthTokenRoot);
+                                System.out.println("root AUTHTOKEN = " + "don't log auth tokens!");
+                                token = rootAuthToken.getAuthInfo();
+                        }
+
+                        LoremIpsum textgen = new LoremIpsum();
+                        DatatypeFactory df = DatatypeFactory.newInstance();
+                        GregorianCalendar gcal = new GregorianCalendar();
+                        gcal.setTimeInMillis(System.currentTimeMillis());
+                        XMLGregorianCalendar xcal = df.newXMLGregorianCalendar(gcal);
+                        for (int i = 0; i < businesses; i++) {
+                                // Creating the parent business entity that will contain our service.
+                                BusinessEntity myBusEntity = new BusinessEntity();
+                                Name myBusName = new Name();
+                                myBusName.setLang("en");
+                                myBusName.setValue(user + "'s Business " +curretNode +" " + i + " " + xcal.toString() + " " + textgen.getWords(5, 2) );
+                                myBusEntity.getDescription().add(new Description( textgen.getWords(10, 2), null));
+                                myBusEntity.getName().add(myBusName);
+
+                                // Adding the business entity to the "save" structure, using our publisher's authentication info and saving away.
+                                SaveBusiness sb = new SaveBusiness();
+                                sb.getBusinessEntity().add(myBusEntity);
+                                sb.setAuthInfo(token);
+                                BusinessDetail bd = publish.saveBusiness(sb);
+                                String myBusKey = bd.getBusinessEntity().get(0).getBusinessKey();
+                                System.out.println("saved: Business key:  " + myBusKey);
+                                for (int k = 0; k < servicesPerBusiness; k++) {
+                                        // Creating a service to save.  Only adding the minimum data: the parent business key retrieved from saving the business 
+                                        // above and a single name.
+                                        BusinessService myService = new BusinessService();
+                                        myService.setBusinessKey(myBusKey);
+                                        Name myServName = new Name();
+                                        myServName.setLang("en");
+                                        myServName.setValue(user + "'s Service " +curretNode+" "+ i + " " + k + " " + xcal.toString()+ " " + textgen.getWords(5, 2) );
+                                        myService.getName().add(myServName);
+                                        myService.getDescription().add(new Description( textgen.getWords(10, 2), null));
+                                        
+                                        // Add binding templates, etc...
+                                        BindingTemplate myBindingTemplate = new BindingTemplate();
+                                        myBindingTemplate.setCategoryBag(new CategoryBag());
+                                        KeyedReference kr = new KeyedReference();
+                                        kr.setTModelKey(UDDIConstants.TRANSPORT_HTTP);
+                                        kr.setKeyName("keyname1");
+                                        kr.setKeyValue("myvalue1");
+
+                                        myBindingTemplate.getCategoryBag().getKeyedReference().add(kr);
+
+                                        KeyedReferenceGroup krg = new KeyedReferenceGroup();
+                                        krg.setTModelKey(UDDIConstants.TRANSPORT_HTTP);
+                                        kr = new KeyedReference();
+                                        kr.setTModelKey(UDDIConstants.PROTOCOL_SSLv3);
+                                        kr.setKeyName("keyname1grp");
+                                        kr.setKeyValue("myvalue1grp");
+
+                                        krg.getKeyedReference().add(kr);
+                                        myBindingTemplate.getCategoryBag().getKeyedReferenceGroup().add(krg);
+
+                                        myService.setCategoryBag(new CategoryBag());
+
+                                        kr = new KeyedReference();
+                                        kr.setTModelKey(UDDIConstants.TRANSPORT_HTTP);
+                                        kr.setKeyName("Servicekeyname2grp");
+                                        kr.setKeyValue("Servicemyvalue2grp");
+                                        myService.getCategoryBag().getKeyedReference().add(kr);
+
+                                        krg = new KeyedReferenceGroup();
+                                        krg.setTModelKey(UDDIConstants.TRANSPORT_HTTP);
+                                        kr = new KeyedReference();
+                                        kr.setTModelKey(UDDIConstants.TRANSPORT_HTTP);
+                                        kr.setKeyName("keyname1grp");
+                                        kr.setKeyValue("myvalue1grp");
+
+                                        krg.getKeyedReference().add(kr);
+                                        myService.getCategoryBag().getKeyedReferenceGroup().add(krg);
+
+                                        AccessPoint accessPoint = new AccessPoint();
+                                        accessPoint.setUseType(AccessPointType.WSDL_DEPLOYMENT.toString());
+                                        accessPoint.setValue("http://example.org/services/myservice" + i + k + "?wsdl");
+                                        myBindingTemplate.setAccessPoint(accessPoint);
+                                        myBindingTemplate.setTModelInstanceDetails(new TModelInstanceDetails());
+                                        TModelInstanceInfo tii = new TModelInstanceInfo();
+                                        Description d = new Description();
+                                        d.setValue("Tmodel instance description");
+                                        tii.getDescription().add(d);
+                                        tii.setTModelKey(UDDIConstants.TRANSPORT_HTTP);
+                                        tii.setInstanceDetails(new InstanceDetails());
+                                        tii.getInstanceDetails().setInstanceParms("heres some useful stuff describing this endpoint, up to 4KB of data"+ " " + textgen.getWords(20, 2) );
+                                        tii.getInstanceDetails().getDescription().add(d);
+                                        OverviewDoc od = new OverviewDoc();
+                                        d = new Description();
+                                        d.setValue("ovweview doc description"+ " " + textgen.getWords(5, 2) );
+                                        od.getDescription().add(d);
+                                        od.setOverviewURL(new OverviewURL());
+                                        od.getOverviewURL().setUseType("www");
+                                        od.getOverviewURL().setValue("www.apache.org");
+                                        tii.getInstanceDetails().getOverviewDoc().add(od);
+                                        myBindingTemplate.getTModelInstanceDetails().getTModelInstanceInfo().add(tii);
+
+                                        BindingTemplates myBindingTemplates = new BindingTemplates();
+                                        myBindingTemplate = UDDIClient.addSOAPtModels(myBindingTemplate);
+                                        myBindingTemplates.getBindingTemplate().add(myBindingTemplate);
+                                        myService.setBindingTemplates(myBindingTemplates);
+                                        try {
+                                                // Adding the service to the "save" structure, using our publisher's authentication info and saving away.
+                                                SaveService ss = new SaveService();
+                                                ss.getBusinessService().add(myService);
+                                                ss.setAuthInfo(token);
+                                                ServiceDetail sd = publish.saveService(ss);
+                                                String myServKey = sd.getBusinessService().get(0).getServiceKey();
+                                                System.out.println("saved: service key:  " + myServKey);
+                                        } catch (Exception x) {
+                                                x.printStackTrace();
+                                        }
+                                }
+                        }
+                } catch (Exception e) {
+                        e.printStackTrace();
+                }
+        }
+
+        public static void main(String args[]) {
+                UddiCreatebulk sp = new UddiCreatebulk(null);
+                sp.publishBusiness(null, 15, 20, "root");
+        }
+}

http://git-wip-us.apache.org/repos/asf/juddi/blob/9dafe4e8/juddi-client-cli/src/main/java/org/apache/juddi/v3/client/cli/UddiCustodyTransfer.java
----------------------------------------------------------------------
diff --git a/juddi-client-cli/src/main/java/org/apache/juddi/v3/client/cli/UddiCustodyTransfer.java b/juddi-client-cli/src/main/java/org/apache/juddi/v3/client/cli/UddiCustodyTransfer.java
new file mode 100644
index 0000000..e77c6ea
--- /dev/null
+++ b/juddi-client-cli/src/main/java/org/apache/juddi/v3/client/cli/UddiCustodyTransfer.java
@@ -0,0 +1,166 @@
+/*
+ * Copyright 2001-2013 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.
+ *
+ */
+package org.apache.juddi.v3.client.cli;
+
+import java.util.GregorianCalendar;
+import javax.xml.datatype.DatatypeFactory;
+import javax.xml.datatype.XMLGregorianCalendar;
+import javax.xml.ws.Holder;
+import org.apache.juddi.v3.client.config.UDDIClient;
+import org.apache.juddi.v3.client.transport.Transport;
+import org.uddi.api_v3.*;
+import org.uddi.custody_v3.KeyBag;
+import org.uddi.custody_v3.TransferEntities;
+import org.uddi.custody_v3.TransferToken;
+import org.uddi.v3_service.UDDICustodyTransferPortType;
+import org.uddi.v3_service.UDDIInquiryPortType;
+import org.uddi.v3_service.UDDIPublicationPortType;
+import org.uddi.v3_service.UDDISecurityPortType;
+
+/**
+ * This provides an example of how to transfer custody of a business from one
+ * user to another on the same UDDI node. All child objects are also transfer
+ *
+ * @author <a href="mailto:alexoree@apache.org">Alex O'Ree</a>
+ */
+public class UddiCustodyTransfer {
+
+        private static UDDISecurityPortType security = null;
+        private static UDDIPublicationPortType publish = null;
+        private static UDDIInquiryPortType uddiInquiryService = null;
+        private static UDDICustodyTransferPortType custodyTransferPortType = null;
+
+        public UddiCustodyTransfer() {
+                try {
+                        // create a manager and read the config in the archive; 
+                        // you can use your config file name
+                        UDDIClient clerkManager = new UDDIClient("META-INF/simple-publish-uddi.xml");
+                        Transport transport = clerkManager.getTransport();
+                        // Now you create a reference to the UDDI API
+                        security = transport.getUDDISecurityService();
+
+                        publish = transport.getUDDIPublishService();
+                        uddiInquiryService = transport.getUDDIInquiryService();
+                        custodyTransferPortType = transport.getUDDICustodyTransferService();
+                } catch (Exception e) {
+                        e.printStackTrace();
+                }
+        }
+
+        public static void main(String args[]) throws Exception {
+                UddiCustodyTransfer sp = new UddiCustodyTransfer();
+
+                GetAuthToken getAuthTokenRoot = new GetAuthToken();
+                getAuthTokenRoot.setUserID("root");
+                getAuthTokenRoot.setCred("root");
+
+                // Making API call that retrieves the authentication token for the 'root' user.
+                AuthToken rootAuthToken = security.getAuthToken(getAuthTokenRoot);
+                System.out.println("root AUTHTOKEN = " + "don't log auth tokens!");
+
+                getAuthTokenRoot = new GetAuthToken();
+                getAuthTokenRoot.setUserID("uddi");
+                getAuthTokenRoot.setCred("uddi");
+
+                // Making API call that retrieves the authentication token for the 'root' user.
+                AuthToken uddiAuthToken = security.getAuthToken(getAuthTokenRoot);
+                System.out.println("uddi AUTHTOKEN = " + "don't log auth tokens!");
+                BusinessEntity biz = sp.CreateBusiness("uddi");
+
+                //save user uddi's business
+                SaveBusiness sb = new SaveBusiness();
+                sb.setAuthInfo(uddiAuthToken.getAuthInfo());
+                sb.getBusinessEntity().add(biz);
+                BusinessDetail saveBusiness = publish.saveBusiness(sb);
+
+                sp.TransferBusiness(uddiAuthToken.getAuthInfo(), "uddi", rootAuthToken.getAuthInfo(), "root", saveBusiness.getBusinessEntity().get(0).getBusinessKey());
+        }
+
+        public void TransferBusiness(String fromUser, String fromUserAuthToken, String toUser, String toUserAuthToken,
+                String BusinessKey) throws Exception {
+
+                System.out.println("Transfering business key " + BusinessKey);
+                DatatypeFactory df = DatatypeFactory.newInstance();
+                GregorianCalendar gcal = new GregorianCalendar();
+                gcal.setTimeInMillis(System.currentTimeMillis());
+                XMLGregorianCalendar xcal = df.newXMLGregorianCalendar(gcal);
+
+                //Create a transfer token from fromUser to toUser
+                KeyBag kb = new KeyBag();
+                kb.getKey().add(BusinessKey);
+                Holder<String> nodeidOUT = new Holder<String>();
+                Holder<XMLGregorianCalendar> expiresOUT = new Holder<XMLGregorianCalendar>();
+                Holder<byte[]> tokenOUT = new Holder<byte[]>();
+                custodyTransferPortType.getTransferToken(fromUserAuthToken, kb, nodeidOUT, expiresOUT, tokenOUT);
+
+                System.out.println("Transfer token obtained. Give this to user " + toUser);
+                System.out.println("Expires " + expiresOUT.value.toXMLFormat());
+                System.out.println("Node " + nodeidOUT.value);
+                System.out.println("Token " + org.apache.commons.codec.binary.Base64.encodeBase64String(tokenOUT.value));
+
+                if (toUser == null || toUser.length() == 0 || toUserAuthToken == null || toUserAuthToken.length() == 0) {
+                        System.out.println("The toUser parameters are either null or empty, I can't complete the transfer here");
+                        return;
+                }
+
+                //The magic part happens here, the user ROOT needs to give the user UDDI the token information out of band
+                //in practice, all values must match exactly
+                //UDDI now accepts the transfer
+                TransferEntities te = new TransferEntities();
+                te.setAuthInfo(toUserAuthToken);
+                te.setKeyBag(kb);
+                TransferToken tt = new TransferToken();
+                tt.setExpirationTime(expiresOUT.value);
+                tt.setNodeID(nodeidOUT.value);
+                tt.setOpaqueToken(tokenOUT.value);
+                te.setTransferToken(tt);
+                System.out.println("Excuting transfer...");
+                custodyTransferPortType.transferEntities(te);
+                System.out.println("Complete! verifing ownership change...");
+
+                //confirm the transfer
+                GetOperationalInfo go = new GetOperationalInfo();
+                go.setAuthInfo(fromUserAuthToken);
+                go.getEntityKey().add(BusinessKey);
+                OperationalInfos operationalInfo = uddiInquiryService.getOperationalInfo(go);
+                boolean ok = false;
+                boolean found = false;
+                for (int i = 0; i < operationalInfo.getOperationalInfo().size(); i++) {
+                        if (operationalInfo.getOperationalInfo().get(i).getEntityKey().equalsIgnoreCase(BusinessKey)) {
+                                found = true;
+                                if (operationalInfo.getOperationalInfo().get(i).getAuthorizedName().equalsIgnoreCase(fromUser)) {
+                                        System.out.println("Transfer unexpected failed");
+                                }
+                                if (operationalInfo.getOperationalInfo().get(i).getAuthorizedName().equalsIgnoreCase(toUser)) {
+                                        ok = true;
+                                }
+
+                        }
+                }
+                if (!found) {
+                        System.out.println("Could get the operational info the transfed business");
+                }
+                System.out.println("Transfer " + (ok ? "success" : " failed"));
+        }
+
+        private BusinessEntity CreateBusiness(String user) {
+                BusinessEntity be = new BusinessEntity();
+                be.getName().add(new Name(user + "'s business", null));
+                return be;
+        }
+
+}

http://git-wip-us.apache.org/repos/asf/juddi/blob/9dafe4e8/juddi-client-cli/src/main/java/org/apache/juddi/v3/client/cli/UddiDigitalSignatureBusiness.java
----------------------------------------------------------------------
diff --git a/juddi-client-cli/src/main/java/org/apache/juddi/v3/client/cli/UddiDigitalSignatureBusiness.java b/juddi-client-cli/src/main/java/org/apache/juddi/v3/client/cli/UddiDigitalSignatureBusiness.java
new file mode 100644
index 0000000..b6829a4
--- /dev/null
+++ b/juddi-client-cli/src/main/java/org/apache/juddi/v3/client/cli/UddiDigitalSignatureBusiness.java
@@ -0,0 +1,196 @@
+/*
+ * Copyright 2001-2013 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.
+ *
+ */
+package org.apache.juddi.v3.client.cli;
+
+import java.util.concurrent.atomic.AtomicReference;
+
+import org.apache.juddi.v3.client.config.UDDIClient;
+import org.apache.juddi.v3.client.config.UDDIClientContainer;
+import org.apache.juddi.v3.client.cryptor.DigSigUtil;
+import org.apache.juddi.v3.client.transport.Transport;
+import org.uddi.api_v3.*;
+import org.uddi.v3_service.UDDIInquiryPortType;
+import org.uddi.v3_service.UDDIPublicationPortType;
+import org.uddi.v3_service.UDDISecurityPortType;
+
+/**
+ * This class shows you how to digital sign a business
+ *
+ * @author <a href="mailto:alexoree@apache.org">Alex O'Ree</a>
+ */
+public class UddiDigitalSignatureBusiness {
+
+        private static UDDISecurityPortType security = null;
+        private static UDDIInquiryPortType inquiry = null;
+        private static UDDIPublicationPortType publish = null;
+        private static UDDIClient clerkManager = null;
+
+        /**
+         * This sets up the ws proxies using uddi.xml in META-INF
+         */
+        public UddiDigitalSignatureBusiness() {
+                try {
+                        // create a manager and read the config in the archive; 
+                        // you can use your config file name
+                        clerkManager = new UDDIClient("META-INF/simple-publish-uddi.xml");
+                        Transport transport = clerkManager.getTransport();
+                        // Now you create a reference to the UDDI API
+                        security = transport.getUDDISecurityService();
+                        inquiry = transport.getUDDIInquiryService();
+                        publish = transport.getUDDIPublishService();
+                } catch (Exception e) {
+                        e.printStackTrace();
+                }
+        }
+        
+        public UddiDigitalSignatureBusiness(Transport transport) {
+                try {
+                       
+                        // Now you create a reference to the UDDI API
+                        security = transport.getUDDISecurityService();
+                        inquiry = transport.getUDDIInquiryService();
+                        publish = transport.getUDDIPublishService();
+                } catch (Exception e) {
+                        e.printStackTrace();
+                }
+        }
+
+        /**
+         * Main entry point
+         *
+         * @param args
+         */
+        public static void main(String args[]) {
+
+                UddiDigitalSignatureBusiness sp = new UddiDigitalSignatureBusiness();
+                sp.Fire(null, null);
+        }
+
+        public void Fire(String token, String key) {
+                try {
+
+                        DigSigUtil ds = null;
+
+                        //option 1), set everything manually
+                        ds = new DigSigUtil();
+                        ds.put(DigSigUtil.SIGNATURE_KEYSTORE_FILE, "keystore.jks");
+                        ds.put(DigSigUtil.SIGNATURE_KEYSTORE_FILETYPE, "JKS");
+                        ds.put(DigSigUtil.SIGNATURE_KEYSTORE_FILE_PASSWORD, "Test");
+                        ds.put(DigSigUtil.SIGNATURE_KEYSTORE_KEY_ALIAS, "Test");
+                        ds.put(DigSigUtil.SIGNATURE_OPTION_CERT_INCLUSION_BASE64, "true");
+
+                        ds.put(DigSigUtil.SIGNATURE_OPTION_CERT_INCLUSION_SERIAL, "true");
+                        ds.put(DigSigUtil.SIGNATURE_OPTION_CERT_INCLUSION_SUBJECTDN, "true");
+                        ds.put(DigSigUtil.TRUSTSTORE_FILE, "truststore.jks");
+                        ds.put(DigSigUtil.TRUSTSTORE_FILETYPE, "JKS");
+                        ds.put(DigSigUtil.TRUSTSTORE_FILE_PASSWORD, "Test");
+
+                        //option 2), load it from the juddi config file
+                        //ds = new DigSigUtil(clerkManager.getClientConfig().getDigitalSignatureConfiguration());
+                        //login
+                        if (token == null) //option, load from juddi config
+                        {
+                                token = GetAuthKey(clerkManager.getClerk("default").getPublisher(),
+                                        clerkManager.getClerk("default").getPassword());
+                        }
+
+                        if (key == null) {
+                                //make a new business
+                                SaveBusiness sb = new SaveBusiness();
+                                sb.setAuthInfo(token);
+                                BusinessEntity ob = new BusinessEntity();
+                                Name name = new Name();
+                                name.setValue("My Signed Business");
+                                ob.getName().add(name);
+                                sb.getBusinessEntity().add(ob);
+                                //save it
+                                BusinessDetail saveBusiness = publish.saveBusiness(sb);
+
+                                System.out.println("business created with key " + saveBusiness.getBusinessEntity().get(0).getBusinessKey());
+
+                                BusinessEntity be = saveBusiness.getBusinessEntity().get(0);
+                                key = be.getBusinessKey();
+                        }
+                        BusinessEntity be = clerkManager.getClerk("default").getBusinessDetail(key);
+                        //sign the copy returned from the UDDI node (it may have made changes)
+                        DigSigUtil.JAXB_ToStdOut(be);
+                        if (!be.getSignature().isEmpty())
+                        {
+                                System.out.println("WARN, the entity with the key " + key + " is already signed! aborting");
+                                return;
+                        }
+
+                        //if it's already signed, remove all existing signatures
+                        
+                        System.out.println("signing");
+                        BusinessEntity signUDDI_JAXBObject = ds.signUddiEntity(be);
+                        DigSigUtil.JAXB_ToStdOut(signUDDI_JAXBObject);
+                        System.out.println("signed, saving");
+
+                        SaveBusiness sb = new SaveBusiness();
+                        sb.setAuthInfo(token);
+                        sb.getBusinessEntity().add(signUDDI_JAXBObject);
+                        publish.saveBusiness(sb);
+                        System.out.println("saved, fetching");
+
+                        //validate it again from the server, confirming that it was transformed correctly
+                        GetBusinessDetail gb = new GetBusinessDetail();
+                        gb.setAuthInfo(token);
+                        gb.getBusinessKey().add(be.getBusinessKey());
+                        be = inquiry.getBusinessDetail(gb).getBusinessEntity().get(0);
+                        DigSigUtil.JAXB_ToStdOut(be);
+                        System.out.println("verifing");
+                        AtomicReference<String> msg = new AtomicReference<String>();
+                        boolean verifySigned_UDDI_JAXB_Object = ds.verifySignedUddiEntity(be, msg);
+                        if (verifySigned_UDDI_JAXB_Object) {
+                                System.out.println("signature validation passed (expected)");
+                        } else {
+                                System.out.println("signature validation failed (not expected)");
+                        }
+                        System.out.println(msg.get());
+
+                } catch (Exception e) {
+                        e.printStackTrace();
+                }
+        }
+
+        /**
+         * Gets a UDDI style auth token, otherwise, appends credentials to the
+         * ws proxies (not yet implemented)
+         *
+         * @param username
+         * @param password
+         * @param style
+         * @return
+         */
+        private String GetAuthKey(String username, String password) {
+                try {
+
+                        GetAuthToken getAuthTokenRoot = new GetAuthToken();
+                        getAuthTokenRoot.setUserID(username);
+                        getAuthTokenRoot.setCred(password);
+
+                        // Making API call that retrieves the authentication token for the 'root' user.
+                        AuthToken rootAuthToken = security.getAuthToken(getAuthTokenRoot);
+                        System.out.println("root AUTHTOKEN = " + "don't log auth tokens!");
+                        return rootAuthToken.getAuthInfo();
+                } catch (Exception ex) {
+                        System.out.println("Could not authenticate with the provided credentials " + ex.getMessage());
+                }
+                return null;
+        }
+}

http://git-wip-us.apache.org/repos/asf/juddi/blob/9dafe4e8/juddi-client-cli/src/main/java/org/apache/juddi/v3/client/cli/UddiDigitalSignatureFile.java
----------------------------------------------------------------------
diff --git a/juddi-client-cli/src/main/java/org/apache/juddi/v3/client/cli/UddiDigitalSignatureFile.java b/juddi-client-cli/src/main/java/org/apache/juddi/v3/client/cli/UddiDigitalSignatureFile.java
new file mode 100644
index 0000000..eed0e72
--- /dev/null
+++ b/juddi-client-cli/src/main/java/org/apache/juddi/v3/client/cli/UddiDigitalSignatureFile.java
@@ -0,0 +1,160 @@
+/*
+ * Copyright 2001-2013 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.
+ *
+ */
+package org.apache.juddi.v3.client.cli;
+
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.util.Scanner;
+import java.util.concurrent.atomic.AtomicReference;
+import javax.xml.bind.JAXB;
+
+import org.apache.juddi.v3.client.config.UDDIClient;
+import org.apache.juddi.v3.client.cryptor.DigSigUtil;
+import org.apache.juddi.v3.client.transport.Transport;
+import org.uddi.api_v3.*;
+import org.uddi.v3_service.UDDIInquiryPortType;
+import org.uddi.v3_service.UDDIPublicationPortType;
+import org.uddi.v3_service.UDDISecurityPortType;
+
+/**
+ * This class shows you how to digital sign a business and save to file
+ *
+ * @author <a href="mailto:alexoree@apache.org">Alex O'Ree</a>
+ */
+public class UddiDigitalSignatureFile {
+
+        private static UDDIClient clerkManager = null;
+
+        /**
+         * This sets up the ws proxies using uddi.xml in META-INF
+         */
+        public UddiDigitalSignatureFile() {
+                try {
+                        // create a manager and read the config in the archive; 
+                        // you can use your config file name
+                        clerkManager = new UDDIClient("META-INF/simple-publish-uddi.xml");
+
+                } catch (Exception e) {
+                        e.printStackTrace();
+                }
+        }
+
+        public enum UddiType {
+
+                Business, Service, Binding, TModel, PublisherAssertion
+        }
+
+        public void Fire(String fileIn, String fileOut, UddiType type) {
+                try {
+                        System.out.println("WARN - All previous signatures will be removed!");
+                        if (fileIn == null || fileOut == null || type == null) {
+                                System.out.print("Input file: ");
+                                fileIn = System.console().readLine();
+                                System.out.print("Out file: ");
+                                fileOut = System.console().readLine();
+                                System.out.println();
+                                for (int i = 0; i < UddiType.values().length; i++) {
+                                        System.out.println("[" + i + "] " + UddiType.values()[i].toString());
+                                }
+                                System.out.print("UDDI Type: ");
+                                String t = System.console().readLine();
+                                type = UddiType.values()[Integer.parseInt(t)];
+                        }
+
+                        DigSigUtil ds = null;
+
+                        //option 1), set everything manually
+                        ds = new DigSigUtil();
+                        ds.put(DigSigUtil.SIGNATURE_KEYSTORE_FILE, "keystore.jks");
+                        ds.put(DigSigUtil.SIGNATURE_KEYSTORE_FILETYPE, "JKS");
+                        ds.put(DigSigUtil.SIGNATURE_KEYSTORE_FILE_PASSWORD, "Test");
+                        ds.put(DigSigUtil.SIGNATURE_KEYSTORE_KEY_ALIAS, "Test");
+                        ds.put(DigSigUtil.SIGNATURE_OPTION_CERT_INCLUSION_BASE64, "true");
+
+                        ds.put(DigSigUtil.SIGNATURE_OPTION_CERT_INCLUSION_SERIAL, "true");
+                        ds.put(DigSigUtil.SIGNATURE_OPTION_CERT_INCLUSION_SUBJECTDN, "true");
+                        ds.put(DigSigUtil.TRUSTSTORE_FILE, "truststore.jks");
+                        ds.put(DigSigUtil.TRUSTSTORE_FILETYPE, "JKS");
+                        ds.put(DigSigUtil.TRUSTSTORE_FILE_PASSWORD, "Test");
+
+                        FileInputStream fis = new FileInputStream(fileIn);
+                        Class expectedType = null;
+                        switch (type) {
+                                case Binding:
+                                        expectedType = BindingTemplate.class;
+                                        break;
+                                case Business:
+                                        expectedType = BusinessEntity.class;
+                                        break;
+                                case PublisherAssertion:
+                                        expectedType = PublisherAssertion.class;
+                                        break;
+                                case Service:
+                                        expectedType = BusinessService.class;
+                                        break;
+                                case TModel:
+                                        expectedType = TModel.class;
+                                        break;
+                        }
+                        Object be = JAXB.unmarshal(fis, expectedType);
+                        fis.close();
+                        fis = null;
+                        
+                        switch (type) {
+                                case Binding:
+                                        ((BindingTemplate)be).getSignature().clear();
+                                        break;
+                                case Business:
+                                        ((BusinessEntity)be).getSignature().clear();
+                                        break;
+                                case PublisherAssertion:
+                                        ((PublisherAssertion)be).getSignature().clear();
+                                        break;
+                                case Service:
+                                        ((BusinessService)be).getSignature().clear();
+                                        break;
+                                case TModel:
+                                        ((TModel)be).getSignature().clear();
+                                        break;
+                        }
+
+                        System.out.println("signing");
+                        Object signUDDI_JAXBObject = ds.signUddiEntity(be);
+                        System.out.println("signed");
+                        DigSigUtil.JAXB_ToStdOut(signUDDI_JAXBObject);
+                        
+
+                        System.out.println("verifing");
+                        AtomicReference<String> msg = new AtomicReference<String>();
+                        boolean verifySigned_UDDI_JAXB_Object = ds.verifySignedUddiEntity(signUDDI_JAXBObject, msg);
+                        if (verifySigned_UDDI_JAXB_Object) {
+                                System.out.println("signature validation passed (expected)");
+                                FileOutputStream fos = new FileOutputStream(fileOut);
+                                JAXB.marshal(signUDDI_JAXBObject, fos);
+                                fos.close();
+                        } else {
+                                System.out.println("signature validation failed (not expected)");
+                        }
+                        System.out.println(msg.get());
+
+                } catch (Exception e) {
+                        e.printStackTrace();
+                }
+        }
+
+       
+}

http://git-wip-us.apache.org/repos/asf/juddi/blob/9dafe4e8/juddi-client-cli/src/main/java/org/apache/juddi/v3/client/cli/UddiDigitalSignatureSearch.java
----------------------------------------------------------------------
diff --git a/juddi-client-cli/src/main/java/org/apache/juddi/v3/client/cli/UddiDigitalSignatureSearch.java b/juddi-client-cli/src/main/java/org/apache/juddi/v3/client/cli/UddiDigitalSignatureSearch.java
new file mode 100644
index 0000000..b844d26
--- /dev/null
+++ b/juddi-client-cli/src/main/java/org/apache/juddi/v3/client/cli/UddiDigitalSignatureSearch.java
@@ -0,0 +1,130 @@
+/*
+ * Copyright 2001-2013 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.
+ *
+ */
+package org.apache.juddi.v3.client.cli;
+
+import java.util.List;
+import org.apache.juddi.v3.client.UDDIConstants;
+import org.apache.juddi.v3.client.config.UDDIClient;
+import org.apache.juddi.v3.client.config.UDDIClientContainer;
+import org.apache.juddi.v3.client.transport.Transport;
+import org.uddi.api_v3.*;
+import org.uddi.v3_service.UDDIInquiryPortType;
+import org.uddi.v3_service.UDDIPublicationPortType;
+import org.uddi.v3_service.UDDISecurityPortType;
+
+/**
+ * This class shows you how to search for services that are digitally signed
+ *
+ * @author <a href="mailto:alexoree@apache.org">Alex O'Ree</a>
+ */
+public class UddiDigitalSignatureSearch {
+
+        private static UDDISecurityPortType security = null;
+        private static UDDIInquiryPortType inquiry = null;
+        private static UDDIPublicationPortType publish = null;
+
+        /**
+         * This sets up the ws proxies using uddi.xml in META-INF
+         */
+        public UddiDigitalSignatureSearch() {
+                try {
+            // create a manager and read the config in the archive; 
+                        // you can use your config file name
+                        UDDIClient clerkManager = new UDDIClient("META-INF/simple-publish-uddi.xml");
+                        Transport transport = clerkManager.getTransport();
+                        // Now you create a reference to the UDDI API
+                        security = transport.getUDDISecurityService();
+                        inquiry = transport.getUDDIInquiryService();
+                        publish = transport.getUDDIPublishService();
+                } catch (Exception e) {
+                        e.printStackTrace();
+                }
+        }
+
+        /**
+         * Main entry point
+         *
+         * @param args
+         */
+        public static void main(String args[]) {
+
+                UddiDigitalSignatureSearch sp = new UddiDigitalSignatureSearch();
+                sp.Fire(null);
+        }
+
+        public void Fire(String token) {
+                try {
+
+                        FindService fs = new FindService();
+                        //optional, usually
+                        if (token == null) {
+                                token = GetAuthKey("root", "root");
+                        }
+                        fs.setAuthInfo(token);
+                        fs.setFindQualifiers(new FindQualifiers());
+                        fs.getFindQualifiers().getFindQualifier().add(UDDIConstants.SORT_BY_DATE_ASC);
+                        fs.getFindQualifiers().getFindQualifier().add(UDDIConstants.APPROXIMATE_MATCH);
+                        fs.getFindQualifiers().getFindQualifier().add(UDDIConstants.SIGNATURE_PRESENT);
+                        Name n = new Name();
+                        n.setValue("%");
+                        fs.getName().add(n);
+                        ServiceList findService = inquiry.findService(fs);
+                        if (findService != null && findService.getServiceInfos() != null) {
+                                for (int i = 0; i < findService.getServiceInfos().getServiceInfo().size(); i++) {
+                                        System.out.println(ListToString(findService.getServiceInfos().getServiceInfo().get(i).getName()));
+                                }
+                        } else
+                                System.out.println("no results found.");
+                } catch (Exception e) {
+                        e.printStackTrace();
+                }
+        }
+
+        /**
+         * Gets a UDDI style auth token, otherwise, appends credentials to the
+         * ws proxies (not yet implemented)
+         *
+         * @param username
+         * @param password
+         * @param style
+         * @return
+         */
+        private String GetAuthKey(String username, String password) {
+                try {
+
+                        GetAuthToken getAuthTokenRoot = new GetAuthToken();
+                        getAuthTokenRoot.setUserID(username);
+                        getAuthTokenRoot.setCred(password);
+
+                        // Making API call that retrieves the authentication token for the 'root' user.
+                        AuthToken rootAuthToken = security.getAuthToken(getAuthTokenRoot);
+                        System.out.println("root AUTHTOKEN = " + "dont log auth tokens!");
+                        return rootAuthToken.getAuthInfo();
+                } catch (Exception ex) {
+                        System.out.println("Could not authenticate with the provided credentials " + ex.getMessage());
+                }
+                return null;
+        }
+
+        private String ListToString(List<Name> name) {
+                StringBuilder sb = new StringBuilder();
+                for (int i = 0; i < name.size(); i++) {
+                        sb.append(name.get(i).getValue()).append(" ");
+                }
+                return sb.toString();
+        }
+}

http://git-wip-us.apache.org/repos/asf/juddi/blob/9dafe4e8/juddi-client-cli/src/main/java/org/apache/juddi/v3/client/cli/UddiDigitalSignatureService.java
----------------------------------------------------------------------
diff --git a/juddi-client-cli/src/main/java/org/apache/juddi/v3/client/cli/UddiDigitalSignatureService.java b/juddi-client-cli/src/main/java/org/apache/juddi/v3/client/cli/UddiDigitalSignatureService.java
new file mode 100644
index 0000000..d8410d4
--- /dev/null
+++ b/juddi-client-cli/src/main/java/org/apache/juddi/v3/client/cli/UddiDigitalSignatureService.java
@@ -0,0 +1,189 @@
+/*
+ * Copyright 2001-2013 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.
+ *
+ */
+package org.apache.juddi.v3.client.cli;
+
+import java.util.concurrent.atomic.AtomicReference;
+import org.apache.juddi.v3.client.config.UDDIClient;
+import org.apache.juddi.v3.client.config.UDDIClientContainer;
+import org.apache.juddi.v3.client.cryptor.DigSigUtil;
+import org.apache.juddi.v3.client.transport.Transport;
+import org.uddi.api_v3.*;
+import org.uddi.v3_service.UDDIInquiryPortType;
+import org.uddi.v3_service.UDDIPublicationPortType;
+import org.uddi.v3_service.UDDISecurityPortType;
+
+/**
+ * This class shows you how to digitally sign a service and verify the signature
+ *
+ * @author <a href="mailto:alexoree@apache.org">Alex O'Ree</a>
+ */
+public class UddiDigitalSignatureService {
+
+        private static UDDISecurityPortType security = null;
+        private static UDDIInquiryPortType inquiry = null;
+        private static UDDIPublicationPortType publish = null;
+        private static UDDIClient clerkManager = null;
+
+        /**
+         * This sets up the ws proxies using uddi.xml in META-INF
+         */
+        public UddiDigitalSignatureService() {
+                try {
+            // create a manager and read the config in the archive; 
+                        // you can use your config file name
+                        clerkManager = new UDDIClient("META-INF/simple-publish-uddi.xml");
+                        Transport transport = clerkManager.getTransport();
+                        // Now you create a reference to the UDDI API
+                        security = transport.getUDDISecurityService();
+                        inquiry = transport.getUDDIInquiryService();
+                        publish = transport.getUDDIPublishService();
+                } catch (Exception e) {
+                        e.printStackTrace();
+                }
+        }
+
+        /**
+         * Main entry point
+         *
+         * @param args
+         */
+        public static void main(String args[]) {
+
+                UddiDigitalSignatureService sp = new UddiDigitalSignatureService();
+                sp.Fire(null, null);
+        }
+
+        public void Fire(String token, String key) {
+                try {
+
+                        DigSigUtil ds = null;
+
+                        ds = new DigSigUtil();
+                        //option 1), set everything manually
+                        ds.put(DigSigUtil.SIGNATURE_KEYSTORE_FILE, "keystore.jks");
+                        ds.put(DigSigUtil.SIGNATURE_KEYSTORE_FILETYPE, "JKS");
+                        ds.put(DigSigUtil.SIGNATURE_KEYSTORE_FILE_PASSWORD, "Test");
+                        ds.put(DigSigUtil.SIGNATURE_KEYSTORE_KEY_ALIAS, "Test");
+                        ds.put(DigSigUtil.SIGNATURE_OPTION_CERT_INCLUSION_BASE64, "true");
+
+                        ds.put(DigSigUtil.SIGNATURE_OPTION_CERT_INCLUSION_SERIAL, "true");
+                        ds.put(DigSigUtil.SIGNATURE_OPTION_CERT_INCLUSION_SUBJECTDN, "true");
+                        ds.put(DigSigUtil.TRUSTSTORE_FILE, "truststore.jks");
+                        ds.put(DigSigUtil.TRUSTSTORE_FILETYPE, "JKS");
+                        ds.put(DigSigUtil.TRUSTSTORE_FILE_PASSWORD, "Test");
+
+
+            //option 2), load it from the juddi config file
+                        //ds = new DigSigUtil(clerkManager.getClientConfig().getDigitalSignatureConfiguration());
+                        //login
+                        if (token == null) //option, load from juddi config
+                        {
+                                token = GetAuthKey(clerkManager.getClerk("default").getPublisher(),
+                                        clerkManager.getClerk("default").getPassword());
+                        }
+
+                        if (key == null) {
+                                SaveBusiness sb = new SaveBusiness();
+                                sb.setAuthInfo(token);
+                                BusinessEntity ob = new BusinessEntity();
+                                Name name = new Name();
+                                name.setValue("My Signed Business");
+                                ob.getName().add(name);
+                                ob.setBusinessServices(new BusinessServices());
+                                BusinessService bs = new BusinessService();
+                                bs.getName().add(new Name("My signed service", null));
+                                ob.getBusinessServices().getBusinessService().add(bs);
+                                sb.getBusinessEntity().add(ob);
+                                //save it
+                                BusinessDetail saveBusiness = publish.saveBusiness(sb);
+
+                                System.out.println("business created with key " + saveBusiness.getBusinessEntity().get(0).getBusinessKey());
+
+                                key = saveBusiness.getBusinessEntity().get(0).getBusinessServices().getBusinessService().get(0).getServiceKey();
+                        }
+
+                        BusinessService be = null;
+                        be = GetServiceDetails(key);
+                        if (!be.getSignature().isEmpty())
+                        {
+                                System.out.println("WARN, the entity with the key " + key + " is already signed! aborting");
+                                return;
+                        }
+                        
+                        //DigSigUtil.JAXB_ToStdOut(be);
+                        System.out.println("signing");
+                        BusinessService signUDDI_JAXBObject = ds.signUddiEntity(be);
+                        DigSigUtil.JAXB_ToStdOut(signUDDI_JAXBObject);
+                        System.out.println("signed, saving");
+
+                        SaveService sb = new SaveService();
+                        sb.setAuthInfo(token);
+                        sb.getBusinessService().add(signUDDI_JAXBObject);
+                        publish.saveService(sb);
+                        System.out.println("saved, fetching");
+
+                        be = GetServiceDetails(key);
+                        DigSigUtil.JAXB_ToStdOut(be);
+                        System.out.println("verifing");
+                        AtomicReference<String> msg = new AtomicReference<String>();
+                        boolean verifySigned_UDDI_JAXB_Object = ds.verifySignedUddiEntity(be, msg);
+                        if (verifySigned_UDDI_JAXB_Object) {
+                                System.out.println("signature validation passed (expected)");
+                        } else {
+                                System.out.println("signature validation failed (not expected)");
+                        }
+                        System.out.println(msg.get());
+
+                } catch (Exception e) {
+                        e.printStackTrace();
+                }
+        }
+
+        private BusinessService GetServiceDetails(String key) throws Exception {
+                //   BusinessInfo get
+                GetServiceDetail r = new GetServiceDetail();
+                //GetBusinessDetail r = new GetBusinessDetail();
+                r.getServiceKey().add(key);
+                return inquiry.getServiceDetail(r).getBusinessService().get(0);
+        }
+
+        /**
+         * Gets a UDDI style auth token, otherwise, appends credentials to the
+         * ws proxies (not yet implemented)
+         *
+         * @param username
+         * @param password
+         * @param style
+         * @return
+         */
+        private String GetAuthKey(String username, String password) {
+                try {
+
+                        GetAuthToken getAuthTokenRoot = new GetAuthToken();
+                        getAuthTokenRoot.setUserID(username);
+                        getAuthTokenRoot.setCred(password);
+
+                        // Making API call that retrieves the authentication token for the 'root' user.
+                        AuthToken rootAuthToken = security.getAuthToken(getAuthTokenRoot);
+                        System.out.println("root AUTHTOKEN = " + "don't log auth tokens!");
+                        return rootAuthToken.getAuthInfo();
+                } catch (Exception ex) {
+                        System.out.println("Could not authenticate with the provided credentials " + ex.getMessage());
+                }
+                return null;
+        }
+}


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