juddi-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ks...@apache.org
Subject svn commit: r1452614 - in /juddi/trunk/juddi-examples: ./ hello-world/src/main/java/org/apache/juddi/example/helloworld/ simple-browse/ simple-browse/src/ simple-browse/src/main/ simple-browse/src/main/java/ simple-browse/src/main/java/org/ simple-brow...
Date Tue, 05 Mar 2013 01:13:52 GMT
Author: kstam
Date: Tue Mar  5 01:13:52 2013
New Revision: 1452614

URL: http://svn.apache.org/r1452614
Log:
JUDDI-555 adding additional examples

applying patch by Alex O'Ree

Added:
    juddi/trunk/juddi-examples/simple-browse/
    juddi/trunk/juddi-examples/simple-browse/README.txt
    juddi/trunk/juddi-examples/simple-browse/pom.xml
    juddi/trunk/juddi-examples/simple-browse/src/
    juddi/trunk/juddi-examples/simple-browse/src/main/
    juddi/trunk/juddi-examples/simple-browse/src/main/java/
    juddi/trunk/juddi-examples/simple-browse/src/main/java/org/
    juddi/trunk/juddi-examples/simple-browse/src/main/java/org/apache/
    juddi/trunk/juddi-examples/simple-browse/src/main/java/org/apache/juddi/
    juddi/trunk/juddi-examples/simple-browse/src/main/java/org/apache/juddi/example/
    juddi/trunk/juddi-examples/simple-browse/src/main/java/org/apache/juddi/example/browse/
    juddi/trunk/juddi-examples/simple-browse/src/main/java/org/apache/juddi/example/browse/SimpleBrowse.java
    juddi/trunk/juddi-examples/simple-browse/src/main/resources/
    juddi/trunk/juddi-examples/simple-browse/src/main/resources/META-INF/
    juddi/trunk/juddi-examples/simple-browse/src/main/resources/META-INF/simple-browse-uddi.xml
Modified:
    juddi/trunk/juddi-examples/hello-world/src/main/java/org/apache/juddi/example/helloworld/HelloWorld.java
    juddi/trunk/juddi-examples/pom.xml

Modified: juddi/trunk/juddi-examples/hello-world/src/main/java/org/apache/juddi/example/helloworld/HelloWorld.java
URL: http://svn.apache.org/viewvc/juddi/trunk/juddi-examples/hello-world/src/main/java/org/apache/juddi/example/helloworld/HelloWorld.java?rev=1452614&r1=1452613&r2=1452614&view=diff
==============================================================================
--- juddi/trunk/juddi-examples/hello-world/src/main/java/org/apache/juddi/example/helloworld/HelloWorld.java
(original)
+++ juddi/trunk/juddi-examples/hello-world/src/main/java/org/apache/juddi/example/helloworld/HelloWorld.java
Tue Mar  5 01:13:52 2013
@@ -17,7 +17,6 @@
 package org.apache.juddi.example.helloworld;
 
 import org.uddi.api_v3.*;
-import org.apache.juddi.v3.client.ClassUtil;
 import org.apache.juddi.v3.client.config.UDDIClerkManager;
 import org.apache.juddi.v3.client.config.UDDIClientContainer;
 import org.apache.juddi.v3.client.transport.Transport;

Modified: juddi/trunk/juddi-examples/pom.xml
URL: http://svn.apache.org/viewvc/juddi/trunk/juddi-examples/pom.xml?rev=1452614&r1=1452613&r2=1452614&view=diff
==============================================================================
--- juddi/trunk/juddi-examples/pom.xml (original)
+++ juddi/trunk/juddi-examples/pom.xml Tue Mar  5 01:13:52 2013
@@ -28,6 +28,7 @@
     </prerequisites>
     <modules>
        <module>hello-world</module>
+       <module>simple-browse</module>
        <module>simple-publish</module>
        <module>uddi-annotations</module>
     </modules>

Added: juddi/trunk/juddi-examples/simple-browse/README.txt
URL: http://svn.apache.org/viewvc/juddi/trunk/juddi-examples/simple-browse/README.txt?rev=1452614&view=auto
==============================================================================
--- juddi/trunk/juddi-examples/simple-browse/README.txt (added)
+++ juddi/trunk/juddi-examples/simple-browse/README.txt Tue Mar  5 01:13:52 2013
@@ -0,0 +1,124 @@
+This example contains one class: the SimplePublish.java. When
+executed it will obtain an AuthToken and use it to publish
+a Publisher, a Business and a Service. 
+
+1. Start the jUDDI-server (juddi-tomcat or juddi-bundle)
+
+2. Check the settings of the META-INF/uddi.xml, to make sure the serverName and serverPort
are set correctly.
+
+3. mvn -Pdemo test
+
+
+You should see the following output being written to the console:
+
+    root AUTHTOKEN = authtoken:4b627696-c4b4-4343-bdae-6866e242bff3
+    ===============================================
+    Business Key: uddi:juddi.apache.org:businesses-asf
+    Name: An Apache jUDDI Node 
+    Name: This is a UDDI v3 registry node as implemented by Apache jUDDI. 
+    Services:
+    -------------------------------------------
+    Service Key: uddi:juddi.apache.org:services-custodytransfer
+    Owning Business Key: uddi:juddi.apache.org:businesses-asf
+    Name: UDDI Custody and Ownership Transfer Service 
+    -------------------------------------------
+    Service Key: uddi:juddi.apache.org:services-inquiry
+    Owning Business Key: uddi:juddi.apache.org:businesses-asf
+    Name: UDDI Inquiry Service 
+    -------------------------------------------
+    Service Key: uddi:juddi.apache.org:services-publish
+    Owning Business Key: uddi:juddi.apache.org:businesses-asf
+    Name: UDDI Publish Service 
+    -------------------------------------------
+    Service Key: uddi:juddi.apache.org:services-security
+    Owning Business Key: uddi:juddi.apache.org:businesses-asf
+    Name: UDDI Security Service 
+    -------------------------------------------
+    Service Key: uddi:juddi.apache.org:services-subscriptionlistener
+    Owning Business Key: uddi:juddi.apache.org:businesses-asf
+    Name: UDDI Subscription Listener Service 
+    -------------------------------------------
+    Service Key: uddi:juddi.apache.org:services-subscription
+    Owning Business Key: uddi:juddi.apache.org:businesses-asf
+    Name: UDDI Subscription Service 
+    -------------------------------------------
+    Service Key: uddi:juddi.apache.org:services-publisher
+    Owning Business Key: uddi:juddi.apache.org:businesses-asf
+    Name: jUDDI Publisher Service 
+    ===============================================
+    Business Key: uddi:juddi.apache.org:75a21da1-6a48-419b-a54e-57d696cd92f3
+    Name: My Business 
+    Name: 
+    Services:
+    -------------------------------------------
+    Service Key: uddi:juddi.apache.org:82c2d59c-ceb1-4b82-8fbf-121c38fbc147
+    Owning Business Key: uddi:juddi.apache.org:75a21da1-6a48-419b-a54e-57d696cd92f3
+    Name: My Service 
+    Business Detail - key: uddi:juddi.apache.org:businesses-asf
+    Name: An Apache jUDDI Node 
+    CategoryBag: Key Ref: Name= Value=node tModel=uddi:uddi.org:categorization:nodes
+    
+    Business Detail - key: uddi:juddi.apache.org:75a21da1-6a48-419b-a54e-57d696cd92f3
+    Name: My Business 
+    CategoryBag: no data
+    Fetching data for business uddi:juddi.apache.org:businesses-asf
+    Name UDDI Custody and Ownership Transfer Service 
+    Desc Web Service supporting UDDI Custody and Ownership Transfer API 
+    Key uddi:juddi.apache.org:services-custodytransfer
+    Cat bag no data
+    Item is not digitally signed
+    Binding Key: uddi:juddi.apache.org:servicebindings-custodytransfer-ws
+    Access Point: http://localhost:8080/juddiv3//services/custody-transfer?wsdl type wsdlDeployment
+    Name UDDI Inquiry Service 
+    Desc Web Service supporting UDDI Inquiry API 
+    Key uddi:juddi.apache.org:services-inquiry
+    Cat bag no data
+    Item is not digitally signed
+    Binding Key: uddi:juddi.apache.org:servicebindings-inquiry-ws
+    Access Point: http://localhost:8080/juddiv3//services/inquiry?wsdl type wsdlDeployment
+    Name UDDI Publish Service 
+    Desc Web Service supporting UDDI Publish API 
+    Key uddi:juddi.apache.org:services-publish
+    Cat bag no data
+    Item is not digitally signed
+    Binding Key: uddi:juddi.apache.org:servicebindings-publish-ws
+    Access Point: http://localhost:8080/juddiv3//services/publish?wsdl type wsdlDeployment
+    Name UDDI Security Service 
+    Desc Web Service supporting UDDI Security API 
+    Key uddi:juddi.apache.org:services-security
+    Cat bag no data
+    Item is not digitally signed
+    Binding Key: uddi:juddi.apache.org:servicebindings-security-ws
+    Access Point: http://localhost:8080/juddiv3//services/security?wsdl type wsdlDeployment
+    Name UDDI Subscription Listener Service 
+    Desc Web Service supporting UDDI Subscription Listener API 
+    Key uddi:juddi.apache.org:services-subscriptionlistener
+    Cat bag no data
+    Item is not digitally signed
+    Binding Key: uddi:juddi.apache.org:servicebindings-subscriptionlistener-ws
+    Access Point: http://localhost:8080/juddiv3//services/subscription-listener?wsdl type
wsdlDeployment
+    Name UDDI Subscription Service 
+    Desc Web Service supporting UDDI Subscription API 
+    Key uddi:juddi.apache.org:services-subscription
+    Cat bag no data
+    Item is not digitally signed
+    Binding Key: uddi:juddi.apache.org:servicebindings-subscription-ws
+    Access Point: http://localhost:8080/juddiv3//services/subscription?wsdl type wsdlDeployment
+    Name jUDDI Publisher Service 
+    Desc Web Service supporting jUDDI specific API 
+    Key uddi:juddi.apache.org:services-publisher
+    Cat bag no data
+    Item is not digitally signed
+    Binding Key: uddi:juddi.apache.org:servicebindings-publisher-ws
+    Access Point: http://localhost:8080/juddiv3//services/publisher?wsdl type wsdlDeployment
+    ................
+    Fetching data for business uddi:juddi.apache.org:75a21da1-6a48-419b-a54e-57d696cd92f3
+    Name My Service 
+    Desc 
+    Key uddi:juddi.apache.org:82c2d59c-ceb1-4b82-8fbf-121c38fbc147
+    Cat bag no data
+    Item is not digitally signed
+    ................
+
+However since the keys are being generated in this case your keys will differ.
+

Added: juddi/trunk/juddi-examples/simple-browse/pom.xml
URL: http://svn.apache.org/viewvc/juddi/trunk/juddi-examples/simple-browse/pom.xml?rev=1452614&view=auto
==============================================================================
--- juddi/trunk/juddi-examples/simple-browse/pom.xml (added)
+++ juddi/trunk/juddi-examples/simple-browse/pom.xml Tue Mar  5 01:13:52 2013
@@ -0,0 +1,72 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+	<modelVersion>4.0.0</modelVersion>
+	<parent>
+		<groupId>org.apache.juddi.example</groupId>
+		<artifactId>juddi-examples</artifactId>
+		<version>3.1.5-SNAPSHOT</version>
+		<relativePath>../pom.xml</relativePath>
+	</parent>
+	<artifactId>simple-browse</artifactId>
+	<name>jUDDI Example Simple Browse</name>
+	<description>Demonstrates the steps taken to Browse a UDDI directory</description>
+
+
+	<dependencies>
+		<dependency>
+			<groupId>org.apache.juddi</groupId>
+			<artifactId>uddi-ws</artifactId>
+			<version>3.1.5-SNAPSHOT</version>
+		</dependency>
+		<dependency>
+			<groupId>org.apache.juddi</groupId>
+			<artifactId>juddi-client</artifactId>
+			<version>3.1.5-SNAPSHOT</version>
+		</dependency>
+	</dependencies>
+
+	<profiles>
+		<profile>
+			<id>default</id>
+			<activation>
+				<activeByDefault>true</activeByDefault>
+			</activation>
+			<build>
+				<plugins>
+					<plugin>
+						<groupId>org.apache.maven.plugins</groupId>
+						<artifactId>maven-surefire-plugin</artifactId>
+						<configuration>
+							<skip>true</skip>
+						</configuration>
+					</plugin>
+				</plugins>
+			</build>
+		</profile>
+		<profile>
+			<id>demo</id>
+			<build>
+				<plugins>
+					<plugin>
+						<groupId>org.codehaus.mojo</groupId>
+						<artifactId>exec-maven-plugin</artifactId>
+						<version>1.1.1</version>
+						<executions>
+							<execution>
+								<phase>test</phase>
+								<goals>
+									<goal>java</goal>
+								</goals>
+								<configuration>
+									<mainClass>org.apache.juddi.example.browse.SimpleBrowse</mainClass>
+								</configuration>
+							</execution>
+						</executions>
+					</plugin>
+				</plugins>
+			</build>
+		</profile>
+	</profiles>
+
+</project>
+

Added: juddi/trunk/juddi-examples/simple-browse/src/main/java/org/apache/juddi/example/browse/SimpleBrowse.java
URL: http://svn.apache.org/viewvc/juddi/trunk/juddi-examples/simple-browse/src/main/java/org/apache/juddi/example/browse/SimpleBrowse.java?rev=1452614&view=auto
==============================================================================
--- juddi/trunk/juddi-examples/simple-browse/src/main/java/org/apache/juddi/example/browse/SimpleBrowse.java
(added)
+++ juddi/trunk/juddi-examples/simple-browse/src/main/java/org/apache/juddi/example/browse/SimpleBrowse.java
Tue Mar  5 01:13:52 2013
@@ -0,0 +1,377 @@
+/*
+ * Copyright 2001-2010 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+package org.apache.juddi.example.browse;
+
+
+import java.util.List;
+import java.util.Properties;
+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.uddi.api_v3.AuthToken;
+import org.uddi.api_v3.BindingTemplates;
+import org.uddi.api_v3.BusinessDetail;
+import org.uddi.api_v3.BusinessInfos;
+import org.uddi.api_v3.BusinessList;
+import org.uddi.api_v3.BusinessService;
+import org.uddi.api_v3.CategoryBag;
+import org.uddi.api_v3.Contacts;
+import org.uddi.api_v3.Description;
+import org.uddi.api_v3.FindBusiness;
+import org.uddi.api_v3.GetAuthToken;
+import org.uddi.api_v3.GetBusinessDetail;
+import org.uddi.api_v3.GetServiceDetail;
+import org.uddi.api_v3.KeyedReference;
+import org.uddi.api_v3.Name;
+import org.uddi.api_v3.ServiceDetail;
+import org.uddi.api_v3.ServiceInfos;
+import org.uddi.v3_service.UDDIInquiryPortType;
+import org.uddi.v3_service.UDDISecurityPortType;
+
+/**
+ * A Simple UDDI Browser that dumps basic information to console
+ *
+ * @author Alex O'Ree
+ */
+public class SimpleBrowse {
+
+    private static UDDISecurityPortType security = null;
+    private static UDDIInquiryPortType inquiry = null;
+
+    /**
+     * This sets up the ws proxies using uddi.xml in META-INF
+     */
+    public SimpleBrowse() {
+        try {
+        	// create a manager and read the config in the archive; 
+        	// you can use your config file name
+        	UDDIClerkManager clerkManager = new UDDIClerkManager("META-INF/simple-browse-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();
+        } 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;
+        }
+        SimpleBrowse sp = new SimpleBrowse();
+        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
+            }
+
+            String token = GetAuthKey("uddi", "uddi", AuthStyle.UDDI_AUTH);
+            BusinessList findBusiness = GetBusinessList(token);
+            PrintBusinessInfo(findBusiness.getBusinessInfos());
+            PrintBusinessDetails(findBusiness.getBusinessInfos(), token);
+            PrintServiceDetailsByBusiness(findBusiness.getBusinessInfos(), token);
+
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+
+    /**
+     * Find all of the registered businesses. This list may be filtered based on
+     * access control rules
+     *
+     * @param token
+     * @return
+     * @throws Exception
+     */
+    private BusinessList GetBusinessList(String token) throws Exception {
+        FindBusiness fb = new FindBusiness();
+        fb.setAuthInfo(token);
+        org.uddi.api_v3.FindQualifiers fq = new org.uddi.api_v3.FindQualifiers();
+        fq.getFindQualifier().add(UDDIConstants.APPROXIMATE_MATCH);
+
+        fb.setFindQualifiers(fq);
+        Name searchname = new Name();
+        searchname.setValue(UDDIConstants.WILDCARD);
+        fb.getName().add(searchname);
+        BusinessList findBusiness = inquiry.findBusiness(fb);
+        return findBusiness;
+
+    }
+
+    /**
+     * Converts category bags of tmodels to a readable string
+     * @param categoryBag
+     * @return 
+     */
+    private String CatBagToString(CategoryBag categoryBag) {
+        StringBuilder sb = new StringBuilder();
+        if (categoryBag == null) {
+            return "no data";
+        }
+        for (int i = 0; i < categoryBag.getKeyedReference().size(); i++) {
+            sb.append(KeyedReferenceToString(categoryBag.getKeyedReference().get(i)));
+        }
+        for (int i = 0; i < categoryBag.getKeyedReferenceGroup().size(); i++) {
+            sb.append("Key Ref Grp: TModelKey=");
+            for (int k = 0; k < categoryBag.getKeyedReferenceGroup().get(i).getKeyedReference().size();
k++) {
+                sb.append(KeyedReferenceToString(categoryBag.getKeyedReferenceGroup().get(i).getKeyedReference().get(k)));
+            }
+        }
+        return sb.toString();
+    }
+
+    
+    private String KeyedReferenceToString(KeyedReference item) {
+        StringBuilder sb = new StringBuilder();
+        sb.append("Key Ref: Name=").
+                append(item.getKeyName()).
+                append(" Value=").
+                append(item.getKeyValue()).
+                append(" tModel=").
+                append(item.getTModelKey()).
+                append(System.getProperty("line.separator"));
+        return sb.toString();
+    }
+
+    
+    private void PrintContacts(Contacts contacts) {
+        if (contacts == null) {
+            return;
+        }
+        for (int i = 0; i < contacts.getContact().size(); i++) {
+            System.out.println("Contact " + i + " type:" + contacts.getContact().get(i).getUseType());
+            for (int k = 0; k < contacts.getContact().get(i).getPersonName().size(); k++)
{
+                System.out.println("Name: " + contacts.getContact().get(i).getPersonName().get(k).getValue());
+            }
+            for (int k = 0; k < contacts.getContact().get(i).getEmail().size(); k++) {
+                System.out.println("Email: " + contacts.getContact().get(i).getEmail().get(k).getValue());
+            }
+            for (int k = 0; k < contacts.getContact().get(i).getAddress().size(); k++)
{
+                System.out.println("Address sort code " + contacts.getContact().get(i).getAddress().get(k).getSortCode());
+                System.out.println("Address use type " + contacts.getContact().get(i).getAddress().get(k).getUseType());
+                System.out.println("Address tmodel key " + contacts.getContact().get(i).getAddress().get(k).getTModelKey());
+                for (int x = 0; x < contacts.getContact().get(i).getAddress().get(k).getAddressLine().size();
x++) {
+                    System.out.println("Address line value " + contacts.getContact().get(i).getAddress().get(k).getAddressLine().get(x).getValue());
+                    System.out.println("Address line key name " + contacts.getContact().get(i).getAddress().get(k).getAddressLine().get(x).getKeyName());
+                    System.out.println("Address line key value " + contacts.getContact().get(i).getAddress().get(k).getAddressLine().get(x).getKeyValue());
+                }
+            }
+            for (int k = 0; k < contacts.getContact().get(i).getDescription().size();
k++) {
+                System.out.println("Desc: " + contacts.getContact().get(i).getDescription().get(k).getValue());
+            }
+            for (int k = 0; k < contacts.getContact().get(i).getPhone().size(); k++) {
+                System.out.println("Phone: " + contacts.getContact().get(i).getPhone().get(k).getValue());
+            }
+        }
+
+    }
+
+    private void PrintServiceDetail(BusinessService get) {
+        if (get == null) {
+            return;
+        }
+        System.out.println("Name " + ListToString(get.getName()));
+        System.out.println("Desc " + ListToDescString(get.getDescription()));
+        System.out.println("Key " + (get.getServiceKey()));
+        System.out.println("Cat bag " + CatBagToString(get.getCategoryBag()));
+        if (!get.getSignature().isEmpty()) {
+            System.out.println("Item is digitally signed");
+        } else {
+            System.out.println("Item is not digitally signed");
+        }
+        PrintBindingTemplates(get.getBindingTemplates());
+    }
+
+    /**
+     * This function is useful for translating UDDI's somewhat complex data format to something
that is more useful.
+     * @param bindingTemplates 
+     */
+    private void PrintBindingTemplates(BindingTemplates bindingTemplates) {
+        if (bindingTemplates == null) {
+            return;
+        }
+        for (int i = 0; i < bindingTemplates.getBindingTemplate().size(); i++) {
+            System.out.println("Binding Key: " + bindingTemplates.getBindingTemplate().get(i).getBindingKey());
+            //TODO The UDDI spec is kind of strange at this point.
+            //An access point could be a URL, a reference to another UDDI binding key, a
hosting redirector (which is 
+            //esscentially a pointer to another UDDI registry) or a WSDL Deployment
+            //From an end client's perspective, all you really want is the endpoint.
+
+            //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]);
+            }
+        }
+        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("Name: " + 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/trunk/juddi-examples/simple-browse/src/main/resources/META-INF/simple-browse-uddi.xml
URL: http://svn.apache.org/viewvc/juddi/trunk/juddi-examples/simple-browse/src/main/resources/META-INF/simple-browse-uddi.xml?rev=1452614&view=auto
==============================================================================
--- juddi/trunk/juddi-examples/simple-browse/src/main/resources/META-INF/simple-browse-uddi.xml
(added)
+++ juddi/trunk/juddi-examples/simple-browse/src/main/resources/META-INF/simple-browse-uddi.xml
Tue Mar  5 01:13:52 2013
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+
+<uddi>
+    <reloadDelay>5000</reloadDelay>
+    <manager name="example-manager">
+		<nodes>
+			<node>
+			    <!-- required 'default' node -->
+				<name>default</name> 
+                <properties>
+                    <property name="serverName" value="localhost"/>
+                    <property name="serverPort" value="8080"/>
+                </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>
+		        <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>
+	</manager>
+</uddi>



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


Mime
View raw message