[jboss-svn-commits] JBL Code SVN: r7236 - in labs/jbossesb/trunk: product/core/services/src/org/jboss/soa/esb product/core/services/src/org/jboss/soa/esb/services product/core/services/src/org/jboss/soa/esb/services/beans product/core/services/tests/src/org/jboss/soa/esb product/core/services/tests/src/org/jboss/soa/esb/services/beans product/samples/trailblazer2/esb/lib/ext qa qa/junit/src/org/jboss/soa/esb/objpersist
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Mon Oct 30 14:25:32 EST 2006
Author: daniel.brum at jboss.com
Date: 2006-10-30 14:25:11 -0500 (Mon, 30 Oct 2006)
New Revision: 7236
Added:
labs/jbossesb/trunk/product/samples/trailblazer2/esb/lib/ext/hsqldb.jar
Removed:
labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/internal/
labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/services/BatchHandlerBsDelegateLocal.java
labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/services/BatchHandlerBsDelegateRemote.java
labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/services/BatchHandlerFactory.java
labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/services/PersistHandlerBsDelegateLocal.java
labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/services/PersistHandlerBsDelegateRemote.java
labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/services/PersistHandlerFactory.java
labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/services/beans/BatchHandler.java
labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/services/beans/BatchHandlerBean.java
labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/services/beans/PersistHandler.java
labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/services/beans/PersistHandlerBean.java
labs/jbossesb/trunk/product/core/services/tests/src/org/jboss/soa/esb/internal/
labs/jbossesb/trunk/product/core/services/tests/src/org/jboss/soa/esb/services/beans/PersistHandlerUnitTest.java
labs/jbossesb/trunk/qa/junit/src/org/jboss/soa/esb/objpersist/ObjStore_brokentest.java
labs/jbossesb/trunk/qa/junit/src/org/jboss/soa/esb/objpersist/TestPersonAddrPhone.java
Modified:
labs/jbossesb/trunk/qa/jbossesb-unittest-properties.xml
Log:
Deleted: labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/services/BatchHandlerBsDelegateLocal.java
===================================================================
--- labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/services/BatchHandlerBsDelegateLocal.java 2006-10-30 17:19:28 UTC (rev 7235)
+++ labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/services/BatchHandlerBsDelegateLocal.java 2006-10-30 19:25:11 UTC (rev 7236)
@@ -1,58 +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.services;
-
-import javax.naming.Context;
-
-import org.jboss.soa.esb.common.bizclasses.BatchProcess;
-import org.jboss.soa.esb.services.beans.BatchHandler;
-
-public class BatchHandlerBsDelegateLocal implements BatchManager
-{
- private BatchHandler m_oBatchH;
-
- public BatchHandlerBsDelegateLocal(Context p_ctx) throws Exception
- {
- m_oBatchH = (BatchHandler) p_ctx.lookup("jbossesb-appl/NotificationHandlerBean/local");
- m_oBatchH.create();
- }
-
- public long newBatch() throws Exception
- {
- return m_oBatchH.newBatch();
- }
-
- public int addToBatch(String p_s) throws Exception
- {
- return m_oBatchH.addToBatch(p_s);
- }
-
- public void finish() throws Exception
- {
- m_oBatchH.finish();
- }
-
- public void commitBatch(BatchProcess p_oBP) throws Exception
- {
- m_oBatchH.commitBatch(p_oBP.toDTO());
- }
-}
Deleted: labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/services/BatchHandlerBsDelegateRemote.java
===================================================================
--- labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/services/BatchHandlerBsDelegateRemote.java 2006-10-30 17:19:28 UTC (rev 7235)
+++ labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/services/BatchHandlerBsDelegateRemote.java 2006-10-30 19:25:11 UTC (rev 7236)
@@ -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.services;
-
-import javax.naming.Context;
-
-import org.jboss.soa.esb.common.bizclasses.BatchProcess;
-import org.jboss.soa.esb.services.beans.BatchHandler;
-
-public class BatchHandlerBsDelegateRemote implements BatchManager
-{
- private BatchHandler m_oBatchH;
-
- public BatchHandlerBsDelegateRemote(Context p_ctx) throws Exception {
- m_oBatchH = (BatchHandler) p_ctx
- .lookup("jbossesb-appl/NotificationHandlerBean/remote");
- m_oBatchH.create();
- }
-
- public long newBatch() throws Exception {
- return m_oBatchH.newBatch();
- }
-
- public int addToBatch(String p_s) throws Exception {
- return m_oBatchH.addToBatch(p_s);
- }
-
- public void finish() throws Exception {
- m_oBatchH.finish();
- }
-
- public void commitBatch(BatchProcess p_oBP) throws Exception {
- m_oBatchH.commitBatch(p_oBP.toDTO());
- }
-}
Deleted: labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/services/BatchHandlerFactory.java
===================================================================
--- labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/services/BatchHandlerFactory.java 2006-10-30 17:19:28 UTC (rev 7235)
+++ labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/services/BatchHandlerFactory.java 2006-10-30 19:25:11 UTC (rev 7236)
@@ -1,61 +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.services;
-
-import java.util.Arrays;
-
-import javax.naming.Context;
-import javax.naming.InitialContext;
-
-import org.jboss.soa.esb.helpers.AppServerContext;
-
-public class BatchHandlerFactory
-{
- private static final String [] s_saTypes = {"local","remote","mock"};
- private final static int LCL=0;
- private final static int REM=1;
- private final static int MOK=2;
-
- public static BatchManager getBatchHandler(String p_sLocRem,
- String p_sJndiType, String p_sJndiServer) throws Exception
- {
- int iIndex = Arrays.binarySearch(s_saTypes, p_sLocRem.toLowerCase());
- if (iIndex < 0)
- return null;
- switch (iIndex) {
- case LCL:
- return new BatchHandlerBsDelegateLocal(new InitialContext());
- case REM:
- return getBatchHandler(AppServerContext.getServerContext(
- p_sJndiType, p_sJndiServer));
- case MOK:
- return null; //return new MockBatchHandler()
- }
- throw new Exception("Invalid Batch Handler Delegate <" + p_sLocRem + ">");
- }
-
- public static BatchManager getBatchHandler(Context p_oCtx)
- throws Exception
- {
- return new BatchHandlerBsDelegateRemote(p_oCtx);
- }
-}
Deleted: labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/services/PersistHandlerBsDelegateLocal.java
===================================================================
--- labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/services/PersistHandlerBsDelegateLocal.java 2006-10-30 17:19:28 UTC (rev 7235)
+++ labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/services/PersistHandlerBsDelegateLocal.java 2006-10-30 19:25:11 UTC (rev 7236)
@@ -1,80 +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.services;
-
-import java.util.Properties;
-
-import javax.naming.Context;
-
-import org.jboss.soa.esb.services.beans.PersistHandler;
-import org.jboss.soa.esb.util.BaseBusinessObject;
-import org.jboss.soa.esb.util.BobjStdDTO;
-import org.jboss.soa.esb.util.ObjLocator;
-
-
-public class PersistHandlerBsDelegateLocal implements PersistManager
-{
- private PersistHandler m_oSnapH;
-
- public PersistHandlerBsDelegateLocal(Context p_ctx) throws Exception {
- m_oSnapH = (PersistHandler) p_ctx.lookup("jbossesb-appl/PersistHandlerBean/local");
- m_oSnapH.create();
- }
-
- public long getUidChunk(int p_iQ) throws Exception {
- return m_oSnapH.getUidChunk(p_iQ);
- }
-
- public long addObject(BobjStdDTO p_oDto) throws Exception {
- return m_oSnapH.addDTO(p_oDto);
- }
-
- public long addObject(BaseBusinessObject p_oBo) throws Exception {
- p_oBo.setPackage();
- return m_oSnapH.addDTO(p_oBo.toDTO());
- }
-
- public BaseBusinessObject getObject(Class p_oCls, long p_lUid)
- throws Exception {
- 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.getName(), p_lUid);
- }
-
- public void rplObject(BaseBusinessObject p_o) throws Exception {
- p_o.setPackage();
- m_oSnapH.rplDTO(p_o.toDTO());
- }
-
- public ObjLocator[] getLocatorList(Class p_oCls, Properties p_oProp) {
- return null;
- } //__________________________________
-
- public ObjLocator[] getLocatorList(Class p_oCls, long[] p_laUids) {
- return null;
- } //__________________________________
-} //____________________________________________________________________________
Deleted: labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/services/PersistHandlerBsDelegateRemote.java
===================================================================
--- labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/services/PersistHandlerBsDelegateRemote.java 2006-10-30 17:19:28 UTC (rev 7235)
+++ labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/services/PersistHandlerBsDelegateRemote.java 2006-10-30 19:25:11 UTC (rev 7236)
@@ -1,88 +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.services;
-
-import java.util.Properties;
-
-import javax.naming.Context;
-
-import org.jboss.soa.esb.services.beans.PersistHandler;
-import org.jboss.soa.esb.util.BaseBusinessObject;
-import org.jboss.soa.esb.util.BobjStdDTO;
-import org.jboss.soa.esb.util.ObjLocator;
-
-
-public class PersistHandlerBsDelegateRemote implements PersistManager
-{
- private PersistHandler m_oSnapH;
-
- public PersistHandlerBsDelegateRemote(Context p_ctx) throws Exception
- {
- m_oSnapH = (PersistHandler) p_ctx.lookup("jbossesb-appl/PersistHandlerBean/remote");
- m_oSnapH.create();
- }
-
- public long getUidChunk(int p_iQ) throws Exception
- {
- return m_oSnapH.getUidChunk(p_iQ);
- }
-
- public long addObject (BaseBusinessObject p_oBo) throws Exception
- {
- if (null==p_oBo) return -1;
- p_oBo.setPackage();
- 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.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.getName(), p_lUid);
- }
-
- 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)
- {
- return null;
- } //__________________________________
-
- public ObjLocator[] getLocatorList(Class p_oCls, long[] p_laUids)
- {
- return null;
- } //__________________________________
-} //____________________________________________________________________________
Deleted: labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/services/PersistHandlerFactory.java
===================================================================
--- labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/services/PersistHandlerFactory.java 2006-10-30 17:19:28 UTC (rev 7235)
+++ labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/services/PersistHandlerFactory.java 2006-10-30 19:25:11 UTC (rev 7236)
@@ -1,59 +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.services;
-
-import java.util.Arrays;
-
-import javax.naming.Context;
-import javax.naming.InitialContext;
-
-import org.jboss.soa.esb.helpers.AppServerContext;
-
-public class PersistHandlerFactory
-{
- private static final String [] s_saTypes = {"local","remote","mock"};
- private final static int LCL=0;
- private final static int REM=1;
- private final static int MOK=2;
-
- public static PersistManager getPersistHandler
- (String p_sLocRem, String p_sJndiType, String p_sJndiServer) throws Exception
- {
- int iIndex = Arrays.binarySearch(s_saTypes,p_sLocRem.toLowerCase());
- if (iIndex < 0) return null;
- switch (iIndex)
- {
- case LCL: return new PersistHandlerBsDelegateLocal(new InitialContext());
- case REM: return getPersistHandler
- (AppServerContext.getServerContext(p_sJndiType,p_sJndiServer));
- case MOK: return null; //new MockPersistHandler();
- }
- throw new Exception("Invalid Persist Handler Delegate <" + p_sLocRem + ">");
- }
-
- public static PersistManager getPersistHandler(Context p_oCtx) throws Exception
- {
- return new PersistHandlerBsDelegateRemote(p_oCtx);
- }
-}
Deleted: labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/services/beans/BatchHandler.java
===================================================================
--- labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/services/beans/BatchHandler.java 2006-10-30 17:19:28 UTC (rev 7235)
+++ labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/services/beans/BatchHandler.java 2006-10-30 19:25:11 UTC (rev 7236)
@@ -1,39 +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.services.beans;
-
-import javax.ejb.CreateException;
-
-import org.jboss.soa.esb.util.BobjStdDTO;
-
-/**
- * @author kstam
- */
-public interface BatchHandler
-{
- public void create() throws CreateException;
- public void finish() throws Exception;
- public void commitBatch(BobjStdDTO p_oDto ) throws Exception;
- public long newBatch() throws Exception;
- public int addToBatch(String p_s) throws Exception;
- public void remove();
-}
Deleted: labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/services/beans/BatchHandlerBean.java
===================================================================
--- labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/services/beans/BatchHandlerBean.java 2006-10-30 17:19:28 UTC (rev 7235)
+++ labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/services/beans/BatchHandlerBean.java 2006-10-30 19:25:11 UTC (rev 7236)
@@ -1,327 +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.services.beans;
-
-import java.sql.Date;
-import java.sql.PreparedStatement;
-import java.sql.ResultSet;
-import java.text.SimpleDateFormat;
-
-import javax.ejb.CreateException;
-import javax.ejb.Init;
-import javax.ejb.Local;
-import javax.ejb.PostActivate;
-import javax.ejb.PrePassivate;
-import javax.ejb.Remote;
-import javax.ejb.Remove;
-import javax.ejb.SessionContext;
-import javax.ejb.Stateful;
-import javax.ejb.TransactionManagement;
-import javax.ejb.TransactionManagementType;
-import javax.naming.Context;
-import javax.naming.InitialContext;
-import javax.sql.DataSource;
-
-import org.apache.log4j.Logger;
-import org.jboss.soa.esb.common.bizclasses.BatchProcess;
-import org.jboss.soa.esb.helpers.persist.JdbcCleanConn;
-import org.jboss.soa.esb.internal.core.objectstore.BobjStore;
-import org.jboss.soa.esb.internal.core.objectstore.DaoBatchTable;
-import org.jboss.soa.esb.internal.core.objectstore.DaoIndexTable;
-import org.jboss.soa.esb.internal.core.objectstore.DaoSnapTable;
-import org.jboss.soa.esb.internal.core.objectstore.DaoUidTable;
-import org.jboss.soa.esb.internal.core.objectstore.RowBatch;
-import org.jboss.soa.esb.util.BobjStdDTO;
-import org.jboss.soa.esb.util.Util;
-/**
- * @author Esteban
- */
- at Remote(BatchHandler.class)
- at Local(BatchHandler.class)
- at TransactionManagement(TransactionManagementType.BEAN)
-public @Stateful class BatchHandlerBean implements BatchHandler
-{
- private static final long serialVersionUID = 1L;
- SessionContext m_oSessCtx;
-
- public void setSessionContext(SessionContext p_oSessCtx)
- { this.m_oSessCtx = p_oSessCtx; }
-
- private Logger m_oLogger;
- private JdbcCleanConn m_oUidConn;
- private JdbcCleanConn m_oDataConn;
-
- private DaoUidTable m_oDaoUid;
- private DaoBatchTable m_oDaoBatch;
- private DaoIndexTable m_oDaoIndex;
- private DaoSnapTable m_oDaoSnap;
-
- private long m_lBatchNum = -1;
- private int m_iSeq;
-
-/**
- * @throws CreateException
- */
- @Init
- public void create() throws CreateException
- {
- try
- { getResources();
- m_oLogger.info(this.toString()+" Created");
- }
- catch (Exception e)
- { m_oLogger.error("Failed to Create : <"+e.getMessage()+">");
- throw new CreateException(e.getMessage());
- }
- } //__________________________________
-
- @PostActivate
- public void ejbActivate()
- { try
- { getResources();
- m_oLogger.info("EJB Activated");
- }
- catch (Exception e)
- { m_oLogger.error("Failed to Activate : <"+e.getMessage()+">");
- }
- } //__________________________________
-
- @PrePassivate
- public void ejbPassivate()
- { m_oLogger.info("EJB Passivated");
- releaseResources();
- m_oLogger = null;
- m_oUidConn = null;
- m_oDataConn = null;
- } //__________________________________
-
- @Remove
- public void remove()
- {
- releaseResources();
- m_oLogger.info("EJB Removed");
- } //__________________________________
-
- private void getResources() throws Exception
- { Context oCtx = new InitialContext();
- m_oLogger = Util.getDefaultLogger(this.getClass());
- m_oUidConn = new JdbcCleanConn ((DataSource)oCtx.lookup("java:JbossEsbDS"));
- m_oDataConn = new JdbcCleanConn ((DataSource)oCtx.lookup("java:JbossEsbDS"));
- } //__________________________________
-
- private void releaseResources()
- { if (null != m_oDataConn) m_oDataConn.release();
- if (null != m_oUidConn) m_oUidConn.release();
- m_oDaoBatch = null;
- m_oDaoUid = null;
- m_oDaoIndex = null;
- m_oDaoSnap = null;
- } //__________________________________
-
-// Utility Methods
-
- private DaoUidTable getDaoUid() throws Exception
- { if (null==m_oDaoUid)
- m_oDaoUid = new DaoUidTable(m_oUidConn, BobjStore.getUidTableName());
- return m_oDaoUid;
- } //__________________________________
-
- private DaoBatchTable getDaoBatch(String p_sTbl) throws Exception
- { if (null==m_oDaoBatch)
- m_oDaoBatch = new DaoBatchTable(m_oDataConn,p_sTbl);
- return m_oDaoBatch;
- } //__________________________________
-
- private DaoIndexTable getDaoIndex(String p_sTbl) throws Exception
- { if (null==m_oDaoIndex)
- m_oDaoIndex = new DaoIndexTable(m_oDataConn,p_sTbl);
- return m_oDaoIndex;
- } //__________________________________
-
- private DaoSnapTable getDaoSnap(BobjStore p_o) throws Exception
- { if (null==m_oDaoSnap)
- m_oDaoSnap = new DaoSnapTable(m_oDataConn,p_o);
- return m_oDaoSnap;
- } //__________________________________
-
- private void doCommitBatch(BatchProcess p_oBP) throws Exception
- { String sPrevClass = null;
- BobjStore oStore = null;
-
- PreparedStatement PSbatch = getDaoBatch(BobjStore.getBatchTableName())
- .getPS(DaoBatchTable.PS_GET_BATCH_ROWS);
- PSbatch.setLong(1,p_oBP.getBatchNum());
-
- long lNow = System.currentTimeMillis();
- String sSnapDt = new SimpleDateFormat("yyyyMMdd").format(new Date(lNow));
-
- // Get all Batch rows
- ResultSet RS = m_oDataConn.execQueryWait(PSbatch,10);
- while (RS.next())
- { String sXml = RS.getString(1+DaoBatchTable.STR_DATA);
- BobjStdDTO oDto = BobjStdDTO.getFromXml(sXml);
- // Get proper Dao's for Index and Snap table
- 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
- 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,oDto);
- 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();
-
- // Delete batch rows we just used
- PreparedStatement PSdel = getDaoBatch(BobjStore.getBatchTableName())
- .getPS(DaoBatchTable.PS_DELETE_BATCH);
- PSdel.setLong(1,p_oBP.getBatchNum());
- m_oDataConn.execUpdWait(PSdel,10);
-
- p_oBP.setField (BatchProcess.ATTRIB.commitStamp,Long.toString(lNow));
- p_oBP.setStamp (lNow);
- p_oBP.setSnapDate(sSnapDt);
-
- oStore = BobjStore.getStore(BatchProcess.class.getName());
-
- // Update snap table with proper timestamp
- m_oDaoSnap = null;
- PreparedStatement PSupd = getDaoSnap(oStore).getPS(DaoSnapTable.PS_UPD_SNAP);
- getDaoSnap(oStore).setUpdValues(PSupd,p_oBP);
- m_oDataConn.execUpdWait(PSupd,10);
-
- // Update index table with proper timestamp
- m_oDaoIndex = null;
- PSupd = getDaoIndex(oStore.getLocatorTable()).getPS(DaoIndexTable.PS_UPD_INDEX);
- getDaoIndex(oStore.getLocatorTable()).setUpdValues(PSupd,p_oBP);
- m_oDataConn.execUpdWait(PSupd,10);
-
- } //__________________________________
-
-//______________________________________________________________________________
-// Public local and remote interface methods
-/**
- */
- public long newBatch() throws Exception
- { if (m_lBatchNum > 0) throw
- new Exception ("Must finish with previous batch before opening new");
- m_iSeq = 0;
- try
- { return m_lBatchNum = getDaoUid().getUidChunk(DaoUidTable.SEQUENCE_BATCH, 1);
- }
- catch (Exception e)
- { m_oLogger.error("BatchHandlerBean.newBatch() FAILED "+ e.getMessage());
- throw e;
- }
- finally { releaseResources(); }
- } //__________________________________
-
-/**
- * @return
- */
- public long getBatchNum()
- { return m_lBatchNum;
- } //__________________________________
-
-/**
- * @param p_s
- * @return
- * @throws Exception
- */
- public int addToBatch(String p_s) throws Exception
- { if (null==p_s) throw
- new Exception ("Tryng to add a null String to a batch");
- if (m_lBatchNum < 1) throw
- new Exception ("Must request batch number before adding objects");
- try
- { RowBatch oRow = new RowBatch(m_lBatchNum,++m_iSeq,0,p_s);
- getDaoBatch(BobjStore.getBatchTableName());
- PreparedStatement PS = m_oDaoBatch.getPS(DaoBatchTable.PS_INS_BATCHROW);
- m_oDaoBatch.setInsValues(PS,oRow);
- m_oDataConn.execUpdWait(PS,1);
- m_oDataConn.commit();
- return m_iSeq;
- }
- catch (Exception e)
- { if (null != m_oDataConn) m_oDataConn.rollback();
- m_oLogger.error("addToBatch() failed",e);
- throw e;
- }
- finally { releaseResources(); }
- } //__________________________________
-/**
- * @throws Exception
- */
- public void finish() throws Exception
- { if (m_lBatchNum < 1) return;
- m_lBatchNum = -1;
- m_iSeq = 0;
- } //__________________________________
-
-//______________________________________________________________________________
-// Public local interface methods
-///** KS: I'm commenting this out since we are now using the
-// same interface for local and remote calls. If all
-// works this code can be deleted.
-// */
-// public void commitBatch(BatchProcess p_oBO) throws Exception
-// { try { doCommitBatch(p_oBO); m_oDataConn.commit(); }
-// catch (Exception e)
-// { if (null != m_oDataConn) m_oDataConn.rollback();
-// m_oLogger.error("commitBatch(BatchProcess) FAILED ",e);
-// throw e;
-// }
-// finally { releaseResources(); }
-// } //__________________________________
-
-//______________________________________________________________________________
-// Public remote interface methods
-/**
- */
- public void commitBatch(BobjStdDTO p_oDto) throws Exception
- {
- doCommitBatch (new BatchProcess(p_oDto));
- }
-
-} //____________________________________________________________________________
Deleted: labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/services/beans/PersistHandler.java
===================================================================
--- labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/services/beans/PersistHandler.java 2006-10-30 17:19:28 UTC (rev 7235)
+++ labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/services/beans/PersistHandler.java 2006-10-30 19:25:11 UTC (rev 7236)
@@ -1,43 +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.services.beans;
-
-import org.jboss.soa.esb.util.BobjStdDTO;
-
-/**
- * @author kstam
- */
-public interface PersistHandler
-{
- public void create() throws Exception;
-
- public long getUidChunk( int p_iQ ) throws Exception;
-
- public void rmvObject( String p_sClassName,long p_lUid ) throws Exception;
-
- public long addDTO( BobjStdDTO p_oDto ) throws Exception;
-
- public BobjStdDTO getDTO( String p_sClassName,long p_lUid ) throws Exception;
-
- public void rplDTO( BobjStdDTO p_oDto ) throws Exception;
-
-}
Deleted: labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/services/beans/PersistHandlerBean.java
===================================================================
--- labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/services/beans/PersistHandlerBean.java 2006-10-30 17:19:28 UTC (rev 7235)
+++ labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/services/beans/PersistHandlerBean.java 2006-10-30 19:25:11 UTC (rev 7236)
@@ -1,369 +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.services.beans;
-
-import java.io.ObjectStreamClass;
-import java.sql.Date;
-import java.sql.PreparedStatement;
-import java.sql.ResultSet;
-import java.text.SimpleDateFormat;
-
-import javax.ejb.CreateException;
-import javax.ejb.Init;
-import javax.ejb.Local;
-import javax.ejb.Remote;
-import javax.ejb.Remove;
-import javax.ejb.SessionContext;
-import javax.ejb.Stateless;
-import javax.ejb.TransactionManagement;
-import javax.ejb.TransactionManagementType;
-import javax.naming.Context;
-import javax.naming.InitialContext;
-import javax.sql.DataSource;
-
-import org.apache.log4j.Logger;
-import org.jboss.soa.esb.helpers.persist.JdbcCleanConn;
-import org.jboss.soa.esb.internal.core.objectstore.BobjStore;
-import org.jboss.soa.esb.internal.core.objectstore.DaoIndexTable;
-import org.jboss.soa.esb.internal.core.objectstore.DaoSnapTable;
-import org.jboss.soa.esb.internal.core.objectstore.DaoUidTable;
-import org.jboss.soa.esb.util.BobjStdDTO;
-import org.jboss.soa.esb.util.ObjLocator;
-import org.jboss.soa.esb.util.Util;
-
-/**
- * @author Esteban
- */
- at Remote(PersistHandler.class)
- at Local(PersistHandler.class)
- at TransactionManagement(TransactionManagementType.BEAN)
-public @Stateless class PersistHandlerBean implements PersistHandler
-{
- private static final long serialVersionUID = 1L;
- private Logger m_oLogger;
- SessionContext m_ctxSess;
-
- private JdbcCleanConn m_oUidConn;
- private JdbcCleanConn m_oDataConn;
-
- private static final int s_iChunkSize=100;
- private long m_lUid;
- private int m_iChunkLeft=0;
-
- private DaoUidTable m_oDaoUid;
- private DaoSnapTable m_oDaoSnap;
- private DaoIndexTable[] m_oaDaoIndex;
-
- public void setSessionContext(SessionContext sessionContext)
- { m_ctxSess = sessionContext; }
-/**
- * Create method. Should get called to initialize this class.
- * @throws CreateException
- */
- @Init
- public void create() throws Exception
- { try
- { m_oLogger = Util.getDefaultLogger(this.getClass());
- Context oCtxInit = new InitialContext();
- String sDSjndiName = BobjStore.getDataSourceJndi();
- DataSource oDS = (DataSource)oCtxInit.lookup(sDSjndiName);
- m_oUidConn = new JdbcCleanConn(oDS);
- m_oDataConn = new JdbcCleanConn(oDS);
-
- Class oCls = BobjStdDTO.class;
- ObjectStreamClass XX = ObjectStreamClass.lookup(oCls);
- System.out.println(XX.getSerialVersionUID());
- System.out.println(oCls.getProtectionDomain().getCodeSource().getLocation());
-
- m_oLogger.info(this.toString()+" Created");
- }
- catch (Exception e)
- { m_oLogger.error("EJB Create Failed <"+e.getMessage()+">");
- throw e;
- }
- } //__________________________________
-
- @Remove
- public void remove()
- { m_oLogger.info(this.toString()+" Removed");
- } //__________________________________
-
-
- /**
- * @param p_sClassName - String Fully qualified name of class to be retrieved
- * @param p_lUid
- * @return
- * @throws Exception
- */
- 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(); }
- } //__________________________________
- /**
- *
- * @param p_oDto BobjStdDTO - Serialized BaseBusinessObject that has to be replaced
- * @throws Exception
- */
- public void rplDTO(BobjStdDTO p_oDto) throws Exception
- { 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(); }
- } //__________________________________
-
-// ______________________________________________________________________________
-// Public local and remote interface methods
- /**
- */
- public long getUidChunk (int p_iQ) throws Exception
- { try { return getDaoUid().getUidChunk(DaoUidTable.SEQUENCE_OBJ,p_iQ); }
- catch (Exception e) { throw e;}
- finally { releaseResources(); }
- } //__________________________________
- /**
- * @param p_sClassName
- * @param p_lUid
- * @throws Exception
- */
- 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) {}
- throw e;
- }
- finally { releaseResources(); }
- } //__________________________________
-
- /**
- */
- public long addDTO(BobjStdDTO p_oDto) throws Exception
- { 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(); }
- } //__________________________________
-
-
-// Utility Methods
-
- private DaoUidTable getDaoUid() throws Exception
- { if (null==m_oDaoUid) m_oDaoUid
- = new DaoUidTable(m_oUidConn,BobjStore.getUidTableName());
- return m_oDaoUid;
- } //__________________________________
-
- private DaoSnapTable getDaoSnap(BobjStore p_oSt) throws Exception
- { if (null==m_oDaoSnap)
- m_oDaoSnap = new DaoSnapTable(m_oDataConn,p_oSt);
- return m_oDaoSnap;
- } //__________________________________
-
- 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[] doAddLocators(BobjStore pStore,BobjStdDTO p_oDto) throws Exception
- { long lUid = p_oDto.getUid();
- if (lUid < 1)
- { lUid = doAssignUid();
- p_oDto.setUid(lUid);
- p_oDto.setSnap(lUid);
- }
- 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);
- }
-
- return oaRet;
- } //__________________________________
-
- 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.execUpdWait(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);
- PS.setLong(1,p_lUid);
- m_oDataConn.execUpdWait(PS,5);
- } //__________________________________
-
- private void doRmvSnapshot (BobjStore p_oSt,long p_lUid) throws Exception
- {
- PreparedStatement PS = getDaoSnap(p_oSt).getPS(DaoSnapTable.PS_SEL_4UPD);
- PS.setLong(1,p_lUid);
- ResultSet rs = m_oDataConn.execQueryWait(PS,30);
- if (! rs.next()) throw new Exception("Non existing Snapshot");
- long lObjUid = rs.getLong(DaoSnapTable.OBJECT_UID);
-
- doDelOneSnap(p_oSt,p_lUid);
- doDelLocators(p_oSt,lObjUid);
-
- } //__________________________________
-
- private void doRplSnapshot(BobjStdDTO p_oDto)
- throws Exception
- { long lSnapUid = p_oDto.getSnap();
- BobjStore oSt = BobjStore.getStore(p_oDto);
- doDelOneSnap(oSt,lSnapUid);
- doDelLocators(oSt,p_oDto.getUid());
- doAddSnapshot(p_oDto,false);
- } //__________________________________
-
- private long doAddSnapshot(BobjStdDTO p_oDto)
- throws Exception
- { return doAddSnapshot(p_oDto,true);
- } //__________________________________
-
- SimpleDateFormat s_oY4md = new SimpleDateFormat("yyyyMMdd");
- private long doAddSnapshot(BobjStdDTO p_oDto, boolean p_bNewVrs)
- throws Exception
- { long lObjUid = p_oDto.getUid();
- if (lObjUid < 1) p_oDto.setUid(lObjUid=doAssignUid());
- p_oDto.setSnap(lObjUid);
-
- // Set Timestamp
- long lNow = System.currentTimeMillis();
- p_oDto.setStamp(lNow);
- p_oDto.setSnapDate(s_oY4md.format(new Date(lNow)));
-
- BobjStore oSt = BobjStore.getStore(p_oDto);
- PreparedStatement PS = getDaoSnap(oSt).getPS(DaoSnapTable.PS_INS_SNAP);
- getDaoSnap(oSt).setInsValues(PS,p_oDto);
-
- m_oDataConn.execUpdWait(PS,1);
-
- 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(BobjStdDTO p_oDto, int p_iNum)
- throws Exception
- { 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);
- } //__________________________________
-
- private BobjStdDTO doGetSnapshot (BobjStore p_oSt,long p_lUid) throws Exception
- { PreparedStatement PS = getDaoSnap(p_oSt).getPS(DaoSnapTable.PS_SEL_SNAP);
- PS.setLong(1,p_lUid);
- ResultSet rs = m_oDataConn.execQueryWait(PS,30);
- if (! rs.next()) throw new Exception("Non existing Snapshot");
- BobjStdDTO oRet = (BobjStdDTO)getDaoSnap(p_oSt).getFromRS(rs);
- return oRet;
- } //__________________________________
-
- private void releaseResources()
- { 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();
- if (null != m_oUidConn) m_oUidConn.release();
- } //__________________________________
-
- private long doAssignUid() throws Exception
- { if (m_iChunkLeft < 1)
- { m_lUid = getDaoUid().getUidChunk(DaoUidTable.SEQUENCE_OBJ, s_iChunkSize);
- m_iChunkLeft = s_iChunkSize;
- }
- m_iChunkLeft--;
- return ++m_lUid;
- } //__________________________________
-
-
-
-} //____________________________________________________________________________
Deleted: labs/jbossesb/trunk/product/core/services/tests/src/org/jboss/soa/esb/services/beans/PersistHandlerUnitTest.java
===================================================================
--- labs/jbossesb/trunk/product/core/services/tests/src/org/jboss/soa/esb/services/beans/PersistHandlerUnitTest.java 2006-10-30 17:19:28 UTC (rev 7235)
+++ labs/jbossesb/trunk/product/core/services/tests/src/org/jboss/soa/esb/services/beans/PersistHandlerUnitTest.java 2006-10-30 19:25:11 UTC (rev 7236)
@@ -1,58 +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.services.beans;
-
-import junit.framework.Test;
-import junit.framework.TestSuite;
-
-import org.apache.log4j.Logger;
-import org.apache.log4j.Priority;
-import org.jboss.soa.esb.common.tests.BaseTest;
-import org.jboss.soa.esb.common.tests.EJBContainerSetup;
-
-
-public class PersistHandlerUnitTest extends BaseTest
-{
- private Logger logger = Logger.getLogger(PersistHandlerUnitTest.class);
-
- public void testConnectivityToPersistHandler() {
- try {
- logger.log(Priority.INFO, "PersistHandler Test");
- PersistHandler persistHandlerLocal = (PersistHandler ) EJBContainerSetup.lookup("PersistHandlerBean/remote");
- logger.log(Priority.INFO, "persistHandlerLocal=" + persistHandlerLocal);
- //Create is currently failing since the config file property is not set.
- //persistHandlerLocal.create();
- //persistHandlerLocal.addDTO(null);
- } catch (Exception e) {
- logger.log(Priority.ERROR, e.getMessage(), e);
- }
- }
-
-
- public static Test suite() {
- TestSuite suite = new TestSuite(PersistHandlerUnitTest.class);
- return new EJBContainerSetup(suite);
- }
-
-}
-
-
Added: labs/jbossesb/trunk/product/samples/trailblazer2/esb/lib/ext/hsqldb.jar
===================================================================
(Binary files differ)
Property changes on: labs/jbossesb/trunk/product/samples/trailblazer2/esb/lib/ext/hsqldb.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Modified: labs/jbossesb/trunk/qa/jbossesb-unittest-properties.xml
===================================================================
--- labs/jbossesb/trunk/qa/jbossesb-unittest-properties.xml 2006-10-30 17:19:28 UTC (rev 7235)
+++ labs/jbossesb/trunk/qa/jbossesb-unittest-properties.xml 2006-10-30 19:25:11 UTC (rev 7236)
@@ -57,12 +57,10 @@
<property name="abandoned-connection-time-interval" value="30000"/>
</properties>
<properties name="dbstore">
- <property name="org.jboss.soa.esb.persistence.db.connection.url" value="jdbc:postgresql://localhost:5432/jbossesb"/>
- <!-- Hypersonic: value="jdbc:hsqldb:hsql://localhost:1701" -->
- <property name="org.jboss.soa.esb.persistence.db.jdbc.driver" value="org.postgresql.Driver"/>
- <!-- Hypersonic: value="org.hsqldb.jdbcDriver" -->
- <property name="org.jboss.soa.esb.persistence.db.user" value="postgres"/>
- <property name="org.jboss.soa.esb.persistence.db.pwd" value="postgres"/>
+ <property name="org.jboss.soa.esb.persistence.db.connection.url" value="jdbc:hsqldb:hsql://localhost:9001/jbossesb"/>
+ <property name="org.jboss.soa.esb.persistence.db.jdbc.driver" value="org.hsqldb.jdbcDriver"/>
+ <property name="org.jboss.soa.esb.persistence.db.user" value="sa"/>
+ <property name="org.jboss.soa.esb.persistence.db.pwd" value=""/>
<property name="org.jboss.soa.esb.persistence.db.pool.initial.size" value="2"/>
<property name="org.jboss.soa.esb.persistence.db.pool.min.size" value="2"/>
<property name="org.jboss.soa.esb.persistence.db.pool.max.size" value="5"/>
Deleted: labs/jbossesb/trunk/qa/junit/src/org/jboss/soa/esb/objpersist/ObjStore_brokentest.java
===================================================================
--- labs/jbossesb/trunk/qa/junit/src/org/jboss/soa/esb/objpersist/ObjStore_brokentest.java 2006-10-30 17:19:28 UTC (rev 7235)
+++ labs/jbossesb/trunk/qa/junit/src/org/jboss/soa/esb/objpersist/ObjStore_brokentest.java 2006-10-30 19:25:11 UTC (rev 7236)
@@ -1,45 +0,0 @@
-package org.jboss.soa.esb.objpersist;
-
-import junit.framework.TestCase;
-
-import org.jboss.soa.esb.common.Configuration;
-import org.jboss.soa.esb.common.bizclasses.Person;
-import org.jboss.soa.esb.services.PersistHandlerFactory;
-import org.jboss.soa.esb.services.PersistManager;
-
-// DON'T FORGET !!
-// The Rosetta Application server has to be up and running
-// (set JNDI_SERVER appropriately)
-
-public class ObjStore_brokentest extends TestCase {
-
- private PersistManager m_oH;
-
- protected void setUp() throws Exception {
- // get a handle to your business delegate
- m_oH = PersistHandlerFactory.getPersistHandler("remote",
- Configuration.getJndiServerType(), Configuration
- .getJndiServerURL());
- }
-
- public void test() throws Exception {
- // set up a Person (see TestPersonAddrPhone.class)
- Person oPrs = TestPersonAddrPhone.getPerson();
- 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);
-
- // Zero the timestams because the original object won't have one
- oPrs.setStamp(0);
- oP2.setStamp(0);
-
- assertEquals(oPrs.toDTO().toXml(), oP2.toDTO().toXml());
- }
-
- protected void tearDown() throws Exception {
- }
-}
Deleted: labs/jbossesb/trunk/qa/junit/src/org/jboss/soa/esb/objpersist/TestPersonAddrPhone.java
===================================================================
--- labs/jbossesb/trunk/qa/junit/src/org/jboss/soa/esb/objpersist/TestPersonAddrPhone.java 2006-10-30 17:19:28 UTC (rev 7235)
+++ labs/jbossesb/trunk/qa/junit/src/org/jboss/soa/esb/objpersist/TestPersonAddrPhone.java 2006-10-30 19:25:11 UTC (rev 7236)
@@ -1,79 +0,0 @@
-package org.jboss.soa.esb.objpersist;
-
-
-import org.jboss.soa.esb.common.bizclasses.Address;
-import org.jboss.soa.esb.common.bizclasses.OneValue;
-import org.jboss.soa.esb.common.bizclasses.Person;
-import org.jboss.soa.esb.common.bizclasses.Telephone;
-import org.jboss.soa.esb.util.BaseBusinessObject;
-import org.jboss.soa.esb.util.BobjStdDTO;
-
-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;
- }
-
-} //____________________________________________________________________________
More information about the jboss-svn-commits
mailing list