[jboss-svn-commits] JBL Code SVN: r8060 - in labs/jbossesb/trunk: product/core/listeners/src/org/jboss/soa/esb/listeners product/core/listeners/src/org/jboss/soa/esb/listeners/message qa/junit/src/org/jboss/soa/esb/actions qa/junit/src/org/jboss/soa/esb/listeners/message qa/junit/src/org/jboss/soa/esb/util
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Tue Dec 5 06:00:42 EST 2006
Author: tfennelly
Date: 2006-12-05 06:00:35 -0500 (Tue, 05 Dec 2006)
New Revision: 8060
Added:
labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/Lifecycle.java
labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/State.java
Modified:
labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/message/EsbListenerController.java
labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/message/EsbListenerControllerFactory.java
labs/jbossesb/trunk/qa/junit/src/org/jboss/soa/esb/actions/CbrProxyActionUnitTest.java
labs/jbossesb/trunk/qa/junit/src/org/jboss/soa/esb/listeners/message/CbrJmsQueueListenerTest.java
labs/jbossesb/trunk/qa/junit/src/org/jboss/soa/esb/util/NewListenerUtils.java
Log:
Added the Lifecycle interface and pulled up the State Enum. All listener components will now implement this interface and report on their lifecycle state.
Added: labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/Lifecycle.java
===================================================================
--- labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/Lifecycle.java 2006-12-05 09:54:23 UTC (rev 8059)
+++ labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/Lifecycle.java 2006-12-05 11:00:35 UTC (rev 8060)
@@ -0,0 +1,35 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2005-2006,
+ * @author JBoss Inc.
+ */
+
+package org.jboss.soa.esb.listeners;
+
+/**
+ * ESB listener component lifecycle interface.
+ * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
+ */
+public interface Lifecycle {
+
+ /**
+ * Get the state of the listener component.
+ * @return The state of the component.
+ */
+ public abstract State getState();
+}
\ No newline at end of file
Added: labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/State.java
===================================================================
--- labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/State.java 2006-12-05 09:54:23 UTC (rev 8059)
+++ labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/State.java 2006-12-05 11:00:35 UTC (rev 8060)
@@ -0,0 +1,65 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2005-2006,
+ * @author JBoss Inc.
+ */
+
+package org.jboss.soa.esb.listeners;
+
+/**
+ * ESB listener component state.
+ * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
+ */
+public enum State {
+ Loading_parameters, Running, Ready, Shutting_down, Done_OK, Exception_thrown;
+
+ private int m_iCompletionCode = 0;
+ private Exception m_oException = null;
+
+ /**
+ * Get the completion code.
+ * @return The completion code.
+ */
+ public int getCompletionCode() {
+ return m_iCompletionCode;
+ }
+
+ /**
+ * Get the exception.
+ * @return Get the exception.
+ */
+ public Exception getException() {
+ return m_oException;
+ }
+
+ /**
+ * Set the completion code.
+ * @param completionCode The completionCode value.
+ */
+ public void setCompletionCode(int completionCode) {
+ m_iCompletionCode = completionCode;
+ }
+
+ /**
+ * Set the exception.
+ * @param exception The Exception.
+ */
+ public void setException(Exception exception) {
+ m_oException = exception;
+ }
+}
\ No newline at end of file
Modified: labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/message/EsbListenerController.java
===================================================================
--- labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/message/EsbListenerController.java 2006-12-05 09:54:23 UTC (rev 8059)
+++ labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/message/EsbListenerController.java 2006-12-05 11:00:35 UTC (rev 8060)
@@ -26,6 +26,7 @@
import org.jboss.soa.esb.addressing.EPR;
import org.jboss.soa.esb.helpers.ConfigTree;
+import org.jboss.soa.esb.listeners.Lifecycle;
import org.jboss.soa.esb.services.registry.RegistryException;
/**
@@ -36,7 +37,7 @@
* class.
* @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
*/
-public interface EsbListenerController {
+public interface EsbListenerController extends Lifecycle {
public static final String PARM_RELOAD_SECS = "parameterReloadSecs";
@@ -66,23 +67,6 @@
public static final SimpleDateFormat s_oDateParse = new SimpleDateFormat(
"yyyyMMdd hh:mm:ss");
- public static enum State {
- Loading_parameters, Running, Ready, Shutting_down, Done_OK, Exception_thrown;
- int m_iCompletionCode = 0;
-
- Exception m_oException = null;
-
- public int getCompletionCode() {
- return m_iCompletionCode;
- };
-
- public Exception getException() {
- return m_oException;
- }
- };
-
- public abstract State getState();
-
/**
* Check to see if all needed parameters are there, and assign default
* values to some of them
Modified: labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/message/EsbListenerControllerFactory.java
===================================================================
--- labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/message/EsbListenerControllerFactory.java 2006-12-05 09:54:23 UTC (rev 8059)
+++ labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/message/EsbListenerControllerFactory.java 2006-12-05 11:00:35 UTC (rev 8060)
@@ -36,6 +36,8 @@
import org.jboss.soa.esb.common.ModulePropertyManager;
import org.jboss.soa.esb.helpers.ConfigTree;
import org.jboss.soa.esb.listeners.ListenerTagNames;
+import org.jboss.soa.esb.listeners.State;
+import org.jboss.soa.esb.listeners.Lifecycle;
import org.jboss.soa.esb.parameters.ParamRepositoryException;
import org.jboss.soa.esb.parameters.ParamRepositoryFactory;
import org.jboss.soa.esb.services.registry.Registry;
@@ -113,7 +115,7 @@
public static void main(String[] args) throws Exception {
EsbListenerControllerImpl oProc = new EsbListenerControllerImpl(args[0]);
oProc.run();
- EsbListenerControllerImpl.State oS = oProc.getState();
+ State oS = oProc.getState();
if (null != oS.getException()) {
_logger.error("EsbListenerControllerImpl <" + args[0] + "> FAILED\n", oS
@@ -190,7 +192,7 @@
String configSource = config.getAttribute("configSource");
m_oState = State.Exception_thrown;
- m_oState.m_oException = e;
+ m_oState.setException(e);
_logger.fatal("Listener configuration and startup error. Config Source: "
+ (configSource != null ? configSource
: "unknown"), e);
@@ -317,7 +319,7 @@
// m_oState = State.Shutting_down;
m_oState = State.Done_OK;
- m_oState.m_iCompletionCode = 0;
+ m_oState.setCompletionCode(0);
_logger
.info("Finishing_____________________________________________________");
Modified: labs/jbossesb/trunk/qa/junit/src/org/jboss/soa/esb/actions/CbrProxyActionUnitTest.java
===================================================================
--- labs/jbossesb/trunk/qa/junit/src/org/jboss/soa/esb/actions/CbrProxyActionUnitTest.java 2006-12-05 09:54:23 UTC (rev 8059)
+++ labs/jbossesb/trunk/qa/junit/src/org/jboss/soa/esb/actions/CbrProxyActionUnitTest.java 2006-12-05 11:00:35 UTC (rev 8060)
@@ -39,6 +39,7 @@
import org.apache.log4j.xml.DOMConfigurator;
import org.jboss.soa.esb.ConfigurationException;
import org.jboss.soa.esb.helpers.ConfigTree;
+import org.jboss.soa.esb.listeners.State;
import org.jboss.soa.esb.listeners.message.ActionProcessingPipeline;
import org.jboss.soa.esb.listeners.message.EsbListenerController;
import org.jboss.soa.esb.listeners.message.EsbListenerControllerFactory;
@@ -200,7 +201,7 @@
_proc.requestEnd();
//Give the controller time to finish
Thread.sleep(2000);
- EsbListenerController.State oS = _proc.getState();
+ State oS = _proc.getState();
System.out.println("Exit state = "+oS.toString());
if ("org.hsqldb.jdbcDriver".equals(mDbDriver)) {
HsqldbUtil.stopHsqldb(mDbUrl, mDbUsername, mDbPassword);
Modified: labs/jbossesb/trunk/qa/junit/src/org/jboss/soa/esb/listeners/message/CbrJmsQueueListenerTest.java
===================================================================
--- labs/jbossesb/trunk/qa/junit/src/org/jboss/soa/esb/listeners/message/CbrJmsQueueListenerTest.java 2006-12-05 09:54:23 UTC (rev 8059)
+++ labs/jbossesb/trunk/qa/junit/src/org/jboss/soa/esb/listeners/message/CbrJmsQueueListenerTest.java 2006-12-05 11:00:35 UTC (rev 8060)
@@ -39,6 +39,7 @@
import org.jboss.soa.esb.couriers.Courier;
import org.jboss.soa.esb.couriers.CourierException;
import org.jboss.soa.esb.couriers.CourierFactory;
+import org.jboss.soa.esb.listeners.State;
import org.jboss.soa.esb.message.Message;
import org.jboss.soa.esb.message.format.MessageFactory;
import org.jboss.soa.esb.services.registry.Registry;
@@ -189,7 +190,7 @@
_proc.requestEnd();
//Give the controller time to finish
Thread.sleep(2000);
- EsbListenerController.State oS = _proc.getState();
+ State oS = _proc.getState();
System.out.println("Exit state = "+oS.toString());
if ("org.hsqldb.jdbcDriver".equals(mDbDriver)) {
Modified: labs/jbossesb/trunk/qa/junit/src/org/jboss/soa/esb/util/NewListenerUtils.java
===================================================================
--- labs/jbossesb/trunk/qa/junit/src/org/jboss/soa/esb/util/NewListenerUtils.java 2006-12-05 09:54:23 UTC (rev 8059)
+++ labs/jbossesb/trunk/qa/junit/src/org/jboss/soa/esb/util/NewListenerUtils.java 2006-12-05 11:00:35 UTC (rev 8060)
@@ -30,6 +30,7 @@
import org.apache.log4j.Logger;
import org.jboss.internal.soa.esb.command.JmsCommandQueue;
import org.jboss.internal.soa.esb.parameters.ParamFileRepository;
+import org.jboss.soa.esb.listeners.State;
import org.jboss.soa.esb.listeners.message.EsbListenerController;
import org.jboss.soa.esb.listeners.message.EsbListenerControllerFactory;
import org.jboss.soa.esb.listeners.message.EsbListenerControllerFactory.EsbListenerControllerImpl;
@@ -58,9 +59,9 @@
manager = new ListenersManagerTestWrapper(createEsbListenerController(paramName));
logger.info("Waiting on Listener Manager the start...");
- while(manager.listenersManager.getState() != EsbListenerController.State.Running) {
+ while(manager.listenersManager.getState() != State.Running) {
Thread.sleep(50);
- if(manager.listenersManager.getState() == EsbListenerController.State.Exception_thrown) {
+ if(manager.listenersManager.getState() == State.Exception_thrown) {
Exception e = manager.listenersManager.getState().getException();
logger.error("Failed to start the Listener Manager!", e);
TestCase.fail(e.getMessage());
@@ -139,7 +140,7 @@
* Assert that the listener Manager is in an Exception state..
*/
public void asserttInException() {
- if(listenersManager.getState() != EsbListenerController.State.Exception_thrown) {
+ if(listenersManager.getState() != State.Exception_thrown) {
String errorMsg = "ListenerManager not in Exception state. Listener Manager Thread: " + listenersManager;
logger.error(errorMsg);
TestCase.fail(errorMsg);
@@ -150,7 +151,7 @@
* Assert that the listener Manager is not in an Exception state..
*/
public void assertNotInException() {
- if(listenersManager.getState() == EsbListenerController.State.Exception_thrown) {
+ if(listenersManager.getState() == State.Exception_thrown) {
String errorMsg = "ListenerManager in Exception state. See log. Listener Manager Thread: " + listenersManager;
logger.error(errorMsg, listenersManager.getState().getException());
TestCase.fail(errorMsg);
@@ -165,7 +166,7 @@
long endTime = System.currentTimeMillis() + maxWait;
while(System.currentTimeMillis() < endTime) {
- if(listenersManager.getState() == EsbListenerController.State.Done_OK) {
+ if(listenersManager.getState() == State.Done_OK) {
logger.info("Shutdown was successful. Listener Manager Thread: " + listenersManager);
return;
}
More information about the jboss-svn-commits
mailing list