juddi-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jfa...@apache.org
Subject svn commit: r917614 - in /webservices/juddi/trunk/docs/examples/simple-publish: ./ src/ src/main/ src/main/java/ src/main/java/org/ src/main/java/org/apache/ src/main/java/org/apache/juddi/ src/main/java/org/apache/juddi/example/ src/main/java/org/apac...
Date Mon, 01 Mar 2010 17:57:51 GMT
Author: jfaath
Date: Mon Mar  1 17:57:50 2010
New Revision: 917614

URL: http://svn.apache.org/viewvc?rev=917614&view=rev
Log:
adding simple-publish example

Added:
    webservices/juddi/trunk/docs/examples/simple-publish/
    webservices/juddi/trunk/docs/examples/simple-publish/pom.xml   (with props)
    webservices/juddi/trunk/docs/examples/simple-publish/src/
    webservices/juddi/trunk/docs/examples/simple-publish/src/main/
    webservices/juddi/trunk/docs/examples/simple-publish/src/main/java/
    webservices/juddi/trunk/docs/examples/simple-publish/src/main/java/org/
    webservices/juddi/trunk/docs/examples/simple-publish/src/main/java/org/apache/
    webservices/juddi/trunk/docs/examples/simple-publish/src/main/java/org/apache/juddi/
    webservices/juddi/trunk/docs/examples/simple-publish/src/main/java/org/apache/juddi/example/
    webservices/juddi/trunk/docs/examples/simple-publish/src/main/java/org/apache/juddi/example/publish/
    webservices/juddi/trunk/docs/examples/simple-publish/src/main/java/org/apache/juddi/example/publish/SimplePublish.java
  (with props)
    webservices/juddi/trunk/docs/examples/simple-publish/src/main/resources/
    webservices/juddi/trunk/docs/examples/simple-publish/src/main/resources/META-INF/
    webservices/juddi/trunk/docs/examples/simple-publish/src/main/resources/META-INF/uddi.xml
  (with props)
    webservices/juddi/trunk/docs/examples/simple-publish/src/test/
    webservices/juddi/trunk/docs/examples/simple-publish/src/test/java/
    webservices/juddi/trunk/docs/examples/simple-publish/src/test/resources/

Added: webservices/juddi/trunk/docs/examples/simple-publish/pom.xml
URL: http://svn.apache.org/viewvc/webservices/juddi/trunk/docs/examples/simple-publish/pom.xml?rev=917614&view=auto
==============================================================================
--- webservices/juddi/trunk/docs/examples/simple-publish/pom.xml (added)
+++ webservices/juddi/trunk/docs/examples/simple-publish/pom.xml Mon Mar  1 17:57:50 2010
@@ -0,0 +1,43 @@
+<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>
+  <groupId>org.apache.juddi</groupId>
+  <artifactId>simple-publish</artifactId>
+  <name>Simple Publish Example</name>
+  <version>0.0.1-SNAPSHOT</version>
+  <description>Demonstrates the steps taken to publish a service using the jUDDI API
directly</description>
+
+  <build>
+    <pluginManagement>
+      <plugins>
+        <plugin>
+          <groupId>org.apache.maven.plugins</groupId>
+          <artifactId>maven-compiler-plugin</artifactId>
+          <configuration>
+            <source>1.5</source>
+            <target>1.5</target>
+          </configuration>
+        </plugin>
+      </plugins>
+    </pluginManagement>
+  </build>
+
+  <dependencies>
+    <dependency>
+      <groupId>org.apache.juddi</groupId>
+      <artifactId>uddi-ws</artifactId>
+      <version>3.0.2-SNAPSHOT</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.juddi</groupId>
+      <artifactId>juddi-core</artifactId>
+      <version>3.0.2-SNAPSHOT</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.juddi</groupId>
+      <artifactId>juddi-client</artifactId>
+      <version>3.0.2-SNAPSHOT</version>
+    </dependency>
+  </dependencies>
+  
+</project>
+

Propchange: webservices/juddi/trunk/docs/examples/simple-publish/pom.xml
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: webservices/juddi/trunk/docs/examples/simple-publish/src/main/java/org/apache/juddi/example/publish/SimplePublish.java
URL: http://svn.apache.org/viewvc/webservices/juddi/trunk/docs/examples/simple-publish/src/main/java/org/apache/juddi/example/publish/SimplePublish.java?rev=917614&view=auto
==============================================================================
--- webservices/juddi/trunk/docs/examples/simple-publish/src/main/java/org/apache/juddi/example/publish/SimplePublish.java
(added)
+++ webservices/juddi/trunk/docs/examples/simple-publish/src/main/java/org/apache/juddi/example/publish/SimplePublish.java
Mon Mar  1 17:57:50 2010
@@ -0,0 +1,124 @@
+/*
+ * 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.publish;
+
+import org.uddi.api_v3.*;
+import org.apache.juddi.ClassUtil;
+import org.apache.juddi.api_v3.*;
+import org.apache.juddi.v3.client.config.UDDIClientContainer;
+import org.apache.juddi.v3.client.transport.Transport;
+import org.uddi.v3_service.UDDISecurityPortType;
+import org.uddi.v3_service.UDDIPublicationPortType;
+import org.apache.juddi.v3_service.JUDDIApiPortType;
+
+public class SimplePublish {
+	private static UDDISecurityPortType security = null;
+	
+	private static JUDDIApiPortType juddiApi = null;
+	private static UDDIPublicationPortType publish = null;
+
+	public SimplePublish() {
+        try {
+            String clazz = UDDIClientContainer.getUDDIClerkManager(null).
+            	getClientConfig().getUDDINode("default").getProxyTransport();
+            Class<?> transportClass = ClassUtil.forName(clazz, Transport.class);
+			if (transportClass!=null) {
+				Transport transport = (Transport) transportClass.
+					getConstructor(String.class).newInstance("default");
+
+				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("");
+
+			// Making API call that retrieves the authentication token for the 'root' user.
+			AuthToken rootAuthToken = security.getAuthToken(getAuthTokenRoot);
+			System.out.println ("root AUTHTOKEN = " + rootAuthToken.getAuthInfo());
+
+			// Creating a new publisher that we will use to publish our entities to.
+			Publisher p = new Publisher();
+			p.setAuthorizedName("my-publisher");
+			p.setPublisherName("My Publisher");
+
+			// Adding the publisher to the "save" structure, using the 'root' user authentication
info and saving away. 
+			SavePublisher sp = new SavePublisher();
+			sp.getPublisher().add(p);
+			sp.setAuthInfo(rootAuthToken.getAuthInfo());
+			juddiApi.savePublisher(sp);
+			
+			// Our publisher is now saved, so now we want to retrieve its authentication token
+			GetAuthToken getAuthTokenMyPub = new GetAuthToken();
+			getAuthTokenMyPub.setUserID("my-publisher");
+			getAuthTokenMyPub.setCred("");
+			AuthToken myPubAuthToken = security.getAuthToken(getAuthTokenMyPub);
+			System.out.println ("myPub AUTHTOKEN = " + myPubAuthToken.getAuthInfo());
+			
+			// Creating the parent business entity that will contain our service.
+			BusinessEntity myBusEntity = new BusinessEntity();
+			Name myBusName = new Name();
+			myBusName.setValue("My Business");
+			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(myPubAuthToken.getAuthInfo());
+			BusinessDetail bd = publish.saveBusiness(sb);
+			String myBusKey = bd.getBusinessEntity().get(0).getBusinessKey();
+			System.out.println("myBusiness key:  " + myBusKey);
+			
+			// Creating a service to save.  Only adding the minimum data: the parent business key
retrieved from saving the business 
+			// above and a single name.
+			BusinessService myService = new BusinessService();
+			myService.setBusinessKey(myBusKey);
+			Name myServName = new Name();
+			myServName.setValue("My Service");
+			myService.getName().add(myServName);
+			// Add binding templates, etc...
+			
+			// Adding the service to the "save" structure, using our publisher's authentication info
and saving away.
+			SaveService ss = new SaveService();
+			ss.getBusinessService().add(myService);
+			ss.setAuthInfo(myPubAuthToken.getAuthInfo());
+			ServiceDetail sd = publish.saveService(ss);
+			String myServKey = sd.getBusinessService().get(0).getServiceKey();
+			System.out.println("myService key:  " + myServKey);
+			
+			// Now you have a publisher saved who in turn published a business and service via the
jUDDI API!
+		} 
+		catch (Exception e) {
+			e.printStackTrace();
+		}
+	}		
+
+	public static void main (String args[]) {
+		SimplePublish sp = new SimplePublish();
+		sp.publish();	
+	}
+}

Propchange: webservices/juddi/trunk/docs/examples/simple-publish/src/main/java/org/apache/juddi/example/publish/SimplePublish.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: webservices/juddi/trunk/docs/examples/simple-publish/src/main/resources/META-INF/uddi.xml
URL: http://svn.apache.org/viewvc/webservices/juddi/trunk/docs/examples/simple-publish/src/main/resources/META-INF/uddi.xml?rev=917614&view=auto
==============================================================================
--- webservices/juddi/trunk/docs/examples/simple-publish/src/main/resources/META-INF/uddi.xml
(added)
+++ webservices/juddi/trunk/docs/examples/simple-publish/src/main/resources/META-INF/uddi.xml
Mon Mar  1 17:57:50 2010
@@ -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?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>
+			</node>
+		</nodes>
+	</manager>
+</uddi>

Propchange: webservices/juddi/trunk/docs/examples/simple-publish/src/main/resources/META-INF/uddi.xml
------------------------------------------------------------------------------
    svn:mime-type = text/plain



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


Mime
View raw message