[jboss-svn-commits] JBL Code SVN: r5389 - in labs/jbossesb/branches/refactor/product/core: listeners/src/org/jboss/soa/esb/listeners processors/src/org/jboss/soa/esb/processors
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Tue Aug 1 17:30:02 EDT 2006
Author: arvinder
Date: 2006-08-01 17:29:38 -0400 (Tue, 01 Aug 2006)
New Revision: 5389
Added:
labs/jbossesb/branches/refactor/product/core/processors/src/org/jboss/soa/esb/processors/AbstractAggregator.java
labs/jbossesb/branches/refactor/product/core/processors/src/org/jboss/soa/esb/processors/AbstractProcessor.java
labs/jbossesb/branches/refactor/product/core/processors/src/org/jboss/soa/esb/processors/AbstractSaxProcessor.java
labs/jbossesb/branches/refactor/product/core/processors/src/org/jboss/soa/esb/processors/AbstractSqlPassthrough.java
labs/jbossesb/branches/refactor/product/core/processors/src/org/jboss/soa/esb/processors/AbstractSqlProcessor.java
labs/jbossesb/branches/refactor/product/core/processors/src/org/jboss/soa/esb/processors/FileProcessor.java
labs/jbossesb/branches/refactor/product/core/processors/src/org/jboss/soa/esb/processors/MsgProcessor.java
Removed:
labs/jbossesb/branches/refactor/product/core/processors/src/org/jboss/soa/esb/processors/EsbAbstractAggregator.java
labs/jbossesb/branches/refactor/product/core/processors/src/org/jboss/soa/esb/processors/EsbAbstractProcessor.java
labs/jbossesb/branches/refactor/product/core/processors/src/org/jboss/soa/esb/processors/EsbAbstractSaxProcessor.java
labs/jbossesb/branches/refactor/product/core/processors/src/org/jboss/soa/esb/processors/EsbAbstractSqlPassthrough.java
labs/jbossesb/branches/refactor/product/core/processors/src/org/jboss/soa/esb/processors/EsbAbstractSqlProcessor.java
labs/jbossesb/branches/refactor/product/core/processors/src/org/jboss/soa/esb/processors/EsbFileProcessor.java
labs/jbossesb/branches/refactor/product/core/processors/src/org/jboss/soa/esb/processors/EsbMsgProcessor.java
Modified:
labs/jbossesb/branches/refactor/product/core/listeners/src/org/jboss/soa/esb/listeners/AbstractPoller.java
labs/jbossesb/branches/refactor/product/core/listeners/src/org/jboss/soa/esb/listeners/BetterDirListener.java
labs/jbossesb/branches/refactor/product/core/listeners/src/org/jboss/soa/esb/listeners/JmsQueueListener.java
labs/jbossesb/branches/refactor/product/core/listeners/src/org/jboss/soa/esb/listeners/OldDirListener.java
labs/jbossesb/branches/refactor/product/core/listeners/src/org/jboss/soa/esb/listeners/SqlTablePoller.java
labs/jbossesb/branches/refactor/product/core/listeners/src/org/jboss/soa/esb/listeners/ZZDummyProcessor.java
labs/jbossesb/branches/refactor/product/core/processors/src/org/jboss/soa/esb/processors/FileCopier.java
labs/jbossesb/branches/refactor/product/core/processors/src/org/jboss/soa/esb/processors/ParamsFileProcessor.java
Log:
Remove Esb prefix
Modified: labs/jbossesb/branches/refactor/product/core/listeners/src/org/jboss/soa/esb/listeners/AbstractPoller.java
===================================================================
--- labs/jbossesb/branches/refactor/product/core/listeners/src/org/jboss/soa/esb/listeners/AbstractPoller.java 2006-08-01 21:08:27 UTC (rev 5388)
+++ labs/jbossesb/branches/refactor/product/core/listeners/src/org/jboss/soa/esb/listeners/AbstractPoller.java 2006-08-01 21:29:38 UTC (rev 5389)
@@ -34,7 +34,7 @@
import org.jboss.soa.esb.common.*;
import org.jboss.soa.esb.helpers.*;
import org.jboss.soa.esb.parameters.*;
-import org.jboss.soa.esb.processors.EsbAbstractProcessor;
+import org.jboss.soa.esb.processors.AbstractProcessor;
public abstract class AbstractPoller
{
@@ -360,7 +360,7 @@
{
m_sb.setLength(m_iSbIni);
m_oChParms = p_oP.cloneObj();
- m_oChParms.rmvChildsByName(EsbAbstractProcessor.PARMS_THIS_INSTANCE);
+ m_oChParms.rmvChildsByName(AbstractProcessor.PARMS_THIS_INSTANCE);
setMaxThreads(p_oP,10);
} //________________________________
Modified: labs/jbossesb/branches/refactor/product/core/listeners/src/org/jboss/soa/esb/listeners/BetterDirListener.java
===================================================================
--- labs/jbossesb/branches/refactor/product/core/listeners/src/org/jboss/soa/esb/listeners/BetterDirListener.java 2006-08-01 21:08:27 UTC (rev 5388)
+++ labs/jbossesb/branches/refactor/product/core/listeners/src/org/jboss/soa/esb/listeners/BetterDirListener.java 2006-08-01 21:29:38 UTC (rev 5389)
@@ -82,8 +82,8 @@
Thread.sleep(5000);
break;
}
- m_oChParms.rmvChildsByName(EsbAbstractProcessor.PARMS_THIS_INSTANCE);
- DomElement oThisProc = new DomElement(EsbAbstractProcessor.PARMS_THIS_INSTANCE);
+ m_oChParms.rmvChildsByName(AbstractProcessor.PARMS_THIS_INSTANCE);
+ DomElement oThisProc = new DomElement(AbstractProcessor.PARMS_THIS_INSTANCE);
oThisProc.setAttr(ParamsFileProcessor.FPRC_FILENAME, oFcurr.getName());
m_oChParms.addElemChild(oThisProc);
@@ -172,7 +172,7 @@
{ try
{ Constructor oCnst = m_oExecClass.getConstructor(new Class[] {DomElement.class});
Object oProc = oCnst.newInstance(new Object[] {m_oParms});
- ((EsbFileProcessor)oProc).execute();
+ ((FileProcessor)oProc).execute();
}
catch (Exception e) { m_oLogger.error("run() FAILED",e); }
Modified: labs/jbossesb/branches/refactor/product/core/listeners/src/org/jboss/soa/esb/listeners/JmsQueueListener.java
===================================================================
--- labs/jbossesb/branches/refactor/product/core/listeners/src/org/jboss/soa/esb/listeners/JmsQueueListener.java 2006-08-01 21:08:27 UTC (rev 5388)
+++ labs/jbossesb/branches/refactor/product/core/listeners/src/org/jboss/soa/esb/listeners/JmsQueueListener.java 2006-08-01 21:29:38 UTC (rev 5389)
@@ -331,7 +331,7 @@
{
m_sb.setLength(m_iSbIni);
m_oChParms = p_oP.cloneObj();
- m_oChParms.rmvChildsByName(EsbAbstractProcessor.PARMS_THIS_INSTANCE);
+ m_oChParms.rmvChildsByName(AbstractProcessor.PARMS_THIS_INSTANCE);
setMaxThreads(p_oP,10);
obtainAtt(p_oP,LISTEN_QUEUE,null);
@@ -414,7 +414,7 @@
{
protected GroupOfChilds m_oParent; // you can always go there for common stuff
protected DomElement m_oParms;
- protected EsbMsgProcessor m_oExec;
+ protected MsgProcessor m_oExec;
public MsgChildProcess(GroupOfChilds p_oGrp, DomElement p_oParms)
throws Exception
@@ -450,7 +450,7 @@
DomElement oParms = m_oParms.cloneObj();
Constructor oCns = m_oParent.m_oExecClass.getConstructor(oaArgs);
Object oInst = oCns.newInstance (new Object[] {oParms});
- m_oExec = (EsbMsgProcessor)oInst;
+ m_oExec = (MsgProcessor)oInst;
m_oExec.processMessage(oMsg);
notifyOK();
}
Modified: labs/jbossesb/branches/refactor/product/core/listeners/src/org/jboss/soa/esb/listeners/OldDirListener.java
===================================================================
--- labs/jbossesb/branches/refactor/product/core/listeners/src/org/jboss/soa/esb/listeners/OldDirListener.java 2006-08-01 21:08:27 UTC (rev 5388)
+++ labs/jbossesb/branches/refactor/product/core/listeners/src/org/jboss/soa/esb/listeners/OldDirListener.java 2006-08-01 21:29:38 UTC (rev 5389)
@@ -308,8 +308,8 @@
Thread.sleep(5000);
break;
}
- m_oChParms.rmvChildsByName(EsbAbstractProcessor.PARMS_THIS_INSTANCE);
- DomElement oThisProc = new DomElement(EsbAbstractProcessor.PARMS_THIS_INSTANCE);
+ m_oChParms.rmvChildsByName(AbstractProcessor.PARMS_THIS_INSTANCE);
+ DomElement oThisProc = new DomElement(AbstractProcessor.PARMS_THIS_INSTANCE);
oThisProc.setAttr(ParamsFileProcessor.FPRC_FILENAME, oFcurr.getName());
m_oChParms.addElemChild(oThisProc);
@@ -429,7 +429,7 @@
{ try
{ Constructor oCnst = m_oExecClass.getConstructor(new Class[] {DomElement.class});
Object oProc = oCnst.newInstance(new Object[] {m_oParms});
- ((EsbFileProcessor)oProc).execute();
+ ((FileProcessor)oProc).execute();
}
catch (Exception e) { m_oLogger.error("run() FAILED",e); }
Modified: labs/jbossesb/branches/refactor/product/core/listeners/src/org/jboss/soa/esb/listeners/SqlTablePoller.java
===================================================================
--- labs/jbossesb/branches/refactor/product/core/listeners/src/org/jboss/soa/esb/listeners/SqlTablePoller.java 2006-08-01 21:08:27 UTC (rev 5388)
+++ labs/jbossesb/branches/refactor/product/core/listeners/src/org/jboss/soa/esb/listeners/SqlTablePoller.java 2006-08-01 21:29:38 UTC (rev 5389)
@@ -313,7 +313,7 @@
List<DomElement> oResults = new ArrayList<DomElement>();
while (RS.next())
- { DomElement oNew = new DomElement(EsbAbstractProcessor.PARMS_THIS_INSTANCE);
+ { DomElement oNew = new DomElement(AbstractProcessor.PARMS_THIS_INSTANCE);
for (String sCurrCol : saColName)
oNew.setAttr(sCurrCol,RS.getString(sCurrCol));
oResults.add(oNew);
@@ -494,7 +494,7 @@
DomElement oParms = m_oParent.m_oChParms.cloneObj();
oParms.addElemChild(m_oInstP);
Object oInst = oCnst.newInstance (new Object[] {oParms});
- ((EsbAbstractProcessor)oInst).execute();
+ ((AbstractProcessor)oInst).execute();
changeStatus(ROW_STATE.Working,ROW_STATE.Done);
}
catch (Exception e)
Modified: labs/jbossesb/branches/refactor/product/core/listeners/src/org/jboss/soa/esb/listeners/ZZDummyProcessor.java
===================================================================
--- labs/jbossesb/branches/refactor/product/core/listeners/src/org/jboss/soa/esb/listeners/ZZDummyProcessor.java 2006-08-01 21:08:27 UTC (rev 5388)
+++ labs/jbossesb/branches/refactor/product/core/listeners/src/org/jboss/soa/esb/listeners/ZZDummyProcessor.java 2006-08-01 21:29:38 UTC (rev 5389)
@@ -3,7 +3,7 @@
import org.jboss.soa.esb.helpers.*;
import org.jboss.soa.esb.processors.*;
-public class ZZDummyProcessor extends EsbAbstractProcessor
+public class ZZDummyProcessor extends AbstractProcessor
{
public ZZDummyProcessor(DomElement p_oParms) throws Exception
{ super(p_oParms);
Copied: labs/jbossesb/branches/refactor/product/core/processors/src/org/jboss/soa/esb/processors/AbstractAggregator.java (from rev 5384, labs/jbossesb/branches/refactor/product/core/processors/src/org/jboss/soa/esb/processors/EsbAbstractAggregator.java)
===================================================================
--- labs/jbossesb/branches/refactor/product/core/processors/src/org/jboss/soa/esb/processors/EsbAbstractAggregator.java 2006-08-01 18:47:29 UTC (rev 5384)
+++ labs/jbossesb/branches/refactor/product/core/processors/src/org/jboss/soa/esb/processors/AbstractAggregator.java 2006-08-01 21:29:38 UTC (rev 5389)
@@ -0,0 +1,82 @@
+/*
+* 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.io.EOFException;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.jboss.soa.esb.helpers.*;
+
+public abstract class AbstractAggregator extends FileProcessor
+{
+ public abstract Object nextInputLine () throws Exception;
+ public abstract Object getGroupKey (Object p_oInp) throws Exception;
+ protected abstract Object composeObj (List p_oLout) throws Exception;
+
+ private Object m_oGroupKey = null;
+ protected List<Object> m_olGroup = new ArrayList<Object>();
+ ParamsFileProcessor m_oFPparm;
+
+ protected AbstractAggregator(DomElement p_oP) throws Exception
+ { super(p_oP);
+ } //__________________________________
+
+ private boolean isSameGroup(Object p_o)
+ { return (null == m_oGroupKey) ? false
+ :(null == p_o) ? false
+ : p_o.equals(m_oGroupKey)
+ ;
+ } //__________________________________
+
+ private long sendComposedObj() throws Exception
+ { if (null == m_oGroupKey) return -1;
+ return super.sendObject(composeObj(m_olGroup));
+ } //__________________________________
+
+ public void execute() throws Exception
+ { m_oFPparm.checkFile();
+ renameToWrk();
+ while (true)
+ try
+ { Object oInp = nextInputLine();
+ Object oGrpK = getGroupKey(oInp);
+ if (! isSameGroup(oGrpK))
+ { sendComposedObj();
+ m_olGroup.clear();
+ m_oGroupKey = getGroupKey(oInp);
+ }
+ m_olGroup.add(oInp);
+ }
+ catch (EOFException eEOF)
+ { sendComposedObj();
+ break;
+ }
+ catch (Exception e)
+ { m_oLogger.fatal("Exception in EsbFileProcessor",e);
+ renameToErr();
+ throw e;
+ }
+ renameToOK();
+ } //__________________________________
+
+} //____________________________________________________________________________
Copied: labs/jbossesb/branches/refactor/product/core/processors/src/org/jboss/soa/esb/processors/AbstractProcessor.java (from rev 5388, labs/jbossesb/branches/refactor/product/core/processors/src/org/jboss/soa/esb/processors/EsbAbstractProcessor.java)
===================================================================
--- labs/jbossesb/branches/refactor/product/core/processors/src/org/jboss/soa/esb/processors/EsbAbstractProcessor.java 2006-08-01 21:08:27 UTC (rev 5388)
+++ labs/jbossesb/branches/refactor/product/core/processors/src/org/jboss/soa/esb/processors/AbstractProcessor.java 2006-08-01 21:29:38 UTC (rev 5389)
@@ -0,0 +1,377 @@
+/*
+* 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.io.*;
+import java.lang.reflect.*;
+import java.util.*;
+
+import javax.sql.*;
+
+import org.apache.log4j.*;
+
+import org.jboss.soa.esb.util.*;
+import org.jboss.soa.esb.common.*;
+import org.jboss.soa.esb.common.bizclasses.*;
+import org.jboss.soa.esb.helpers.*;
+import org.jboss.soa.esb.helpers.persist.SimpleDataSource;
+
+import org.jboss.soa.esb.notification.*;
+import org.jboss.soa.esb.services.*;
+
+public abstract class AbstractProcessor
+{
+ public abstract void execute() throws Exception;
+ protected abstract void checkParms() throws Exception;
+
+ public static final String PARMS_THIS_INSTANCE = "__thisInstance";
+
+ private static final String POSTPRC_ELEMENT= "postProcess";
+ private static final String POSTPRC_CLASS = "actionClass";
+
+ public static final String CTX_PREFIX = "@@ctx@@";
+ public static final String CTX_BATCH_UID = CTX_PREFIX+"batchUid";
+ public static final String CTX_BATCH_NUM = CTX_PREFIX+"batchNum";
+ public static final String CTX_INPUT_FILE = CTX_PREFIX+"inputFile";
+ public static final String CTX_POST_FILE = CTX_PREFIX+"postFile";
+
+ private static final String[] s_saMacros =
+ {CTX_BATCH_UID, CTX_BATCH_NUM ,CTX_INPUT_FILE, CTX_POST_FILE };
+
+ protected Map <String,Object> m_oContext = new HashMap<String,Object>();
+ public void clearContext () { m_oContext.clear(); }
+ public Object rmvContextObj (String p_sKey) { return m_oContext.remove(p_sKey); }
+ public Object getContextObj (String p_sKey) { return m_oContext.get(p_sKey); }
+ public Object setContextObj (String p_sKey, Object p_oVal)
+ { return m_oContext.put(p_sKey,p_oVal); }
+
+ protected DomElement m_oParms ,m_oInstP;
+ protected Logger m_oLogger;
+
+ private InotificationHandler m_oNotifH;
+ protected InotificationHandler getNotifHandler() throws Exception
+ { if (null == m_oNotifH)
+ {
+ String sJndiType= SystemProperties.getJndiServerType();
+ String sJndiURL = SystemProperties.getJndiServerURL();
+ m_oNotifH = NotificationHandlerFactory.getNotifHandler
+ ("remote",sJndiType,sJndiURL);
+ }
+ return m_oNotifH;
+ } //________________________________
+
+
+ private AbstractProcessor() {}
+
+ protected AbstractProcessor(DomElement p_oParms) throws Exception
+ { this(p_oParms,true);
+ } //__________________________________
+
+ protected AbstractProcessor(DomElement p_oParms, boolean p_bLogInit) throws Exception
+ {
+ m_oLogger = EsbUtil.getDefaultLogger(this.getClass());
+ m_oParms = p_oParms;
+
+ try { m_oInstP = m_oParms.getFirstElementChild(PARMS_THIS_INSTANCE); }
+ catch (Exception eNo) {}
+ if (null==m_oInstP)
+ { m_oInstP = new DomElement(PARMS_THIS_INSTANCE);
+ m_oParms.addElemChild(m_oInstP);
+ }
+
+ checkParms();
+ } //__________________________________
+
+
+ public DomElement cloneParams() throws Exception {return m_oParms.cloneObj();}
+
+ private Integer m_oiType;
+
+ protected static final int TYP_UNKNOWN = -1;
+ protected static final int TYP_BATCHER = 0;
+ protected static final int TYP_FEEDER = 1;
+ protected static final int TYP_COPIER = 2;
+
+ protected boolean isBatcher() { return TYP_BATCHER == getOutputType(); }
+ protected boolean isFeeder () { return TYP_FEEDER == getOutputType(); }
+ protected boolean isCopier () { return TYP_COPIER == getOutputType(); }
+
+ protected void setOutputType(int p_i)
+ { if (null != m_oiType)
+ m_oLogger.info("Redefining Processor Type from "+m_oiType.toString()
+ +" to "+p_i);
+ m_oiType = new Integer(p_i);
+ } //__________________________________
+
+ protected int getOutputType()
+ { if (null == m_oiType)
+ { // m_oLogger.info("Requesting unknown processor type (forgot to set it ?)");
+ return TYP_UNKNOWN;
+ }
+ return m_oiType.intValue();
+ } //__________________________________
+
+ protected long getBatchNumber() throws Exception
+ { if (! isBatcher()) throw new Exception ("'this' is not a Batcher");
+ return getBatcher().getBatchNumber();
+ } //__________________________________
+
+ private static final Class[] s_oaPostCnst = new Class[] {DomElement.class};
+ protected void postProcess() throws Exception
+ { InotificationHandler oNH =
+ NotificationHandlerFactory.getNotifHandler
+ ("remote"
+ ,SystemProperties.getJndiServerType()
+ ,SystemProperties.getJndiServerURL()
+ );
+ DomElement[] oaPost = m_oParms.getElementChildren(POSTPRC_ELEMENT);
+ for (int i1=0; i1<oaPost.length;i1++)
+ { DomElement oCpy = oaPost[i1].cloneObj();
+ replaceMacros(oCpy);
+ try
+ { Class oCls = Class.forName(oCpy.getAttr(POSTPRC_CLASS));
+ Constructor oConst = oCls.getConstructor(s_oaPostCnst);
+ oConst.newInstance(new Object[] {oCpy});
+ NotifyUtil.notifyOK(oNH,oaPost[i1].getDad(),("postProcess() <"+i1+"> Succeeded")
+ ,null);
+
+ }
+ catch (Exception e)
+ { m_oLogger.error("postProcess() <"+i1+"> FAILED :"+e.getMessage());
+ NotifyUtil.notifyError(oNH,oaPost[i1].getDad(),("postProcess() <"+i1+"> Failed")
+ ,null,e);
+ }
+ }
+ }//_________________________
+
+ void replaceMacros(DomElement p_oParm)
+ { String[] saAtt = p_oParm.getAttrKeys();
+ for (int i1=0; i1<saAtt.length;i1++)
+ { String sKey = saAtt[i1];
+ String sVal = p_oParm.getAttr(sKey);
+
+ boolean bSubst = false;
+ int iWh = 0;
+ int iPos = 0;
+ while (0 <= (iPos=sVal.indexOf(CTX_PREFIX,iWh)))
+ { String sRest = sVal.substring(iPos);
+ for (int i2=0; i2<s_saMacros.length; i2++)
+ { String sMac = s_saMacros[i2];
+ if (! sRest.startsWith(sMac)) continue;
+ Object oRpl = getContextObj(sMac);
+ if (null == oRpl) continue;
+ bSubst = true;
+ sVal = sVal.substring(0,iPos)
+ +oRpl.toString()+sVal.substring(iPos+sMac.length());
+ }
+ }
+ if (bSubst) p_oParm.setAttr(sKey,sVal);
+ }
+ DomElement[] oaChilds = p_oParm.getAllElemChildren();
+ for (int i1=0; i1<oaChilds.length;i1++)
+ replaceMacros(oaChilds[i1]);
+ }//_________________________
+
+ protected void release()
+ { switch (getOutputType())
+ { case TYP_BATCHER: getBatcher().release(); break;
+ }
+ } //__________________________________
+
+ protected void finish(BatchProcess p_oBP) throws Exception
+ {
+ switch (getOutputType())
+ { case TYP_BATCHER:
+ if (p_oBP.getUid() <1) p_oBP.setUid(assignUid());
+ if (p_oBP.getSnap()<1) p_oBP.setSnap(p_oBP.getUid());
+ p_oBP.setField(BatchProcess.ATTRIB.createStamp
+ ,Long.toString(System.currentTimeMillis()));
+ getPersistHandler().addObject(p_oBP);
+ getBatcher().finish();
+ setContextObj(CTX_BATCH_UID,new Long(p_oBP.getUid()));
+ setContextObj(CTX_BATCH_NUM,new Long(p_oBP.getBatchNum()));
+ break;
+ }
+ } //__________________________________
+
+ protected void commitBatch(BatchProcess p_oBP) throws Exception
+ { switch (getOutputType())
+ { case TYP_BATCHER: getBatcher().commitBatch(p_oBP); break;
+ }
+ } //________________________________
+
+ protected BatchProcess getBatchObj()
+ { return (this.isBatcher()) ? getBatcher().m_oBP : null;
+ } //________________________________
+
+ protected long sendObject(Object p_o) throws Exception
+ { BaseBusinessObject BO = null;
+ if (p_o instanceof BaseBusinessObject)
+ { BO = (BaseBusinessObject) p_o;
+ if (BO.getUid() <1) BO.setUid(assignUid());
+ if (BO.getSnap()<1) BO.setSnap(BO.getUid());
+ }
+
+ switch (getOutputType())
+ { case TYP_BATCHER: getBatcher().addRow(p_o); break;
+ case TYP_FEEDER: getFeeder ().addRow(p_o); break;
+ }
+ return (null==BO) ? -1 : BO.getUid();
+ } //________________________________
+
+ public void notifyOK(Serializable p_o)
+ { try
+ {
+ DomElement[] oaP = m_oParms.getElementChildren(NotificationList.ELEMENT);
+ for (int i1=0; i1<oaP.length;i1++)
+ { NotificationList oCurr = new NotificationList(oaP[i1]);
+ if (! oCurr.isOK()) continue;
+ DomElement oCpy = oaP[i1].cloneObj();
+ m_oLogger.info("BEFORE EXPAND <"+m_oContext.get(CTX_BATCH_UID)+">");
+ replaceMacros(oCpy);
+ m_oLogger.info("AFTER EXPAND \n"+oCpy.toString()+"\n");
+ getNotifHandler().sendNotifications(oCpy,p_o);
+ }
+ }
+ catch (Exception e) {}
+ } //__________________________________
+
+ public void notifyError(Exception p_e, Serializable p_o)
+ {
+ try
+ {
+ DomElement[] oaP = m_oParms.getElementChildren(NotificationList.ELEMENT);
+ if (oaP.length<1) // Uncomment this line to send only to the list
+ getNotifHandler().sendNotifications(p_o);
+ for (int i1=0; i1<oaP.length;i1++)
+ { NotificationList oCurr = new NotificationList(oaP[i1]);
+ if (! oCurr.isErr()) continue;
+ getNotifHandler().sendNotifications(oaP[i1],p_o);
+ }
+ }
+ catch (Exception e) {
+ e.printStackTrace(System.out);
+ }
+ } //__________________________________
+
+ private int m_iChunkLeft = 0;
+ private long m_lNewUid = -1;
+
+ public long assignUid() throws Exception
+ { if (m_iChunkLeft < 1)
+ { int iChunk = 100;
+ m_lNewUid = getPersistHandler().getUidChunk(iChunk);
+ m_iChunkLeft = iChunk;
+ }
+ m_iChunkLeft--;
+ return ++m_lNewUid;
+ } //__________________________________
+
+ private IpersistHandler m_oPHandler;
+ private IpersistHandler getPersistHandler() throws Exception
+ { if (null == m_oPHandler)
+ m_oPHandler = PersistHandlerFactory
+ .getPersistHandler
+ ("remote"
+ ,SystemProperties.getJndiServerType()
+ ,SystemProperties.getJndiServerURL()
+ );
+ return m_oPHandler;
+ } //________________________________
+
+ public static DataSource getDataSource(String p_sDriver, String p_sConnURL
+ ,String p_sUser, String p_sPassowrd) throws Exception
+ { return new SimpleDataSource(p_sDriver, p_sConnURL, p_sUser, p_sPassowrd);
+ } //__________________________________
+
+ protected Feeder m_oFeeder;
+ protected Feeder getFeeder()
+ { if (! this.isFeeder()) return null;
+ if (null==m_oFeeder) m_oFeeder = new Feeder();
+ return m_oFeeder;
+ } //__________________________________
+
+ class Feeder
+ {
+ private Long m_olNum;
+ public long getBatchNumber() { return m_olNum.longValue(); }
+
+ private long addRow(Object p_o) throws Exception
+ { return getPersistHandler().addObject((BaseBusinessObject)p_o);
+ } //________________________________
+ } //______________________________________________________
+
+ protected Batcher m_oBatcher;
+ protected Batcher getBatcher()
+ { if (! this.isBatcher()) return null;
+ if (null==m_oBatcher) m_oBatcher = new Batcher();
+ return m_oBatcher;
+ } //__________________________________
+
+ class Batcher
+ {
+ private IbatchHandler m_oBHandler;
+ private BatchProcess m_oBP;
+
+ private IbatchHandler getBatchHandler() throws Exception
+ { if (null == m_oBHandler)
+ m_oBHandler = BatchHandlerFactory
+ .getBatchHandler
+ ("remote"
+ ,SystemProperties.getJndiServerType()
+ ,SystemProperties.getJndiServerURL()
+ );
+ return m_oBHandler;
+ } //________________________________
+
+ private Long m_olNum = null;
+ private long getBatchNumber() throws Exception
+ { if (null==m_olNum) m_olNum = new Long(getBatchHandler().newBatch());
+ return m_olNum.longValue();
+ }
+
+ private int addRow(Object p_o) throws Exception
+ { if (null==m_olNum)
+ { Exception oEx = new Exception("No batch number was requested");
+ m_oLogger.error("Batcher.addRow() - "+oEx.getMessage());
+ throw oEx;
+ }
+ return getBatchHandler().addToBatch(p_o.toString());
+ } //________________________________
+
+ private void release()
+ { try {m_oBHandler.releaseHandler(); }
+ catch (Exception e) {}
+ } //________________________________
+
+ private void finish() throws Exception
+ { m_olNum = null;
+ m_oBHandler.finish();
+ } //________________________________
+
+ private void commitBatch(BatchProcess p_oBP) throws Exception
+ { m_oBP = p_oBP;
+ getBatchHandler().commitBatch(p_oBP);
+ } //________________________________
+ } //______________________________________________________
+} //____________________________________________________________________________
Copied: labs/jbossesb/branches/refactor/product/core/processors/src/org/jboss/soa/esb/processors/AbstractSaxProcessor.java (from rev 5384, labs/jbossesb/branches/refactor/product/core/processors/src/org/jboss/soa/esb/processors/EsbAbstractSaxProcessor.java)
===================================================================
--- labs/jbossesb/branches/refactor/product/core/processors/src/org/jboss/soa/esb/processors/EsbAbstractSaxProcessor.java 2006-08-01 18:47:29 UTC (rev 5384)
+++ labs/jbossesb/branches/refactor/product/core/processors/src/org/jboss/soa/esb/processors/AbstractSaxProcessor.java 2006-08-01 21:29:38 UTC (rev 5389)
@@ -0,0 +1,137 @@
+/*
+* 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.io.*;
+import java.util.*;
+
+import javax.xml.parsers.*;
+
+import org.apache.log4j.*;
+import org.w3c.dom.*;
+import org.xml.sax.*;
+import org.xml.sax.helpers.*;
+
+import org.jboss.soa.esb.util.*;
+import org.jboss.soa.esb.common.bizclasses.*;
+
+public abstract class AbstractSaxProcessor extends DefaultHandler
+{
+ protected abstract String getDocElemName();
+ protected abstract boolean handleElement(Element p_oElem) throws Exception;
+ protected abstract void wrapUp(AbstractProcessor p_oProc) throws Exception;
+
+ protected AbstractProcessor m_oProcessor;
+ protected Logger m_oLogger;
+ protected BatchProcess m_oBatchP;
+
+ private DocumentBuilder m_oDB;
+ private SAXParser m_oSaxPrs;
+
+ static
+ { try
+ { System.setProperty("javax.xml.parsers.SAXParserFactory",
+ "org.apache.xerces.jaxp.SAXParserFactoryImpl");
+ }
+ catch (Exception eX) { eX.printStackTrace(System.err); }
+ }
+ private Stack <Element> m_oElemStk;
+
+ protected AbstractSaxProcessor(File p_oF, AbstractProcessor p_oProc, int p_iOutType)
+ throws Exception
+ { m_oLogger = EsbUtil.getDefaultLogger(this.getClass());
+ m_oProcessor = p_oProc;
+ m_oProcessor.setOutputType(p_iOutType);
+
+ m_oDB =DocumentBuilderFactory.newInstance().newDocumentBuilder();
+ m_oSaxPrs = SAXParserFactory.newInstance().newSAXParser();
+ XMLReader oXmlRd = null;
+ oXmlRd = m_oSaxPrs.getXMLReader();
+ oXmlRd.setContentHandler(this);
+
+ InputStream oIstr = new FileInputStream(p_oF);
+ InputSource oIsrc = new InputSource(oIstr);
+ m_oElemStk = new Stack<Element>();
+
+ try
+ { if (m_oProcessor.isBatcher())
+ { m_oBatchP = new BatchProcess(null,m_oProcessor.assignUid());
+ m_oBatchP.setBatchNum(m_oProcessor.getBatchNumber());
+ }
+
+ oXmlRd.parse(oIsrc);
+
+ wrapUp(m_oProcessor);
+ }
+ catch (Exception e)
+ { m_oLogger.fatal(this.getClass().getName()+" FAILED",e);
+ throw e;
+ }
+ finally
+ { if (null != oIstr) try { oIstr.close(); } catch (Exception e) {}
+ }
+ } //__________________________________
+
+ public void characters(char [] p_ca, int p_iSt, int p_iLn)
+ throws SAXException
+ { Element nTop = (Element)m_oElemStk.peek();
+ String sTxt = new String(p_ca,p_iSt,p_iLn);
+ nTop.appendChild(nTop.getOwnerDocument().createTextNode(sTxt));
+ } //_________________________________
+
+ public void startElement (String namespaceURI, String localName,
+ String qName ,Attributes attr ) throws SAXException
+ { Element onDad = (m_oElemStk.isEmpty())
+ ? null : m_oElemStk.peek();
+ if (null == onDad)
+ { if (! (getDocElemName().equals(qName)))
+ { m_oLogger.error("Invalid Document Element <" + qName + ">");
+ throw new SAXException(getClass().getName()+"Invalid Document Element <" + qName + ">");
+ }
+ Document oDoc = m_oDB.newDocument();
+ oDoc.appendChild(onDad=oDoc.createElement("root"));
+ }
+
+ Element eNew = onDad.getOwnerDocument().createElement(qName);
+ onDad.appendChild(eNew);
+
+ int iQ = attr.getLength();
+ for (int i1=0; i1<iQ; i1++)
+ eNew.setAttribute(attr.getQName(i1),attr.getValue(i1));
+ m_oElemStk.push(eNew);
+ } //_________________________________
+
+ public void endElement( String namespaceURI,
+ String localName, String qName ) throws SAXException
+ {
+ Element nCurr = m_oElemStk.pop();
+ if (m_oElemStk.isEmpty()) return;
+
+ try
+ { if (handleElement(nCurr))
+ nCurr.getParentNode().removeChild(nCurr);
+ }
+ catch (Exception e) { throw new SAXException(e); }
+ } //_________________________________
+
+} //____________________________________________________________________________
Copied: labs/jbossesb/branches/refactor/product/core/processors/src/org/jboss/soa/esb/processors/AbstractSqlPassthrough.java (from rev 5384, labs/jbossesb/branches/refactor/product/core/processors/src/org/jboss/soa/esb/processors/EsbAbstractSqlPassthrough.java)
===================================================================
--- labs/jbossesb/branches/refactor/product/core/processors/src/org/jboss/soa/esb/processors/EsbAbstractSqlPassthrough.java 2006-08-01 18:47:29 UTC (rev 5384)
+++ labs/jbossesb/branches/refactor/product/core/processors/src/org/jboss/soa/esb/processors/AbstractSqlPassthrough.java 2006-08-01 21:29:38 UTC (rev 5389)
@@ -0,0 +1,93 @@
+/*
+* 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.io.File;
+import java.io.FileOutputStream;
+import java.net.URI;
+import java.sql.PreparedStatement;
+import java.util.Properties;
+import java.util.StringTokenizer;
+
+import javax.sql.DataSource;
+
+import org.jboss.soa.esb.helpers.persist.*;
+import org.jboss.soa.esb.helpers.*;
+
+
+public abstract class AbstractSqlPassthrough extends AbstractSqlProcessor
+{
+ public JdbcCleanConn m_oConn;
+ public String[] m_saColNames;
+ public PreparedStatement m_oPSinsert;
+ public File m_oOutTrigger;
+ public long m_lGroupUid;
+
+ public AbstractSqlPassthrough(File p_oF, AbstractProcessor p_oProc) throws Exception
+ { super(p_oF, p_oProc,AbstractProcessor.TYP_COPIER);
+ } //__________________________________
+
+ public void wrapUp (AbstractProcessor p_oProc) throws Exception
+ {
+ if (null != m_oConn) {
+ m_oConn.commit();
+ m_oConn.release();
+ }
+ if (null!=m_oOutTrigger)
+ try
+ { FileOutputStream oF = new FileOutputStream(m_oOutTrigger);
+ oF.close();
+ }
+ catch (Exception e) {}
+ } //__________________________________
+
+ public void checkParms() throws Exception
+ {
+
+ DomElement oCh = m_oParms.getFirstElementChild("output");
+ DataSource oDS = AbstractProcessor.getDataSource
+ (oCh.getAttr("driver-class") ,oCh.getAttr("connection-url")
+ ,oCh.getAttr("user-name") ,oCh.getAttr("password") );
+ m_oConn = new JdbcCleanConn(oDS);
+
+ String sTrigger = oCh.getAttr("outputTriggerURI");
+ if (null!= sTrigger)
+ m_oOutTrigger = new File(new URI(sTrigger));
+
+ String sTable = oCh.getAttr("table");
+ StringTokenizer ST = new StringTokenizer(oCh.getAttr("columns"),",");
+
+ m_saColNames = new String[ST.countTokens()];
+ for (int i1=0;i1<m_saColNames.length;i1++) m_saColNames[i1]=ST.nextToken();
+
+
+ String sIns = AbstractSqlProcessor.getInsertStmt(sTable,m_saColNames);
+ m_oPSinsert = m_oConn.prepareStatement(sIns);
+
+ m_lGroupUid = m_oProcessor.assignUid();
+
+ } //_________________________________
+
+ public abstract boolean handleTblRow(Properties p_oProw) throws Exception;
+
+
+} //____________________________________________________________________________
Copied: labs/jbossesb/branches/refactor/product/core/processors/src/org/jboss/soa/esb/processors/AbstractSqlProcessor.java (from rev 5384, labs/jbossesb/branches/refactor/product/core/processors/src/org/jboss/soa/esb/processors/EsbAbstractSqlProcessor.java)
===================================================================
--- labs/jbossesb/branches/refactor/product/core/processors/src/org/jboss/soa/esb/processors/EsbAbstractSqlProcessor.java 2006-08-01 18:47:29 UTC (rev 5384)
+++ labs/jbossesb/branches/refactor/product/core/processors/src/org/jboss/soa/esb/processors/AbstractSqlProcessor.java 2006-08-01 21:29:38 UTC (rev 5389)
@@ -0,0 +1,137 @@
+/*
+* 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.io.*;
+import java.sql.*;
+import java.util.*;
+
+import javax.sql.DataSource;
+
+import org.apache.log4j.Logger;
+
+import org.jboss.soa.esb.util.*;
+import org.jboss.soa.esb.common.bizclasses.*;
+import org.jboss.soa.esb.helpers.*;
+import org.jboss.soa.esb.helpers.persist.*;
+
+public abstract class AbstractSqlProcessor
+{
+ protected abstract boolean handleTblRow (Properties p_opRow) throws Exception;
+ protected abstract void wrapUp (AbstractProcessor p_oProc) throws Exception;
+
+ public static final String QPARM_TABLE = "table";
+ public static final String QPARM_CONDITION = "condition";
+ public static final String QPARM_ORDER_BY = "orderBy";
+
+ protected DomElement m_oParms;
+ protected AbstractProcessor m_oProcessor;
+ protected Logger m_oLogger;
+ protected BatchProcess m_oBatchP;
+ public JdbcCleanConn m_oConn;
+
+ private String[] m_saColNames;
+ protected String[] getColNames() { return m_saColNames; }
+
+ protected AbstractSqlProcessor(File p_oF, AbstractProcessor p_oProc, int p_iOutType)
+ throws Exception
+ { m_oLogger = EsbUtil.getDefaultLogger(this.getClass());
+ m_oProcessor= p_oProc;
+ m_oProcessor.setOutputType(p_iOutType);
+ m_oParms = m_oProcessor.cloneParams();
+
+ InputStream oIstr = null;
+ try
+ { connectToDB();
+ oIstr = new FileInputStream(p_oF);
+
+ if (m_oProcessor.isBatcher())
+ { m_oBatchP = new BatchProcess(null,m_oProcessor.assignUid());
+ m_oBatchP.setBatchNum(m_oProcessor.getBatchNumber());
+ }
+
+ processRows(oIstr);
+
+ wrapUp(m_oProcessor);
+ }
+ catch (Exception e)
+ { m_oLogger.fatal(this.getClass().getName()+" FAILED",e);
+ throw e;
+ }
+ finally
+ { if (null != oIstr) try { oIstr.close(); } catch (Exception e) {}
+ if (null != m_oConn) m_oConn.release();
+ }
+ } //__________________________________
+
+ protected void connectToDB() throws Exception
+ {
+ DataSource oDS = AbstractProcessor.getDataSource
+ (m_oParms.getAttr(SimpleDataSource.DRIVER)
+ ,m_oParms.getAttr(SimpleDataSource.URL)
+ ,m_oParms.getAttr(SimpleDataSource.USER)
+ ,m_oParms.getAttr(SimpleDataSource.PASSWORD)
+ );
+ m_oConn = new JdbcCleanConn(oDS);
+ } //__________________________________
+
+ private void processRows(InputStream p_oIS) throws Exception
+ { StringBuilder sb = new StringBuilder("select * from ")
+ .append(m_oParms.getAttr(QPARM_TABLE));
+
+ String sCond = m_oParms.getAttr(QPARM_CONDITION);
+ if (null != sCond) sb.append(" ").append(sCond);
+
+ String sOrder = m_oParms.getAttr(QPARM_ORDER_BY);
+ if (null != sOrder) sb.append(" order by ").append(sOrder);
+
+ PreparedStatement PS = m_oConn.prepareStatement(sb.toString());
+ ResultSet RS = m_oConn.execQueryWait(PS,10);
+ ResultSetMetaData MD = RS.getMetaData();
+ m_saColNames = new String[MD.getColumnCount()];
+ for (int i1=0; i1<m_saColNames.length; i1++)
+ m_saColNames[i1] = MD.getColumnName(1+i1);
+
+ Properties oP = new Properties();
+ while (RS.next())
+ { oP.clear();
+ for (int i1=0; i1<m_saColNames.length; i1++)
+ { String sVal = RS.getString(1 + i1);
+ if (null != sVal) oP.setProperty(m_saColNames[i1], sVal);
+ }
+ handleTblRow(oP);
+ }
+ } //__________________________________
+
+ public static final String getInsertStmt(String p_sTbl, String[] p_saCols)
+ { StringBuilder sbCol = new StringBuilder("insert into ").append(p_sTbl).append(" ");
+ StringBuilder sbPrm = new StringBuilder(" values ");
+ for (int i1=0; i1<p_saCols.length; i1++)
+ { String sIn = (i1==0) ? "(" : ",";
+ sbCol.append(sIn).append("\"").append(p_saCols[i1]).append("\"");
+ sbPrm.append(sIn).append("?");
+ }
+ return sbCol.append(")").append(sbPrm).append(")").toString();
+ } //__________________________________
+
+} //____________________________________________________________________________
Deleted: labs/jbossesb/branches/refactor/product/core/processors/src/org/jboss/soa/esb/processors/EsbAbstractAggregator.java
===================================================================
--- labs/jbossesb/branches/refactor/product/core/processors/src/org/jboss/soa/esb/processors/EsbAbstractAggregator.java 2006-08-01 21:08:27 UTC (rev 5388)
+++ labs/jbossesb/branches/refactor/product/core/processors/src/org/jboss/soa/esb/processors/EsbAbstractAggregator.java 2006-08-01 21:29:38 UTC (rev 5389)
@@ -1,82 +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.io.EOFException;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.jboss.soa.esb.helpers.*;
-
-public abstract class EsbAbstractAggregator extends EsbFileProcessor
-{
- public abstract Object nextInputLine () throws Exception;
- public abstract Object getGroupKey (Object p_oInp) throws Exception;
- protected abstract Object composeObj (List p_oLout) throws Exception;
-
- private Object m_oGroupKey = null;
- protected List<Object> m_olGroup = new ArrayList<Object>();
- ParamsFileProcessor m_oFPparm;
-
- protected EsbAbstractAggregator(DomElement p_oP) throws Exception
- { super(p_oP);
- } //__________________________________
-
- private boolean isSameGroup(Object p_o)
- { return (null == m_oGroupKey) ? false
- :(null == p_o) ? false
- : p_o.equals(m_oGroupKey)
- ;
- } //__________________________________
-
- private long sendComposedObj() throws Exception
- { if (null == m_oGroupKey) return -1;
- return super.sendObject(composeObj(m_olGroup));
- } //__________________________________
-
- public void execute() throws Exception
- { m_oFPparm.checkFile();
- renameToWrk();
- while (true)
- try
- { Object oInp = nextInputLine();
- Object oGrpK = getGroupKey(oInp);
- if (! isSameGroup(oGrpK))
- { sendComposedObj();
- m_olGroup.clear();
- m_oGroupKey = getGroupKey(oInp);
- }
- m_olGroup.add(oInp);
- }
- catch (EOFException eEOF)
- { sendComposedObj();
- break;
- }
- catch (Exception e)
- { m_oLogger.fatal("Exception in EsbFileProcessor",e);
- renameToErr();
- throw e;
- }
- renameToOK();
- } //__________________________________
-
-} //____________________________________________________________________________
Deleted: labs/jbossesb/branches/refactor/product/core/processors/src/org/jboss/soa/esb/processors/EsbAbstractProcessor.java
===================================================================
--- labs/jbossesb/branches/refactor/product/core/processors/src/org/jboss/soa/esb/processors/EsbAbstractProcessor.java 2006-08-01 21:08:27 UTC (rev 5388)
+++ labs/jbossesb/branches/refactor/product/core/processors/src/org/jboss/soa/esb/processors/EsbAbstractProcessor.java 2006-08-01 21:29:38 UTC (rev 5389)
@@ -1,377 +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.io.*;
-import java.lang.reflect.*;
-import java.util.*;
-
-import javax.sql.*;
-
-import org.apache.log4j.*;
-
-import org.jboss.soa.esb.util.*;
-import org.jboss.soa.esb.common.*;
-import org.jboss.soa.esb.common.bizclasses.*;
-import org.jboss.soa.esb.helpers.*;
-import org.jboss.soa.esb.helpers.persist.SimpleDataSource;
-
-import org.jboss.soa.esb.notification.*;
-import org.jboss.soa.esb.services.*;
-
-public abstract class EsbAbstractProcessor
-{
- public abstract void execute() throws Exception;
- protected abstract void checkParms() throws Exception;
-
- public static final String PARMS_THIS_INSTANCE = "__thisInstance";
-
- private static final String POSTPRC_ELEMENT= "postProcess";
- private static final String POSTPRC_CLASS = "actionClass";
-
- public static final String CTX_PREFIX = "@@ctx@@";
- public static final String CTX_BATCH_UID = CTX_PREFIX+"batchUid";
- public static final String CTX_BATCH_NUM = CTX_PREFIX+"batchNum";
- public static final String CTX_INPUT_FILE = CTX_PREFIX+"inputFile";
- public static final String CTX_POST_FILE = CTX_PREFIX+"postFile";
-
- private static final String[] s_saMacros =
- {CTX_BATCH_UID, CTX_BATCH_NUM ,CTX_INPUT_FILE, CTX_POST_FILE };
-
- protected Map <String,Object> m_oContext = new HashMap<String,Object>();
- public void clearContext () { m_oContext.clear(); }
- public Object rmvContextObj (String p_sKey) { return m_oContext.remove(p_sKey); }
- public Object getContextObj (String p_sKey) { return m_oContext.get(p_sKey); }
- public Object setContextObj (String p_sKey, Object p_oVal)
- { return m_oContext.put(p_sKey,p_oVal); }
-
- protected DomElement m_oParms ,m_oInstP;
- protected Logger m_oLogger;
-
- private InotificationHandler m_oNotifH;
- protected InotificationHandler getNotifHandler() throws Exception
- { if (null == m_oNotifH)
- {
- String sJndiType= SystemProperties.getJndiServerType();
- String sJndiURL = SystemProperties.getJndiServerURL();
- m_oNotifH = NotificationHandlerFactory.getNotifHandler
- ("remote",sJndiType,sJndiURL);
- }
- return m_oNotifH;
- } //________________________________
-
-
- private EsbAbstractProcessor() {}
-
- protected EsbAbstractProcessor(DomElement p_oParms) throws Exception
- { this(p_oParms,true);
- } //__________________________________
-
- protected EsbAbstractProcessor(DomElement p_oParms, boolean p_bLogInit) throws Exception
- {
- m_oLogger = EsbUtil.getDefaultLogger(this.getClass());
- m_oParms = p_oParms;
-
- try { m_oInstP = m_oParms.getFirstElementChild(PARMS_THIS_INSTANCE); }
- catch (Exception eNo) {}
- if (null==m_oInstP)
- { m_oInstP = new DomElement(PARMS_THIS_INSTANCE);
- m_oParms.addElemChild(m_oInstP);
- }
-
- checkParms();
- } //__________________________________
-
-
- public DomElement cloneParams() throws Exception {return m_oParms.cloneObj();}
-
- private Integer m_oiType;
-
- protected static final int TYP_UNKNOWN = -1;
- protected static final int TYP_BATCHER = 0;
- protected static final int TYP_FEEDER = 1;
- protected static final int TYP_COPIER = 2;
-
- protected boolean isBatcher() { return TYP_BATCHER == getOutputType(); }
- protected boolean isFeeder () { return TYP_FEEDER == getOutputType(); }
- protected boolean isCopier () { return TYP_COPIER == getOutputType(); }
-
- protected void setOutputType(int p_i)
- { if (null != m_oiType)
- m_oLogger.info("Redefining Processor Type from "+m_oiType.toString()
- +" to "+p_i);
- m_oiType = new Integer(p_i);
- } //__________________________________
-
- protected int getOutputType()
- { if (null == m_oiType)
- { // m_oLogger.info("Requesting unknown processor type (forgot to set it ?)");
- return TYP_UNKNOWN;
- }
- return m_oiType.intValue();
- } //__________________________________
-
- protected long getBatchNumber() throws Exception
- { if (! isBatcher()) throw new Exception ("'this' is not a Batcher");
- return getBatcher().getBatchNumber();
- } //__________________________________
-
- private static final Class[] s_oaPostCnst = new Class[] {DomElement.class};
- protected void postProcess() throws Exception
- { InotificationHandler oNH =
- NotificationHandlerFactory.getNotifHandler
- ("remote"
- ,SystemProperties.getJndiServerType()
- ,SystemProperties.getJndiServerURL()
- );
- DomElement[] oaPost = m_oParms.getElementChildren(POSTPRC_ELEMENT);
- for (int i1=0; i1<oaPost.length;i1++)
- { DomElement oCpy = oaPost[i1].cloneObj();
- replaceMacros(oCpy);
- try
- { Class oCls = Class.forName(oCpy.getAttr(POSTPRC_CLASS));
- Constructor oConst = oCls.getConstructor(s_oaPostCnst);
- oConst.newInstance(new Object[] {oCpy});
- NotifyUtil.notifyOK(oNH,oaPost[i1].getDad(),("postProcess() <"+i1+"> Succeeded")
- ,null);
-
- }
- catch (Exception e)
- { m_oLogger.error("postProcess() <"+i1+"> FAILED :"+e.getMessage());
- NotifyUtil.notifyError(oNH,oaPost[i1].getDad(),("postProcess() <"+i1+"> Failed")
- ,null,e);
- }
- }
- }//_________________________
-
- void replaceMacros(DomElement p_oParm)
- { String[] saAtt = p_oParm.getAttrKeys();
- for (int i1=0; i1<saAtt.length;i1++)
- { String sKey = saAtt[i1];
- String sVal = p_oParm.getAttr(sKey);
-
- boolean bSubst = false;
- int iWh = 0;
- int iPos = 0;
- while (0 <= (iPos=sVal.indexOf(CTX_PREFIX,iWh)))
- { String sRest = sVal.substring(iPos);
- for (int i2=0; i2<s_saMacros.length; i2++)
- { String sMac = s_saMacros[i2];
- if (! sRest.startsWith(sMac)) continue;
- Object oRpl = getContextObj(sMac);
- if (null == oRpl) continue;
- bSubst = true;
- sVal = sVal.substring(0,iPos)
- +oRpl.toString()+sVal.substring(iPos+sMac.length());
- }
- }
- if (bSubst) p_oParm.setAttr(sKey,sVal);
- }
- DomElement[] oaChilds = p_oParm.getAllElemChildren();
- for (int i1=0; i1<oaChilds.length;i1++)
- replaceMacros(oaChilds[i1]);
- }//_________________________
-
- protected void release()
- { switch (getOutputType())
- { case TYP_BATCHER: getBatcher().release(); break;
- }
- } //__________________________________
-
- protected void finish(BatchProcess p_oBP) throws Exception
- {
- switch (getOutputType())
- { case TYP_BATCHER:
- if (p_oBP.getUid() <1) p_oBP.setUid(assignUid());
- if (p_oBP.getSnap()<1) p_oBP.setSnap(p_oBP.getUid());
- p_oBP.setField(BatchProcess.ATTRIB.createStamp
- ,Long.toString(System.currentTimeMillis()));
- getPersistHandler().addObject(p_oBP);
- getBatcher().finish();
- setContextObj(CTX_BATCH_UID,new Long(p_oBP.getUid()));
- setContextObj(CTX_BATCH_NUM,new Long(p_oBP.getBatchNum()));
- break;
- }
- } //__________________________________
-
- protected void commitBatch(BatchProcess p_oBP) throws Exception
- { switch (getOutputType())
- { case TYP_BATCHER: getBatcher().commitBatch(p_oBP); break;
- }
- } //________________________________
-
- protected BatchProcess getBatchObj()
- { return (this.isBatcher()) ? getBatcher().m_oBP : null;
- } //________________________________
-
- protected long sendObject(Object p_o) throws Exception
- { BaseBusinessObject BO = null;
- if (p_o instanceof BaseBusinessObject)
- { BO = (BaseBusinessObject) p_o;
- if (BO.getUid() <1) BO.setUid(assignUid());
- if (BO.getSnap()<1) BO.setSnap(BO.getUid());
- }
-
- switch (getOutputType())
- { case TYP_BATCHER: getBatcher().addRow(p_o); break;
- case TYP_FEEDER: getFeeder ().addRow(p_o); break;
- }
- return (null==BO) ? -1 : BO.getUid();
- } //________________________________
-
- public void notifyOK(Serializable p_o)
- { try
- {
- DomElement[] oaP = m_oParms.getElementChildren(NotificationList.ELEMENT);
- for (int i1=0; i1<oaP.length;i1++)
- { NotificationList oCurr = new NotificationList(oaP[i1]);
- if (! oCurr.isOK()) continue;
- DomElement oCpy = oaP[i1].cloneObj();
- m_oLogger.info("BEFORE EXPAND <"+m_oContext.get(CTX_BATCH_UID)+">");
- replaceMacros(oCpy);
- m_oLogger.info("AFTER EXPAND \n"+oCpy.toString()+"\n");
- getNotifHandler().sendNotifications(oCpy,p_o);
- }
- }
- catch (Exception e) {}
- } //__________________________________
-
- public void notifyError(Exception p_e, Serializable p_o)
- {
- try
- {
- DomElement[] oaP = m_oParms.getElementChildren(NotificationList.ELEMENT);
- if (oaP.length<1) // Uncomment this line to send only to the list
- getNotifHandler().sendNotifications(p_o);
- for (int i1=0; i1<oaP.length;i1++)
- { NotificationList oCurr = new NotificationList(oaP[i1]);
- if (! oCurr.isErr()) continue;
- getNotifHandler().sendNotifications(oaP[i1],p_o);
- }
- }
- catch (Exception e) {
- e.printStackTrace(System.out);
- }
- } //__________________________________
-
- private int m_iChunkLeft = 0;
- private long m_lNewUid = -1;
-
- public long assignUid() throws Exception
- { if (m_iChunkLeft < 1)
- { int iChunk = 100;
- m_lNewUid = getPersistHandler().getUidChunk(iChunk);
- m_iChunkLeft = iChunk;
- }
- m_iChunkLeft--;
- return ++m_lNewUid;
- } //__________________________________
-
- private IpersistHandler m_oPHandler;
- private IpersistHandler getPersistHandler() throws Exception
- { if (null == m_oPHandler)
- m_oPHandler = PersistHandlerFactory
- .getPersistHandler
- ("remote"
- ,SystemProperties.getJndiServerType()
- ,SystemProperties.getJndiServerURL()
- );
- return m_oPHandler;
- } //________________________________
-
- public static DataSource getDataSource(String p_sDriver, String p_sConnURL
- ,String p_sUser, String p_sPassowrd) throws Exception
- { return new SimpleDataSource(p_sDriver, p_sConnURL, p_sUser, p_sPassowrd);
- } //__________________________________
-
- protected Feeder m_oFeeder;
- protected Feeder getFeeder()
- { if (! this.isFeeder()) return null;
- if (null==m_oFeeder) m_oFeeder = new Feeder();
- return m_oFeeder;
- } //__________________________________
-
- class Feeder
- {
- private Long m_olNum;
- public long getBatchNumber() { return m_olNum.longValue(); }
-
- private long addRow(Object p_o) throws Exception
- { return getPersistHandler().addObject((BaseBusinessObject)p_o);
- } //________________________________
- } //______________________________________________________
-
- protected Batcher m_oBatcher;
- protected Batcher getBatcher()
- { if (! this.isBatcher()) return null;
- if (null==m_oBatcher) m_oBatcher = new Batcher();
- return m_oBatcher;
- } //__________________________________
-
- class Batcher
- {
- private IbatchHandler m_oBHandler;
- private BatchProcess m_oBP;
-
- private IbatchHandler getBatchHandler() throws Exception
- { if (null == m_oBHandler)
- m_oBHandler = BatchHandlerFactory
- .getBatchHandler
- ("remote"
- ,SystemProperties.getJndiServerType()
- ,SystemProperties.getJndiServerURL()
- );
- return m_oBHandler;
- } //________________________________
-
- private Long m_olNum = null;
- private long getBatchNumber() throws Exception
- { if (null==m_olNum) m_olNum = new Long(getBatchHandler().newBatch());
- return m_olNum.longValue();
- }
-
- private int addRow(Object p_o) throws Exception
- { if (null==m_olNum)
- { Exception oEx = new Exception("No batch number was requested");
- m_oLogger.error("Batcher.addRow() - "+oEx.getMessage());
- throw oEx;
- }
- return getBatchHandler().addToBatch(p_o.toString());
- } //________________________________
-
- private void release()
- { try {m_oBHandler.releaseHandler(); }
- catch (Exception e) {}
- } //________________________________
-
- private void finish() throws Exception
- { m_olNum = null;
- m_oBHandler.finish();
- } //________________________________
-
- private void commitBatch(BatchProcess p_oBP) throws Exception
- { m_oBP = p_oBP;
- getBatchHandler().commitBatch(p_oBP);
- } //________________________________
- } //______________________________________________________
-} //____________________________________________________________________________
Deleted: labs/jbossesb/branches/refactor/product/core/processors/src/org/jboss/soa/esb/processors/EsbAbstractSaxProcessor.java
===================================================================
--- labs/jbossesb/branches/refactor/product/core/processors/src/org/jboss/soa/esb/processors/EsbAbstractSaxProcessor.java 2006-08-01 21:08:27 UTC (rev 5388)
+++ labs/jbossesb/branches/refactor/product/core/processors/src/org/jboss/soa/esb/processors/EsbAbstractSaxProcessor.java 2006-08-01 21:29:38 UTC (rev 5389)
@@ -1,137 +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.io.*;
-import java.util.*;
-
-import javax.xml.parsers.*;
-
-import org.apache.log4j.*;
-import org.w3c.dom.*;
-import org.xml.sax.*;
-import org.xml.sax.helpers.*;
-
-import org.jboss.soa.esb.util.*;
-import org.jboss.soa.esb.common.bizclasses.*;
-
-public abstract class EsbAbstractSaxProcessor extends DefaultHandler
-{
- protected abstract String getDocElemName();
- protected abstract boolean handleElement(Element p_oElem) throws Exception;
- protected abstract void wrapUp(EsbAbstractProcessor p_oProc) throws Exception;
-
- protected EsbAbstractProcessor m_oProcessor;
- protected Logger m_oLogger;
- protected BatchProcess m_oBatchP;
-
- private DocumentBuilder m_oDB;
- private SAXParser m_oSaxPrs;
-
- static
- { try
- { System.setProperty("javax.xml.parsers.SAXParserFactory",
- "org.apache.xerces.jaxp.SAXParserFactoryImpl");
- }
- catch (Exception eX) { eX.printStackTrace(System.err); }
- }
- private Stack <Element> m_oElemStk;
-
- protected EsbAbstractSaxProcessor(File p_oF, EsbAbstractProcessor p_oProc, int p_iOutType)
- throws Exception
- { m_oLogger = EsbUtil.getDefaultLogger(this.getClass());
- m_oProcessor = p_oProc;
- m_oProcessor.setOutputType(p_iOutType);
-
- m_oDB =DocumentBuilderFactory.newInstance().newDocumentBuilder();
- m_oSaxPrs = SAXParserFactory.newInstance().newSAXParser();
- XMLReader oXmlRd = null;
- oXmlRd = m_oSaxPrs.getXMLReader();
- oXmlRd.setContentHandler(this);
-
- InputStream oIstr = new FileInputStream(p_oF);
- InputSource oIsrc = new InputSource(oIstr);
- m_oElemStk = new Stack<Element>();
-
- try
- { if (m_oProcessor.isBatcher())
- { m_oBatchP = new BatchProcess(null,m_oProcessor.assignUid());
- m_oBatchP.setBatchNum(m_oProcessor.getBatchNumber());
- }
-
- oXmlRd.parse(oIsrc);
-
- wrapUp(m_oProcessor);
- }
- catch (Exception e)
- { m_oLogger.fatal(this.getClass().getName()+" FAILED",e);
- throw e;
- }
- finally
- { if (null != oIstr) try { oIstr.close(); } catch (Exception e) {}
- }
- } //__________________________________
-
- public void characters(char [] p_ca, int p_iSt, int p_iLn)
- throws SAXException
- { Element nTop = (Element)m_oElemStk.peek();
- String sTxt = new String(p_ca,p_iSt,p_iLn);
- nTop.appendChild(nTop.getOwnerDocument().createTextNode(sTxt));
- } //_________________________________
-
- public void startElement (String namespaceURI, String localName,
- String qName ,Attributes attr ) throws SAXException
- { Element onDad = (m_oElemStk.isEmpty())
- ? null : m_oElemStk.peek();
- if (null == onDad)
- { if (! (getDocElemName().equals(qName)))
- { m_oLogger.error("Invalid Document Element <" + qName + ">");
- throw new SAXException(getClass().getName()+"Invalid Document Element <" + qName + ">");
- }
- Document oDoc = m_oDB.newDocument();
- oDoc.appendChild(onDad=oDoc.createElement("root"));
- }
-
- Element eNew = onDad.getOwnerDocument().createElement(qName);
- onDad.appendChild(eNew);
-
- int iQ = attr.getLength();
- for (int i1=0; i1<iQ; i1++)
- eNew.setAttribute(attr.getQName(i1),attr.getValue(i1));
- m_oElemStk.push(eNew);
- } //_________________________________
-
- public void endElement( String namespaceURI,
- String localName, String qName ) throws SAXException
- {
- Element nCurr = m_oElemStk.pop();
- if (m_oElemStk.isEmpty()) return;
-
- try
- { if (handleElement(nCurr))
- nCurr.getParentNode().removeChild(nCurr);
- }
- catch (Exception e) { throw new SAXException(e); }
- } //_________________________________
-
-} //____________________________________________________________________________
Deleted: labs/jbossesb/branches/refactor/product/core/processors/src/org/jboss/soa/esb/processors/EsbAbstractSqlPassthrough.java
===================================================================
--- labs/jbossesb/branches/refactor/product/core/processors/src/org/jboss/soa/esb/processors/EsbAbstractSqlPassthrough.java 2006-08-01 21:08:27 UTC (rev 5388)
+++ labs/jbossesb/branches/refactor/product/core/processors/src/org/jboss/soa/esb/processors/EsbAbstractSqlPassthrough.java 2006-08-01 21:29:38 UTC (rev 5389)
@@ -1,93 +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.io.File;
-import java.io.FileOutputStream;
-import java.net.URI;
-import java.sql.PreparedStatement;
-import java.util.Properties;
-import java.util.StringTokenizer;
-
-import javax.sql.DataSource;
-
-import org.jboss.soa.esb.helpers.persist.*;
-import org.jboss.soa.esb.helpers.*;
-
-
-public abstract class EsbAbstractSqlPassthrough extends EsbAbstractSqlProcessor
-{
- public JdbcCleanConn m_oConn;
- public String[] m_saColNames;
- public PreparedStatement m_oPSinsert;
- public File m_oOutTrigger;
- public long m_lGroupUid;
-
- public EsbAbstractSqlPassthrough(File p_oF, EsbAbstractProcessor p_oProc) throws Exception
- { super(p_oF, p_oProc,EsbAbstractProcessor.TYP_COPIER);
- } //__________________________________
-
- public void wrapUp (EsbAbstractProcessor p_oProc) throws Exception
- {
- if (null != m_oConn) {
- m_oConn.commit();
- m_oConn.release();
- }
- if (null!=m_oOutTrigger)
- try
- { FileOutputStream oF = new FileOutputStream(m_oOutTrigger);
- oF.close();
- }
- catch (Exception e) {}
- } //__________________________________
-
- public void checkParms() throws Exception
- {
-
- DomElement oCh = m_oParms.getFirstElementChild("output");
- DataSource oDS = EsbAbstractProcessor.getDataSource
- (oCh.getAttr("driver-class") ,oCh.getAttr("connection-url")
- ,oCh.getAttr("user-name") ,oCh.getAttr("password") );
- m_oConn = new JdbcCleanConn(oDS);
-
- String sTrigger = oCh.getAttr("outputTriggerURI");
- if (null!= sTrigger)
- m_oOutTrigger = new File(new URI(sTrigger));
-
- String sTable = oCh.getAttr("table");
- StringTokenizer ST = new StringTokenizer(oCh.getAttr("columns"),",");
-
- m_saColNames = new String[ST.countTokens()];
- for (int i1=0;i1<m_saColNames.length;i1++) m_saColNames[i1]=ST.nextToken();
-
-
- String sIns = EsbAbstractSqlProcessor.getInsertStmt(sTable,m_saColNames);
- m_oPSinsert = m_oConn.prepareStatement(sIns);
-
- m_lGroupUid = m_oProcessor.assignUid();
-
- } //_________________________________
-
- public abstract boolean handleTblRow(Properties p_oProw) throws Exception;
-
-
-} //____________________________________________________________________________
Deleted: labs/jbossesb/branches/refactor/product/core/processors/src/org/jboss/soa/esb/processors/EsbAbstractSqlProcessor.java
===================================================================
--- labs/jbossesb/branches/refactor/product/core/processors/src/org/jboss/soa/esb/processors/EsbAbstractSqlProcessor.java 2006-08-01 21:08:27 UTC (rev 5388)
+++ labs/jbossesb/branches/refactor/product/core/processors/src/org/jboss/soa/esb/processors/EsbAbstractSqlProcessor.java 2006-08-01 21:29:38 UTC (rev 5389)
@@ -1,137 +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.io.*;
-import java.sql.*;
-import java.util.*;
-
-import javax.sql.DataSource;
-
-import org.apache.log4j.Logger;
-
-import org.jboss.soa.esb.util.*;
-import org.jboss.soa.esb.common.bizclasses.*;
-import org.jboss.soa.esb.helpers.*;
-import org.jboss.soa.esb.helpers.persist.*;
-
-public abstract class EsbAbstractSqlProcessor
-{
- protected abstract boolean handleTblRow (Properties p_opRow) throws Exception;
- protected abstract void wrapUp (EsbAbstractProcessor p_oProc) throws Exception;
-
- public static final String QPARM_TABLE = "table";
- public static final String QPARM_CONDITION = "condition";
- public static final String QPARM_ORDER_BY = "orderBy";
-
- protected DomElement m_oParms;
- protected EsbAbstractProcessor m_oProcessor;
- protected Logger m_oLogger;
- protected BatchProcess m_oBatchP;
- public JdbcCleanConn m_oConn;
-
- private String[] m_saColNames;
- protected String[] getColNames() { return m_saColNames; }
-
- protected EsbAbstractSqlProcessor(File p_oF, EsbAbstractProcessor p_oProc, int p_iOutType)
- throws Exception
- { m_oLogger = EsbUtil.getDefaultLogger(this.getClass());
- m_oProcessor= p_oProc;
- m_oProcessor.setOutputType(p_iOutType);
- m_oParms = m_oProcessor.cloneParams();
-
- InputStream oIstr = null;
- try
- { connectToDB();
- oIstr = new FileInputStream(p_oF);
-
- if (m_oProcessor.isBatcher())
- { m_oBatchP = new BatchProcess(null,m_oProcessor.assignUid());
- m_oBatchP.setBatchNum(m_oProcessor.getBatchNumber());
- }
-
- processRows(oIstr);
-
- wrapUp(m_oProcessor);
- }
- catch (Exception e)
- { m_oLogger.fatal(this.getClass().getName()+" FAILED",e);
- throw e;
- }
- finally
- { if (null != oIstr) try { oIstr.close(); } catch (Exception e) {}
- if (null != m_oConn) m_oConn.release();
- }
- } //__________________________________
-
- protected void connectToDB() throws Exception
- {
- DataSource oDS = EsbAbstractProcessor.getDataSource
- (m_oParms.getAttr(SimpleDataSource.DRIVER)
- ,m_oParms.getAttr(SimpleDataSource.URL)
- ,m_oParms.getAttr(SimpleDataSource.USER)
- ,m_oParms.getAttr(SimpleDataSource.PASSWORD)
- );
- m_oConn = new JdbcCleanConn(oDS);
- } //__________________________________
-
- private void processRows(InputStream p_oIS) throws Exception
- { StringBuilder sb = new StringBuilder("select * from ")
- .append(m_oParms.getAttr(QPARM_TABLE));
-
- String sCond = m_oParms.getAttr(QPARM_CONDITION);
- if (null != sCond) sb.append(" ").append(sCond);
-
- String sOrder = m_oParms.getAttr(QPARM_ORDER_BY);
- if (null != sOrder) sb.append(" order by ").append(sOrder);
-
- PreparedStatement PS = m_oConn.prepareStatement(sb.toString());
- ResultSet RS = m_oConn.execQueryWait(PS,10);
- ResultSetMetaData MD = RS.getMetaData();
- m_saColNames = new String[MD.getColumnCount()];
- for (int i1=0; i1<m_saColNames.length; i1++)
- m_saColNames[i1] = MD.getColumnName(1+i1);
-
- Properties oP = new Properties();
- while (RS.next())
- { oP.clear();
- for (int i1=0; i1<m_saColNames.length; i1++)
- { String sVal = RS.getString(1 + i1);
- if (null != sVal) oP.setProperty(m_saColNames[i1], sVal);
- }
- handleTblRow(oP);
- }
- } //__________________________________
-
- public static final String getInsertStmt(String p_sTbl, String[] p_saCols)
- { StringBuilder sbCol = new StringBuilder("insert into ").append(p_sTbl).append(" ");
- StringBuilder sbPrm = new StringBuilder(" values ");
- for (int i1=0; i1<p_saCols.length; i1++)
- { String sIn = (i1==0) ? "(" : ",";
- sbCol.append(sIn).append("\"").append(p_saCols[i1]).append("\"");
- sbPrm.append(sIn).append("?");
- }
- return sbCol.append(")").append(sbPrm).append(")").toString();
- } //__________________________________
-
-} //____________________________________________________________________________
Deleted: labs/jbossesb/branches/refactor/product/core/processors/src/org/jboss/soa/esb/processors/EsbFileProcessor.java
===================================================================
--- labs/jbossesb/branches/refactor/product/core/processors/src/org/jboss/soa/esb/processors/EsbFileProcessor.java 2006-08-01 21:08:27 UTC (rev 5388)
+++ labs/jbossesb/branches/refactor/product/core/processors/src/org/jboss/soa/esb/processors/EsbFileProcessor.java 2006-08-01 21:29:38 UTC (rev 5389)
@@ -1,110 +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.io.File;
-import java.lang.reflect.Constructor;
-
-import org.jboss.soa.esb.helpers.*;
-
-public class EsbFileProcessor extends EsbAbstractProcessor
-{
- ParamsFileProcessor m_oFPparm;
-
- public EsbFileProcessor(DomElement p_oP) throws Exception
- { super(p_oP);
- } //______________________comment____________
-
- protected File renameToWrk() throws Exception
- { File oWrk = File.createTempFile
- (m_oFPparm.m_sInpFile,"",m_oFPparm.m_oInpDir);
- oWrk.delete();
- m_oFPparm.m_oWorkF = oWrk;
- if (m_oFPparm.m_oIF.renameTo(oWrk)) return oWrk;
- throw new Exception ("Cannot rename "+m_oFPparm.m_oIF.toString()+" to "+oWrk.toString());
- } //__________________________________
-
- protected File renameToOK() throws Exception
- { File oOK = File.createTempFile
- (m_oFPparm.m_sInpFile,m_oFPparm.m_sPostSfx,m_oFPparm.m_oPostDir);
- oOK.delete();
- if (m_oFPparm.m_oWorkF.renameTo(oOK)) return oOK;
- throw new Exception ("Cannot rename "+m_oFPparm.m_oWorkF.toString()+" to "+oOK.toString());
- } //__________________________________
-
- protected File renameToErr() throws Exception
- { File oErr = File.createTempFile
- (m_oFPparm.m_sInpFile,m_oFPparm.m_sErrorSfx,m_oFPparm.m_oErrorDir);
- oErr.delete();
- if (m_oFPparm.m_oWorkF.renameTo(oErr)) return oErr;
- throw new Exception ("Cannot rename "+m_oFPparm.m_oWorkF.toString()+" to "+oErr.toString());
- } //__________________________________
-
- protected void checkParms() throws Exception
- { try { m_oFPparm = new ParamsFileProcessor(super.m_oParms); }
- catch (Exception e)
- { m_oLogger.fatal("checkParms() FAILED",e);
- throw e;
- }
- } //__________________________________
-
- public void execute() throws Exception
- { try
- {
- m_oFPparm.checkFile();
- super.setContextObj(CTX_INPUT_FILE,m_oFPparm.m_oIF.getName());
- try { renameToWrk(); }
- catch (Exception eRn)
- {
- m_oLogger.info("Skipping rename to wrk "+m_oFPparm.m_oIF.getName(),eRn);
- return;
- }
-
- try
- { Class oCls = Class.forName(m_oParms.getAttr(ParamsFileProcessor.FPRC_ACTION));
- Constructor oCns = oCls.getConstructor(new Class[] {File.class,EsbAbstractProcessor.class});
- oCns.newInstance(new Object[] {m_oFPparm.m_oWorkF,this});
-
- File oFok = renameToOK();
-
- super.setContextObj(EsbAbstractProcessor.CTX_POST_FILE,oFok.getName());
- super.postProcess();
- super.notifyOK("File "+m_oFPparm.m_sInpFile+" processed successfully");
- }
- catch (Exception e)
- { renameToErr();
- m_oLogger.fatal("Input File processor FAILED",e);
- throw e;
- }
- finally
- { super.release();
- }
- }
- catch (Exception eGen)
- {
-// super.notifyError(eGen,"PROBLEMS processing File "+m_oFPparm.m_sInpFile);
- eGen.printStackTrace();
- }
- }//_________________________
-
-} //____________________________________________________________________________
Deleted: labs/jbossesb/branches/refactor/product/core/processors/src/org/jboss/soa/esb/processors/EsbMsgProcessor.java
===================================================================
--- labs/jbossesb/branches/refactor/product/core/processors/src/org/jboss/soa/esb/processors/EsbMsgProcessor.java 2006-08-01 21:08:27 UTC (rev 5388)
+++ labs/jbossesb/branches/refactor/product/core/processors/src/org/jboss/soa/esb/processors/EsbMsgProcessor.java 2006-08-01 21:29:38 UTC (rev 5389)
@@ -1,90 +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.text.SimpleDateFormat;
-import java.util.Date;
-import java.io.Serializable;
-
-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
- {
- StringBuilder sb = new StringBuilder();
- if (p_oMsg instanceof TextMessage)
- sb.append("TextMessage<")
- .append(((TextMessage)p_oMsg).getText())
- .append("> ");
- else
- sb.append(p_oMsg.toString());
- System.out.println(sb.toString());
- }//_________________________
-
- private static final SimpleDateFormat s_oDF
- = new SimpleDateFormat("MMMM dd, yyyy ");
-
- protected String messagePfx()
- {
- return
- s_oDF.format(new Date(System.currentTimeMillis()))
- +" " +this.getClass().getSimpleName()
- + " : ";
- }//_________________________
-
- /**
- * Override this method in your derived class
- * <p />Listeners will call this method to request
- * the object that has to be sent to the 'ok'
- * notification list
- * @return Object - The Rosetta notification framework
- * will use the toString() method of the returned Object
- */
- public Serializable getOkNotification()
- {
- return messagePfx()+" Normal completion";
- }
- /**
- * Override this method in your derived class
- * <p />Listeners will call this method to request
- * the object that has to be sent to the 'error'
- * notification list
- * @return Object - The Rosetta notification framework
- * will use the toString() method of the returned Object
- */
- public Serializable getErrorNotification()
- {
- return messagePfx()+" Abnormal end";
- }
-
-} //____________________________________________________________________________
Modified: labs/jbossesb/branches/refactor/product/core/processors/src/org/jboss/soa/esb/processors/FileCopier.java
===================================================================
--- labs/jbossesb/branches/refactor/product/core/processors/src/org/jboss/soa/esb/processors/FileCopier.java 2006-08-01 21:08:27 UTC (rev 5388)
+++ labs/jbossesb/branches/refactor/product/core/processors/src/org/jboss/soa/esb/processors/FileCopier.java 2006-08-01 21:29:38 UTC (rev 5389)
@@ -36,12 +36,12 @@
private static final String PARMS_OUTDIR = "copyToDirURI";
private static final String PARMS_OUTSFX = "copyToSuffix";
- EsbFileProcessor m_oProc;
+ FileProcessor m_oProc;
private File [] m_oaTmpFile;
private File [] m_oaOutFile;
- public FileCopier(File p_oF, EsbAbstractProcessor p_oProc) throws Exception
- { m_oProc = (EsbFileProcessor)p_oProc;
+ public FileCopier(File p_oF, AbstractProcessor p_oProc) throws Exception
+ { m_oProc = (FileProcessor)p_oProc;
checkParms();
if (m_oaTmpFile.length> 0) execute();
} //__________________________________
Copied: labs/jbossesb/branches/refactor/product/core/processors/src/org/jboss/soa/esb/processors/FileProcessor.java (from rev 5384, labs/jbossesb/branches/refactor/product/core/processors/src/org/jboss/soa/esb/processors/EsbFileProcessor.java)
===================================================================
--- labs/jbossesb/branches/refactor/product/core/processors/src/org/jboss/soa/esb/processors/EsbFileProcessor.java 2006-08-01 18:47:29 UTC (rev 5384)
+++ labs/jbossesb/branches/refactor/product/core/processors/src/org/jboss/soa/esb/processors/FileProcessor.java 2006-08-01 21:29:38 UTC (rev 5389)
@@ -0,0 +1,110 @@
+/*
+* 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.io.File;
+import java.lang.reflect.Constructor;
+
+import org.jboss.soa.esb.helpers.*;
+
+public class FileProcessor extends AbstractProcessor
+{
+ ParamsFileProcessor m_oFPparm;
+
+ public FileProcessor(DomElement p_oP) throws Exception
+ { super(p_oP);
+ } //______________________comment____________
+
+ protected File renameToWrk() throws Exception
+ { File oWrk = File.createTempFile
+ (m_oFPparm.m_sInpFile,"",m_oFPparm.m_oInpDir);
+ oWrk.delete();
+ m_oFPparm.m_oWorkF = oWrk;
+ if (m_oFPparm.m_oIF.renameTo(oWrk)) return oWrk;
+ throw new Exception ("Cannot rename "+m_oFPparm.m_oIF.toString()+" to "+oWrk.toString());
+ } //__________________________________
+
+ protected File renameToOK() throws Exception
+ { File oOK = File.createTempFile
+ (m_oFPparm.m_sInpFile,m_oFPparm.m_sPostSfx,m_oFPparm.m_oPostDir);
+ oOK.delete();
+ if (m_oFPparm.m_oWorkF.renameTo(oOK)) return oOK;
+ throw new Exception ("Cannot rename "+m_oFPparm.m_oWorkF.toString()+" to "+oOK.toString());
+ } //__________________________________
+
+ protected File renameToErr() throws Exception
+ { File oErr = File.createTempFile
+ (m_oFPparm.m_sInpFile,m_oFPparm.m_sErrorSfx,m_oFPparm.m_oErrorDir);
+ oErr.delete();
+ if (m_oFPparm.m_oWorkF.renameTo(oErr)) return oErr;
+ throw new Exception ("Cannot rename "+m_oFPparm.m_oWorkF.toString()+" to "+oErr.toString());
+ } //__________________________________
+
+ protected void checkParms() throws Exception
+ { try { m_oFPparm = new ParamsFileProcessor(super.m_oParms); }
+ catch (Exception e)
+ { m_oLogger.fatal("checkParms() FAILED",e);
+ throw e;
+ }
+ } //__________________________________
+
+ public void execute() throws Exception
+ { try
+ {
+ m_oFPparm.checkFile();
+ super.setContextObj(CTX_INPUT_FILE,m_oFPparm.m_oIF.getName());
+ try { renameToWrk(); }
+ catch (Exception eRn)
+ {
+ m_oLogger.info("Skipping rename to wrk "+m_oFPparm.m_oIF.getName(),eRn);
+ return;
+ }
+
+ try
+ { Class oCls = Class.forName(m_oParms.getAttr(ParamsFileProcessor.FPRC_ACTION));
+ Constructor oCns = oCls.getConstructor(new Class[] {File.class,AbstractProcessor.class});
+ oCns.newInstance(new Object[] {m_oFPparm.m_oWorkF,this});
+
+ File oFok = renameToOK();
+
+ super.setContextObj(AbstractProcessor.CTX_POST_FILE,oFok.getName());
+ super.postProcess();
+ super.notifyOK("File "+m_oFPparm.m_sInpFile+" processed successfully");
+ }
+ catch (Exception e)
+ { renameToErr();
+ m_oLogger.fatal("Input File processor FAILED",e);
+ throw e;
+ }
+ finally
+ { super.release();
+ }
+ }
+ catch (Exception eGen)
+ {
+// super.notifyError(eGen,"PROBLEMS processing File "+m_oFPparm.m_sInpFile);
+ eGen.printStackTrace();
+ }
+ }//_________________________
+
+} //____________________________________________________________________________
Copied: labs/jbossesb/branches/refactor/product/core/processors/src/org/jboss/soa/esb/processors/MsgProcessor.java (from rev 5384, labs/jbossesb/branches/refactor/product/core/processors/src/org/jboss/soa/esb/processors/EsbMsgProcessor.java)
===================================================================
--- labs/jbossesb/branches/refactor/product/core/processors/src/org/jboss/soa/esb/processors/EsbMsgProcessor.java 2006-08-01 18:47:29 UTC (rev 5384)
+++ labs/jbossesb/branches/refactor/product/core/processors/src/org/jboss/soa/esb/processors/MsgProcessor.java 2006-08-01 21:29:38 UTC (rev 5389)
@@ -0,0 +1,90 @@
+/*
+* 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.text.SimpleDateFormat;
+import java.util.Date;
+import java.io.Serializable;
+
+import javax.jms.Message;
+import javax.jms.TextMessage;
+
+import org.jboss.soa.esb.helpers.*;
+
+public class MsgProcessor extends AbstractProcessor
+{
+ public MsgProcessor(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
+ {
+ StringBuilder sb = new StringBuilder();
+ if (p_oMsg instanceof TextMessage)
+ sb.append("TextMessage<")
+ .append(((TextMessage)p_oMsg).getText())
+ .append("> ");
+ else
+ sb.append(p_oMsg.toString());
+ System.out.println(sb.toString());
+ }//_________________________
+
+ private static final SimpleDateFormat s_oDF
+ = new SimpleDateFormat("MMMM dd, yyyy ");
+
+ protected String messagePfx()
+ {
+ return
+ s_oDF.format(new Date(System.currentTimeMillis()))
+ +" " +this.getClass().getSimpleName()
+ + " : ";
+ }//_________________________
+
+ /**
+ * Override this method in your derived class
+ * <p />Listeners will call this method to request
+ * the object that has to be sent to the 'ok'
+ * notification list
+ * @return Object - The Rosetta notification framework
+ * will use the toString() method of the returned Object
+ */
+ public Serializable getOkNotification()
+ {
+ return messagePfx()+" Normal completion";
+ }
+ /**
+ * Override this method in your derived class
+ * <p />Listeners will call this method to request
+ * the object that has to be sent to the 'error'
+ * notification list
+ * @return Object - The Rosetta notification framework
+ * will use the toString() method of the returned Object
+ */
+ public Serializable getErrorNotification()
+ {
+ return messagePfx()+" Abnormal end";
+ }
+
+} //____________________________________________________________________________
Modified: labs/jbossesb/branches/refactor/product/core/processors/src/org/jboss/soa/esb/processors/ParamsFileProcessor.java
===================================================================
--- labs/jbossesb/branches/refactor/product/core/processors/src/org/jboss/soa/esb/processors/ParamsFileProcessor.java 2006-08-01 21:08:27 UTC (rev 5388)
+++ labs/jbossesb/branches/refactor/product/core/processors/src/org/jboss/soa/esb/processors/ParamsFileProcessor.java 2006-08-01 21:29:38 UTC (rev 5389)
@@ -133,7 +133,7 @@
} //__________________________________
public void checkFile() throws Exception
- { DomElement oPthis = m_oParms.getFirstElementChild(EsbAbstractProcessor.PARMS_THIS_INSTANCE);
+ { DomElement oPthis = m_oParms.getFirstElementChild(AbstractProcessor.PARMS_THIS_INSTANCE);
m_sInpFile = oPthis.getAttr(FPRC_FILENAME);
m_oIF = new File((new File(m_oInpDir,m_sInpFile)).getAbsolutePath());
if (! m_oIF.exists()) throw new Exception ("File "+m_oIF.toString()+" not found");
More information about the jboss-svn-commits
mailing list