You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@juddi.apache.org by ks...@apache.org on 2013/03/05 01:37:40 UTC

svn commit: r1452608 - in /juddi/trunk: docs/examples/helloworld/ docs/examples/simple-publish/ juddi-examples/ juddi-examples/hello-world/ juddi-examples/hello-world/src/main/java/org/apache/juddi/example/helloworld/ juddi-examples/hello-world/src/mai...

Author: kstam
Date: Tue Mar  5 00:37:40 2013
New Revision: 1452608

URL: http://svn.apache.org/r1452608
Log:
JUDDI-540 working on adding the examples to the bundle

Added:
    juddi/trunk/juddi-examples/hello-world/src/main/resources/META-INF/hello-world-uddi.xml
      - copied unchanged from r1452536, juddi/trunk/juddi-examples/hello-world/src/main/resources/META-INF/uddi.xml
    juddi/trunk/juddi-examples/simple-publish/src/main/resources/META-INF/simple-publish-uddi.xml
      - copied unchanged from r1452536, juddi/trunk/juddi-examples/simple-publish/src/main/resources/META-INF/uddi.xml
Removed:
    juddi/trunk/docs/examples/helloworld/
    juddi/trunk/docs/examples/simple-publish/
    juddi/trunk/juddi-examples/hello-world/src/main/resources/META-INF/uddi.xml
    juddi/trunk/juddi-examples/simple-publish/src/main/resources/META-INF/uddi.xml
Modified:
    juddi/trunk/juddi-examples/   (props changed)
    juddi/trunk/juddi-examples/hello-world/   (props changed)
    juddi/trunk/juddi-examples/hello-world/README
    juddi/trunk/juddi-examples/hello-world/pom.xml
    juddi/trunk/juddi-examples/hello-world/src/main/java/org/apache/juddi/example/helloworld/HelloWorld.java
    juddi/trunk/juddi-examples/pom.xml
    juddi/trunk/juddi-examples/simple-publish/   (props changed)
    juddi/trunk/juddi-examples/simple-publish/README.txt
    juddi/trunk/juddi-examples/simple-publish/pom.xml
    juddi/trunk/juddi-examples/simple-publish/src/main/java/org/apache/juddi/example/publish/SimplePublish.java
    juddi/trunk/juddi-examples/uddi-annotations/   (props changed)
    juddi/trunk/juddi-examples/uddi-annotations/pom.xml
    juddi/trunk/juddi-examples/uddi-annotations/src/main/webapp/WEB-INF/   (props changed)

Propchange: juddi/trunk/juddi-examples/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Tue Mar  5 00:37:40 2013
@@ -1 +1,3 @@
 target
+.settings
+.project

Propchange: juddi/trunk/juddi-examples/hello-world/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Tue Mar  5 00:37:40 2013
@@ -0,0 +1,4 @@
+.settings
+target
+.classpath
+.project

Modified: juddi/trunk/juddi-examples/hello-world/README
URL: http://svn.apache.org/viewvc/juddi/trunk/juddi-examples/hello-world/README?rev=1452608&r1=1452607&r2=1452608&view=diff
==============================================================================
--- juddi/trunk/juddi-examples/hello-world/README (original)
+++ juddi/trunk/juddi-examples/hello-world/README Tue Mar  5 00:37:40 2013
@@ -1,18 +1,16 @@
 This example is a command line demonstration of how to interact with JUDDI.
 
-1. Download Apache Ivy and update the project.properties
+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. ant run
+3. mvn package
 
-  run:
-     [echo] HelloWorld Grab AuthToken
-     [java] log4j:WARN No appenders could be found for logger (org.apache.commons.configuration.ConfigurationUtils).
-     [java] log4j:WARN Please initialize the log4j system properly.
-     [java] AUTHTOKEN = authtoken:8f18d677-b19d-454f-b1ba-61bc5947c16e
-  
-  
+Should print the auth token:
+
+     AUTHTOKEN = authtoken:8aa26a8a-461b-485f-904b-4be4fd5fab76
   
-For further examples, see the uddi-client module, which includes a number
-of unit tests that exercise API other than just the security API.
+You will need an auth token to on subsequent UDDI calls. The token
+can be used until you call discard. The server can be configured to 
+timeout tokens after a certain age, or when not used for a certain
+number of minutes.

Modified: juddi/trunk/juddi-examples/hello-world/pom.xml
URL: http://svn.apache.org/viewvc/juddi/trunk/juddi-examples/hello-world/pom.xml?rev=1452608&r1=1452607&r2=1452608&view=diff
==============================================================================
--- juddi/trunk/juddi-examples/hello-world/pom.xml (original)
+++ juddi/trunk/juddi-examples/hello-world/pom.xml Tue Mar  5 00:37:40 2013
@@ -1,58 +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</groupId>
-     <artifactId>juddi-examples</artifactId>
-     <version>3.1.5-SNAPSHOT</version>
-     <relativePath>../pom.xml</relativePath>
-  </parent>
-  <artifactId>hello-world</artifactId>
-  <name>jUDDI Example Hello World</name>
-  <description>Demonstrates the steps taken to publish a service using the jUDDI API directly</description>
+<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>hello-world</artifactId>
+	<name>jUDDI Example Hello World</name>
+	<description>Demonstrates the steps taken to publish a service using the jUDDI API directly</description>
 
-  <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.helloworld.HelloWorld</mainClass>
-		<!--
-	      <arguments>  
-	        <argument>arg0</argument>  
-	      </arguments> 
-		--> 
-	    </configuration>  
-            </execution>  
-	  </executions>  
-   	</plugin>  
-    </plugins>
-  </build>
 
-  <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-core</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>
-  
+	<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.helloworld.HelloWorld</mainClass>
+								</configuration>
+							</execution>
+						</executions>
+					</plugin>
+				</plugins>
+			</build>
+		</profile>
+	</profiles>
+
 </project>
 

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=1452608&r1=1452607&r2=1452608&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 00:37:40 2013
@@ -14,7 +14,7 @@
  * limitations under the License.
  *
  */
-package org.apache.juddi.examples.helloworld;
+package org.apache.juddi.example.helloworld;
 
 import org.uddi.api_v3.*;
 import org.apache.juddi.v3.client.ClassUtil;
@@ -24,19 +24,21 @@ import org.apache.juddi.v3.client.transp
 import org.uddi.v3_service.UDDISecurityPortType;
 
 public class HelloWorld {
-	private Transport transport = null;
 	private static UDDISecurityPortType security = null;
 
 	public HelloWorld() {
         try {
-            String clazz = UDDIClientContainer.getUDDIClerkManager("example-manager").
-            	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();
-			}	
+        	// create a manager and read the config in the archive; 
+        	// you can use your config file name
+        	UDDIClerkManager clerkManager = new UDDIClerkManager("META-INF/hello-world-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();
 		} catch (Exception e) {
 			e.printStackTrace();
 		}	

Modified: juddi/trunk/juddi-examples/pom.xml
URL: http://svn.apache.org/viewvc/juddi/trunk/juddi-examples/pom.xml?rev=1452608&r1=1452607&r2=1452608&view=diff
==============================================================================
--- juddi/trunk/juddi-examples/pom.xml (original)
+++ juddi/trunk/juddi-examples/pom.xml Tue Mar  5 00:37:40 2013
@@ -19,6 +19,7 @@
 		<version>3.1.5-SNAPSHOT</version>
 		<relativePath>../pom.xml</relativePath>
 	</parent>
+	<groupId>org.apache.juddi.example</groupId>
 	<artifactId>juddi-examples</artifactId>
 	<name>jUDDI Examples</name>
 	<packaging>pom</packaging>

Propchange: juddi/trunk/juddi-examples/simple-publish/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Tue Mar  5 00:37:40 2013
@@ -0,0 +1,4 @@
+.settings
+target
+.classpath
+.project

Modified: juddi/trunk/juddi-examples/simple-publish/README.txt
URL: http://svn.apache.org/viewvc/juddi/trunk/juddi-examples/simple-publish/README.txt?rev=1452608&r1=1452607&r2=1452608&view=diff
==============================================================================
--- juddi/trunk/juddi-examples/simple-publish/README.txt (original)
+++ juddi/trunk/juddi-examples/simple-publish/README.txt Tue Mar  5 00:37:40 2013
@@ -1,11 +1,10 @@
-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. 
-
-The easiest way to run execute the main of this class in from
-your IDE. If your IDE has maven integration it should set up
-the project class path for you, and you can simple run it from 
-there.
+This example is a command line demonstration of how to interact with JUDDI.
+
+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 package
 
 You should see the following output being written to the console:
 

Modified: juddi/trunk/juddi-examples/simple-publish/pom.xml
URL: http://svn.apache.org/viewvc/juddi/trunk/juddi-examples/simple-publish/pom.xml?rev=1452608&r1=1452607&r2=1452608&view=diff
==============================================================================
--- juddi/trunk/juddi-examples/simple-publish/pom.xml (original)
+++ juddi/trunk/juddi-examples/simple-publish/pom.xml Tue Mar  5 00:37:40 2013
@@ -1,7 +1,7 @@
 <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</groupId>
+     <groupId>org.apache.juddi.example</groupId>
      <artifactId>juddi-examples</artifactId>
      <version>3.1.5-SNAPSHOT</version>
      <relativePath>../pom.xml</relativePath>
@@ -10,32 +10,6 @@
   <name>jUDDI Example Simple Publish</name>
   <description>Demonstrates the steps taken to publish a service using the jUDDI API directly</description>
 
-  <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.publish.SimplePublish</mainClass>
-		<!--
-	      <arguments>  
-	        <argument>arg0</argument>  
-	      </arguments> 
-		--> 
-	    </configuration>  
-            </execution>  
-	  </executions>  
-   	</plugin>  
-    </plugins>
-  </build>
-
   <dependencies>
     <dependency>
       <groupId>org.apache.juddi</groupId>
@@ -44,15 +18,52 @@
     </dependency>
     <dependency>
       <groupId>org.apache.juddi</groupId>
-      <artifactId>juddi-core</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.publish.SimplePublish</mainClass>
+                                </configuration>
+                            </execution>
+                        </executions>
+                    </plugin>
+                </plugins>
+            </build>
+        </profile>
+    </profiles>
 </project>
 

Modified: juddi/trunk/juddi-examples/simple-publish/src/main/java/org/apache/juddi/example/publish/SimplePublish.java
URL: http://svn.apache.org/viewvc/juddi/trunk/juddi-examples/simple-publish/src/main/java/org/apache/juddi/example/publish/SimplePublish.java?rev=1452608&r1=1452607&r2=1452608&view=diff
==============================================================================
--- juddi/trunk/juddi-examples/simple-publish/src/main/java/org/apache/juddi/example/publish/SimplePublish.java (original)
+++ juddi/trunk/juddi-examples/simple-publish/src/main/java/org/apache/juddi/example/publish/SimplePublish.java Tue Mar  5 00:37:40 2013
@@ -17,8 +17,8 @@
 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.UDDIClerkManager;
 import org.apache.juddi.v3.client.config.UDDIClientContainer;
 import org.apache.juddi.v3.client.transport.Transport;
 import org.uddi.v3_service.UDDISecurityPortType;
@@ -33,17 +33,19 @@ public class SimplePublish {
 
 	public SimplePublish() {
         try {
-            String clazz = UDDIClientContainer.getUDDIClerkManager("example-manager").
-            	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();
-			}	
+        	// 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();
 		}	

Propchange: juddi/trunk/juddi-examples/uddi-annotations/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Tue Mar  5 00:37:40 2013
@@ -1 +1,4 @@
 target
+.settings
+.classpath
+.project

Modified: juddi/trunk/juddi-examples/uddi-annotations/pom.xml
URL: http://svn.apache.org/viewvc/juddi/trunk/juddi-examples/uddi-annotations/pom.xml?rev=1452608&r1=1452607&r2=1452608&view=diff
==============================================================================
--- juddi/trunk/juddi-examples/uddi-annotations/pom.xml (original)
+++ juddi/trunk/juddi-examples/uddi-annotations/pom.xml Tue Mar  5 00:37:40 2013
@@ -18,7 +18,7 @@
 <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</groupId>
+		<groupId>org.apache.juddi.example</groupId>
 		<artifactId>juddi-examples</artifactId>
 		<version>3.1.5-SNAPSHOT</version>
 		<relativePath>../pom.xml</relativePath>

Propchange: juddi/trunk/juddi-examples/uddi-annotations/src/main/webapp/WEB-INF/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Tue Mar  5 00:37:40 2013
@@ -0,0 +1 @@
+lib



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