[jboss-svn-commits] JBL Code SVN: r5246 - in labs/jbossesb/branches/refactor: . product product/esb product/esb/ESBCore product/esb/listeners/src/org/jboss/soa/esb/listeners product/esb/processors/src/org/jboss/soa/esb/processors product/etc product/etc/schemas qa
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Sat Jul 22 07:31:07 EDT 2006
Author: arvinder
Date: 2006-07-22 07:30:53 -0400 (Sat, 22 Jul 2006)
New Revision: 5246
Added:
labs/jbossesb/branches/refactor/product/
labs/jbossesb/branches/refactor/product/build.xml
labs/jbossesb/branches/refactor/product/docs/
labs/jbossesb/branches/refactor/product/esb/
labs/jbossesb/branches/refactor/product/esb/ESBCore/
labs/jbossesb/branches/refactor/product/esb/listeners/src/org/jboss/soa/esb/listeners/JmsQueueListener.java
labs/jbossesb/branches/refactor/product/esb/processors/src/org/jboss/soa/esb/processors/EsbMsgProcessor.java
labs/jbossesb/branches/refactor/product/etc/
labs/jbossesb/branches/refactor/product/etc/schemas/
labs/jbossesb/branches/refactor/product/etc/schemas/xml/
labs/jbossesb/branches/refactor/product/jbi/
labs/jbossesb/branches/refactor/product/lib/
labs/jbossesb/branches/refactor/product/product.properties
labs/jbossesb/branches/refactor/qa/
labs/jbossesb/branches/refactor/qa/esb/
labs/jbossesb/branches/refactor/qa/jbi/
Removed:
labs/jbossesb/branches/refactor/ESBCore/
labs/jbossesb/branches/refactor/JBI/
labs/jbossesb/branches/refactor/build.xml
labs/jbossesb/branches/refactor/docs/
labs/jbossesb/branches/refactor/lib/
labs/jbossesb/branches/refactor/product.properties
labs/jbossesb/branches/refactor/product/esb/ESBCore/ant.bat
labs/jbossesb/branches/refactor/product/esb/ESBCore/build.xml
labs/jbossesb/branches/refactor/product/esb/ESBCore/common/
labs/jbossesb/branches/refactor/product/esb/ESBCore/listeners/
labs/jbossesb/branches/refactor/product/esb/ESBCore/processors/
labs/jbossesb/branches/refactor/product/esb/ESBCore/services/
labs/jbossesb/branches/refactor/product/esb/listeners/src/org/jboss/soa/esb/listeners/JmsQueueListener.java
labs/jbossesb/branches/refactor/product/esb/processors/src/org/jboss/soa/esb/processors/EsbMsgProcessor.java
labs/jbossesb/branches/refactor/xml/
Log:
reorganise structure
Deleted: labs/jbossesb/branches/refactor/build.xml
===================================================================
--- labs/jbossesb/branches/refactor/build.xml 2006-07-22 11:06:58 UTC (rev 5245)
+++ labs/jbossesb/branches/refactor/build.xml 2006-07-22 11:30:53 UTC (rev 5246)
@@ -1,186 +0,0 @@
-<project name="JBESB" default="org.jboss.esb.compile" basedir=".">
- <!-- class path behaviour -->
- <property name="build.sysclasspath" value="last"/>
-
- <!-- Set module name -->
- <property name="org.jboss.esb.internal.modulename" value="jbesb"/>
-
- <property name="org.jboss.esb.jboss.home" value="."/>
-
- <!-- Product properties file -->
- <property name="org.jboss.esb.product.properties" value="jbossesb-properties.xml"/>
-
- <!-- Set default properties filename -->
- <property name="org.jboss.esb.properties" value="product.properties"/>
-
- <!-- Some default build locations -->
- <property name="org.jboss.esb.internal.dest" value="${basedir}/build"/>
- <property name="org.jboss.esb.internal.jar.dest" value="${basedir}/build/dist/lib"/>
-
- <!-- Load Build Properties File -->
- <property file="${org.jboss.esb.properties}"/>
-
- <!-- Set internal property defaults -->
-
- <property name="org.jboss.esb.installationdirectory" value="${basedir}/build/dist"/>
-
- <!-- Compile with debugging? -->
- <property name="org.jboss.esb.debug" value="yes"/>
- <condition property="org.jboss.esb.debug" value="no">
- <equals arg1="${org.jboss.esb.debug}" arg2="no"/>
- </condition>
-
- <!-- Compile with deprecation? -->
- <property name="org.jboss.esb.deprecation" value="no"/>
- <condition property="org.jboss.esb.deprecation" value="yes">
- <equals arg1="${org.jboss.esb.deprecation}" arg2="yes"/>
- </condition>
-
- <!-- Compile with optimization? -->
- <property name="org.jboss.esb.optimize" value="on"/>
- <condition property="org.jboss.esb.optimize" value="off">
- <equals arg1="${org.jboss.esb.optimize}" arg2="off"/>
- </condition>
-
- <!-- Build from local libs? -->
- <property name="org.jboss.esb.frominstall" value="no"/>
- <condition property="org.jboss.esb.frominstall" value="yes">
- <equals arg1="${org.jboss.esb.frominstall}" arg2="yes"/>
- </condition>
-
- <!-- Build tests? -->
- <property name="org.jboss.esb.buildtests" value="no"/>
- <condition property="org.jboss.esb.buildtests" value="yes">
- <equals arg1="${org.jboss.esb.buildtests}" arg2="yes"/>
- </condition>
-
- <!-- Path names -->
- <property name="org.jboss.esb.internal.core" value="ESBCore"/>
- <property name="org.jboss.esb.internal.dest" value="${basedir}/build"/>
- <property name="org.jboss.esb.internal.jar.dest" value="${basedir}/lib"/>
- <property name="org.jboss.esb.internal.javadocs.dest" value="javadocs"/>
-
- <!-- Initialisation -->
- <target name="org.jboss.esb.internal.init">
- <!-- Define default build properties -->
- <tstamp>
- <format property="org.jboss.esb.date" pattern="yyyy/mm/dd hh:mm aa"/>
- </tstamp>
- <!-- Make the destination directory -->
- <mkdir dir="${org.jboss.esb.internal.dest}"/>
- </target>
-
- <!-- Compilation targets -->
-
- <target name="org.jboss.esb.compile"
- depends="org.jboss.esb.internal.init, org.jboss.esb.core.compile"/>
-
- <target name="org.jboss.esb.jar" depends="org.jboss.esb.internal.init, org.jboss.esb.core.jar"/>
-
- <target name="org.jboss.esb.core.compile" depends="org.jboss.esb.internal.init">
- <echo message="Compiling modules"/>
- <ant dir="ESBCore"/>
- </target>
-
- <!-- Test targets -->
- <target name="org.jboss.esb.test" depends="org.jboss.esb.compile">
- <echo message="Testing modules"/>
- <ant dir="ESBCore" target="org.jboss.esb.core.test"/>
- </target>
-
-
-
- <!-- javadocs paths -->
- <path id="org.jboss.esb.javadocs.path">
- <pathelement path="ESBCore/classes"/>
- </path>
-
- <property name="org.jboss.esb.javadocs.list"
- value="org.jboss.soa.*"/>
-
- <!-- Jar targets -->
- <target name="org.jboss.esb.core.jar" depends="org.jboss.esb.compile">
- <echo message="Building jar file"/>
- <ant dir="ESBCore" target="jar"/>
- </target>
-
- <!-- add ear file rule -->
-
- <target name="org.jboss.esb.javadocs"
- depends="org.jboss.esb.internal.init">
- <echo message="Building javadocs "/>
- <mkdir dir="${org.jboss.esb.internal.javadocs.dest}"/>
- <path id="org.jboss.esb.internal.javadocs.path">
- <path refid="org.jboss.esb.javadocs.path"/>
- </path>
-
- <javadoc
- sourcepathref="org.jboss.esb.internal.javadocs.path"
- destdir="${org.jboss.esb.internal.javadocs.dest}"
- packagenames="${org.jboss.esb.javadocs.list}"
- >
- <classpath>
- <path path="${org.jboss.esb.internal.src}"/>
- </classpath>
- </javadoc>
- </target>
-
- <target name="install" depends="org.jboss.esb.jar">
-
- <echo message="Installation directory : ${org.jboss.esb.installationdirectory}"/>
-
- <echo message="Installing jar files"/>
- <mkdir dir="${org.jboss.esb.installationdirectory}/lib"/>
- <copy
- todir="${org.jboss.esb.installationdirectory}/lib"
- >
- <fileset dir="lib">
- <include name="*.jar"/>
- </fileset>
- </copy>
-
- <echo message="Installing xml"/>
- <mkdir dir="${org.jboss.esb.installationdirectory}/xml"/>
- <copy
- todir="${org.jboss.esb.installationdirectory}/xml"
- >
- <fileset dir="xml"/>
- </copy>
-
- <!--
- <echo message="Installing javadocs"/>
- <mkdir dir="${org.jboss.esb.installationdirectory}/javadocs"/>
- <copy
- todir="${org.jboss.esb.installationdirectory}/javadocs"
- >
- <fileset dir="javadocs"/>
- </copy>
- -->
-
- </target>
-
- <!-- Clean targets -->
- <target name="org.jboss.esb.clean">
- <echo message="Cleaning modules"/>
-
- <echo message="Cleaning ESBCore"/>
- <ant dir="ESBCore" target="clean"/>
- </target>
-
- <target name="org.jboss.esb.purge">
- <echo message="Purging modules"/>
-
- <ant dir="ESBCore" target="purge"/>
-
- <delete dir="${org.jboss.esb.internal.dest}"/>
- <delete dir="${org.jboss.esb.internal.dest.root}"/>
- <delete dir="${org.jboss.esb.internal.javadocs.dest}"/>
- </target>
-
- <!-- Short target names -->
- <target name="compile" depends="org.jboss.esb.compile"/>
- <target name="test" depends="org.jboss.esb.test"/>
- <target name="jar" depends="org.jboss.esb.jar"/>
- <target name="clean" depends="org.jboss.esb.clean"/>
- <target name="purge" depends="org.jboss.esb.purge"/>
-</project>
Copied: labs/jbossesb/branches/refactor/product/build.xml (from rev 5237, labs/jbossesb/branches/refactor/build.xml)
Copied: labs/jbossesb/branches/refactor/product/docs (from rev 5237, labs/jbossesb/branches/refactor/docs)
Copied: labs/jbossesb/branches/refactor/product/esb (from rev 5238, labs/jbossesb/branches/refactor/ESBCore)
Copied: labs/jbossesb/branches/refactor/product/esb/ESBCore (from rev 5245, labs/jbossesb/branches/refactor/ESBCore)
Deleted: labs/jbossesb/branches/refactor/product/esb/ESBCore/ant.bat
===================================================================
--- labs/jbossesb/branches/refactor/ESBCore/ant.bat 2006-07-22 11:06:58 UTC (rev 5245)
+++ labs/jbossesb/branches/refactor/product/esb/ESBCore/ant.bat 2006-07-22 11:30:53 UTC (rev 5246)
@@ -1,12 +0,0 @@
- at echo off
-set ANT_CMD_LINE_ARGS=%1
-if ""%1""=="""" goto doneStart
-shift
-:setupArgs
-if ""%1""=="""" goto doneStart
-set ANT_CMD_LINE_ARGS=%ANT_CMD_LINE_ARGS% %1
-shift
-goto setupArgs
-:doneStart
-%ANT_HOME%\bin\ant %ANT_CMD_LINE_ARGS%
-
Deleted: labs/jbossesb/branches/refactor/product/esb/ESBCore/build.xml
===================================================================
--- labs/jbossesb/branches/refactor/ESBCore/build.xml 2006-07-22 11:06:58 UTC (rev 5245)
+++ labs/jbossesb/branches/refactor/product/esb/ESBCore/build.xml 2006-07-22 11:30:53 UTC (rev 5246)
@@ -1,122 +0,0 @@
-<?xml version="1.0" encoding="ISO-8859-1"?>
-
- <!-- =================================================================== -->
- <!-- build.xml - Builds all subprojects in child directories -->
- <!-- =================================================================== -->
-
-<project name="JbossEsb" default="org.jboss.esb.core.compile" basedir=".">
-
- <property name="org.jboss.esb.core.name.jar" value="name.jar-NOT_SET.jar"/>
- <property environment="env"/>
-
- <!-- =================================================================== -->
- <!-- Initialize -->
- <!-- =================================================================== -->
- <target name="org.jboss.esb.core.init">
- <tstamp>
- <format property="TODAY" pattern="d-MM-yy"/>
- </tstamp>
- </target>
-
- <!-- =================================================================== -->
- <!-- Prepares the directory structure -->
- <!-- =================================================================== -->
- <target name="org.jboss.esb.core.prepare" depends="org.jboss.esb.core.init">
- <mkdir dir="${org.jboss.esb.internal.dest}/dist"/>
- <mkdir dir="${org.jboss.esb.internal.dest}/dist/lib"/>
- </target>
-
- <!-- =================================================================== -->
- <!-- Compiles all the classes -->
- <!-- =================================================================== -->
- <target name="org.jboss.esb.core.compile" depends="org.jboss.esb.core.prepare" description="Compile subprojects">
- <echo message="Compiling submodules"/>
- <ant dir="common"/>
- <ant dir="services"/>
- <ant dir="processors"/>
- <ant dir="listeners"/>
- <!--
- <ant dir="tests"/>
- -->
- </target>
-
- <!-- =================================================================== -->
- <!-- Test all the classes -->
- <!-- =================================================================== -->
- <target name="org.jboss.esb.core.test" depends="org.jboss.esb.core.compile" description="Test subprojects">
- <echo message="Testing submodules"/>
- <ant dir="common" target="org.jboss.esb.common.test"/>
- <ant dir="listeners" target="org.jboss.esb.listeners.test"/>
- <ant dir="processors" target="org.jboss.esb.processors.test"/>
- <ant dir="services" target="org.jboss.esb.services.test"/>
- </target>
-
-
- <!-- =================================================================== -->
- <!-- Assemble jars -->
- <!-- =================================================================== -->
- <target name="jar" depends="org.jboss.esb.core.compile" description="Build jar files">
- <echo message="Building jar"/>
- <ant dir="common" target="jar"/>
- <ant dir="listeners" target="jar"/>
- <ant dir="processors" target="jar"/>
- <ant dir="services" target="jar"/>
- <antcall target="-ear"/>
- </target>
-
- <target name="-ear">
- <ear destfile="${org.jboss.esb.internal.dest}/dist/lib/jbossesb-appl.ear"
- appxml="services/src/META-INF/application.xml"
- >
- <fileset dir="${org.jboss.esb.internal.dest}/dist/lib"
- includes="*.jar"
- />
- </ear>
-
- </target>
-
- <!-- =================================================================== -->
- <!-- Clean all -->
- <!-- =================================================================== -->
- <target name="clean" description="Clean dist directory and cleans subprojects">
- <delete dir="${org.jboss.esb.internal.dest}"/>
- <!--
- for now I am going to delete the build directory as each module builds
- to a common place, so calling clean on each module does not make sense,
- that is unless we later configure the clean task to delete <module>
- specific classes
- -->
- <!--
- <ant dir="common" target="clean"/>
- <ant dir="listeners" target="clean"/>
- <ant dir="processors" target="clean"/>
- <ant dir="services" target="clean"/>
- -->
- <!-- tests are now per module, this will be cleaned up later
- <ant dir="tests" target="clean"/>
- -->
- </target>
-
- <target name="purge" depends="clean">
- <!--
- <delete dir="${org.jboss.esb.internal.dest}/dist"/>
- -->
- <!-- see comment above w.r.t clean and where module are build to -->
- <!--
- <ant dir="common" target="purge"/>
- <ant dir="listeners" target="purge"/>
- <ant dir="processors" target="purge"/>
- <ant dir="services" target="purge"/>
- -->
- <!-- tests are now per module, this will be cleaned up later
- <ant dir="tests" target="purge"/>
- -->
- </target>
-
- <!-- =================================================================== -->
- <!-- Rebuild everything from scratch -->
- <!-- =================================================================== -->
- <target name="all" depends="clean,jar" />
- <target name="recompile" depends="clean,org.jboss.esb.core.compile" />
-
-</project>
Deleted: labs/jbossesb/branches/refactor/product/esb/listeners/src/org/jboss/soa/esb/listeners/JmsQueueListener.java
===================================================================
--- labs/jbossesb/branches/refactor/ESBCore/listeners/src/org/jboss/soa/esb/listeners/JmsQueueListener.java 2006-07-21 23:39:44 UTC (rev 5238)
+++ labs/jbossesb/branches/refactor/product/esb/listeners/src/org/jboss/soa/esb/listeners/JmsQueueListener.java 2006-07-22 11:30:53 UTC (rev 5246)
@@ -1,513 +0,0 @@
-package org.jboss.soa.esb.listeners;
-
-import java.io.*;
-import java.lang.reflect.*;
-import java.util.Map;
-import java.util.HashMap;
-import java.util.Observer;
-import java.util.Observable;
-
-import org.apache.log4j.*;
-
-import javax.naming.*;
-import javax.jms.*;
-
-import org.jboss.soa.esb.services.*;
-import org.jboss.soa.esb.util.*;
-import org.jboss.soa.esb.common.*;
-import org.jboss.soa.esb.helpers.*;
-import org.jboss.soa.esb.notification.*;
-import org.jboss.soa.esb.parameters.*;
-import org.jboss.soa.esb.processors.*;
-
-public class JmsQueueListener
-{
- // You can override this value at constructor time of your
- // derived class after calling super(String)
- protected int m_iDfltReloadMillis= 180000 // default interval between
- // parameter reloading
- ;
-
- public static final String PARM_ACTION_CLASS = "actionClass";
-
- public static final String PARM_RELOAD_LTCY = "parmsReloadSecs";
-
- public static final String PARM_TOPIC_CONN_FACT = "topicConnFactoryClass";
- public static final String PARM_QUIESCE_TOPIC = "quiesceTopic";
- public static final String PARM_QUIESCE_SELECTOR = "quiesceSelector";
-
- public static final String LISTEN_QUEUE_CONN_FACT = "queueConnFactoryClass";
- public static final String LISTEN_QUEUE = "listenQueue";
- public static final String LISTEN_MSG_SELECTOR = "listenMsgSelector";
-
- protected ThreadGroup m_oThrGrp = Thread.currentThread().getThreadGroup();
- protected Map<String,GroupOfChilds> m_omChildPrc
- = new HashMap<String,GroupOfChilds>();
-
- protected ParamsRepository m_oParmRepos;
- protected Name m_oParmsName;
- protected Logger m_oLogger;
-
- protected DomElement m_oParms;
- protected boolean m_bEndRequested;
-
- protected TopicConnection m_oTopicConn;
- protected TopicSession m_oSession;
- protected Topic m_oTopic;
- protected TopicSubscriber m_oTopicSubs;
-
- protected long m_lNextReload;
-
-
-
- protected JmsQueueListener(String p_sParamsUid) throws Exception
- {
- m_oLogger = EsbUtil.getDefaultLogger(this.getClass());
-
- String sFactoryClass = EsbSysProps.getParamsReposFactoryClass();
- m_oParmRepos = ParamsReposUtil.reposFromFactory(sFactoryClass,null);
- m_oParmsName = m_oParmRepos.nameFromString(p_sParamsUid);
- runUntilEndRequested();
- } //__________________________________
-
- protected void runUntilEndRequested() throws Exception
- { while (! m_bEndRequested)
- { try
- { String sMsg = (null == m_oParms)
- ? "Initial Parameter loading" : "Reloading Params";
- m_oLogger.info(formatLogMsg(sMsg));
- m_oParms = m_oParmRepos.getElement(m_oParmsName);
- }
- catch (Exception e)
- {
- StringBuilder sb = new StringBuilder ("Problems loading params ")
- .append(m_oParmsName)
- .append((null==m_oParms)? " exiting..." : "continuing to use cached params")
- ;
- m_oLogger.error(formatLogMsg(sb.toString()));
- if (null==m_oParms)
- throw e;
- }
- quiesceTopicSubscribe();
- executeOneCycle();
- }
- } //__________________________________
-
- private void executeOneCycle() throws Exception
- {
- String sAtt = m_oParms.getAttr(PARM_RELOAD_LTCY);
- m_lNextReload = System.currentTimeMillis()
- + ( (null != sAtt)
- ? (1000 * Integer.parseInt(sAtt))
- : m_iDfltReloadMillis
- );
-
- DomElement[] oaParms = m_oParms.getAllElemChildren();
-
- boolean bFirst = true;
- while (System.currentTimeMillis() <= m_lNextReload)
- {
- for (DomElement oCurr : oaParms)
- {
- oneScan(oCurr, bFirst);
- }
- if (waitForQuiesce(1000))
- { m_bEndRequested = true;
- return;
- }
- bFirst = false;
- }
- } //_________________________________________
-
- protected String formatLogMsg(String p_s)
- { return new StringBuilder("Processor '")
- .append(getClass().getSimpleName()).append("' <")
- .append(p_s).append(">")
- .toString();
- } //__________________________________
-
- private final void quiesceTopicSubscribe() throws JMSException, NamingException
- {
- try
- {
- m_oTopicConn = null;
- m_oSession = null;
- m_oTopic = null;
- m_oTopicSubs = null;
-
- String sStopTopic = m_oParms.getAttr(PARM_QUIESCE_TOPIC);
- if (EsbUtil.isNullString(sStopTopic))
- return;
- String sFactClass = m_oParms.getAttr(PARM_TOPIC_CONN_FACT);
- if (EsbUtil.isNullString(sFactClass))
- sFactClass = "ConnectionFactory";
-
- String sJndiType = EsbSysProps.getJndiServerType();
- String sJndiURL = EsbSysProps.getJndiServerURL();
- Context oJndiCtx = AppServerContext.getServerContext(sJndiType,sJndiURL);
- Object tmp = oJndiCtx.lookup(sFactClass);
- TopicConnectionFactory tcf = (TopicConnectionFactory) tmp;
-
- m_oTopicConn = tcf.createTopicConnection();
- m_oTopic = (Topic) oJndiCtx.lookup(sStopTopic);
- m_oSession = m_oTopicConn.createTopicSession
- (false,TopicSession.AUTO_ACKNOWLEDGE);
- m_oTopicConn.start();
-
- String sSelector = m_oParms.getAttr(PARM_QUIESCE_SELECTOR);
- if (EsbUtil.isNullString(sSelector))
- sSelector = "processor='"+getClass().getSimpleName()+"'";
- m_oTopicSubs = m_oSession.createSubscriber(m_oTopic, sSelector,true);
- }
- catch (Exception e)
- { m_oLogger.error("Problems connecting to JMS. ",e);
- }
-
- } //_________________________________________
-
- protected boolean waitForQuiesce(long p_lMillis) throws Exception
- {
- try
- { boolean bSleep = (null== m_oTopicSubs);
- Object oMsg = (bSleep) ? null : secureQuiesceReceive(p_lMillis);
-
- if (null!=oMsg)
- { m_oLogger.info("Starting Quiesce of "
- +getClass().getSimpleName());
- return true;
- }
- if (bSleep)
- Thread.sleep(p_lMillis);
- return false;
-
- }
- catch (Exception e)
- { m_oLogger.error("Problems with waitForQuiesce. ",e);
- Thread.sleep(p_lMillis);
- return false;
- }
- } //_________________________________________
-
- private Message secureQuiesceReceive(long p_lMillis) throws Exception
- {
- while (true)
- try
- { return (null==m_oTopicSubs) ? null : m_oTopicSubs.receive(p_lMillis); }
- catch (JMSException e)
- {
- // put here your recovery code
- return null;
- }
-
- } //_________________________________________
-
-
- protected void oneScan(DomElement p_oP, boolean p_bFirst) throws Exception
- {
- String sPrcName = p_oP.getName();
- if (!m_omChildPrc.containsKey(sPrcName))
- {
- ThreadGroup[] oaCh = new ThreadGroup[m_oThrGrp.activeGroupCount()];
- int iMax = m_oThrGrp.enumerate(oaCh);
-
- ThreadGroup oThG = null;
- for (int i1 = 0; null == oThG && i1 < iMax; i1++)
- { if (m_oThrGrp.getName().equals(sPrcName))
- oThG = oaCh[i1];
- }
- if (null == oThG)
- oThG = new ThreadGroup(sPrcName);
- m_omChildPrc.put(sPrcName, newChildGroup(oThG));
- }
- GroupOfChilds oChildGrp = m_omChildPrc.get(sPrcName);
-
- if (null == oChildGrp) return;
- if (p_bFirst)
- oChildGrp.m_bError = false;
-
- try
- {
- oChildGrp.execute(p_oP);
- }
- catch (Exception e)
- {
- oChildGrp.m_bError = true;
- m_oLogger.error(formatLogMsg("GroupOfChilds.execute"), e);
- }
- } //_________________________________________
-
- protected GroupOfChilds newChildGroup(ThreadGroup pThG) throws Exception
- { return new GroupOfChilds(pThG); }
-
- protected class GroupOfChilds implements Observer
- {
- public static final String PARM_MAX_THREADS = "maxThreads";
-
- protected ThreadGroup m_oThrGrp;
- protected boolean m_bError = false;
-
- protected Class m_oExecClass;
- protected DomElement m_oChParms;
-
- protected int m_iQthr = 0, m_iMaxThr;
- protected StringBuilder m_sb;
- protected int m_iSbIni;
-
- protected QueueConnection m_oQconn;
- protected QueueSession m_oQsess;
- protected Queue m_oQueue;
-
- protected GroupOfChilds(ThreadGroup p_oThrGrp) throws Exception
- {
- m_oThrGrp = p_oThrGrp;
- m_sb = new StringBuilder("GroupOfThreads ")
- .append(m_oThrGrp.getName()).append(" : ");
- m_iSbIni = m_sb.length();
- } //________________________________
-
- public void update(Observable p_oObs, Object p_oUsrObj)
- {
- if (p_oUsrObj instanceof Integer)
- {
- updQthreads( ( (Integer) p_oUsrObj).intValue());
- }
- } //________________________________
-
- private synchronized void updQthreads(int p_i)
- {
- m_iQthr += p_i;
- } //________________________________
-
- private void execute(DomElement p_oP) throws Exception
- {
- m_sb.setLength(m_iSbIni);
- if (m_bError)
- {
- m_oLogger.warn(m_sb.append(" Skipping execution due to previous errors")
- .toString());
- return;
- }
- checkParms(p_oP);
- doYourJob (p_oP);
- } //________________________________
-
- protected void setMaxThreads(DomElement p_oP,int p_iMax)
- {
- String sAtt = p_oP.getAttr(PARM_MAX_THREADS);
- m_iMaxThr = (null == sAtt) ? 1 : Integer.parseInt(sAtt);
- m_iMaxThr = (m_iMaxThr < 1) ? 1
- : (m_iMaxThr > p_iMax) ? p_iMax
- : m_iMaxThr;
-
- } //________________________________
-
- protected Class checkActionClass(String p_sName) throws Exception
- {
- Class oCls;
- try { oCls = Class.forName(p_sName); }
- catch (ClassNotFoundException e)
- { throw new Exception(formatLogMsg("Class "+p_sName
- +" not found in classpath"));
- }
- try { oCls.getConstructor(new Class[] {DomElement.class}); }
- catch (NoSuchMethodException eN)
- { throw new Exception(formatLogMsg("No appropriate constructor "
- +p_sName+"(DomElement) found for class "));
- }
- return oCls;
- } //_________________________________________
-
- protected String obtainAtt(DomElement p_oP, String p_sAtt, String p_sDefault)
- throws Exception
- {
- String sVal = p_oP.getAttr(p_sAtt);
- if (null==sVal)
- sVal = p_sDefault;
- if (EsbUtil.isNullString(sVal) && (null==p_sDefault))
- throw new Exception(formatLogMsg("Missing or invalid <"+p_sAtt+"> attribute"));
-
- return sVal;
- } //________________________________
-
- protected void checkParms(DomElement p_oP) throws Exception
- {
- m_sb.setLength(m_iSbIni);
- m_oChParms = p_oP.cloneObj();
- m_oChParms.rmvChildsByName(EsbAbstractProcessor.PARMS_THIS_INSTANCE);
- setMaxThreads(p_oP,1);
-
- obtainAtt(p_oP,LISTEN_QUEUE,null);
- } //________________________________
-
- protected final void obtainQueue(DomElement p_oP) throws JMSException, NamingException
- {
- try
- {
- m_oQconn = null;
- m_oQsess = null;
- m_oQueue = null;
-
- String sQueue = p_oP.getAttr(LISTEN_QUEUE);
- String sFactClass = p_oP.getAttr(LISTEN_QUEUE_CONN_FACT);
- if (EsbUtil.isNullString(sFactClass))
- sFactClass = "ConnectionFactory";
-
- String sJndiType = EsbSysProps.getJndiServerType();
- String sJndiURL = EsbSysProps.getJndiServerURL();
- Context oJndiCtx = AppServerContext.getServerContext(sJndiType,sJndiURL);
- Object tmp = oJndiCtx.lookup(sFactClass);
- QueueConnectionFactory qcf = (QueueConnectionFactory) tmp;
-
- m_oQconn = qcf.createQueueConnection();
- m_oQueue = (Queue) oJndiCtx.lookup(sQueue);
- m_oQsess = m_oQconn.createQueueSession
- (false,TopicSession.AUTO_ACKNOWLEDGE);
- m_oQconn.start();
-
- }
- catch (Exception e)
- { m_oLogger.error("Problems connecting to JMS. ",e);
- }
-
- } //_________________________________________
-
- protected void doYourJob(DomElement p_oP) throws Exception
- {
- while(System.currentTimeMillis() < m_lNextReload)
- {
- if (m_iQthr >= m_iMaxThr)
- { m_oLogger.info(m_sb.append("Waiting for available threads").toString());
- Thread.sleep(5000);
- continue;
- }
- obtainQueue(p_oP);
- String sSelector = m_oParms.getAttr(LISTEN_MSG_SELECTOR);
- MessageConsumer oReader = m_oQsess.createReceiver(m_oQueue, sSelector);
- Message oMsg = (null==oReader) ? null
- : oReader.receiveNoWait();
- if (null==oMsg)
- { Thread.sleep(500);
- continue;
- }
-
- MsgChildProcess oNew = getMsgChildProcess(this,oMsg);
- new Thread(m_oThrGrp,oNew).start();
- // Wait a little bit, so thread count will be updated
- // at some point in the past, this sleep was indispensable
- // new thread control classes in Java 5 might have solved the problem
- Thread.sleep(500);
- }
- } //________________________________
-
- protected MsgChildProcess getMsgChildProcess
- (GroupOfChilds pDad, Message pMsg) throws Exception
- { return new MsgChildProcess (pDad,pMsg); }
-
- } //______________________________________________________
-
- protected class MsgChildProcess extends Observable implements Runnable
- {
- protected GroupOfChilds m_oParent; // you can always go there for common stuff
- protected Message m_oMsg;
-
- public MsgChildProcess(GroupOfChilds p_oGrp, Message p_oMsg)
- throws Exception
- {
- m_oParent = p_oGrp;
- this.addObserver(m_oParent);
- setChanged();
- // add 1 to child thread count
- notifyObservers(new Integer(1));
- } //__________________________________
-
- public void run()
- {
- Exception oAbend = null;
- try
- {
- Constructor oCnst = m_oParent.m_oExecClass
- .getConstructor (new Class[] {DomElement.class});
- DomElement oParms = m_oParent.m_oChParms.cloneObj();
- Object oInst = oCnst.newInstance (new Object[] {oParms});
- ((EsbMsgProcessor)oInst).processMessage(m_oMsg);
- }
- catch (Exception e)
- { m_oLogger.error("run() FAILED",e);
- oAbend = e;
- }
-
- if (null==oAbend)
- notifyOK();
- else
- notifyError(oAbend);
-
- setChanged();
- // decrease child thread count in parent group
- notifyObservers(new Integer(-1));
- } //______________________________
-
- public void notifyOK()
- { try
- {
- String sNotif = getOkNotifContent();
- for (DomElement oCurr : m_oParms.getElementChildren(NotificationList.ELEMENT))
- { NotificationList oNL = new NotificationList(oCurr);
- if (! oNL.isOK()) continue;
- getNotifHandler().sendNotifications(oCurr,sNotif);
- }
- }
- catch (Exception e) {}
- } //__________________________________
-
- public void notifyError(Exception p_e)
- {
- String sNotif = getErrorNotifContent();
- ByteArrayOutputStream oBO = new ByteArrayOutputStream();
- PrintStream oPS = new PrintStream(oBO);
- try
- { oPS.println(sNotif);
- if (null != p_e) p_e.printStackTrace(oPS);
- oPS.close();
-
- String sMsg = oBO.toString();
- for (DomElement oCurr : m_oParms.getElementChildren(NotificationList.ELEMENT))
- { NotificationList oNL = new NotificationList(oCurr);
- if (! oNL.isErr()) continue;
- getNotifHandler().sendNotifications(oNL,sMsg);
- }
- }
- catch (Exception e) { }
- } //__________________________________
-
- protected InotificationHandler getNotifHandler()
- {
- try { return NotificationHandlerFactory.getNotifHandler
- ("remote"
- ,EsbSysProps.getJndiServerType()
- ,EsbSysProps.getJndiServerURL()
- );
- }
- catch (Exception e)
- { m_oLogger.error(formatLogMsg("Notification FAILED"),e);
- return null;
- }
- } //______________________________
-
- // These methods to be overriden by you own derived class
- protected String getOkNotifContent()
- {
- return "Success";
- }
- protected String getErrorNotifContent()
- {
- return "FAILURE";
- }
-
- } //______________________________________________________
-
- public static void main(String[] args) throws Exception
- {
- new JmsQueueListener(args[0]);
- }
-
-} //____________________________________________________________________________
Copied: labs/jbossesb/branches/refactor/product/esb/listeners/src/org/jboss/soa/esb/listeners/JmsQueueListener.java (from rev 5245, labs/jbossesb/branches/refactor/ESBCore/listeners/src/org/jboss/soa/esb/listeners/JmsQueueListener.java)
Deleted: labs/jbossesb/branches/refactor/product/esb/processors/src/org/jboss/soa/esb/processors/EsbMsgProcessor.java
===================================================================
--- labs/jbossesb/branches/refactor/ESBCore/processors/src/org/jboss/soa/esb/processors/EsbMsgProcessor.java 2006-07-21 23:39:44 UTC (rev 5238)
+++ labs/jbossesb/branches/refactor/product/esb/processors/src/org/jboss/soa/esb/processors/EsbMsgProcessor.java 2006-07-22 11:30:53 UTC (rev 5246)
@@ -1,78 +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.
-*/
-package org.jboss.soa.esb.processors;
-
-import java.lang.reflect.Constructor;
-
-import javax.jms.Message;
-import javax.jms.TextMessage;
-
-import org.jboss.soa.esb.helpers.*;
-
-public class EsbMsgProcessor extends EsbAbstractProcessor
-{
- public EsbMsgProcessor(DomElement p_oP) throws Exception
- { super(p_oP,false);
- } //__________________________________
-
- protected void checkParms() throws Exception {}
- public void execute() throws Exception {}
-
- public void processMessage(Message p_oMsg) throws Exception
- {
- String sPrc = this.getClass().getName();
- sPrc = sPrc.substring(1+sPrc.lastIndexOf("."));
-
- StringBuffer sb = new StringBuffer("Message ");
- if (p_oMsg instanceof TextMessage)
- sb.append("<").append(((TextMessage)p_oMsg).getText()).append("> ");
- String sNotifMsg = sb.toString();
-
- sb.setLength(0);
- try
- {
- try
- { Class oCls = Class.forName(m_oParms.getAttr("actionClass"));
- Constructor oCns = oCls.getConstructor(new Class[] {Message.class,EsbAbstractProcessor.class});
- oCns.newInstance(new Object[] {p_oMsg,this});
-
- super.postProcess();
-
- sb.append(sPrc).append(" processed ").append(sNotifMsg).append(" successfully");
- super.notifyOK(sb.toString());
- }
- catch (Exception e)
- { m_oLogger.fatal("Message processor FAILED",e);
- throw e;
- }
- finally { super.release(); }
- }
-
- catch (Exception eGen)
- {
- System.out.println("test catch for rollback here..");
- super.notifyError(eGen," " + sPrc+" PROBLEMS processing "+sNotifMsg);
- throw eGen;
- }
- }//_________________________
-
-} //____________________________________________________________________________
Copied: labs/jbossesb/branches/refactor/product/esb/processors/src/org/jboss/soa/esb/processors/EsbMsgProcessor.java (from rev 5245, labs/jbossesb/branches/refactor/ESBCore/processors/src/org/jboss/soa/esb/processors/EsbMsgProcessor.java)
Copied: labs/jbossesb/branches/refactor/product/etc/schemas/xml (from rev 5237, labs/jbossesb/branches/refactor/xml)
Copied: labs/jbossesb/branches/refactor/product/jbi (from rev 5237, labs/jbossesb/branches/refactor/JBI)
Copied: labs/jbossesb/branches/refactor/product/lib (from rev 5237, labs/jbossesb/branches/refactor/lib)
Copied: labs/jbossesb/branches/refactor/product/product.properties (from rev 5237, labs/jbossesb/branches/refactor/product.properties)
Deleted: labs/jbossesb/branches/refactor/product.properties
===================================================================
--- labs/jbossesb/branches/refactor/product.properties 2006-07-22 11:06:58 UTC (rev 5245)
+++ labs/jbossesb/branches/refactor/product.properties 2006-07-22 11:30:53 UTC (rev 5246)
@@ -1,8 +0,0 @@
-# JBossESB ant properties file
-# $Id$
-#
-org.jboss.esb.deprecation=yes
-org.jboss.esb.optimize=off
-org.jboss.esb.alltests.build=yes
-org.jboss.esb.frominstall=no
-org.jboss.esb.jboss.home=.
More information about the jboss-svn-commits
mailing list