[jboss-svn-commits] JBL Code SVN: r5118 - in labs/jbossesb/trunk: . ESBCore ESBCore/Tests ESBCore/Tests/src ESBCore/Tests/src/org ESBCore/Tests/src/org/jboss ESBCore/Tests/src/org/jboss/soa ESBCore/Tests/src/org/jboss/soa/esb ESBCore/Tests/src/org/jboss/soa/esb/tests ESBCore/common ESBCore/common/src/org/jboss/soa/esb/common ESBCore/common/src/org/jboss/soa/esb/common/bizclasses ESBCore/common/src/org/jboss/soa/esb/helpers ESBCore/common/src/org/jboss/soa/esb/helpers/persist ESBCore/common/src/org/jboss/soa/esb/parameters ESBCore/common/src/org/jboss/soa/esb/services ESBCore/common/src/org/jboss/soa/esb/util ESBCore/listeners ESBCore/listeners/src/org/jboss/soa/esb/listeners ESBCore/processors ESBCore/services ESBCore/services/src/org/jboss/soa/esb ESBCore/services/src/org/jboss/soa/esb/internal ESBCore/services/src/org/jboss/soa/esb/internal/core ESBCore/services/src/org/jboss/soa/esb/internal/core/objectstore ESBCore/services/src/org/jboss/soa/esb/services ESBCore/services/src/org/j! boss/soa/esb/services/EJB ESBCore/services/src/org/jboss/soa/esb/services/msglistener docs docs/Install/conf docs/samples/TestJBossESB/conf lib/ext
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Sun Jul 16 16:26:35 EDT 2006
Author: arvinder
Date: 2006-07-16 16:25:04 -0400 (Sun, 16 Jul 2006)
New Revision: 5118
Added:
labs/jbossesb/trunk/ESBCore/Tests/
labs/jbossesb/trunk/ESBCore/Tests/build.xml
labs/jbossesb/trunk/ESBCore/Tests/src/
labs/jbossesb/trunk/ESBCore/Tests/src/org/
labs/jbossesb/trunk/ESBCore/Tests/src/org/jboss/
labs/jbossesb/trunk/ESBCore/Tests/src/org/jboss/soa/
labs/jbossesb/trunk/ESBCore/Tests/src/org/jboss/soa/esb/
labs/jbossesb/trunk/ESBCore/Tests/src/org/jboss/soa/esb/tests/
labs/jbossesb/trunk/ESBCore/Tests/src/org/jboss/soa/esb/tests/Controller.java
labs/jbossesb/trunk/ESBCore/Tests/src/org/jboss/soa/esb/tests/DrainQueuesAndTopics.java
labs/jbossesb/trunk/ESBCore/Tests/src/org/jboss/soa/esb/tests/TestNotification.java
labs/jbossesb/trunk/ESBCore/Tests/src/org/jboss/soa/esb/tests/TestObjStore.java
labs/jbossesb/trunk/ESBCore/Tests/src/org/jboss/soa/esb/tests/TestParamsRepository.java
labs/jbossesb/trunk/ESBCore/Tests/src/org/jboss/soa/esb/tests/TestPersonAddrPhone.java
labs/jbossesb/trunk/ESBCore/common/src/org/jboss/soa/esb/services/DefaultEncryptionFactory.java
labs/jbossesb/trunk/ESBCore/common/src/org/jboss/soa/esb/services/Iencryption.java
labs/jbossesb/trunk/ESBCore/listeners/src/org/jboss/soa/esb/listeners/ZZderivedSqlTablePoller.java
labs/jbossesb/trunk/ESBCore/services/src/org/jboss/soa/esb/internal/
labs/jbossesb/trunk/ESBCore/services/src/org/jboss/soa/esb/internal/core/
labs/jbossesb/trunk/ESBCore/services/src/org/jboss/soa/esb/internal/core/objectstore/
labs/jbossesb/trunk/ESBCore/services/src/org/jboss/soa/esb/internal/core/objectstore/AbstractBobjStore.java
labs/jbossesb/trunk/ESBCore/services/src/org/jboss/soa/esb/internal/core/objectstore/BobjStore.java
labs/jbossesb/trunk/ESBCore/services/src/org/jboss/soa/esb/internal/core/objectstore/DaoBatchTable.java
labs/jbossesb/trunk/ESBCore/services/src/org/jboss/soa/esb/internal/core/objectstore/DaoIndexTable.java
labs/jbossesb/trunk/ESBCore/services/src/org/jboss/soa/esb/internal/core/objectstore/DaoSnapTable.java
labs/jbossesb/trunk/ESBCore/services/src/org/jboss/soa/esb/internal/core/objectstore/DaoUidTable.java
labs/jbossesb/trunk/ESBCore/services/src/org/jboss/soa/esb/internal/core/objectstore/ItfStorable.java
labs/jbossesb/trunk/ESBCore/services/src/org/jboss/soa/esb/internal/core/objectstore/RowBatch.java
labs/jbossesb/trunk/docs/JBossESB Getting Started Guide.rtf
Removed:
labs/jbossesb/trunk/ESBCore/Tests/build.xml
labs/jbossesb/trunk/ESBCore/Tests/src/
labs/jbossesb/trunk/ESBCore/Tests/src/org/
labs/jbossesb/trunk/ESBCore/Tests/src/org/jboss/
labs/jbossesb/trunk/ESBCore/Tests/src/org/jboss/soa/
labs/jbossesb/trunk/ESBCore/Tests/src/org/jboss/soa/esb/
labs/jbossesb/trunk/ESBCore/Tests/src/org/jboss/soa/esb/tests/
labs/jbossesb/trunk/ESBCore/Tests/src/org/jboss/soa/esb/tests/Controller.java
labs/jbossesb/trunk/ESBCore/Tests/src/org/jboss/soa/esb/tests/DrainQueuesAndTopics.java
labs/jbossesb/trunk/ESBCore/Tests/src/org/jboss/soa/esb/tests/TestNotification.java
labs/jbossesb/trunk/ESBCore/Tests/src/org/jboss/soa/esb/tests/TestObjStore.java
labs/jbossesb/trunk/ESBCore/Tests/src/org/jboss/soa/esb/tests/TestParamsRepository.java
labs/jbossesb/trunk/ESBCore/Tests/src/org/jboss/soa/esb/tests/TestPersonAddrPhone.java
labs/jbossesb/trunk/ESBCore/common/src/org/jboss/soa/esb/helpers/persist/AbstractBobjStore.java
labs/jbossesb/trunk/ESBCore/common/src/org/jboss/soa/esb/helpers/persist/ItfStorable.java
labs/jbossesb/trunk/ESBCore/common/tests/
labs/jbossesb/trunk/ESBCore/listeners/tests/
labs/jbossesb/trunk/ESBCore/processors/tests/
labs/jbossesb/trunk/ESBCore/services/src/org/jboss/soa/esb/internal/core/
labs/jbossesb/trunk/ESBCore/services/src/org/jboss/soa/esb/internal/core/objectstore/
labs/jbossesb/trunk/ESBCore/services/src/org/jboss/soa/esb/internal/core/objectstore/AbstractBobjStore.java
labs/jbossesb/trunk/ESBCore/services/src/org/jboss/soa/esb/internal/core/objectstore/BobjStore.java
labs/jbossesb/trunk/ESBCore/services/src/org/jboss/soa/esb/internal/core/objectstore/DaoBatchTable.java
labs/jbossesb/trunk/ESBCore/services/src/org/jboss/soa/esb/internal/core/objectstore/DaoIndexTable.java
labs/jbossesb/trunk/ESBCore/services/src/org/jboss/soa/esb/internal/core/objectstore/DaoSnapTable.java
labs/jbossesb/trunk/ESBCore/services/src/org/jboss/soa/esb/internal/core/objectstore/DaoUidTable.java
labs/jbossesb/trunk/ESBCore/services/src/org/jboss/soa/esb/internal/core/objectstore/ItfStorable.java
labs/jbossesb/trunk/ESBCore/services/src/org/jboss/soa/esb/internal/core/objectstore/RowBatch.java
labs/jbossesb/trunk/ESBCore/services/src/org/jboss/soa/esb/services/crypto/
labs/jbossesb/trunk/ESBCore/services/src/org/jboss/soa/esb/services/dbtables/
labs/jbossesb/trunk/ESBCore/services/tests/
labs/jbossesb/trunk/ESBCore/tests/
labs/jbossesb/trunk/docs/JBossESB Getting Started Guide.doc
labs/jbossesb/trunk/lib/ext/junit.jar
Modified:
labs/jbossesb/trunk/ESBCore/build.xml
labs/jbossesb/trunk/ESBCore/common/build.xml
labs/jbossesb/trunk/ESBCore/common/src/org/jboss/soa/esb/common/EsbSysProps.java
labs/jbossesb/trunk/ESBCore/common/src/org/jboss/soa/esb/common/bizclasses/Address.java
labs/jbossesb/trunk/ESBCore/common/src/org/jboss/soa/esb/common/bizclasses/Person.java
labs/jbossesb/trunk/ESBCore/common/src/org/jboss/soa/esb/helpers/KeyValuePair.java
labs/jbossesb/trunk/ESBCore/common/src/org/jboss/soa/esb/helpers/persist/JdbcCleanConn.java
labs/jbossesb/trunk/ESBCore/common/src/org/jboss/soa/esb/parameters/DefaultReposFactory.java
labs/jbossesb/trunk/ESBCore/common/src/org/jboss/soa/esb/parameters/ParamsReposUtil.java
labs/jbossesb/trunk/ESBCore/common/src/org/jboss/soa/esb/parameters/ParamsRepository.java
labs/jbossesb/trunk/ESBCore/common/src/org/jboss/soa/esb/util/BaseBusinessObject.java
labs/jbossesb/trunk/ESBCore/common/src/org/jboss/soa/esb/util/BobjStdDTO.java
labs/jbossesb/trunk/ESBCore/common/src/org/jboss/soa/esb/util/EsbUtil.java
labs/jbossesb/trunk/ESBCore/listeners/build.xml
labs/jbossesb/trunk/ESBCore/listeners/src/org/jboss/soa/esb/listeners/AbstractPoller.java
labs/jbossesb/trunk/ESBCore/listeners/src/org/jboss/soa/esb/listeners/OldDirListener.java
labs/jbossesb/trunk/ESBCore/listeners/src/org/jboss/soa/esb/listeners/SqlTablePoller.java
labs/jbossesb/trunk/ESBCore/processors/build.xml
labs/jbossesb/trunk/ESBCore/services/build.xml
labs/jbossesb/trunk/ESBCore/services/src/org/jboss/soa/esb/services/EJB/JbossEsbBatchHandler.java
labs/jbossesb/trunk/ESBCore/services/src/org/jboss/soa/esb/services/EJB/JbossEsbBatchHandlerBean.java
labs/jbossesb/trunk/ESBCore/services/src/org/jboss/soa/esb/services/EJB/JbossEsbBatchHandlerHome.java
labs/jbossesb/trunk/ESBCore/services/src/org/jboss/soa/esb/services/EJB/JbossEsbBatchHandlerLocal.java
labs/jbossesb/trunk/ESBCore/services/src/org/jboss/soa/esb/services/EJB/JbossEsbBatchHandlerLocalHome.java
labs/jbossesb/trunk/ESBCore/services/src/org/jboss/soa/esb/services/EJB/JbossEsbNotificationHandler.java
labs/jbossesb/trunk/ESBCore/services/src/org/jboss/soa/esb/services/EJB/JbossEsbNotificationHandlerHome.java
labs/jbossesb/trunk/ESBCore/services/src/org/jboss/soa/esb/services/EJB/JbossEsbNotificationHandlerLocal.java
labs/jbossesb/trunk/ESBCore/services/src/org/jboss/soa/esb/services/EJB/JbossEsbNotificationHandlerLocalHome.java
labs/jbossesb/trunk/ESBCore/services/src/org/jboss/soa/esb/services/EJB/JbossEsbPersistHandler.java
labs/jbossesb/trunk/ESBCore/services/src/org/jboss/soa/esb/services/EJB/JbossEsbPersistHandlerBean.java
labs/jbossesb/trunk/ESBCore/services/src/org/jboss/soa/esb/services/EJB/JbossEsbPersistHandlerHome.java
labs/jbossesb/trunk/ESBCore/services/src/org/jboss/soa/esb/services/EJB/JbossEsbPersistHandlerLocal.java
labs/jbossesb/trunk/ESBCore/services/src/org/jboss/soa/esb/services/EJB/JbossEsbPersistHandlerLocalHome.java
labs/jbossesb/trunk/ESBCore/services/src/org/jboss/soa/esb/services/PersistHandlerBsDelegateLocal.java
labs/jbossesb/trunk/ESBCore/services/src/org/jboss/soa/esb/services/PersistHandlerBsDelegateRemote.java
labs/jbossesb/trunk/ESBCore/services/src/org/jboss/soa/esb/services/msglistener/AbstractEsbMsgDrivenBean.java
labs/jbossesb/trunk/build.xml
labs/jbossesb/trunk/docs/Install/conf/jbossEsb.properties
labs/jbossesb/trunk/docs/samples/TestJBossESB/conf/ObjStoreExample.xml
Log:
Revert back to revision 5096 before refactor merge at revision 5104
Copied: labs/jbossesb/trunk/ESBCore/Tests (from rev 5096, labs/jbossesb/trunk/ESBCore/Tests)
Deleted: labs/jbossesb/trunk/ESBCore/Tests/build.xml
===================================================================
--- labs/jbossesb/trunk/ESBCore/Tests/build.xml 2006-07-14 14:02:34 UTC (rev 5096)
+++ labs/jbossesb/trunk/ESBCore/Tests/build.xml 2006-07-16 20:25:04 UTC (rev 5118)
@@ -1,47 +0,0 @@
-<?xml version="1.0"?>
-<project name="BuildEsbTests" default="org.jboss.esb.tests.compile" basedir=".">
-
- <property name="org.jboss.esb.tests.bin.dir" value="${org.jboss.esb.internal.dest}/tests"/>
- <property name="org.jboss.esb.core.bin.dir" value="${org.jboss.esb.internal.dest}/classes"/>
- <property name="org.jboss.esb.tests.src.dir" value="${basedir}/src"/>
- <property name="org.jboss.esb.root.dir" value="../.."/>
- <property environment="env"/>
-
- <property name="org.jboss.esb.ext.lib.dir" value="${org.jboss.esb.root.dir}/lib/ext"/>
- <condition property="org.jboss.esb.ext.lib.dir" value="{org.jboss.esb.jboss.home}/client">
- <equals arg1="${org.jboss.esb.frominstall}" arg2="yes"/>
- </condition>
-
- <path id="org.jboss.esb.tests.base.classpath">
- <fileset dir="${org.jboss.esb.ext.lib.dir}" includes="activation.jar jbossall-client.jar log4j.jar mail.jar"/>
- <pathelement location="${org.jboss.esb.core.bin.dir}"/>
- </path>
-
- <target name="org.jboss.esb.tests.init">
- <tstamp>
- <format property="TODAY" pattern="d-MM-yy"/>
- </tstamp>
-
- <mkdir dir="${org.jboss.esb.tests.bin.dir}"/>
- </target>
-
- <target name="clean"/>
-
- <target name="purge" depends="clean">
- <delete dir="${org.jboss.esb.tests.bin.dir}"/>
- </target>
-
- <target name="org.jboss.esb.tests.compile" if="org.jboss.esb.buildtests" depends="org.jboss.esb.tests.init">
-
- <javac
- destdir="${org.jboss.esb.tests.bin.dir}"
- classpathref="org.jboss.esb.tests.base.classpath"
- debug="${org.jboss.esb.debug}"
- optimize="${org.jboss.esb.optimize}"
- >
- <src path="${org.jboss.esb.tests.src.dir}"/>
- </javac>
-
- </target>
-
-</project>
Copied: labs/jbossesb/trunk/ESBCore/Tests/build.xml (from rev 5096, labs/jbossesb/trunk/ESBCore/Tests/build.xml)
Copied: labs/jbossesb/trunk/ESBCore/Tests/src (from rev 5096, labs/jbossesb/trunk/ESBCore/Tests/src)
Copied: labs/jbossesb/trunk/ESBCore/Tests/src/org (from rev 5096, labs/jbossesb/trunk/ESBCore/Tests/src/org)
Copied: labs/jbossesb/trunk/ESBCore/Tests/src/org/jboss (from rev 5096, labs/jbossesb/trunk/ESBCore/Tests/src/org/jboss)
Copied: labs/jbossesb/trunk/ESBCore/Tests/src/org/jboss/soa (from rev 5096, labs/jbossesb/trunk/ESBCore/Tests/src/org/jboss/soa)
Copied: labs/jbossesb/trunk/ESBCore/Tests/src/org/jboss/soa/esb (from rev 5096, labs/jbossesb/trunk/ESBCore/Tests/src/org/jboss/soa/esb)
Copied: labs/jbossesb/trunk/ESBCore/Tests/src/org/jboss/soa/esb/tests (from rev 5096, labs/jbossesb/trunk/ESBCore/Tests/src/org/jboss/soa/esb/tests)
Deleted: labs/jbossesb/trunk/ESBCore/Tests/src/org/jboss/soa/esb/tests/Controller.java
===================================================================
--- labs/jbossesb/trunk/ESBCore/Tests/src/org/jboss/soa/esb/tests/Controller.java 2006-07-14 14:02:34 UTC (rev 5096)
+++ labs/jbossesb/trunk/ESBCore/Tests/src/org/jboss/soa/esb/tests/Controller.java 2006-07-16 20:25:04 UTC (rev 5118)
@@ -1,56 +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.tests;
-
-import java.lang.reflect.*;
-
-public class Controller
-{
- private static String[] s_saArgs;
- static String[] getArgs() { return s_saArgs; }
- public static void main(String[] args) throws Exception
- { s_saArgs = args; new Controller(); }
-
- private Controller() throws Exception
- {
- // build this Class[] with the list of classes you wish to test
- // Tested classes should have a public constructor with no arguments
-
- Class[] oaTest =
- {
-// TestParamsRepository.class
-// ,TestPersonAddrPhone.class
-// ,TestObjStore.class
-// ,TestNotification.class
- DrainQueuesAndTopics.class
- };
-
- for (Class oCls : oaTest)
- {
- Constructor oConst = oCls.getConstructor(new Class[] {});
- oConst.newInstance(new Object[] {});
- }
-
- Thread.sleep(500);
- } //________________________________
-
-} //____________________________________________________________________________
Copied: labs/jbossesb/trunk/ESBCore/Tests/src/org/jboss/soa/esb/tests/Controller.java (from rev 5096, labs/jbossesb/trunk/ESBCore/Tests/src/org/jboss/soa/esb/tests/Controller.java)
Deleted: labs/jbossesb/trunk/ESBCore/Tests/src/org/jboss/soa/esb/tests/DrainQueuesAndTopics.java
===================================================================
--- labs/jbossesb/trunk/ESBCore/Tests/src/org/jboss/soa/esb/tests/DrainQueuesAndTopics.java 2006-07-14 14:02:34 UTC (rev 5096)
+++ labs/jbossesb/trunk/ESBCore/Tests/src/org/jboss/soa/esb/tests/DrainQueuesAndTopics.java 2006-07-16 20:25:04 UTC (rev 5118)
@@ -1,92 +0,0 @@
-package org.jboss.soa.esb.tests;
-
-import javax.jms.*;
-import javax.naming.*;
-
-import org.jboss.soa.esb.helpers.*;
-
-public class DrainQueuesAndTopics
-{
- private static final int MAX_TIMES_NOMSG = 10;
- private static final String JNDI_URL = "localhost";
- private static final String JNDI_TYPE
- = AppServerContext.SERVER_TYPE.jboss.toString();
-
- private Context m_oCtx;
-
- public DrainQueuesAndTopics() throws Exception
- {
- purgeQueueTopic("queue/A");
- purgeQueueTopic("queue/B");
- purgeQueueTopic("topic/testTopic");
- } //__________________________________
-
- public int purgeQueueTopic(String p_sName) throws Exception
- {
- int iRet = 0;
- m_oCtx = AppServerContext.getServerContext(JNDI_TYPE,JNDI_URL);
-
- System.out.println(p_sName);
- MessageConsumer oCns = null;
- switch(p_sName.toLowerCase().charAt(0))
- { case 't' : oCns = getTopic(p_sName); break;
- case 'q' : oCns = getQueue(p_sName); break;
- }
- if (null==oCns)
- return 0;
-
- for (int iNoRcv=0; iNoRcv < MAX_TIMES_NOMSG; )
- { Message oMsg = oCns.receive(200);
- if (null==oMsg)
- { iNoRcv++;
- System.out.print(".");
- continue;
- }
- iRet++;
- dumpMessage(oMsg);
- iNoRcv = 0;
- }
- System.out.println();
- return iRet;
- } //__________________________________
-
- void dumpMessage(Message pM)
- {
- System.out.println(pM);
- } //__________________________________
-
- QueueReceiver getQueue(String p_sJndi) throws Exception
- {
- QueueConnection oQconn = null;
- QueueSession oQsess = null;
- QueueConnectionFactory qcf = (QueueConnectionFactory) m_oCtx
- .lookup("ConnectionFactory");
-
- oQconn = qcf.createQueueConnection();
- oQsess = oQconn.createQueueSession(false
- ,QueueSession.AUTO_ACKNOWLEDGE);
- javax.jms.Queue oQueue
- = (javax.jms.Queue) m_oCtx.lookup(p_sJndi);
-
- QueueReceiver oRcv = oQsess.createReceiver(oQueue);
- oQconn.start();
- return oRcv;
- } //__________________________________
-
- TopicSubscriber getTopic(String p_sJndi) throws Exception
- {
- TopicConnection oTconn = null;
- TopicSession oTsess = null;
- TopicConnectionFactory qcf = (TopicConnectionFactory) m_oCtx
- .lookup("ConnectionFactory");
-
- oTconn = qcf.createTopicConnection();
- oTsess = oTconn.createTopicSession(false
- ,QueueSession.AUTO_ACKNOWLEDGE);
- Topic oT = (Topic) m_oCtx.lookup(p_sJndi);
-
- TopicSubscriber oRcv = oTsess.createSubscriber(oT);
- oTconn.start();
- return oRcv;
- } //__________________________________
-} //____________________________________________________________________________
Copied: labs/jbossesb/trunk/ESBCore/Tests/src/org/jboss/soa/esb/tests/DrainQueuesAndTopics.java (from rev 5096, labs/jbossesb/trunk/ESBCore/Tests/src/org/jboss/soa/esb/tests/DrainQueuesAndTopics.java)
Deleted: labs/jbossesb/trunk/ESBCore/Tests/src/org/jboss/soa/esb/tests/TestNotification.java
===================================================================
--- labs/jbossesb/trunk/ESBCore/Tests/src/org/jboss/soa/esb/tests/TestNotification.java 2006-07-14 14:02:34 UTC (rev 5096)
+++ labs/jbossesb/trunk/ESBCore/Tests/src/org/jboss/soa/esb/tests/TestNotification.java 2006-07-16 20:25:04 UTC (rev 5118)
@@ -1,201 +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.tests;
-
-import java.util.*;
-import java.text.SimpleDateFormat;
-
-import org.jboss.soa.esb.common.EsbSysProps;
-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.*;
-
-// DON'T FORGET !!
-// The Rosetta Application server has to be up and running
-// (set JNDI_SERVER appropriately)
-// For e-mail notification: System properties for smtp
-// (server, user, password, port) must be set up in app server
-
-public class TestNotification
-{
- private static InotificationHandler m_oH;
-
- public TestNotification () throws Exception
- { performTest(); }
-
- static void performTest() throws Exception
- {
- // get a handle to your business delegate
- m_oH = NotificationHandlerFactory.getNotifHandler
- ("remote"
- ,EsbSysProps.getJndiServerType()
- ,EsbSysProps.getJndiServerURL()
- );
-
- DomElement oEl = new DomElement("MyFileList");
- oEl.setAttr(NotificationList.TYPE,"OK");
-
-// oEl.addElemChild(fileListTarget());
-// oEl.addElemChild(emailTarget());
-// oEl.addElemChild(jmsQueueTarget());
-// oEl.addElemChild(jmsTopicTarget());
- oEl.addElemChild(sqlTableTarget());
-
- NotificationList oNL = new NotificationList(oEl);
-
- // to see how the XML looks like
- // this is just a unit test class
- // Typically the XML is used in a parameter object (DomElement.fromXml())
- System.out.println(oNL.toString());
-
- // a simple timestamped message
- Date oNow = new Date(System.currentTimeMillis());
- SimpleDateFormat oStamp = new SimpleDateFormat("dd/MMM/yyyy HH:mm:ss.SSS");
- StringBuilder sb = new StringBuilder(oStamp.format(oNow))
- .append(" This message from Notification test");
-
- m_oH.sendNotifications(oNL,sb.toString());
- } //________________________________
-
- static DomElement emailTarget() throws Exception
- {
- DomElement oTgt = new DomElement(NotificationList.CHILD_TGT);
- oTgt.setAttr(NotificationTarget.PRM_NOTIF_CLASS,"NotifyEmail");
- oTgt.setAttr(EsbEmail.FROM,"sender at jboss.com");
- oTgt.setAttr(EsbEmail.SENDTO,"receiver1 at hotmail.com,receiver2 at jboss.com");;
- oTgt.setAttr(EsbEmail.SUBJECT,"TEST from Rosetta");
- oTgt.setAttr(EsbEmail.MESSAGE,"This is the text of your message");
-
- // This class does NOT send the e-mails, the app server does
- // consequently these paths would have to be accessible in the
- // application server (filesystem / mounts)
- String[] sa = {"/tmp/tomcat.sh","/tmp/program.js"};
- for (String sCurr : sa)
- oTgt.addTextChild(EsbEmail.ATTACH,sCurr);
-
- return oTgt;
- } //________________________________
-
- static DomElement fileListTarget() throws Exception
- {
- DomElement oTgt = new DomElement(NotificationList.CHILD_TGT);
- oTgt.setAttr(NotificationTarget.PRM_NOTIF_CLASS,"NotifyFiles");
-
- // This class does NOT write the files, the app server does
- // consequently these paths would have to be accessible in the
- // application server (filesystem / mounts)
- String[] sa = {"file:///tmp/file1.notif","file:///tmp/file2.notif"};
- for (String sCurr : sa)
- { DomElement oFile = new DomElement(NotifyFiles.CHILD_FILE);
- oFile.setAttr(NotifyFiles.ATT_URI,sCurr);
- oFile.setAttr(NotifyFiles.ATT_APPEND,Boolean.toString(true));
- oTgt.addElemChild(oFile);
- }
- return oTgt;
- } //________________________________
-
- static DomElement jmsQueueTarget() throws Exception
- {
- DomElement oTgt = new DomElement(NotificationList.CHILD_TGT);
- oTgt.setAttr(NotificationTarget.PRM_NOTIF_CLASS,"NotifyQueues");
-
- String[] sa = {"queue/A","queue/B"};
- for (String sCurr : sa)
- { DomElement oQ = new DomElement(NotifyQueues.CHILD_QUEUE);
- oQ.setAttr(NotifyJMS.ATT_DEST_NAME,sCurr);
- for (DomElement oProp : getMessageProperties())
- oQ.addElemChild(oProp);
- oTgt.addElemChild(oQ);
- }
- return oTgt;
- } //________________________________
-
- static DomElement jmsTopicTarget() throws Exception
- {
- DomElement oTgt = new DomElement(NotificationList.CHILD_TGT);
- oTgt.setAttr(NotificationTarget.PRM_NOTIF_CLASS,"NotifyTopics");
-
- String[] sa = {"topic/testTopic"};
- for (String sCurr : sa)
- { DomElement oQ = new DomElement(NotifyTopics.CHILD_TOPIC);
- oQ.setAttr(NotifyJMS.ATT_DEST_NAME,sCurr);
- for (DomElement oProp : getMessageProperties())
- oQ.addElemChild(oProp);
- oTgt.addElemChild(oQ);
- }
- return oTgt;
- } //________________________________
-
- static DomElement[] getMessageProperties() throws Exception
- {
- KeyValuePair[] oaProps = new KeyValuePair[]
- {new KeyValuePair("prop1","111")
- ,new KeyValuePair("prop2","bbb")
- ,new KeyValuePair("prop3","abc123")
- };
- DomElement[] oaRet = new DomElement[oaProps.length];
- int iCurr = 0;
- for (KeyValuePair oCurr : oaProps)
- { DomElement oElem = new DomElement(NotifyJMS.CHILD_MSG_PROP);
- oElem.setAttr(NotifyJMS.ATT_PROP_NAME,oCurr.getKey());
- oElem.setAttr(NotifyJMS.ATT_PROP_VALUE,oCurr.getValue());
- oaRet[iCurr++] = oElem;
- }
- return oaRet;
- } //________________________________
-
- static DomElement sqlTableTarget() throws Exception
- {
- DomElement oTgt = new DomElement(NotificationList.CHILD_TGT);
- oTgt.setAttr(NotificationTarget.PRM_NOTIF_CLASS,"NotifySqlTable");
-
- oTgt.setAttr(SimpleDataSource.DRIVER,"org.postgresql.Driver");
- oTgt.setAttr(SimpleDataSource.URL,"jdbc:postgresql://lavasca:5432/rosetta");
- oTgt.setAttr(SimpleDataSource.USER,"postgres");
- oTgt.setAttr(SimpleDataSource.PASSWORD,"");
-
- // Table name for insert - must exist in database (URL)
- oTgt.setAttr(NotifySqlTable.ATT_TABLE,"test_notif_table");
- // Column that will contain the dynamic data generated by the ActionClass
- // must exist in table (ATT_TABLE above)
- oTgt.setAttr(NotifySqlTable.ATT_DATA,"msg");
-
- // constant data that can be also added in the insert
- // (perhaps needed for queries)
- // Key = column name (it must exist in the table, same as ATT_DATA column)
- KeyValuePair[] oaCols = new KeyValuePair[]
- {new KeyValuePair("src","TestNotification")
- ,new KeyValuePair("ref","any Ref")
- ,new KeyValuePair("val1","VVVV 11111")
- };
- for (KeyValuePair oCurr : oaCols)
- { DomElement oElem = new DomElement(NotifySqlTable.CHILD_COLUMN);
- oElem.setAttr(NotifySqlTable.ATT_NAME,oCurr.getKey());
- oElem.setAttr(NotifySqlTable.ATT_VALUE,oCurr.getValue());
- oTgt.addElemChild(oElem);
- }
-
-
- return oTgt;
- } //________________________________
-} //____________________________________________________________________________
Copied: labs/jbossesb/trunk/ESBCore/Tests/src/org/jboss/soa/esb/tests/TestNotification.java (from rev 5096, labs/jbossesb/trunk/ESBCore/Tests/src/org/jboss/soa/esb/tests/TestNotification.java)
Deleted: labs/jbossesb/trunk/ESBCore/Tests/src/org/jboss/soa/esb/tests/TestObjStore.java
===================================================================
--- labs/jbossesb/trunk/ESBCore/Tests/src/org/jboss/soa/esb/tests/TestObjStore.java 2006-07-14 14:02:34 UTC (rev 5096)
+++ labs/jbossesb/trunk/ESBCore/Tests/src/org/jboss/soa/esb/tests/TestObjStore.java 2006-07-16 20:25:04 UTC (rev 5118)
@@ -1,84 +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.tests;
-
-import org.jboss.soa.esb.common.EsbSysProps;
-import org.jboss.soa.esb.common.bizclasses.*;
-import org.jboss.soa.esb.services.*;
-
-// DON'T FORGET !!
-// The Rosetta Application server has to be up and running
-// (set JNDI_SERVER appropriately)
-
-public class TestObjStore
-{
- private static IpersistHandler m_oH;
-
- public TestObjStore () throws Exception
- { performTest(); }
-
- static void performTest() throws Exception
- {
- // get a handle to your business delegate
- m_oH = PersistHandlerFactory.getPersistHandler
- ("remote"
- ,EsbSysProps.getJndiServerType()
- ,EsbSysProps.getJndiServerURL()
- );
-
- // request UID chunks for your own use
-// int[] ia = {10,20,30};
-// for (int iCurr : ia)
-// System.out.println
-// ("Requesting "+iCurr+" uids "
-// +" - First UID returned = " +m_oH.getUidChunk(iCurr)
-// );
-
- storeAndRetrievePerson();
- } //________________________________
-
- static void storeAndRetrievePerson() throws Exception
- {
- // set up a Person (see TestPersonAddrPhone.class)
- Person oPrs = TestPersonAddrPhone.getPerson();
- // timestamp, uid and snap Uid are added just to make it easier
- // to compare output text
- oPrs.setStamp(System.currentTimeMillis());
- long lUid = m_oH.addObject(oPrs);
- oPrs.setUid(lUid);
- oPrs.setSnap(lUid);
-
- // retrieve it from the Object Store
- Person oP2 = (Person)m_oH.getObject(Person.class,lUid);
-
- // output in XML format both objects, and compare
- // timestamps will differ slightly because first object
- // has a dummy timestamp (just before "store" request)
- System.out.println(oPrs.toDTO().toXml());
- System.out.println(oP2.toDTO().toXml());
-
- // if you used the "ObjStoreExample.xml" that comes with the
- // standard example, you'll be able to see your objects
- // in the "object_snap" and "people_index" tables
-
- } //________________________________
-} //____________________________________________________________________________
Copied: labs/jbossesb/trunk/ESBCore/Tests/src/org/jboss/soa/esb/tests/TestObjStore.java (from rev 5096, labs/jbossesb/trunk/ESBCore/Tests/src/org/jboss/soa/esb/tests/TestObjStore.java)
Deleted: labs/jbossesb/trunk/ESBCore/Tests/src/org/jboss/soa/esb/tests/TestParamsRepository.java
===================================================================
--- labs/jbossesb/trunk/ESBCore/Tests/src/org/jboss/soa/esb/tests/TestParamsRepository.java 2006-07-14 14:02:34 UTC (rev 5096)
+++ labs/jbossesb/trunk/ESBCore/Tests/src/org/jboss/soa/esb/tests/TestParamsRepository.java 2006-07-16 20:25:04 UTC (rev 5118)
@@ -1,55 +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.tests;
-
-import javax.naming.*;
-
-import org.jboss.soa.esb.helpers.*;
-import org.jboss.soa.esb.parameters.*;
-
-public class TestParamsRepository
-{
- ParamsRepository m_oRepos;
- public TestParamsRepository() throws Exception
- {
- m_oRepos = ParamsReposUtil.reposFromFactory(null,null);
- performTest();
- } //________________________________
-
- @SuppressWarnings("unused")
- private void performTest() throws Exception
- {
- String sDir = "/tmp/jbossEsb/paramsDir";
- Name oInpName = m_oRepos.nameFromString(sDir)
- .add("FileMoverConfigExample.xml");
-
- DomElement oElem = m_oRepos.getElement(oInpName);
-
- Name oOutName = m_oRepos.nameFromString(sDir)
- .add("outputTest.xml");
- m_oRepos.storeElement(oOutName,oElem);
-
- oElem = m_oRepos.getElement(oOutName);
- System.out.println(oElem.toString());
- } //________________________________
-
-} //____________________________________________________________________________
Copied: labs/jbossesb/trunk/ESBCore/Tests/src/org/jboss/soa/esb/tests/TestParamsRepository.java (from rev 5096, labs/jbossesb/trunk/ESBCore/Tests/src/org/jboss/soa/esb/tests/TestParamsRepository.java)
Deleted: labs/jbossesb/trunk/ESBCore/Tests/src/org/jboss/soa/esb/tests/TestPersonAddrPhone.java
===================================================================
--- labs/jbossesb/trunk/ESBCore/Tests/src/org/jboss/soa/esb/tests/TestPersonAddrPhone.java 2006-07-14 14:02:34 UTC (rev 5096)
+++ labs/jbossesb/trunk/ESBCore/Tests/src/org/jboss/soa/esb/tests/TestPersonAddrPhone.java 2006-07-16 20:25:04 UTC (rev 5118)
@@ -1,96 +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.tests;
-
-
-import org.jboss.soa.esb.util.*;
-import org.jboss.soa.esb.common.bizclasses.*;
-
-public class TestPersonAddrPhone
-{
- public TestPersonAddrPhone() throws Exception
- { performTest(); }
-
- static void performTest() throws Exception
- {
- BaseBusinessObject o = getPerson();
- o.setPackage();
-
- BobjStdDTO oDto = o.toDTO();
- System.out.println(oDto.toXml());
-
- o = BaseBusinessObject.getFromDTO(oDto);
- System.out.println(o.toDTO().toXml());
- Thread.sleep(500);
-
- o.toDTO().Dump("Example dump of "+o.getClass().getSimpleName());
-
- } //________________________________
-
- static Person getPerson() throws Exception
- { Person oP = new Person((String)null);
- oP.setField(Person.ATTRIB.pfx,"Mr.");
- oP.setField(Person.ATTRIB.fmlyN,"Brum");
- oP.setField(Person.ATTRIB.givN,"Daniel");
- oP.setField(Person.ATTRIB.sfx,"the 1st.");
-
- oP.addAddress(getAddress());
-
- oP.addEmail(OneValue.getStringValue("myaddr at gmail.com","home"));
- oP.addEmail(OneValue.getStringValue("john.smith at jboss.com","work"));
-
- oP.addPhone(newPhone("basement","1","416","555-1212",null));
- oP.addPhone(newPhone("cell",null,"416","666-4444",null));
-
- return oP;
- } //________________________________
-
- static Address getAddress() throws Exception
- {
- Address oP = new Address((String)null);
- oP.setField(Address.ATTRIB.strNum,"50");
- oP.setField(Address.ATTRIB.strLine1,"Balcarce");
- oP.setField(Address.ATTRIB.twnCty1,"San Isidro");
- oP.setField(Address.ATTRIB.postalZip,"1642");
- oP.setField(Address.ATTRIB.provSt,"Buenos Aires");
- oP.setField(Address.ATTRIB.cntry,"Argentina");
-
- oP.addPhone(newPhone("torIP",null,"416","555-1212",null));
- oP.addPhone(newPhone("home","54","11","4555-1111","7"));
-
- return oP;
- } //________________________________
-
- public static Telephone newPhone(String p_sRole,
- String p_sCtry, String p_sCity, String p_sNum, String p_sExt)
- {
- Telephone oP = new Telephone((String)null);
- oP.setRole(p_sRole);
- oP.setField(Telephone.ATTRIB.cntry,p_sCtry);
- oP.setField(Telephone.ATTRIB.city,p_sCity);
- oP.setField(Telephone.ATTRIB.num,p_sNum);
- oP.setField(Telephone.ATTRIB.ext,p_sExt);
-
- return oP;
- }
-
-} //____________________________________________________________________________
Copied: labs/jbossesb/trunk/ESBCore/Tests/src/org/jboss/soa/esb/tests/TestPersonAddrPhone.java (from rev 5096, labs/jbossesb/trunk/ESBCore/Tests/src/org/jboss/soa/esb/tests/TestPersonAddrPhone.java)
Modified: labs/jbossesb/trunk/ESBCore/build.xml
===================================================================
--- labs/jbossesb/trunk/ESBCore/build.xml 2006-07-16 00:25:35 UTC (rev 5117)
+++ labs/jbossesb/trunk/ESBCore/build.xml 2006-07-16 20:25:04 UTC (rev 5118)
@@ -18,6 +18,12 @@
</tstamp>
</target>
+ <!--
+ <condition property="org.jboss.esb.internal.dest" value="..">
+ <equals arg1="$org.jboss.esb.internal.dest}" arg2=""/>
+ </condition>
+ -->
+
<!-- =================================================================== -->
<!-- Prepares the directory structure -->
<!-- =================================================================== -->
@@ -29,28 +35,15 @@
<!-- =================================================================== -->
<!-- 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"/>
- -->
+ <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 -->
@@ -79,38 +72,21 @@
<!-- 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"/>
- -->
+ <ant dir="common" target="clean"/>
+ <ant dir="listeners" target="clean"/>
+ <ant dir="processors" target="clean"/>
+ <ant dir="services" target="clean"/>
+ <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"/>
+ <delete dir="${org.jboss.esb.internal.dest}/dist"/>
+
+ <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"/>
- -->
+ <ant dir="tests" target="purge"/>
</target>
<!-- =================================================================== -->
Modified: labs/jbossesb/trunk/ESBCore/common/build.xml
===================================================================
--- labs/jbossesb/trunk/ESBCore/common/build.xml 2006-07-16 00:25:35 UTC (rev 5117)
+++ labs/jbossesb/trunk/ESBCore/common/build.xml 2006-07-16 20:25:04 UTC (rev 5118)
@@ -34,17 +34,8 @@
<target name="purge" depends="clean">
<delete dir="${org.jboss.esb.common.bin.dir}"/>
</target>
-
-
- <target name="org.jboss.esb.common.compile">
- <!-- Compile common -->
- <antcall target="org.jboss.esb.common.internal.compile"/>
- <!-- Compile common tests -->
- <ant inheritAll="true" dir="tests" target="org.jboss.esb.common.tests.compile"/>
- </target>
-
-
- <target name="org.jboss.esb.common.internal.compile" depends="org.jboss.esb.common.prepare"
+
+ <target name="org.jboss.esb.common.compile" depends="org.jboss.esb.common.prepare"
description="Compile all classes">
<javac
@@ -70,16 +61,6 @@
/>
</target>
+ <target name="all" depends="recompile,jar" />
-
- <target name="org.jboss.esb.common.test" description="Run tests for this module">
- <!-- Compile common tests -->
- <ant dir="tests" target="org.jboss.esb.common.internal.test"/>
- </target>
-
-
-
-
- <target name="all" depends="recompile,jar" />
-
</project>
Modified: labs/jbossesb/trunk/ESBCore/common/src/org/jboss/soa/esb/common/EsbSysProps.java
===================================================================
--- labs/jbossesb/trunk/ESBCore/common/src/org/jboss/soa/esb/common/EsbSysProps.java 2006-07-16 00:25:35 UTC (rev 5117)
+++ labs/jbossesb/trunk/ESBCore/common/src/org/jboss/soa/esb/common/EsbSysProps.java 2006-07-16 20:25:04 UTC (rev 5118)
@@ -22,6 +22,8 @@
package org.jboss.soa.esb.common;
+import org.jboss.soa.esb.helpers.KeyValuePair;
+
public class EsbSysProps
{
public static final String SMTP_HOST = "jbossEsb.mail.smtp.host";
@@ -33,10 +35,32 @@
public static final String JNDI_SERVER_URL = "jbossEsb.jndi.server.url";
public static final String PARAMS_REPOS_FACTORY_CLASS
- = "jbossEsb.paramsRepository.factoryClass";
+ = "jbossEsb.paramsRepository.factory.class";
public static final String OBJECT_STORE_CONFIG_FILE
- = "jbossEsb.objStore.configfile";
+ = "jbossEsb.objStore.configfile";
+ public static final String ENCRYPT_FACTORY_CLASS
+ = "jbossEsb.encryption.factory.class";
+ private static KeyValuePair[] s_oaKV = new KeyValuePair[]
+ {new KeyValuePair(SMTP_HOST ,getSmtpHost())
+ ,new KeyValuePair(SMTP_USERNAME ,getSmtpUsername())
+ ,new KeyValuePair(SMTP_PASSWORD ,getSmtpPassword())
+ ,new KeyValuePair(SMTP_PORT ,getSmtpPort())
+ ,new KeyValuePair(JNDI_SERVER_TYPE, getJndiServerType())
+ ,new KeyValuePair(JNDI_SERVER_URL,getJndiServerURL())
+ ,new KeyValuePair(PARAMS_REPOS_FACTORY_CLASS, getParamsReposFactoryClass())
+ ,new KeyValuePair(OBJECT_STORE_CONFIG_FILE, getObjStoreConfigFile())
+ ,new KeyValuePair(ENCRYPT_FACTORY_CLASS, getEncryptionFactoryClass())
+
+ };
+
+ public static String dump()
+ { StringBuilder sb = new StringBuilder("Dump of EsbSysProps:\n");
+ for (KeyValuePair oCurr : s_oaKV)
+ sb.append(oCurr.getKey()).append("=").append(oCurr.getValue()).append("\n")
+ ;
+ return sb.append("______________________________________").toString();
+ } //________________________________
public static String getSmtpHost()
{ return System.getProperty(SMTP_HOST,"localhost");
@@ -70,5 +94,10 @@
{ return System.getProperty(OBJECT_STORE_CONFIG_FILE);
}
+ public static String getEncryptionFactoryClass()
+ { return System.getProperty(ENCRYPT_FACTORY_CLASS
+ ,"org.jboss.soa.esb.services.DefaultEncryptionFactory");
+ }
+
} //_____________________________________________________________________
Modified: labs/jbossesb/trunk/ESBCore/common/src/org/jboss/soa/esb/common/bizclasses/Address.java
===================================================================
--- labs/jbossesb/trunk/ESBCore/common/src/org/jboss/soa/esb/common/bizclasses/Address.java 2006-07-16 00:25:35 UTC (rev 5117)
+++ labs/jbossesb/trunk/ESBCore/common/src/org/jboss/soa/esb/common/bizclasses/Address.java 2006-07-16 20:25:04 UTC (rev 5118)
@@ -110,6 +110,10 @@
return m_olPhones.remove(p_i);
}//_____________________________________________
+ public Telephone getPhoneRole(String p_sRole)
+ { return (Telephone)BaseBusinessObject.getRoleFromList(p_sRole,m_olPhones);
+ }//_____________________________________________
+
public String toString()
{ StringBuilder sb = new StringBuilder();
String sCurr = getField(ATTRIB.strNum);
Modified: labs/jbossesb/trunk/ESBCore/common/src/org/jboss/soa/esb/common/bizclasses/Person.java
===================================================================
--- labs/jbossesb/trunk/ESBCore/common/src/org/jboss/soa/esb/common/bizclasses/Person.java 2006-07-16 00:25:35 UTC (rev 5117)
+++ labs/jbossesb/trunk/ESBCore/common/src/org/jboss/soa/esb/common/bizclasses/Person.java 2006-07-16 20:25:04 UTC (rev 5118)
@@ -173,6 +173,10 @@
if(p_i < 0 || p_i >=m_olAddr.size()) return null;
return m_olAddr.remove(p_i);
}//_____________________________________________
+
+ public Address getAddressRole(String p_sRole)
+ { return (Address)BaseBusinessObject.getRoleFromList(p_sRole,m_olAddr);
+ }//_____________________________________________
// Telephone List handling
@@ -198,6 +202,10 @@
return m_olPhones.remove(p_i);
}//_____________________________________________
+ public Telephone getPhoneRole(String p_sRole)
+ { return (Telephone)BaseBusinessObject.getRoleFromList(p_sRole,m_olPhones);
+ }//_____________________________________________
+
// e-mail List handling
public int getEmailCount ()
Modified: labs/jbossesb/trunk/ESBCore/common/src/org/jboss/soa/esb/helpers/KeyValuePair.java
===================================================================
--- labs/jbossesb/trunk/ESBCore/common/src/org/jboss/soa/esb/helpers/KeyValuePair.java 2006-07-16 00:25:35 UTC (rev 5117)
+++ labs/jbossesb/trunk/ESBCore/common/src/org/jboss/soa/esb/helpers/KeyValuePair.java 2006-07-16 20:25:04 UTC (rev 5118)
@@ -39,4 +39,7 @@
{String sRet = mVal; mVal = arg0.toString(); return sRet; }
public String toString()
{ return mVal; }
+ public String dump()
+ { return "KVpair["+mKey+"="+mVal+"]"; }
+
} //____________________________________________________________________________
Deleted: labs/jbossesb/trunk/ESBCore/common/src/org/jboss/soa/esb/helpers/persist/AbstractBobjStore.java
===================================================================
--- labs/jbossesb/trunk/ESBCore/common/src/org/jboss/soa/esb/helpers/persist/AbstractBobjStore.java 2006-07-16 00:25:35 UTC (rev 5117)
+++ labs/jbossesb/trunk/ESBCore/common/src/org/jboss/soa/esb/helpers/persist/AbstractBobjStore.java 2006-07-16 20:25:04 UTC (rev 5118)
@@ -1,197 +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.helpers.persist;
-
-import org.jboss.soa.esb.util.BaseBusinessObject;
-
-public abstract class AbstractBobjStore
-{
- public static AbstractBobjStore getInstance()
- { throw new UnsupportedOperationException(
- "getInstance() must be implemented in the derived class");
- } //__________________________________
-
- /**
- * Array of BobjStore objects.
- * @return AbstractBobjStore[]
- */
- public abstract AbstractBobjStore[] getBobjStoreTable();
-
- /**
- * String names for BobjStoreTable.
- * @return String[]
- */
- public abstract String[] getBobjStoreIndex();
-
- protected String m_sSnapType , m_sSnapTbl , m_sLocTbl, m_sClass;
- protected boolean m_bEncrypt=false;
-
- /**
- * Snapshot type getter - The value assigned to this attribute will help if
- * standard SQL queries are required to surf the Object Store's snapshot tables
- * @return String - Value of snapshot type
- * @see ItfStorable#getSnapType()
- */
- public String getSnapType() { return m_sSnapType; }
- /**
- * Snapshot tablename getter - The value assigned to this attribute is the
- * name of the snapshot table for this object
- * @return String - name of SQL table where snapshots of objects will be stored
- * @see ItfStorable#getSnapTable()
- */
- public String getSnapTable() { return m_sSnapTbl; }
- /**
- * Locator tablename getter - Locator table are also called index tables.
- * The value assigned to this attribute is the name of the locator table for
- * this object
- * @return String - name of SQL table where locators for objects will be stored
- * @see ItfStorable#getLocatorTable()
- * @see BusinessObject#getObjLocator()
- */
- public String getLocatorTable() { return m_sLocTbl; }
- /**
- * Encryption requirement getter
- * @return boolean - true if Objects stored using this descriptor have to be
- * encrypted - decrypted at storage/retrieval time
- */
- public boolean isEncrypted() { return m_bEncrypt; }
- /**
- * Static helper method to obtain the snapshot type by index mnemonic
- * @param p_i int - Index of descriptor in static descriptor table
- * @return String
- * @see BobjStore#getSnapType()
- * @see BobjStore#getIndex(Class)
- */
- public String getSnapType(int p_i) { return getBobjStoreTable()[p_i].m_sSnapType; }
- /**
- * Static helper method to obtain the snapshot SQL tablename by index mnemonic
- * @param p_i int - Index of descriptor in static descriptor table
- * @return String
- * @see BobjStore#getSnapTable()
- * @see BobjStore#getIndex(Class)
- */
- public String getSnapTable(int p_i) { return getBobjStoreTable()[p_i].m_sSnapTbl; }
- /**
- * Static helper method to obtain the locator SQL tablename by index mnemonic
- * @param p_i int - Index of descriptor in static descriptor table
- * @return String
- * @see BobjStore#getLocatorTable()
- * @see BobjStore#getIndex(Class)
- */
- public String getLocatorTable(int p_i){ return getBobjStoreTable()[p_i].m_sLocTbl; }
-
- /**
- *
- */
- protected AbstractBobjStore() {}
-
- /**
- * Constructor using all fields required by a BobjStore object
- * @param p_sSnapType String - Snapshot type
- * @param p_sSnapTbl String - Snapshot SQL tablename
- * @param p_sLocTbl String - Locator SQL tablename (may be null - No locator table)
- * @param p_sCls String - Class name excluding package prefix
- * @param p_bCrypt boolean - Does data have to be encrypted in the snap table ?
- * @see ItfStorable
- * @see BusinessObject#classNm()
- */
- protected AbstractBobjStore (String p_sSnapType,String p_sSnapTbl, String p_sLocTbl
- ,String p_sCls, boolean p_bCrypt)
- { m_sSnapType = p_sSnapType;
- m_sSnapTbl = p_sSnapTbl;
- m_sLocTbl = p_sLocTbl;
- m_sClass = p_sCls;
- m_bEncrypt = p_bCrypt;
- } //________________________________
-
- /**
- * Constructor for non encrypted BobjStore
- * @param p_sSnapType String
- * @param p_sSnapTbl String
- * @param p_sLocTbl String
- * @param p_sCls String
- * @see BobjStore#BobjStore(String,String,String,String,boolean)
- */
- protected AbstractBobjStore (String p_sSnapType,String p_sSnapTbl, String p_sLocTbl
- ,String p_sCls)
- { this(p_sSnapType,p_sSnapTbl,p_sLocTbl,p_sCls,false);
- } //________________________________
-
- /**
- * Index in static descriptor table for objects of class <arg 1>
- * @param p_oCls Class - BusinessObject class to search for in descriptor table
- * @throws Exception
- * @return int - index in static descriptor table
- */
- public int getIndex (Class p_oCls) throws Exception
- { String sClassName = p_oCls.getName()
- .substring(1+p_oCls.getName().lastIndexOf("."));
- for (int i1 = 0; i1 < getBobjStoreTable().length; i1++)
- if (getBobjStoreIndex()[i1].equals(sClassName)) return i1;
- throw new Exception("No BobjStore for class "+p_oCls.getName());
- } //__________________________________
- /**
- * Get a BobjStore object that describes persistence details for objects of
- * class <arg 1>
- * @param p_sClassName String Classname to search for in descriptor table
- * @return BobjStore - A descriptor that will provide persistence info
- * @see PersistHandler
- * @see BobjStore#getStore(BusinessObject)
- */
- public AbstractBobjStore getStore (String p_sClassName)
- { if (null == p_sClassName) return null;
- for (int i1 = 0; i1 < getBobjStoreTable().length; i1++)
- { String sTblCls = getBobjStoreIndex()[i1];
- if (p_sClassName.equals(sTblCls)) return getStore(i1);
- }
- return null;
- } //__________________________________
-
- /**
- * Get a BobjStore object that describes persistence details for the
- * object specified in arg 1
- * @param p_o BusinessObject The object whose storage descriptor is requested
- * @return BobjStore - A descriptor that will provide persistence info
- * @see PersistHandler
- * @see BobjStore#getStore(String)
- */
- public AbstractBobjStore getStore (BaseBusinessObject p_o)
- { return (null != p_o) ? getStore(p_o.classNm()) : null;
- } //__________________________________
-
- /**
- * Get a BobjStore object by mnemonic name (index in the static descriptor table)
- * @param p_i int - typically a mnemonic name will be used (see CQ3 constants)
- * @return BobjStore - A descriptor that will provide persistence info
- * @see PersistHandler
- * @see BobjStore#getStore(String)
- */
- public AbstractBobjStore getStore (int p_i)
- {
- AbstractBobjStore oRet = getBobjStoreTable()[p_i];
-
- try { return (AbstractBobjStore)oRet.clone(); }
- catch (Exception e) {return oRet;}
- } //________________________________
-
-} //____________________________________________________________________________
Deleted: labs/jbossesb/trunk/ESBCore/common/src/org/jboss/soa/esb/helpers/persist/ItfStorable.java
===================================================================
--- labs/jbossesb/trunk/ESBCore/common/src/org/jboss/soa/esb/helpers/persist/ItfStorable.java 2006-07-16 00:25:35 UTC (rev 5117)
+++ labs/jbossesb/trunk/ESBCore/common/src/org/jboss/soa/esb/helpers/persist/ItfStorable.java 2006-07-16 20:25:04 UTC (rev 5118)
@@ -1,37 +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.helpers.persist;
-
-/**
- * Provides methods to learn about how and where a BusinessObject will be stored
- * and retrieved from a BobjStore
- * @see BobjStore
- */
-
-public interface ItfStorable
-{
- public String getSnapType();
- public String getSnapTable();
- public String getLocatorTable();
- public boolean isEncrypted();
-} // ___________________________________________________________________________
Modified: labs/jbossesb/trunk/ESBCore/common/src/org/jboss/soa/esb/helpers/persist/JdbcCleanConn.java
===================================================================
--- labs/jbossesb/trunk/ESBCore/common/src/org/jboss/soa/esb/helpers/persist/JdbcCleanConn.java 2006-07-16 00:25:35 UTC (rev 5117)
+++ labs/jbossesb/trunk/ESBCore/common/src/org/jboss/soa/esb/helpers/persist/JdbcCleanConn.java 2006-07-16 20:25:04 UTC (rev 5118)
@@ -37,7 +37,9 @@
protected Logger m_oLogger;
public JdbcCleanConn(DataSource p_oDS) throws Exception
- { m_oDS = p_oDS; }
+ { m_oDS = p_oDS;
+ m_oLogger = Logger.getLogger(this.getClass());
+ }
public void commit () throws Exception { if (null != m_conn)m_conn.commit(); }
public void rollback () throws Exception { if (null != m_conn)m_conn.rollback(); }
Modified: labs/jbossesb/trunk/ESBCore/common/src/org/jboss/soa/esb/parameters/DefaultReposFactory.java
===================================================================
--- labs/jbossesb/trunk/ESBCore/common/src/org/jboss/soa/esb/parameters/DefaultReposFactory.java 2006-07-16 00:25:35 UTC (rev 5117)
+++ labs/jbossesb/trunk/ESBCore/common/src/org/jboss/soa/esb/parameters/DefaultReposFactory.java 2006-07-16 20:25:04 UTC (rev 5118)
@@ -22,6 +22,10 @@
package org.jboss.soa.esb.parameters;
import java.io.*;
+import java.util.Properties;
+
+import javax.naming.CompoundName;
+import javax.naming.InvalidNameException;
import javax.naming.Name;
import org.jboss.soa.esb.helpers.DomElement;
@@ -116,5 +120,15 @@
oF.delete();
} //____________________________
+ private static final Properties s_oSyntax = new Properties();
+ static
+ { s_oSyntax.setProperty("jndi.syntax.direction","left_to_right");
+ s_oSyntax.setProperty("jndi.syntax.separator","/");
+ };
+
+ public Name nameFromString(String p_s)
+ throws InvalidNameException
+ { return new CompoundName(p_s,s_oSyntax);
+ } //________________________________
} //____________________________________________________
} //____________________________________________________________________________
Modified: labs/jbossesb/trunk/ESBCore/common/src/org/jboss/soa/esb/parameters/ParamsReposUtil.java
===================================================================
--- labs/jbossesb/trunk/ESBCore/common/src/org/jboss/soa/esb/parameters/ParamsReposUtil.java 2006-07-16 00:25:35 UTC (rev 5117)
+++ labs/jbossesb/trunk/ESBCore/common/src/org/jboss/soa/esb/parameters/ParamsReposUtil.java 2006-07-16 20:25:04 UTC (rev 5118)
@@ -24,8 +24,6 @@
package org.jboss.soa.esb.parameters;
import java.lang.reflect.*;
-import java.util.Properties;
-import javax.naming.*;
import org.jboss.soa.esb.common.EsbSysProps;
@@ -54,14 +52,4 @@
return reposFromFactory(sFactClass,p_oFactoryParam);
} //________________________________
- private static final Properties s_oSyntax = new Properties();
- static
- { s_oSyntax.setProperty("jndi.syntax.direction","left_to_right");
- s_oSyntax.setProperty("jndi.syntax.separator","/");
- };
-
- public static Name nameFromString(String p_s)
- throws InvalidNameException
- { return new CompoundName(p_s,s_oSyntax);
- } //________________________________
} //____________________________________________________________________________
Modified: labs/jbossesb/trunk/ESBCore/common/src/org/jboss/soa/esb/parameters/ParamsRepository.java
===================================================================
--- labs/jbossesb/trunk/ESBCore/common/src/org/jboss/soa/esb/parameters/ParamsRepository.java 2006-07-16 00:25:35 UTC (rev 5117)
+++ labs/jbossesb/trunk/ESBCore/common/src/org/jboss/soa/esb/parameters/ParamsRepository.java 2006-07-16 20:25:04 UTC (rev 5118)
@@ -28,6 +28,7 @@
public interface ParamsRepository
{
+ public Name nameFromString (String p_s) throws Exception;
public DomElement storeElement
(Name pName, DomElement p_oNew) throws Exception;
public DomElement getElement (Name pName) throws Exception;
Copied: labs/jbossesb/trunk/ESBCore/common/src/org/jboss/soa/esb/services/DefaultEncryptionFactory.java (from rev 5096, labs/jbossesb/trunk/ESBCore/common/src/org/jboss/soa/esb/services/DefaultEncryptionFactory.java)
Copied: labs/jbossesb/trunk/ESBCore/common/src/org/jboss/soa/esb/services/Iencryption.java (from rev 5096, labs/jbossesb/trunk/ESBCore/common/src/org/jboss/soa/esb/services/Iencryption.java)
Modified: labs/jbossesb/trunk/ESBCore/common/src/org/jboss/soa/esb/util/BaseBusinessObject.java
===================================================================
--- labs/jbossesb/trunk/ESBCore/common/src/org/jboss/soa/esb/util/BaseBusinessObject.java 2006-07-16 00:25:35 UTC (rev 5117)
+++ labs/jbossesb/trunk/ESBCore/common/src/org/jboss/soa/esb/util/BaseBusinessObject.java 2006-07-16 20:25:04 UTC (rev 5118)
@@ -25,12 +25,10 @@
import java.util.*;
import java.lang.reflect.*;
-import org.jboss.soa.esb.helpers.persist.ItfStorable;
-
public class BaseBusinessObject
{
public BobjStdDTO toDTO() throws Exception { return getBaseDTO(); }
- public String classNm() { return EsbUtil.classSuffix(this.getClass()); }
+ public String classNm() { return this.getClass().getSimpleName(); }
public boolean isNull () { return false; }
public String toString ()
{ try { return this.toDTO().toXml(); }
@@ -41,6 +39,12 @@
public String [] locator(int p_i)
{ return (0==p_i) ? locator() : new String [] {};
}
+ /**
+ * Get all locators for a given BaseBusinessObject
+ * <p /> Override this method in your class if you have more than 1 locator array
+ * @return An array of String arrays containing all locators
+ */
+ public String[][] allLocators() { return new String[][] {locator()}; }
public final ObjLocator getObjLocator() { return getObjLocator(0); }
public final ObjLocator getObjLocator(int p_i)
@@ -50,7 +54,7 @@
{elem
,rol
};
- private enum HIDDEN
+ enum HIDDEN
{uid
,stamp
,type
@@ -109,7 +113,7 @@
{ setField(ATTRIB.elem,p_sElem);
m_lUid = p_lUid;
if (null != getElemNm()) return;
- String sClass = EsbUtil.classSuffix(getClass());
+ String sClass = getClass().getSimpleName();
if (null == p_sElem)
setField(ATTRIB.elem,sClass);
} //________________________________
@@ -151,12 +155,7 @@
throws Exception
{ if (null == p_oDto) return null;
- String sPkg = p_oDto.getAttr(BobjStdDTO.BOBJ_PACKAGE);
- String sConstrPkg = (null==sPkg)?""
- : (sPkg.endsWith(".")) ? sPkg
- : sPkg+".";
- String sClass = sConstrPkg+p_oDto.classNm();
- Class oClass = Class.forName(sClass);
+ Class oClass = Class.forName(p_oDto.fullClassName());
Constructor CC=oClass.getConstructor (new Class[]{BobjStdDTO.class});
BaseBusinessObject oRet = (BaseBusinessObject)CC.newInstance(new Object []{p_oDto});
@@ -165,7 +164,7 @@
} //________________________________
protected BobjStdDTO getBaseDTO()
- { String sClass = EsbUtil.classSuffix(getClass());
+ { String sClass = getClass().getSimpleName();
BobjStdDTO oRet = new BobjStdDTO(sClass,getElemNm(),null);
if (hasUid())
try { oRet.addAttr(HIDDEN.uid.toString(),Long.toString(m_lUid)); }
@@ -177,8 +176,8 @@
protected void putStdAtts(BobjStdDTO p_oRet)
{ try
{ p_oRet.addAttr(ATTRIB.rol.toString(),getRole());
- if (this instanceof ItfStorable)
- p_oRet.addAttr(HIDDEN.type.toString(),((ItfStorable)this).getSnapType());
+// if (this instanceof XtfStorable)
+// p_oRet.addAttr(HIDDEN.type.toString(),((XtfStorable)this).getSnapType());
if (m_lStamp > 0) p_oRet.addAttr(HIDDEN.stamp.toString()
,Long.toString(m_lStamp));
if (m_lLastSnap > 0) p_oRet.addAttr(HIDDEN.snap.toString()
@@ -200,7 +199,7 @@
List<BobjStdDTO> LL = new ArrayList<BobjStdDTO>();
for (BaseBusinessObject oCurr : p_oList)
LL.add( oCurr.toDTO());
- String sElem = EsbUtil.classSuffix(p_Class);
+ String sElem = p_Class.getSimpleName();
return (LL.size()<1) ? null : new BobjStdDTO(sElem,null,LL);
} //__________________________________
Modified: labs/jbossesb/trunk/ESBCore/common/src/org/jboss/soa/esb/util/BobjStdDTO.java
===================================================================
--- labs/jbossesb/trunk/ESBCore/common/src/org/jboss/soa/esb/util/BobjStdDTO.java 2006-07-16 00:25:35 UTC (rev 5117)
+++ labs/jbossesb/trunk/ESBCore/common/src/org/jboss/soa/esb/util/BobjStdDTO.java 2006-07-16 20:25:04 UTC (rev 5118)
@@ -49,6 +49,9 @@
protected String m_sElemNm;
protected Map<String,Object> m_oAtts;
protected List<BobjStdDTO> m_oChild;
+ protected String[][] m_saaLocators;
+ public void setLocators(String[][] p_saa) { m_saaLocators = p_saa; }
+ public String[][] getLocators() { return m_saaLocators; }
//Getters
public String classNm() { return m_sClassNm; }
@@ -126,7 +129,54 @@
,new BobjStdDTO(((Element)oCurr)));
}
} //__________________________________
+
+ private void setLongAttr(String p_s,long pL)
+ { try { addAttr(p_s,Long.toString(pL)); }
+ catch (Exception e) { e.printStackTrace(); }
+ } //__________________________________
+ private void setStringAttr(String p_s,String pVal)
+ { try { addAttr(p_s,pVal); }
+ catch (Exception e) { e.printStackTrace(); }
+ } //__________________________________
+
+ private long attrAsLong(String p_s)
+ { try
+ { String sVal = getAttr(p_s);
+ if (! EsbUtil.isNullString(sVal))
+ return Long.parseLong(sVal);
+ }
+ catch (Exception e) {/* OK just fall through and return default*/ }
+ return 0;
+ } //__________________________________
+ private String attrAsString(String p_s)
+ { try { return getAttr(p_s); }
+ catch (Exception e) {/* OK just fall through and return default*/ }
+ return null;
+ } //__________________________________
+
+ public long getStamp(){ return attrAsLong(BaseBusinessObject.HIDDEN.stamp.toString()); }
+ public long getUid() { return attrAsLong(BaseBusinessObject.HIDDEN.uid.toString()); }
+ public long getSnap() { return attrAsLong(BaseBusinessObject.HIDDEN.snap.toString()); }
+ public long getBatch(){ return attrAsLong(BaseBusinessObject.HIDDEN.batch.toString()); }
+ public String getSnapType(){ return attrAsString(BaseBusinessObject.HIDDEN.type.toString()); }
+ public String getSnapDate(){ return attrAsString(BaseBusinessObject.HIDDEN.dtSnap.toString()); }
+
+ public void setStamp (long pL) { setLongAttr(BaseBusinessObject.HIDDEN.stamp.toString(),pL); }
+ public void setUid (long pL) { setLongAttr(BaseBusinessObject.HIDDEN.uid.toString(),pL); }
+ public void setSnap (long pL) { setLongAttr(BaseBusinessObject.HIDDEN.snap.toString(),pL); }
+ public void setBatch (long pL) { setLongAttr(BaseBusinessObject.HIDDEN.batch.toString(),pL); }
+ public void setSnapType(String pS){ setStringAttr(BaseBusinessObject.HIDDEN.type.toString(),pS); }
+ public void setSnapDate(String pS){ setStringAttr(BaseBusinessObject.HIDDEN.dtSnap.toString(),pS); }
+
+ public String fullClassName()
+ { String sPkg = "";
+ try { sPkg = getAttr(BobjStdDTO.BOBJ_PACKAGE); }
+ catch (Exception e) {/* just leave it empty */ }
+ String sConstrPkg = (sPkg.endsWith(".")) ? sPkg : sPkg+".";
+ return sConstrPkg+classNm();
+ } //__________________________________
+
public List<? extends BaseBusinessObject> getChildObjList(String p_sElem, Class pCls) throws Exception
{ BobjStdDTO oChDto = this.getDTO(p_sElem);
if (null == oChDto) return null;
@@ -355,4 +405,5 @@
((BobjStdDTO)oCurr.getValue()).Dump(1+p_iLev);
}
} //__________________________________
+
} //____________________________________________________________________________
Modified: labs/jbossesb/trunk/ESBCore/common/src/org/jboss/soa/esb/util/EsbUtil.java
===================================================================
--- labs/jbossesb/trunk/ESBCore/common/src/org/jboss/soa/esb/util/EsbUtil.java 2006-07-16 00:25:35 UTC (rev 5117)
+++ labs/jbossesb/trunk/ESBCore/common/src/org/jboss/soa/esb/util/EsbUtil.java 2006-07-16 20:25:04 UTC (rev 5118)
@@ -104,8 +104,7 @@
} //__________________________________
public static String classSuffix(Class pCls)
- { int iPos = 1+pCls.getPackage().getName().length();
- return pCls.getName().substring(iPos);
+ { return pCls.getSimpleName();
} //__________________________________
public static Logger getDefaultLogger(Class p_oCls)
Modified: labs/jbossesb/trunk/ESBCore/listeners/build.xml
===================================================================
--- labs/jbossesb/trunk/ESBCore/listeners/build.xml 2006-07-16 00:25:35 UTC (rev 5117)
+++ labs/jbossesb/trunk/ESBCore/listeners/build.xml 2006-07-16 20:25:04 UTC (rev 5118)
@@ -40,18 +40,7 @@
<delete dir="${org.jboss.esb.listeners.bin.dir}"/>
</target>
-
-
- <target name="org.jboss.esb.listeners.compile">
- <!-- Compile listeners -->
- <antcall target="org.jboss.esb.listeners.internal.compile"/>
- <!-- Compile listener tests -->
- <ant inheritAll="true" dir="tests" target="org.jboss.esb.listeners.tests.compile"/>
- </target>
-
-
-
- <target name="org.jboss.esb.listeners.internal.compile" depends="org.jboss.esb.listeners.prepare"
+ <target name="org.jboss.esb.listeners.compile" depends="org.jboss.esb.listeners.prepare"
description="Compile all classes">
<javac
@@ -77,14 +66,6 @@
/>
</target>
+ <target name="all" depends="recompile,jar" />
-
- <target name="org.jboss.esb.listeners.test" description="Run tests for this module">
- <!-- Compile listener tests -->
- <ant dir="tests" target="org.jboss.esb.listeners.internal.test"/>
- </target>
-
-
- <target name="all" depends="recompile,jar" />
-
</project>
Modified: labs/jbossesb/trunk/ESBCore/listeners/src/org/jboss/soa/esb/listeners/AbstractPoller.java
===================================================================
--- labs/jbossesb/trunk/ESBCore/listeners/src/org/jboss/soa/esb/listeners/AbstractPoller.java 2006-07-16 00:25:35 UTC (rev 5117)
+++ labs/jbossesb/trunk/ESBCore/listeners/src/org/jboss/soa/esb/listeners/AbstractPoller.java 2006-07-16 20:25:04 UTC (rev 5118)
@@ -51,8 +51,8 @@
public static final String PARM_ACTION_CLASS = "actionClass";
- public static final String PARM_POLL_LTCY = "pollLatency";
- public static final String PARM_RELOAD_LTCY = "reloadLatency";
+ public static final String PARM_POLL_LTCY = "pollLatencySecs";
+ 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";
@@ -82,7 +82,7 @@
String sFactoryClass = EsbSysProps.getParamsReposFactoryClass();
m_oParmRepos = ParamsReposUtil.reposFromFactory(sFactoryClass,null);
- m_oParmsName = ParamsReposUtil.nameFromString(p_sParamsUid);
+ m_oParmsName = m_oParmRepos.nameFromString(p_sParamsUid);
} //__________________________________
protected void runUntilEndRequested() throws Exception
@@ -149,7 +149,7 @@
protected String formatLogMsg(String p_s)
{ return new StringBuilder("Processor '")
- .append(EsbUtil.classSuffix(this.getClass())).append("' <")
+ .append(getClass().getSimpleName()).append("' <")
.append(p_s).append(">")
.toString();
} //__________________________________
@@ -184,7 +184,7 @@
String sSelector = m_oParms.getAttr(PARM_QUIESCE_SELECTOR);
if (EsbUtil.isNullString(sSelector))
- sSelector = "processor='"+EsbUtil.classSuffix(this.getClass())+"'";
+ sSelector = "processor='"+getClass().getSimpleName()+"'";
m_oTopicSubs = m_oSession.createSubscriber(m_oTopic, sSelector,true);
}
catch (Exception e)
@@ -201,7 +201,7 @@
if (null!=oMsg)
{ m_oLogger.info("Starting Quiesce of "
- +EsbUtil.classSuffix(this.getClass()));
+ +getClass().getSimpleName());
return true;
}
if (bSleep)
Modified: labs/jbossesb/trunk/ESBCore/listeners/src/org/jboss/soa/esb/listeners/OldDirListener.java
===================================================================
--- labs/jbossesb/trunk/ESBCore/listeners/src/org/jboss/soa/esb/listeners/OldDirListener.java 2006-07-16 00:25:35 UTC (rev 5117)
+++ labs/jbossesb/trunk/ESBCore/listeners/src/org/jboss/soa/esb/listeners/OldDirListener.java 2006-07-16 20:25:04 UTC (rev 5118)
@@ -99,7 +99,7 @@
String sFactoryClass = EsbSysProps.getParamsReposFactoryClass();
m_oParmRepos = ParamsReposUtil.reposFromFactory(sFactoryClass,null);
- Name oParms = ParamsReposUtil.nameFromString(p_sParamsUid);
+ Name oParms = m_oParmRepos.nameFromString(p_sParamsUid);
while (loadParmsCycle(oParms))
{
}
Modified: labs/jbossesb/trunk/ESBCore/listeners/src/org/jboss/soa/esb/listeners/SqlTablePoller.java
===================================================================
--- labs/jbossesb/trunk/ESBCore/listeners/src/org/jboss/soa/esb/listeners/SqlTablePoller.java 2006-07-16 00:25:35 UTC (rev 5117)
+++ labs/jbossesb/trunk/ESBCore/listeners/src/org/jboss/soa/esb/listeners/SqlTablePoller.java 2006-07-16 20:25:04 UTC (rev 5118)
@@ -24,19 +24,102 @@
package org.jboss.soa.esb.listeners;
import java.util.*;
+import java.io.ByteArrayOutputStream;
+import java.io.PrintStream;
import java.lang.reflect.*;
import java.sql.*;
import javax.sql.*;
+import org.jboss.soa.esb.services.InotificationHandler;
+import org.jboss.soa.esb.services.NotificationHandlerFactory;
import org.jboss.soa.esb.util.*;
+import org.jboss.soa.esb.common.EsbSysProps;
import org.jboss.soa.esb.helpers.*;
import org.jboss.soa.esb.helpers.persist.*;
+import org.jboss.soa.esb.notification.NotificationList;
import org.jboss.soa.esb.processors.*;
-
+/**
+ * SqlTablePoller class
+ *
+ * the "main(args)" static method of this class will:
+ * 1) load the parameters from the Name supplied in args[0] into a DomElement
+ * (See org.jboss.soa.esb.parameters package for options on parameter repositories)
+ * 2) for each child element (1st level) of the DomElement, it will try to initiate
+ * a Thread group that can start a maximum of simultaneous child threads
+ * "maxThreads" supplied in parameters - default=1
+ * 3) each thread group will poll a SQL table with parameters defined in the corresponding
+ * DomElement (example below has only 1 child element, but you can have several)
+ * 4) Execution will orderly finish when a message is received in the "quiesceTopic"
+ * with an optional "quiesceSelector" (please see AbstractPoller class constants)
+ *
+ * The SQL table(s) that is (are) polled should have
+ * 1) a unique key (see "keyFields" parameter) that will be used to update status
+ * 2) a column to indicate the "processing status" of this trigger row (see ROW_STATE enum)
+ * this column will be updated by the SqlChildProcess.run() method (see internal
+ * protected class SqlChildProcess)
+ *
+ * Each retrieved row (see OPTIONAL_ATT.whereCondition) should be considered as a trigger
+ * that is intended to instantiate an object of "actionClass". The new instance will
+ * receive the full DomElement (level 1 for each child group), with an added child
+ * DomElement (see EsbAbstractProcessor.PARMS_THIS_INSTANCE) containing attributes
+ * corresponding to the values of the "selectFields" columns in the row that triggered
+ * the "actionClass"
+ *
+ * The ZZDummyProcessor (in this package) is a trivial actionClass included with the
+ * sole purpose of illustrating what the actionClass will receive, and the entry points
+ * where users can insert their logic
+ *
+ * GOOD LUCK !!
+ *
+ * @author Esteban Schifman
+ */
public class SqlTablePoller extends AbstractPoller
{
+/* ___________________ Example XML configuration file for a SqlTablePoller_______________
+ *
+<DocumentElementName>
+ <ExampleListenChapter
+ pollLatencySecs="20"
+ parmsReloadSecs="300"
+
+ maxThreads="2"
+
+ actionClass="org.jboss.soa.esb.listeners.ZZDummyProcessor"
+
+ driver-class="org.postgresql.Driver"
+ connection-url="jdbc:postgresql://myhost:5432/myDB"
+ user-name="postgres"
+ password=""
+
+ tableName="test_notif_table"
+ selectFields="oid,ref,msg"
+ keyFields="oid,ref"
+ inProcessField="statusCol"
+ whereCondition="src='pepe'"
+ orderBy="oid desc"
+ >
+ <NotificationList type="OK">
+ <target class="NotifyFiles">
+ <file URI="file:///tmp/jbossEsb/notifyDir/ListenOnNotifTable.notifOK"
+ append="true"
+ />
+ </target>
+ </NotificationList>
+
+ <NotificationList type="err">
+ <target class="NotifyFiles">
+ <file URI="file:///tmp/jbossEsb/notifyDir/ListenOnNotifTable.notifErr"
+ append="true"
+ />
+ </target>
+ </NotificationList>
+ </ExampleListenChapter>
+</DocumentElementName>
+ *
+ */
+
/**
- * These are the mandatory attributes needed for any SqlTablePoller
+ * Mandatory attributes needed for SqlTablePoller
* 1) Table name
* 2) Comma separated list of fields needed in the ResultSet
* 3) Comma separated list of fields that constitute a unique ID of the working row
@@ -112,18 +195,31 @@
runUntilEndRequested();
} //__________________________________
+ /**
+ * Override this method if you wish to extend the SqlChildProcess class
+ * (for example with ad-hoc notifications for OK list or Error list)
+ * @param p_oParms = DomElement containing attributes of trigger
+ * @return the SqlChildProcess to be started
+ * @throws Exception
+ */
+ protected SqlChildProcess getSqlChildProcess
+ (SqlPollerChildGroup pDad, DomElement p_oParms) throws Exception
+ {
+ return new SqlChildProcess(pDad, p_oParms);
+ } //________________________________
+
@Override
protected GroupOfChilds newChildGroup(ThreadGroup pThG) throws Exception
{
return new SqlPollerChildGroup(pThG);
} //__________________________________
- private class SqlPollerChildGroup extends AbstractPoller.GroupOfChilds
+ protected class SqlPollerChildGroup extends AbstractPoller.GroupOfChilds
{
JdbcCleanConn m_oConn;
String[] m_saKeys;
- private SqlPollerChildGroup(ThreadGroup p_oThrGrp) throws Exception
+ protected SqlPollerChildGroup(ThreadGroup p_oThrGrp) throws Exception
{ super(p_oThrGrp);
} //________________________________
@@ -178,7 +274,7 @@
}
} //________________________________
-
+
@Override
protected void doYourJob(DomElement p_oP) throws Exception
{
@@ -191,11 +287,11 @@
break;
}
- new Thread(m_oThrGrp,
- new SqlChildProcess(this, oCurr)).start();
+ SqlChildProcess oNew = getSqlChildProcess(this,oCurr);
+ 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 should be explored
+ // new thread control classes in Java 5 might have solved the problem
Thread.sleep(500);
}
@@ -352,6 +448,7 @@
m_oParent = p_oGrp;
this.addObserver(m_oParent);
setChanged();
+ // add 1 to child thread count
notifyObservers(new Integer(1));
m_oInstP = p_oP;
@@ -360,7 +457,8 @@
} //__________________________________
public void run()
- {
+ {
+ Exception oAbend = null;
try
{ m_PSsel4U = m_oConn.prepareStatement(m_oParent.selectForUpdStatement());
m_PSupd = m_oConn.prepareStatement(m_oParent.updateStatement());
@@ -373,14 +471,21 @@
// autoincrement leaves things ready for next SQL parameter
m_PSupd.setString (++iParm,sVal);
}
+ // will only continue if it can change status to "Working"
if (! changeStatus(ROW_STATE.Pending,ROW_STATE.Working))
- return;
+ oAbend = new Exception("Unable to change status to Working");
}
catch (Exception e)
{ m_oLogger.error("Problems with update statements",e);
- return;
+ if (null!=m_oConn)
+ { try { m_oConn.rollback(); }
+ catch (Exception eR) { /* OK do nothing */}
+ m_oConn.release();
+ }
+ oAbend = e;
}
+ if (null==oAbend)
try
{
Constructor oCnst = m_oParent.m_oExecClass
@@ -389,17 +494,30 @@
oParms.addElemChild(m_oInstP);
Object oInst = oCnst.newInstance (new Object[] {oParms});
((EsbAbstractProcessor)oInst).execute();
+ changeStatus(ROW_STATE.Working,ROW_STATE.Done);
}
catch (Exception e)
- { m_oLogger.error("run() FAILED",e);
+ { m_oLogger.error("run() FAILED",e);
+ try
+ { m_oConn.rollback();
+ changeStatus(null,ROW_STATE.Error);
+ }
+ catch (Exception CS) { /* What could we do here ? */}
+ oAbend = e;
}
finally
{ if (null!=m_oConn)
m_oConn.release();
}
-
+
+ if (null==oAbend)
+ notifyOK();
+ else
+ notifyError(oAbend);
+
setChanged();
+ // decrease child thread count in parent group
notifyObservers(new Integer(-1));
} //______________________________
@@ -420,7 +538,64 @@
return true;
} //______________________________
-
+
+ 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";
+ }
+
} //______________________________________________________
} //____________________________________________________________________________
Copied: labs/jbossesb/trunk/ESBCore/listeners/src/org/jboss/soa/esb/listeners/ZZderivedSqlTablePoller.java (from rev 5096, labs/jbossesb/trunk/ESBCore/listeners/src/org/jboss/soa/esb/listeners/ZZderivedSqlTablePoller.java)
Modified: labs/jbossesb/trunk/ESBCore/processors/build.xml
===================================================================
--- labs/jbossesb/trunk/ESBCore/processors/build.xml 2006-07-16 00:25:35 UTC (rev 5117)
+++ labs/jbossesb/trunk/ESBCore/processors/build.xml 2006-07-16 20:25:04 UTC (rev 5118)
@@ -40,16 +40,7 @@
<delete dir="${org.jboss.esb.processors.bin.dir}"/>
</target>
-
- <target name="org.jboss.esb.processors.compile">
- <!-- Compile processors -->
- <antcall target="org.jboss.esb.processors.internal.compile"/>
- <!-- Compile processors tests -->
- <ant inheritAll="true" dir="tests" target="org.jboss.esb.processors.tests.compile"/>
- </target>
-
-
- <target name="org.jboss.esb.processors.internal.compile" depends="org.jboss.esb.processors.prepare"
+ <target name="org.jboss.esb.processors.compile" depends="org.jboss.esb.processors.prepare"
description="Compile all classes">
<javac
@@ -75,14 +66,6 @@
/>
</target>
+ <target name="all" depends="recompile,jar" />
- <target name="org.jboss.esb.processors.test" description="Run tests for this module">
- <!-- Compile processors tests -->
- <ant dir="tests" target="org.jboss.esb.processors.internal.test"/>
- </target>
-
-
-
- <target name="all" depends="recompile,jar" />
-
</project>
Modified: labs/jbossesb/trunk/ESBCore/services/build.xml
===================================================================
--- labs/jbossesb/trunk/ESBCore/services/build.xml 2006-07-16 00:25:35 UTC (rev 5117)
+++ labs/jbossesb/trunk/ESBCore/services/build.xml 2006-07-16 20:25:04 UTC (rev 5118)
@@ -59,16 +59,7 @@
<!-- Compiles all the classes -->
<!-- =================================================================== -->
-
- <target name="org.jboss.esb.services.compile">
- <!-- Compile services -->
- <antcall target="org.jboss.esb.services.internal.compile"/>
- <!-- Compile services tests -->
- <ant inheritAll="true" dir="tests" target="org.jboss.esb.services.tests.compile"/>
- </target>
-
-
- <target name="org.jboss.esb.services.internal.compile" depends="org.jboss.esb.services.prepare"
+ <target name="org.jboss.esb.services.compile" depends="org.jboss.esb.services.prepare"
description="Compile all classes">
<javac
@@ -189,7 +180,7 @@
/>
<jar destfile="${org.jboss.esb.internal.dest}/dist/jbossesb-services.jar"
basedir="${org.jboss.esb.internal.dest}/classes"
- includes="**/EJBs/*.class,**/dbtables/*.class,**/crypto/*.class"
+ includes="**/EJBs/*.class"
manifest="${org.jboss.esb.services.metainf.dir}/manifest.server"
>
<metainf dir="${org.jboss.esb.services.metainf.dir}" includes="*.xml"
@@ -212,16 +203,4 @@
</target>
-
- <!-- =================================================================== -->
- <!-- Test -->
- <!-- =================================================================== -->
- <target name="org.jboss.esb.services.test" description="Run tests for this module">
- <!-- Compile processors tests -->
- <ant dir="tests" target="org.jboss.esb.services.internal.test"/>
- </target>
-
-
-
-
</project>
Copied: labs/jbossesb/trunk/ESBCore/services/src/org/jboss/soa/esb/internal (from rev 5096, labs/jbossesb/trunk/ESBCore/services/src/org/jboss/soa/esb/internal)
Copied: labs/jbossesb/trunk/ESBCore/services/src/org/jboss/soa/esb/internal/core (from rev 5096, labs/jbossesb/trunk/ESBCore/services/src/org/jboss/soa/esb/internal/core)
Copied: labs/jbossesb/trunk/ESBCore/services/src/org/jboss/soa/esb/internal/core/objectstore (from rev 5096, labs/jbossesb/trunk/ESBCore/services/src/org/jboss/soa/esb/internal/core/objectstore)
Deleted: labs/jbossesb/trunk/ESBCore/services/src/org/jboss/soa/esb/internal/core/objectstore/AbstractBobjStore.java
===================================================================
--- labs/jbossesb/trunk/ESBCore/services/src/org/jboss/soa/esb/internal/core/objectstore/AbstractBobjStore.java 2006-07-14 14:02:34 UTC (rev 5096)
+++ labs/jbossesb/trunk/ESBCore/services/src/org/jboss/soa/esb/internal/core/objectstore/AbstractBobjStore.java 2006-07-16 20:25:04 UTC (rev 5118)
@@ -1,193 +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.internal.core.objectstore;
-
-import org.jboss.soa.esb.util.BaseBusinessObject;
-
-public abstract class AbstractBobjStore
-{
- public static AbstractBobjStore getInstance()
- { throw new UnsupportedOperationException(
- "getInstance() must be implemented in the derived class");
- } //__________________________________
-
- /**
- * Array of BobjStore objects.
- * @return AbstractBobjStore[]
- */
- public abstract AbstractBobjStore[] getBobjStoreTable();
-
- /**
- * String names for BobjStoreTable.
- * @return String[]
- */
- public abstract String[] getBobjStoreIndex();
-
- protected String m_sSnapType , m_sSnapTbl , m_sLocTbl, m_sClass;
- protected boolean m_bEncrypt=false;
-
- /**
- * Snapshot type getter - The value assigned to this attribute will help if
- * standard SQL queries are required to surf the Object Store's snapshot tables
- * @return String - Value of snapshot type
- */
- public String getSnapType() { return m_sSnapType; }
- /**
- * Snapshot tablename getter - The value assigned to this attribute is the
- * name of the snapshot table for this object
- * @return String - name of SQL table where snapshots of objects will be stored
- */
- public String getSnapTable() { return m_sSnapTbl; }
- /**
- * Locator tablename getter - Locator table are also called index tables.
- * The value assigned to this attribute is the name of the locator table for
- * this object
- * @return String - name of SQL table where locators for objects will be stored
- * @see BusinessObject#getObjLocator()
- */
- public String getLocatorTable() { return m_sLocTbl; }
- /**
- * Encryption requirement getter
- * @return boolean - true if Objects stored using this descriptor have to be
- * encrypted - decrypted at storage/retrieval time
- */
- public boolean isEncrypted() { return m_bEncrypt; }
- /**
- * Static helper method to obtain the snapshot type by index mnemonic
- * @param p_i int - Index of descriptor in static descriptor table
- * @return String
- * @see BobjStore#getSnapType()
- * @see BobjStore#getIndex(Class)
- */
- public String getSnapType(int p_i) { return getBobjStoreTable()[p_i].m_sSnapType; }
- /**
- * Static helper method to obtain the snapshot SQL tablename by index mnemonic
- * @param p_i int - Index of descriptor in static descriptor table
- * @return String
- * @see BobjStore#getSnapTable()
- * @see BobjStore#getIndex(Class)
- */
- public String getSnapTable(int p_i) { return getBobjStoreTable()[p_i].m_sSnapTbl; }
- /**
- * Static helper method to obtain the locator SQL tablename by index mnemonic
- * @param p_i int - Index of descriptor in static descriptor table
- * @return String
- * @see BobjStore#getLocatorTable()
- * @see BobjStore#getIndex(Class)
- */
- public String getLocatorTable(int p_i){ return getBobjStoreTable()[p_i].m_sLocTbl; }
-
- /**
- *
- */
- protected AbstractBobjStore() {}
-
- /**
- * Constructor using all fields required by a BobjStore object
- * @param p_sSnapType String - Snapshot type
- * @param p_sSnapTbl String - Snapshot SQL tablename
- * @param p_sLocTbl String - Locator SQL tablename (may be null - No locator table)
- * @param p_sCls String - Class name excluding package prefix
- * @param p_bCrypt boolean - Does data have to be encrypted in the snap table ?
- * @see BusinessObject#classNm()
- */
- protected AbstractBobjStore (String p_sSnapType,String p_sSnapTbl, String p_sLocTbl
- ,String p_sCls, boolean p_bCrypt)
- { m_sSnapType = p_sSnapType;
- m_sSnapTbl = p_sSnapTbl;
- m_sLocTbl = p_sLocTbl;
- m_sClass = p_sCls;
- m_bEncrypt = p_bCrypt;
- } //________________________________
-
- /**
- * Constructor for non encrypted BobjStore
- * @param p_sSnapType String
- * @param p_sSnapTbl String
- * @param p_sLocTbl String
- * @param p_sCls String
- * @see BobjStore#BobjStore(String,String,String,String,boolean)
- */
- protected AbstractBobjStore (String p_sSnapType,String p_sSnapTbl, String p_sLocTbl
- ,String p_sCls)
- { this(p_sSnapType,p_sSnapTbl,p_sLocTbl,p_sCls,false);
- } //________________________________
-
- /**
- * Index in static descriptor table for objects of class <arg 1>
- * @param p_oCls Class - BusinessObject class to search for in descriptor table
- * @throws Exception
- * @return int - index in static descriptor table
- */
- public int getIndex (Class p_oCls) throws Exception
- { String sClassName = p_oCls.getName()
- .substring(1+p_oCls.getName().lastIndexOf("."));
- for (int i1 = 0; i1 < getBobjStoreTable().length; i1++)
- if (getBobjStoreIndex()[i1].equals(sClassName)) return i1;
- throw new Exception("No BobjStore for class "+p_oCls.getName());
- } //__________________________________
- /**
- * Get a BobjStore object that describes persistence details for objects of
- * class <arg 1>
- * @param p_sClassName String Classname to search for in descriptor table
- * @return BobjStore - A descriptor that will provide persistence info
- * @see PersistHandler
- * @see BobjStore#getStore(BusinessObject)
- */
- public AbstractBobjStore getStore (String p_sClassName)
- { if (null == p_sClassName) return null;
- for (int i1 = 0; i1 < getBobjStoreTable().length; i1++)
- { String sTblCls = getBobjStoreIndex()[i1];
- if (p_sClassName.equals(sTblCls)) return getStore(i1);
- }
- return null;
- } //__________________________________
-
- /**
- * Get a BobjStore object that describes persistence details for the
- * object specified in arg 1
- * @param p_o BusinessObject The object whose storage descriptor is requested
- * @return BobjStore - A descriptor that will provide persistence info
- * @see PersistHandler
- * @see BobjStore#getStore(String)
- */
- public AbstractBobjStore getStore (BaseBusinessObject p_o)
- { return (null != p_o) ? getStore(p_o.classNm()) : null;
- } //__________________________________
-
- /**
- * Get a BobjStore object by mnemonic name (index in the static descriptor table)
- * @param p_i int - typically a mnemonic name will be used (see CQ3 constants)
- * @return BobjStore - A descriptor that will provide persistence info
- * @see PersistHandler
- * @see BobjStore#getStore(String)
- */
- public AbstractBobjStore getStore (int p_i)
- {
- AbstractBobjStore oRet = getBobjStoreTable()[p_i];
-
- try { return (AbstractBobjStore)oRet.clone(); }
- catch (Exception e) {return oRet;}
- } //________________________________
-
-} //____________________________________________________________________________
Copied: labs/jbossesb/trunk/ESBCore/services/src/org/jboss/soa/esb/internal/core/objectstore/AbstractBobjStore.java (from rev 5096, labs/jbossesb/trunk/ESBCore/services/src/org/jboss/soa/esb/internal/core/objectstore/AbstractBobjStore.java)
Deleted: labs/jbossesb/trunk/ESBCore/services/src/org/jboss/soa/esb/internal/core/objectstore/BobjStore.java
===================================================================
--- labs/jbossesb/trunk/ESBCore/services/src/org/jboss/soa/esb/internal/core/objectstore/BobjStore.java 2006-07-14 14:02:34 UTC (rev 5096)
+++ labs/jbossesb/trunk/ESBCore/services/src/org/jboss/soa/esb/internal/core/objectstore/BobjStore.java 2006-07-16 20:25:04 UTC (rev 5118)
@@ -1,206 +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.internal.core.objectstore;
-
-import java.util.*;
-
-import org.jboss.soa.esb.common.*;
-import org.jboss.soa.esb.helpers.*;
-import org.jboss.soa.esb.util.*;
-
-public class BobjStore
-{
- private static String DATASRC_JNDI_NAME;
- public static void setDataSourceJndi(String p_s){ DATASRC_JNDI_NAME = p_s; }
- public static String getDataSourceJndi() { return DATASRC_JNDI_NAME; }
-
- private static String TBL_UIDS;
- public static void setUidTableName(String p_s) { TBL_UIDS = p_s; }
- public static String getUidTableName() { return TBL_UIDS; }
-
- private static String TBL_BATCHES;
- public static void setBatchTableName(String p_s) { TBL_BATCHES = p_s; }
- public static String getBatchTableName() { return TBL_BATCHES; }
-
- private static final Map<String,BobjStore> s_oStoreMap
- = new HashMap<String,BobjStore>();
-
- static
- { try
- { DomElement oConf = DomElement.fromURL(EsbSysProps.getObjStoreConfigFile());
- if (null!=oConf)
- {
- setDataSourceJndi (oConf.getAttr("dataSourceJndiName"));
- setUidTableName (oConf.getAttr("uidTable"));
- setBatchTableName (oConf.getAttr("batchTable"));
- for (DomElement oCurr : oConf.getElementChildren("Class"))
- { String sClass = oCurr.getAttr("name");
- boolean bCrypt = "true".equalsIgnoreCase(oCurr.getAttr("encrypt"));
-
- BobjStore oNew = new BobjStore
- (oCurr.getAttr("type")
- ,oCurr.getAttr("table")
- ,null
- ,sClass.substring(1+sClass.lastIndexOf("."))
- ,bCrypt
- );
-
- for (DomElement oIcurr : oCurr.getElementChildren("Index"))
- oNew.addLocatorTable(oIcurr.getAttr("table"));
- s_oStoreMap.put(sClass,oNew);
- }
- }
- }
- catch (Exception e)
- { EsbUtil.getDefaultLogger(BobjStore.class).error("BobjStore configuration FAILED"
- ,e);
- }
-
- };
-
- private String m_sSnapType , m_sSnapTbl , m_sClass;
- private List<String> m_olLocators;
- private boolean m_bEncrypt=false;
-
- /**
- * Snapshot type getter - The value assigned to this attribute will help if
- * standard SQL queries are required to surf the Object Store's snapshot tables
- * @return String - Value of snapshot type
- * @see Istorable#getSnapType()
- */
- public String getSnapType() { return m_sSnapType; }
- /**
- * Snapshot tablename getter - The value assigned to this attribute is the
- * name of the snapshot table for this object
- * @return String - name of SQL table where snapshots of objects will be stored
- * @see Istorable#getSnapTable()
- */
- public String getSnapTable() { return m_sSnapTbl; }
- /**
- * First locator tablename getter - Locator tables are also called index tables.
- * @return String - name of SQL table where locators(0) will be stored
- * @see Istorable#getLocatorTable()
- * @see BusinessObject#getObjLocator()
- */
- public String getLocatorTable() { return getLocatorTable(0); }
- /**
- * Obtain Nth locator table
- * @param p_n - Index for desired locator table
- * @return String - name of Nth SQL table where for objects will be stored
- * @see BaseBusinessObject#locator(p_i)
- */
- public String getLocatorTable(int p_n)
- { return (null==m_olLocators) ? null
- : (m_olLocators.size() <= p_n) ? null
- : m_olLocators.get(p_n);
- }
-
- /**
- * Obtain all locator table names
- * @return Names of all locator tables
- */
- public String[] allLocatorTables()
- { return (null==m_olLocators) ? new String[] {}
- : m_olLocators.toArray(new String[m_olLocators.size()]);
- }
- /**
- * Class suffix getter - Deprecated - Left here for backwards compatibility
- * @return String - Class suffix
- * @see Istorable#getLocatorTable()
- * @see BusinessObject#getObjLocator()
- */
- public String getClassSuffix() { return m_sClass; }
- /**
- * Encryption requirement getter
- * @return boolean - true if Objects stored using this descriptor have to be
- * encrypted - decrypted at storage/retrieval time
- */
- public boolean isEncrypted() { return m_bEncrypt; }
-
- /**
- * Constructor using all fields required by a BobjStore object
- * @param p_sSnapType String - Snapshot type
- * @param p_sSnapTbl String - Snapshot SQL tablename
- * @param p_sLocTbl String - Locator SQL tablename (may be null - No locator table)
- * @param p_sCls String - Class name excluding package prefix
- * @param p_bCrypt boolean - Does data have to be encrypted in the snap table ?
- * @see Istorable
- * @see BusinessObject#classNm()
- */
- protected BobjStore (String p_sSnapType,String p_sSnapTbl, String p_sLocTbl
- ,String p_sCls, boolean p_bCrypt)
- { m_sSnapType = p_sSnapType;
- m_sSnapTbl = p_sSnapTbl;
- addLocatorTable(p_sLocTbl);
- m_sClass = p_sCls;
- m_bEncrypt = p_bCrypt;
- } //________________________________
-
- private void addLocatorTable(String p_s)
- { if (EsbUtil.isNullString(p_s)) return;
- if (null==m_olLocators)
- m_olLocators = new ArrayList<String>();
- m_olLocators.add(p_s);
- } //________________________________
-
- /**
- * Constructor for non encrypted BobjStore
- * @param p_sSnapType String
- * @param p_sSnapTbl String
- * @param p_sLocTbl String
- * @param p_sCls String
- * @see BobjStore#BobjStore(String,String,String,String,boolean)
- */
- protected BobjStore (String p_sSnapType,String p_sSnapTbl, String p_sLocTbl
- ,String p_sCls)
- { this(p_sSnapType,p_sSnapTbl,p_sLocTbl,p_sCls,false);
- } //________________________________
-
- /**
- * Get a BobjStore object that describes persistence details for objects of
- * class <arg 1>
- * @param p_sClassName Class to search for in descriptor table
- * @return BobjStore - A descriptor that will provide persistence info
- * @see JbossEsbPersistHandler
- * @see BobjStore#getStore(BusinessObject)
- */
- public static BobjStore getStore (String p_sClassName)
- { if (EsbUtil.isNullString(p_sClassName)) return null;
- return s_oStoreMap.get(p_sClassName);
- } //__________________________________
-
- /**
- * Get a BobjStore object that describes persistence details for
- * BobjStdDTO <arg 1>
- * @param p_sClassName BobjStdDTO for which we need an object store
- * @return BobjStore - A descriptor that will provide persistence info
- * @see JbossEsbPersistHandler
- * @see BobjStore#getStore(String)
- */
- public static BobjStore getStore (BobjStdDTO p_oDto)
- { if (null == p_oDto) return null;
- return getStore(p_oDto.fullClassName());
- } //__________________________________
-
-} //____________________________________________________________________________
Copied: labs/jbossesb/trunk/ESBCore/services/src/org/jboss/soa/esb/internal/core/objectstore/BobjStore.java (from rev 5096, labs/jbossesb/trunk/ESBCore/services/src/org/jboss/soa/esb/internal/core/objectstore/BobjStore.java)
Deleted: labs/jbossesb/trunk/ESBCore/services/src/org/jboss/soa/esb/internal/core/objectstore/DaoBatchTable.java
===================================================================
--- labs/jbossesb/trunk/ESBCore/services/src/org/jboss/soa/esb/internal/core/objectstore/DaoBatchTable.java 2006-07-14 14:02:34 UTC (rev 5096)
+++ labs/jbossesb/trunk/ESBCore/services/src/org/jboss/soa/esb/internal/core/objectstore/DaoBatchTable.java 2006-07-16 20:25:04 UTC (rev 5118)
@@ -1,219 +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.internal.core.objectstore;
-
-import java.sql.*;
-import org.apache.log4j.*;
-import org.jboss.soa.esb.util.*;
-import org.jboss.soa.esb.helpers.persist.*;
-
-/**
- * Data access object for the SQL table where batches are temporarily stored
- * until they are committed
- *
- */
-public class DaoBatchTable extends SqlDbTable
-{
- private Logger m_oLog;
- private JdbcCleanConn m_oConn;
-
- private DaoBatchTable() throws Exception {this(null,null); }
- /**
- * Instantiate a DaoBatchTable object using the javax.sql.DataSource object
- * within <arg 1>, with table name held in <arg 2>
- * @param p_oConn JdbcCleanConn - Connection to use for preparing and executing
- * all SQL statements in this DAO
- * @param p_sTblName String - SQL table name to use in the context of this
- * DaoBatchTable object
- * @throws Exception - pass through from invoked methods - see Exception.getMessage()
- * at runtime for details
- * @see JdbcCleanConn
- */
- public DaoBatchTable(JdbcCleanConn p_oConn,String p_sTblName) throws Exception
- { super(p_oConn,p_sTblName);
- m_oLog = EsbUtil.getDefaultLogger(this.getClass());
- m_oConn = p_oConn;
- m_oaPS = new PreparedStatement[PS_MAX];
- } //________________________________
- /**
- * List of fields for select statement - provided only to avoid time
- * consuming 'select *' statements
- * @return String - a Comma separated list of fields
- */
- protected String getSelectFields()
- { return "batch_num,seq,data";
- } //________________________________
-
- // -------------------------------------------------------------
- // Column constants
- // -------------------------------------------------------------
- private static int s_iFld = 0;
- /**
- * Column index for field representing batch number
- */
- public static final int BATCH_NUM = s_iFld++;
- /**
- * Column index for field representing sequence number within batch number
- */
- public static final int BATCH_SEQ = s_iFld++;
- /**
- * XML string that will be used to instantiate the BusinessObject
- * @see BusinessObject#BusinessObject(BobjStdDTO)
- * @see BobjStdDTO#getFromXml(String)
- */
- public static final int STR_DATA = s_iFld++;
-
- private static final int QFIELDS = s_iFld;
-
- /**
- * Set values for insert statement
- * @param p_PS PreparedStatement - The prepared SQL statement for insert in this
- * table
- * <p>Must be the result of a previous call to this.getPS(PS_INS_BATCHROW)</p>
- * @param p_o Object - Object to get values from
- * <p>arg 2 is Object to comply with SqlDbTable abstract method setInsValues()
- * <li>For this particular class, arg 2 MUST be an instance of RowBatch</li>
- * </p>
- * @throws Exception
- * @return int
- * @see DaoBatchTable#getPS(int)
- * @see RowBatch
- */
- public int setInsValues(PreparedStatement p_PS,Object p_o)
- throws Exception
- { try
- { if (! (p_o instanceof RowBatch)) throw
- new Exception ("Parameter must be RowBatch");
-
- p_PS.clearParameters();
- RowBatch oBR = (RowBatch)p_o;
- setLong (p_PS, BATCH_NUM ,oBR.m_lBatch); // Batch Number
- setInt (p_PS, BATCH_SEQ ,oBR.m_iSeq); // Batch Sequence
- setObject (p_PS ,STR_DATA ,oBR.m_sData); // Batch Data
-
- return QFIELDS;
- }
- catch (Exception e)
- { m_oLog.error("setInsValues() Failed",e);
- throw e;
- }
- } //________________________________
- /**
- * Returns a RowBatch object containing data from the row in the current
- * cursor position of the ResultSet object <arg 1>
- * @param p_oRS ResultSet - The current ResultSet
- * <p>Must be the result of a previous execution of
- * JdbcCleanConn.execQueryWait() method on a 'select' prepared statement for
- * this object</p>
- * @throws Exception
- * @return Object - A RowBatch object
- * @see JdbcCleanConn#execQueryWait(PreparedStatement, int)
- * @see DaoBatchTable#getPS(int)
- * @see DaoBatchTable#PS_GET_BATCH_ROWS
- * @see RowBatch
- */
- public Object getFromRS (ResultSet p_oRS) throws Exception
- { try
- { RowBatch oRet = new RowBatch();
- oRet.m_lBatch = p_oRS.getLong(1+BATCH_NUM);
- oRet.m_iSeq = p_oRS.getInt (1+BATCH_SEQ);
- oRet.m_sData = p_oRS.getString(1+STR_DATA);
- return oRet;
- }
- catch (Exception e)
- { m_oLog.error("getFromRS() Failed",e);
- throw e;
- }
- } //________________________________
- /**
- * Index of the 'insert' statement in the list of PreparedStatement objects
- * for this DAO
- */
- public static final int PS_INS_BATCHROW = 0;
- /**
- * Index of the 'delete' statement in the list of PreparedStatement objects
- * for this DAO
- */
- public static final int PS_DELETE_BATCH = 1;
- /**
- * Index of the 'select' statement in the list of PreparedStatement objects
- * for this DAO (it has a where batch_num = ?)
- */
- public static final int PS_GET_BATCH_ROWS = 2;
-
- private static final int PS_MAX = 10;
-
- /**
- * Obtain a prepared statement for this DAO from the list of available PStmts
- * <p>Uses lazy instantiation of requested objects</p>
- * @param p_i int - Index of PreparedStatement object to obtain
- * @throws Exception - If an invalid index is passed or there are problems
- * during the prepareStatement() invocation
- * @return PreparedStatement
- */
- public PreparedStatement getPS (int p_i) throws Exception
- { try
- { switch (p_i)
- { case PS_INS_BATCHROW: return getInsBatchRow (p_i);
- case PS_DELETE_BATCH: return deleteBatch (p_i);
- case PS_GET_BATCH_ROWS: return getBatchRows (p_i);
- }
- ;
- throw new Exception("Invalid Index "+p_i);
- }
- catch (Exception e)
- { m_oLog.error("Request for Prepared Statement Failed",e);
- throw e;
- }
- } //__________________________________
-
- private PreparedStatement getInsBatchRow(int p_i) throws Exception
- { if (null == m_oaPS[p_i])
- m_oaPS[p_i] = m_oConn.prepareStatement(getInsertStatement());
- return m_oaPS[p_i];
- } //__________________________________
-
- private PreparedStatement deleteBatch(int p_i) throws Exception
- { if (null == m_oaPS[p_i])
- { StringBuffer sb = new StringBuffer("delete from ").append(m_sTableName)
- .append(" where ")
- .append(m_oaFields[BATCH_NUM].getFieldName()).append(" = ?")
- ;
- m_oaPS[p_i] = m_oConn.prepareStatement(sb.toString());
- }
- return m_oaPS[p_i];
- } //__________________________________
-
- private PreparedStatement getBatchRows(int p_i) throws Exception
- { if (null == m_oaPS[p_i])
- { StringBuffer sb = new StringBuffer(getSelectStatement())
- .append(" where ")
- .append(m_oaFields[BATCH_NUM].getFieldName()).append(" = ?")
- .append(" order by 1,2")
- ;
- m_oaPS[p_i] = m_oConn.prepareStatement(sb.toString());
- }
- return m_oaPS[p_i];
- } //__________________________________
-
-} //____________________________________________________________________________
Copied: labs/jbossesb/trunk/ESBCore/services/src/org/jboss/soa/esb/internal/core/objectstore/DaoBatchTable.java (from rev 5096, labs/jbossesb/trunk/ESBCore/services/src/org/jboss/soa/esb/internal/core/objectstore/DaoBatchTable.java)
Deleted: labs/jbossesb/trunk/ESBCore/services/src/org/jboss/soa/esb/internal/core/objectstore/DaoIndexTable.java
===================================================================
--- labs/jbossesb/trunk/ESBCore/services/src/org/jboss/soa/esb/internal/core/objectstore/DaoIndexTable.java 2006-07-14 14:02:34 UTC (rev 5096)
+++ labs/jbossesb/trunk/ESBCore/services/src/org/jboss/soa/esb/internal/core/objectstore/DaoIndexTable.java 2006-07-16 20:25:04 UTC (rev 5118)
@@ -1,312 +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.internal.core.objectstore;
-
-import org.jboss.soa.esb.util.*;
-import org.jboss.soa.esb.helpers.persist.*;
-import java.sql.*;
-import org.apache.log4j.*;
-
-/**
- * Data access object for all SQL tables that the ROS (Rosetta Object Store)
- * uses as locator tables
- * <p>Number of actual columns in all of these tables equals 4 + the
- * length of the String[] returned by the BusinessObject locator() method</p>
- * <p>It is responsibility of rosetta core developers to ensure
- * synchronization between these two, as well as to add a corresponding
- * entry in the BobjStore static descriptor table</p>
- *
- * @see BobjStore
- * @see BusinessObject#locator()
- */
-public class DaoIndexTable extends SqlDbTable
-{
-
- public static final String LOCATOR_TABLE_INDEX = "__whichLocator";
-
- private Logger m_oLog;
- private JdbcCleanConn m_oConn;
-
- private DaoIndexTable() throws Exception {this(null,null); }
- /**
- * Instantiate a DaoIndexTable object using the javax.sql.DataSource object
- * within <arg 1>, with table name held in <arg 2>
- * @param p_oConn JdbcCleanConn - Connection to use for preparing and executing
- * all SQL statements in this DAO
- * @param p_sTblName String - SQL table name to use in the context of this
- * DaoIndexTable object
- * @throws Exception - pass through from invoked methods - see Exception.getMessage()
- * at runtime for details
- * @see JdbcCleanConn
- */
- public DaoIndexTable(JdbcCleanConn p_oConn,String p_sTbl) throws Exception
- { super(p_oConn,p_sTbl);
- m_oLog = EsbUtil.getDefaultLogger(this.getClass());
- m_oConn = p_oConn;
- if (null != m_oaFields)
- { m_oaFields[OBJECT_UID].setPrimaryKey(true);
- m_sSelectSql = null;
- }
- m_oaPS = new PreparedStatement[PS_MAX];
- } //________________________________
-
- /**
- * List of fields for select statement - provided only to avoid time
- * consuming 'select *' statements
- * @return String - a Comma separated list of fields
- */
- protected String getSelectFields()
- { if (null==m_oaFields) return "*";
- StringBuffer sb = new StringBuffer(256);
- for (int i1=0; i1<m_oaFields.length;i1++)
- ((i1 < 1)?sb:sb.append(","))
- .append(m_oaFields[i1].getFieldName());
- return sb.toString();
- } //________________________________
-
- // -------------------------------------------------------------
- // Column constants
- // -------------------------------------------------------------
- private static int s_iFld = 0;
- /**
- * Column index for the BusinessObject UID represented in the corresponding
- * SQL table row
- */
- public static final int OBJECT_UID = s_iFld++;
- /**
- * Column index for the latest Object snapshot taken for the BusinessObject
- */
- public static final int TIMESTAMP = s_iFld++;
- /**
- * Column index for the latest snapshot's UID for the BusinessObject the row
- * represents
- */
- public static final int UID_SNAP = s_iFld++;
- /**
- * Column index for the latest Object snapshot's date (yyyymmdd)
- */
- public static final int SNAP_DATE = s_iFld++;
- /**
- * Column index for the first field in the String array returned by the
- * BusinessObject's locator() method - Subsequent fields in the array will
- * have consecutive sequential indices
- * @see BusinessObject#locator()
- */
- public static final int FIRST_FIELD = s_iFld++;
-
- public int setInsValues(PreparedStatement p_PS,Object p_o)
- throws Exception
- { return setInsValues (p_PS,p_o,0); }
- /**
- * Set values for insert statement
- * @param p_PS PreparedStatement - The prepared SQL statement for insert in this
- * table
- * <p>Must be the result of a previous call to this.getPS(PS_INS_INDEX)</p>
- * @param p_o Object - Object to get values from
- * <p>arg 2 is Object to comply with SqlDbTable abstract method setInsValues()
- * <li>For this particular class, arg 2 MUST be an instance of BobjStdDTO</li>
- * </p>
- * @param p_iNum int - Index of which locator String[] should be used
- * @throws Exception
- * @return int
- * @see DaoIndexTable#getPS(int)
- * @see DaoIndexTable#PS_INS_INDEX
- */
- public int setInsValues(PreparedStatement p_PS,Object p_o, int p_iNum)
- throws Exception
- { try
- { if (! (p_o instanceof BobjStdDTO)) throw
- new Exception ("Parameter must be BobjStdDTO");
-
- BobjStdDTO oDto = (BobjStdDTO)p_o;
-
- p_PS.clearParameters();
- setLong (p_PS, OBJECT_UID ,oDto.getUid()); // Object's UID
- long lStamp = oDto.getStamp();
- setLong (p_PS, TIMESTAMP ,lStamp); // Timestamp
- setLong (p_PS, UID_SNAP ,oDto.getSnap()); // Snap UID
- setObject(p_PS, SNAP_DATE ,oDto.getSnapDate()); // Snap Date
-
- int iFld = FIRST_FIELD;
- String[] sa = oDto.getLocators()[p_iNum];
- for (int i1=0; i1<sa.length;i1++)
- if (iFld < m_oaFields.length) setObject(p_PS,iFld++,sa[i1]);
-
- return iFld;
- }
- catch (Exception e)
- { m_oLog.error("setInsValues() Failed",e);
- throw e;
- }
- } //________________________________
-
- public void setUpdValues(PreparedStatement p_PS,Object p_o)
- throws Exception
- { setUpdValues(p_PS,p_o,0); }
-
- /**
- * Set values for update statement
- * @param p_PS PreparedStatement - The prepared SQL statement for update in this
- * table
- * <p>Must be the result of a previous call to this.getPS(PS_UPD_INDEX)</p>
- * @param p_o Object - Object to get values from
- * <li>For this particular class, arg 2 MUST be an instance of BaseBusinessObject</li>
- * </p>
- * @param p_iNum int - Index of which locator String[] should be used
- * @throws Exception
- * @see DaoIndexTable#getPS(int)
- * @see DaoIndexTable#PS_UPD_INDEX
- */
- public void setUpdValues(PreparedStatement p_PS,Object p_o, int p_iNum)
- throws Exception
- { try
- { if (! (p_o instanceof BobjStdDTO)) throw
- new Exception ("Parameter must be BobjStdDTO");
-
- BobjStdDTO oDto = (BobjStdDTO)p_o;
-
- int iFld = 0;
- p_PS.clearParameters();
- setLong (p_PS, iFld++ ,oDto.getStamp()); // Timestamp
- setLong (p_PS, iFld++ ,oDto.getSnap()); // Snap UID
- setObject(p_PS, iFld++ ,oDto.getSnapDate());
-
- String[] sa = oDto.getLocators()[p_iNum];
- for (int i1=0; i1<sa.length;i1++)
- if (iFld < m_oaFields.length) setObject(p_PS,iFld++,sa[i1]);
-
- setLong(p_PS, iFld++, oDto.getUid());
- }
- catch (Exception e)
- { m_oLog.error("setUpdValues() Failed",e);
- throw e;
- }
- } //________________________________
-
- /**
- * Returns an ObjLocator object containing data from the row in the current
- * cursor position of the ResultSet object <arg 1>
- * @param p_oRS ResultSet - The current ResultSet
- * <p>Must be the result of a previous execution of
- * JdbcCleanConn.execQueryWait() method on a 'select' prepared statement for
- * this object</p>
- * @throws Exception
- * @return Object - An ObjLocator object
- * @see JdbcCleanConn#execQueryWait(PreparedStatement, int)
- * @see DaoIndexTable#getPS(int)
- * @see DaoIndexTable#PS_SEL_INDEX
- * @see ObjLocator
- */
- public Object getFromRS (ResultSet p_oRS) throws Exception
- { try
- {
- long lUid = p_oRS.getLong(1+OBJECT_UID);
- String[] sa = new String[m_oaFields.length-FIRST_FIELD];
- int iFld = FIRST_FIELD;
- for (int i1=0; i1<sa.length;i1++) sa[i1] = p_oRS.getString(++iFld);
-
- return new ObjLocator(lUid,sa);
- }
- catch (Exception e)
- { m_oLog.error("getFromRS() Failed",e);
- throw e;
- }
- } //________________________________
-
-
- /**
- * Index of the 'insert' statement in the list of PreparedStatement objects
- * for this DAO
- */
- public static final int PS_INS_INDEX = 0;
- /**
- * Index of the 'select' statement in the list of PreparedStatement objects
- * for this DAO
- */
- public static final int PS_SEL_INDEX = 1;
- /**
- * Index of the 'delete' statement in the list of PreparedStatement objects
- * for this DAO
- */
- public static final int PS_RMV_INDEX = 2;
- /**
- * Index of the 'update' statement in the list of PreparedStatement objects
- * for this DAO
- */
- public static final int PS_UPD_INDEX = 3;
-
- private static final int PS_MAX = 10;
-
- /**
- * Obtain a prepared statement for this DAO from the list of available PStmts
- * <p>Uses lazy instantiation of requested objects</p>
- * @param p_i int - Index of PreparedStatement object to obtain
- * @throws Exception - If an invalid index is passed or there are problems
- * during the prepareStatement() invocation
- * @return PreparedStatement
- */
- public PreparedStatement getPS (int p_i) throws Exception
- { try
- { switch (p_i)
- { case PS_INS_INDEX: return getInsIndex(p_i);
- case PS_SEL_INDEX: return getSelIndex(p_i);
- case PS_RMV_INDEX: return getRmvIndex(p_i);
- case PS_UPD_INDEX: return getUpdIndex(p_i);
- }
- ;
- throw new Exception("Invalid Index "+p_i);
- }
- catch (Exception e)
- { m_oLog.error("Request for Prepared Statement Failed",e);
- throw e;
- }
- } //__________________________________
-
- private PreparedStatement getInsIndex(int p_i) throws Exception
- { if (null == m_oaPS[p_i])
- m_oaPS[p_i] = m_oConn.prepareStatement(getInsertStatement());
- return m_oaPS[p_i];
- } //__________________________________
-
- private PreparedStatement getSelIndex(int p_i) throws Exception
- { if (null == m_oaPS[p_i])
- { StringBuffer sb = new StringBuffer(getSelectStatement())
- .append(" where ").append(getFldName(OBJECT_UID)).append(" = ? ");
- m_oaPS[p_i] = m_oConn.prepareStatement(sb.toString());
- }
- return m_oaPS[p_i];
- } //__________________________________
-
- private PreparedStatement getRmvIndex(int p_i) throws Exception
- { if (null == m_oaPS[p_i])
- m_oaPS[p_i] = m_oConn.prepareStatement(getDeleteStatement());
- return m_oaPS[p_i];
- } //__________________________________
-
- private PreparedStatement getUpdIndex(int p_i) throws Exception
- { if (null == m_oaPS[p_i])
- m_oaPS[p_i] = m_oConn.prepareStatement(getUpdateStatement());
- return m_oaPS[p_i];
- } //__________________________________
-
-} //____________________________________________________________________________
Copied: labs/jbossesb/trunk/ESBCore/services/src/org/jboss/soa/esb/internal/core/objectstore/DaoIndexTable.java (from rev 5096, labs/jbossesb/trunk/ESBCore/services/src/org/jboss/soa/esb/internal/core/objectstore/DaoIndexTable.java)
Deleted: labs/jbossesb/trunk/ESBCore/services/src/org/jboss/soa/esb/internal/core/objectstore/DaoSnapTable.java
===================================================================
--- labs/jbossesb/trunk/ESBCore/services/src/org/jboss/soa/esb/internal/core/objectstore/DaoSnapTable.java 2006-07-14 14:02:34 UTC (rev 5096)
+++ labs/jbossesb/trunk/ESBCore/services/src/org/jboss/soa/esb/internal/core/objectstore/DaoSnapTable.java 2006-07-16 20:25:04 UTC (rev 5118)
@@ -1,398 +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.internal.core.objectstore;
-
-import java.lang.reflect.Method;
-import java.sql.*;
-import org.apache.log4j.*;
-
-import org.jboss.soa.esb.common.*;
-import org.jboss.soa.esb.util.EsbUtil;
-import org.jboss.soa.esb.util.BobjStdDTO;
-import org.jboss.soa.esb.helpers.persist.*;
-import org.jboss.soa.esb.services.*;
-
-
-/**
- * Data access object for all SQL tables that the ROS (Rosetta Object Store)
- * uses as snapshot tables
- *
- * @see BobjStore
- */
-public class DaoSnapTable extends SqlDbTable
-{
- private Logger m_oLogger;
- private JdbcCleanConn m_oConn;
- private BobjStore m_oST;
-
- private DaoSnapTable() throws Exception {this(null,null); }
- /**
- * Instantiate a DaoSnapTable object using the javax.sql.DataSource object
- * within <arg 1>, with table name held in <arg 2>
- * @param p_oConn JdbcCleanConn - Connection to use for preparing and executing
- * all SQL statements in this DAO
- * @param p_oST BobjStore - Descriptor that holds information of what physical
- * SQL tables to use both for the snapshot and the locator tables for
- * BusinessObjects sent to this DAO
- * @throws Exception - pass through from invoked methods - see Exception.getMessage()
- * at runtime for details
- * @see JdbcCleanConn
- * @see BobjStore
- * @see Istorable
- */
- public DaoSnapTable(JdbcCleanConn p_oConn,BobjStore p_oST) throws Exception
- { super(p_oConn,p_oST.getSnapTable());
- m_oLogger = EsbUtil.getDefaultLogger(this.getClass());
- m_oConn = p_oConn;
- m_oST = p_oST;
- if (null != m_oaFields)m_oaFields[UID_SNAP].setPrimaryKey(true);
- m_oaPS = new PreparedStatement[PS_MAX];
- } //________________________________
-
- /**
- * List of fields for select statement - provided only to avoid time
- * consuming 'select *' statements
- * @return String - a Comma separated list of fields
- */
- protected String getSelectFields()
- { return "uid,stamp,snap_type,object_uid,batch_num,xml_data";
- } //________________________________
-
- // -------------------------------------------------------------
- // Column constants
- // -------------------------------------------------------------
- private static int s_iFld = 0;
- /**
- * Column index for the SQL table field representing snapshot's unique identifier
- * <p>This would be the 'natural' primary key for all snapshot tables, and the
- * number should only be assigned by the JbossEsbPersistHandler EJB at insert time</p>
- * <p>There could potentially be several snapshots for the same
- * BusinessObject - In that case, there would be several rows in the
- * snapshot table with the same OBJECT_UID value and different UID_SNAP
- * values
- * </p>
- * @see DaoSnapTable#OBJECT_UID
- */
- public static final int UID_SNAP = s_iFld++;
- /**
- * Column index for the SQL table field representing this snapshot's timestamp, expressed
- * in milliseconds since the start of the 'epoch'
- * @see java.util.Date
- */
- public static final int TIMESTAMP = s_iFld++;
- /**
- * Column index for the SQL table field representing this snapshot's
- * underlying BusinessObject type - This is a Rosetta Core design level decision
- * <p>Having this field as an SQL column will enable SQL 'visibility' and thus
- * can be used in the 'where' clause of any SQL statement</p>
- * <p>An example of when this field could potentially be used is if a
- * decision is made by Rosetta Administrators to move all objects of a specific
- * type to a different SQL snapshot table</p>
- */
- public static final int SNAP_TYPE = s_iFld++;
- /**
- * Column index for the SQL table field representing BusinessObject unique identifier
- * <p>There could potentially be several snapshots for the same
- * BusinessObject - In that case, there would be several rows in the
- * snapshot table with the same OBJECT_UID value and different UID_SNAP
- * values
- * </p>
- * @see DaoSnapTable#OBJECT_UID
- */
- public static final int OBJECT_UID = s_iFld++;
- /**
- * Column index for the SQL table field representing the batch number
- * as a result of which this snapshot was added to the store
- * <p>If this snapshot was not added as part of a batch process (meaning a
- * group of BusinessObjects added using the JbossEsbBatchHandler EJB), then it
- * will hold a null value</p>
- */
- public static final int BATCH_NUM = s_iFld++;
- /**
- * Column index for the SQL table field representing the XML representation
- * of the BusinessObject stored in this SQL table
- * <p>The contents of this field are going to be the result of invoking
- * the BusinessObject.toDTO().toXml() method</p>
- * @see BusinessObject#toDTO()
- * @see BobjStdDTO#toXml()
- * @see DaoSnapTable#setInsValues(PreparedStatement,Object)
- */
- public static final int XML_OBJECT = s_iFld++;
-
- private static final int QFIELDS = s_iFld++;
-
- /**
- * Set values for insert statement
- * @param p_PS PreparedStatement - The prepared SQL statement for insert in this
- * table
- * <p>Must be the result of a previous call to this.getPS(PS_INS_SNAP)</p>
- * @param p_o Object - Object to get values from
- * <p>arg 2 is Object to comply with SqlDbTable abstract method setInsValues()
- * <li>For this particular class, arg 2 MUST be an instance of BusinessObject</li>
- * </p>
- * @throws Exception
- * @return int
- * @see DaoSnapTable#getPS(int)
- * @see DaoSnapTable#PS_INS_SNAP
- * @see BusinessObject
- */
- public int setInsValues(PreparedStatement p_PS,Object p_o)
- throws Exception
- { try
- { if (! (p_o instanceof BobjStdDTO)) throw
- new Exception ("Parameter must be BobjStdDTO");
-
- BobjStdDTO oDto = (BobjStdDTO)p_o;
- long lSnapUid = oDto.getSnap();
-
- p_PS.clearParameters();
- setLong (p_PS, UID_SNAP ,lSnapUid);
- setLong (p_PS, TIMESTAMP ,oDto.getStamp()); // Timestamp
- setObject(p_PS, SNAP_TYPE ,m_oST.getSnapType()); // Snap Type
- setLong (p_PS, OBJECT_UID ,oDto.getUid()); // Object's UID
- setLong (p_PS, BATCH_NUM ,oDto.getBatch()); // Batch Number
- byte[] baXml = oDto.toXml().getBytes();
- p_PS.setBytes(1+XML_OBJECT,seeCrypt(baXml,lSnapUid));
-
- return QFIELDS;
- }
- catch (Exception e)
- { m_oLogger.error("setInsValues() Failed",e);
- throw e;
- }
- } //________________________________
-
- /**
- * Set values for update statement
- * @param p_PS PreparedStatement - The prepared SQL statement for updates in this
- * table
- * <p>Must be the result of a previous call to this.getPS(PS_UPD_SNAP)</p>
- * @param p_o Object - Object to get values from
- * <li>For this particular class, arg 2 MUST be an instance of BobjStdDTO</li>
- * </p>
- * @throws Exception
- * @see DaoSnapTable#getPS(int)
- * @see DaoSnapTable#PS_UPD_SNAP
- * @see BobjStdDTO
- */
- public void setUpdValues(PreparedStatement p_PS,Object p_o)
- throws Exception
- { try
- { if (! (p_o instanceof BobjStdDTO)) throw
- new Exception ("Parameter must be BobjStdDTO");
-
- BobjStdDTO oDto = (BobjStdDTO)p_o;
- long lSnapUid = oDto.getSnap();
-
- p_PS.clearParameters();
-
- int iFld = 0;
- setLong (p_PS, iFld++ ,oDto.getStamp()); // Timestamp
- setObject(p_PS, iFld++ ,m_oST.getSnapType()); // Snap Type
- setLong (p_PS, iFld++ ,oDto.getUid()); // Object's UID
- setLong (p_PS, iFld++ ,oDto.getBatch()); // Batch Number
- byte[] baXml = oDto.toXml().getBytes();
- p_PS.setBytes(1+iFld++ ,seeCrypt(baXml,lSnapUid));
- setLong (p_PS, iFld++ ,lSnapUid);
- }
- catch (Exception e)
- { m_oLogger.error("setInsValues() Failed",e);
- throw e;
- }
- } //________________________________
-
- private Iencryption m_oMangler;
- private static final Object s_oSync = new Integer(0);
- private Iencryption getMangler() throws Exception
- { return getMangler(null); }
- private Iencryption getMangler(Object p_oFactParms) throws Exception
- { if (null!=m_oMangler)
- return m_oMangler;
- synchronized(s_oSync)
- { if (null!=m_oMangler)
- return m_oMangler;
-
- String sFactoryName = EsbSysProps.getEncryptionFactoryClass();
- Class oFactClass = DefaultEncryptionFactory.class;
- if (null!=sFactoryName)
- oFactClass = Class.forName(sFactoryName);
- Method oMth = oFactClass.getMethod("getEncrypter"
- ,new Class[] {Object.class});
- m_oMangler = (Iencryption) oMth.invoke(null,p_oFactParms);
- }
-
- return m_oMangler;
- } //________________________________
-
- /**
- * Encrypt if you have to or just return your first argument
- * <p />
- * You'll probably override this method if you have your own Iencryption implementation
- * @param p_ba the byte array to be encrypted (if the store so indicates)
- * @param p_l an object for the encrypt method of the Iencryption object
- * @return the value to be stored in the column
- * @throws Exception
- */
-
- protected byte[] seeCrypt(byte[] p_ba,Object p_l) throws Exception
- { if (! m_oST.isEncrypted()) return p_ba;
- return getMangler().encrypt(p_ba,p_l);
- } //________________________________
-
- /**
- * Decrypt if you have to or just return your first argument
- * <p />
- * You'll probably override this method if you have your own Iencryption implementation
- * @param p_ba the byte array to be decrypted (if the store so indicates)
- * @param p_l an object for the decrypt method of the Iencryption object
- * @return the value to be used to construct the XML string
- * @throws Exception
- */
- protected byte[] seeDecrypt(byte[] p_ba,Object p_l) throws Exception
- { if (! m_oST.isEncrypted()) return p_ba;
- return getMangler().decrypt(p_ba,p_l);
- } //________________________________
-
- /**
- * Returns a BobjStdDTO containing data from the row in the current
- * cursor position of the ResultSet object <arg 1>
- * @param p_oRS ResultSet - The current ResultSet
- * <p>Must be the result of a previous execution of
- * JdbcCleanConn.execQueryWait() method on a 'select' prepared statement for
- * this object</p>
- * @throws Exception
- * @return Object - A BobjStdDTO
- * @see JdbcCleanConn#execQueryWait(PreparedStatement, int)
- * @see DaoSnapTable#getPS(int)
- * @see DaoSnapTable#PS_SEL_SNAP
- * @see DaoSnapTable#PS_SEL_4UPD
- * @see BobjStdDTO
- */
- public Object getFromRS (ResultSet p_oRS) throws Exception
- { try
- { long lUid = p_oRS.getLong(1+UID_SNAP);
- String sXml = (m_oST.isEncrypted())
- ? new String(seeDecrypt(p_oRS.getBytes(1+XML_OBJECT),lUid),"ISO-8859-1")
- : p_oRS.getString(1+XML_OBJECT);
- Object oRet = BobjStdDTO.getFromXml(sXml);
- return oRet;
- }
- catch (Exception e)
- { m_oLogger.error("getFromRS() Failed",e);
- throw e;
- }
- } //________________________________
-
-
- /**
- * Index of the 'insert' statement in the list of PreparedStatement objects
- * for this DAO
- */
- public static final int PS_INS_SNAP = 0;
- /**
- * Index of the 'select' statement in the list of PreparedStatement objects
- * for this DAO
- */
- public static final int PS_SEL_SNAP = 1;
- /**
- * Index of the 'delete' statement in the list of PreparedStatement objects
- * for this DAO
- */
- public static final int PS_RMV_SNAP = 2;
- /**
- * Index of the 'update' statement in the list of PreparedStatement objects
- * for this DAO
- */
- public static final int PS_UPD_SNAP = 3;
- /**
- * Index of the 'select for update' statement in the list of PreparedStatement
- * objects for this DAO
- */
- public static final int PS_SEL_4UPD = 4;
-
- private static final int PS_MAX = 10;
-
- /**
- * Obtain a prepared statement for this DAO from the list of available PStmts
- * <p>Uses lazy instantiation of requested objects</p>
- * @param p_i int - Index of PreparedStatement object to obtain
- * @throws Exception - If an invalid index is passed or there are problems
- * during the prepareStatement() invocation
- * @return PreparedStatement
- */
- public PreparedStatement getPS (int p_i) throws Exception
- { try
- { switch (p_i)
- { case PS_INS_SNAP: return getInsSnap(p_i);
- case PS_SEL_SNAP: return getSelSnap(p_i);
- case PS_RMV_SNAP: return getRmvSnap(p_i);
- case PS_UPD_SNAP: return getUpdSnap(p_i);
- case PS_SEL_4UPD: return getSel4UpdSnap(p_i);
- }
- ;
- throw new Exception("Invalid Index "+p_i);
- }
- catch (Exception e)
- { m_oLogger.error("Request for Prepared Statement Failed",e);
- throw e;
- }
- } //__________________________________
-
- private PreparedStatement getInsSnap(int p_i) throws Exception
- { if (null == m_oaPS[p_i])
- m_oaPS[p_i] = m_oConn.prepareStatement(getInsertStatement());
- return m_oaPS[p_i];
- } //__________________________________
-
- private PreparedStatement getSelSnap(int p_i) throws Exception
- { if (null == m_oaPS[p_i])
- { StringBuffer sb = new StringBuffer(getSelectStatement())
- .append(" where ").append(getFldName(UID_SNAP)).append(" = ? ");
- m_oaPS[p_i] = m_oConn.prepareStatement(sb.toString());
- }
- return m_oaPS[p_i];
- } //__________________________________
-
- private PreparedStatement getRmvSnap(int p_i) throws Exception
- { if (null == m_oaPS[p_i])
- m_oaPS[p_i] = m_oConn.prepareStatement(getDeleteStatement());
- return m_oaPS[p_i];
- } //__________________________________
-
- private PreparedStatement getUpdSnap(int p_i) throws Exception
- { if (null == m_oaPS[p_i])
- m_oaPS[p_i] = m_oConn.prepareStatement(getUpdateStatement());
- return m_oaPS[p_i];
- } //__________________________________
-
- private PreparedStatement getSel4UpdSnap(int p_i) throws Exception
- { if (null == m_oaPS[p_i])
- { StringBuffer sb = new StringBuffer(getSelectStatement())
- .append(" where ").append(getFldName(UID_SNAP)).append(" = ? ")
- .append(" for update");
- m_oaPS[p_i] = m_oConn.prepareStatement(sb.toString());
- }
- return m_oaPS[p_i];
- } //__________________________________
-
-} //____________________________________________________________________________
Copied: labs/jbossesb/trunk/ESBCore/services/src/org/jboss/soa/esb/internal/core/objectstore/DaoSnapTable.java (from rev 5096, labs/jbossesb/trunk/ESBCore/services/src/org/jboss/soa/esb/internal/core/objectstore/DaoSnapTable.java)
Deleted: labs/jbossesb/trunk/ESBCore/services/src/org/jboss/soa/esb/internal/core/objectstore/DaoUidTable.java
===================================================================
--- labs/jbossesb/trunk/ESBCore/services/src/org/jboss/soa/esb/internal/core/objectstore/DaoUidTable.java 2006-07-14 14:02:34 UTC (rev 5096)
+++ labs/jbossesb/trunk/ESBCore/services/src/org/jboss/soa/esb/internal/core/objectstore/DaoUidTable.java 2006-07-16 20:25:04 UTC (rev 5118)
@@ -1,233 +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.internal.core.objectstore;
-
-import org.jboss.soa.esb.helpers.persist.*;
-import org.jboss.soa.esb.util.*;
-import java.sql.*;
-import org.apache.log4j.*;
-
-/**
- * Data access object for the SQL table that the Object Store
- * uses to assign Unique Identifiers (UID) to any object in the framework
- * @see IpersistHandler#getUidChunk(int)
- */
-public class DaoUidTable extends SqlDbTable
-{
- /**
- * Key value for the row in the UID table that holds UIDs for BusinessObjects
- * "jbossEsb_objuid"
- */
- public static final String SEQUENCE_OBJ = "jbossEsb_objuid";
- /**
- * Key value for the row in the UID table that holds UIDs for BatchProcess
- * "jbossEsb_batchuid"
- */
- public static final String SEQUENCE_BATCH = "jbossEsb_batchuid";
-
- private Logger m_oLogger;
-
- private DaoUidTable() throws Exception {this(null,null); }
- /**
- * Instantiate a DaoUidTable object using the javax.sql.DataSource object
- * within <arg 1>, with table name held in <arg 2>
- * @param p_oConn JdbcCleanConn - Connection to use for preparing and executing
- * all SQL statements in this DAO
- * @param p_sTblName String - SQL table name to use in the context of this
- * DaoUidTable object
- * @throws Exception - pass through from invoked methods - see Exception.getMessage()
- * at runtime for details
- * @see JdbcCleanConn
- */
- public DaoUidTable(JdbcCleanConn p_oConn,String p_sTblName) throws Exception
- { super(p_oConn,p_sTblName);
- m_oLogger = EsbUtil.getDefaultLogger(this.getClass());
- if (null != m_oaFields)
- { m_oaFields[UID].setPrimaryKey(true);
- }
- m_oaPS = new PreparedStatement[PS_MAX];
- } //________________________________
- /**
- * List of fields for select statement - provided only to avoid time
- * consuming 'select *' statements
- * @return String - a Comma separated list of fields
- */
- protected String getSelectFields()
- { return "uid,sequence_name,last_used_uid";
- } //________________________________
-
- // -------------------------------------------------------------
- // Column constants
- // -------------------------------------------------------------
- private static int s_iFld = 0;
- /**
- * Column index for field representing the UID of this table row
- */
- public static final int UID = s_iFld++;
- /**
- * Column index for field representing the sequence name of this row
- * @see DoiUidTable#SEQUENCE_OBJ
- * @see DoiUidTable#SEQUENCE_BATCH
- */
- public static final int SEQ_NAME = s_iFld++;
- /**
- * Column index for field representing the last used UID number for this
- * particular sequence name
- */
- public static final int LAST_USED_UID = s_iFld++;
-
-
- /**
- * This method is supplied to comply with the parent class but it should
- * NEVER be used
- * @param p_PS PreparedStatement
- * @param p_o Object
- * @throws Exception - This will ALWAYS throw an Exception - Inserts to
- * this table class should be handled ONLY by the Rosetta Administrator
- * @return int - It will never return a value
- */
- public int setInsValues(PreparedStatement p_PS,Object p_o)
- throws Exception
- { String sErr = "No Inserts to UID table";
- m_oLogger.error(sErr);
- throw new Exception (sErr);
- } //________________________________
- /**
- * Provided for compatibility - Never used - Will always return null
- * @param p_oRS ResultSet
- * @throws Exception
- * @return Object
- */
- public Object getFromRS(ResultSet p_oRS) throws Exception
- { return null;
- } //________________________________
-
- /**
- * Index of the 'select for update' statement in the list of PreparedStatement
- * objects for this DAO
- */
- public static final int PS_GET_SEQ_4_UPD = 0;
- /**
- * Index of the 'update' statement in the list of PreparedStatement
- * objects for this DAO
- */
- public static final int PS_UPDATE_LAST_USED = 1;
-
- private static final int PS_MAX = 10;
-
- /**
- * Obtain a prepared statement for this DAO from the list of available PStmts
- * <p>Uses lazy instantiation of requested objects</p>
- * @param p_i int - Index of PreparedStatement object to obtain
- * @throws Exception - If an invalid index is passed or there are problems
- * during the prepareStatement() invocation
- * @return PreparedStatement
- */
- public PreparedStatement getPS (int p_i) throws Exception
- { try
- { switch (p_i)
- { case PS_GET_SEQ_4_UPD: return getSeq4Upd(p_i);
- case PS_UPDATE_LAST_USED: return updateLastUsed(p_i);
- }
- ;
- throw new Exception("Invalid Index "+p_i);
- }
- catch (Exception e)
- { m_oLogger.error("Request for Prepared Statement Failed",e);
- throw e;
- }
- } //__________________________________
-
- private PreparedStatement getSeq4Upd(int p_i) throws Exception
- { if (null == m_oaPS[p_i])
- { StringBuffer sb = new StringBuffer(getSelectStatement())
- .append(" where ").append(getFldName(SEQ_NAME))
- .append(" = ? for update");
- m_oaPS[p_i] = getConn().prepareStatement(sb.toString());
- }
- return m_oaPS[p_i];
- } //__________________________________
-
- private PreparedStatement updateLastUsed(int p_i) throws Exception
- { if (null == m_oaPS[p_i])
- { StringBuffer sb = new StringBuffer("update ").append(m_sTableName)
- .append(" set ").append(getFldName(LAST_USED_UID)).append(" = ?")
- .append(" where ").append(getFldName(SEQ_NAME)).append(" = ?")
- ;
- m_oaPS[p_i] = getConn().prepareStatement(sb.toString());
- }
- return m_oaPS[p_i];
- } //__________________________________
-
- /**
- * This is an exception to the standard behaviour of derived classes that
- * extend the SqlDbTable abstract class
- * <p>This method is called by the JbossEsbPersistHandler and JbossEsbBatchHandler EJBs
- * and makes their life easier when they need to obtain UID chunks</p>
- * <p>These EJBs rely on this table to ensure no duplicate UIDs across all of
- * Rosetta</p>
- * <p>It could also be invoked from a different context, provided that the
- * Rosetta Administrators have added a row with a unique sequence name to
- * the underlying SQL table that holds the last used UIDs for all numbering
- * sequences</p>
- * @param p_sSeqName String - Key to the sequence name to get the chunk from
- * @param p_iQuids int - Number of UIDs to return
- * @throws Exception
- * @return long - First UID in the chunk assigned by this method
- */
- public long getUidChunk(String p_sSeqName, int p_iQuids) throws Exception
- {
- try
- { PreparedStatement PS = getPS(DaoUidTable.PS_GET_SEQ_4_UPD);
- PS.setString(1,p_sSeqName);
- ResultSet rs = getConn().execQueryWait(PS,30);
-
- boolean bOK=false;
- try
- { if (rs.next())
- bOK = true;
- }
- catch (Exception e1) { getConn().rollback(); }
- if (! bOK) throw new Exception("Select FAILED jbossEsb.getChunk()");
-
- int iSqlFld = 1+DaoUidTable.LAST_USED_UID;
- long lUid = rs.getLong(iSqlFld);
- if (lUid < 1) lUid = 1;
- long lNewLast = lUid + p_iQuids;
-
- PS = getPS(DaoUidTable.PS_UPDATE_LAST_USED);
- PS.setLong (1,lNewLast);
- PS.setString(2,p_sSeqName);
- getConn().execUpdWait(PS,10);
-
- getConn().commit();
-
- return lUid;
- }
- catch (Exception e)
- { m_oLogger.error(e.getMessage());
- throw e;
- }
- } //__________________________________
-} //____________________________________________________________________________
Copied: labs/jbossesb/trunk/ESBCore/services/src/org/jboss/soa/esb/internal/core/objectstore/DaoUidTable.java (from rev 5096, labs/jbossesb/trunk/ESBCore/services/src/org/jboss/soa/esb/internal/core/objectstore/DaoUidTable.java)
Deleted: labs/jbossesb/trunk/ESBCore/services/src/org/jboss/soa/esb/internal/core/objectstore/ItfStorable.java
===================================================================
--- labs/jbossesb/trunk/ESBCore/services/src/org/jboss/soa/esb/internal/core/objectstore/ItfStorable.java 2006-07-14 14:02:34 UTC (rev 5096)
+++ labs/jbossesb/trunk/ESBCore/services/src/org/jboss/soa/esb/internal/core/objectstore/ItfStorable.java 2006-07-16 20:25:04 UTC (rev 5118)
@@ -1,38 +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.internal.core.objectstore;
-
-/**
- * Provides methods to learn about how and where a BusinessObject will be stored
- * and retrieved from a BobjStore
- * @see BobjStore
- */
-
-public interface ItfStorable
-{
- public String getSnapType ();
- public String getSnapTable ();
- public String getLocatorTable ();
- public String getLocatorTable (int p_i);
- public boolean isEncrypted ();
-} // ___________________________________________________________________________
Copied: labs/jbossesb/trunk/ESBCore/services/src/org/jboss/soa/esb/internal/core/objectstore/ItfStorable.java (from rev 5096, labs/jbossesb/trunk/ESBCore/services/src/org/jboss/soa/esb/internal/core/objectstore/ItfStorable.java)
Deleted: labs/jbossesb/trunk/ESBCore/services/src/org/jboss/soa/esb/internal/core/objectstore/RowBatch.java
===================================================================
--- labs/jbossesb/trunk/ESBCore/services/src/org/jboss/soa/esb/internal/core/objectstore/RowBatch.java 2006-07-14 14:02:34 UTC (rev 5096)
+++ labs/jbossesb/trunk/ESBCore/services/src/org/jboss/soa/esb/internal/core/objectstore/RowBatch.java 2006-07-16 20:25:04 UTC (rev 5118)
@@ -1,42 +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.internal.core.objectstore;
-
-public class RowBatch
-{
- public long m_lBatch;
- public int m_iSeq;
- public long m_lCommitTS;
- public String m_sData;
-
- public RowBatch()
- { this(0,0,0,null);
- } //__________________________________
-
- public RowBatch (long p_lBatch, int p_iSeq, long p_lTS, String p_sData)
- { m_lBatch = p_lBatch;
- m_iSeq = p_iSeq;
- m_lCommitTS = p_lTS;
- m_sData = p_sData;
- } //__________________________________
-} //____________________________________________________________________________
Copied: labs/jbossesb/trunk/ESBCore/services/src/org/jboss/soa/esb/internal/core/objectstore/RowBatch.java (from rev 5096, labs/jbossesb/trunk/ESBCore/services/src/org/jboss/soa/esb/internal/core/objectstore/RowBatch.java)
Modified: labs/jbossesb/trunk/ESBCore/services/src/org/jboss/soa/esb/services/EJB/JbossEsbBatchHandler.java
===================================================================
--- labs/jbossesb/trunk/ESBCore/services/src/org/jboss/soa/esb/services/EJB/JbossEsbBatchHandler.java 2006-07-16 00:25:35 UTC (rev 5117)
+++ labs/jbossesb/trunk/ESBCore/services/src/org/jboss/soa/esb/services/EJB/JbossEsbBatchHandler.java 2006-07-16 20:25:04 UTC (rev 5118)
@@ -5,7 +5,7 @@
/**
* Remote interface for JbossEsbBatchHandler.
- * @xdoclet-generated at July 4 2006
+ * @xdoclet-generated at July 12 2006
* @copyright The XDoclet Team
* @author XDoclet
* @version ${version}
Modified: labs/jbossesb/trunk/ESBCore/services/src/org/jboss/soa/esb/services/EJB/JbossEsbBatchHandlerBean.java
===================================================================
--- labs/jbossesb/trunk/ESBCore/services/src/org/jboss/soa/esb/services/EJB/JbossEsbBatchHandlerBean.java 2006-07-16 00:25:35 UTC (rev 5117)
+++ labs/jbossesb/trunk/ESBCore/services/src/org/jboss/soa/esb/services/EJB/JbossEsbBatchHandlerBean.java 2006-07-16 20:25:04 UTC (rev 5118)
@@ -33,8 +33,8 @@
import org.apache.log4j.*;
import org.jboss.soa.esb.util.*;
import org.jboss.soa.esb.helpers.persist.*;
+import org.jboss.soa.esb.internal.core.objectstore.*;
import org.jboss.soa.esb.common.bizclasses.*;
-import org.jboss.soa.esb.services.dbtables.*;
/**
* @ejb.bean
* name="JbossEsbBatchHandler"
@@ -148,7 +148,7 @@
} //__________________________________
private void doCommitBatch(BatchProcess p_oBP) throws Exception
- { Class oPrevClass = null;
+ { String sPrevClass = null;
BobjStore oStore = null;
PreparedStatement PSbatch = getDaoBatch(BobjStore.getBatchTableName())
@@ -162,31 +162,35 @@
ResultSet RS = m_oDataConn.execQueryWait(PSbatch,10);
while (RS.next())
{ String sXml = RS.getString(1+DaoBatchTable.STR_DATA);
- BaseBusinessObject oCurr = BaseBusinessObject.getFromDTO(BobjStdDTO.getFromXml(sXml));
+ BobjStdDTO oDto = BobjStdDTO.getFromXml(sXml);
// Get proper Dao's for Index and Snap table
- Class oNewClass = oCurr.getClass();
- if (! oNewClass.equals(oPrevClass))
- { oStore = BobjStore.getStore(oNewClass);
- oPrevClass = oNewClass;
+ String sNewClass = oDto.fullClassName();
+ if (! sNewClass.equals(sPrevClass))
+ { oStore = BobjStore.getStore(sNewClass);
+ sPrevClass = sNewClass;
m_oDaoIndex = null;
m_oDaoSnap = null;
}
// Set batch number to current batch
- oCurr.setBatchNum(p_oBP.getBatchNum());
- oCurr.setStamp (lNow);
- oCurr.setSnapDate(sSnapDt);
+ oDto.setBatch (p_oBP.getBatchNum());
+ oDto.setStamp (lNow);
+ oDto.setSnapDate(sSnapDt);
// Insert Snap row
PreparedStatement PSins = getDaoSnap(oStore).getPS(DaoSnapTable.PS_INS_SNAP);
- m_oDaoSnap.setInsValues(PSins,oCurr);
+ m_oDaoSnap.setInsValues(PSins,oDto);
try { m_oDataConn.execUpdWait(PSins,10); }
catch (Exception e) { m_oLogger.error(e.getMessage()); }
- // Insert Index row
- PSins = getDaoIndex(oStore.getLocatorTable()).getPS(DaoIndexTable.PS_INS_INDEX);
- m_oDaoIndex.setInsValues(PSins,oCurr);
- try { m_oDataConn.execUpdWait(PSins,10); }
- catch (Exception e) { m_oLogger.error(e.getMessage()); }
+ // Insert row in all index tables
+ String[][] saa = oDto.getLocators();
+ for (int i1=0; i1<saa.length; i1++)
+ { m_oDaoIndex = getDaoIndex(oStore.getLocatorTable(i1));
+ PSins = m_oDaoIndex.getPS(DaoIndexTable.PS_INS_INDEX);
+ m_oDaoIndex.setInsValues(PSins,oDto,i1);
+ try { m_oDataConn.execUpdWait(PSins,10); }
+ catch (Exception e) { m_oLogger.error(e.getMessage()); }
+ }
}
PSbatch.close();
@@ -200,7 +204,7 @@
p_oBP.setStamp (lNow);
p_oBP.setSnapDate(sSnapDt);
- oStore = BobjStore.getStore(BatchProcess.class);
+ oStore = BobjStore.getStore(BatchProcess.class.getName());
// Update snap table with proper timestamp
m_oDaoSnap = null;
@@ -220,6 +224,7 @@
// Public local and remote interface methods
/**
* @ejb.interface-method
+ * view-type="both"
*/
public long newBatch() throws Exception
{ if (m_lBatchNum > 0) throw
@@ -237,6 +242,7 @@
/**
* @ejb.interface-method
+ * view-type="both"
* @return
*/
public long getBatchNum()
@@ -245,6 +251,7 @@
/**
* @ejb.interface-method
+ * view-type="both"
* @param p_s
* @return
* @throws Exception
@@ -272,6 +279,7 @@
} //__________________________________
/**
* @ejb.interface-method
+ * view-type="both"
* @throws Exception
*/
public void finish() throws Exception
@@ -301,7 +309,7 @@
// Public remote interface methods
/**
* @ejb.interface-method
- * view-type="remote"
+ * view-type="both"
*/
public void commitBatch(BobjStdDTO p_oDto) throws Exception
{ commitBatch (new BatchProcess(p_oDto));
Modified: labs/jbossesb/trunk/ESBCore/services/src/org/jboss/soa/esb/services/EJB/JbossEsbBatchHandlerHome.java
===================================================================
--- labs/jbossesb/trunk/ESBCore/services/src/org/jboss/soa/esb/services/EJB/JbossEsbBatchHandlerHome.java 2006-07-16 00:25:35 UTC (rev 5117)
+++ labs/jbossesb/trunk/ESBCore/services/src/org/jboss/soa/esb/services/EJB/JbossEsbBatchHandlerHome.java 2006-07-16 20:25:04 UTC (rev 5118)
@@ -5,7 +5,7 @@
/**
* Home interface for JbossEsbBatchHandler.
- * @xdoclet-generated at July 4 2006
+ * @xdoclet-generated at July 12 2006
* @copyright The XDoclet Team
* @author XDoclet
* @version ${version}
Modified: labs/jbossesb/trunk/ESBCore/services/src/org/jboss/soa/esb/services/EJB/JbossEsbBatchHandlerLocal.java
===================================================================
--- labs/jbossesb/trunk/ESBCore/services/src/org/jboss/soa/esb/services/EJB/JbossEsbBatchHandlerLocal.java 2006-07-16 00:25:35 UTC (rev 5117)
+++ labs/jbossesb/trunk/ESBCore/services/src/org/jboss/soa/esb/services/EJB/JbossEsbBatchHandlerLocal.java 2006-07-16 20:25:04 UTC (rev 5118)
@@ -5,7 +5,7 @@
/**
* Local interface for JbossEsbBatchHandler.
- * @xdoclet-generated at July 4 2006
+ * @xdoclet-generated at July 12 2006
* @copyright The XDoclet Team
* @author XDoclet
* @version ${version}
@@ -24,4 +24,6 @@
public void commitBatch( org.jboss.soa.esb.common.bizclasses.BatchProcess p_oBO ) throws java.lang.Exception;
+ public void commitBatch( org.jboss.soa.esb.util.BobjStdDTO p_oDto ) throws java.lang.Exception;
+
}
Modified: labs/jbossesb/trunk/ESBCore/services/src/org/jboss/soa/esb/services/EJB/JbossEsbBatchHandlerLocalHome.java
===================================================================
--- labs/jbossesb/trunk/ESBCore/services/src/org/jboss/soa/esb/services/EJB/JbossEsbBatchHandlerLocalHome.java 2006-07-16 00:25:35 UTC (rev 5117)
+++ labs/jbossesb/trunk/ESBCore/services/src/org/jboss/soa/esb/services/EJB/JbossEsbBatchHandlerLocalHome.java 2006-07-16 20:25:04 UTC (rev 5118)
@@ -5,7 +5,7 @@
/**
* Local home interface for JbossEsbBatchHandler.
- * @xdoclet-generated at July 4 2006
+ * @xdoclet-generated at July 12 2006
* @copyright The XDoclet Team
* @author XDoclet
* @version ${version}
Modified: labs/jbossesb/trunk/ESBCore/services/src/org/jboss/soa/esb/services/EJB/JbossEsbNotificationHandler.java
===================================================================
--- labs/jbossesb/trunk/ESBCore/services/src/org/jboss/soa/esb/services/EJB/JbossEsbNotificationHandler.java 2006-07-16 00:25:35 UTC (rev 5117)
+++ labs/jbossesb/trunk/ESBCore/services/src/org/jboss/soa/esb/services/EJB/JbossEsbNotificationHandler.java 2006-07-16 20:25:04 UTC (rev 5118)
@@ -5,7 +5,7 @@
/**
* Remote interface for JbossEsbNotificationHandler.
- * @xdoclet-generated at July 4 2006
+ * @xdoclet-generated at July 5 2006
* @copyright The XDoclet Team
* @author XDoclet
* @version ${version}
Modified: labs/jbossesb/trunk/ESBCore/services/src/org/jboss/soa/esb/services/EJB/JbossEsbNotificationHandlerHome.java
===================================================================
--- labs/jbossesb/trunk/ESBCore/services/src/org/jboss/soa/esb/services/EJB/JbossEsbNotificationHandlerHome.java 2006-07-16 00:25:35 UTC (rev 5117)
+++ labs/jbossesb/trunk/ESBCore/services/src/org/jboss/soa/esb/services/EJB/JbossEsbNotificationHandlerHome.java 2006-07-16 20:25:04 UTC (rev 5118)
@@ -5,7 +5,7 @@
/**
* Home interface for JbossEsbNotificationHandler.
- * @xdoclet-generated at July 4 2006
+ * @xdoclet-generated at July 5 2006
* @copyright The XDoclet Team
* @author XDoclet
* @version ${version}
Modified: labs/jbossesb/trunk/ESBCore/services/src/org/jboss/soa/esb/services/EJB/JbossEsbNotificationHandlerLocal.java
===================================================================
--- labs/jbossesb/trunk/ESBCore/services/src/org/jboss/soa/esb/services/EJB/JbossEsbNotificationHandlerLocal.java 2006-07-16 00:25:35 UTC (rev 5117)
+++ labs/jbossesb/trunk/ESBCore/services/src/org/jboss/soa/esb/services/EJB/JbossEsbNotificationHandlerLocal.java 2006-07-16 20:25:04 UTC (rev 5118)
@@ -5,7 +5,7 @@
/**
* Local interface for JbossEsbNotificationHandler.
- * @xdoclet-generated at July 4 2006
+ * @xdoclet-generated at July 5 2006
* @copyright The XDoclet Team
* @author XDoclet
* @version ${version}
Modified: labs/jbossesb/trunk/ESBCore/services/src/org/jboss/soa/esb/services/EJB/JbossEsbNotificationHandlerLocalHome.java
===================================================================
--- labs/jbossesb/trunk/ESBCore/services/src/org/jboss/soa/esb/services/EJB/JbossEsbNotificationHandlerLocalHome.java 2006-07-16 00:25:35 UTC (rev 5117)
+++ labs/jbossesb/trunk/ESBCore/services/src/org/jboss/soa/esb/services/EJB/JbossEsbNotificationHandlerLocalHome.java 2006-07-16 20:25:04 UTC (rev 5118)
@@ -5,7 +5,7 @@
/**
* Local home interface for JbossEsbNotificationHandler.
- * @xdoclet-generated at July 4 2006
+ * @xdoclet-generated at July 5 2006
* @copyright The XDoclet Team
* @author XDoclet
* @version ${version}
Modified: labs/jbossesb/trunk/ESBCore/services/src/org/jboss/soa/esb/services/EJB/JbossEsbPersistHandler.java
===================================================================
--- labs/jbossesb/trunk/ESBCore/services/src/org/jboss/soa/esb/services/EJB/JbossEsbPersistHandler.java 2006-07-16 00:25:35 UTC (rev 5117)
+++ labs/jbossesb/trunk/ESBCore/services/src/org/jboss/soa/esb/services/EJB/JbossEsbPersistHandler.java 2006-07-16 20:25:04 UTC (rev 5118)
@@ -5,7 +5,7 @@
/**
* Remote interface for JbossEsbPersistHandler.
- * @xdoclet-generated at July 4 2006
+ * @xdoclet-generated at July 12 2006
* @copyright The XDoclet Team
* @author XDoclet
* @version ${version}
@@ -17,13 +17,13 @@
public long getUidChunk( int p_iQ )
throws java.lang.Exception, java.rmi.RemoteException;
- public void rmvObject( java.lang.Class pCls,long p_lUid )
+ public void rmvObject( java.lang.String p_sClassName,long p_lUid )
throws java.lang.Exception, java.rmi.RemoteException;
public long addDTO( org.jboss.soa.esb.util.BobjStdDTO p_oDto )
throws java.lang.Exception, java.rmi.RemoteException;
- public org.jboss.soa.esb.util.BobjStdDTO getDTO( java.lang.Class pCls,long p_lUid )
+ public org.jboss.soa.esb.util.BobjStdDTO getDTO( java.lang.String p_sClassName,long p_lUid )
throws java.lang.Exception, java.rmi.RemoteException;
public void rplDTO( org.jboss.soa.esb.util.BobjStdDTO p_oDto )
Modified: labs/jbossesb/trunk/ESBCore/services/src/org/jboss/soa/esb/services/EJB/JbossEsbPersistHandlerBean.java
===================================================================
--- labs/jbossesb/trunk/ESBCore/services/src/org/jboss/soa/esb/services/EJB/JbossEsbPersistHandlerBean.java 2006-07-16 00:25:35 UTC (rev 5117)
+++ labs/jbossesb/trunk/ESBCore/services/src/org/jboss/soa/esb/services/EJB/JbossEsbPersistHandlerBean.java 2006-07-16 20:25:04 UTC (rev 5118)
@@ -28,12 +28,13 @@
import javax.naming.*;
import java.sql.*;
import javax.sql.*;
+
import java.text.*;
import java.io.*;
import org.jboss.soa.esb.util.*;
import org.jboss.soa.esb.helpers.persist.*;
-import org.jboss.soa.esb.services.dbtables.*;
+import org.jboss.soa.esb.internal.core.objectstore.*;
import org.apache.log4j.*;
@@ -46,11 +47,7 @@
* jndi-name="JbossEsbPersistHandler"
* local-jndi-name="JbossEsbPersistHandlerLocal"
* transaction-type="Bean"
- * @ejb.env-entry
- * name="datasource"
- * type="java.lang.String"
- * value="java:RosettaDS"
- * @author Administrator
+ * @author Esteban
*/
public class JbossEsbPersistHandlerBean implements SessionBean
{
@@ -67,7 +64,7 @@
private DaoUidTable m_oDaoUid;
private DaoSnapTable m_oDaoSnap;
- private DaoIndexTable m_oDaoIndex;
+ private DaoIndexTable[] m_oaDaoIndex;
public void ejbActivate() {}
public void ejbPassivate() {}
@@ -81,8 +78,10 @@
{ try
{ m_oLogger = EsbUtil.getDefaultLogger(this.getClass());
Context oCtxInit = new InitialContext();
- m_oUidConn = new JdbcCleanConn((DataSource) oCtxInit.lookup("java:RosettaDS"));
- m_oDataConn = new JdbcCleanConn((DataSource) oCtxInit.lookup("java:RosettaDS"));
+ String sDSjndiName = BobjStore.getDataSourceJndi();
+ DataSource oDS = (DataSource)oCtxInit.lookup(sDSjndiName);
+ m_oUidConn = new JdbcCleanConn(oDS);
+ m_oDataConn = new JdbcCleanConn(oDS);
Class oCls = Class.forName("org.jboss.soa.esb.util.BobjStdDTO");
ObjectStreamClass XX = ObjectStreamClass.lookup(oCls);
@@ -115,58 +114,72 @@
return m_oDaoSnap;
} //__________________________________
- private DaoIndexTable getDaoIndex(BobjStore p_oSt) throws Exception
- { if (null==m_oDaoIndex)
- m_oDaoIndex = new DaoIndexTable(m_oDataConn,p_oSt.getLocatorTable());
- return m_oDaoIndex;
+ private DaoIndexTable getDaoIndex(BobjStore p_oSt,int p_i) throws Exception
+ { if (null==m_oaDaoIndex)
+ m_oaDaoIndex = new DaoIndexTable[p_oSt.allLocatorTables().length];
+ if (null==m_oaDaoIndex[p_i])
+ m_oaDaoIndex[p_i] = new DaoIndexTable(m_oDataConn,p_oSt.getLocatorTable(p_i));
+ return m_oaDaoIndex[p_i];
} //__________________________________
- protected ObjLocator doAddLocator(BaseBusinessObject p_oBO) throws Exception
- { long lUid = p_oBO.getUid();
+ protected ObjLocator[] doAddLocators(BobjStore pStore,BobjStdDTO p_oDto) throws Exception
+ { long lUid = p_oDto.getUid();
if (lUid < 1)
{ lUid = doAssignUid();
- p_oBO.setUid(lUid);
- p_oBO.setSnap(lUid);
+ p_oDto.setUid(lUid);
+ p_oDto.setSnap(lUid);
}
- ObjLocator oLoc = p_oBO.getObjLocator();
-
- BobjStore oSt = BobjStore.getStore(p_oBO);
- String sTbl = oSt.getLocatorTable();
- if (null == sTbl) return oLoc;
-
- DaoIndexTable oDao = new DaoIndexTable(m_oDataConn,sTbl);
- PreparedStatement PS = oDao.getPS(DaoIndexTable.PS_INS_INDEX);
-
- PS.setLong (DaoIndexTable.OBJECT_UID,lUid);
- long lStamp = p_oBO.getStamp();
- PS.setLong (DaoIndexTable.TIMESTAMP,lStamp);
- PS.setLong (DaoIndexTable.UID_SNAP,p_oBO.getSnap());
- PS.setString (DaoIndexTable.SNAP_DATE,s_oY4md.format(new Date(lStamp)));
-
- String[] sa = oLoc.getStrings();
- int iFld = DaoIndexTable.FIRST_FIELD;
- for (int i1=0; i1<sa.length;i1++)
- { String sCurr = sa[i1];
- PS.setString(iFld++,(null == sCurr)?"":sCurr);
+ long lStamp = p_oDto.getStamp();
+ if (lStamp < 1)
+ p_oDto.setStamp(lStamp = System.currentTimeMillis());
+
+ String[][] saa = p_oDto.getLocators();
+ ObjLocator[]oaRet = new ObjLocator[saa.length];
+ int iCurr = 0;
+ for (int i1=0; i1<saa.length; i1++)
+ { String[] saCurr = saa[i1];
+ ObjLocator oLoc = new ObjLocator(lUid,saCurr);
+ oaRet[iCurr] = oLoc;
+ String sTbl = pStore.getLocatorTable(iCurr++);
+ if (null == sTbl)
+ continue;
+
+ DaoIndexTable oDao = new DaoIndexTable(m_oDataConn,sTbl);
+ PreparedStatement PS = oDao.getPS(DaoIndexTable.PS_INS_INDEX);
+
+ PS.setLong (DaoIndexTable.OBJECT_UID,lUid);
+ PS.setLong (DaoIndexTable.TIMESTAMP,lStamp);
+ PS.setLong (DaoIndexTable.UID_SNAP,p_oDto.getSnap());
+ PS.setString (DaoIndexTable.SNAP_DATE,s_oY4md.format(new Date(lStamp)));
+
+ int iFld = DaoIndexTable.FIRST_FIELD;
+ for (int i2=0; i2<saCurr.length; i2++)
+ { String sFldVal = saCurr[i2];
+ PS.setString(iFld++,(null == sFldVal)?"":sFldVal);
+ }
+ m_oDataConn.execUpdWait(PS,1);
}
- m_oDataConn.execUpdWait(PS,1);
- return oLoc;
+ return oaRet;
} //__________________________________
- private void doDelLocator (BobjStore p_oSt, long p_lUid)
- { if (p_lUid < 1) return;try
- { PreparedStatement PS = getDaoIndex(p_oSt).getPS(DaoIndexTable.PS_RMV_INDEX);
- PS.setLong(1,p_lUid);
- m_oDataConn.execQueryWait(PS,5);
- }
- catch (Exception e)
- { m_oLogger.warn("doDelLocator() FAILED <"+e.getMessage()+">");
- }
+ private void doDelLocators (BobjStore p_oSt, long p_lUid)
+ { if (p_lUid < 1) return;
+ int iQlocs = p_oSt.allLocatorTables().length;
+ for (int i1=0; i1<iQlocs; i1++)
+ try
+ { PreparedStatement PS = getDaoIndex(p_oSt,i1).getPS(DaoIndexTable.PS_RMV_INDEX);
+ PS.setLong(1,p_lUid);
+ m_oDataConn.execQueryWait(PS,5);
+ }
+ catch (Exception e)
+ { m_oLogger.warn("doDelLocator() FAILED <"+e.getMessage()+">");
+ }
} //__________________________________
private void doDelOneSnap (BobjStore p_oSt,long p_lUid) throws Exception
- { if (p_lUid < 1) return;PreparedStatement PS = getDaoSnap(p_oSt).getPS(DaoSnapTable.PS_RMV_SNAP);
+ { if (p_lUid < 1) return;
+ PreparedStatement PS = getDaoSnap(p_oSt).getPS(DaoSnapTable.PS_RMV_SNAP);
PS.setLong(1,p_lUid);
m_oDataConn.execQueryWait(PS,5);
} //__________________________________
@@ -180,60 +193,66 @@
long lObjUid = rs.getLong(DaoSnapTable.OBJECT_UID);
doDelOneSnap(p_oSt,p_lUid);
- doDelLocator(p_oSt,lObjUid);
+ doDelLocators(p_oSt,lObjUid);
} //__________________________________
- private void doRplSnapshot(BaseBusinessObject p_oBo)
+ private void doRplSnapshot(BobjStdDTO p_oDto)
throws Exception
- { long lSnapUid = p_oBo.getSnap();
- BobjStore oSt = BobjStore.getStore(p_oBo);
+ { long lSnapUid = p_oDto.getSnap();
+ BobjStore oSt = BobjStore.getStore(p_oDto);
doDelOneSnap(oSt,lSnapUid);
- doDelLocator(oSt,p_oBo.getUid());
- doAddSnapshot(p_oBo,false);
+ doDelLocators(oSt,p_oDto.getUid());
+ doAddSnapshot(p_oDto,false);
} //__________________________________
- private long doAddSnapshot(BaseBusinessObject p_oBo)
+ private long doAddSnapshot(BobjStdDTO p_oDto)
throws Exception
- { return doAddSnapshot(p_oBo,true);
+ { return doAddSnapshot(p_oDto,true);
} //__________________________________
SimpleDateFormat s_oY4md = new SimpleDateFormat("yyyyMMdd");
- private long doAddSnapshot(BaseBusinessObject p_oBo, boolean p_bNewVrs)
+ private long doAddSnapshot(BobjStdDTO p_oDto, boolean p_bNewVrs)
throws Exception
- { long lObjUid = p_oBo.getUid();
- if (lObjUid < 1) p_oBo.setUid(lObjUid=doAssignUid());
- p_oBo.setSnap(lObjUid);
+ { long lObjUid = p_oDto.getUid();
+ if (lObjUid < 1) p_oDto.setUid(lObjUid=doAssignUid());
+ p_oDto.setSnap(lObjUid);
// Set Timestamp
long lNow = System.currentTimeMillis();
- p_oBo.setStamp(lNow);
- p_oBo.setSnapDate(s_oY4md.format(new Date(lNow)));
+ p_oDto.setStamp(lNow);
+ p_oDto.setSnapDate(s_oY4md.format(new Date(lNow)));
- BobjStore oSt = BobjStore.getStore(p_oBo);
+ BobjStore oSt = BobjStore.getStore(p_oDto);
PreparedStatement PS = getDaoSnap(oSt).getPS(DaoSnapTable.PS_INS_SNAP);
- getDaoSnap(oSt).setInsValues(PS,p_oBo);
+ getDaoSnap(oSt).setInsValues(PS,p_oDto);
m_oDataConn.execUpdWait(PS,1);
- PS = getDaoIndex(oSt).getPS(DaoIndexTable.PS_INS_INDEX);
- getDaoIndex(oSt).setInsValues(PS,p_oBo);
- try { m_oDataConn.execUpdWait(PS,1); }
- catch (Exception e)
- { PS = getDaoIndex(oSt).getPS(DaoIndexTable.PS_UPD_INDEX);
- getDaoIndex(oSt).setUpdValues(PS,p_oBo);
- m_oDataConn.execUpdWait(PS,10);
+ int iQlocs = oSt.allLocatorTables().length;
+ for (int i1=0; i1<iQlocs; i1++)
+ { DaoIndexTable oDao = getDaoIndex(oSt,i1);
+ PS = oDao.getPS(DaoIndexTable.PS_INS_INDEX);
+ oDao.setInsValues(PS,p_oDto);
+ try { m_oDataConn.execUpdWait(PS,1); }
+ catch (Exception e)
+ { PS = oDao.getPS(DaoIndexTable.PS_UPD_INDEX);
+ oDao.setUpdValues(PS,p_oDto);
+ m_oDataConn.execUpdWait(PS,10);
+ }
}
return lObjUid;
} //__________________________________
- protected void updateLocTbl(BaseBusinessObject p_oBo)
+ protected void updateLocTbl(BobjStdDTO p_oDto, int p_iNum)
throws Exception
- { BobjStore oSt = BobjStore.getStore(p_oBo);
- String sTbl = oSt.getLocatorTable();
- if (null==sTbl) return;PreparedStatement PSupd = getDaoIndex(oSt).getPS(DaoIndexTable.PS_UPD_INDEX);
- getDaoIndex(oSt).setUpdValues(PSupd, p_oBo);
+ { BobjStore oSt = BobjStore.getStore(p_oDto);
+ String sTbl = oSt.getLocatorTable(p_iNum);
+ if (null==sTbl) return;
+ DaoIndexTable oDao = getDaoIndex(oSt,p_iNum);
+ PreparedStatement PSupd = oDao.getPS(DaoIndexTable.PS_UPD_INDEX);
+ oDao.setUpdValues(PSupd, p_oDto);
m_oDataConn.execUpdWait(PSupd,10);
} //__________________________________
@@ -248,7 +267,10 @@
} //__________________________________
private void releaseResources()
- { m_oDaoIndex = null;
+ { if (null!=m_oaDaoIndex)
+ for (int i1=0; i1<m_oaDaoIndex.length; i1++)
+ m_oaDaoIndex[i1] = null;
+ m_oaDaoIndex = null;
m_oDaoSnap = null;
m_oDaoUid = null;
if (null != m_oDataConn) m_oDataConn.release();
@@ -268,6 +290,7 @@
// Public local and remote interface methods
/**
* @ejb.interface-method
+ * view-type="both"
*/
public long getUidChunk (int p_iQ) throws Exception
{ try { return getDaoUid().getUidChunk(DaoUidTable.SEQUENCE_OBJ,p_iQ); }
@@ -276,12 +299,13 @@
} //__________________________________
/**
* @ejb.interface-method
- * @param p_iStore
+ * view-type="both"
+ * @param p_sClassName
* @param p_lUid
* @throws Exception
*/
- public void rmvObject(Class pCls, long p_lUid) throws Exception
- { try { doRmvSnapshot(BobjStore.getStore(pCls), p_lUid); m_oDataConn.commit(); }
+ public void rmvObject(String p_sClassName, long p_lUid) throws Exception
+ { try { doRmvSnapshot(BobjStore.getStore(p_sClassName), p_lUid); m_oDataConn.commit(); }
catch (Exception e)
{ try { if (null != m_oDataConn) m_oDataConn.rollback(); }
catch (Exception eRoll) {}
@@ -290,81 +314,54 @@
finally { releaseResources(); }
} //__________________________________
-// Public local interface
/**
* @ejb.interface-method
- * view-type = "local"
+ * view-type="both"
*/
- public long addObject (BaseBusinessObject p_oBO) throws Exception
- { try
- { long lUid = doAddSnapshot (p_oBO);
- m_oDataConn.commit();
- return lUid;
- }
- catch (Exception e)
- { try { if (null != m_oDataConn) m_oDataConn.rollback(); }
- catch (Exception eRoll) {}
- throw e;
- }
- finally { releaseResources(); }
- } //__________________________________
-/**
- * @ejb.interface-method
- * view-type = "local"
- * @param p_iStore
- * @param p_lUid
- * @return
- * @throws Exception
- */
- public BaseBusinessObject getObject(Class pCls, long p_lUid) throws Exception
- { return BaseBusinessObject.getFromDTO(getDTO(pCls, p_lUid));
- } //__________________________________
-/**
- * @ejb.interface-method
- * view-type = "local"
- * @param p_o
- * @throws Exception
- */
- public void rplObject(BaseBusinessObject p_o) throws Exception
- { try { doRplSnapshot(p_o); m_oDataConn.commit(); }
- catch (Exception e)
- { try { if (null != m_oDataConn) m_oDataConn.rollback(); }
- catch (Exception eRoll) {}
- throw e;
- }
- finally { releaseResources(); }
- } //__________________________________
-
-// Public remote interface
-/**
- * @ejb.interface-method
- * view-type = "remote"
- */
public long addDTO(BobjStdDTO p_oDto) throws Exception
- { BaseBusinessObject oBO = BaseBusinessObject.getFromDTO(p_oDto);
- return addObject (oBO);
+ { try
+ { long lRet = doAddSnapshot(p_oDto);
+ m_oDataConn.commit();
+ return lRet;
+ }
+ catch (Exception e)
+ { try { if (null != m_oDataConn) m_oDataConn.rollback(); }
+ catch (Exception eRoll) {}
+ throw e;
+ }
+ finally { releaseResources(); }
} //__________________________________
/**
* @ejb.interface-method
- * view-type = "remote"
- * @param p_iStore
+ * view-type="both"
+ * @param p_sClassName - String Fully qualified name of class to be retrieved
* @param p_lUid
* @return
* @throws Exception
*/
- public BobjStdDTO getDTO (Class pCls, long p_lUid) throws Exception
- { try { return doGetSnapshot(BobjStore.getStore(pCls), p_lUid);}
+ public BobjStdDTO getDTO (String p_sClassName, long p_lUid) throws Exception
+ { try { return doGetSnapshot(BobjStore.getStore(p_sClassName), p_lUid);}
catch (Exception e) { throw e; }
finally { releaseResources(); }
} //__________________________________
/**
* @ejb.interface-method
- * view-type = "remote"
- * @param p_oDto
+ * view-type="both"
+ *
+ * @param p_oDto BobjStdDTO - Serialized BaseBusinessObject that has to be replaced
* @throws Exception
*/
public void rplDTO(BobjStdDTO p_oDto) throws Exception
- { rplObject(BaseBusinessObject.getFromDTO(p_oDto));
+ { try
+ { doRplSnapshot(p_oDto);
+ m_oDataConn.commit();
+ }
+ catch (Exception e)
+ { try { if (null != m_oDataConn) m_oDataConn.rollback(); }
+ catch (Exception eRoll) {}
+ throw e;
+ }
+ finally { releaseResources(); }
} //__________________________________
} //____________________________________________________________________________
Modified: labs/jbossesb/trunk/ESBCore/services/src/org/jboss/soa/esb/services/EJB/JbossEsbPersistHandlerHome.java
===================================================================
--- labs/jbossesb/trunk/ESBCore/services/src/org/jboss/soa/esb/services/EJB/JbossEsbPersistHandlerHome.java 2006-07-16 00:25:35 UTC (rev 5117)
+++ labs/jbossesb/trunk/ESBCore/services/src/org/jboss/soa/esb/services/EJB/JbossEsbPersistHandlerHome.java 2006-07-16 20:25:04 UTC (rev 5118)
@@ -5,7 +5,7 @@
/**
* Home interface for JbossEsbPersistHandler.
- * @xdoclet-generated at July 4 2006
+ * @xdoclet-generated at July 12 2006
* @copyright The XDoclet Team
* @author XDoclet
* @version ${version}
Modified: labs/jbossesb/trunk/ESBCore/services/src/org/jboss/soa/esb/services/EJB/JbossEsbPersistHandlerLocal.java
===================================================================
--- labs/jbossesb/trunk/ESBCore/services/src/org/jboss/soa/esb/services/EJB/JbossEsbPersistHandlerLocal.java 2006-07-16 00:25:35 UTC (rev 5117)
+++ labs/jbossesb/trunk/ESBCore/services/src/org/jboss/soa/esb/services/EJB/JbossEsbPersistHandlerLocal.java 2006-07-16 20:25:04 UTC (rev 5118)
@@ -5,7 +5,7 @@
/**
* Local interface for JbossEsbPersistHandler.
- * @xdoclet-generated at July 4 2006
+ * @xdoclet-generated at July 12 2006
* @copyright The XDoclet Team
* @author XDoclet
* @version ${version}
@@ -16,12 +16,12 @@
public long getUidChunk( int p_iQ ) throws java.lang.Exception;
- public void rmvObject( java.lang.Class pCls,long p_lUid ) throws java.lang.Exception;
+ public void rmvObject( java.lang.String p_sClassName,long p_lUid ) throws java.lang.Exception;
- public long addObject( org.jboss.soa.esb.util.BaseBusinessObject p_oBO ) throws java.lang.Exception;
+ public long addDTO( org.jboss.soa.esb.util.BobjStdDTO p_oDto ) throws java.lang.Exception;
- public org.jboss.soa.esb.util.BaseBusinessObject getObject( java.lang.Class pCls,long p_lUid ) throws java.lang.Exception;
+ public org.jboss.soa.esb.util.BobjStdDTO getDTO( java.lang.String p_sClassName,long p_lUid ) throws java.lang.Exception;
- public void rplObject( org.jboss.soa.esb.util.BaseBusinessObject p_o ) throws java.lang.Exception;
+ public void rplDTO( org.jboss.soa.esb.util.BobjStdDTO p_oDto ) throws java.lang.Exception;
}
Modified: labs/jbossesb/trunk/ESBCore/services/src/org/jboss/soa/esb/services/EJB/JbossEsbPersistHandlerLocalHome.java
===================================================================
--- labs/jbossesb/trunk/ESBCore/services/src/org/jboss/soa/esb/services/EJB/JbossEsbPersistHandlerLocalHome.java 2006-07-16 00:25:35 UTC (rev 5117)
+++ labs/jbossesb/trunk/ESBCore/services/src/org/jboss/soa/esb/services/EJB/JbossEsbPersistHandlerLocalHome.java 2006-07-16 20:25:04 UTC (rev 5118)
@@ -5,7 +5,7 @@
/**
* Local home interface for JbossEsbPersistHandler.
- * @xdoclet-generated at July 4 2006
+ * @xdoclet-generated at July 12 2006
* @copyright The XDoclet Team
* @author XDoclet
* @version ${version}
Modified: labs/jbossesb/trunk/ESBCore/services/src/org/jboss/soa/esb/services/PersistHandlerBsDelegateLocal.java
===================================================================
--- labs/jbossesb/trunk/ESBCore/services/src/org/jboss/soa/esb/services/PersistHandlerBsDelegateLocal.java 2006-07-16 00:25:35 UTC (rev 5117)
+++ labs/jbossesb/trunk/ESBCore/services/src/org/jboss/soa/esb/services/PersistHandlerBsDelegateLocal.java 2006-07-16 20:25:04 UTC (rev 5118)
@@ -47,21 +47,22 @@
{ return m_oSnapH.getUidChunk(p_iQ);
} //__________________________________
public long addObject (BobjStdDTO p_oDto) throws Exception
- { return m_oSnapH.addObject(BaseBusinessObject.getFromDTO(p_oDto));
+ { return m_oSnapH.addDTO(p_oDto);
} //__________________________________
public long addObject (BaseBusinessObject p_oBo) throws Exception
{ p_oBo.setPackage();
- return m_oSnapH.addObject(p_oBo);
+ return m_oSnapH.addDTO(p_oBo.toDTO());
} //__________________________________
public BaseBusinessObject getObject (Class p_oCls, long p_lUid) throws Exception
- { return m_oSnapH.getObject(p_oCls,p_lUid);
+ { BobjStdDTO oDto = m_oSnapH.getDTO(p_oCls.getName(), p_lUid);
+ return (null==oDto)?null:BaseBusinessObject.getFromDTO(oDto);
} //__________________________________
public void rmvObject (Class p_oCls, long p_lUid) throws Exception
- { m_oSnapH.rmvObject(p_oCls, p_lUid);
+ { m_oSnapH.rmvObject(p_oCls.getName(), p_lUid);
} //__________________________________
public void rplObject (BaseBusinessObject p_o) throws Exception
{ p_o.setPackage();
- m_oSnapH.rplObject(p_o);
+ m_oSnapH.rplDTO(p_o.toDTO());
} //__________________________________
public ObjLocator[] getLocatorList(Class p_oCls, Properties p_oProp)
{
Modified: labs/jbossesb/trunk/ESBCore/services/src/org/jboss/soa/esb/services/PersistHandlerBsDelegateRemote.java
===================================================================
--- labs/jbossesb/trunk/ESBCore/services/src/org/jboss/soa/esb/services/PersistHandlerBsDelegateRemote.java 2006-07-16 00:25:35 UTC (rev 5117)
+++ labs/jbossesb/trunk/ESBCore/services/src/org/jboss/soa/esb/services/PersistHandlerBsDelegateRemote.java 2006-07-16 20:25:04 UTC (rev 5118)
@@ -50,20 +50,24 @@
public long addObject (BaseBusinessObject p_oBo) throws Exception
{ if (null==p_oBo) return -1;
p_oBo.setPackage();
- return m_oSnapH.addDTO(p_oBo.toDTO());
+ BobjStdDTO oDto = p_oBo.toDTO();
+ oDto.setLocators(p_oBo.allLocators());
+ return m_oSnapH.addDTO(oDto);
} //__________________________________
public BaseBusinessObject getObject (Class p_oCls, long p_lUid) throws Exception
{
- BobjStdDTO oDto = m_oSnapH.getDTO(p_oCls, p_lUid);
+ BobjStdDTO oDto = m_oSnapH.getDTO(p_oCls.getName(), p_lUid);
return (null==oDto)?null:BaseBusinessObject.getFromDTO(oDto);
} //__________________________________
public void rmvObject (Class p_oCls, long p_lUid) throws Exception
- { m_oSnapH.rmvObject(p_oCls, p_lUid);
+ { m_oSnapH.rmvObject(p_oCls.getName(), p_lUid);
} //__________________________________
- public void rplObject (BaseBusinessObject p_o) throws Exception
- { if (null==p_o) return;
- p_o.setPackage();
- m_oSnapH.rplDTO(p_o.toDTO());
+ public void rplObject (BaseBusinessObject p_oBo) throws Exception
+ { if (null==p_oBo) return;
+ p_oBo.setPackage();
+ BobjStdDTO oDto = p_oBo.toDTO();
+ oDto.setLocators(p_oBo.allLocators());
+ m_oSnapH.rplDTO(oDto);
} //__________________________________
public ObjLocator[] getLocatorList(Class p_oCls, Properties p_oProp)
Modified: labs/jbossesb/trunk/ESBCore/services/src/org/jboss/soa/esb/services/msglistener/AbstractEsbMsgDrivenBean.java
===================================================================
--- labs/jbossesb/trunk/ESBCore/services/src/org/jboss/soa/esb/services/msglistener/AbstractEsbMsgDrivenBean.java 2006-07-16 00:25:35 UTC (rev 5117)
+++ labs/jbossesb/trunk/ESBCore/services/src/org/jboss/soa/esb/services/msglistener/AbstractEsbMsgDrivenBean.java 2006-07-16 20:25:04 UTC (rev 5118)
@@ -244,7 +244,7 @@
= EsbSysProps.getParamsReposFactoryClass();
ParamsRepository oRep
= ParamsReposUtil.reposFromFactory(sFactoryClass,null);
- return oRep.getElement(ParamsReposUtil.nameFromString(p_sKey));
+ return oRep.getElement(oRep.nameFromString(p_sKey));
} //__________________________________
Modified: labs/jbossesb/trunk/build.xml
===================================================================
--- labs/jbossesb/trunk/build.xml 2006-07-16 00:25:35 UTC (rev 5117)
+++ labs/jbossesb/trunk/build.xml 2006-07-16 20:25:04 UTC (rev 5118)
@@ -13,6 +13,10 @@
<!-- 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}/lib"/>
+
<!-- Load Build Properties File -->
<property file="${org.jboss.esb.properties}"/>
@@ -52,8 +56,6 @@
<!-- 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 -->
@@ -78,15 +80,7 @@
<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 -->
+ <!-- javadocs paths -->
<path id="org.jboss.esb.javadocs.path">
<pathelement path="ESBCore/classes"/>
</path>
@@ -156,7 +150,7 @@
<target name="org.jboss.esb.clean">
<echo message="Cleaning modules"/>
- <echo message="Cleaning ESBCore"/>
+ <echo message="Compiling modules"/>
<ant dir="ESBCore" target="clean"/>
</target>
@@ -172,8 +166,7 @@
<!-- 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="jar" depends="org.jboss.esb.jar"/>
<target name="clean" depends="org.jboss.esb.clean"/>
<target name="purge" depends="org.jboss.esb.purge"/>
</project>
Modified: labs/jbossesb/trunk/docs/Install/conf/jbossEsb.properties
===================================================================
--- labs/jbossesb/trunk/docs/Install/conf/jbossEsb.properties 2006-07-16 00:25:35 UTC (rev 5117)
+++ labs/jbossesb/trunk/docs/Install/conf/jbossEsb.properties 2006-07-16 20:25:04 UTC (rev 5118)
@@ -36,4 +36,4 @@
#
# Object Store Settings
#
-jbossEsb.objStore.configfile=E:/Projects/JBoss/ESB/EsbServices/src/org/jboss/soa/esb/services/dbtables/ObjStoreExample.xml
\ No newline at end of file
+jbossEsb.objStore.configfile=/mypath/.../ObjStoreExample.xml
\ No newline at end of file
Deleted: labs/jbossesb/trunk/docs/JBossESB Getting Started Guide.doc
===================================================================
(Binary files differ)
Copied: labs/jbossesb/trunk/docs/JBossESB Getting Started Guide.rtf (from rev 5096, labs/jbossesb/trunk/docs/JBossESB Getting Started Guide.rtf)
Modified: labs/jbossesb/trunk/docs/samples/TestJBossESB/conf/ObjStoreExample.xml
===================================================================
--- labs/jbossesb/trunk/docs/samples/TestJBossESB/conf/ObjStoreExample.xml 2006-07-16 00:25:35 UTC (rev 5117)
+++ labs/jbossesb/trunk/docs/samples/TestJBossESB/conf/ObjStoreExample.xml 2006-07-16 20:25:04 UTC (rev 5118)
@@ -1,12 +1,19 @@
-<ObjectStore
+<ObjectStore
+ dataSourceJndiName="java:JbossEsbDS"
uidTable="uid_table"
- batchTable="batches"
->
+ batchTable="batches" >
+
<Class name="org.jboss.soa.esb.common.bizclasses.Person"
table="object_snap"
type="Person"
- encrypt="false"
- >
+ encrypt="false" >
<Index table="people_index" />
</Class>
+
+ <Class name="org.jboss.soa.esb.samples.Customer"
+ table="object_snap"
+ type="Customer"
+ encrypt="false" >
+ <Index table="customer_index" />
+ </Class>
</ObjectStore>
Deleted: labs/jbossesb/trunk/lib/ext/junit.jar
===================================================================
(Binary files differ)
More information about the jboss-svn-commits
mailing list