[jboss-svn-commits] JBL Code SVN: r8397 - in labs/jbossesb/trunk/product: core/listeners/src/org/jboss/internal/soa/esb/listeners core/listeners/src/org/jboss/soa/esb/listeners core/listeners/tests/src/org/jboss/soa/esb/listeners core/rosetta/src/org/jboss/internal/soa/esb/couriers core/rosetta/tests/src/org/jboss/soa/esb/testutils core/services/src/org/jboss/internal/soa/esb/services/registry core/services/src/org/jboss/soa/esb/services/registry docs docs/services install
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Tue Dec 19 07:13:35 EST 2006
Author: mark.little at jboss.com
Date: 2006-12-19 07:13:15 -0500 (Tue, 19 Dec 2006)
New Revision: 8397
Added:
labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/ListenerManagerIntegrationTest.java
labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/ListenerManagerUnitTest.java
labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/listenerFile.xml
labs/jbossesb/trunk/product/docs/WARNING.txt
Removed:
labs/jbossesb/trunk/product/docs/QuickStart.odt
labs/jbossesb/trunk/product/docs/QuickStart.pdf
labs/jbossesb/trunk/product/install/README.TXT
Modified:
labs/jbossesb/trunk/product/core/listeners/src/org/jboss/internal/soa/esb/listeners/DefaultListenerManager.java
labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/AbstractManagedListener.java
labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/ListenerUtil.java
labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/internal/soa/esb/couriers/FileCourier.java
labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/internal/soa/esb/couriers/TwoWayCourierImpl.java
labs/jbossesb/trunk/product/core/rosetta/tests/src/org/jboss/soa/esb/testutils/TestEnvironmentUtil.java
labs/jbossesb/trunk/product/core/services/src/org/jboss/internal/soa/esb/services/registry/JAXRRegistryImpl.java
labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/services/registry/RegistryFactory.java
labs/jbossesb/trunk/product/docs/GettingStarted.sxw
labs/jbossesb/trunk/product/docs/services/RegistryConfiguration.odt
Log:
Added unit test for Esteban. Updated some of the documents. Some code formatting (courtesy of Eclipse).
Modified: labs/jbossesb/trunk/product/core/listeners/src/org/jboss/internal/soa/esb/listeners/DefaultListenerManager.java
===================================================================
--- labs/jbossesb/trunk/product/core/listeners/src/org/jboss/internal/soa/esb/listeners/DefaultListenerManager.java 2006-12-19 12:03:53 UTC (rev 8396)
+++ labs/jbossesb/trunk/product/core/listeners/src/org/jboss/internal/soa/esb/listeners/DefaultListenerManager.java 2006-12-19 12:13:15 UTC (rev 8397)
@@ -55,11 +55,12 @@
import com.arjuna.common.util.propertyservice.PropertyManager;
/**
- * Default implementation of the {@link org.jboss.soa.esb.listeners.ListenerManager} interface.
- * <p/>
+ * Default implementation of the
+ * {@link org.jboss.soa.esb.listeners.ListenerManager} interface. <p/>
* Controlling class that will launch listener child threads for supported
- * transport listener classes, as indicated in the configuration XML tree used in the constructor
- * If you use the 'main' method, configuration file is expected in arg[0]
+ * transport listener classes, as indicated in the configuration XML tree used
+ * in the constructor If you use the 'main' method, configuration file is
+ * expected in arg[0]
*
* <p />
* Can be launched as uppermost controller (it has a main(args) method)
@@ -74,16 +75,17 @@
* <p />
* End time for this instance can also be set using the PARM_END_TIME attribute
* <p />
- * Constructor will not return until the controller is up and running completely, with
- * all managed listeners fully initalised.
+ * Constructor will not return until the controller is up and running
+ * completely, with all managed listeners fully initalised.
*
* @since Version 4.0
*/
-public class DefaultListenerManager implements ListenerManager
+public class DefaultListenerManager implements ListenerManager
{
/**
- * Construct a Listener Manager and configure it using the named repository entry
+ * Construct a Listener Manager and configure it using the named repository
+ * entry
*
* @param parametersName
* Name of the Repository entry containing the configuration.
@@ -91,20 +93,21 @@
* Unable to load/use the named configuration.
*/
public DefaultListenerManager(String parametersName) throws Exception
- {
+ {
this(DefaultListenerManager.getListenerConfig(parametersName));
_parametersName = parametersName;
- } //____________________________
+ } // ____________________________
/**
- * Construct a Listener Controller using the specified listener configuration.
+ * Construct a Listener Controller using the specified listener
+ * configuration.
*
* @param config
* The configuration.
* @throws Exception
* Unable to load/use the supplied configuration.
*/
- public DefaultListenerManager(ConfigTree config) throws Exception
+ public DefaultListenerManager(ConfigTree config) throws Exception
{
// default sleep time when waiting for events to happen in other threads
_pauseTimeMillis = 50;
@@ -114,22 +117,29 @@
_config = config;
_status = State.Loading_parameters;
- try { checkParms(_config); }
- catch (Exception e)
+ try
{
+ checkParms(_config);
+ }
+ catch (Exception e)
+ {
String configSource = config.getAttribute("configSource");
_status = State.Exception_thrown;
_status.setThrowable(e);
- _logger.fatal("Listener configuration and startup error. Config Source: "
+ _logger
+ .fatal(
+ "Listener configuration and startup error. Config Source: "
+ (configSource != null ? configSource
: "unknown"), e);
throw e;
}
- } //____________________________
+ } // ____________________________
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see org.jboss.soa.esb.listeners.message.EsbListenerController#getState()
*/
/**
@@ -148,35 +158,36 @@
* Unable to parse the configuration.
*/
private static ConfigTree getListenerConfig(String reposParam)
- throws IOException, ParamRepositoryException, SAXException
- {
+ throws IOException, ParamRepositoryException, SAXException
+ {
String sXml = ParamRepositoryFactory.getInstance().get(reposParam);
ConfigTree config = ConfigTree.fromXml(sXml);
config.setAttribute("configSource", "param-repository:" + reposParam);
return config;
- } //____________________________
+ } // ____________________________
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see org.jboss.soa.esb.listeners.message.EsbListenerController#checkParms(org.jboss.soa.esb.helpers.ConfigTree)
*/
- public void checkParms(ConfigTree p_oP) throws Exception
+ public void checkParms(ConfigTree p_oP) throws Exception
{
// We've just loaded - set to false until next reload requested
_reloadRequested = false;
- if (null!=_parametersName)
+ if (null != _parametersName)
{
File file = new File(_parametersName);
if (file.exists())
_paramFileTimeStamps.put(_parametersName, file.lastModified());
}
-
_commandQueue = createCommandQueue(p_oP);
// Open the command queue...
- if (null!=_commandQueue)
+ if (null != _commandQueue)
_commandQueue.open(p_oP);
setNextReloadTime(p_oP);
@@ -187,21 +198,22 @@
String sEndT = p_oP.getAttribute(PARM_END_TIME);
_endTimeStamp = (null == sEndT) ? Long.MAX_VALUE : s_oDateParse.parse(
sEndT).getTime();
-
+
for (ConfigTree tree : _config.getAllChildren())
{
- String gateway = tree.getAttribute(PARM_GATEWAY_CLASS);
+ String gateway = tree.getAttribute(PARM_GATEWAY_CLASS);
String listener = tree.getAttribute(PARM_LISTENER_CLASS);
- if (null==gateway || null==listener)
+ if (null == gateway || null == listener)
continue;
- StringBuilder sb = new StringBuilder()
- .append("Either "+PARM_GATEWAY_CLASS+" or "+PARM_LISTENER_CLASS)
- .append(" can be specified, but not both")
- ;
- _logger.error("Child listener class must be gateway or listener - can't be both");
+ StringBuilder sb = new StringBuilder().append(
+ "Either " + PARM_GATEWAY_CLASS + " or "
+ + PARM_LISTENER_CLASS).append(
+ " can be specified, but not both");
+ _logger
+ .error("Child listener class must be gateway or listener - can't be both");
throw new ConfigurationException(sb.toString());
}
-
+
} // ________________________________
private void setNextReloadTime(ConfigTree tree)
@@ -211,53 +223,63 @@
// If there is a command queue, run until command is received
_sRldSecs = tree.getAttribute(PARM_RELOAD_SECS);
- synchronized (_synchReload)
+ synchronized (_synchReload)
{
- _nextReload = (null != _sRldSecs)
- ? System.currentTimeMillis() + 1000 * Long.parseLong(_sRldSecs)
- : (null == _commandQueue)
- ? Long.MAX_VALUE
- : System.currentTimeMillis() + _defaultReloadIntervalMillis;
+ _nextReload = (null != _sRldSecs) ? System.currentTimeMillis()
+ + 1000 * Long.parseLong(_sRldSecs)
+ : (null == _commandQueue) ? Long.MAX_VALUE : System
+ .currentTimeMillis()
+ + _defaultReloadIntervalMillis;
}
-
-
- if (null==_sRldSecs)
- {
- String sMsg = (null==_commandQueue)
- ? " - Using default of "+_sRldSecs
- : " - Listener will run until stopped by command sent to queue";
- _logger.warn("No value specified for: "+PARM_RELOAD_SECS + sMsg);
- }
- } //____________________________
+ if (null == _sRldSecs)
+ {
+ String sMsg = (null == _commandQueue) ? " - Using default of "
+ + _sRldSecs
+ : " - Listener will run until stopped by command sent to queue";
+ _logger.warn("No value specified for: " + PARM_RELOAD_SECS + sMsg);
+ }
- /**
- * Factory method for creating the command queue.
- * @param config DefaultListenerManager config.
- * @return DefaultListenerManager CommandQueue instance.
- */
- private CommandQueue createCommandQueue(ConfigTree config)
+ } // ____________________________
+
+ /**
+ * Factory method for creating the command queue.
+ *
+ * @param config
+ * DefaultListenerManager config.
+ * @return DefaultListenerManager CommandQueue instance.
+ */
+ private CommandQueue createCommandQueue(ConfigTree config)
{
String commandQueueClass = config.getAttribute("command-queue-class");
- if(commandQueueClass != null)
+ if (commandQueueClass != null)
{
- try { return (CommandQueue) Class.forName(commandQueueClass).newInstance(); }
- catch (Exception e)
+ try
{
- _logger.error("Failed to instantiate CommandQueue ["+ commandQueueClass + "]. Defaulting to no Command Queue", e);
+ return (CommandQueue) Class.forName(commandQueueClass)
+ .newInstance();
}
+ catch (Exception e)
+ {
+ _logger.error("Failed to instantiate CommandQueue ["
+ + commandQueueClass
+ + "]. Defaulting to no Command Queue", e);
+ }
}
-
+
return null;
- } //____________________________
+ } // ____________________________
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see org.jboss.soa.esb.listeners.message.EsbListenerController#run()
*/
- public void run()
+ public void run()
{
boolean relaunch = true;
- while (endNotRequested())
+
+ while (endNotRequested())
{
_status = State.Running;
if (relaunch)
@@ -265,14 +287,14 @@
synchronized (_synchAllReady)
{
_childrenStarted = new HashMap<AbstractManagedListener, Boolean>();
- for (ConfigTree oCurr : _config.getAllChildren())
+ for (ConfigTree oCurr : _config.getAllChildren())
{
- String sClass = oCurr.getAttribute(PARM_LISTENER_CLASS);
+ String sClass = oCurr.getAttribute(PARM_LISTENER_CLASS);
if (Util.isNullString(sClass))
- sClass = oCurr.getAttribute(PARM_GATEWAY_CLASS);
+ sClass = oCurr.getAttribute(PARM_GATEWAY_CLASS);
if (Util.isNullString(sClass))
continue;
-
+
tryToLaunchChildListener(oCurr, sClass);
}
}
@@ -288,23 +310,28 @@
}
relaunch = false;
- if (_parametersName != null && isReloadNeeded())
- try
+
+ if (_parametersName != null && isReloadNeeded())
+ {
+ try
{
_status = State.Loading_parameters;
- _logger.debug("Reloading parameters _____________________________________________________");
- ConfigTree oNew = DefaultListenerManager.getListenerConfig(_parametersName);
+ _logger
+ .debug("Reloading parameters _____________________________________________________");
+ ConfigTree oNew = DefaultListenerManager
+ .getListenerConfig(_parametersName);
checkParms(oNew);
_config = oNew;
relaunch = true;
- }
- catch (Exception e)
+ }
+ catch (Exception e)
{
_logger.error("Failed to reload parameters"
+ " - Continuing with cached version", e);
}
+ }
}
-// _status = State.Shutting_down;
+ // _status = State.Shutting_down;
_status = State.Done_OK;
_status.setCompletionCode(0);
@@ -315,24 +342,33 @@
if (null != _commandQueue)
_commandQueue.close();
}
- catch (CommandQueueException e) { _logger.debug("Error closing Command Queue.", e); }
+ catch (CommandQueueException e)
+ {
+ _logger.debug("Error closing Command Queue.", e);
+ }
} // ________________________________
- private void tryToLaunchChildListener(ConfigTree p_oP, String p_sClassName)
+ private void tryToLaunchChildListener(ConfigTree p_oP, String p_sClassName)
{
- try
+ try
{
Class oListener = Class.forName(p_sClassName);
- Constructor oConst = oListener.getConstructor(new Class[] {ListenerManager.class, ConfigTree.class});
- AbstractManagedListener listener = (AbstractManagedListener)
- oConst.newInstance(new Object[] { this,p_oP});
+ Constructor oConst = oListener.getConstructor(new Class[]
+ { ListenerManager.class, ConfigTree.class });
+ AbstractManagedListener listener = (AbstractManagedListener) oConst
+ .newInstance(new Object[]
+ { this, p_oP });
_childrenStarted.put(listener, Boolean.FALSE);
- ((Observable)listener).addObserver(this);
+
+ ((Observable) listener).addObserver(this);
+
new Thread(listener).start();
}
- catch (Throwable e)
+ catch (Throwable e)
{
+ e.printStackTrace();
+
_logger.error("Cannot launch <" + p_sClassName + ">\n", e);
}
} // ________________________________
@@ -341,25 +377,28 @@
{
synchronized (_synchReload)
{
- return Math.min(_nextReload, _endTimeStamp) - System.currentTimeMillis();
+ return Math.min(_nextReload, _endTimeStamp)
+ - System.currentTimeMillis();
}
} // ________________________________
- private void waitForCmdOrSleep()
+ private void waitForCmdOrSleep()
{
long lToGo = millisToWait();
- if (null == _commandQueue)
+ if (null == _commandQueue)
{
_logger.debug("About to sleep " + lToGo);
// No command queue nor topic - Just sleep until time
// exhausted, or thread interrupted
- try
+ try
{
- while ((lToGo=millisToWait()) > 0)
+ // TODO magic number!!
+
+ while ((lToGo = millisToWait()) > 0)
Thread.sleep(500);
- }
- catch (InterruptedException e)
+ }
+ catch (InterruptedException e)
{
_endTimeStamp = 0; // mark as end requested and return
}
@@ -369,22 +408,25 @@
// Wait for commands until time exhausted or command received
// Note that received commands might change time variables (reload/end)
// that's why time to go is recalculated on each cycle
- while ((lToGo = millisToWait()) > 0)
+ while ((lToGo = millisToWait()) > 0)
{
- try
+ try
{
- _logger.info("Waiting for command ... timeout=" + lToGo + " millis");
+ _logger.info("Waiting for command ... timeout=" + lToGo
+ + " millis");
String oM = _commandQueue.receiveCommand(lToGo);
- if (null == oM) {
+ if (null == oM)
+ {
return;
}
processCommand(oM);
- if (endRequested() || isReloadNeeded()) {
+ if (endRequested() || isReloadNeeded())
+ {
break;
}
- }
- catch (CommandQueueException eJ)
+ }
+ catch (CommandQueueException eJ)
{
_logger.info("receive on command queue failed", eJ);
}
@@ -423,63 +465,76 @@
* Message received from the command queue.
*
*/
- private void processCommand(String sTxt)
+ private void processCommand(String sTxt)
{
if (null == sTxt)
return;
-
+
String sLow = sTxt.trim().toLowerCase();
- if (sLow.startsWith("shutdown")) {
+ if (sLow.startsWith("shutdown"))
+ {
_endRequested = true;
_logger.info("Shutdown has been requested");
return;
}
- if (sLow.startsWith("reload param")) {
+ if (sLow.startsWith("reload param"))
+ {
_reloadRequested = true;
- _logger
- .info("Request for parameter reload has been received");
+ _logger.info("Request for parameter reload has been received");
return;
}
String[] sa = sLow.split("\\s+");
- if (sa.length > 1 && "endtime".equals(sa[0])) {
- try {
+ if (sa.length > 1 && "endtime".equals(sa[0]))
+ {
+ try
+ {
String sDate = sa[1];
String sTime = (sa.length < 3 || null == sa[2]) ? "23:59:59"
: sa[2];
Date oEnd = s_oDateParse.parse(sDate + " " + sTime);
_logger.info("New end date set to : " + oEnd);
_endTimeStamp = oEnd.getTime();
- } catch (Exception eDat) {
+ }
+ catch (Exception eDat)
+ {
_logger.info("Problems with endTime command", eDat);
}
}
} // ________________________________
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see org.jboss.soa.esb.listeners.message.EsbListenerController#requestEnd()
*/
- public void requestEnd()
+ public void requestEnd()
{
- _endTimeStamp = System.currentTimeMillis()+1000;
- _nextReload = _endTimeStamp+100;
- _logger.debug("Waiting for child threads to finish___________________________");
- waitForCompletion();
- _logger.debug("ListenerManager ends__________________________________________");
- _endRequested=true;
+ _endTimeStamp = System.currentTimeMillis() + 1000;
+ _nextReload = _endTimeStamp + 100;
+ _logger
+ .debug("Waiting for child threads to finish___________________________");
+ waitForCompletion();
+ _logger
+ .debug("ListenerManager ends__________________________________________");
+ _endRequested = true;
}
-
- /* (non-Javadoc)
+
+ /*
+ * (non-Javadoc)
+ *
* @see org.jboss.soa.esb.listeners.message.EsbListenerController#endRequested()
*/
- public boolean endRequested()
+ public boolean endRequested()
{
return _endRequested || System.currentTimeMillis() >= _endTimeStamp;
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see org.jboss.soa.esb.listeners.message.EsbListenerController#endNotRequested()
*/
- public boolean endNotRequested()
+ public boolean endNotRequested()
{
return !endRequested();
}
@@ -493,132 +548,177 @@
// Still not time to reload
if (System.currentTimeMillis() < _nextReload)
return false;
-
- if (null==_parametersName)
+
+ if (null == _parametersName)
return refreshNextReload();
-
+
File paramFile = new File(_parametersName);
- if (! paramFile.exists())
+ if (!paramFile.exists())
return refreshNextReload();
-
-// check the TS on the file.
- Long previousTimeStamp = _paramFileTimeStamps.get(_parametersName);
- if (null==previousTimeStamp)
+
+ // check the TS on the file.
+ Long previousTimeStamp = _paramFileTimeStamps.get(_parametersName);
+ if (null == previousTimeStamp)
return refreshNextReload();
-
- Long currentTimeStamp = paramFile.lastModified();
- if (! previousTimeStamp.equals(currentTimeStamp))
+ Long currentTimeStamp = paramFile.lastModified();
+ if (!previousTimeStamp.equals(currentTimeStamp))
return refreshNextReload();
setNextReloadTime(_config);
return false;
}
-
+
private boolean refreshNextReload()
{
setNextReloadTime(_config);
return true;
}
-
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see org.jboss.soa.esb.listeners.message.EsbListenerController#continueLooping()
*/
- public boolean continueLooping()
+ public boolean continueLooping()
{
return (endNotRequested() && !isReloadNeeded());
} // ________________________________
-
+
public static EPRManager getEprManager()
{
- PropertyManager manager = ModulePropertyManager.getPropertyManager(ModulePropertyManager.CORE_MODULE);
- String sDir = manager.getProperty(Environment.REGISTRY_FILE_HELPER_DIR,".");
+ PropertyManager manager = ModulePropertyManager
+ .getPropertyManager(ModulePropertyManager.CORE_MODULE);
+ String sDir = manager.getProperty(Environment.REGISTRY_FILE_HELPER_DIR,
+ ".");
return EPRManager.getInstance(sDir);
}
-
+
@Deprecated
- private void register (String name, EPR address)
+ private void register(String name, EPR address)
{
- try { getEprManager().saveEPR(name,address); }
+ try
+ {
+ getEprManager().saveEPR(name, address);
+ }
catch (IOException e)
{
- _logger.fatal("Cannot register service",e);
+ _logger.fatal("Cannot register service", e);
}
} // ________________________________
+
@Deprecated
- private void unRegister (String name)
+ private void unRegister(String name)
{
- try { getEprManager().removeEPR(name); }
+ try
+ {
+ getEprManager().removeEPR(name);
+ }
catch (IOException e)
{
- _logger.fatal("Cannot un-register service",e);
+ _logger.fatal("Cannot un-register service", e);
}
} // ________________________________
- /* (non-Javadoc)
- * @see org.jboss.soa.esb.listeners.message.ListenerManager#register(org.jboss.soa.esb.helpers.ConfigTree, org.jboss.soa.esb.addressing.EPR)
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.jboss.soa.esb.listeners.message.ListenerManager#register(org.jboss.soa.esb.helpers.ConfigTree,
+ * org.jboss.soa.esb.addressing.EPR)
*/
- public void register(ConfigTree config , EPR epr) throws RegistryException
+ public void register(ConfigTree config, EPR epr) throws RegistryException
{
- String serviceCategoryName = config.getAttribute(ListenerTagNames.SERVICE_CATEGORY_NAME_TAG);
- String serviceName = config.getAttribute(ListenerTagNames.SERVICE_NAME_TAG);
+ String serviceCategoryName = config
+ .getAttribute(ListenerTagNames.SERVICE_CATEGORY_NAME_TAG);
+ String serviceName = config
+ .getAttribute(ListenerTagNames.SERVICE_NAME_TAG);
+
if ("eprManager".equalsIgnoreCase(serviceCategoryName))
{
- register(serviceName,epr);
- return;
+ register(serviceName, epr);
+ return;
}
- String serviceDescription = config.getAttribute(ListenerTagNames.SERVICE_DESCRIPTION_TAG);
- String eprDescription = config.getAttribute(ListenerTagNames.EPR_DESCRIPTION_TAG);
+
+ String serviceDescription = config
+ .getAttribute(ListenerTagNames.SERVICE_DESCRIPTION_TAG);
+ String eprDescription = config
+ .getAttribute(ListenerTagNames.EPR_DESCRIPTION_TAG);
Registry registry = RegistryFactory.getRegistry();
+
+ _logger.debug("Registering < "+serviceName+", "+epr+" >");
+
synchronized (_synchRegistry)
{
- registry.registerEPR(serviceCategoryName, serviceName, serviceDescription, epr, eprDescription);
+ registry.registerEPR(serviceCategoryName, serviceName,
+ serviceDescription, epr, eprDescription);
}
- } //____________________________
- /* (non-Javadoc)
- * @see org.jboss.soa.esb.listeners.message.ListenerManager#unRegister(java.lang.String, java.lang.String, org.jboss.soa.esb.addressing.EPR)
+ } // ____________________________
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.jboss.soa.esb.listeners.message.ListenerManager#unRegister(java.lang.String,
+ * java.lang.String, org.jboss.soa.esb.addressing.EPR)
*/
- public void unRegister(String serviceCategoryName, String serviceName , EPR epr) throws RegistryException
+ public void unRegister(String serviceCategoryName, String serviceName,
+ EPR epr) throws RegistryException
{
if ("eprManager".equalsIgnoreCase(serviceCategoryName))
{
- unRegister(serviceName);
- return;
+ unRegister(serviceName);
+ return;
}
Registry registry = RegistryFactory.getRegistry();
synchronized (_synchRegistry)
{
registry.unRegisterEPR(serviceCategoryName, serviceName, epr);
}
- } //____________________________
+ } // ____________________________
- // this method will typically run in the invoker's thread
- // (which btw might be the same as the run() thread if this not launched in a separate thread
- public void waitUntilReady()
+ // this method will typically run in the invoker's thread
+ // (which btw might be the same as the run() thread if this not launched in
+ // a separate thread
+ public void waitUntilReady()
{
boolean someChildPending = true;
+
do
{
Collection<Boolean> allStarted = null;
+
synchronized (_synchAllReady)
{
- allStarted = (null==_childrenStarted) ? null : _childrenStarted.values();
+ allStarted = ((_childrenStarted == null) ? null : _childrenStarted.values());
}
- if (null!= allStarted)
- {
+
+ if (allStarted != null)
+ {
someChildPending = false;
+
for (Boolean curr : allStarted)
- if (! Boolean.TRUE.equals(curr))
+ {
+ if (!Boolean.TRUE.equals(curr))
someChildPending = true;
+ }
}
+
if (someChildPending)
- try { Thread.sleep(_pauseTimeMillis); }
- catch (InterruptedException e) { return; }
-
+ {
+ try
+ {
+ Thread.sleep(_pauseTimeMillis);
+ }
+ catch (InterruptedException e)
+ {
+ return;
+ }
+ }
+
} while (someChildPending);
- } //____________________________
-
+ } // ____________________________
+
+ // TODO name??
+
public void xxx()
{
boolean someChildPending = true;
@@ -627,70 +727,97 @@
Collection<Boolean> allStarted = null;
synchronized (_synchAllReady)
{
- allStarted = (null==_childrenStarted) ? null : _childrenStarted.values();
+ allStarted = (null == _childrenStarted) ? null
+ : _childrenStarted.values();
}
- if (null== allStarted)
+ if (null == allStarted)
break;
someChildPending = false;
- for (Boolean curr : allStarted)
- if (Boolean.TRUE.equals(curr))
- someChildPending = true;
+ for (Boolean curr : allStarted)
+ if (Boolean.TRUE.equals(curr))
+ someChildPending = true;
if (someChildPending)
- try { Thread.sleep(_pauseTimeMillis); }
- catch (InterruptedException e) { return; }
-
+ {
+ try
+ {
+ Thread.sleep(_pauseTimeMillis);
+ }
+ catch (InterruptedException e)
+ {
+ return;
+ }
+ }
+
} while (someChildPending);
- } //____________________________
+ } // ____________________________
public void waitForCompletion()
{
- try { Thread.sleep(2000); }
- catch (InterruptedException e) {}
+ // TODO a magic number!
+
+ try
+ {
+ Thread.sleep(2000);
+ }
+ catch (InterruptedException e)
+ {
+ }
boolean bRunning = true;
- while (bRunning && null!=_childrenStarted && _childrenStarted.size()>0)
+ while (bRunning && null != _childrenStarted
+ && _childrenStarted.size() > 0)
{
bRunning = false;
- for (AbstractManagedListener curr :_childrenStarted.keySet())
+ for (AbstractManagedListener curr : _childrenStarted.keySet())
{
if (curr.hasActiveTreads())
- bRunning = true;
+ bRunning = true;
}
}
- } //____________________________
-
+ } // ____________________________
+
// Child processes must let us know when they're ready
- public void update(Observable o, Object arg)
+ public void update(Observable o, Object arg)
{
- if (null!=_childrenStarted && (arg instanceof Boolean))
- _childrenStarted.put((AbstractManagedListener)o, (Boolean)arg);
- } //____________________________
+ if (null != _childrenStarted && (arg instanceof Boolean))
+ _childrenStarted.put((AbstractManagedListener) o, (Boolean) arg);
+ } // ____________________________
+ private static Logger _logger = Logger
+ .getLogger(DefaultListenerManager.class);
- private static Logger _logger = Logger.getLogger(DefaultListenerManager.class);
+ private ConfigTree _config;
- private ConfigTree _config;
- private CommandQueue _commandQueue;
+ private CommandQueue _commandQueue;
- private State _status = State.Uninitialised;
- public State getState() { return _status; }
-
- private Map<AbstractManagedListener,Boolean> _childrenStarted;
-
-
- private Map<String,Long> _paramFileTimeStamps=new ConcurrentHashMap<String,Long>();
- private String _sRldSecs=null;
- private String _parametersName;
+ private State _status = State.Uninitialised;
- private boolean _reloadRequested, _endRequested;
- private long _nextReload = Long.MAX_VALUE;
- private long _endTimeStamp = Long.MAX_VALUE;
+ public State getState()
+ {
+ return _status;
+ }
- private Object _synchRegistry = new Short((short)0);
- private Object _synchReload = new Short((short)10);
- private Object _synchAllReady = new Short((short)20);
+ private Map<AbstractManagedListener, Boolean> _childrenStarted;
- protected int _defaultReloadIntervalMillis;
-
- protected int _pauseTimeMillis;
+ private Map<String, Long> _paramFileTimeStamps = new ConcurrentHashMap<String, Long>();
+ private String _sRldSecs = null;
+
+ private String _parametersName;
+
+ private boolean _reloadRequested, _endRequested;
+
+ private long _nextReload = Long.MAX_VALUE;
+
+ private long _endTimeStamp = Long.MAX_VALUE;
+
+ private Object _synchRegistry = new Short((short) 0);
+
+ private Object _synchReload = new Short((short) 10);
+
+ private Object _synchAllReady = new Short((short) 20);
+
+ protected int _defaultReloadIntervalMillis;
+
+ protected int _pauseTimeMillis;
+
} // ____________________________________________________________________________
Modified: labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/AbstractManagedListener.java
===================================================================
--- labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/AbstractManagedListener.java 2006-12-19 12:03:53 UTC (rev 8396)
+++ labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/AbstractManagedListener.java 2006-12-19 12:13:15 UTC (rev 8397)
@@ -37,192 +37,246 @@
/**
* All ESB 'managed' listeners (gateways and message) should extend this class.
*
- * <p/> Responsibility as an Observable is to notify Observers when it
- * is ready to run (Boolean.TRUE) and when it's not (Boolean.FALSE)
+ * <p/> Responsibility as an Observable is to notify Observers when it is ready
+ * to run (Boolean.TRUE) and when it's not (Boolean.FALSE)
*
- * <br/> It must be a Runnable that will be started in a thread forked and controlled
- * by a ListenerManager (the _controller)
+ * <br/> It must be a Runnable that will be started in a thread forked and
+ * controlled by a ListenerManager (the _controller)
*
- * <br/> It is supposed to manage it's own thread pool of 'actions' (the _execService)
+ * <br/> It is supposed to manage it's own thread pool of 'actions' (the
+ * _execService)
*
- * @author <a href="mailto:schifest at heuristica.com.ar">schifest at heuristica.com.ar</a>
+ * @author <a
+ * href="mailto:schifest at heuristica.com.ar">schifest at heuristica.com.ar</a>
* @since Version 4.0
*
*/
-public abstract class AbstractManagedListener extends Observable implements Runnable, Observer
+public abstract class AbstractManagedListener extends Observable implements
+ Runnable, Observer
{
public abstract boolean isMessageAware();
+
public abstract boolean initializeRun();
+
public abstract boolean finalizeRun();
- public abstract void waitForEventAndProcess(long maxWaitMillis);
+ public abstract void waitForEventAndProcess(long maxWaitMillis);
+
// disable default constructor
- private AbstractManagedListener() {}
-
+ private AbstractManagedListener()
+ {
+ }
+
/**
* public constructor
- * @param controller ListenerManager - the controlling process
- * @param config ConfigTree - Containing 'static' configuration for this instance
+ *
+ * @param controller
+ * ListenerManager - the controlling process
+ * @param config
+ * ConfigTree - Containing 'static' configuration for this
+ * instance
* @throws Exception
*/
- protected AbstractManagedListener(ListenerManager controller, ConfigTree config)
- throws ConfigurationException
- {
- _pauseLapseInMillis = 50;
- _defaultMaxThreads = 1;
- _controller = controller;
- _config = config;
+ protected AbstractManagedListener(ListenerManager controller,
+ ConfigTree config) throws ConfigurationException
+ {
+ _pauseLapseInMillis = 50;
+ _defaultMaxThreads = 1;
+ _controller = controller;
+ _config = config;
- _logger = Logger.getLogger(this.getClass());
+ _logger = Logger.getLogger(this.getClass());
checkMyParms();
- } //________________________________
-
-
- protected void checkMyParms() throws ConfigurationException
- {
- _eprCategoryName= _config.getAttribute(ListenerTagNames.SERVICE_CATEGORY_NAME_TAG);
- _eprName = _config.getAttribute(ListenerTagNames.SERVICE_NAME_TAG);
+ } // ________________________________
- String attr = _config.getAttribute(ListenerTagNames.MAX_THREADS_TAG);
- if (!Util.isNullString(attr))
- try { _maxThreads = Integer.parseInt(attr); }
- catch (Exception e) { attr = null; }
- if (Util.isNullString(attr))
- {
- _maxThreads = _defaultMaxThreads;
- _logger.debug("Missing or invalid "+ListenerTagNames.MAX_THREADS_TAG+" attribute"
- +" - Using default value of <"+_maxThreads+">");
- }
- } //________________________________
-
- protected void registerProcess() throws RegistryException
- {
- _bRegistered = false;
- _controller.register(_config,_epr);
- _bRegistered = true;
- } // ________________________________
-
- protected void unregisterProcess() throws RegistryException
- {
- if (_bRegistered)
- _controller.unRegister(_eprCategoryName, _eprName, _epr);
- } //________________________________
-
- /**
- * Wait until the registration process finished, a PickupCourier was obtained
- * , and the pool thread is instantiated
- */
- public void waitUntilReady()
+ protected void checkMyParms() throws ConfigurationException
{
- while(null==_execService)
- try { Thread.sleep(_pauseLapseInMillis); }
- catch (InterruptedException e)
- { _logger.warn(this.getClass().getSimpleName()+" startup interrupted", e); }
- } //________________________________
+ _eprCategoryName = _config
+ .getAttribute(ListenerTagNames.SERVICE_CATEGORY_NAME_TAG);
+ _eprName = _config.getAttribute(ListenerTagNames.SERVICE_NAME_TAG);
- // Child threads will send a -1 when their run() method ends
- // we need to prevent picking up Messages when there are no available threads in pool
- public void update(Observable o, Object arg)
+ String attr = _config.getAttribute(ListenerTagNames.MAX_THREADS_TAG);
+
+ if (!Util.isNullString(attr))
+ {
+ try
+ {
+ _maxThreads = Integer.parseInt(attr);
+ }
+ catch (Exception e)
+ {
+ attr = null;
+ }
+ }
+
+ if (Util.isNullString(attr))
+ {
+ _maxThreads = _defaultMaxThreads;
+ _logger.debug("Missing or invalid "
+ + ListenerTagNames.MAX_THREADS_TAG + " attribute"
+ + " - Using default value of <" + _maxThreads + ">");
+ }
+ } // ________________________________
+
+ protected void registerProcess() throws RegistryException
{
+ _bRegistered = false;
+
+ _controller.register(_config, _epr);
+
+ _bRegistered = true;
+ } // ________________________________
+
+ protected void unregisterProcess() throws RegistryException
+ {
+ if (_bRegistered)
+ _controller.unRegister(_eprCategoryName, _eprName, _epr);
+ } // ________________________________
+
+ /**
+ * Wait until the registration process finished, a PickupCourier was
+ * obtained , and the pool thread is instantiated
+ */
+ public void waitUntilReady()
+ {
+ while (null == _execService)
+ {
+ try
+ {
+ Thread.sleep(_pauseLapseInMillis);
+ }
+ catch (InterruptedException e)
+ {
+ _logger.warn(this.getClass().getSimpleName()
+ + " startup interrupted", e);
+ }
+ }
+ } // ________________________________
+
+ // Child threads will send a -1 when their run() method ends
+ // we need to prevent picking up Messages when there are no available
+ // threads in pool
+ public void update(Observable o, Object arg)
+ {
if (arg instanceof Integer)
- updateThreadCount((Integer)arg);
- } //________________________________
-
+ updateThreadCount((Integer) arg);
+ } // ________________________________
+
public boolean hasActiveTreads()
{
return _qRunningThreads > 0;
- } //________________________________
-
+ } // ________________________________
+
protected void resetThreadCount()
{
- synchronized (_synchThreads)
- { _qRunningThreads = 0;}
- } //________________________________
-
+ synchronized (_synchThreads)
+ {
+ _qRunningThreads = 0;
+ }
+ } // ________________________________
+
protected void updateThreadCount(Integer i)
{
- synchronized (_synchThreads)
- { _qRunningThreads += i.intValue();}
-// _logger.debug("Thread pool ("+getClass().getSimpleName()+") used ="+_qRunningThreads+"/"+_maxThreads);
- } //________________________________
-
- protected String obtainAttribute(String p_sAtt, String p_sDefault)
- throws ConfigurationException
+ synchronized (_synchThreads)
+ {
+ _qRunningThreads += i.intValue();
+ }
+ // _logger.debug("Thread pool ("+getClass().getSimpleName()+") used
+ // ="+_qRunningThreads+"/"+_maxThreads);
+ } // ________________________________
+
+ protected String obtainAttribute(String p_sAtt, String p_sDefault)
+ throws ConfigurationException
{
_logger.debug("Reading value for " + p_sAtt);
String sVal = _config.getAttribute(p_sAtt);
if ((null == sVal) && (null == p_sDefault))
- throw new ConfigurationException("Missing or invalid <" + p_sAtt + "> attribute");
-
+ throw new ConfigurationException("Missing or invalid <" + p_sAtt
+ + "> attribute");
+
return (null != sVal) ? sVal : p_sDefault;
} // ________________________________
-
- /**
- * Loops until controlling process determines
- * <br/>Invokes appropriate Courier to obtain incoming ESB Messages
- * <br/>When one is received, instantiates an action processing pipeline to process it
- */
- public void run()
- {
- _logger.debug("run() method of "+this.getClass().getSimpleName()
- +" started on thread "+Thread.currentThread().getName());
+ /**
+ * Loops until controlling process determines <br/>Invokes appropriate
+ * Courier to obtain incoming ESB Messages <br/>When one is received,
+ * instantiates an action processing pipeline to process it
+ */
+ public void run()
+ {
+ _logger.debug("run() method of " + this.getClass().getSimpleName()
+ + " started on thread " + Thread.currentThread().getName());
+
if (initializeRun())
{
// Instantiate the pool thread and set active count to zero
_execService = Executors.newFixedThreadPool(_maxThreads);
resetThreadCount();
-
+
setChanged();
notifyObservers(Boolean.TRUE);
-
- while (_controller.continueLooping())
- {
- // Only pickup a message when a thread is available
- if (_qRunningThreads >= _maxThreads)
- {
-// _logger.debug("+++++++++++"+Thread.currentThread()+_qRunningThreads);
- try { Thread.sleep(_pauseLapseInMillis); }
- catch (InterruptedException e) { break;}
- continue;
- }
-
- long lWait = _controller.millisToWait();
- // This if() is just in case (it should never happen - it's a safety net)
- if (lWait>0)
- waitForEventAndProcess(lWait);
- }
- setChanged();
- notifyObservers(Boolean.FALSE);
+ while (_controller.continueLooping())
+ {
+ // Only pickup a message when a thread is available
+ if (_qRunningThreads >= _maxThreads)
+ {
+ // _logger.debug("+++++++++++"+Thread.currentThread()+_qRunningThreads);
+ try
+ {
+ Thread.sleep(_pauseLapseInMillis);
+ }
+ catch (InterruptedException e)
+ {
+ break;
+ }
+ continue;
+ }
+
+ long lWait = _controller.millisToWait();
+
+ // This if() is just in case (it should never happen - it's a
+ // safety net)
+ if (lWait > 0)
+ waitForEventAndProcess(lWait);
+ }
+ setChanged();
+ notifyObservers(Boolean.FALSE);
}
-
+
finalizeRun();
// shutdown should wait for all child threads to finish
- if (null!=_execService)
+ if (null != _execService)
_execService.shutdown();
-
- _logger.debug("run() method of "+this.getClass().getSimpleName()
- +" finished on thread "+Thread.currentThread().getName());
- } // _______________________________
-
-
- protected ConfigTree _config;
- protected ListenerManager _controller;
- protected boolean _bRegistered;
- protected String _eprCategoryName;
- protected String _eprName;
- protected EPR _epr;
-
- protected int _maxThreads;
- protected int _defaultMaxThreads;
- protected long _pauseLapseInMillis;
- protected ExecutorService _execService;
+ _logger.debug("run() method of " + this.getClass().getSimpleName()
+ + " finished on thread " + Thread.currentThread().getName());
+ } // _______________________________
- private Object _synchThreads = new Short((short)-1);
- private int _qRunningThreads;
+ protected ConfigTree _config;
- protected Logger _logger;
+ protected ListenerManager _controller;
+
+ protected boolean _bRegistered;
+
+ protected String _eprCategoryName;
+
+ protected String _eprName;
+
+ protected EPR _epr;
+
+ protected int _maxThreads;
+
+ protected int _defaultMaxThreads;
+
+ protected long _pauseLapseInMillis;
+
+ protected ExecutorService _execService;
+
+ private Object _synchThreads = new Short((short) -1);
+
+ private int _qRunningThreads;
+
+ protected Logger _logger;
}
Modified: labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/ListenerUtil.java
===================================================================
--- labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/ListenerUtil.java 2006-12-19 12:03:53 UTC (rev 8396)
+++ labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/ListenerUtil.java 2006-12-19 12:13:15 UTC (rev 8397)
@@ -1,3 +1,25 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY 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 along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
package org.jboss.soa.esb.listeners;
import java.io.File;
@@ -21,47 +43,55 @@
import org.jboss.soa.esb.services.registry.RegistryFactory;
import org.jboss.soa.esb.util.Util;
-public class ListenerUtil
+public class ListenerUtil
{
- private ListenerUtil() {}
-
+ private ListenerUtil()
+ {
+ }
+
/**
* ListenerManager Launcher.
- * @param parametersName String - used to retrieve the ConfigTree with run time configuration values
- * @param inNewThread boolean - if 'true' will launch the ListenerManager in a new thread, and wait
- * until controlled listeners are up and running
- * <br/> if false, will instantiate and run the Controller in current thread - flow control will only
- * return to invoker once the controller's run() method has finished
+ *
+ * @param parametersName
+ * String - used to retrieve the ConfigTree with run time
+ * configuration values
+ * @param inNewThread
+ * boolean - if 'true' will launch the ListenerManager in a new
+ * thread, and wait until controlled listeners are up and running
+ * <br/> if false, will instantiate and run the Controller in
+ * current thread - flow control will only return to invoker once
+ * the controller's run() method has finished
* @return ListenerManager
* @throws Exception
*/
- public static ListenerManager launchManager(String parametersName, boolean inNewThread)
- throws Exception
+ public static ListenerManager launchManager(String parametersName,
+ boolean inNewThread) throws Exception
{
- ListenerManager manager = ListenerManagerFactory.getInstance().getListenerManager(parametersName);
+ ListenerManager manager = ListenerManagerFactory.getInstance()
+ .getListenerManager(parametersName);
if (inNewThread)
{
new Thread(manager).start();
}
else
{
- StringBuilder sb = new StringBuilder("You are running a ListenerManager in your own thread")
- .append(" - It won't return until it's run() method ends")
- ;
+ StringBuilder sb = new StringBuilder(
+ "You are running a ListenerManager in your own thread")
+ .append(" - It won't return until it's run() method ends");
_logger.warn(sb.toString());
manager.run();
}
return manager;
- } //________________________________
-
- public static EPR tryToDeliver(Message message, String category, String name)
- throws Exception
+ } // ________________________________
+
+ public static EPR tryToDeliver(Message message, String category, String name)
+ throws Exception
{
Courier courier = null;
Registry reg = RegistryFactory.getRegistry();
Collection<EPR> all = reg.findEPRs(category, name);
- if (null!=all)
+ if (null != all)
for (EPR epr : all)
{
try
@@ -71,215 +101,246 @@
continue;
return epr;
}
- finally { CourierUtil.cleanCourier(courier); }
+ finally
+ {
+ CourierUtil.cleanCourier(courier);
+ }
}
- String service = "["+category+","+name+"]";
- String txt = (null==all || all.size()<1)
- ? "No EPRs registered for "+service
- : "Unable to deliver message to registered EPRs for "+service
- ;
+ String service = "[" + category + "," + name + "]";
+ String txt = (null == all || all.size() < 1) ? "No EPRs registered for "
+ + service
+ : "Unable to deliver message to registered EPRs for " + service;
throw new Exception(txt);
- } //________________________________
-
+ } // ________________________________
+
public static EPR assembleEpr(ConfigTree tree)
- throws ConfigurationException
- {
- String urlString = tree.getAttribute(ListenerTagNames.URL_TAG);
- String protocol = (null==urlString)
- ? tree.getAttribute(ListenerTagNames.PROTOCOL_TAG)
- : urlString.split(":")[0];
+ throws ConfigurationException
+ {
+ String urlString = tree.getAttribute(ListenerTagNames.URL_TAG);
+ String protocol = (null == urlString) ? tree
+ .getAttribute(ListenerTagNames.PROTOCOL_TAG) : urlString
+ .split(":")[0];
- try
- {
- if ("jms" .equals(protocol)) return jmsEprFromElement(tree);
- if ("file" .equals(protocol)) return fileEprFromElement(tree);
- if ("ftp" .equals(protocol)) return fileEprFromElement(tree);
- if ("jdbc" .equals(protocol)) return jdbcEprFromElement(tree);
- }
- catch (Exception e)
- {
- _logger.error("Problem",e);
- throw new ConfigurationException("xx",e);
- }
-
- throw new ConfigurationException("Unknown protocol <"+protocol+">");
-
- } //________________________________
-
+ try
+ {
+ if ("jms".equals(protocol))
+ return jmsEprFromElement(tree);
+ if ("file".equals(protocol))
+ return fileEprFromElement(tree);
+ if ("ftp".equals(protocol))
+ return fileEprFromElement(tree);
+ if ("jdbc".equals(protocol))
+ return jdbcEprFromElement(tree);
+ }
+ catch (Exception e)
+ {
+ _logger.error("Problem", e);
+ throw new ConfigurationException("xx", e);
+ }
+
+ throw new ConfigurationException("Unknown protocol <" + protocol + ">");
+
+ } // ________________________________
+
public static JMSEpr jmsEprFromElement(ConfigTree tree)
- throws ConfigurationException
+ throws ConfigurationException
{
try
{
-
- String name = tree.getAttribute(JMSEpr.DESTINATION_NAME_TAG,null);
- String type = getAttrAndWarn(tree, JMSEpr.DESTINATION_TYPE_TAG,"queue");
- String jndiURL = getAttrAndWarn(tree, JMSEpr.JNDI_URL_TAG ,"localhost");
- String jndiContextFactory
- = getAttrAndWarn(tree,JMSEpr.JNDI_CONTEXT_FACTORY,NamingContext.JBOSS_INITIAL_CONTEXT_FACTORY);
- String jndiPkgPrefix
- =getAttrAndWarn(tree,JMSEpr.JNDI_PKG_PREFIX_TAG,NamingContext.JBOSS_URL_PKG_PREFIX);
- String jmsFactoryClass
- = getAttrAndWarn(tree,JMSEpr.CONNECTION_FACTORY_TAG, "ConnectionFactory");
-
- String selector = tree.getAttribute(JMSEpr.MESSAGE_SELECTOR_TAG);
- if (Util.isNullString(selector))
- _logger.debug("No value specified for "+JMSEpr.MESSAGE_SELECTOR_TAG+" attribute"
- +" - All messages in queue <"+name+"> will be picked up by listener");
-
- JMSEpr epr = new JMSEpr(type,name,jmsFactoryClass
- ,jndiURL,jndiContextFactory,jndiPkgPrefix,selector);
-
+ String name = tree.getAttribute(JMSEpr.DESTINATION_NAME_TAG, null);
+
+ String type = getAttrAndWarn(tree, JMSEpr.DESTINATION_TYPE_TAG,
+ "queue");
+ String jndiURL = getAttrAndWarn(tree, JMSEpr.JNDI_URL_TAG,
+ "localhost");
+ String jndiContextFactory = getAttrAndWarn(tree,
+ JMSEpr.JNDI_CONTEXT_FACTORY,
+ NamingContext.JBOSS_INITIAL_CONTEXT_FACTORY);
+ String jndiPkgPrefix = getAttrAndWarn(tree,
+ JMSEpr.JNDI_PKG_PREFIX_TAG,
+ NamingContext.JBOSS_URL_PKG_PREFIX);
+ String jmsFactoryClass = getAttrAndWarn(tree,
+ JMSEpr.CONNECTION_FACTORY_TAG, "ConnectionFactory");
+
+ String selector = tree.getAttribute(JMSEpr.MESSAGE_SELECTOR_TAG);
+ if (Util.isNullString(selector))
+ _logger.debug("No value specified for "
+ + JMSEpr.MESSAGE_SELECTOR_TAG + " attribute"
+ + " - All messages in queue <" + name
+ + "> will be picked up by listener");
+
+ JMSEpr epr = new JMSEpr(type, name, jmsFactoryClass, jndiURL,
+ jndiContextFactory, jndiPkgPrefix, selector);
+
return epr;
}
- catch (Exception e) { throw new ConfigurationException(e); }
- } //________________________________
-
+ catch (Exception e)
+ {
+ throw new ConfigurationException(e);
+ }
+ } // ________________________________
- public static FileEpr fileEprFromElement(ConfigTree tree)
- throws Exception
+ public static FileEpr fileEprFromElement(ConfigTree tree) throws Exception
{
- URL url = new URL(tree.getAttribute(ListenerTagNames.URL_TAG,null));
- String protocol = url.getProtocol();
-
- if ("file".equals(protocol))
- {
- if (!new File(url.getFile()).isDirectory())
- throw new ConfigurationException("Attribute "
- +ListenerTagNames.URL_TAG+" must reference a directory");
- }
+ URL url = new URL(tree.getAttribute(ListenerTagNames.URL_TAG, null));
+ String protocol = url.getProtocol();
- FileEpr epr =
- ("file".equals(protocol)) ? new FileEpr(url)
- :("ftp".equals(protocol)) ? new FTPEpr (url)
- : null
- ;
- if (null==epr)
- throw new ConfigurationException("Unsupported file protocol : "+protocol);
-
- String inputSuffix = tree.getAttribute(FileEpr.INPUT_SUFFIX_TAG);
- if (! Util.isNullString(inputSuffix))
- epr.setInputSuffix(inputSuffix);
-
- boolean bErrorDel = Boolean.parseBoolean
- (getAttrAndWarn(tree,FileEpr.ERROR_DEL_TAG,"true"));
- String errorDir = tree.getAttribute(FileEpr.ERROR_DIR_TAG);
- String errorSuffix = tree.getAttribute(FileEpr.ERROR_SUFFIX_TAG);
- if (bErrorDel)
- {
- if (null!= errorDir || null!=errorSuffix)
- _logger.warn("If you don't specify "+FileEpr.ERROR_DEL_TAG+"'false' ,"
- +FileEpr.ERROR_DIR_TAG+" and "+FileEpr.ERROR_SUFFIX_TAG
- +" will have no effect because files in error will be deleted");
- }
- if (null==errorDir)
- {
- errorDir = url.getFile();
- warnDefault(FileEpr.ERROR_DIR_TAG, errorDir);
- }
- if (null==errorSuffix)
- {
- errorSuffix = ".esbERROR";
- warnDefault(FileEpr.ERROR_SUFFIX_TAG, errorSuffix);
- }
- epr.setErrorDelete(bErrorDel);
- epr.setErrorDirectory(errorDir);
- epr.setErrorSuffix(errorSuffix);
-
- boolean bPostDel = Boolean.parseBoolean
- (getAttrAndWarn(tree,FileEpr.POST_DEL_TAG,"true"));
+ if ("file".equals(protocol))
+ {
+ if (!new File(url.getFile()).isDirectory())
+ throw new ConfigurationException("Attribute "
+ + ListenerTagNames.URL_TAG
+ + " must reference a directory");
+ }
- String postDir = tree.getAttribute(FileEpr.POST_DIR_TAG);
- String postSuffix = tree.getAttribute(FileEpr.POST_SUFFIX_TAG);
- if (bPostDel)
- {
- if (null!= postDir || null!=postSuffix)
- _logger.warn("If you don't specify "+FileEpr.POST_DEL_TAG+"'false' ,"
- +FileEpr.POST_DIR_TAG+" and "+FileEpr.POST_SUFFIX_TAG
- +" will have no effect because processed input messages will be deleted");
- }
- if (null==postDir)
- {
- postDir = url.getFile();
- warnDefault(FileEpr.POST_DIR_TAG, postDir);
- }
- if (null==postSuffix)
- {
- postSuffix = ".esbDONE";
- warnDefault(FileEpr.POST_SUFFIX_TAG, postSuffix);
- }
- epr.setPostDelete (bPostDel);
- epr.setPostDirectory(postDir);
- epr.setPostSuffix (postSuffix);
-
- if (epr instanceof FTPEpr)
- {
- FTPEpr ftp = (FTPEpr)epr;
- ftp.setPassive(Boolean.valueOf(getAttrAndWarn(tree,FTPEpr.PASSIVE_TAG,"false")));
- }
- return epr;
- } //________________________________
-
-
- public static JDBCEpr jdbcEprFromElement(ConfigTree tree)
- throws Exception
+ FileEpr epr = ("file".equals(protocol)) ? new FileEpr(url) : ("ftp"
+ .equals(protocol)) ? new FTPEpr(url) : null;
+ if (null == epr)
+ throw new ConfigurationException("Unsupported file protocol : "
+ + protocol);
+
+ String inputSuffix = tree.getAttribute(FileEpr.INPUT_SUFFIX_TAG);
+ if (!Util.isNullString(inputSuffix))
+ epr.setInputSuffix(inputSuffix);
+
+ boolean bErrorDel = Boolean.parseBoolean(getAttrAndWarn(tree,
+ FileEpr.ERROR_DEL_TAG, "true"));
+ String errorDir = tree.getAttribute(FileEpr.ERROR_DIR_TAG);
+ String errorSuffix = tree.getAttribute(FileEpr.ERROR_SUFFIX_TAG);
+ if (bErrorDel)
+ {
+ if (null != errorDir || null != errorSuffix)
+ _logger
+ .warn("If you don't specify "
+ + FileEpr.ERROR_DEL_TAG
+ + "'false' ,"
+ + FileEpr.ERROR_DIR_TAG
+ + " and "
+ + FileEpr.ERROR_SUFFIX_TAG
+ + " will have no effect because files in error will be deleted");
+ }
+ if (null == errorDir)
+ {
+ errorDir = url.getFile();
+ warnDefault(FileEpr.ERROR_DIR_TAG, errorDir);
+ }
+ if (null == errorSuffix)
+ {
+ errorSuffix = ".esbERROR";
+ warnDefault(FileEpr.ERROR_SUFFIX_TAG, errorSuffix);
+ }
+ epr.setErrorDelete(bErrorDel);
+ epr.setErrorDirectory(errorDir);
+ epr.setErrorSuffix(errorSuffix);
+
+ boolean bPostDel = Boolean.parseBoolean(getAttrAndWarn(tree,
+ FileEpr.POST_DEL_TAG, "true"));
+
+ String postDir = tree.getAttribute(FileEpr.POST_DIR_TAG);
+ String postSuffix = tree.getAttribute(FileEpr.POST_SUFFIX_TAG);
+ if (bPostDel)
+ {
+ if (null != postDir || null != postSuffix)
+ _logger
+ .warn("If you don't specify "
+ + FileEpr.POST_DEL_TAG
+ + "'false' ,"
+ + FileEpr.POST_DIR_TAG
+ + " and "
+ + FileEpr.POST_SUFFIX_TAG
+ + " will have no effect because processed input messages will be deleted");
+ }
+ if (null == postDir)
+ {
+ postDir = url.getFile();
+ warnDefault(FileEpr.POST_DIR_TAG, postDir);
+ }
+ if (null == postSuffix)
+ {
+ postSuffix = ".esbDONE";
+ warnDefault(FileEpr.POST_SUFFIX_TAG, postSuffix);
+ }
+ epr.setPostDelete(bPostDel);
+ epr.setPostDirectory(postDir);
+ epr.setPostSuffix(postSuffix);
+
+ if (epr instanceof FTPEpr)
+ {
+ FTPEpr ftp = (FTPEpr) epr;
+ ftp.setPassive(Boolean.valueOf(getAttrAndWarn(tree,
+ FTPEpr.PASSIVE_TAG, "false")));
+ }
+ return epr;
+ } // ________________________________
+
+ public static JDBCEpr jdbcEprFromElement(ConfigTree tree) throws Exception
{
- String url = tree.getAttribute(JDBCEpr.URL_TAG,null);
+ String url = tree.getAttribute(JDBCEpr.URL_TAG, null);
if (!url.toLowerCase().startsWith("jdbc"))
throw new ConfigurationException("URL in "
- +ListenerTagNames.URL_TAG+" must be a jdbc URL");
+ + ListenerTagNames.URL_TAG + " must be a jdbc URL");
- boolean bPostDel = Boolean.valueOf(tree.getAttribute(JDBCEpr.POST_DEL_TAG,"true"));
- boolean bErrorDel = Boolean.valueOf(tree.getAttribute(JDBCEpr.ERROR_DEL_TAG,"true"));
- JDBCEpr epr = new JDBCEpr(url,bPostDel,bErrorDel);
- epr.setDriver (tree.getAttribute(JDBCEpr.DRIVER_TAG ,null));
- epr.setUserName (getAttrAndWarn(tree,JDBCEpr.USERNAME_TAG ,""));
- epr.setPassword (getAttrAndWarn(tree,JDBCEpr.PASSWORD_TAG ,""));
- epr.setTableName (tree.getAttribute(JDBCEpr.TABLE_NAME_TAG ,null));
- epr.setMessageIdColumn (getColName(tree,JDBCEpr.MESSAGE_ID_COLUMN_TAG));
- epr.setStatusColumn (getColName(tree,JDBCEpr.STATUS_COLUMN_TAG));
- epr.setDataColumn (getColName(tree,JDBCEpr.DATA_COLUMN_TAG));
- epr.setTimestampColumn (getColName(tree,JDBCEpr.TIMESTAMP_COLUMN_TAG));
-
+ boolean bPostDel = Boolean.valueOf(tree.getAttribute(
+ JDBCEpr.POST_DEL_TAG, "true"));
+ boolean bErrorDel = Boolean.valueOf(tree.getAttribute(
+ JDBCEpr.ERROR_DEL_TAG, "true"));
+ JDBCEpr epr = new JDBCEpr(url, bPostDel, bErrorDel);
+ epr.setDriver(tree.getAttribute(JDBCEpr.DRIVER_TAG, null));
+ epr.setUserName(getAttrAndWarn(tree, JDBCEpr.USERNAME_TAG, ""));
+ epr.setPassword(getAttrAndWarn(tree, JDBCEpr.PASSWORD_TAG, ""));
+ epr.setTableName(tree.getAttribute(JDBCEpr.TABLE_NAME_TAG, null));
+ epr.setMessageIdColumn(getColName(tree, JDBCEpr.MESSAGE_ID_COLUMN_TAG));
+ epr.setStatusColumn(getColName(tree, JDBCEpr.STATUS_COLUMN_TAG));
+ epr.setDataColumn(getColName(tree, JDBCEpr.DATA_COLUMN_TAG));
+ epr.setTimestampColumn(getColName(tree, JDBCEpr.TIMESTAMP_COLUMN_TAG));
+
return epr;
- } //________________________________
-
+ } // ________________________________
+
private static final String s_Sfx = "_column";
- private static String getColName(ConfigTree tree,String tag) throws ConfigurationException
+
+ private static String getColName(ConfigTree tree, String tag)
+ throws ConfigurationException
{
- String defaultColname = (tag.endsWith(s_Sfx)?tag.substring(0,tag.length()-s_Sfx.length()) : null);
+ String defaultColname = (tag.endsWith(s_Sfx) ? tag.substring(0, tag
+ .length()
+ - s_Sfx.length()) : null);
return getAttrAndWarn(tree, tag, defaultColname);
- } //________________________________
+ } // ________________________________
-
- public static String getAttrAndWarn(ConfigTree tree, String tag,String defaultValue)
- throws ConfigurationException
+ public static String getAttrAndWarn(ConfigTree tree, String tag,
+ String defaultValue) throws ConfigurationException
{
String value = null;
try
{
value = tree.getAttribute(tag);
- if (null==value)
- if (null==defaultValue)
- throw new ConfigurationException("Missing or invalid "+tag+" attribute");
+ if (null == value)
+ if (null == defaultValue)
+ throw new ConfigurationException("Missing or invalid "
+ + tag + " attribute");
else
{
- warnDefault(tag,defaultValue);
+ warnDefault(tag, defaultValue);
value = defaultValue;
}
return value;
}
- catch (Exception e) { throw new ConfigurationException(e); }
- } //________________________________
-
- private static final boolean LOGWARN=true;
+ catch (Exception e)
+ {
+ throw new ConfigurationException(e);
+ }
+ } // ________________________________
+
+ private static final boolean LOGWARN = true;
+
private static void warnDefault(String tag, String defaultValue)
{
if (LOGWARN)
- _logger.debug("No value specified for "+tag+" attribute"
- +" - Using default value: '"+defaultValue+"'");
- } //________________________________
-
+ _logger.debug("No value specified for " + tag + " attribute"
+ + " - Using default value: '" + defaultValue + "'");
+ } // ________________________________
+
private static final Logger _logger = Logger.getLogger(ListenerUtil.class);
}
Added: labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/ListenerManagerIntegrationTest.java
===================================================================
--- labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/ListenerManagerIntegrationTest.java 2006-12-19 12:03:53 UTC (rev 8396)
+++ labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/ListenerManagerIntegrationTest.java 2006-12-19 12:13:15 UTC (rev 8397)
@@ -0,0 +1,269 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY 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 along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package dummy;
+
+import static org.junit.Assert.assertTrue;
+
+import java.io.ByteArrayOutputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.net.URI;
+import java.sql.DriverManager;
+import java.sql.Statement;
+import java.util.Properties;
+import java.util.Random;
+import java.util.UUID;
+
+import junit.framework.Assert;
+import junit.framework.JUnit4TestAdapter;
+
+import org.apache.log4j.Logger;
+import org.apache.log4j.xml.DOMConfigurator;
+import org.jboss.internal.soa.esb.couriers.DeliverOnlyCourier;
+import org.jboss.soa.esb.addressing.Call;
+import org.jboss.soa.esb.addressing.EPR;
+import org.jboss.soa.esb.addressing.eprs.FileEpr;
+import org.jboss.soa.esb.couriers.CourierFactory;
+import org.jboss.soa.esb.helpers.ConfigTree;
+import org.jboss.soa.esb.listeners.ListenerManager;
+import org.jboss.soa.esb.listeners.ListenerUtil;
+import org.jboss.soa.esb.listeners.message.EsbListenerController;
+import org.jboss.soa.esb.message.Message;
+import org.jboss.soa.esb.message.format.MessageFactory;
+import org.jboss.soa.esb.testutils.FileUtil;
+import org.jboss.soa.esb.testutils.HsqldbUtil;
+import org.jboss.soa.esb.testutils.TestEnvironmentUtil;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+public class ListenerManagerIntegrationTest
+{
+
+ @BeforeClass
+ public static void setUp() throws Exception
+ {
+ _logger.info("Writing temp files to "+TMP_DIR);
+
+ // delete this one just to make sure asserts take the new ones
+ _returnFile.delete();
+
+ // initialize registry
+ runBeforeAllTests();
+
+ }
+
+ @AfterClass
+ public static void tearDown() throws Exception
+ {
+ _returnFile.delete();
+
+ Thread.sleep(2000);
+ if ("org.hsqldb.jdbcDriver".equals(mDbDriver))
+ HsqldbUtil.stopHsqldb(mDbUrl, mDbUsername, mDbPassword);
+ }
+
+ @Test
+ public void allTests() throws Exception
+ {
+ String winOrUnix = (isWindows()) ? "Win" : "Unix";
+ for (String file : new String[]
+ {
+ "/esbListenerFtp.xml"
+ ,"/esbListenerFile"+winOrUnix+".xml"
+ ,"/esbListenerJms.xml"
+ })
+ {
+ _logger.info("___Test for FILENAME: "+file+" starting ____________________");
+ oneTest(file);
+ _logger.info("___Test for FILENAME: "+file+" FINISHED ____________________");
+ }
+ } //________________________________
+
+ private void oneTest(String fileName) throws Exception
+ {
+ // Write wome messages to EPR obtained from configuration file
+ String configFile = getClass().getResource(fileName).getFile();
+ ConfigTree tree = ConfigTree.fromInputStream(new FileInputStream(configFile));
+ ConfigTree eprElement = tree.getAllChildren()[0].getFirstChild("EPR");
+ EPR toEPR = ListenerUtil.assembleEpr(eprElement);
+ if (toEPR instanceof FileEpr)
+ {
+ // take inputSuffix as outputSuffix for initial message sending
+ eprElement.setAttribute(FileEpr.POST_SUFFIX_TAG,eprElement.getAttribute(FileEpr.INPUT_SUFFIX_TAG));
+ eprElement.setAttribute(FileEpr.INPUT_SUFFIX_TAG,null);
+ toEPR = ListenerUtil.assembleEpr(eprElement);
+ }
+
+ String THE_TEXT = "___Config="+fileName+"___ Message Content ___";
+
+ int howMany = 10; // how many messages do you want to send before the listener comes up
+ DeliverOnlyCourier sender = CourierFactory.getCourier(toEPR);
+ Message message = MessageFactory.getInstance().getMessage();
+ message.getHeader().setCall(new Call(toEPR));
+ message.getBody().setContents(THE_TEXT.getBytes());
+ for (int i1=0; i1<howMany; i1++)
+ {
+ URI uri = new URI(UUID.randomUUID().toString());
+ message.getHeader().getCall().setMessageID(uri);
+ sender.deliver(message);
+ }
+
+ _returnFile.delete();
+ // launch listener manager in a child thread
+ _manager = ListenerUtil.launchManager(configFile, true);
+ _logger.debug(" Waiting for all child listeners to start");
+ _manager.waitUntilReady();
+ _logger.debug(" All child listeners ready");
+
+ // JUST FOR THIS TEST:
+ // Give your listener some time to process queued messages (see howMany above)
+ // Time allowed, and maxThreads in config file will impact how many messages
+ // will be processed, and how many will remain unprocessed
+ Thread.sleep(150*howMany);
+
+ _logger.debug("going to EndRequested");
+ _manager.requestEnd();
+ _logger.debug("back from EndRequested");
+
+ Assert.assertEquals(THE_TEXT, stringFromFile(_returnFile));
+ _returnFile.delete();
+ }
+
+ static void bytesToFile(File file, byte[] text) throws Exception
+ {
+ OutputStream out = new FileOutputStream(file);
+ out.write(text);
+ out.close();
+ } //________________________________
+
+ static String stringFromFile(File file) throws Exception
+ {
+ ByteArrayOutputStream out = new ByteArrayOutputStream();
+
+ FileInputStream inp = new FileInputStream(file);
+ byte[] ba = new byte[1000];
+ int iQ;
+ while (-1 != (iQ=inp.read(ba)))
+ if (iQ > 0)
+ out.write(ba,0,iQ);
+ inp.close();
+
+ out.close();
+ return out.toString();
+ } //________________________________
+
+ public static void runBeforeAllTests()
+ {
+ try {
+ DOMConfigurator.configure(TestEnvironmentUtil.getUserDir("product","../product") + "etc/test/resources/log4j.xml");
+ TestEnvironmentUtil.setESBPropertiesFileToUse("product","../product");
+ //Set the juddi properties file in System so juddi will pick it up later and use the test values.
+ String juddiPropertiesFile = "/org/jboss/soa/esb/services/registry/juddi-qatest.properties";
+ System.setProperty("juddi.propertiesFile", juddiPropertiesFile);
+ //Read this properties file to get the db connection string
+ Properties props = new Properties();
+ InputStream inStream = Class.class.getResourceAsStream(juddiPropertiesFile);
+ props.load(inStream);
+ mDbDriver = props.getProperty("juddi.jdbcDriver");
+ mDbUrl = props.getProperty("juddi.jdbcUrl");
+ mDbUsername = props.getProperty("juddi.jdbcUsername");
+ mDbPassword = props.getProperty("juddi.jdbcPassword");
+
+ String database="not tested yet";
+ if ("org.hsqldb.jdbcDriver".equals(mDbDriver)) {
+ database = "hsqldb";
+ //Bring up hsql on default port 9001
+ HsqldbUtil.startHsqldb(TestEnvironmentUtil.getUserDir("product","../product") + "build/hsqltestdb", "juddi");
+ } else if ("com.mysql.jdbc.Driver".equals(mDbDriver)) {
+ database = "mysql";
+ } //add and test your own database..
+
+ //Get the registry-schema create scripts
+ String sqlDir = TestEnvironmentUtil.getUserDir("product","../product") + "install/jUDDI-registry/sql/" + database + "/";
+ //Drop what is there now, if exists. We want to start fresh.
+ String sqlDropCmd = FileUtil.readTextFile(new File(sqlDir + "drop_database.sql"));
+ String sqlCreateCmd = FileUtil.readTextFile(new File(sqlDir + "create_database.sql"));
+ String sqlInsertPubCmd = FileUtil.readTextFile(new File(sqlDir + "insert_publishers.sql"));
+
+ try {
+ Class.forName(mDbDriver);
+ } catch (Exception e) {
+ System.out.println("ERROR: failed to load " + database + " JDBC driver.");
+ e.printStackTrace();
+ return;
+ }
+ java.sql.Connection con = DriverManager.getConnection(mDbUrl, mDbUsername, mDbPassword);
+ Statement stmnt = con.createStatement();
+ stmnt.execute(sqlDropCmd);
+ stmnt.execute(sqlCreateCmd);
+ stmnt.execute(sqlInsertPubCmd);
+
+ } catch (Throwable e) {
+ e.printStackTrace();
+ System.out.println("We should stop testing, since we don't have a db.");
+ assertTrue(false);
+ }
+ }
+ public static junit.framework.Test suite() {
+ return new JUnit4TestAdapter(ListenerManagerIntegrationTest.class);
+ }
+
+ private static boolean isWindows()
+ { return System.getProperty("os.name").toLowerCase().contains("window"); }
+ private static final String TMP_DIR = isWindows() ? "/temp" : "/tmp";
+
+ private static Logger _logger = Logger.getLogger(ListenerManagerIntegrationTest.class);
+
+ static File _returnFile = new File(TMP_DIR,"ListenerManagerOutput.txt");
+
+
+ EsbListenerController _esbListController;
+ ListenerManager _manager;
+
+ private static String mDbDriver;
+ private static String mDbUrl;
+ private static String mDbUsername;
+ private static String mDbPassword;
+
+ public static class MockMessageAwareAction
+ {
+ Random _rand = new Random(System.currentTimeMillis());
+ ConfigTree _config;
+ public MockMessageAwareAction(ConfigTree config) { _config = config; }
+ public Message writeToDisk (Message message) throws Exception
+ {
+ String id = message.getHeader().getCall().getMessageID().toASCIIString();
+ long lSleep = Math.abs(_rand.nextInt())%300;
+ _logger.info("Random sleep on "+Thread.currentThread()+"="+lSleep+"-Message id="+id);
+ Thread.sleep(lSleep);
+ bytesToFile(_returnFile, message.getBody().getContents());
+ return message;
+ } // ________________________________
+
+ } // ___________________________________________________
+
+}
Added: labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/ListenerManagerUnitTest.java
===================================================================
--- labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/ListenerManagerUnitTest.java 2006-12-19 12:03:53 UTC (rev 8396)
+++ labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/ListenerManagerUnitTest.java 2006-12-19 12:13:15 UTC (rev 8397)
@@ -0,0 +1,299 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY 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 along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.soa.esb.listeners;
+
+import static org.junit.Assert.assertTrue;
+
+import java.io.ByteArrayOutputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.net.URI;
+import java.sql.DriverManager;
+import java.sql.Statement;
+import java.util.Properties;
+import java.util.Random;
+import java.util.UUID;
+
+import junit.framework.Assert;
+import junit.framework.JUnit4TestAdapter;
+import junit.framework.TestCase;
+
+import org.apache.log4j.Logger;
+import org.apache.log4j.xml.DOMConfigurator;
+import org.jboss.internal.soa.esb.couriers.DeliverOnlyCourier;
+import org.jboss.soa.esb.addressing.Call;
+import org.jboss.soa.esb.addressing.EPR;
+import org.jboss.soa.esb.addressing.PortReference;
+import org.jboss.soa.esb.addressing.eprs.FileEpr;
+import org.jboss.soa.esb.couriers.CourierFactory;
+import org.jboss.soa.esb.helpers.ConfigTree;
+import org.jboss.soa.esb.listeners.ListenerManager;
+import org.jboss.soa.esb.listeners.ListenerUtil;
+import org.jboss.soa.esb.listeners.message.EsbListenerController;
+import org.jboss.soa.esb.message.Message;
+import org.jboss.soa.esb.message.format.MessageFactory;
+import org.jboss.soa.esb.testutils.FileUtil;
+import org.jboss.soa.esb.testutils.HsqldbUtil;
+import org.jboss.soa.esb.testutils.TestEnvironmentUtil;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+public class ListenerManagerUnitTest
+{
+ @BeforeClass
+ public static void setUp() throws Exception
+ {
+ _logger.info("Writing temp files to " + TMP_DIR);
+
+ // delete this one just to make sure asserts take the new ones
+ _returnFile.delete();
+
+ // initialize registry
+ runBeforeAllTests();
+ }
+
+ @AfterClass
+ public static void tearDown() throws Exception
+ {
+ _returnFile.delete();
+ }
+
+ @Test
+ public void allTests() throws Exception
+ {
+ String file = "listenerFile.xml";
+
+ _logger.info("___Test for FILENAME: " + file
+ + " starting ____________________");
+
+ oneTest(file);
+
+ _logger.info("___Test for FILENAME: " + file
+ + " FINISHED ____________________");
+ }
+
+ private void oneTest(String fileName) throws Exception
+ {
+ // Write wome messages to EPR obtained from configuration file
+ String configFile = getClass().getResource(fileName).getFile();
+ ConfigTree tree = ConfigTree.fromInputStream(new FileInputStream(
+ configFile));
+ ConfigTree eprElement = tree.getAllChildren()[0].getFirstChild("EPR");
+ EPR toEPR = ListenerUtil.assembleEpr(eprElement);
+
+ if (toEPR instanceof FileEpr)
+ {
+ toEPR.setAddr(new PortReference("file://"+System.getProperty("java.io.tmpdir")));
+
+ // take inputSuffix as outputSuffix for initial message sending
+ eprElement.setAttribute(FileEpr.POST_SUFFIX_TAG, eprElement
+ .getAttribute(FileEpr.INPUT_SUFFIX_TAG));
+ eprElement.setAttribute(FileEpr.INPUT_SUFFIX_TAG, null);
+ toEPR = ListenerUtil.assembleEpr(eprElement);
+ }
+ else
+ Assert.fail();
+
+ String THE_TEXT = "___Config=" + fileName + "___ Message Content ___";
+
+ int howMany = 10; // how many messages do you want to send before the
+ // listener comes up
+
+ DeliverOnlyCourier sender = CourierFactory.getCourier(toEPR);
+
+ Message message = MessageFactory.getInstance().getMessage();
+ message.getHeader().setCall(new Call(toEPR));
+ message.getBody().setContents(THE_TEXT.getBytes());
+
+ for (int i1 = 0; i1 < howMany; i1++)
+ {
+ URI uri = new URI(UUID.randomUUID().toString());
+ message.getHeader().getCall().setMessageID(uri);
+ sender.deliver(message);
+ }
+
+ _returnFile.delete();
+
+ // launch listener manager in a child thread
+ _manager = ListenerUtil.launchManager(configFile, true);
+ _logger.debug("Waiting for all child listeners to start");
+ _manager.waitUntilReady();
+ _logger.debug(" All child listeners ready");
+
+ // JUST FOR THIS TEST:
+ // Give your listener some time to process queued messages (see howMany
+ // above)
+ // Time allowed, and maxThreads in config file will impact how many
+ // messages
+ // will be processed, and how many will remain unprocessed
+
+ Thread.sleep(150 * howMany);
+
+ _logger.debug("going to EndRequested");
+ _manager.requestEnd();
+ _logger.debug("back from EndRequested");
+
+ Assert.assertEquals(THE_TEXT, stringFromFile(_returnFile));
+
+ _returnFile.delete();
+ }
+
+ static void bytesToFile(File file, byte[] text) throws Exception
+ {
+ OutputStream out = new FileOutputStream(file);
+ out.write(text);
+ out.close();
+ }
+
+ static String stringFromFile(File file) throws Exception
+ {
+ ByteArrayOutputStream out = new ByteArrayOutputStream();
+
+ FileInputStream inp = new FileInputStream(file);
+ byte[] ba = new byte[1000];
+ int iQ;
+ while (-1 != (iQ = inp.read(ba)))
+ if (iQ > 0)
+ out.write(ba, 0, iQ);
+ inp.close();
+
+ out.close();
+ return out.toString();
+ }
+
+ public static void runBeforeAllTests()
+ {
+ try {
+ DOMConfigurator.configure(TestEnvironmentUtil.getUserDir("product","../product") + "/etc/test/resources/log4j.xml");
+ TestEnvironmentUtil.setESBPropertiesFileToUse("product","../product");
+ // Set the juddi properties file in System so juddi will pick it up
+ // later and use the test values.
+ String juddiPropertiesFile = "/org/jboss/soa/esb/listeners/juddi-unittest.properties";
+ System.setProperty("juddi.propertiesFile", juddiPropertiesFile);
+ // Read this properties file to get the db connection string
+ Properties props = new Properties();
+ InputStream inStream = Class.class.getResourceAsStream(juddiPropertiesFile);
+
+ props.load(inStream);
+ mDbDriver = props.getProperty("juddi.jdbcDriver");
+ mDbUrl = props.getProperty("juddi.jdbcUrl");
+ mDbUsername = props.getProperty("juddi.jdbcUsername");
+ mDbPassword = props.getProperty("juddi.jdbcPassword");
+
+ String database="not tested yet";
+ if ("org.hsqldb.jdbcDriver".equals(mDbDriver)) {
+ database = "hsqldb";
+ // Bring up hsql on default port 9001
+ HsqldbUtil.startHsqldb(TestEnvironmentUtil.getUserDir("product","../product") + "/build/hsqltestdb", "juddi");
+ } else if ("com.mysql.jdbc.Driver".equals(mDbDriver)) {
+ database = "mysql";
+ } // add and test your own database..
+
+ // Get the registry-schema create scripts
+ String sqlDir = TestEnvironmentUtil.getUserDir("product","../product") + "/install/jUDDI-registry/sql/" + database + "/";
+ // Drop what is there now, if exists. We want to start fresh.
+ String sqlDropCmd = FileUtil.readTextFile(new File(sqlDir + "drop_database.sql"));
+ String sqlCreateCmd = FileUtil.readTextFile(new File(sqlDir + "create_database.sql"));
+ String sqlInsertPubCmd = FileUtil.readTextFile(new File(sqlDir + "insert_publishers.sql"));
+
+ try
+ {
+ Class.forName(mDbDriver);
+ }
+ catch (Exception e)
+ {
+ System.out.println("ERROR: failed to load " + database + " JDBC driver.");
+ e.printStackTrace();
+ return;
+ }
+ java.sql.Connection con = DriverManager.getConnection(mDbUrl, mDbUsername, mDbPassword);
+ Statement stmnt = con.createStatement();
+ stmnt.execute(sqlDropCmd);
+ stmnt.execute(sqlCreateCmd);
+ stmnt.execute(sqlInsertPubCmd);
+
+ } catch (Throwable e) {
+ e.printStackTrace();
+ System.out.println("We should stop testing, since we don't have a db.");
+ assertTrue(false);
+ }
+ }
+
+ public static junit.framework.Test suite()
+ {
+ return new JUnit4TestAdapter(ListenerManagerUnitTest.class);
+ }
+
+ private static boolean isWindows()
+ {
+ return System.getProperty("os.name").toLowerCase().contains("windows");
+ }
+
+ private static final String TMP_DIR = System.getProperty("java.io.tmpdir",
+ "/tmp");
+
+ private static Logger _logger = Logger
+ .getLogger(ListenerManagerUnitTest.class);
+
+ static File _returnFile = new File(TMP_DIR, "ListenerManagerOutput.txt");
+
+ EsbListenerController _esbListController;
+
+ ListenerManager _manager;
+
+ private static String mDbDriver;
+ private static String mDbUrl;
+ private static String mDbUsername;
+ private static String mDbPassword;
+
+ public static class MockMessageAwareAction
+ {
+ Random _rand = new Random(System.currentTimeMillis());
+
+ ConfigTree _config;
+
+ public MockMessageAwareAction(ConfigTree config)
+ {
+ _config = config;
+ }
+
+ public Message writeToDisk(Message message) throws Exception
+ {
+ String id = message.getHeader().getCall().getMessageID()
+ .toASCIIString();
+ long lSleep = Math.abs(_rand.nextInt()) % 300;
+
+ _logger.info("Random sleep on " + Thread.currentThread() + "="
+ + lSleep + "-Message id=" + id);
+ Thread.sleep(lSleep);
+ bytesToFile(_returnFile, message.getBody().getContents());
+
+ return message;
+ }
+ }
+
+}
Added: labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/listenerFile.xml
===================================================================
--- labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/listenerFile.xml 2006-12-19 12:03:53 UTC (rev 8396)
+++ labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/listenerFile.xml 2006-12-19 12:13:15 UTC (rev 8397)
@@ -0,0 +1,23 @@
+<DummyTester parameterReloadSecs="180">
+ <DummyActionConfig
+ service-category="CatgFileEsbListener"
+ service-name="testFileListener"
+ service-description="My Dummy Service Name FILE"
+ listenerClass="org.jboss.soa.esb.listeners.message.MessageAwareListener"
+ maxThreads="10"
+ >
+ <EPR
+ URL="file:///tmp"
+ inputSuffix=".testFile"
+ postDelete="false"
+ postSuffix=".processedOK"
+ />
+
+ <action class="org.jboss.soa.esb.listeners.ListenerManagerUnitTest$MockMessageAwareAction" process="writeToDisk" />
+ <action class="org.jboss.soa.esb.actions.Notifier" okMethod="notifyOK">
+ <NotificationList type="OK">
+ <target class="NotifyConsole" />
+ </NotificationList>
+ </action>
+ </DummyActionConfig>
+</DummyTester>
Modified: labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/internal/soa/esb/couriers/FileCourier.java
===================================================================
--- labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/internal/soa/esb/couriers/FileCourier.java 2006-12-19 12:03:53 UTC (rev 8396)
+++ labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/internal/soa/esb/couriers/FileCourier.java 2006-12-19 12:13:15 UTC (rev 8397)
@@ -83,6 +83,7 @@
{
_receiverOnly = receiverOnly;
_epr = epr;
+
checkEprParms();
} // ________________________________
@@ -94,6 +95,7 @@
protected void checkEprParms() throws CourierException
{
_outputSuffix = null;
+
try
{
_outputSuffix = _epr.getPostSuffix();
@@ -110,7 +112,7 @@
.debug("No suffix for delivered messages - using default of <"
+ _outputSuffix + ">");
}
-
+
// Certain things can only be checked in local filesystem
try
{
Modified: labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/internal/soa/esb/couriers/TwoWayCourierImpl.java
===================================================================
--- labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/internal/soa/esb/couriers/TwoWayCourierImpl.java 2006-12-19 12:03:53 UTC (rev 8396)
+++ labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/internal/soa/esb/couriers/TwoWayCourierImpl.java 2006-12-19 12:13:15 UTC (rev 8397)
@@ -62,6 +62,7 @@
{
DeliverOnlyCourier old = _deliverCourier;
_deliverCourier = getDeliverCourier(toEPR);
+
tryToCleanup(old);
}
/**
@@ -71,6 +72,7 @@
{
PickUpOnlyCourier old = _pickupCourier;
_pickupCourier = getPickupCourier(replyToEPR);
+
tryToCleanup(old);
}
Modified: labs/jbossesb/trunk/product/core/rosetta/tests/src/org/jboss/soa/esb/testutils/TestEnvironmentUtil.java
===================================================================
--- labs/jbossesb/trunk/product/core/rosetta/tests/src/org/jboss/soa/esb/testutils/TestEnvironmentUtil.java 2006-12-19 12:03:53 UTC (rev 8396)
+++ labs/jbossesb/trunk/product/core/rosetta/tests/src/org/jboss/soa/esb/testutils/TestEnvironmentUtil.java 2006-12-19 12:13:15 UTC (rev 8397)
@@ -56,7 +56,7 @@
public static void setESBPropertiesFileToUse()
{
//Set the jbossesb properties file in System, so we can pick up the one for testing
- String jbossesbPropertiesFile = getUserDir() + "etc/test/resources/jbossesb-unittest-properties.xml";
+ String jbossesbPropertiesFile = getUserDir() + "/etc/test/resources/jbossesb-unittest-properties.xml";
System.setProperty("org.jboss.soa.esb.propertyFile", jbossesbPropertiesFile);
}
/**
@@ -65,7 +65,7 @@
public static void setESBPropertiesFileToUse(String dir)
{
//Set the jbossesb properties file in System, so we can pick up the one for testing
- String jbossesbPropertiesFile = getUserDir(dir) + "etc/test/resources/jbossesb-unittest-properties.xml";
+ String jbossesbPropertiesFile = getUserDir(dir) + "/etc/test/resources/jbossesb-unittest-properties.xml";
System.setProperty("org.jboss.soa.esb.propertyFile", jbossesbPropertiesFile);
}
@@ -75,7 +75,7 @@
public static void setESBPropertiesFileToUse(String eclipseDir, String antDir)
{
//Set the jbossesb properties file in System, so we can pick up the one for testing
- String jbossesbPropertiesFile = getUserDir(eclipseDir, antDir) + "etc/test/resources/jbossesb-unittest-properties.xml";
+ String jbossesbPropertiesFile = getUserDir(eclipseDir, antDir) + "/etc/test/resources/jbossesb-unittest-properties.xml";
System.setProperty("org.jboss.soa.esb.propertyFile", jbossesbPropertiesFile);
}
Modified: labs/jbossesb/trunk/product/core/services/src/org/jboss/internal/soa/esb/services/registry/JAXRRegistryImpl.java
===================================================================
--- labs/jbossesb/trunk/product/core/services/src/org/jboss/internal/soa/esb/services/registry/JAXRRegistryImpl.java 2006-12-19 12:03:53 UTC (rev 8396)
+++ labs/jbossesb/trunk/product/core/services/src/org/jboss/internal/soa/esb/services/registry/JAXRRegistryImpl.java 2006-12-19 12:13:15 UTC (rev 8397)
@@ -169,11 +169,13 @@
Connection connection = JAXRRegistryImpl.getConnection();
try {
//Find the service
+
Service service = findService(category,serviceName);
if (service==null) {
logger.log(Priority.INFO, "Service " + serviceName + " does not yet exist, creating now..");
service = registerService(category, serviceName, serviceDescription);
}
+
connection.setCredentials(JAXRRegistryImpl.creds);
RegistryService rs = connection.getRegistryService();
BusinessLifeCycleManager blm = rs.getBusinessLifeCycleManager();
Modified: labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/services/registry/RegistryFactory.java
===================================================================
--- labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/services/registry/RegistryFactory.java 2006-12-19 12:03:53 UTC (rev 8396)
+++ labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/services/registry/RegistryFactory.java 2006-12-19 12:13:15 UTC (rev 8397)
@@ -1,53 +1,67 @@
/*
-* JBoss, Home of Professional Open Source
-* Copyright 2006, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY 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 along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY 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 along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
package org.jboss.soa.esb.services.registry;
import org.apache.log4j.Logger;
import org.apache.log4j.Priority;
import org.jboss.soa.esb.common.Configuration;
import org.jboss.soa.esb.common.Factory;
+
/**
* Returns an Instance of the Registry.
+ *
* @author kstam
- *
+ *
*/
public class RegistryFactory extends Factory
{
private static Logger logger = Logger.getLogger(RegistryException.class);
-
- public static Registry getRegistry() throws RegistryException{
+
+ public static Registry getRegistry() throws RegistryException
+ {
Registry registry = null;
String className = Configuration.getRegistryImplementationClass();
logger.log(Priority.INFO, "Going to load " + className);
- try {
+
+ try
+ {
// instruct class loader to load the Registry Implementation
Class registryClass = getClassForName(className);
// Try to instance the Registry
registry = (Registry) registryClass.newInstance();
- } catch (ClassNotFoundException cnfex) {
- throw new RegistryException("Registry Implementation=" + className + " not found", cnfex);
- } catch (Exception e) {
- throw new RegistryException("Invocation exception. " + e.getLocalizedMessage(), e);
}
+ catch (ClassNotFoundException cnfex)
+ {
+ throw new RegistryException("Registry Implementation=" + className
+ + " not found", cnfex);
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+
+ throw new RegistryException("Invocation exception. "
+ + e.getLocalizedMessage(), e);
+ }
+
return registry;
}
}
Modified: labs/jbossesb/trunk/product/docs/GettingStarted.sxw
===================================================================
(Binary files differ)
Deleted: labs/jbossesb/trunk/product/docs/QuickStart.odt
===================================================================
(Binary files differ)
Deleted: labs/jbossesb/trunk/product/docs/QuickStart.pdf
===================================================================
(Binary files differ)
Added: labs/jbossesb/trunk/product/docs/WARNING.txt
===================================================================
--- labs/jbossesb/trunk/product/docs/WARNING.txt 2006-12-19 12:03:53 UTC (rev 8396)
+++ labs/jbossesb/trunk/product/docs/WARNING.txt 2006-12-19 12:13:15 UTC (rev 8397)
@@ -0,0 +1,3 @@
+WARNING: the pdf documents in this directory may not be up-to-date with respect to
+the various OpenOffice documents. Between releases only the OpenOffice documents are
+normative.
\ No newline at end of file
Modified: labs/jbossesb/trunk/product/docs/services/RegistryConfiguration.odt
===================================================================
(Binary files differ)
Deleted: labs/jbossesb/trunk/product/install/README.TXT
===================================================================
--- labs/jbossesb/trunk/product/install/README.TXT 2006-12-19 12:03:53 UTC (rev 8396)
+++ labs/jbossesb/trunk/product/install/README.TXT 2006-12-19 12:13:15 UTC (rev 8397)
@@ -1,46 +0,0 @@
-#########################################################################
-# JBoss, Home of Professional Open Source
-# Copyright 2006, JBoss Inc., and individual contributors as indicated
-# by the @authors tag. See the copyright.txt in the distribution for a
-# full listing of individual contributors.
-#
-# This is free software; you can redistribute it and/or modify it
-# under the terms of the GNU Lesser General Public License as
-# published by the Free Software Foundation; either version 2.1 of
-# the License, or (at your option) any later version.
-#
-# This software is distributed in the hope that it will be useful,
-# but WITHOUT ANY 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 along with this software; if not, write to the Free
-# Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-# 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-#########################################################################
-
-HOW TO INSTALL JBoss ESB:
-
-
-1. Copy the <JBoss ESB Home>/lib/jbossesb.sar directory to your <JBOSS_HOME>/server/default/deploy directory
-
-2. Edit the properties-service.xml in your <JBOSS_HOME>/server/default/deploy directory and add the following attribute entry:
- <attribute name="URLList">
- ./conf/jbossesb-properties.xml
- </attribute>
- * This lets the JBoss ESB application know where to find its config file
-
-3. Copy the <JBoss ESB HOME>/install/conf/jbossesb-properties.xml to your <JBOSS_HOME>/server/default/conf directory
-
-4. Load the database schema located in <JBoss ESB HOME>/install/database/JBossESB-DB.sql into your PostGreSQL database and create a new database of your choice.
-
-5. Copy the <JBoss ESB HOME>/install/deploy/JBossESB-DS.xml to your <JBOSS_HOME>/server/default/deploy directory.
-
-6. Edit the JBossESB-DS.xml and change as required for your database settings
-
-7. Copy the PostGreSQL JDBC driver into your <JBOSS_HOME>/server/default/lib directory
-
-8. Edit the <JBOSS_HOME>/server/default/conf/jbossEsb.properties file and modify as per your environment for mail notifications to work
-
-9. Launch JBoss Application Server
More information about the jboss-svn-commits
mailing list