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:[email protected]";>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:[email protected]";>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:[email protected]";>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:[email protected]";>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:[email protected]";>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:[email protected]";>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:[email protected]";>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: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to