juddi-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From alexo...@apache.org
Subject svn commit: r1478745 [6/9] - in /juddi/branches/juddi-3.2.x: juddi-core/src/main/java/org/apache/juddi/api/impl/ juddi-examples/subscription-notification-handler/ juddi-examples/subscription-notification-handler/nbproject/ juddi-examples/subscription-n...
Date Fri, 03 May 2013 12:12:12 GMT
Added: juddi/branches/juddi-3.2.x/juddi-examples/uddi-createbulk/src/uddi/createbulk/UddiDigitalSignatureService.java
URL: http://svn.apache.org/viewvc/juddi/branches/juddi-3.2.x/juddi-examples/uddi-createbulk/src/uddi/createbulk/UddiDigitalSignatureService.java?rev=1478745&view=auto
==============================================================================
--- juddi/branches/juddi-3.2.x/juddi-examples/uddi-createbulk/src/uddi/createbulk/UddiDigitalSignatureService.java (added)
+++ juddi/branches/juddi-3.2.x/juddi-examples/uddi-createbulk/src/uddi/createbulk/UddiDigitalSignatureService.java Fri May  3 12:12:10 2013
@@ -0,0 +1,470 @@
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+package uddi.createbulk;
+
+import java.util.List;
+import java.util.Properties;
+import java.util.concurrent.atomic.AtomicReference;
+
+import org.apache.juddi.api_v3.AccessPointType;
+import org.apache.juddi.api_v3.Publisher;
+import org.apache.juddi.v3.client.UDDIConstants;
+import org.apache.juddi.v3.client.config.UDDIClerkManager;
+import org.apache.juddi.v3.client.config.UDDIClientContainer;
+import org.apache.juddi.v3.client.crypto.DigSigUtil;
+import org.apache.juddi.v3.client.transport.Transport;
+import org.uddi.api_v3.*;
+import org.uddi.v3_service.DispositionReportFaultMessage;
+import org.uddi.v3_service.UDDIInquiryPortType;
+import org.uddi.v3_service.UDDIPublicationPortType;
+import org.uddi.v3_service.UDDISecurityPortType;
+
+public class UddiDigitalSignatureService {
+
+    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 UddiDigitalSignatureService() {
+        try {
+            // create a manager and read the config in the archive; 
+            // you can use your config file name
+            UDDIClerkManager clerkManager = new UDDIClerkManager("META-INF/simple-publish-uddi.xml");
+            // register the clerkManager with the client side container
+            UDDIClientContainer.addClerkManager(clerkManager);
+            // 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("default");
+            // Now you create a reference to the UDDI API
+            security = transport.getUDDISecurityService();
+            inquiry = transport.getUDDIInquiryService();
+            publish = transport.getUDDIPublishService();
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+
+    private static void DisplayHelp() {
+        //TODO
+    }
+
+    /**
+     * Main entry point
+     *
+     * @param args
+     */
+    public static void main(String args[]) {
+        if (args.length == 1 && args[0].equalsIgnoreCase("help")) {
+            DisplayHelp();
+            return;
+        }
+        UddiDigitalSignatureService sp = new UddiDigitalSignatureService();
+        sp.Browse(args);
+    }
+
+    public void Browse(String[] args) {
+        try {
+            Properties prop = ParseArgs(args);
+            if (prop.containsKey("AuthStyle")) {
+                //TODO, determine a way to pass parameters from the command line, hardcoded for now
+                //UDDI Token
+                //HTTP Username/Password (basic or digest)
+                //HTTP Client Cert
+            }
+            org.apache.juddi.v3.client.crypto.DigSigUtil 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, "password");
+            ds.put(DigSigUtil.SIGNATURE_KEYSTORE_KEY_ALIAS, "selfsigned");
+            ds.put(DigSigUtil.SIGNATURE_OPTION_CERT_INCLUSION_BASE64, "t");
+            String token = GetAuthKey("root", "root", AuthStyle.UDDI_AUTH);
+            /*BusinessList findBusiness = GetBusinessList(token);
+             BusinessEntity be = GetBusinessDetails(findBusiness.getBusinessInfos().getBusinessInfo().get(0));
+            
+             //todo provider name
+             /*ds.put(DigSigUtil.SIGNATURE_OPTION_CERT_INCLUSION_SERIAL, "t");
+             ds.put(DigSigUtil.SIGNATURE_OPTION_CERT_INCLUSION_SUBJECTDN, "t");
+             ds.put(DigSigUtil.SIGNATURE_OPTION_CERT_INCLUSION_THUMBPRINT, "t");
+             ds.put(DigSigUtil.SIGNATURE_OPTION_CERT_INCLUSION_X500_PRINICPAL, "t");
+
+             * /
+             ds.put(DigSigUtil.SIGNATURE_OPTION_CERT_INCLUSION_BASE64, "t");
+
+             // org.apache.xml.security.utils.
+             System.out.println("signing");
+             BusinessEntity signUDDI_JAXBObject = ds.signUddiEntity(be);
+             System.out.println("signed");
+             DigSigUtil.JAXB_ToStdOut(signUDDI_JAXBObject);
+             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 (as expected)");
+             } else {
+             System.out.println("signature validation failed");
+             }
+             System.out.println(msg.get());
+             msg = new AtomicReference<String>();
+             System.out.println("signing it again for the hell of it");
+             signUDDI_JAXBObject = ds.signUddiEntity(signUDDI_JAXBObject);
+             DigSigUtil.JAXB_ToStdOut(signUDDI_JAXBObject);
+
+             verifySigned_UDDI_JAXB_Object = ds.verifySignedUddiEntity(signUDDI_JAXBObject, msg);
+             if (verifySigned_UDDI_JAXB_Object) {
+             System.out.println("signature validation passed (as expected)");
+             } else {
+             System.out.println("signature validation failed");
+             }
+             System.out.println(msg.get());
+             msg = new AtomicReference<String>();
+             System.out.println("signing");
+             //start from scratcha again
+             signUDDI_JAXBObject = ds.signUddiEntity(be);
+             System.out.println("signed");
+             //tweak it, then revalidate
+             System.out.println("tweak it, then verify again");
+             Description d = new Description();
+             d.setValue("Hello world");
+             signUDDI_JAXBObject.getDescription().add(d);
+             DigSigUtil.JAXB_ToStdOut(signUDDI_JAXBObject);
+
+             verifySigned_UDDI_JAXB_Object = ds.verifySignedUddiEntity(signUDDI_JAXBObject, msg);
+             if (verifySigned_UDDI_JAXB_Object) {
+             System.out.println("signature validation passed (not expected)");
+             } else {
+             System.out.println("signature validation failed (expected)");
+             }
+             System.out.println(msg.get());
+             //PrintBusinessInfo(findBusiness.getBusinessInfos());
+             //PrintBusinessDetails(findBusiness.getBusinessInfos(), token);
+             //Pr                    intServiceDetailsByBusiness(findBusiness.getBusinessInfos(), token);
+             */
+            System.out.println("this is the real test =====================");
+
+           // BusinessList findBusiness = GetBusinessList(token);
+            
+            BusinessService be = null;
+            be = GetBusinessDetails();//findBusiness.getBusinessInfos().getBusinessInfo().get(0));
+            be.getSignature().clear();
+            //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");
+
+           // findBusiness = GetBusinessList(token);
+            be = GetBusinessDetails();//findBusiness.getBusinessInfos().getBusinessInfo().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();
+        }
+    }
+
+    /**
+     * 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);
+        Name n = new Name();
+        n.setValue("My Business 0 2013-04-11T12:40:52.753-04:00");
+        fb.getName().add(n);
+        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 BusinessService GetBusinessDetails() throws Exception {
+     //   BusinessInfo get
+        GetServiceDetail r = new GetServiceDetail();
+        //GetBusinessDetail r = new GetBusinessDetail();
+        r.getServiceKey().add("uddi:juddi.apache.org:da314f49-b84f-4ede-a434-0b0178632f10");
+        return inquiry.getServiceDetail(r).getBusinessService().get(0);
+    }
+
+    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, AuthStyle style) {
+        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 = " + rootAuthToken.getAuthInfo());
+            return rootAuthToken.getAuthInfo();
+        } catch (Exception ex) {
+            System.out.println("Could not authenticate with the provided credentials " + ex.getMessage());
+        }
+        return null;
+    }
+
+    /**
+     * Converts command line args into a simple property structure
+     *
+     * @param args
+     * @return
+     */
+    private Properties ParseArgs(String[] args) {
+
+        Properties p = new Properties();
+        if (args == null) {
+            return p;
+        }
+        for (int i = 0; i < args.length; i++) {
+            if (args[i] != null && args[i].length() >= 3) {
+                p.put(args[i].split("=")[0], args[i].split("=")[1]);
+            }
+        }
+        return p;
+    }
+
+    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("................");
+
+        }
+    }
+}

Added: juddi/branches/juddi-3.2.x/juddi-examples/uddi-createbulk/src/uddi/createbulk/UddiDigitalSignatureTmodel.java
URL: http://svn.apache.org/viewvc/juddi/branches/juddi-3.2.x/juddi-examples/uddi-createbulk/src/uddi/createbulk/UddiDigitalSignatureTmodel.java?rev=1478745&view=auto
==============================================================================
--- juddi/branches/juddi-3.2.x/juddi-examples/uddi-createbulk/src/uddi/createbulk/UddiDigitalSignatureTmodel.java (added)
+++ juddi/branches/juddi-3.2.x/juddi-examples/uddi-createbulk/src/uddi/createbulk/UddiDigitalSignatureTmodel.java Fri May  3 12:12:10 2013
@@ -0,0 +1,468 @@
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+package uddi.createbulk;
+
+import java.util.List;
+import java.util.Properties;
+import java.util.concurrent.atomic.AtomicReference;
+
+import org.apache.juddi.api_v3.AccessPointType;
+import org.apache.juddi.api_v3.Publisher;
+import org.apache.juddi.v3.client.UDDIConstants;
+import org.apache.juddi.v3.client.config.UDDIClerkManager;
+import org.apache.juddi.v3.client.config.UDDIClientContainer;
+import org.apache.juddi.v3.client.crypto.DigSigUtil;
+import org.apache.juddi.v3.client.transport.Transport;
+import org.uddi.api_v3.*;
+import org.uddi.v3_service.DispositionReportFaultMessage;
+import org.uddi.v3_service.UDDIInquiryPortType;
+import org.uddi.v3_service.UDDIPublicationPortType;
+import org.uddi.v3_service.UDDISecurityPortType;
+
+public class UddiDigitalSignatureTmodel {
+
+    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 UddiDigitalSignatureTmodel() {
+        try {
+            // create a manager and read the config in the archive; 
+            // you can use your config file name
+            UDDIClerkManager clerkManager = new UDDIClerkManager("META-INF/simple-publish-uddi.xml");
+            // register the clerkManager with the client side container
+            UDDIClientContainer.addClerkManager(clerkManager);
+            // 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("default");
+            // Now you create a reference to the UDDI API
+            security = transport.getUDDISecurityService();
+            inquiry = transport.getUDDIInquiryService();
+            publish = transport.getUDDIPublishService();
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+
+    private static void DisplayHelp() {
+        //TODO
+    }
+
+    /**
+     * Main entry point
+     *
+     * @param args
+     */
+    public static void main(String args[]) {
+        if (args.length == 1 && args[0].equalsIgnoreCase("help")) {
+            DisplayHelp();
+            return;
+        }
+        UddiDigitalSignatureTmodel sp = new UddiDigitalSignatureTmodel();
+        sp.Browse(args);
+    }
+
+    public void Browse(String[] args) {
+        try {
+            Properties prop = ParseArgs(args);
+            if (prop.containsKey("AuthStyle")) {
+                //TODO, determine a way to pass parameters from the command line, hardcoded for now
+                //UDDI Token
+                //HTTP Username/Password (basic or digest)
+                //HTTP Client Cert
+            }
+            org.apache.juddi.v3.client.crypto.DigSigUtil 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, "password");
+            ds.put(DigSigUtil.SIGNATURE_KEYSTORE_KEY_ALIAS, "selfsigned");
+            ds.put(DigSigUtil.SIGNATURE_OPTION_CERT_INCLUSION_BASE64, "t");
+            String token = GetAuthKey("root", "root", AuthStyle.UDDI_AUTH);
+            /*BusinessList findBusiness = GetBusinessList(token);
+             BusinessEntity be = GetBusinessDetails(findBusiness.getBusinessInfos().getBusinessInfo().get(0));
+            
+             //todo provider name
+             /*ds.put(DigSigUtil.SIGNATURE_OPTION_CERT_INCLUSION_SERIAL, "t");
+             ds.put(DigSigUtil.SIGNATURE_OPTION_CERT_INCLUSION_SUBJECTDN, "t");
+             ds.put(DigSigUtil.SIGNATURE_OPTION_CERT_INCLUSION_THUMBPRINT, "t");
+             ds.put(DigSigUtil.SIGNATURE_OPTION_CERT_INCLUSION_X500_PRINICPAL, "t");
+
+             * /
+             ds.put(DigSigUtil.SIGNATURE_OPTION_CERT_INCLUSION_BASE64, "t");
+
+             // org.apache.xml.security.utils.
+             System.out.println("signing");
+             BusinessEntity signUDDI_JAXBObject = ds.signUddiEntity(be);
+             System.out.println("signed");
+             DigSigUtil.JAXB_ToStdOut(signUDDI_JAXBObject);
+             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 (as expected)");
+             } else {
+             System.out.println("signature validation failed");
+             }
+             System.out.println(msg.get());
+             msg = new AtomicReference<String>();
+             System.out.println("signing it again for the hell of it");
+             signUDDI_JAXBObject = ds.signUddiEntity(signUDDI_JAXBObject);
+             DigSigUtil.JAXB_ToStdOut(signUDDI_JAXBObject);
+
+             verifySigned_UDDI_JAXB_Object = ds.verifySignedUddiEntity(signUDDI_JAXBObject, msg);
+             if (verifySigned_UDDI_JAXB_Object) {
+             System.out.println("signature validation passed (as expected)");
+             } else {
+             System.out.println("signature validation failed");
+             }
+             System.out.println(msg.get());
+             msg = new AtomicReference<String>();
+             System.out.println("signing");
+             //start from scratcha again
+             signUDDI_JAXBObject = ds.signUddiEntity(be);
+             System.out.println("signed");
+             //tweak it, then revalidate
+             System.out.println("tweak it, then verify again");
+             Description d = new Description();
+             d.setValue("Hello world");
+             signUDDI_JAXBObject.getDescription().add(d);
+             DigSigUtil.JAXB_ToStdOut(signUDDI_JAXBObject);
+
+             verifySigned_UDDI_JAXB_Object = ds.verifySignedUddiEntity(signUDDI_JAXBObject, msg);
+             if (verifySigned_UDDI_JAXB_Object) {
+             System.out.println("signature validation passed (not expected)");
+             } else {
+             System.out.println("signature validation failed (expected)");
+             }
+             System.out.println(msg.get());
+             //PrintBusinessInfo(findBusiness.getBusinessInfos());
+             //PrintBusinessDetails(findBusiness.getBusinessInfos(), token);
+             //Pr                    intServiceDetailsByBusiness(findBusiness.getBusinessInfos(), token);
+             */
+            System.out.println("this is the real test =====================");
+
+           // BusinessList findBusiness = GetBusinessList(token);
+            
+            TModel be = GetBusinessDetails();//findBusiness.getBusinessInfos().getBusinessInfo().get(0));
+            be.getSignature().clear();
+            //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");
+
+           // findBusiness = GetBusinessList(token);
+            be = GetBusinessDetails();//findBusiness.getBusinessInfos().getBusinessInfo().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();
+        }
+    }
+
+    /**
+     * 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);
+        Name n = new Name();
+        n.setValue("My Business 0 2013-04-11T12:40:52.753-04:00");
+        fb.getName().add(n);
+        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 TModel GetBusinessDetails() throws Exception {
+     //   BusinessInfo get
+        GetTModelDetail r = new GetTModelDetail();
+        r.getTModelKey().add("uddi:juddi.apache.org:23748881-bb2f-4896-8283-4a15be1d0bc1");
+        return inquiry.getTModelDetail(r).getTModel().get(0);
+    }
+
+    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, AuthStyle style) {
+        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 = " + rootAuthToken.getAuthInfo());
+            return rootAuthToken.getAuthInfo();
+        } catch (Exception ex) {
+            System.out.println("Could not authenticate with the provided credentials " + ex.getMessage());
+        }
+        return null;
+    }
+
+    /**
+     * Converts command line args into a simple property structure
+     *
+     * @param args
+     * @return
+     */
+    private Properties ParseArgs(String[] args) {
+
+        Properties p = new Properties();
+        if (args == null) {
+            return p;
+        }
+        for (int i = 0; i < args.length; i++) {
+            if (args[i] != null && args[i].length() >= 3) {
+                p.put(args[i].split("=")[0], args[i].split("=")[1]);
+            }
+        }
+        return p;
+    }
+
+    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("................");
+
+        }
+    }
+}

Added: juddi/branches/juddi-3.2.x/juddi-examples/uddi-createbulk/src/uddi/createbulk/UddiFindBinding.java
URL: http://svn.apache.org/viewvc/juddi/branches/juddi-3.2.x/juddi-examples/uddi-createbulk/src/uddi/createbulk/UddiFindBinding.java?rev=1478745&view=auto
==============================================================================
--- juddi/branches/juddi-3.2.x/juddi-examples/uddi-createbulk/src/uddi/createbulk/UddiFindBinding.java (added)
+++ juddi/branches/juddi-3.2.x/juddi-examples/uddi-createbulk/src/uddi/createbulk/UddiFindBinding.java Fri May  3 12:12:10 2013
@@ -0,0 +1,94 @@
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+package uddi.createbulk;
+
+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.UDDIClerkManager;
+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;
+
+/**
+ *
+ * @author Alex
+ */
+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
+            UDDIClerkManager clerkManager = new UDDIClerkManager("META-INF/simple-publish-uddi.xml");
+            // register the clerkManager with the client side container
+            UDDIClientContainer.addClerkManager(clerkManager);
+            // 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("default");
+            // 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 publish() {
+        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");
+
+            // Making API call that retrieves the authentication token for the 'root' user.
+            AuthToken rootAuthToken = security.getAuthToken(getAuthTokenRoot);
+            System.out.println("root AUTHTOKEN = " + rootAuthToken.getAuthInfo());
+
+            FindService fs = new FindService();
+            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());
+                for (int k = 0; k < serviceDetail.getBusinessService().get(i).getBindingTemplates().getBindingTemplate().size(); k++) {
+                    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.publish();
+    }
+}

Added: juddi/branches/juddi-3.2.x/juddi-examples/uddi-createbulk/src/uddi/createbulk/UddiRelatedBusinesses.java
URL: http://svn.apache.org/viewvc/juddi/branches/juddi-3.2.x/juddi-examples/uddi-createbulk/src/uddi/createbulk/UddiRelatedBusinesses.java?rev=1478745&view=auto
==============================================================================
--- juddi/branches/juddi-3.2.x/juddi-examples/uddi-createbulk/src/uddi/createbulk/UddiRelatedBusinesses.java (added)
+++ juddi/branches/juddi-3.2.x/juddi-examples/uddi-createbulk/src/uddi/createbulk/UddiRelatedBusinesses.java Fri May  3 12:12:10 2013
@@ -0,0 +1,139 @@
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+package uddi.createbulk;
+
+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.api_v3.AccessPointType;
+import org.apache.juddi.v3.client.config.UDDIClerkManager;
+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.UDDIPublicationPortType;
+import org.uddi.v3_service.UDDISecurityPortType;
+
+/**
+ *
+ * @author Alex
+ */
+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
+            UDDIClerkManager clerkManager = new UDDIClerkManager("META-INF/simple-publish-uddi.xml");
+            // register the clerkManager with the client side container
+            UDDIClientContainer.addClerkManager(clerkManager);
+            // 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("default");
+            // 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 publish() {
+        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");
+
+            // Making API call that retrieves the authentication token for the 'root' user.
+            AuthToken rootAuthToken = security.getAuthToken(getAuthTokenRoot);
+            System.out.println("root AUTHTOKEN = " + rootAuthToken.getAuthInfo());
+
+
+
+            DatatypeFactory df = DatatypeFactory.newInstance();
+            GregorianCalendar gcal = new GregorianCalendar();
+            gcal.setTimeInMillis(System.currentTimeMillis());
+            XMLGregorianCalendar xcal = df.newXMLGregorianCalendar(gcal);
+            for (int i = 0; i < 1; i++) {
+                // Creating the parent business entity that will contain our service.
+                BusinessEntity myBusEntity = new BusinessEntity();
+                Name myBusName = new Name();
+                myBusName.setLang("en");
+                myBusName.setValue("My Business Dept 1" + " " + xcal.toString());
+                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(rootAuthToken.getAuthInfo());
+                BusinessDetail bd = publish.saveBusiness(sb);
+                String myBusKey1 = bd.getBusinessEntity().get(0).getBusinessKey();
+                System.out.println("myBusiness key:  " + myBusKey1);
+
+
+                myBusEntity = new BusinessEntity();
+                myBusName = new Name();
+                myBusName.setLang("en");
+                myBusName.setValue("My Business Dept 2" + " " + xcal.toString());
+                myBusEntity.getName().add(myBusName);
+
+                // Adding the business entity to the "save" structure, using our publisher's authentication info and saving away.
+                sb = new SaveBusiness();
+                sb.getBusinessEntity().add(myBusEntity);
+                sb.setAuthInfo(rootAuthToken.getAuthInfo());
+                bd = publish.saveBusiness(sb);
+                String myBusKey2 = bd.getBusinessEntity().get(0).getBusinessKey();
+                System.out.println("myBusiness key:  " + myBusKey2);
+
+                Holder<List<PublisherAssertion>> x = new Holder<List<PublisherAssertion>>();
+                PublisherAssertion pa = new PublisherAssertion();
+                pa.setFromKey(myBusKey2);
+                pa.setToKey(myBusKey1);
+                pa.setKeyedReference(new KeyedReference());
+                pa.getKeyedReference().setKeyName("Subsidiary");
+                pa.getKeyedReference().setKeyValue("parent-child");
+                
+                pa.getKeyedReference().setTModelKey("uddi:uddi.org:relationships");
+                x.value = new ArrayList<PublisherAssertion>();
+                x.value.add(pa);
+                publish.setPublisherAssertions(rootAuthToken.getAuthInfo(), x);
+                
+                
+                x = new Holder<List<PublisherAssertion>>();
+                pa = new PublisherAssertion();
+                pa.setFromKey(myBusKey1);
+                pa.setToKey(myBusKey2);
+                pa.setKeyedReference(new KeyedReference());
+                pa.getKeyedReference().setKeyName("Subsidiary");
+                pa.getKeyedReference().setKeyValue("parent-child");
+                
+                pa.getKeyedReference().setTModelKey("uddi:uddi.org:relationships");
+                x.value = new ArrayList<PublisherAssertion>();
+                x.value.add(pa);
+                publish.setPublisherAssertions(rootAuthToken.getAuthInfo(), x);
+
+
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+
+    public static void main(String args[]) {
+        UddiRelatedBusinesses sp = new UddiRelatedBusinesses();
+        sp.publish();
+    }
+}

Added: juddi/branches/juddi-3.2.x/juddi-examples/uddi-createbulk/src/uddi/createbulk/UddiSubscribe.java
URL: http://svn.apache.org/viewvc/juddi/branches/juddi-3.2.x/juddi-examples/uddi-createbulk/src/uddi/createbulk/UddiSubscribe.java?rev=1478745&view=auto
==============================================================================
--- juddi/branches/juddi-3.2.x/juddi-examples/uddi-createbulk/src/uddi/createbulk/UddiSubscribe.java (added)
+++ juddi/branches/juddi-3.2.x/juddi-examples/uddi-createbulk/src/uddi/createbulk/UddiSubscribe.java Fri May  3 12:12:10 2013
@@ -0,0 +1,292 @@
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+package uddi.createbulk;
+
+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.Endpoint;
+import javax.xml.ws.Holder;
+import org.apache.juddi.v3.client.UDDIConstants;
+import org.apache.juddi.v3.client.config.UDDIClerkManager;
+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.sub_v3.DeleteSubscription;
+import org.uddi.sub_v3.Subscription;
+import org.uddi.sub_v3.SubscriptionFilter;
+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
+ */
+public class UddiSubscribe {
+
+    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;
+
+    public UddiSubscribe() {
+        try {
+            // create a manager and read the config in the archive; 
+            // you can use your config file name
+            UDDIClerkManager clerkManager = new UDDIClerkManager("META-INF/simple-publish-uddi.xml");
+            // register the clerkManager with the client side container
+            UDDIClientContainer.addClerkManager(clerkManager);
+            // 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("default");
+            // 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 void publish() {
+        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");
+
+            // Making API call that retrieves the authentication token for the 'root' user.
+            AuthToken rootAuthToken = security.getAuthToken(getAuthTokenRoot);
+            System.out.println("root AUTHTOKEN = " + rootAuthToken.getAuthInfo());
+
+
+            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 = " + rootAuthToken.getAuthInfo());
+
+
+
+
+
+
+            DatatypeFactory df = DatatypeFactory.newInstance();
+            GregorianCalendar gcal = new GregorianCalendar();
+            gcal.setTimeInMillis(System.currentTimeMillis());
+            XMLGregorianCalendar xcal = df.newXMLGregorianCalendar(gcal);
+
+            // Creating the parent business entity that will contain our service.
+            BusinessEntity myBusEntity = new BusinessEntity();
+            Name myBusName = new Name();
+            myBusName.setLang("en");
+            myBusName.setValue("My Business Dept 1" + " " + xcal.toString());
+            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(rootAuthToken.getAuthInfo());
+            BusinessDetail bd = publish.saveBusiness(sb);
+            String myBusKey1 = bd.getBusinessEntity().get(0).getBusinessKey();
+            System.out.println("myBusiness key:  " + myBusKey1);
+
+            Holder<List<Subscription>> subs = new Holder<List<Subscription>>();
+            subs.value = new ArrayList<Subscription>();
+            Subscription sub = new Subscription();
+            sub.setMaxEntities(20);
+            sub.setSubscriptionFilter(new SubscriptionFilter());
+            sub.getSubscriptionFilter().setGetBusinessDetail(new GetBusinessDetail());
+            sub.getSubscriptionFilter().getGetBusinessDetail().getBusinessKey().add(myBusKey1);
+            sub.getSubscriptionFilter().setGetAssertionStatusReport(new GetAssertionStatusReport());
+            //  sub.getSubscriptionFilter().s
+            //uddi:juddi.apache.org:72619170-d391-41cb-99a0-238cb0b76eb9
+            subs.value.add(sub);
+            uddiSubscriptionService.saveSubscription(rootAuthToken.getAuthInfo(), subs);
+
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+
+    public static void main(String args[]) throws Exception {
+        UddiSubscribe sp = new UddiSubscribe();
+        sp.SetupAndRegisterCallback();
+        //sp.publish();
+    }
+
+    private void SetupAndRegisterCallback() throws Exception {
+        String url = "http://localhost:7777/uddi_subscription_back";
+        Endpoint ep = Endpoint.publish(url, new ClientSubscriptionCallback(this));
+
+
+        DatatypeFactory df = DatatypeFactory.newInstance();
+        GregorianCalendar gcal = new GregorianCalendar();
+        gcal.setTimeInMillis(System.currentTimeMillis());
+        XMLGregorianCalendar xcal = df.newXMLGregorianCalendar(gcal);
+
+        //?? note, you won't get subscription updates if you own the entity, at least with juddi
+
+
+        //in this case, the user "root" is subscribing to a business entity published by the user "uddi"
+        //"uddi" then updates the item and then logically "root" should be notified
+        //before this happens "root" needs to publish a business, service and binding template that is used for the 
+        //subscription callback
+
+        /*
+         * so the order of operation is
+         * 1) uddi publisher's an entity 
+         * 2) root wants updates on uddi's entity
+         * 3) root starts a subscription listener service to process updates
+         * 4) root creates a business and service with a bindingtemplate with the access point value = the the subscription listener's address
+         * 5) root creates a subscription
+         * 6) uddi updates the entity
+         * 7) root's sub listener is notified (hopefully)
+         * 
+         */
+
+
+        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 = " + rootAuthToken.getAuthInfo());
+
+
+        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 = " + rootAuthToken.getAuthInfo());
+
+        //first publish a business user the user uddi
+        BusinessEntity myBusEntity = new BusinessEntity();
+        Name myBusName = new Name();
+        myBusName.setLang("en");
+        myBusName.setValue("User UDDI's Business" + " " + xcal.toString());
+        myBusEntity.getName().add(myBusName);
+        SaveBusiness sb = new SaveBusiness();
+        sb.getBusinessEntity().add(myBusEntity);
+        sb.setAuthInfo(uddiAuthToken.getAuthInfo());
+        BusinessDetail bd = publish.saveBusiness(sb);
+
+        String keyRootSubscribesTo = bd.getBusinessEntity().get(0).getBusinessKey();
+        System.out.println("UDDI's business saved as biz key " + keyRootSubscribesTo);
+        BusinessEntity uddisBusiness = bd.getBusinessEntity().get(0);
+
+        //reset
+        List<Subscription> subscriptions = uddiSubscriptionService.getSubscriptions(rootAuthToken.getAuthInfo());
+        DeleteSubscription ds = new DeleteSubscription();
+        ds.setAuthInfo(rootAuthToken.getAuthInfo());
+        for (int i = 0; i < subscriptions.size(); i++) {
+            ds.getSubscriptionKey().add(subscriptions.get(i).getSubscriptionKey());
+        }
+        if (!ds.getSubscriptionKey().isEmpty()) {
+            System.out.println("removing " + ds.getSubscriptionKey().size() + " old subscriptions");
+            uddiSubscriptionService.deleteSubscription(ds);
+        }
+
+        // Creating the parent business entity that will contain our service.
+        myBusEntity = new BusinessEntity();
+        myBusName = new Name();
+        myBusName.setLang("en");
+        myBusName.setValue("My Business Dept 1" + " " + xcal.toString());
+        myBusEntity.getName().add(myBusName);
+        myBusEntity.setBusinessServices(new BusinessServices());
+        BusinessService bs = new BusinessService();
+        bs.getName().add(new Name());
+        bs.getName().get(0).setValue("my callback endpoint");
+
+        bs.setBindingTemplates(new BindingTemplates());
+        BindingTemplate bt = new BindingTemplate();
+        //bt.setCategoryBag(new CategoryBag());
+        //   KeyedReference kr = new KeyedReference();
+        //         kr.setTModelKey(UDDIConstants.);
+        // bt.getCategoryBag().getKeyedReference().add(kr);
+        bt.setAccessPoint(new AccessPoint());
+        bt.getAccessPoint().setValue(url);
+        bt.getAccessPoint().setUseType("endPoint");
+        //Added per Kurt
+        TModelInstanceInfo instanceInfo = new TModelInstanceInfo();
+        instanceInfo.setTModelKey("uddi:uddi.org:transport:http");
+        bt.setTModelInstanceDetails(new TModelInstanceDetails());
+        bt.getTModelInstanceDetails().getTModelInstanceInfo().add(instanceInfo);
+        
+        bs.getBindingTemplates().getBindingTemplate().add(bt);
+
+
+        myBusEntity.getBusinessServices().getBusinessService().add(bs);
+        // Adding the business entity to the "save" structure, using our publisher's authentication info and saving away.
+        sb = new SaveBusiness();
+        sb.getBusinessEntity().add(myBusEntity);
+        sb.setAuthInfo(rootAuthToken.getAuthInfo());
+        bd = publish.saveBusiness(sb);
+
+        String callbackBindingTemplate = bd.getBusinessEntity().get(0).getBusinessServices().getBusinessService().get(0).getBindingTemplates().getBindingTemplate().get(0).getBindingKey();
+        System.out.println("myBusiness key:  " + bd.getBusinessEntity().get(0).getBusinessKey());
+        System.out.println("callback binding template key:  " + callbackBindingTemplate);
+
+        System.out.println("i'll stay awake until someone kills me");
+
+        Holder<List<Subscription>> subscription = new Holder<List<Subscription>>();
+        subscription.value = new ArrayList<Subscription>();
+        Subscription sub = new Subscription();
+        sub.setBindingKey(callbackBindingTemplate);
+        //this is required
+        sub.setBrief(true);
+        sub.setNotificationInterval(df.newDuration(0));
+        sub.setSubscriptionFilter(new SubscriptionFilter());
+        sub.getSubscriptionFilter().setGetBusinessDetail(new GetBusinessDetail());
+        sub.getSubscriptionFilter().getGetBusinessDetail().setAuthInfo(rootAuthToken.getAuthInfo());
+        sub.getSubscriptionFilter().getGetBusinessDetail().getBusinessKey().add(keyRootSubscribesTo);
+        subscription.value.add(sub);
+        uddiSubscriptionService.saveSubscription(rootAuthToken.getAuthInfo(), subscription);
+
+
+        //ok now we're ready to mess around with the user's "uddi" business
+        //in this case, we're just setting the lang
+        uddisBusiness.getName().get(0).setLang("en");
+        sb = new SaveBusiness();
+        sb.setAuthInfo(uddiAuthToken.getAuthInfo());
+        sb.getBusinessEntity().add(uddisBusiness);
+        publish.saveBusiness(sb);
+
+        long timer = 310000;
+        while (timer > 0 && !callbackRecieved) {
+            Thread.sleep(5000);
+            timer = timer - 5000;
+        }
+        ep.stop();
+        if (callbackRecieved ) {
+            System.out.println("Callback recieved successfully");
+            System.exit(0);
+        } else {
+            System.out.println("Callback NOT recieved!");
+            System.exit(1);
+        }
+
+        //TODO clean up all the crap we just made
+    }
+}

Added: juddi/branches/juddi-3.2.x/juddi-examples/uddi-createbulk/src/uddi/createbulk/UddiSubscribeValidate.java
URL: http://svn.apache.org/viewvc/juddi/branches/juddi-3.2.x/juddi-examples/uddi-createbulk/src/uddi/createbulk/UddiSubscribeValidate.java?rev=1478745&view=auto
==============================================================================
--- juddi/branches/juddi-3.2.x/juddi-examples/uddi-createbulk/src/uddi/createbulk/UddiSubscribeValidate.java (added)
+++ juddi/branches/juddi-3.2.x/juddi-examples/uddi-createbulk/src/uddi/createbulk/UddiSubscribeValidate.java Fri May  3 12:12:10 2013
@@ -0,0 +1,107 @@
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+package uddi.createbulk;
+
+import java.util.ArrayList;
+import java.util.Calendar;
+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.UDDIClerkManager;
+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.sub_v3.CoveragePeriod;
+import org.uddi.sub_v3.GetSubscriptionResults;
+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.UDDISubscriptionListenerPortType;
+import org.uddi.v3_service.UDDISubscriptionPortType;
+
+/**
+ *
+ * @author Alex
+ */
+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
+            UDDIClerkManager clerkManager = new UDDIClerkManager("META-INF/simple-publish-uddi.xml");
+            // register the clerkManager with the client side container
+            UDDIClientContainer.addClerkManager(clerkManager);
+            // 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("default");
+            // 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 void publish() {
+        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");
+
+            // Making API call that retrieves the authentication token for the 'root' user.
+            AuthToken rootAuthToken = security.getAuthToken(getAuthTokenRoot);
+            System.out.println("root AUTHTOKEN = " + rootAuthToken.getAuthInfo());
+
+//uddiSubscriptionListenerService.notifySubscriptionListener()
+
+            DatatypeFactory df = DatatypeFactory.newInstance();
+            GregorianCalendar gcal = new GregorianCalendar();
+            gcal.setTimeInMillis(System.currentTimeMillis());
+            XMLGregorianCalendar xcal = df.newXMLGregorianCalendar(gcal);
+            for (int i = 0; i < 1; i++) {
+                //
+                GetSubscriptionResults req = new GetSubscriptionResults();
+                req.setAuthInfo(rootAuthToken.getAuthInfo());
+                req.setSubscriptionKey("uddi:juddi.apache.org:72619170-d391-41cb-99a0-238cb0b76eb9");
+                req.setCoveragePeriod(new CoveragePeriod());
+                req.getCoveragePeriod().setEndPoint(xcal);
+                
+                
+                gcal = new GregorianCalendar();
+                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.publish();
+    }
+}

Added: juddi/branches/juddi-3.2.x/juddi-examples/uddi-createbulk/src/uddi/createbulk/testStrings.java
URL: http://svn.apache.org/viewvc/juddi/branches/juddi-3.2.x/juddi-examples/uddi-createbulk/src/uddi/createbulk/testStrings.java?rev=1478745&view=auto
==============================================================================
--- juddi/branches/juddi-3.2.x/juddi-examples/uddi-createbulk/src/uddi/createbulk/testStrings.java (added)
+++ juddi/branches/juddi-3.2.x/juddi-examples/uddi-createbulk/src/uddi/createbulk/testStrings.java Fri May  3 12:12:10 2013
@@ -0,0 +1,58 @@
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+package uddi.createbulk;
+
+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 Alex O'Ree
+ */
+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");
+    }
+}

Modified: juddi/branches/juddi-3.2.x/juddi-gui-dsig/src/org/apache/juddi/gui/dsig/XmlSignatureApplet.java
URL: http://svn.apache.org/viewvc/juddi/branches/juddi-3.2.x/juddi-gui-dsig/src/org/apache/juddi/gui/dsig/XmlSignatureApplet.java?rev=1478745&r1=1478744&r2=1478745&view=diff
==============================================================================
--- juddi/branches/juddi-3.2.x/juddi-gui-dsig/src/org/apache/juddi/gui/dsig/XmlSignatureApplet.java (original)
+++ juddi/branches/juddi-3.2.x/juddi-gui-dsig/src/org/apache/juddi/gui/dsig/XmlSignatureApplet.java Fri May  3 12:12:10 2013
@@ -1,6 +1,17 @@
 /*
- * To change this template, choose Tools | Templates
- * and open the template in the editor.
+ * 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.gui.dsig;
 
@@ -59,10 +70,11 @@ import org.xml.sax.InputSource;
 import org.xml.sax.SAXException;
 
 /**
- *
+ * Provides a Java web applet that digitally signs UDDI xml
  * @author Alex O'Ree
  */
 public class XmlSignatureApplet extends java.applet.Applet {
+    private static final long serialVersionUID = 1L;
 
     /**
      * Initializes the applet XmlSignatureApplet

Modified: juddi/branches/juddi-3.2.x/juddi-gui/nbproject/project.properties
URL: http://svn.apache.org/viewvc/juddi/branches/juddi-3.2.x/juddi-gui/nbproject/project.properties?rev=1478745&r1=1478744&r2=1478745&view=diff
==============================================================================
--- juddi/branches/juddi-3.2.x/juddi-gui/nbproject/project.properties (original)
+++ juddi/branches/juddi-3.2.x/juddi-gui/nbproject/project.properties Fri May  3 12:12:10 2013
@@ -14,7 +14,7 @@ build.test.results.dir=${build.dir}/test
 build.web.dir=${build.dir}/web
 build.web.excludes=${build.classes.excludes}
 client.urlPart=
-compile.jsps=false
+compile.jsps=true
 conf.dir=${source.root}/conf
 debug.classpath=${build.classes.dir}:${javac.classpath}
 debug.test.classpath=\

Modified: juddi/branches/juddi-3.2.x/juddi-gui/src/java/org/apache/juddi/webconsole/CrossSiteRequestForgeryException.java
URL: http://svn.apache.org/viewvc/juddi/branches/juddi-3.2.x/juddi-gui/src/java/org/apache/juddi/webconsole/CrossSiteRequestForgeryException.java?rev=1478745&r1=1478744&r2=1478745&view=diff
==============================================================================
--- juddi/branches/juddi-3.2.x/juddi-gui/src/java/org/apache/juddi/webconsole/CrossSiteRequestForgeryException.java (original)
+++ juddi/branches/juddi-3.2.x/juddi-gui/src/java/org/apache/juddi/webconsole/CrossSiteRequestForgeryException.java Fri May  3 12:12:10 2013
@@ -22,16 +22,24 @@ package org.apache.juddi.webconsole;
  */
 public class CrossSiteRequestForgeryException extends Exception {
     //Parameterless Constructor
-
+/**
+ * CrossSiteRequestForgeryException
+ */
     public CrossSiteRequestForgeryException() {
         super(msg, null);
     }
 
-    //Constructor that accepts a message
+    /**
+     * Constructor that accepts a message
+     */
     public CrossSiteRequestForgeryException(String message) {
         super(msg, null);
     }
-
+/**
+ * CrossSiteRequestForgeryException
+ * @param message
+ * @param cause 
+ */
     public CrossSiteRequestForgeryException(String message, Throwable cause) {
         super(msg, null);
     }

Modified: juddi/branches/juddi-3.2.x/juddi-gui/src/java/org/apache/juddi/webconsole/StartupServlet.java
URL: http://svn.apache.org/viewvc/juddi/branches/juddi-3.2.x/juddi-gui/src/java/org/apache/juddi/webconsole/StartupServlet.java?rev=1478745&r1=1478744&r2=1478745&view=diff
==============================================================================
--- juddi/branches/juddi-3.2.x/juddi-gui/src/java/org/apache/juddi/webconsole/StartupServlet.java (original)
+++ juddi/branches/juddi-3.2.x/juddi-gui/src/java/org/apache/juddi/webconsole/StartupServlet.java Fri May  3 12:12:10 2013
@@ -16,6 +16,10 @@ import javax.servlet.ServletContextEvent
  */
 public class StartupServlet implements javax.servlet.ServletContextListener {
 
+    /**
+     * creates a new AES key and stores it to the properties files
+     * @param sce 
+     */
     public void contextInitialized(ServletContextEvent sce) {
         FileOutputStream fos = null;
         try {
@@ -45,6 +49,10 @@ public class StartupServlet implements j
         }
     }
 
+    /**
+     * does nothing
+     * @param sce 
+     */
     public void contextDestroyed(ServletContextEvent sce) {
     }
 }



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


Mime
View raw message