You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@juddi.apache.org by tc...@apache.org on 2009/10/10 06:14:34 UTC

svn commit: r823788 - in /webservices/juddi/trunk/docs/examples/helloworld: ./ META-INF/ src/ src/org/ src/org/apache/ src/org/apache/juddi/ src/org/apache/juddi/example/ src/org/apache/juddi/example/helloworld/

Author: tcunning
Date: Sat Oct 10 04:14:34 2009
New Revision: 823788

URL: http://svn.apache.org/viewvc?rev=823788&view=rev
Log:
Add command line example of GetAuthToken.

Added:
    webservices/juddi/trunk/docs/examples/helloworld/
    webservices/juddi/trunk/docs/examples/helloworld/META-INF/
    webservices/juddi/trunk/docs/examples/helloworld/META-INF/uddi.xml
    webservices/juddi/trunk/docs/examples/helloworld/README
    webservices/juddi/trunk/docs/examples/helloworld/build.xml
    webservices/juddi/trunk/docs/examples/helloworld/src/
    webservices/juddi/trunk/docs/examples/helloworld/src/org/
    webservices/juddi/trunk/docs/examples/helloworld/src/org/apache/
    webservices/juddi/trunk/docs/examples/helloworld/src/org/apache/juddi/
    webservices/juddi/trunk/docs/examples/helloworld/src/org/apache/juddi/example/
    webservices/juddi/trunk/docs/examples/helloworld/src/org/apache/juddi/example/helloworld/
    webservices/juddi/trunk/docs/examples/helloworld/src/org/apache/juddi/example/helloworld/HelloWorld.java

Added: webservices/juddi/trunk/docs/examples/helloworld/META-INF/uddi.xml
URL: http://svn.apache.org/viewvc/webservices/juddi/trunk/docs/examples/helloworld/META-INF/uddi.xml?rev=823788&view=auto
==============================================================================
--- webservices/juddi/trunk/docs/examples/helloworld/META-INF/uddi.xml (added)
+++ webservices/juddi/trunk/docs/examples/helloworld/META-INF/uddi.xml Sat Oct 10 04:14:34 2009
@@ -0,0 +1,69 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+
+<uddi>
+    <reloadDelay>5000</reloadDelay>
+    <manager name="test-manager">
+		<nodes>
+			<node>
+			    <!-- required 'default' node -->
+				<name>default</name> 
+				<description>Main jUDDI node</description>
+				<properties>
+					<property name="serverName" value="localhost" />
+					<property name="serverPort" value="8080" />
+				</properties>
+				<!-- JAX-WS Transport -->
+				<proxyTransport>org.apache.juddi.v3.client.transport.JAXWSTransport</proxyTransport>
+				<custodyTransferUrl>http://${serverName}:${serverPort}/juddiv3/services/custody-transfer?wsdl</custodyTransferUrl>
+				<inquiryUrl>http://${serverName}:${serverPort}/juddiv3/services/inquiry?wsdl</inquiryUrl>
+		        <publishUrl>http://${serverName}:${serverPort}/juddiv3/services/publish?wsdl</publishUrl>
+		        <securityUrl>http://${serverName}:${serverPort}/juddiv3/services/security?wsdl</securityUrl>
+				<subscriptionUrl>http://${serverName}:${serverPort}/juddiv3/services/subscription?wsdl</subscriptionUrl>
+				<subscriptionListenerUrl>http://${serverName}:${serverPort}/juddiv3/services/subscription-listener?wsdl</subscriptionListenerUrl>
+				<juddiApiUrl>http://${serverName}:${serverPort}/juddiv3/services/juddi-api?wsdl</juddiApiUrl>
+				<!-- In VM Transport Settings 
+				<proxyTransport>org.apache.juddi.v3.client.transport.InVMTransport</proxyTransport>
+				<custodyTransferUrl>org.apache.juddi.api.impl.UDDICustodyTransferImpl</custodyTransferUrl>
+				<inquiryUrl>org.apache.juddi.api.impl.UDDIInquiryImpl</inquiryUrl>
+		        <publishUrl>org.apache.juddi.api.impl.UDDIPublicationImpl</publishUrl>
+		        <securityUrl>org.apache.juddi.api.impl.UDDISecurityImpl</securityUrl>
+				<subscriptionUrl>org.apache.juddi.api.impl.UDDISubscriptionImpl</subscriptionUrl>
+				<subscriptionListenerUrl>org.apache.juddi.api.impl.UDDISubscriptionListenerImpl</subscriptionListenerUrl>
+				<juddiApiUrl>org.apache.juddi.api.impl.JUDDIApiImpl</juddiApiUrl>
+				-->
+				<!-- RMI Transport Settings 
+				<proxyTransport>org.apache.juddi.v3.client.transport.RMITransport</proxyTransport>
+				<custodyTransferUrl>/juddiv3/UDDICustodyTransferService</custodyTransferUrl>
+				<inquiryUrl>/juddiv3/UDDIInquiryService</inquiryUrl>
+		        <publishUrl>/juddiv3/UDDIPublicationService</publishUrl>
+		        <securityUrl>/juddiv3/UDDISecurityService</securityUrl>
+				<subscriptionUrl>/juddiv3/UDDISubscriptionService</subscriptionUrl>
+				<subscriptionListenerUrl>/juddiv3/UDDISubscriptionListenerService</subscriptionListenerUrl>
+				<juddiApiUrl>/juddiv3/JUDDIApiService</juddiApiUrl>
+				<javaNamingFactoryInitial>org.jnp.interfaces.NamingContextFactory</javaNamingFactoryInitial>
+				<javaNamingFactoryUrlPkgs>org.jboss.naming</javaNamingFactoryUrlPkgs>
+				<javaNamingProviderUrl>jnp://localhost:1099</javaNamingProviderUrl>
+				-->
+			</node>
+			<node>
+				<name>localhost</name>
+				<description>jUDDI node in other Department</description>
+				<proxyTransport>org.apache.juddi.v3.client.transport.JAXWSTransport</proxyTransport>
+				<custodyTransferUrl>http://localhost:8080/juddiv3/services/custody-transfer?wsdl</custodyTransferUrl>
+				<inquiryUrl>http://localhost:8080/juddiv3/services/inquiry?wsdl</inquiryUrl>
+		        <publishUrl>http://localhost:8080/juddiv3/services/publish?wsdl</publishUrl>
+		        <securityUrl>http://localhost:8080/juddiv3/services/security?wsdl</securityUrl>
+				<subscriptionUrl>http://localhost:8080/juddiv3/services/subscription?wsdl</subscriptionUrl>
+				<subscriptionListenerUrl>http://localhost:8080/juddiv3/services/subscription-listener?wsdl</subscriptionListenerUrl>
+				<juddiApiUrl>http://localhost:8080/juddiv3/services/juddi-api?wsdl</juddiApiUrl>
+			</node>
+		</nodes>
+		<clerks registerOnStartup="false">
+		   <clerk name="default" node="default" publisher="root" password="root"/>
+	       <clerk name="localhostroot" node="localhost"     publisher="root" password="root"/>
+	       <xregister>
+		       <service bindingKey="uddi:juddi.apache.org:servicebindings-subscriptionlistener-ws" fromClerk="default" toClerk="localhostroot"/>
+		   </xregister>
+	   </clerks>
+	</manager>
+</uddi>

Added: webservices/juddi/trunk/docs/examples/helloworld/README
URL: http://svn.apache.org/viewvc/webservices/juddi/trunk/docs/examples/helloworld/README?rev=823788&view=auto
==============================================================================
--- webservices/juddi/trunk/docs/examples/helloworld/README (added)
+++ webservices/juddi/trunk/docs/examples/helloworld/README Sat Oct 10 04:14:34 2009
@@ -0,0 +1,4 @@
+This example is a command line demonstration of how to interact with JUDDI.  
+
+For further examples, see the uddi-client module, which includes a number
+of unit tests that exercise API other than just the security API.

Added: webservices/juddi/trunk/docs/examples/helloworld/build.xml
URL: http://svn.apache.org/viewvc/webservices/juddi/trunk/docs/examples/helloworld/build.xml?rev=823788&view=auto
==============================================================================
--- webservices/juddi/trunk/docs/examples/helloworld/build.xml (added)
+++ webservices/juddi/trunk/docs/examples/helloworld/build.xml Sat Oct 10 04:14:34 2009
@@ -0,0 +1,39 @@
+<project name="helloworld" default="run" basedir=".">
+
+<property name="classes" value="build/classes"/>
+<property name="juddi.parent.dir" value="../../.."/>
+<property name="src.dir" value="src"/>
+
+<path id="exec-classpath">
+	<pathelement location="." />
+	<pathelement location="${classes}"/>
+	<pathelement location="${basedir}/src" />
+	<fileset dir="${juddi.parent.dir}/juddi-core/target" includes="*.jar" /> 	<fileset dir="${juddi.parent.dir}/uddi-client/target" includes="*.jar"/>
+	<fileset dir="${juddi.parent.dir}/uddi-client/target/juddi-tomcat-3.0.0.SNAPSHOT/lib/" includes="log4j-*.jar"/>
+	<fileset dir="${juddi.parent.dir}/juddiv3-war/target/juddi/WEB-INF/lib" includes="commons-configuration-*.jar, commons-lang-*.jar"/>
+	<fileset dir="${juddi.parent.dir}/uddi-client/target/juddi-tomcat-3.0.0.SNAPSHOT/webapps/juddiv3/WEB-INF/lib" includes="commons-logging-*.jar, commons-collections-*.jar"/>
+	<fileset dir="${juddi.parent.dir}/uddi-ws/target" includes="*.jar"/>
+</path>
+
+<target name="clean">
+	<delete dir="build"/>
+</target>
+
+<target name="compile">
+	<mkdir dir="${classes}"/>
+	<javac srcdir="${src.dir}" destdir="${classes}" 
+		debug="true" deprecation="true">
+		<classpath refid="exec-classpath" />
+	</javac>
+</target>
+
+<target name="run" depends="compile">
+	<echo>HelloWorld Grab AuthToken</echo>
+	<java fork="yes" 
+		classname="org.apache.juddi.examples.helloworld.HelloWorld"
+		failonerror="true">
+		<classpath refid="exec-classpath"/>
+	</java>
+</target>
+
+</project>

Added: webservices/juddi/trunk/docs/examples/helloworld/src/org/apache/juddi/example/helloworld/HelloWorld.java
URL: http://svn.apache.org/viewvc/webservices/juddi/trunk/docs/examples/helloworld/src/org/apache/juddi/example/helloworld/HelloWorld.java?rev=823788&view=auto
==============================================================================
--- webservices/juddi/trunk/docs/examples/helloworld/src/org/apache/juddi/example/helloworld/HelloWorld.java (added)
+++ webservices/juddi/trunk/docs/examples/helloworld/src/org/apache/juddi/example/helloworld/HelloWorld.java Sat Oct 10 04:14:34 2009
@@ -0,0 +1,44 @@
+package org.apache.juddi.examples.helloworld;
+
+import org.apache.log4j.helpers.Loader;
+
+import org.uddi.api_v3.*;
+import org.apache.juddi.v3.client.config.UDDIClerkManager;
+import org.apache.juddi.v3.client.transport.Transport;
+import org.uddi.v3_service.UDDISecurityPortType;
+
+public class HelloWorld {
+	private Transport transport = null;
+	private static UDDISecurityPortType security = null;
+
+	public HelloWorld() {
+                try {
+	                String clazz = UDDIClerkManager.getClientConfig().getNodes().get("default").getProxyTransport();
+			Class<?> transportClass = Loader.loadClass(clazz);
+			if (transportClass!=null) {
+				Transport transport = (Transport) transportClass.getConstructor(String.class).newInstance("default");
+				security = transport.getUDDISecurityService();
+			}	
+		} catch (Exception e) {
+			e.printStackTrace();
+		}	
+	}
+
+	public void getAuthToken() {
+		GetAuthToken getAuthToken = new GetAuthToken();
+		getAuthToken.setUserID("root");
+		getAuthToken.setCred("");
+		try {
+			AuthToken authToken = security.getAuthToken(getAuthToken);
+			System.out.println ("AUTHTOKEN = " 
+				+ authToken.getAuthInfo());
+		} catch (Exception e) {
+			e.printStackTrace();
+		}
+	}		
+
+	public static void main (String args[]) {
+		HelloWorld hw = new HelloWorld();
+		hw.getAuthToken();	
+	}
+}



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