[jboss-svn-commits] JBL Code SVN: r7580 - in labs/jbossesb/workspace/b_georges/product/core/services: src/org/jboss/soa/esb src/org/jboss/soa/esb/services src/org/jboss/soa/esb/services/beans src/org/jboss/soa/esb/services/persistence src/org/jboss/soa/esb/services/registry tests/src/org/jboss/soa/esb tests/src/org/jboss/soa/esb/services tests/src/org/jboss/soa/esb/services/beans tests/src/org/jboss/soa/esb/services/registry
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Mon Nov 13 17:28:45 EST 2006
Author: b_georges
Date: 2006-11-13 17:28:36 -0500 (Mon, 13 Nov 2006)
New Revision: 7580
Removed:
labs/jbossesb/workspace/b_georges/product/core/services/src/org/jboss/soa/esb/internal/
labs/jbossesb/workspace/b_georges/product/core/services/src/org/jboss/soa/esb/services/BatchHandlerBsDelegateLocal.java
labs/jbossesb/workspace/b_georges/product/core/services/src/org/jboss/soa/esb/services/BatchHandlerBsDelegateRemote.java
labs/jbossesb/workspace/b_georges/product/core/services/src/org/jboss/soa/esb/services/BatchHandlerFactory.java
labs/jbossesb/workspace/b_georges/product/core/services/src/org/jboss/soa/esb/services/PersistHandlerBsDelegateLocal.java
labs/jbossesb/workspace/b_georges/product/core/services/src/org/jboss/soa/esb/services/PersistHandlerBsDelegateRemote.java
labs/jbossesb/workspace/b_georges/product/core/services/src/org/jboss/soa/esb/services/PersistHandlerFactory.java
labs/jbossesb/workspace/b_georges/product/core/services/src/org/jboss/soa/esb/services/beans/BatchHandler.java
labs/jbossesb/workspace/b_georges/product/core/services/src/org/jboss/soa/esb/services/beans/BatchHandlerBean.java
labs/jbossesb/workspace/b_georges/product/core/services/src/org/jboss/soa/esb/services/beans/PersistHandler.java
labs/jbossesb/workspace/b_georges/product/core/services/src/org/jboss/soa/esb/services/beans/PersistHandlerBean.java
labs/jbossesb/workspace/b_georges/product/core/services/src/org/jboss/soa/esb/services/persistence/MessageStoreFactoryImpl.java
labs/jbossesb/workspace/b_georges/product/core/services/src/org/jboss/soa/esb/services/persistence/MessageStorePlugin.java
labs/jbossesb/workspace/b_georges/product/core/services/src/org/jboss/soa/esb/services/persistence/db/
labs/jbossesb/workspace/b_georges/product/core/services/src/org/jboss/soa/esb/services/registry/JAXRRegistryImpl.java
labs/jbossesb/workspace/b_georges/product/core/services/tests/src/org/jboss/soa/esb/internal/
labs/jbossesb/workspace/b_georges/product/core/services/tests/src/org/jboss/soa/esb/services/beans/PersistHandlerUnitTest.java
labs/jbossesb/workspace/b_georges/product/core/services/tests/src/org/jboss/soa/esb/services/registry/JAXRRegistryUnitTest.java
labs/jbossesb/workspace/b_georges/product/core/services/tests/src/org/jboss/soa/esb/services/tests/
labs/jbossesb/workspace/b_georges/product/core/services/tests/src/org/jboss/soa/esb/services/util/
Log:
sync with latest rel
Deleted: labs/jbossesb/workspace/b_georges/product/core/services/src/org/jboss/soa/esb/services/BatchHandlerBsDelegateLocal.java
===================================================================
--- labs/jbossesb/workspace/b_georges/product/core/services/src/org/jboss/soa/esb/services/BatchHandlerBsDelegateLocal.java 2006-11-13 22:23:37 UTC (rev 7579)
+++ labs/jbossesb/workspace/b_georges/product/core/services/src/org/jboss/soa/esb/services/BatchHandlerBsDelegateLocal.java 2006-11-13 22:28:36 UTC (rev 7580)
@@ -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/workspace/b_georges/product/core/services/src/org/jboss/soa/esb/services/BatchHandlerBsDelegateRemote.java
===================================================================
--- labs/jbossesb/workspace/b_georges/product/core/services/src/org/jboss/soa/esb/services/BatchHandlerBsDelegateRemote.java 2006-11-13 22:23:37 UTC (rev 7579)
+++ labs/jbossesb/workspace/b_georges/product/core/services/src/org/jboss/soa/esb/services/BatchHandlerBsDelegateRemote.java 2006-11-13 22:28:36 UTC (rev 7580)
@@ -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/workspace/b_georges/product/core/services/src/org/jboss/soa/esb/services/BatchHandlerFactory.java
===================================================================
--- labs/jbossesb/workspace/b_georges/product/core/services/src/org/jboss/soa/esb/services/BatchHandlerFactory.java 2006-11-13 22:23:37 UTC (rev 7579)
+++ labs/jbossesb/workspace/b_georges/product/core/services/src/org/jboss/soa/esb/services/BatchHandlerFactory.java 2006-11-13 22:28:36 UTC (rev 7580)
@@ -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/workspace/b_georges/product/core/services/src/org/jboss/soa/esb/services/PersistHandlerBsDelegateLocal.java
===================================================================
--- labs/jbossesb/workspace/b_georges/product/core/services/src/org/jboss/soa/esb/services/PersistHandlerBsDelegateLocal.java 2006-11-13 22:23:37 UTC (rev 7579)
+++ labs/jbossesb/workspace/b_georges/product/core/services/src/org/jboss/soa/esb/services/PersistHandlerBsDelegateLocal.java 2006-11-13 22:28:36 UTC (rev 7580)
@@ -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/workspace/b_georges/product/core/services/src/org/jboss/soa/esb/services/PersistHandlerBsDelegateRemote.java
===================================================================
--- labs/jbossesb/workspace/b_georges/product/core/services/src/org/jboss/soa/esb/services/PersistHandlerBsDelegateRemote.java 2006-11-13 22:23:37 UTC (rev 7579)
+++ labs/jbossesb/workspace/b_georges/product/core/services/src/org/jboss/soa/esb/services/PersistHandlerBsDelegateRemote.java 2006-11-13 22:28:36 UTC (rev 7580)
@@ -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/workspace/b_georges/product/core/services/src/org/jboss/soa/esb/services/PersistHandlerFactory.java
===================================================================
--- labs/jbossesb/workspace/b_georges/product/core/services/src/org/jboss/soa/esb/services/PersistHandlerFactory.java 2006-11-13 22:23:37 UTC (rev 7579)
+++ labs/jbossesb/workspace/b_georges/product/core/services/src/org/jboss/soa/esb/services/PersistHandlerFactory.java 2006-11-13 22:28:36 UTC (rev 7580)
@@ -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/workspace/b_georges/product/core/services/src/org/jboss/soa/esb/services/beans/BatchHandler.java
===================================================================
--- labs/jbossesb/workspace/b_georges/product/core/services/src/org/jboss/soa/esb/services/beans/BatchHandler.java 2006-11-13 22:23:37 UTC (rev 7579)
+++ labs/jbossesb/workspace/b_georges/product/core/services/src/org/jboss/soa/esb/services/beans/BatchHandler.java 2006-11-13 22:28:36 UTC (rev 7580)
@@ -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/workspace/b_georges/product/core/services/src/org/jboss/soa/esb/services/beans/BatchHandlerBean.java
===================================================================
--- labs/jbossesb/workspace/b_georges/product/core/services/src/org/jboss/soa/esb/services/beans/BatchHandlerBean.java 2006-11-13 22:23:37 UTC (rev 7579)
+++ labs/jbossesb/workspace/b_georges/product/core/services/src/org/jboss/soa/esb/services/beans/BatchHandlerBean.java 2006-11-13 22:28:36 UTC (rev 7580)
@@ -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/workspace/b_georges/product/core/services/src/org/jboss/soa/esb/services/beans/PersistHandler.java
===================================================================
--- labs/jbossesb/workspace/b_georges/product/core/services/src/org/jboss/soa/esb/services/beans/PersistHandler.java 2006-11-13 22:23:37 UTC (rev 7579)
+++ labs/jbossesb/workspace/b_georges/product/core/services/src/org/jboss/soa/esb/services/beans/PersistHandler.java 2006-11-13 22:28:36 UTC (rev 7580)
@@ -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/workspace/b_georges/product/core/services/src/org/jboss/soa/esb/services/beans/PersistHandlerBean.java
===================================================================
--- labs/jbossesb/workspace/b_georges/product/core/services/src/org/jboss/soa/esb/services/beans/PersistHandlerBean.java 2006-11-13 22:23:37 UTC (rev 7579)
+++ labs/jbossesb/workspace/b_georges/product/core/services/src/org/jboss/soa/esb/services/beans/PersistHandlerBean.java 2006-11-13 22:28:36 UTC (rev 7580)
@@ -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/workspace/b_georges/product/core/services/src/org/jboss/soa/esb/services/persistence/MessageStoreFactoryImpl.java
===================================================================
--- labs/jbossesb/workspace/b_georges/product/core/services/src/org/jboss/soa/esb/services/persistence/MessageStoreFactoryImpl.java 2006-11-13 22:23:37 UTC (rev 7579)
+++ labs/jbossesb/workspace/b_georges/product/core/services/src/org/jboss/soa/esb/services/persistence/MessageStoreFactoryImpl.java 2006-11-13 22:28:36 UTC (rev 7580)
@@ -1,111 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2006, JBoss Inc., and others contributors as indicated
- * by the @authors tag. All rights reserved.
- * See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * 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,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- *
- * (C) 2005-2006,
- * @author daniel.brum at jboss.com
- */
-
-
-package org.jboss.internal.soa.esb.persistence.format;
-
-import java.net.URI;
-import java.util.Enumeration;
-import java.util.Hashtable;
-import java.util.Properties;
-
-
-import org.jboss.internal.soa.esb.persistence.format.db.DBMessageStorePlugin;
-import org.jboss.soa.esb.services.persistence.MessageStore;
-import org.jboss.soa.esb.services.persistence.MessageStoreFactory;
-
-public class MessageStoreFactoryImpl extends MessageStoreFactory {
-
- private final Hashtable<URI, MessageStorePlugin> messageStoreFormats = new Hashtable<URI, MessageStorePlugin>();
-
-
- public MessageStoreFactoryImpl() {
- reset();
- }
-
- public MessageStore getMessageStore() {
- return ((MessageStorePlugin) messageStoreFormats.get(MessageStoreType.DEFAULT_TYPE)).getMessageStore();
- }
-
- public MessageStore getMessageStore(URI type) {
- if (type == null)
- throw new IllegalArgumentException();
-
- MessageStorePlugin plugin = messageStoreFormats.get(type);
-
- if (plugin != null)
- return plugin.getMessageStore();
- else
- return null;
- }
-
- public void reset ()
- {
- messageStoreFormats.clear();
- /*
- * Go through the properties loaded from the property file. Anything
- * starting with MessageStorePlugin.MESSAGE_STORE_PLUGIN is assumed to be a plugin
- * that we load and add to the list.
- */
-
- Properties properties = System.getProperties();
-
- if (properties != null)
- {
- Enumeration names = properties.propertyNames();
-
- while (names.hasMoreElements())
- {
- String attrName = (String) names.nextElement();
-
- if (attrName.startsWith(MessageStorePlugin. MESSAGE_STORE_PLUGIN))
- {
- try
- {
- String pluginName = properties.getProperty(attrName);
- Class c = Class.forName(pluginName);
- MessageStorePlugin thePlugin = (MessageStorePlugin) c.newInstance();
-
- messageStoreFormats.put(thePlugin.getType(), thePlugin);
- }
- catch (ClassNotFoundException ex)
- {
- ex.printStackTrace();
- }
- catch (IllegalAccessException ex)
- {
- ex.printStackTrace();
- }
- catch (InstantiationException ex)
- {
- ex.printStackTrace();
- }
- }
- }
- }
-
- /*
- * Now add the default(s).
- */
- messageStoreFormats.put(MessageStoreType.DATABASE, new DBMessageStorePlugin());
- }
-
-}
Deleted: labs/jbossesb/workspace/b_georges/product/core/services/src/org/jboss/soa/esb/services/persistence/MessageStorePlugin.java
===================================================================
--- labs/jbossesb/workspace/b_georges/product/core/services/src/org/jboss/soa/esb/services/persistence/MessageStorePlugin.java 2006-11-13 22:23:37 UTC (rev 7579)
+++ labs/jbossesb/workspace/b_georges/product/core/services/src/org/jboss/soa/esb/services/persistence/MessageStorePlugin.java 2006-11-13 22:28:36 UTC (rev 7580)
@@ -1,54 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2006, JBoss Inc., and others contributors as indicated
- * by the @authors tag. All rights reserved.
- * See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * 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,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- *
- * (C) 2005-2006,
- * @author daniel.brum at jboss.com
- */
-
-package org.jboss.internal.soa.esb.persistence.format;
-
-import java.net.URI;
-
-import org.jboss.soa.esb.services.persistence.MessageStore;
-
-
-/**
-* Used to plug in new message stores dynamically. Each plugin is responsible for
-* returning a message store implementation that knows how to handle its own persistence
-* mechanism, i.e: database, file, etc.
-*
-* @author Daniel Brum
-*
-*/
-
-public interface MessageStorePlugin {
-
-public static final String MESSAGE_STORE_PLUGIN = "org.jboss.soa.esb.persistence.base.plugin";
-
- /**
- * @return the message instance.
- */
-
- public MessageStore getMessageStore ();
-
- /**
- * @return the unique identifier for this message store plugin.
- */
-
- public URI getType ();
-
-}
Deleted: labs/jbossesb/workspace/b_georges/product/core/services/src/org/jboss/soa/esb/services/registry/JAXRRegistryImpl.java
===================================================================
--- labs/jbossesb/workspace/b_georges/product/core/services/src/org/jboss/soa/esb/services/registry/JAXRRegistryImpl.java 2006-11-13 22:23:37 UTC (rev 7579)
+++ labs/jbossesb/workspace/b_georges/product/core/services/src/org/jboss/soa/esb/services/registry/JAXRRegistryImpl.java 2006-11-13 22:28:36 UTC (rev 7580)
@@ -1,629 +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.registry;
-
-import java.net.PasswordAuthentication;
-import java.net.URLDecoder;
-import java.net.URLEncoder;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Properties;
-import java.util.Set;
-
-import javax.xml.registry.BulkResponse;
-import javax.xml.registry.BusinessLifeCycleManager;
-import javax.xml.registry.BusinessQueryManager;
-import javax.xml.registry.Connection;
-import javax.xml.registry.ConnectionFactory;
-import javax.xml.registry.FindQualifier;
-import javax.xml.registry.JAXRException;
-import javax.xml.registry.JAXRResponse;
-import javax.xml.registry.RegistryService;
-import javax.xml.registry.infomodel.EmailAddress;
-import javax.xml.registry.infomodel.Key;
-import javax.xml.registry.infomodel.Organization;
-import javax.xml.registry.infomodel.PersonName;
-import javax.xml.registry.infomodel.PostalAddress;
-import javax.xml.registry.infomodel.RegistryObject;
-import javax.xml.registry.infomodel.Service;
-import javax.xml.registry.infomodel.ServiceBinding;
-import javax.xml.registry.infomodel.TelephoneNumber;
-import javax.xml.registry.infomodel.User;
-
-import org.apache.log4j.Logger;
-import org.apache.log4j.Priority;
-import org.jboss.internal.soa.esb.addressing.EPRHelper;
-import org.jboss.soa.esb.addressing.EPR;
-import org.jboss.soa.esb.common.Configuration;
-/**
- * Utility class for the Registry.
- * If need be we can extract the interface from here, add a factory and have JAXR as a plugin, allowing
- * for other RegistryAPIs.
- *
- * @author Kurt Stam
- */
-public class JAXRRegistryImpl implements Registry
-{
- private static Logger logger = Logger.getLogger(JAXRRegistryImpl.class);
- public static Set<PasswordAuthentication> creds = new HashSet<PasswordAuthentication>();
- private static Properties props = new Properties();
- private static Organization jbossESBOrganization;
-
- private static void init()
- {
- props = new Properties();
- props.setProperty("javax.xml.registry.queryManagerURL", Configuration.getRegistryQueryManageURI());
- props.setProperty("javax.xml.registry.lifeCycleManagerURL", Configuration.getRegistryLifecycleManagerURI());
- props.setProperty("javax.xml.registry.factoryClass", Configuration.getRegistryFactoryClass());
- props.setProperty("scout.proxy.transportClass", Configuration.getRegistryScoutTransportClass());
- String user = Configuration.getRegistryUser();
- String password = Configuration.getRegistryPassword();
- PasswordAuthentication passwdAuth = new PasswordAuthentication(user, password.toCharArray());
- creds.add(passwdAuth);
- }
-
- /**
- * Creates a connecton to a JAXR capable registy.
- *
- * @return Connection to a Registry using JAXR.
- */
- protected static Connection getConnection()
- {
- Connection connection = null;
- init();
- try
- { // Create the connection, passing it the configuration properties
- ConnectionFactory factory = ConnectionFactory.newInstance();
- factory.setProperties(props);
- connection = factory.createConnection();
- } catch (JAXRException e) {
- logger.log(Priority.ERROR, "Could not set up a connection to the Registry. " + e.getMessage(), e);
- }
- return connection;
- }
- /**
- * Closes the connection to the Registry
- */
- protected static void closeConnection(Connection connection)
- {
- try {
- if (connection!=null && !connection.isClosed()) {
- connection.close();
- }
- } catch (JAXRException je) {
- logger.log(Priority.ERROR, je.getMessage(), je);
- }
- }
- /**
- * Publish an EPR to the Registry
- */
- protected Service registerService(String category, String serviceName, String serviceDescription) throws JAXRException
- {
- Service service =null;
- Organization organization = getJBossESBOrganization();
- Connection connection = JAXRRegistryImpl.getConnection();
- try {
- connection.setCredentials(JAXRRegistryImpl.creds);
- RegistryService rs = connection.getRegistryService();
- BusinessLifeCycleManager blm = rs.getBusinessLifeCycleManager();
- //Adding the category as prefix for the name
- service = blm.createService(blm.createInternationalString(category + ":" + serviceName));
- service.setDescription(blm.createInternationalString(serviceDescription));
-// ClassificationScheme cScheme = getClassificationScheme(blm, "uddi-org:general_keywords", "");
-// Classification classification = blm.createClassification(cScheme, "JBossESB" + category, category);
-// service.addClassification(classification);
- organization.addService(service);
- saveRegistryObject(service);
- } finally {
- closeConnection(connection);
- }
- return service;
- }
- /**
- * Remove an EPR from the Registry
- */
- public void unRegisterService(String category, String serviceName) throws RegistryException{
- try {
- Organization organization = getJBossESBOrganization();
- for (Iterator i=organization.getServices().iterator(); i.hasNext();) {
- Service service = (Service) i.next();
- if (service.getName().getValue().equals(category + ":" + serviceName)) {
- organization.removeService(service);
- saveRegistryObject(organization);
- return;
- }
- }
- } catch (JAXRException je) {
- throw new RegistryException(je.getLocalizedMessage(), je);
- }
- }
- /**
- * Publish an EPR to the Registry
- */
- public void registerEPR(String category, String serviceName, String serviceDescription, EPR epr, String eprDescription)
- throws RegistryException
- {
- Connection connection = JAXRRegistryImpl.getConnection();
- try {
- //Find the service
- Service service = findService(category,serviceName);
- if (service==null) {
- logger.log(Priority.INFO, "Service " + serviceName + " does not yet exist, creating now..");
- service = registerService(category, serviceName, serviceDescription);
- }
- connection.setCredentials(JAXRRegistryImpl.creds);
- RegistryService rs = connection.getRegistryService();
- BusinessLifeCycleManager blm = rs.getBusinessLifeCycleManager();
-// BusinessQueryManager bqm = rs.getBusinessQueryManager();
- ServiceBinding serviceBinding = blm.createServiceBinding();
- serviceBinding.setDescription(blm.createInternationalString(eprDescription));
- String xml = EPRHelper.toXMLString(epr);
- serviceBinding.setAccessURI(URLEncoder.encode(xml,"UTF-8"));
-
-// The following code would store the EPR xml as an ExtrinsicObject, but scout does not
-// have an implementation for it.
-// DataHandler repositoryItem = new DataHandler(xml,"text/xml");
-// ExtrinsicObject eo = blm.createExtrinsicObject(repositoryItem);
-// eo.setName(blm.createInternationalString("EPR"));
-// eo.setMimeType("text/xml");
-// String conceptId = "urn:oasis:names:tc:ebxml-regrep:ObjectType:RegistryObject:ExtrinsicObject:XML";
-// Concept objectTypeConcept = (Concept) bqm.getRegistryObject(conceptId);
-// ((ExtrinsicObjectImpl)eo).setObjectType(objectTypeConcept);
-
-// Concept specConcept = blm.createConcept(null, "HelloConcept", "");
-// String schemeName = "uddi-org:types";
-// ClassificationScheme uddiOrgTypes =
-// bqm.findClassificationSchemeByName(null, schemeName);
-// Classification wsdlSpecClassification =
-// blm.createClassification(uddiOrgTypes,
-// "eprSpec", xml);
-// specConcept.addClassification(wsdlSpecClassification);
-// Collection<Concept> concepts = new ArrayList<Concept>();
-// concepts.add(specConcept);
-// BulkResponse br=blm.saveConcepts(concepts);
-// Key conceptKey = null;
-// if (br.getStatus() == JAXRResponse.STATUS_SUCCESS) {
-// Collection keys = br.getCollection();
-// for (Iterator i=keys.iterator();i.hasNext();){
-// conceptKey = (Key) i.next();
-// break;
-// }
-// } else {
-// throw new RegistryException("Could not save the EPR as Concept");
-// }
-// //now adding this concept to the binding
-// Concept specificationConcept = (Concept) bqm.getRegistryObject(conceptKey.getId(), LifeCycleManager.CONCEPT);
-// SpecificationLink specificationLink = blm.createSpecificationLink();
-// specificationLink.setSpecificationObject(specificationConcept);
-// serviceBinding.addSpecificationLink(specificationLink);
-
- ArrayList<ServiceBinding> serviceBindings = new ArrayList<ServiceBinding>();
- serviceBindings.add(serviceBinding);
- service.addServiceBindings(serviceBindings);
- saveRegistryObject(serviceBinding);
- } catch (Exception je) {
- throw new RegistryException(je.getLocalizedMessage(), je);
- } finally {
- closeConnection(connection);
- }
- }
- /**
- * Remove an EPR from the Registry
- */
- public void unRegisterEPR(String category, String serviceName, EPR toBeDeletedEPR) throws RegistryException{
- //first find the ServiceBindings for this service
- try {
- Service service = findService(category, serviceName);
- Collection<ServiceBinding> serviceBindings = findServiceBindings(service);
- for (Iterator i=serviceBindings.iterator();i.hasNext();){
- ServiceBinding serviceBinding = (ServiceBinding) i.next();
- String xml = URLDecoder.decode(serviceBinding.getAccessURI(), "UTF-8");
- if (xml.equals(EPRHelper.toXMLString(toBeDeletedEPR))) {
- service.removeServiceBinding(serviceBinding);
- service.setProvidingOrganization(getJBossESBOrganization());
- saveRegistryObject(service);
- return;
- }
- }
- //We should not end up here or else we did not match any EPRs
- throw new RegistryException("No such EPR found for service with name = "
- + serviceName + " and EPR=" + toBeDeletedEPR);
- } catch (Exception je) {
- throw new RegistryException(je.getLocalizedMessage(), je);
- }
- }
-
- /**
- * {@inheritDoc}
- * @return collection services
- */
- public Collection<String> findAllServices() throws RegistryException
- {
- Collection<String> serviceNames = new ArrayList<String>();
- try {
- Collection services = getJBossESBOrganization().getServices();
- for (Iterator i=services.iterator();i.hasNext();) {
- String serviceName = ((Service)i.next()).getName().getValue();
- serviceNames.add(serviceName);
- }
- } catch (JAXRException je) {
- throw new RegistryException(je.getLocalizedMessage(), je);
- }
- return serviceNames;
- }
- /**
- * Find Services based on a category ("transformation").
- *
- * @param serviceType
- * @return collection services
- */
- public Collection<String> findServices(String category) throws RegistryException
- {
- Collection<String>serviceNames = new ArrayList<String>();
- try {
- Collection<Service>services = findServicesForCategory(category);
- for (Iterator<Service> i=services.iterator();i.hasNext();) {
- String serviceName = i.next().getName().getValue();
- serviceNames.add(serviceName);
- }
- } catch (JAXRException je) {
- throw new RegistryException(je.getLocalizedMessage(), je);
- }
- return serviceNames;
- }
- /**
- *
- * @param service
- * @return
- */
- public Collection<EPR> findEPRs(String category, String serviceName) throws RegistryException
- {
- Collection<EPR> eprs = new ArrayList<EPR>();
- Connection connection = JAXRRegistryImpl.getConnection();
- try {
- Service service = findService(category, serviceName);
- // Get registry service and business query manager
- Collection<ServiceBinding> serviceBindings = findServiceBindings(service);
- //Converting them to EPRs
- for (Iterator i=serviceBindings.iterator();i.hasNext();) {
- ServiceBinding serviceBinding = (ServiceBinding) i.next();
- @SuppressWarnings("unused")
- String eprXML = URLDecoder.decode(serviceBinding.getAccessURI(),"UTF-8");
- //TODO use the XML to generate the EPR
- EPR epr = EPRHelper.fromXMLString(eprXML);
- eprs.add(epr);
- }
- } catch (Exception je) {
- throw new RegistryException(je.getLocalizedMessage(), je);
- } finally {
- closeConnection(connection);
- }
- return eprs;
- }
- /**
- * Find all Organizations with a name mathing the queryString parameter.
- *
- * @param organizationName used to match with the name of the organization.
- * @return the Organization.
- */
- protected static Organization findOrganization(String organizationName) throws JAXRException
- {
- if (organizationName==null) {
- organizationName="";
- }
- Connection connection = JAXRRegistryImpl.getConnection();
- try {
- // Get registry service and business query manager
- RegistryService rs = connection.getRegistryService();
- BusinessQueryManager bqm = rs.getBusinessQueryManager();
- // Define find qualifiers and name patterns
- Collection<String> findQualifiers = new ArrayList<String>();
- findQualifiers.add(FindQualifier.SORT_BY_NAME_ASC);
- Collection<String> namePatterns = new ArrayList<String>();
- namePatterns.add("%" + organizationName + "%");
- //Find based upon qualifier type and values
- System.out.println("Going to query the registry for name pattern " + namePatterns);
- BulkResponse response = bqm.findOrganizations(findQualifiers,
- namePatterns, null, null, null, null);
- if (response.getStatus()==JAXRResponse.STATUS_SUCCESS) {
- for (Iterator orgIter = response.getCollection().iterator(); orgIter.hasNext();)
- {
- Organization org = (Organization) orgIter.next();
- logger.log(Priority.INFO, "Organization name: " + org.getName().getValue());
- logger.log(Priority.INFO, "Description: " + org.getDescription().getValue());
- logger.log(Priority.INFO, "Key id: " + org.getKey().getId());
- User primaryContact = org.getPrimaryContact();
- logger.log(Priority.INFO, "Primary Contact: " + primaryContact.getPersonName().getFullName());
- if (orgIter.hasNext()) {
- logger.log(Priority.ERROR, "Found " + response.getCollection().size()
- + " Organization, while expecting only one of name " + organizationName);
- }
- return org;
- }
- }
- return null;
- } finally {
- closeConnection(connection);
- }
- }
- /**
- *
- * @param category
- * @param serviceName
- * @return Service
- */
- protected static Service findService(String category, String serviceName) throws JAXRException
- {
- if (category==null) {
- category="";
- }
- if (serviceName==null) {
- serviceName="";
- }
- Connection connection = JAXRRegistryImpl.getConnection();
- try {
- // Get registry service and business query manager
- RegistryService rs = connection.getRegistryService();
- BusinessQueryManager bqm = rs.getBusinessQueryManager();
- // Define find qualifiers and name patterns
- Collection<String> findQualifiers = new ArrayList<String>();
- findQualifiers.add(FindQualifier.AND_ALL_KEYS);
- findQualifiers.add(FindQualifier.SORT_BY_NAME_DESC);
- Collection<String> namePatterns = new ArrayList<String>();
- namePatterns.add("%" + category + "%");
- namePatterns.add("%" + serviceName + "%");
- //Find based upon qualifier type and values
- logger.log(Priority.DEBUG, "Going to query the registry for name pattern " + namePatterns);
- BulkResponse response = bqm.findServices(null, findQualifiers,
- namePatterns, null, null);
- if (response.getStatus()==JAXRResponse.STATUS_SUCCESS) {
- for (Iterator servIter = response.getCollection().iterator(); servIter.hasNext();)
- {
- Service service = (Service) servIter.next();
- logger.log(Priority.INFO, "Service name: " + service.getName().getValue());
- if (service.getDescription()!=null) {
- logger.log(Priority.INFO, "Description: " + service.getDescription().getValue());
- }
- logger.log(Priority.INFO, "Key id: " + service.getKey().getId());
- if (servIter.hasNext()) {
- logger.log(Priority.ERROR, "Found " + response.getCollection().size()
- + " Services, while expecting only one by the name of "
- + serviceName + " in category " + category);
- }
- return service;
- }
- }
- return null;
- } finally {
- closeConnection(connection);
- }
- }
- /**
- * Finds all services for a given category.
- * @param category
- * @param serviceName
- * @return Service
- */
- @SuppressWarnings("unchecked")
- protected static Collection<Service> findServicesForCategory(String category) throws JAXRException
- {
- Collection<Service> services = new ArrayList<Service>();
- if (category==null) {
- category="";
- }
- Connection connection = JAXRRegistryImpl.getConnection();
- try {
- // Get registry service and business query manager
- RegistryService rs = connection.getRegistryService();
- BusinessQueryManager bqm = rs.getBusinessQueryManager();
- // Define find qualifiers and name patterns
- Collection<String> findQualifiers = new ArrayList<String>();
- findQualifiers.add(FindQualifier.AND_ALL_KEYS);
- findQualifiers.add(FindQualifier.SORT_BY_NAME_DESC);
- Collection<String> namePatterns = new ArrayList<String>();
- namePatterns.add("%" + category + "%");
- //Find based upon qualifier type and values
- logger.log(Priority.DEBUG, "Going to query the registry for name pattern " + namePatterns);
- BulkResponse response = bqm.findServices(null, findQualifiers,
- namePatterns, null, null);
- if (response.getStatus()==JAXRResponse.STATUS_SUCCESS) {
- services = response.getCollection();
- }
- return services;
- } finally {
- closeConnection(connection);
- }
- }
- /**
- * Create a jbossesb organization under which we will register all our services.
- *
- * @param blm
- * @return
- * @throws JAXRException
- */
- protected static Organization createJBossESBOrganization()
- throws JAXRException
- {
-// Getting the connection to the Registry (reading config)
- Connection connection = JAXRRegistryImpl.getConnection();
- try {
- //Logging in
- connection.setCredentials(JAXRRegistryImpl.creds);
- RegistryService rs = connection.getRegistryService();
- //Building organization
- BusinessLifeCycleManager blm = rs.getBusinessLifeCycleManager();
- Organization organization = blm.createOrganization(blm.createInternationalString("Red Hat/JBossESB"));
- organization.setDescription(blm.createInternationalString("Red Hat/JBoss Professional Open Source, Services for the JBossESB"));
-
- User user = blm.createUser();
- organization.setPrimaryContact(user);
- PersonName personName = blm.createPersonName("JBossESB");
- TelephoneNumber telephoneNumber = blm.createTelephoneNumber();
- telephoneNumber.setNumber("404 467-8555");
- telephoneNumber.setType(null);
- PostalAddress address = blm.createPostalAddress("3340",
- "Peachtree Road, NE, Suite 1200", "Atlanta", "GA", "USA",
- "30326", "");
- Collection<PostalAddress> postalAddresses = new ArrayList<PostalAddress>();
- postalAddresses.add(address);
- Collection<EmailAddress> emailAddresses = new ArrayList<EmailAddress>();
- EmailAddress emailAddress = blm
- .createEmailAddress("jbossesb at jboss.com");
- emailAddresses.add(emailAddress);
-
- Collection<TelephoneNumber> numbers = new ArrayList<TelephoneNumber>();
- numbers.add(telephoneNumber);
- user.setPersonName(personName);
- user.setPostalAddresses(postalAddresses);
- user.setEmailAddresses(emailAddresses);
- user.setTelephoneNumbers(numbers);
-
- // Scout does not support this (yet), so leaving it out for now.
- // ClassificationScheme cScheme = getClassificationScheme(blm,
- // blm.createInternationalString("uddi-org:general_keywords"), blm.createInternationalString(""));
- // Classification classification = blm.createClassification(cScheme,
- // blm..createInternationalString("JBoss ESB"), blm..createInternationalString("JBESB"));
- // org.addClassification(classification);
-
- saveRegistryObject(organization);
- return organization;
- } finally {
- closeConnection(connection);
- }
- }
- /**
- * Save Registry Object
- */
- protected static void saveRegistryObject(RegistryObject registryObject) throws JAXRException
- {
-// Getting the connection to the Registry (reading config)
- Connection connection = JAXRRegistryImpl.getConnection();
- try {
- Collection<RegistryObject> registryObjects = new ArrayList<RegistryObject>();
- BulkResponse br = null;
- //Logging in
- connection.setCredentials(JAXRRegistryImpl.creds);
- RegistryService rs = connection.getRegistryService();
- //Building organization
- BusinessLifeCycleManager blm = rs.getBusinessLifeCycleManager();
- registryObjects.add(registryObject);
- Class[] interfaces = registryObject.getClass().getInterfaces();
- String interfaceName ="";
- for (int i=0; i<interfaces.length; i++) {
- interfaceName = interfaces[i].getName();
- if (interfaceName.equals("javax.xml.registry.infomodel.Organization")) {
- br = blm.saveOrganizations(registryObjects);
- break;
- } else if (interfaceName.equals("javax.xml.registry.infomodel.Service")) {
- br = blm.saveServices(registryObjects);
- break;
- } else if (interfaceName.equals("javax.xml.registry.infomodel.ServiceBinding")) {
- br = blm.saveServiceBindings(registryObjects);
- break;
- } else {
- logger.log(Priority.ERROR, "Trying to save an unsupported RegistryObject");
- throw new JAXRException("Trying to save an unsupported RegistryObject");
- }
- }
- //Verify the return
- if (br!=null && br.getStatus() == JAXRResponse.STATUS_SUCCESS) {
- logger.log(Priority.INFO, interfaceName + " successfully saved");
- Collection coll = br.getCollection();
- Iterator iter = coll.iterator();
- while (iter.hasNext()) {
- Key key = (Key) iter.next();
- registryObject.setKey(key);
- logger.log(Priority.INFO, "Saved Key=" + key.getId());
- }
- } else {
- logger.log(Priority.ERROR, "Errors occurred during save.");
- if (br!=null) {
- Collection exceptions = br.getExceptions();
- Iterator iter = exceptions.iterator();
- String errors = "";
- JAXRException je = new JAXRException("JAXRExceptions occurred during save");
- while (iter.hasNext()) {
- Exception e = (Exception) iter.next();
- errors += e.getLocalizedMessage() + "\n";
- je.setStackTrace(e.getStackTrace());
- logger.log(Priority.ERROR, e.getLocalizedMessage(), e);
- //if it's the last error, throw it now and set the current stacktrace
- if (!iter.hasNext()) {
- throw new JAXRException(errors, e);
- }
- }
- throw new JAXRException("Errors occurred during save. Response status=" + br.getStatus());
- }
- throw new JAXRException("Errors occurred during save");
- }
- } finally {
- JAXRRegistryImpl.closeConnection(connection);
- }
- }
- /**
- * finds the JBossESB Organizationa and creates one if it is not there.
- * @return JBossESB Organization
- * @throws JAXRException
- */
- private Organization getJBossESBOrganization() throws JAXRException
- {
- if (jbossESBOrganization==null) {
- jbossESBOrganization = findOrganization("Red Hat/JBossESB");
- if (jbossESBOrganization==null) {
- jbossESBOrganization = createJBossESBOrganization();
- }
- }
- return jbossESBOrganization;
- }
- /**
- * Find the ServiceBindings for a given Service
- * @param service
- * @return
- * @throws RegistryException
- */
- @SuppressWarnings("unchecked")
- private Collection<ServiceBinding> findServiceBindings(Service service) throws RegistryException
- {
- Collection<ServiceBinding> serviceBindings = new ArrayList<ServiceBinding>();
- Connection connection = JAXRRegistryImpl.getConnection();
- try {
- RegistryService rs = connection.getRegistryService();
- BusinessQueryManager bqm = rs.getBusinessQueryManager();
- Collection<String> findQualifiers = new ArrayList<String>();
- findQualifiers.add(FindQualifier.SORT_BY_NAME_ASC);
- BulkResponse bulkResponse = bqm.findServiceBindings(service.getKey(),findQualifiers,null,null);
- if (bulkResponse.getStatus()==JAXRResponse.STATUS_SUCCESS){
- serviceBindings = bulkResponse.getCollection();
- }
- return serviceBindings;
- } catch (Exception je) {
- throw new RegistryException(je.getLocalizedMessage(), je);
- } finally {
- closeConnection(connection);
- }
- }
-
-}
-
-
Deleted: labs/jbossesb/workspace/b_georges/product/core/services/tests/src/org/jboss/soa/esb/services/beans/PersistHandlerUnitTest.java
===================================================================
--- labs/jbossesb/workspace/b_georges/product/core/services/tests/src/org/jboss/soa/esb/services/beans/PersistHandlerUnitTest.java 2006-11-13 22:23:37 UTC (rev 7579)
+++ labs/jbossesb/workspace/b_georges/product/core/services/tests/src/org/jboss/soa/esb/services/beans/PersistHandlerUnitTest.java 2006-11-13 22:28:36 UTC (rev 7580)
@@ -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);
- }
-
-}
-
-
Deleted: labs/jbossesb/workspace/b_georges/product/core/services/tests/src/org/jboss/soa/esb/services/registry/JAXRRegistryUnitTest.java
===================================================================
--- labs/jbossesb/workspace/b_georges/product/core/services/tests/src/org/jboss/soa/esb/services/registry/JAXRRegistryUnitTest.java 2006-11-13 22:23:37 UTC (rev 7579)
+++ labs/jbossesb/workspace/b_georges/product/core/services/tests/src/org/jboss/soa/esb/services/registry/JAXRRegistryUnitTest.java 2006-11-13 22:28:36 UTC (rev 7580)
@@ -1,281 +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.registry;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-
-import java.io.File;
-import java.io.InputStream;
-import java.net.URLDecoder;
-import java.sql.DriverManager;
-import java.sql.Statement;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.Properties;
-
-import javax.xml.registry.BulkResponse;
-import javax.xml.registry.BusinessLifeCycleManager;
-import javax.xml.registry.BusinessQueryManager;
-import javax.xml.registry.Connection;
-import javax.xml.registry.JAXRException;
-import javax.xml.registry.RegistryService;
-import javax.xml.registry.infomodel.Classification;
-import javax.xml.registry.infomodel.ClassificationScheme;
-import javax.xml.registry.infomodel.Organization;
-import javax.xml.registry.infomodel.Service;
-import javax.xml.registry.infomodel.ServiceBinding;
-import javax.xml.registry.infomodel.User;
-
-import junit.framework.JUnit4TestAdapter;
-
-import org.apache.log4j.Logger;
-import org.apache.log4j.Priority;
-import org.apache.log4j.xml.DOMConfigurator;
-import org.jboss.internal.soa.esb.addressing.EPRHelper;
-import org.jboss.soa.esb.addressing.EPR;
-import org.jboss.soa.esb.common.tests.HsqldbUtil;
-import org.jboss.soa.esb.common.tests.TestUtil;
-import org.jboss.soa.esb.services.util.FileUtil;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-/**
- * Testing the registry.
- *
- * @author kstam
- *
- */
-public class JAXRRegistryUnitTest
-{
- private static Logger logger = Logger.getLogger(JAXRRegistryUnitTest.class);
- private static String mDbDriver;
- private static String mDbUrl;
- private static String mDbUsername;
- private static String mDbPassword;
- /**
- * Tests the successful creation of the RED HAT/JBossESB Organization.
- */
- @Test
- public void publishOrganization()
- {
- try {
- Organization org = JAXRRegistryImpl.createJBossESBOrganization();
- logger.log(Priority.INFO, "Succesfully created organization: " + org.getName().getValue());
- assertEquals("Red Hat/JBossESB", org.getName().getValue());
- } catch (JAXRException je) {
- logger.log(Priority.ERROR, je.getLocalizedMessage(), je);
- assertTrue(false);
- }
- }
- @Test
- public void findOrganization()
- {
- try {
- Organization org = JAXRRegistryImpl.findOrganization("Red Hat/JBossESB");
- logger.log(Priority.INFO, "Succesfully created organization: " + org.getName().getValue());
- assertEquals("Red Hat/JBossESB", org.getName().getValue());
- } catch (JAXRException je) {
- logger.log(Priority.ERROR, je.getLocalizedMessage(), je);
- assertTrue(false);
- }
- try {
- Organization org = JAXRRegistryImpl.findOrganization("Not Existing Org");
- logger.log(Priority.INFO, "Could not find non-existing organization.");
- assertEquals(null, org);
- } catch (JAXRException je) {
- logger.log(Priority.ERROR, je.getLocalizedMessage(), je);
- assertTrue(false);
- }
- }
- /**
- * Tests the successful registration of a Service.
- *
- */
- @Test
- public void publishService()
- {
- try {
- JAXRRegistryImpl registry = new JAXRRegistryImpl();
- registry.registerService("registry", "Registry Test ServiceName", "Registry Test Service Description");
- } catch (JAXRException je) {
- logger.log(Priority.ERROR, je.getLocalizedMessage(), je);
- assertTrue(false);
- }
- }
- @Test
- public void publishServiceBinding()
- {
- try {
- EPR epr = new EPR();
- JAXRRegistryImpl registry = new JAXRRegistryImpl();
- registry.registerEPR("registry", "Registry Test ServiceName", "Registry Test Service Description",
- epr, "EPR description");
- } catch (RegistryException re) {
- logger.log(Priority.ERROR, re.getLocalizedMessage(), re);
- assertTrue(false);
- }
- }
- /**
- * Queries the newly added information
- * @throws Exception
- */
- @Test
- public void findServicesForAnOrganization()
- {
- try {
- Organization org = JAXRRegistryImpl.findOrganization("Red Hat/JBossESB");
- //Listing out the services and their Bindings
- logger.log(Priority.INFO, "-------------------------------------------------");
- logger.log(Priority.INFO, "Organization name: " + org.getName().getValue());
- logger.log(Priority.INFO, "Description: " + org.getDescription().getValue());
- logger.log(Priority.INFO, "Key id: " + org.getKey().getId());
- User primaryContact = org.getPrimaryContact();
- logger.log(Priority.INFO, "Primary Contact: " + primaryContact.getPersonName().getFullName());
- Collection services = org.getServices();
- for (Iterator serviceIter = services.iterator();serviceIter.hasNext();) {
- Service service = (Service) serviceIter.next();
- logger.log(Priority.INFO, "- Service Name: " + service.getName().getValue());
- logger.log(Priority.INFO, " Service Key : " + service.getKey().getId());
- Collection serviceBindings = service.getServiceBindings();
- for (Iterator serviceBindingIter = serviceBindings.iterator();serviceBindingIter.hasNext();){
- ServiceBinding serviceBinding = (ServiceBinding) serviceBindingIter.next();
- logger.log(Priority.INFO, " ServiceBinding Description: " + serviceBinding.getDescription().getValue());
- String xml = URLDecoder.decode(serviceBinding.getAccessURI(),"UTF-8");
- logger.log(Priority.INFO, " ServiceBinding URI: " + xml);
- assertEquals(EPRHelper.toXMLString(new EPR()),xml);
- }
- }
- logger.log(Priority.INFO, "-------------------------------------------------");
- } catch (Exception je) {
- je.printStackTrace();
- assertTrue(false);
- }
- }
- /**
- * This doesn't work because scout drops the classifications on the floor.
- * We're ignoring this test until I come up with a patch.
- *
- */
- public void findServicesByClassification()
- {
- Connection connection = JAXRRegistryImpl.getConnection();
- try {
- // Get registry service and business query manager
- RegistryService rs = connection.getRegistryService();
- BusinessQueryManager bqm = rs.getBusinessQueryManager();
- BusinessLifeCycleManager blm = rs.getBusinessLifeCycleManager();
- ClassificationScheme classificationScheme = bqm.findClassificationSchemeByName(null, "uddi-org:general_keywords");
- Classification classification = blm.createClassification(classificationScheme,
- "Test transformation service", "transformation");
- Collection<Classification> classifications = new ArrayList<Classification>();
- classifications.add(classification);
- //Here I'd like to test filtering by this classification, but scout ignored the classification
- String name=classificationScheme.getName().getValue();
- System.out.println("Name=" + name);
- Collection<String> nameParams = new ArrayList<String>();
- //The name of the service is wild
- nameParams.add("%");
- BulkResponse bs = bqm.findServices(null, null,nameParams,classifications, null);
- int status = bs.getStatus();
- System.out.println("status=" + status);
- } catch (JAXRException je) {
- je.printStackTrace();
- }
- finally{}
- }
- /**
- * Setup the database.
- * @throws Exception
- */
- @BeforeClass
- public static void runBeforeAllTests() throws Exception {
- try {
- DOMConfigurator.configure(TestUtil.getPrefix() + "/etc/test/resources/log4j.xml");
- TestUtil.setESBPropertiesFileToUse();
- //Set the juddi properties file in System so juddi will pick it up later and use the test values.
- String juddiPropertiesFile = "/org/jboss/soa/esb/services/registry/juddi-unittest.properties";
- System.setProperty("juddi.propertiesFile", juddiPropertiesFile);
- //Read this properties file to get the db connection string
- Properties props = new Properties();
- InputStream inStream = Class.class.getResourceAsStream(juddiPropertiesFile);
- props.load(inStream);
- mDbDriver = props.getProperty("juddi.jdbcDriver");
- mDbUrl = props.getProperty("juddi.jdbcUrl");
- mDbUsername = props.getProperty("juddi.jdbcUsername");
- mDbPassword = props.getProperty("juddi.jdbcPassword");
-
- String database="not tested yet";
- if ("org.hsqldb.jdbcDriver".equals(mDbDriver)) {
- database = "hsqldb";
- //Bring up hsql on default port 9001
- HsqldbUtil.startHsqldb(TestUtil.getPrefix() + "build/hsqltestdb", "juddi");
- } else if ("com.mysql.jdbc.Driver".equals(mDbDriver)) {
- database = "mysql";
- } //add and test your own database..
-
- //Get the registry-schema create scripts
- String sqlDir = TestUtil.getPrefix() + "install/jUDDI-registry/sql/" + database + "/";
- //Drop what is there now, if exists. We want to start fresh.
- String sqlDropCmd = FileUtil.readTextFile(new File(sqlDir + "drop_database.sql"));
- String sqlCreateCmd = FileUtil.readTextFile(new File(sqlDir + "create_database.sql"));
- String sqlInsertPubCmd = FileUtil.readTextFile(new File(sqlDir + "insert_publishers.sql"));
-
- try {
- Class.forName(mDbDriver);
- } catch (Exception e) {
- System.out.println("ERROR: failed to load " + database + " JDBC driver.");
- e.printStackTrace();
- return;
- }
- java.sql.Connection con = DriverManager.getConnection(mDbUrl, mDbUsername, mDbPassword);
- Statement stmnt = con.createStatement();
- System.out.println("Dropping the schema if exist");
- stmnt.execute(sqlDropCmd);
- System.out.println("Creating the juddi-schema");
- stmnt.execute(sqlCreateCmd);
- System.out.println("Adding the jbossesb publisher");
- stmnt.execute(sqlInsertPubCmd);
- } catch (Exception e) {
- e.printStackTrace();
- System.out.println("We should stop testing, since we don't have a db.");
- assertTrue(false);
- }
- }
- /**
- * Shutdown the database
- * @throws Exception
- */
- @AfterClass
- public static void runAfterAllTests() throws Exception {
- if ("org.hsqldb.jdbcDriver".equals(mDbDriver)) {
- HsqldbUtil.stopHsqldb(mDbUrl, mDbUsername, mDbPassword);
- }
- }
-
- public static junit.framework.Test suite() {
- return new JUnit4TestAdapter(JAXRRegistryUnitTest.class);
- }
-
-}
More information about the jboss-svn-commits
mailing list