You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@juddi.apache.org by al...@apache.org on 2014/01/08 04:36:12 UTC

svn commit: r1556437 [3/3] - in /juddi/trunk: juddi-client.net/juddi-client.net-sample/org.apache.juddi.client.samples/ juddi-client.net/juddi-client.net/org.apache.juddi.v3.client.config/ juddi-client.net/juddi-client.net/org.apache.juddi.v3.client.ma...

Modified: juddi/trunk/juddi-client/src/main/java/org/apache/juddi/v3/client/config/UDDIClient.java
URL: http://svn.apache.org/viewvc/juddi/trunk/juddi-client/src/main/java/org/apache/juddi/v3/client/config/UDDIClient.java?rev=1556437&r1=1556436&r2=1556437&view=diff
==============================================================================
--- juddi/trunk/juddi-client/src/main/java/org/apache/juddi/v3/client/config/UDDIClient.java (original)
+++ juddi/trunk/juddi-client/src/main/java/org/apache/juddi/v3/client/config/UDDIClient.java Wed Jan  8 03:36:11 2014
@@ -45,6 +45,7 @@ import org.uddi.api_v3.CategoryBag;
 import org.uddi.api_v3.KeyedReference;
 import org.uddi.api_v3.TModelInstanceDetails;
 import org.uddi.api_v3.TModelInstanceInfo;
+
 /**
  * <p>The UDDIClient is the main entry point for using the jUDDI client. The UDDICLient
  * provides a simple way to get interact with a UDDI registry using the UDDI v3 API.</p>
@@ -293,8 +294,6 @@ public class UDDIClient {
      * Removes the service and all of its bindingTemplates of the annotated
      * classes.
      *
-     * @throws TransportException
-     * @throws RemoteException
      */
     public void unRegisterAnnotatedServices() {
         Map<String, UDDIClerk> clerks = clientConfig.getUDDIClerks();
@@ -335,7 +334,7 @@ public class UDDIClient {
                     }
                     if (removeServiceWithNoBindingTemplates) {
                         try {
-                            BusinessService existingService = clerk.findService(businessService.getServiceKey(), clerk.getUDDINode().getApiNode());
+                            BusinessService existingService = clerk.getServiceDetail(businessService.getServiceKey(), clerk.getUDDINode().getApiNode());
                             if (existingService.getBindingTemplates() == null || existingService.getBindingTemplates().getBindingTemplate().size() == 0) {
                                 clerk.unRegisterService(businessService.getServiceKey(), clerk.getUDDINode().getApiNode());
                             }
@@ -402,7 +401,7 @@ public class UDDIClient {
      * Gets the UDDI Clerk, the entry point into many functions of the juddi
      * client
      *
-     * @param clerkName - This references the uddi/client/clern@name of the
+     * @param clerkName - This references the uddi/client/clerk@name of the
      * juddi client config file. it stores credentials if necessary and
      * associates it with a particular UDDI node (server/cluster) If not
      * specificed, the value of "default" will be used.
@@ -418,11 +417,7 @@ public class UDDIClient {
     /**
      * Registers services to UDDI using a clerk, and the uddi.xml configuration.
      *
-     * @throws WSDLException
-     * @throws TransportException
-     * @throws ConfigurationException
-     * @throws RemoteException
-     */
+          */
     public void registerWSDLs() {
         Map<String, UDDIClerk> uddiClerks = clientConfig.getUDDIClerks();
         if (uddiClerks.size() > 0) {
@@ -432,6 +427,9 @@ public class UDDIClient {
         }
     }
 
+    /**
+     * unregisters all config defined wsdls
+     */
     public void unRegisterWSDLs() {
         Map<String, UDDIClerk> uddiClerks = clientConfig.getUDDIClerks();
         if (uddiClerks.size() > 0) {

Modified: juddi/trunk/juddi-client/src/main/java/org/apache/juddi/v3/client/config/XRegistration.java
URL: http://svn.apache.org/viewvc/juddi/trunk/juddi-client/src/main/java/org/apache/juddi/v3/client/config/XRegistration.java?rev=1556437&r1=1556436&r2=1556437&view=diff
==============================================================================
--- juddi/trunk/juddi-client/src/main/java/org/apache/juddi/v3/client/config/XRegistration.java (original)
+++ juddi/trunk/juddi-client/src/main/java/org/apache/juddi/v3/client/config/XRegistration.java Wed Jan  8 03:36:11 2014
@@ -70,7 +70,7 @@ public class XRegistration {
 	public void xRegisterBusiness() {
 		BusinessEntity businessEntity;
 		try {
-			businessEntity = fromClerk.findBusiness(entityKey,fromClerk.getUDDINode().getApiNode());
+			businessEntity = fromClerk.getBusinessDetail(entityKey,fromClerk.getUDDINode().getApiNode());
 			log.info("xregister business " + businessEntity.getName().get(0).getValue() + " + from "
 					+ fromClerk.getName() + " to " + toClerk.getName() + ".");
 			//not bringing over the services. They need to be explicitly copied using xRegisterService.
@@ -87,7 +87,7 @@ public class XRegistration {
 	public void xRegisterBusinessAndServices() {
 		BusinessEntity businessEntity;
 		try {
-			businessEntity = fromClerk.findBusiness(entityKey,fromClerk.getUDDINode().getApiNode());
+			businessEntity = fromClerk.getBusinessDetail(entityKey,fromClerk.getUDDINode().getApiNode());
 			log.info("xregister business " + businessEntity.getName().get(0).getValue() + " + from "
 					+ fromClerk.getName() + " to " + toClerk.getName() + " including all services owned by this business.");
 			toClerk.register(businessEntity,toClerk.getUDDINode().getApiNode());
@@ -101,7 +101,7 @@ public class XRegistration {
 	public void xRegisterService() {
 		BusinessService businessService;
 		try {
-			businessService = fromClerk.findService(entityKey,fromClerk.getUDDINode().getApiNode());
+			businessService = fromClerk.getServiceDetail(entityKey,fromClerk.getUDDINode().getApiNode());
 			log.info("xregister service " + businessService.getName().get(0).getValue() + " + from "
 					+ fromClerk.getName() + " to " + toClerk.getName());
 			businessService.setBindingTemplates(null);
@@ -116,7 +116,7 @@ public class XRegistration {
 	public void xRegisterServiceAndBindings() {
 		BusinessService businessService;
 		try {
-			businessService = fromClerk.findService(entityKey,fromClerk.getUDDINode().getApiNode());
+			businessService = fromClerk.getServiceDetail(entityKey,fromClerk.getUDDINode().getApiNode());
 			log.info("xregister service " + businessService.getName().get(0).getValue() + " + from "
 					+ fromClerk.getName() + " to " + toClerk.getName());
 			toClerk.register(businessService,toClerk.getUDDINode().getApiNode());
@@ -129,7 +129,7 @@ public class XRegistration {
 	 */
 	public void xRegisterServiceBinding() {
 		try {
-			BindingTemplate bindingTemplate = fromClerk.findServiceBinding(entityKey,fromClerk.getUDDINode().getApiNode());
+			BindingTemplate bindingTemplate = fromClerk.getServiceBindingDetail(entityKey,fromClerk.getUDDINode().getApiNode());
 			log.info("xregister binding " + bindingTemplate.getBindingKey()+ " + from "
 					+ fromClerk.getName() + " to " + toClerk.getName());
 			toClerk.register(bindingTemplate,toClerk.getUDDINode().getApiNode());

Modified: juddi/trunk/juddi-client/src/main/java/org/apache/juddi/v3/client/mapping/ServiceLocator.java
URL: http://svn.apache.org/viewvc/juddi/trunk/juddi-client/src/main/java/org/apache/juddi/v3/client/mapping/ServiceLocator.java?rev=1556437&r1=1556436&r2=1556437&view=diff
==============================================================================
--- juddi/trunk/juddi-client/src/main/java/org/apache/juddi/v3/client/mapping/ServiceLocator.java (original)
+++ juddi/trunk/juddi-client/src/main/java/org/apache/juddi/v3/client/mapping/ServiceLocator.java Wed Jan  8 03:36:11 2014
@@ -232,7 +232,7 @@ public class ServiceLocator {
 	private Topology lookupEndpointInUDDI(String serviceKey) throws RemoteException, ConfigurationException, TransportException {
 		Topology topology = null;
 		
-		BusinessService service = clerk.findService(serviceKey);
+		BusinessService service = clerk.getServiceDetail(serviceKey);
 		if (service==null) {
 			log.warn("No Service with key " + serviceKey + " was found in the registry.");
 			//TODO find service by tModel

Modified: juddi/trunk/juddi-client/src/main/java/org/apache/juddi/v3/client/mapping/wsdl/BPEL2UDDI.java
URL: http://svn.apache.org/viewvc/juddi/trunk/juddi-client/src/main/java/org/apache/juddi/v3/client/mapping/wsdl/BPEL2UDDI.java?rev=1556437&r1=1556436&r2=1556437&view=diff
==============================================================================
--- juddi/trunk/juddi-client/src/main/java/org/apache/juddi/v3/client/mapping/wsdl/BPEL2UDDI.java (original)
+++ juddi/trunk/juddi-client/src/main/java/org/apache/juddi/v3/client/mapping/wsdl/BPEL2UDDI.java Wed Jan  8 03:36:11 2014
@@ -268,7 +268,7 @@ public class BPEL2UDDI extends Annotatio
 	public BusinessService lookupService(String serviceKey) throws RemoteException, ConfigurationException, TransportException {
 		
 		//Checking if this serviceKey already exist
-		BusinessService service = clerk.findService(serviceKey);
+		BusinessService service = clerk.getServiceDetail(serviceKey);
 		return service;
 	}
 	/**

Modified: juddi/trunk/juddi-client/src/main/java/org/apache/juddi/v3/client/mapping/wsdl/WSDL2UDDI.java
URL: http://svn.apache.org/viewvc/juddi/trunk/juddi-client/src/main/java/org/apache/juddi/v3/client/mapping/wsdl/WSDL2UDDI.java?rev=1556437&r1=1556436&r2=1556437&view=diff
==============================================================================
--- juddi/trunk/juddi-client/src/main/java/org/apache/juddi/v3/client/mapping/wsdl/WSDL2UDDI.java (original)
+++ juddi/trunk/juddi-client/src/main/java/org/apache/juddi/v3/client/mapping/wsdl/WSDL2UDDI.java Wed Jan  8 03:36:11 2014
@@ -734,7 +734,7 @@ public class WSDL2UDDI {
     private BusinessService lookupService(String serviceKey) throws RemoteException, ConfigurationException, TransportException {
 
         //Checking if this serviceKey already exist
-        BusinessService service = clerk.findService(serviceKey);
+        BusinessService service = clerk.getServiceDetail(serviceKey);
         return service;
     }
 

Modified: juddi/trunk/juddi-examples/create-partition/src/main/java/org/apache/juddi/example/partition/SimpleCreateTmodelPartition.java
URL: http://svn.apache.org/viewvc/juddi/trunk/juddi-examples/create-partition/src/main/java/org/apache/juddi/example/partition/SimpleCreateTmodelPartition.java?rev=1556437&r1=1556436&r2=1556437&view=diff
==============================================================================
--- juddi/trunk/juddi-examples/create-partition/src/main/java/org/apache/juddi/example/partition/SimpleCreateTmodelPartition.java (original)
+++ juddi/trunk/juddi-examples/create-partition/src/main/java/org/apache/juddi/example/partition/SimpleCreateTmodelPartition.java Wed Jan  8 03:36:11 2014
@@ -17,9 +17,12 @@
 package org.apache.juddi.example.partition;
 
 import java.util.Properties;
+import javax.xml.ws.BindingProvider;
+import org.apache.commons.configuration.ConfigurationException;
+import org.apache.juddi.v3.client.config.UDDIClerk;
 
 import org.apache.juddi.v3.client.config.UDDIClient;
-import org.apache.juddi.v3.client.config.UDDIClientContainer;
+import org.apache.juddi.v3.client.config.UDDINode;
 import org.apache.juddi.v3.client.transport.Transport;
 import org.uddi.api_v3.AuthToken;
 import org.uddi.api_v3.BindingTemplates;
@@ -30,7 +33,6 @@ import org.uddi.api_v3.Name;
 import org.uddi.api_v3.SaveTModel;
 import org.uddi.api_v3.TModel;
 import org.uddi.api_v3.TModelDetail;
-import org.uddi.v3_service.UDDIInquiryPortType;
 import org.uddi.v3_service.UDDIPublicationPortType;
 import org.uddi.v3_service.UDDISecurityPortType;
 
@@ -42,188 +44,193 @@ import org.uddi.v3_service.UDDISecurityP
  */
 public class SimpleCreateTmodelPartition {
 
-    private static UDDISecurityPortType security = null;
-    private static UDDIPublicationPortType publish = null;
+        private static UDDISecurityPortType security = null;
+        private static UDDIPublicationPortType publish = null;
 
-    /**
-     * This sets up the ws proxies using uddi.xml in META-INF
-     */
-    public SimpleCreateTmodelPartition() {
-        try {
-	    	// create a manager and read the config in the archive; 
-	    	// you can use your config file name
-	    	UDDIClient uddiClient = new UDDIClient("META-INF/partition-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 = uddiClient.getTransport("default");
-	    	// Now you create a reference to the UDDI API
-	
-	        security = transport.getUDDISecurityService();
-	        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;
-        }
-        SimpleCreateTmodelPartition sp = new SimpleCreateTmodelPartition();
-        sp.Go(args);
-    }
-
-    public void Go(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
-            }
-
-			
-			//Note: when creating a tModel Key Generator, aka Partition, you MUST follow the below pattern
-			//for jUDDI, the following is required
-			//	Name
-			//	CategoryBag/KR for the below fixed values
-			//	a tModelKey that starts with uddi:<something>:keygenerator - recommended all lower case
-
-            String key = GetAuthKey("uddi", "uddi", AuthStyle.UDDI_AUTH);
-            SaveTModel st = new SaveTModel();
-            st.setAuthInfo(key);
-            TModel tm = new TModel();
-            tm.setName(new Name());
-            tm.getName().setValue("My Company's Keymodel generator");
-            tm.getName().setLang("en");
-            tm.setCategoryBag(new CategoryBag());
-            KeyedReference kr = new KeyedReference();
-            kr.setTModelKey("uddi:uddi.org:categorization:types");
-            kr.setKeyName("uddi-org:keyGenerator");
-            kr.setKeyValue("keyGenerator");
-            tm.getCategoryBag().getKeyedReference().add(kr);
-            tm.setTModelKey("uddi:www.mycoolcompany.com:keygenerator");
-            st.getTModel().add(tm);
-            TModelDetail saveTModel = publish.saveTModel(st);
-            System.out.println("Creation of Partition Success!");
-
-            tm = new TModel();
-            tm.setName(new Name());
-            tm.getName().setValue("My Company's Department");
-            tm.getName().setLang("en");
-            tm.setTModelKey("uddi:www.mycoolcompany.com:department");
-            st.getTModel().add(tm);
-            saveTModel = publish.saveTModel(st);
-            System.out.println("Creation of tModel Department Success!");
-            
-             tm = new TModel();
-            tm.setName(new Name());
-            tm.getName().setValue("My Company's Authentication Method");
-            tm.getName().setLang("en");
-            tm.setTModelKey("uddi:www.mycoolcompany.com:authmode");
-            st.getTModel().add(tm);
-            saveTModel = publish.saveTModel(st);
-            System.out.println("Creation of tModel Auth Mode Success!");
-
-
-
-        } catch (Exception e) {
-            e.printStackTrace();
-        }
-    }
-
-    /**
-     * 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 
-            //essentially a pointer to another UDDI registry) or a WSDL Deployment
-            //From an end client's perspective, all you really want is the endpoint.
-
-            //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());
-            }
-
-        }
-    }
-
-    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]);
-            }
+        private static UDDIClient uddiClient = null;
+
+        /**
+         * This sets up the ws proxies using uddi.xml in META-INF
+         */
+        public SimpleCreateTmodelPartition() {
+                try {
+                        // create a manager and read the config in the archive; 
+                        // you can use your config file name
+                        uddiClient = new UDDIClient("META-INF/partition-uddi.xml");
+                        uddiClient.start();
+
+                        // 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 = uddiClient.getTransport("default");
+                        // Now you create a reference to the UDDI API
+
+                        security = transport.getUDDISecurityService();
+                        publish = transport.getUDDIPublishService();
+                } catch (Exception e) {
+                        e.printStackTrace();
+                }
+        }
+
+        private static void DisplayHelp() {
+                //TODO
+        }
+
+        /**
+         * Main entry point
+         *
+         * @param args
+         */
+        public static void main(String args[]) throws ConfigurationException {
+                if (args.length == 1 && args[0].equalsIgnoreCase("help")) {
+                        DisplayHelp();
+                        return;
+                }
+                SimpleCreateTmodelPartition sp = new SimpleCreateTmodelPartition();
+                sp.TmodelsTheLongAndHardWay(args);
+                sp.TmodelsTheEasyWay(args);
+                uddiClient.stop();
+        }
+
+        public void TmodelsTheEasyWay(String[] args) {
+                try {
+                        
+                        //This reads from the config file
+                        UDDIClerk clerk = uddiClient.getClerk("defaultClerk");
+                        //Since the pass isn't set there, we have to provide it. Pist. it could be in the config file
+                        clerk.setPublisher("uddi");     //username
+                        clerk.setPassword("uddi");     //pass
+                        
+
+                        TModel keygen = UDDIClerk.createKeyGenator("www.mycoolcompany.com", "My Company's Keymodel generator", "en");
+                        clerk.register(keygen);
+                        System.out.println("Creation of Partition Success!");
+
+
+                        //Now lets make a few tModels using the new domain
+                        TModel tm = new TModel();
+                        tm.setName(new Name());
+                        tm.getName().setValue("My Company's Department");
+                        tm.getName().setLang("en");
+                        tm.setTModelKey("uddi:www.mycoolcompany.com:department");
+                        clerk.register(tm);
+                        System.out.println("Creation of tModel Department Success!");
+
+                        tm = new TModel();
+                        tm.setName(new Name());
+                        tm.getName().setValue("My Company's Authentication Method");
+                        tm.getName().setLang("en");
+                        tm.setTModelKey("uddi:www.mycoolcompany.com:authmode");
+                        clerk.register(tm);
+                        System.out.println("Creation of tModel Auth Mode Success!");
+
+                } catch (Exception e) {
+                        e.printStackTrace();
+                }
+        }
+
+        public void TmodelsTheLongAndHardWay(String[] args) {
+                try {
+                        //TODO this is where you, the developer need to find out if your UDDI server
+                        //supports UDDI's auth tokens or not. jUDDI does, so moving onwards.
+                        AuthStyle style = AuthStyle.UDDI_AUTH;
+                        //Login
+                        String key = GetAuthKey("uddi", "password", style);
+
+                        //Note: when creating a tModel Key Generator, aka Partition, you MUST follow the below pattern
+                        //for jUDDI, the following is required
+                        //	Name
+                        //	CategoryBag/KR for the below fixed values
+                        //	a tModelKey that starts with uddi:<something>:keygenerator - all lower case
+                        //First, Here's the long way to do it to make a Key Generator tModel.
+                        SaveTModel st = new SaveTModel();
+                        st.setAuthInfo(key);
+                        TModel tm = new TModel();
+                        tm.setName(new Name());
+                        tm.getName().setValue("My Company's Keymodel generator");
+                        tm.getName().setLang("en");
+                        tm.setCategoryBag(new CategoryBag());
+                        KeyedReference kr = new KeyedReference();
+                        kr.setTModelKey("uddi:uddi.org:categorization:types");
+                        kr.setKeyName("uddi-org:keyGenerator");
+                        kr.setKeyValue("keyGenerator");
+                        tm.getCategoryBag().getKeyedReference().add(kr);
+                        tm.setTModelKey("uddi:www.mycoolcompany.com:keygenerator");
+                        st.getTModel().add(tm);
+                        TModelDetail saveTModel = publish.saveTModel(st);
+                        System.out.println("Creation of Partition Success!");
+
+                        //Here's the easy and fun way!
+                        TModel keygen = UDDIClerk.createKeyGenator("www.mycoolcompany.com", "My Company's Keymodel generator", "en");
+                        //st = new SaveTModel();
+                        //st.setAuthInfo(key);
+                        //st.getTModel().add(keygen);
+                        //saveTModel = publish.saveTModel(st);
+                        
+
+                        //Now lets make a few tModels using the new domain
+                        tm = new TModel();
+                        tm.setName(new Name());
+                        tm.getName().setValue("My Company's Department");
+                        tm.getName().setLang("en");
+                        tm.setTModelKey("uddi:www.mycoolcompany.com:department");
+                        st.getTModel().add(tm);
+                        saveTModel = publish.saveTModel(st);
+                        System.out.println("Creation of tModel Department Success!");
+
+                        tm = new TModel();
+                        tm.setName(new Name());
+                        tm.getName().setValue("My Company's Authentication Method");
+                        tm.getName().setLang("en");
+                        tm.setTModelKey("uddi:www.mycoolcompany.com:authmode");
+                        st.getTModel().add(tm);
+                        saveTModel = publish.saveTModel(st);
+                        System.out.println("Creation of tModel Auth Mode Success!");
+
+                } catch (Exception e) {
+                        e.printStackTrace();
+                }
+        }
+
+        
+        private enum AuthStyle {
+
+                HTTP,
+                UDDI_AUTH
+
+        }
+
+        /**
+         * 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) {
+                switch (style) {
+                        case HTTP:
+                                ((BindingProvider) publish).getRequestContext().put(BindingProvider.USERNAME_PROPERTY, username);
+                                ((BindingProvider) publish).getRequestContext().put(BindingProvider.PASSWORD_PROPERTY, password);
+                                return null;
+                        case UDDI_AUTH:
+                                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(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;
         }
-        return p;
-    }
 }

Modified: juddi/trunk/juddi-examples/create-partition/src/main/resources/META-INF/partition-uddi.xml
URL: http://svn.apache.org/viewvc/juddi/trunk/juddi-examples/create-partition/src/main/resources/META-INF/partition-uddi.xml?rev=1556437&r1=1556436&r2=1556437&view=diff
==============================================================================
--- juddi/trunk/juddi-examples/create-partition/src/main/resources/META-INF/partition-uddi.xml (original)
+++ juddi/trunk/juddi-examples/create-partition/src/main/resources/META-INF/partition-uddi.xml Wed Jan  8 03:36:11 2014
@@ -1,32 +1,36 @@
 <?xml version="1.0" encoding="ISO-8859-1" ?>
 <uddi xmlns="urn:juddi-apache-org:v3_client" xsi:schemaLocation="uddi-client classpath:xsd/uddi-client.xsd">
-    <reloadDelay>5000</reloadDelay>
-    <client name="example-client">
-		<nodes>
-			<node>
-			    <!-- required 'default' node -->
-				<name>default</name> 
-                <properties>
-                    <property name="serverName" value="localhost"/>
-                    <property name="serverPort" value="8080"/>
-					<!-- for UDDI nodes that use HTTP u/p, using the following 
-					<property name="basicAuthUsername" value="root" />
-					<property name="basicAuthPassword" value="password" />
-					<property name="basicAuthPasswordIsEncrypted" value="false" />
-					<property name="basicAuthPasswordCryptoProvider" value="org.apache.juddi.v3.client.crypto.AES128Cryptor (an example)" />-->
-                </properties>
-				<description>Main jUDDI node</description>
-				<!-- JAX-WS Transport -->
-				<proxyTransport>org.apache.juddi.v3.client.transport.JAXWSTransport</proxyTransport>
-				<custodyTransferUrl>http://${serverName}:${serverPort}/juddiv3/services/custody-transfer</custodyTransferUrl>
-				<inquiryUrl>http://${serverName}:${serverPort}/juddiv3/services/inquiry</inquiryUrl>
-				<inquiryRESTUrl>http://${serverName}:${serverPort}/juddiv3/services/inquiryRest</inquiryRESTUrl>
-		        <publishUrl>http://${serverName}:${serverPort}/juddiv3/services/publish</publishUrl>
-		        <securityUrl>http://${serverName}:${serverPort}/juddiv3/services/security</securityUrl>
-				<subscriptionUrl>http://${serverName}:${serverPort}/juddiv3/services/subscription</subscriptionUrl>
-				<subscriptionListenerUrl>http://${serverName}:${serverPort}/juddiv3/services/subscription-listener</subscriptionListenerUrl>
-				<juddiApiUrl>http://${serverName}:${serverPort}/juddiv3/services/juddi-api</juddiApiUrl>
-			</node>
-		</nodes>
-	</client>
+        <reloadDelay>5000</reloadDelay>
+        <client name="example-client">
+                <nodes>
+                        <node>
+                                <!-- required 'default' node -->
+                                <name>default</name> 
+                                <properties>
+                                        <property name="serverName" value="localhost"/>
+                                        <property name="serverPort" value="8080"/>
+                                        <!-- for UDDI nodes that use HTTP u/p, using the following 
+                                        <property name="basicAuthUsername" value="root" />
+                                        <property name="basicAuthPassword" value="password" />
+                                        <property name="basicAuthPasswordIsEncrypted" value="false" />
+                                        <property name="basicAuthPasswordCryptoProvider" value="org.apache.juddi.v3.client.crypto.AES128Cryptor (an example)" />-->
+                                </properties>
+                                <description>Main jUDDI node</description>
+                                <!-- JAX-WS Transport -->
+                                <proxyTransport>org.apache.juddi.v3.client.transport.JAXWSTransport</proxyTransport>
+                                <custodyTransferUrl>http://${serverName}:${serverPort}/juddiv3/services/custody-transfer</custodyTransferUrl>
+                                <inquiryUrl>http://${serverName}:${serverPort}/juddiv3/services/inquiry</inquiryUrl>
+                                <inquiryRESTUrl>http://${serverName}:${serverPort}/juddiv3/services/inquiryRest</inquiryRESTUrl>
+                                <publishUrl>http://${serverName}:${serverPort}/juddiv3/services/publish</publishUrl>
+                                <securityUrl>http://${serverName}:${serverPort}/juddiv3/services/security</securityUrl>
+                                <subscriptionUrl>http://${serverName}:${serverPort}/juddiv3/services/subscription</subscriptionUrl>
+                                <subscriptionListenerUrl>http://${serverName}:${serverPort}/juddiv3/services/subscription-listener</subscriptionListenerUrl>
+                                <juddiApiUrl>http://${serverName}:${serverPort}/juddiv3/services/juddi-api</juddiApiUrl>
+                        </node>
+                </nodes>
+                <clerks>
+                        <clerk node="default" name="defaultClerk" password="" publisher="username"></clerk>
+                        
+                </clerks>
+        </client>
 </uddi>



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