juddi-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ks...@apache.org
Subject svn commit: r819439 - in /webservices/juddi/trunk/uddi-client/src: main/java/org/apache/juddi/v3/client/ main/java/org/apache/juddi/v3/client/config/ test/java/org/apache/juddi/v3/client/ test/resources/META-INF/
Date Mon, 28 Sep 2009 00:53:30 GMT
Author: kstam
Date: Mon Sep 28 00:53:29 2009
New Revision: 819439

URL: http://svn.apache.org/viewvc?rev=819439&view=rev
Log:
JUDDI-204, adding the UDDI Clerks Manager

Added:
    webservices/juddi/trunk/uddi-client/src/main/java/org/apache/juddi/v3/client/UDDIClerkManager.java
  (contents, props changed)
      - copied, changed from r819390, webservices/juddi/trunk/uddi-client/src/main/java/org/apache/juddi/v3/client/UDDIClient.java
    webservices/juddi/trunk/uddi-client/src/main/java/org/apache/juddi/v3/client/UDDIClerkServlet.java
  (contents, props changed)
      - copied, changed from r819390, webservices/juddi/trunk/uddi-client/src/main/java/org/apache/juddi/v3/client/UDDIClientServlet.java
    webservices/juddi/trunk/uddi-client/src/test/java/org/apache/juddi/v3/client/UDDIClerkManagerTest.java
  (contents, props changed)
      - copied, changed from r819436, webservices/juddi/trunk/uddi-client/src/test/java/org/apache/juddi/v3/client/UDDIClientTest.java
Removed:
    webservices/juddi/trunk/uddi-client/src/main/java/org/apache/juddi/v3/client/UDDIClient.java
    webservices/juddi/trunk/uddi-client/src/main/java/org/apache/juddi/v3/client/UDDIClientServlet.java
    webservices/juddi/trunk/uddi-client/src/test/java/org/apache/juddi/v3/client/UDDIClientTest.java
Modified:
    webservices/juddi/trunk/uddi-client/src/main/java/org/apache/juddi/v3/client/config/ClientConfig.java
    webservices/juddi/trunk/uddi-client/src/main/java/org/apache/juddi/v3/client/config/UDDIClerk.java
    webservices/juddi/trunk/uddi-client/src/test/resources/META-INF/uddi.xml

Copied: webservices/juddi/trunk/uddi-client/src/main/java/org/apache/juddi/v3/client/UDDIClerkManager.java
(from r819390, webservices/juddi/trunk/uddi-client/src/main/java/org/apache/juddi/v3/client/UDDIClient.java)
URL: http://svn.apache.org/viewvc/webservices/juddi/trunk/uddi-client/src/main/java/org/apache/juddi/v3/client/UDDIClerkManager.java?p2=webservices/juddi/trunk/uddi-client/src/main/java/org/apache/juddi/v3/client/UDDIClerkManager.java&p1=webservices/juddi/trunk/uddi-client/src/main/java/org/apache/juddi/v3/client/UDDIClient.java&r1=819390&r2=819439&rev=819439&view=diff
==============================================================================
--- webservices/juddi/trunk/uddi-client/src/main/java/org/apache/juddi/v3/client/UDDIClient.java
(original)
+++ webservices/juddi/trunk/uddi-client/src/main/java/org/apache/juddi/v3/client/UDDIClerkManager.java
Mon Sep 28 00:53:29 2009
@@ -12,69 +12,74 @@
 import org.apache.log4j.Logger;
 import org.uddi.api_v3.BusinessService;
 
-public class UDDIClient {
+public class UDDIClerkManager {
 	
-	private static UDDIClient client = null;
-	private static Logger log = Logger.getLogger(UDDIClient.class);
+	private static UDDIClerkManager manager = null;
+	private static Logger log = Logger.getLogger(UDDIClerkManager.class);
     private static ClientConfig clientConfig = null;
 	
 	/**
 	 * Singleton.
 	 * @throws ConfigurationException 
 	 */
-	private UDDIClient() throws ConfigurationException {
+	private UDDIClerkManager() throws ConfigurationException {
 		super();
 		clientConfig = ClientConfig.getInstance();
 	}
 	/**
-	 * Stops the client.
+	 * Stops the clerks.
 	 * @throws ConfigurationException 
 	 */
 	public synchronized static void stop() throws ConfigurationException {
-		log.info("Stopping UDDI-client...");
-		if (client!=null) {
-			//TODO unregister bindings from the annotation
-			client=null;
-			log.info("UDDI-client shutdown completed.");
+		log.info("Stopping UDDI Clerks...");
+		if (manager!=null) {
+			manager.releaseResources();
+			manager=null;
+			log.info("UDDI Clerks shutdown completed.");
 		} else {
-			log.warn("UDDI-Client was not running.");
+			log.warn("UDDI Clerks where not running.");
 		}
 	}
-	/**
-	 * Initializes the UDDI client.
+	
+	private synchronized void releaseResources() {
+		//TODO unregister bindings from the annotation
+	}
+ 	/**
+	 * Initializes the UDDI Clerk.
 	 * @return
 	 * @throws ConfigurationException
 	 * @throws  
 	 */
-	public synchronized static UDDIClient start() throws ConfigurationException {
-		log.info("Starting UDDI-client...");
-		if (client==null) {
-			client = new UDDIClient();
-			log.info("Initializing clerks...");
-			Map<String,UDDIClerk> clerks = clientConfig.getClerks();
-			if (clerks.size() > 0) {
-				AnnotationProcessor ap = new AnnotationProcessor();
-				for (UDDIClerk clerk : clerks.values()) {
-					Collection<BusinessService> services = ap.readServiceAnnotations(clerk.getClassWithAnnotations());
-					for (BusinessService businessService : services) {
-						clerk.register(businessService);
-					}
-				}
-			}
-			//XRegistration of listed services
-			Set<XRegistration> xRegistrations = clientConfig.getXRegistrations();
-			if (clientConfig.isRegisterOnStartup()) {
-				log.info("Starting cross registration...");
-				for (XRegistration xRegistration : xRegistrations) {
-					xRegistration.xRegister();
+	public synchronized static UDDIClerkManager start() throws ConfigurationException {
+		log.info("Starting UDDI Clerks...");
+		if (manager==null) {
+			manager = new UDDIClerkManager();
+		} else {
+			log.warn("ClerkManager was already started. Going to restart..");
+			manager.releaseResources();
+			manager = new UDDIClerkManager();
+		}
+		log.info("Initializing clerks...");
+		Map<String,UDDIClerk> clerks = clientConfig.getClerks();
+		if (clerks.size() > 0) {
+			AnnotationProcessor ap = new AnnotationProcessor();
+			for (UDDIClerk clerk : clerks.values()) {
+				Collection<BusinessService> services = ap.readServiceAnnotations(clerk.getClassWithAnnotations());
+				for (BusinessService businessService : services) {
+					clerk.register(businessService);
 				}
-				log.info("Cross registration completed");
 			}
-			log.info("UDDI client started succesfully.");
-		} else {
-			log.warn("UDDI Client was already start.");
 		}
-		return client;
+		//XRegistration of listed services
+		Set<XRegistration> xRegistrations = clientConfig.getXRegistrations();
+		log.info("Starting cross registration...");
+		for (XRegistration xRegistration : xRegistrations) {
+			xRegistration.xRegister();
+		}
+		log.info("Cross registration completed");
+		log.info("Clerks started succesfully.");
+		
+		return manager;
  	}
 	
 	public ClientConfig getClientConfig() {

Propchange: webservices/juddi/trunk/uddi-client/src/main/java/org/apache/juddi/v3/client/UDDIClerkManager.java
------------------------------------------------------------------------------
--- svn:mergeinfo (added)
+++ svn:mergeinfo Mon Sep 28 00:53:29 2009
@@ -0,0 +1 @@
+/webservices/juddi/branches/v3_trunk/uddi-client/src/main/java/org/apache/juddi/v3/client/UDDIClient.java:797614-802957

Copied: webservices/juddi/trunk/uddi-client/src/main/java/org/apache/juddi/v3/client/UDDIClerkServlet.java
(from r819390, webservices/juddi/trunk/uddi-client/src/main/java/org/apache/juddi/v3/client/UDDIClientServlet.java)
URL: http://svn.apache.org/viewvc/webservices/juddi/trunk/uddi-client/src/main/java/org/apache/juddi/v3/client/UDDIClerkServlet.java?p2=webservices/juddi/trunk/uddi-client/src/main/java/org/apache/juddi/v3/client/UDDIClerkServlet.java&p1=webservices/juddi/trunk/uddi-client/src/main/java/org/apache/juddi/v3/client/UDDIClientServlet.java&r1=819390&r2=819439&rev=819439&view=diff
==============================================================================
--- webservices/juddi/trunk/uddi-client/src/main/java/org/apache/juddi/v3/client/UDDIClientServlet.java
(original)
+++ webservices/juddi/trunk/uddi-client/src/main/java/org/apache/juddi/v3/client/UDDIClerkServlet.java
Mon Sep 28 00:53:29 2009
@@ -19,7 +19,6 @@
 import javax.servlet.ServletException;
 import javax.servlet.http.HttpServlet;
 
-import org.apache.commons.configuration.ConfigurationException;
 import org.apache.log4j.Logger;
 
 /**
@@ -28,9 +27,9 @@
  * 
  * @author Kurt Stam (kstam@apache.org)
  */
-public class UDDIClientServlet extends HttpServlet {
+public class UDDIClerkServlet extends HttpServlet {
 	private static final long serialVersionUID = 1L;
-	private static Logger logger = Logger.getLogger(UDDIClientServlet.class);
+	private static Logger logger = Logger.getLogger(UDDIClerkServlet.class);
 
 	/**
 	 * Create the shared instance of jUDDI's Registry class and call it's
@@ -40,20 +39,26 @@
 	public void init(ServletConfig config) throws ServletException {
 		super.init(config);
 		try {
-			UDDIClient.start();
-		} catch (ConfigurationException e) {
+			UDDIClerkManager.start();
+		} catch (Exception e) {
 			logger.error("UDDI-client could not be started."
 					+ e.getMessage(), e);
+		} catch (Throwable t) {
+			logger.error("UDDI-client could not be started."
+					+ t.getMessage(), t);
 		}
 	}
 	
 	@Override
 	public void destroy() {
 		try {
-			UDDIClient.stop();
-		} catch (ConfigurationException e) {
-			logger.error("UDDI client could not be stopped."
+			UDDIClerkManager.stop();
+		} catch (Exception e) {
+			logger.error("UDDI-client could not be stopped."
 					+ e.getMessage(), e);
+		} catch (Throwable t) {
+			logger.error("UDDI-client could not be stopped."
+					+ t.getMessage(), t);
 		}
 		super.destroy();
 	}

Propchange: webservices/juddi/trunk/uddi-client/src/main/java/org/apache/juddi/v3/client/UDDIClerkServlet.java
------------------------------------------------------------------------------
--- svn:mergeinfo (added)
+++ svn:mergeinfo Mon Sep 28 00:53:29 2009
@@ -0,0 +1 @@
+/webservices/juddi/branches/v3_trunk/uddi-client/src/main/java/org/apache/juddi/v3/client/UDDIClientServlet.java:797614-802957

Modified: webservices/juddi/trunk/uddi-client/src/main/java/org/apache/juddi/v3/client/config/ClientConfig.java
URL: http://svn.apache.org/viewvc/webservices/juddi/trunk/uddi-client/src/main/java/org/apache/juddi/v3/client/config/ClientConfig.java?rev=819439&r1=819438&r2=819439&view=diff
==============================================================================
--- webservices/juddi/trunk/uddi-client/src/main/java/org/apache/juddi/v3/client/config/ClientConfig.java
(original)
+++ webservices/juddi/trunk/uddi-client/src/main/java/org/apache/juddi/v3/client/config/ClientConfig.java
Mon Sep 28 00:53:29 2009
@@ -169,19 +169,19 @@
 	 */
 	private static Set<XRegistration> readXRegConfig(Configuration config, Map<String,UDDIClerk>
clerks) 
 	throws ConfigurationException {
-		String[] bindingKeys = config.getStringArray("xregister.service[@bindingKey]");
+		String[] bindingKeys = config.getStringArray("clerks.xregister.service[@bindingKey]");
 		Set<XRegistration> xRegistrations = new HashSet<XRegistration>();
 		log.debug("XRegistration bindingKeys=" + bindingKeys);
 		for (int i=0; i<bindingKeys.length; i++) {
 			XRegistration xRegistration = new XRegistration();
-			xRegistration.setBindingKey(config.getString("xregister.service(" + i + ")[@bindingKey]"));
+			xRegistration.setBindingKey(config.getString("clerks.xregister.service(" + i + ")[@bindingKey]"));
 			
-			String fromClerkRef = config.getString("xregister.service(" + i + ")[@fromClerk]");
+			String fromClerkRef = config.getString("clerks.xregister.service(" + i + ")[@fromClerk]");
 			if (!clerks.containsKey(fromClerkRef)) throw new ConfigurationException("Could not find
fromClerk with name=" + fromClerkRef);
 			UDDIClerk fromClerk = clerks.get(fromClerkRef);
 			xRegistration.setFromClerk(fromClerk);
 			
-			String toClerkRef = config.getString("xregister.service(" + i + ")[@toClerk]");
+			String toClerkRef = config.getString("clerks.xregister.service(" + i + ")[@toClerk]");
 			if (!clerks.containsKey(toClerkRef)) throw new ConfigurationException("Could not find
toClerk with name=" + toClerkRef);
 			UDDIClerk toClerk = clerks.get(toClerkRef);
 			xRegistration.setToClerk(toClerk);
@@ -191,10 +191,6 @@
 		return xRegistrations;
 	}
 	
-	public boolean isRegisterOnStartup() {
-		return config.getBoolean("xregister[@onStartUp]");
-	}
-	
 	public Map<String, UDDINode> getNodes() {
 		try {
 			getInstance();

Modified: webservices/juddi/trunk/uddi-client/src/main/java/org/apache/juddi/v3/client/config/UDDIClerk.java
URL: http://svn.apache.org/viewvc/webservices/juddi/trunk/uddi-client/src/main/java/org/apache/juddi/v3/client/config/UDDIClerk.java?rev=819439&r1=819438&r2=819439&view=diff
==============================================================================
--- webservices/juddi/trunk/uddi-client/src/main/java/org/apache/juddi/v3/client/config/UDDIClerk.java
(original)
+++ webservices/juddi/trunk/uddi-client/src/main/java/org/apache/juddi/v3/client/config/UDDIClerk.java
Mon Sep 28 00:53:29 2009
@@ -85,9 +85,6 @@
 		return authToken;
 	}
 	
-	
-	
-	
 	public String getName() {
 		return name;
 	}

Copied: webservices/juddi/trunk/uddi-client/src/test/java/org/apache/juddi/v3/client/UDDIClerkManagerTest.java
(from r819436, webservices/juddi/trunk/uddi-client/src/test/java/org/apache/juddi/v3/client/UDDIClientTest.java)
URL: http://svn.apache.org/viewvc/webservices/juddi/trunk/uddi-client/src/test/java/org/apache/juddi/v3/client/UDDIClerkManagerTest.java?p2=webservices/juddi/trunk/uddi-client/src/test/java/org/apache/juddi/v3/client/UDDIClerkManagerTest.java&p1=webservices/juddi/trunk/uddi-client/src/test/java/org/apache/juddi/v3/client/UDDIClientTest.java&r1=819436&r2=819439&rev=819439&view=diff
==============================================================================
--- webservices/juddi/trunk/uddi-client/src/test/java/org/apache/juddi/v3/client/UDDIClientTest.java
(original)
+++ webservices/juddi/trunk/uddi-client/src/test/java/org/apache/juddi/v3/client/UDDIClerkManagerTest.java
Mon Sep 28 00:53:29 2009
@@ -20,14 +20,14 @@
 /**
  * @author <a href="mailto:kstam@apache.org">Kurt T Stam</a>
  */
-public class UDDIClientTest {
+public class UDDIClerkManagerTest {
 	
      @Test
      public void testReadingTheConfig() {
 	     try {
-	    	 UDDIClient.start();
-	        
+	    	UDDIClerkManager.start();
 	     } catch (Exception e) {
+	    	 //we should not have any issues reading the config
 	         e.printStackTrace();
 	         Assert.fail();
 	     } 

Propchange: webservices/juddi/trunk/uddi-client/src/test/java/org/apache/juddi/v3/client/UDDIClerkManagerTest.java
------------------------------------------------------------------------------
--- svn:mergeinfo (added)
+++ svn:mergeinfo Mon Sep 28 00:53:29 2009
@@ -0,0 +1 @@
+/webservices/juddi/branches/v3_trunk/uddi-client/src/test/java/org/apache/juddi/client/UDDIClientTest.java:797614-802957

Modified: webservices/juddi/trunk/uddi-client/src/test/resources/META-INF/uddi.xml
URL: http://svn.apache.org/viewvc/webservices/juddi/trunk/uddi-client/src/test/resources/META-INF/uddi.xml?rev=819439&r1=819438&r2=819439&view=diff
==============================================================================
--- webservices/juddi/trunk/uddi-client/src/test/resources/META-INF/uddi.xml (original)
+++ webservices/juddi/trunk/uddi-client/src/test/resources/META-INF/uddi.xml Mon Sep 28 00:53:29
2009
@@ -56,9 +56,10 @@
 	<clerks>
 	   <clerk name="default" node="default" publisher="root" password="root"/>
        <clerk name="medroot" node="med" publisher="root" password="root"/>
-   </clerks> 
-   <xregister onStartUp="true">
+        <xregister onStartUp="true">
        <service bindingKey="uddi:juddi.apache.org:servicebindings-subscriptionlistener-ws"
fromClerk="default" toClerk="medroot"/>
    </xregister>
+   </clerks> 
+  
 	
 </uddi>
\ No newline at end of file



---------------------------------------------------------------------
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