Author: seanahn
Date: Sun Mar 29 03:29:43 2009
New Revision: 759636

URL: http://svn.apache.org/viewvc?rev=759636&view=rev
Log:
reformatted tabs to spaces, fixed the lock query on correlatordaoimpl

Modified:
    
ode/branches/APACHE_ODE_1.X/bpel-store/src/main/java/org/apache/ode/store/ProcessStoreImpl.java
    
ode/branches/APACHE_ODE_1.X/bpel-store/src/main/java/org/apache/ode/store/jpa/DbConfStoreConnectionFactory.java
    
ode/branches/APACHE_ODE_1.X/dao-hibernate/src/main/java/org/apache/ode/daohib/SessionManager.java
    
ode/branches/APACHE_ODE_1.X/dao-hibernate/src/main/java/org/apache/ode/daohib/bpel/CorrelatorDaoImpl.java
    
ode/branches/APACHE_ODE_1.X/dao-hibernate/src/main/java/org/apache/ode/daohib/bpel/HibernateDao.java
    
ode/branches/APACHE_ODE_1.X/dao-hibernate/src/main/java/org/apache/ode/daohib/bpel/ProcessDaoImpl.java
    
ode/branches/APACHE_ODE_1.X/utils/src/main/java/org/apache/ode/utils/LoggingInterceptor.java

Modified: 
ode/branches/APACHE_ODE_1.X/bpel-store/src/main/java/org/apache/ode/store/ProcessStoreImpl.java
URL: 
http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.X/bpel-store/src/main/java/org/apache/ode/store/ProcessStoreImpl.java?rev=759636&r1=759635&r2=759636&view=diff
==============================================================================
--- 
ode/branches/APACHE_ODE_1.X/bpel-store/src/main/java/org/apache/ode/store/ProcessStoreImpl.java
 (original)
+++ 
ode/branches/APACHE_ODE_1.X/bpel-store/src/main/java/org/apache/ode/store/ProcessStoreImpl.java
 Sun Mar 29 03:29:43 2009
@@ -114,24 +114,24 @@
     public ProcessStoreImpl(EndpointReferenceContext eprContext, DataSource 
ds, String persistenceType, OdeConfigProperties props, boolean createDatamodel) 
{
         this.eprContext = eprContext;
         if (ds != null) {
-                       // ugly hack
-                       if (persistenceType.toLowerCase().indexOf("hib") != -1) 
{
-                               _cf = new 
org.apache.ode.store.hib.DbConfStoreConnectionFactory(ds, 
props.getProperties(), createDatamodel, props.getTxFactoryClass());
-                       } else {
-                               _cf = new 
org.apache.ode.store.jpa.DbConfStoreConnectionFactory(ds, createDatamodel, 
props.getTxFactoryClass());
-                       }
-               } else {
-                       // If the datasource is not provided, then we create a 
HSQL-based
-                       // in-memory database. Makes testing a bit simpler.
-                       DataSource hsqlds = createInternalDS(new 
GUID().toString());
-                       if ("hibernate".equalsIgnoreCase(persistenceType)) {
-                               _cf = new 
org.apache.ode.store.hib.DbConfStoreConnectionFactory(hsqlds, 
props.getProperties(), createDatamodel, props.getTxFactoryClass());
-                       } else {
-                               _cf = new 
org.apache.ode.store.jpa.DbConfStoreConnectionFactory(hsqlds, createDatamodel, 
props.getTxFactoryClass());
-                       }
-                       _inMemDs = hsqlds;
-               }
-       }
+            // ugly hack
+            if (persistenceType.toLowerCase().indexOf("hib") != -1) {
+                _cf = new 
org.apache.ode.store.hib.DbConfStoreConnectionFactory(ds, 
props.getProperties(), createDatamodel, props.getTxFactoryClass());
+            } else {
+                _cf = new 
org.apache.ode.store.jpa.DbConfStoreConnectionFactory(ds, createDatamodel, 
props.getTxFactoryClass());
+            }
+         } else {
+            // If the datasource is not provided, then we create a HSQL-based
+            // in-memory database. Makes testing a bit simpler.
+            DataSource hsqlds = createInternalDS(new GUID().toString());
+            if ("hibernate".equalsIgnoreCase(persistenceType)) {
+                _cf = new 
org.apache.ode.store.hib.DbConfStoreConnectionFactory(hsqlds, 
props.getProperties(), createDatamodel, props.getTxFactoryClass());
+            } else {
+                _cf = new 
org.apache.ode.store.jpa.DbConfStoreConnectionFactory(hsqlds, createDatamodel, 
props.getTxFactoryClass());
+            }
+            _inMemDs = hsqlds;
+        }
+    }
 
     /**
      * Constructor that hardwires OpenJPA on a new in-memory database. 
Suitable for tests.
@@ -716,7 +716,7 @@
             } finally {
                 if (!success)
                     try {
-                                   _cf.rollbackTransaction();
+                        _cf.rollbackTransaction();
                     } catch (Exception ex) {
                         __log.error("DbError", ex);
                     }

Modified: 
ode/branches/APACHE_ODE_1.X/bpel-store/src/main/java/org/apache/ode/store/jpa/DbConfStoreConnectionFactory.java
URL: 
http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.X/bpel-store/src/main/java/org/apache/ode/store/jpa/DbConfStoreConnectionFactory.java?rev=759636&r1=759635&r2=759636&view=diff
==============================================================================
--- 
ode/branches/APACHE_ODE_1.X/bpel-store/src/main/java/org/apache/ode/store/jpa/DbConfStoreConnectionFactory.java
 (original)
+++ 
ode/branches/APACHE_ODE_1.X/bpel-store/src/main/java/org/apache/ode/store/jpa/DbConfStoreConnectionFactory.java
 Sun Mar 29 03:29:43 2009
@@ -36,15 +36,15 @@
  * @author Matthieu Riou <mriou at apache dot org>
  */
 public class DbConfStoreConnectionFactory implements 
ConfStoreConnectionFactory {
-       private static final Log __log = 
LogFactory.getLog(DbConfStoreConnectionFactory.class);
-       
+    private static final Log __log = 
LogFactory.getLog(DbConfStoreConnectionFactory.class);
+
     private DataSource _ds;
     private EntityManagerFactory _emf;
 
     private TransactionManager _txMgr;
-    
+
     @SuppressWarnings("unchecked")
-       public DbConfStoreConnectionFactory(DataSource ds, boolean 
createDatamodel, String txFactoryClassName) {
+    public DbConfStoreConnectionFactory(DataSource ds, boolean 
createDatamodel, String txFactoryClassName) {
         _ds = ds;
         initTxMgr(txFactoryClassName);
 
@@ -63,49 +63,49 @@
     }
 
     @SuppressWarnings("unchecked")
-       public ConfStoreConnection getConnection() {
-       HashMap propMap2 = new HashMap();
-       propMap2.put("openjpa.TransactionMode", "managed");
+    public ConfStoreConnection getConnection() {
+        HashMap propMap2 = new HashMap();
+        propMap2.put("openjpa.TransactionMode", "managed");
         return new ConfStoreConnectionJpa(_emf.createEntityManager(propMap2));
     }
 
     public void beginTransaction() {
-               try {
-                       if(__log.isDebugEnabled()) __log.debug("begin 
transaction on " + _txMgr);
-                       _txMgr.begin();
-               } catch (Exception e) {
-                       throw new RuntimeException(e);
-               }
-       }
-
-       public void commitTransaction() {
-               try {
-                       if(__log.isDebugEnabled()) __log.debug("commit 
transaction on " + _txMgr);
-                       _txMgr.commit();
-               } catch (Exception e) {
-                       throw new RuntimeException(e);
-               }
-       }
-
-       public void rollbackTransaction() {
-               try {
-                       if(__log.isDebugEnabled()) __log.debug("rollback 
transaction on " + _txMgr);
-                       _txMgr.rollback();
-               } catch (Exception e) {
-                       throw new RuntimeException(e);
-               }
-       }
-
-       @SuppressWarnings("unchecked")
-       private void initTxMgr(String txFactoryClassName) {
-               __log.info("ProcessStore initializing transaction manager using 
" + txFactoryClassName);
-               try {
-                       Class txFactClass = 
getClass().getClassLoader().loadClass(txFactoryClassName);
-                       Object txFact = txFactClass.newInstance();
-                       _txMgr = (TransactionManager) 
txFactClass.getMethod("getTransactionManager", (Class[]) null).invoke(txFact);
-               } catch (Exception e) {
-                       __log.fatal("Couldn't initialize a transaction manager 
with factory: " + txFactoryClassName, e);
-                       throw new RuntimeException("Couldn't initialize a 
transaction manager with factory: " + txFactoryClassName, e);
-               }
-       }       
+        try {
+            if(__log.isDebugEnabled()) __log.debug("begin transaction on " + 
_txMgr);
+            _txMgr.begin();
+        } catch (Exception e) {
+            throw new RuntimeException(e);
+        }
+    }
+
+    public void commitTransaction() {
+        try {
+            if(__log.isDebugEnabled()) __log.debug("commit transaction on " + 
_txMgr);
+            _txMgr.commit();
+        } catch (Exception e) {
+            throw new RuntimeException(e);
+        }
+    }
+
+    public void rollbackTransaction() {
+        try {
+            if(__log.isDebugEnabled()) __log.debug("rollback transaction on " 
+ _txMgr);
+            _txMgr.rollback();
+        } catch (Exception e) {
+            throw new RuntimeException(e);
+        }
+    }
+
+    @SuppressWarnings("unchecked")
+    private void initTxMgr(String txFactoryClassName) {
+        __log.info("ProcessStore initializing transaction manager using " + 
txFactoryClassName);
+        try {
+            Class txFactClass = 
getClass().getClassLoader().loadClass(txFactoryClassName);
+            Object txFact = txFactClass.newInstance();
+            _txMgr = (TransactionManager) 
txFactClass.getMethod("getTransactionManager", (Class[]) null).invoke(txFact);
+        } catch (Exception e) {
+            __log.fatal("Couldn't initialize a transaction manager with 
factory: " + txFactoryClassName, e);
+            throw new RuntimeException("Couldn't initialize a transaction 
manager with factory: " + txFactoryClassName, e);
+        }
+    }
 }
\ No newline at end of file

Modified: 
ode/branches/APACHE_ODE_1.X/dao-hibernate/src/main/java/org/apache/ode/daohib/SessionManager.java
URL: 
http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.X/dao-hibernate/src/main/java/org/apache/ode/daohib/SessionManager.java?rev=759636&r1=759635&r2=759636&view=diff
==============================================================================
--- 
ode/branches/APACHE_ODE_1.X/dao-hibernate/src/main/java/org/apache/ode/daohib/SessionManager.java
 (original)
+++ 
ode/branches/APACHE_ODE_1.X/dao-hibernate/src/main/java/org/apache/ode/daohib/SessionManager.java
 Sun Mar 29 03:29:43 2009
@@ -43,9 +43,9 @@
  * managing sessions.
  */
 public class SessionManager {
-       private static final Log __log = 
LogFactory.getLog(SessionManager.class);
-       
-       public static final String PROP_GUID = "ode.hibernate.guid";
+  private static final Log __log = LogFactory.getLog(SessionManager.class);
+
+  public static final String PROP_GUID = "ode.hibernate.guid";
   
   private static final Map<String, TransactionManager> _txManagers =
     Collections.synchronizedMap(new HashMap<String, TransactionManager>());
@@ -78,7 +78,7 @@
   public static void registerTransactionManager(String uuid, 
TransactionManager txm) {
        _txManagers.put(uuid, txm);
   }
-         
+
   /**
    * Get the current Hibernate Session.
    */

Modified: 
ode/branches/APACHE_ODE_1.X/dao-hibernate/src/main/java/org/apache/ode/daohib/bpel/CorrelatorDaoImpl.java
URL: 
http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.X/dao-hibernate/src/main/java/org/apache/ode/daohib/bpel/CorrelatorDaoImpl.java?rev=759636&r1=759635&r2=759636&view=diff
==============================================================================
--- 
ode/branches/APACHE_ODE_1.X/dao-hibernate/src/main/java/org/apache/ode/daohib/bpel/CorrelatorDaoImpl.java
 (original)
+++ 
ode/branches/APACHE_ODE_1.X/dao-hibernate/src/main/java/org/apache/ode/daohib/bpel/CorrelatorDaoImpl.java
 Sun Mar 29 03:29:43 2009
@@ -98,68 +98,47 @@
 
     @SuppressWarnings("unchecked")
     public List<MessageRouteDAO> findRoute(CorrelationKeySet keySet) {
-       List<MessageRouteDAO> routes = new ArrayList<MessageRouteDAO>();
-       
+        List<MessageRouteDAO> routes = new ArrayList<MessageRouteDAO>();
+
         entering("CorrelatorDaoImpl.findRoute");
         String hdr = "findRoute(keySet=" + keySet + "): ";
-        if (__log.isDebugEnabled())
-            __log.debug(hdr);
+        if (__log.isDebugEnabled()) __log.debug(hdr);
 
-        // Make sure we obtain a lock for the selector we want to find. Note 
that a SELECT FOR UPDATE
-        // will not necessarily work, as different DB vendors attach a 
different meaning to this syntax.
-        // In particular it is not clear how long the lock should be held, for 
the lifetime of the 
-        // resulting cursor, or for the lifetime of the transaction. So 
really, an UPDATE of the row
-        // is a much safer alternative.
         String processType = new QName(_hobj.getProcess().getTypeNamespace(), 
_hobj.getProcess().getTypeName()).toString();
-       List<CorrelationKeySet> subSets = keySet.findSubSets();
-        Query lockQry = 
getSession().createQuery(generateSelectorQuery(LOCK_SELECTORS, subSets));
-        lockQry.setString("processType", processType);
-       for( int i = 0; i < subSets.size(); i++ ) {
-               lockQry.setString("s" + i, subSets.get(i).toCanonicalString());
-       }
-        if (lockQry.executeUpdate() > 0) {
-            Query q = 
getSession().createQuery(generateSelectorQuery(FLTR_SELECTORS, subSets));
-            
-            q.setString("processType", processType);
-            q.setString("correlatorId", _hobj.getCorrelatorId());
+        List<CorrelationKeySet> subSets = keySet.findSubSets();
+        
+        Query q = 
getSession().createQuery(generateSelectorQuery(FLTR_SELECTORS, subSets));
+        q.setString("processType", processType);
+        q.setString("correlatorId", _hobj.getCorrelatorId());
 
-               for( int i = 0; i < subSets.size(); i++ ) {
-                       q.setString("s" + i, 
subSets.get(i).toCanonicalString());
-               }
-            q.setLockMode("hs", LockMode.UPGRADE);
+        for( int i = 0; i < subSets.size(); i++ ) {
+            q.setString("s" + i, subSets.get(i).toCanonicalString());
+        }
+        // Make sure we obtain a lock for the selector we want to find.
+        q.setLockMode("hs", LockMode.UPGRADE);
 
-            HCorrelatorSelector selector;
-            try {
-               boolean routed = false;
-               Iterator selectors = q.iterate();
-               while (selectors.hasNext()) {
-                    selector = (HCorrelatorSelector) selectors.next();
-                    if (selector != null) {
-                       if ("all".equals(selector.getRoute())) {
-                               routes.add(new MessageRouteDaoImpl(_sm, 
selector));
-                       } else {
-                               if (!routed){
-                               routes.add(new MessageRouteDaoImpl(_sm, 
selector));
-                               }
-                               routed = true;
-                       }
+        HCorrelatorSelector selector;
+        Iterator selectors = null;
+        try {
+            List<HProcessInstance> targets = new ArrayList<HProcessInstance>();
+            selectors = q.iterate();
+            while (selectors.hasNext()) {
+                selector = (HCorrelatorSelector) selectors.next();
+                if (selector != null) {
+                    if ("all".equals(selector.getRoute()) ||
+                            ("one".equals(selector.getRoute()) && 
!targets.contains(selector.getInstance()))) {
+                        routes.add(new MessageRouteDaoImpl(_sm, selector));
+                        targets.add(selector.getInstance());
                     }
-               }
-            } catch (Exception ex) {
-                __log.debug("Strange, could not get a unique result for 
findRoute, trying to iterate instead.");
-
-                Iterator i = q.iterate();
-                if (i.hasNext()) selector = (HCorrelatorSelector) i.next();
-                else selector = null;
-                Hibernate.close(i);
+                }
             }
-    
-            if (__log.isDebugEnabled())
-                __log.debug(hdr + "found " + routes);
-            return routes;
-        } 
+        } finally {
+            if (selectors != null) Hibernate.close(selectors);
+        }
+
+        if(__log.isDebugEnabled()) __log.debug(hdr + "found " + routes);
         
-        return null;
+        return routes;
     }
 
     private String generateUnmatchedQuery(List<CorrelationKeySet> subSets) {

Modified: 
ode/branches/APACHE_ODE_1.X/dao-hibernate/src/main/java/org/apache/ode/daohib/bpel/HibernateDao.java
URL: 
http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.X/dao-hibernate/src/main/java/org/apache/ode/daohib/bpel/HibernateDao.java?rev=759636&r1=759635&r2=759636&view=diff
==============================================================================
--- 
ode/branches/APACHE_ODE_1.X/dao-hibernate/src/main/java/org/apache/ode/daohib/bpel/HibernateDao.java
 (original)
+++ 
ode/branches/APACHE_ODE_1.X/dao-hibernate/src/main/java/org/apache/ode/daohib/bpel/HibernateDao.java
 Sun Mar 29 03:29:43 2009
@@ -43,40 +43,40 @@
     protected final HObject _hobj;
 
        protected HibernateDao(SessionManager sessionManager, HObject hobj) {
-    _sm = sessionManager;
-               _hobj = hobj;
-       }
+        _sm = sessionManager;
+        _hobj = hobj;
+    }
 
     void entering(String msg){
         // add a prefix to be parser friendly 
         if(logDao.isDebugEnabled()) logDao.debug("entering "+msg);
     }
 
-       /**
-        * @see org.apache.ode.utils.dao.DAO#getDHandle()
-        */
-       public Serializable getDHandle() {
-    return new HibernateHandle(getClass(), _hobj.getClass(), 
getSession().getIdentifier(_hobj));
-       }
-  
-  protected Session getSession(){
-       return _sm.getSession();
-  }
-  
-  public HObject getHibernateObj(){
-       return _hobj;
-  }
-  
-  public boolean equals(Object obj){
-       assert obj instanceof HibernateDao;
-    return _hobj.getId().equals(((HibernateDao)obj)._hobj.getId());
-  }
-  
-  public int hashCode(){
-       return _hobj.getId().hashCode();
-  }
+    /**
+     * @see org.apache.ode.utils.dao.DAO#getDHandle()
+     */
+    public Serializable getDHandle() {
+        return new HibernateHandle(getClass(), _hobj.getClass(), 
getSession().getIdentifier(_hobj));
+    }
   
-  protected void update() {
-    _sm.getSession().update(_hobj);
-  }
+    protected Session getSession() {
+        return _sm.getSession();
+    }
+
+    public HObject getHibernateObj() {
+        return _hobj;
+    }
+
+    public boolean equals(Object obj) {
+        assert obj instanceof HibernateDao;
+        return _hobj.getId().equals(((HibernateDao) obj)._hobj.getId());
+    }
+
+    public int hashCode() {
+        return _hobj.getId().hashCode();
+    }
+
+    protected void update() {
+        _sm.getSession().update(_hobj);
+    }
 }

Modified: 
ode/branches/APACHE_ODE_1.X/dao-hibernate/src/main/java/org/apache/ode/daohib/bpel/ProcessDaoImpl.java
URL: 
http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.X/dao-hibernate/src/main/java/org/apache/ode/daohib/bpel/ProcessDaoImpl.java?rev=759636&r1=759635&r2=759636&view=diff
==============================================================================
--- 
ode/branches/APACHE_ODE_1.X/dao-hibernate/src/main/java/org/apache/ode/daohib/bpel/ProcessDaoImpl.java
 (original)
+++ 
ode/branches/APACHE_ODE_1.X/dao-hibernate/src/main/java/org/apache/ode/daohib/bpel/ProcessDaoImpl.java
 Sun Mar 29 03:29:43 2009
@@ -59,10 +59,10 @@
  * Hibernate-based {...@link ProcessDAO} implementation.
  */
 public class ProcessDaoImpl extends HibernateDao implements ProcessDAO {
-       @SuppressWarnings("unused")
-       private static final Log __log = 
LogFactory.getLog(ProcessDaoImpl.class);
-       
-       private static final String QRY_CORRELATOR = "where this.correlatorId = 
?";
+    @SuppressWarnings("unused")
+    private static final Log __log = LogFactory.getLog(ProcessDaoImpl.class);
+
+    private static final String QRY_CORRELATOR = "where this.correlatorId = ?";
 
     private HProcess _process;
 
@@ -85,7 +85,7 @@
     }
 
     @SuppressWarnings("unchecked")
-       public CorrelatorDAO getCorrelator(String  corrId) {
+    public CorrelatorDAO getCorrelator(String  corrId) {
         entering("ProcessDaoImpl.getCorrelator");
         Iterator results;
         Query q = getSession().createFilter(_process.getCorrelators(),
@@ -147,61 +147,61 @@
 
         deleteEvents();
         deleteCorrelations();
-               deleteMessages();
-               deleteVariables();
-               deleteProcessInstances();
-
-               getSession().delete(_process); // this deletes HCorrelator -> 
HCorrelatorSelector
-               
-               // after this delete, we have a use case that creates the 
process with the same procid.
-               // for hibernate to work without the database deferred 
constraint check, let's just flush the session.
-               getSession().flush();
+        deleteMessages();
+        deleteVariables();
+        deleteProcessInstances();
+
+        getSession().delete(_process); // this deletes HCorrelator -> 
HCorrelatorSelector
+
+        // after this delete, we have a use case that creates the process with 
the same procid.
+        // for hibernate to work without the database deferred constraint 
check, let's just flush the session.
+        getSession().flush();
     }
 
     private void deleteProcessInstances() {
-               
getSession().getNamedQuery(HLargeData.DELETE_ACTIVITY_RECOVERY_LDATA_BY_PROCESS).setParameter
 ("process", _process).executeUpdate();
-               
getSession().getNamedQuery(HActivityRecovery.DELETE_ACTIVITY_RECOVERIES_BY_PROCESS).setParameter
 ("process", _process).executeUpdate();
-               
getSession().getNamedQuery(HLargeData.DELETE_FAULT_LDATA_BY_PROCESS).setParameter("process",
 _process).executeUpdate();
+        
getSession().getNamedQuery(HLargeData.DELETE_ACTIVITY_RECOVERY_LDATA_BY_PROCESS).setParameter
 ("process", _process).executeUpdate();
+        
getSession().getNamedQuery(HActivityRecovery.DELETE_ACTIVITY_RECOVERIES_BY_PROCESS).setParameter
 ("process", _process).executeUpdate();
+        
getSession().getNamedQuery(HLargeData.DELETE_FAULT_LDATA_BY_PROCESS).setParameter("process",
 _process).executeUpdate();
         
getSession().getNamedQuery(HFaultData.DELETE_FAULTS_BY_PROCESS).setParameter("process",
 _process).executeUpdate();
         
getSession().getNamedQuery(HLargeData.DELETE_JACOB_LDATA_BY_PROCESS).setParameter("process",
 _process).executeUpdate();
         
getSession().getNamedQuery(HProcessInstance.DELETE_INSTANCES_BY_PROCESS).setParameter("process",
 _process).executeUpdate();
     }
 
     private void deleteVariables() {
-               
getSession().getNamedQuery(HCorrelationProperty.DELETE_CORPROPS_BY_PROCESS).setParameter
 ("process", _process).executeUpdate();
-               
getSession().getNamedQuery(HCorrelationSet.DELETE_CORSETS_BY_PROCESS).setParameter
 ("process", _process).executeUpdate();
+        
getSession().getNamedQuery(HCorrelationProperty.DELETE_CORPROPS_BY_PROCESS).setParameter
 ("process", _process).executeUpdate();
+        
getSession().getNamedQuery(HCorrelationSet.DELETE_CORSETS_BY_PROCESS).setParameter
 ("process", _process).executeUpdate();
 
-               
getSession().getNamedQuery(HVariableProperty.DELETE_VARIABLE_PROPERITES_BY_PROCESS).setParameter
 ("process", _process).executeUpdate();
-               
getSession().getNamedQuery(HLargeData.DELETE_XMLDATA_LDATA_BY_PROCESS).setParameter
 ("process", _process).executeUpdate();
-               
getSession().getNamedQuery(HXmlData.DELETE_XMLDATA_BY_PROCESS).setParameter 
("process", _process).executeUpdate();
-
-               
getSession().getNamedQuery(HLargeData.DELETE_PARTNER_LINK_LDATA_BY_PROCESS).setParameter
 ("process", _process).setParameter ("process2", _process).executeUpdate();
-               
getSession().getNamedQuery(HPartnerLink.DELETE_PARTNER_LINKS_BY_PROCESS).setParameter
 ("process", _process).executeUpdate();
-               
getSession().getNamedQuery(HScope.DELETE_SCOPES_BY_PROCESS).setParameter 
("process", _process).executeUpdate();
+        
getSession().getNamedQuery(HVariableProperty.DELETE_VARIABLE_PROPERITES_BY_PROCESS).setParameter
 ("process", _process).executeUpdate();
+        
getSession().getNamedQuery(HLargeData.DELETE_XMLDATA_LDATA_BY_PROCESS).setParameter
 ("process", _process).executeUpdate();
+        
getSession().getNamedQuery(HXmlData.DELETE_XMLDATA_BY_PROCESS).setParameter 
("process", _process).executeUpdate();
+
+        
getSession().getNamedQuery(HLargeData.DELETE_PARTNER_LINK_LDATA_BY_PROCESS).setParameter
 ("process", _process).setParameter ("process2", _process).executeUpdate();
+        
getSession().getNamedQuery(HPartnerLink.DELETE_PARTNER_LINKS_BY_PROCESS).setParameter
 ("process", _process).executeUpdate();
+        
getSession().getNamedQuery(HScope.DELETE_SCOPES_BY_PROCESS).setParameter 
("process", _process).executeUpdate();
     }
 
     private void deleteMessages() {
-               
getSession().getNamedQuery(HCorrelatorMessage.DELETE_CORMESSAGES_BY_PROCESS).setParameter
 ("process", _process).executeUpdate();
+        
getSession().getNamedQuery(HCorrelatorMessage.DELETE_CORMESSAGES_BY_PROCESS).setParameter
 ("process", _process).executeUpdate();
 
-               
getSession().getNamedQuery(HLargeData.DELETE_MESSAGE_LDATA_BY_PROCESS).setParameter("process",
 _process).setParameter ("process2", _process).executeUpdate();
-               
getSession().getNamedQuery(HMessage.DELETE_MESSAGES_BY_PROCESS).setParameter("process",
 _process).executeUpdate();
-               
getSession().getNamedQuery(HMessageExchangeProperty.DELETE_MEX_PROPS_BY_PROCESS).setParameter("process",
 _process).executeUpdate();
-               
getSession().getNamedQuery(HLargeData.DELETE_MEX_LDATA_BY_PROCESS).setParameter("process",
 _process).setParameter("process2", _process).executeUpdate();
-               
getSession().getNamedQuery(HMessageExchange.DELETE_MEX_BY_PROCESS).setParameter("process",
 _process).executeUpdate();
-               
getSession().getNamedQuery(HCorrelator.DELETE_CORRELATORS_BY_PROCESS).setParameter("process",
 _process).executeUpdate();
+        
getSession().getNamedQuery(HLargeData.DELETE_MESSAGE_LDATA_BY_PROCESS).setParameter("process",
 _process).setParameter ("process2", _process).executeUpdate();
+        
getSession().getNamedQuery(HMessage.DELETE_MESSAGES_BY_PROCESS).setParameter("process",
 _process).executeUpdate();
+        
getSession().getNamedQuery(HMessageExchangeProperty.DELETE_MEX_PROPS_BY_PROCESS).setParameter("process",
 _process).executeUpdate();
+        
getSession().getNamedQuery(HLargeData.DELETE_MEX_LDATA_BY_PROCESS).setParameter("process",
 _process).setParameter("process2", _process).executeUpdate();
+        
getSession().getNamedQuery(HMessageExchange.DELETE_MEX_BY_PROCESS).setParameter("process",
 _process).executeUpdate();
+        
getSession().getNamedQuery(HCorrelator.DELETE_CORRELATORS_BY_PROCESS).setParameter("process",
 _process).executeUpdate();
     }
 
     private void deleteCorrelations() {
-               
getSession().getNamedQuery(HCorrelationProperty.DELETE_CORPROPS_BY_PROCESS).setParameter
 ("process", _process).executeUpdate();
-               
getSession().getNamedQuery(HCorrelationSet.DELETE_CORSETS_BY_PROCESS).setParameter
 ("process", _process).executeUpdate();
+        
getSession().getNamedQuery(HCorrelationProperty.DELETE_CORPROPS_BY_PROCESS).setParameter
 ("process", _process).executeUpdate();
+        
getSession().getNamedQuery(HCorrelationSet.DELETE_CORSETS_BY_PROCESS).setParameter
 ("process", _process).executeUpdate();
     }
 
     private void deleteEvents() {
-               
getSession().getNamedQuery(HLargeData.DELETE_EVENT_LDATA_BY_PROCESS).setParameter("process",
 _process).executeUpdate();
-               
getSession().getNamedQuery(HBpelEvent.DELETE_EVENTS_BY_PROCESS).setParameter("process",
 _process).executeUpdate();
-       }
+        
getSession().getNamedQuery(HLargeData.DELETE_EVENT_LDATA_BY_PROCESS).setParameter("process",
 _process).executeUpdate();
+        
getSession().getNamedQuery(HBpelEvent.DELETE_EVENTS_BY_PROCESS).setParameter("process",
 _process).executeUpdate();
+    }
 
-       public QName getType() {
+    public QName getType() {
         return new QName(_process.getTypeNamespace(), _process.getTypeName());
     }
 
@@ -222,7 +222,7 @@
     }
 
     @SuppressWarnings("unchecked")
-       public Collection<ProcessInstanceDAO> getActiveInstances() {
+    public Collection<ProcessInstanceDAO> getActiveInstances() {
         ArrayList<ProcessInstanceDAO> instDaos = new 
ArrayList<ProcessInstanceDAO>();
         Collection<HProcessInstance> insts = 
getSession().getNamedQuery(HProcessInstance.SELECT_ACTIVE_INSTANCES)
                 .setParameter("processId", 
_process.getId()).setParameter("state", ProcessState.STATE_ACTIVE).list();
@@ -235,8 +235,8 @@
         entering("ProcessDaoImpl.getNumInstances");
         // this should be efficient if the relation is tagged as extra-lazy.
         // If the collection is not initialized yet, Hibernate will do a 
count(*) and the whole collection will not be fetched.
-               return _process.getInstances().size();
-       }
+        return _process.getInstances().size();
+    }
 
     public String getGuid() {
         return _process.getGuid();

Modified: 
ode/branches/APACHE_ODE_1.X/utils/src/main/java/org/apache/ode/utils/LoggingInterceptor.java
URL: 
http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.X/utils/src/main/java/org/apache/ode/utils/LoggingInterceptor.java?rev=759636&r1=759635&r2=759636&view=diff
==============================================================================
--- 
ode/branches/APACHE_ODE_1.X/utils/src/main/java/org/apache/ode/utils/LoggingInterceptor.java
 (original)
+++ 
ode/branches/APACHE_ODE_1.X/utils/src/main/java/org/apache/ode/utils/LoggingInterceptor.java
 Sun Mar 29 03:29:43 2009
@@ -14,100 +14,100 @@
 
 public class LoggingInterceptor<T> implements InvocationHandler {
 
-       private static final Set<String> PARAMSTYPES = new HashSet<String>();
-       static {
-               PARAMSTYPES.add("setArray");
-               PARAMSTYPES.add("setBigDecimal");
-               PARAMSTYPES.add("setBoolean");
-               PARAMSTYPES.add("setByte");
-               PARAMSTYPES.add("setBytes");
-               PARAMSTYPES.add("setDate");
-               PARAMSTYPES.add("setDouble");
-               PARAMSTYPES.add("setFloat");
-               PARAMSTYPES.add("setInt");
-               PARAMSTYPES.add("setLong");
-               PARAMSTYPES.add("setObject");
-               PARAMSTYPES.add("setRef");
-               PARAMSTYPES.add("setShort");
-               PARAMSTYPES.add("setString");
-               PARAMSTYPES.add("setTime");
-               PARAMSTYPES.add("setTimestamp");
-               PARAMSTYPES.add("setURL");
-       }
-       
-       private Log _log;
-       private T _delegate;
+    private static final Set<String> PARAMSTYPES = new HashSet<String>();
+    static {
+        PARAMSTYPES.add("setArray");
+        PARAMSTYPES.add("setBigDecimal");
+        PARAMSTYPES.add("setBoolean");
+        PARAMSTYPES.add("setByte");
+        PARAMSTYPES.add("setBytes");
+        PARAMSTYPES.add("setDate");
+        PARAMSTYPES.add("setDouble");
+        PARAMSTYPES.add("setFloat");
+        PARAMSTYPES.add("setInt");
+        PARAMSTYPES.add("setLong");
+        PARAMSTYPES.add("setObject");
+        PARAMSTYPES.add("setRef");
+        PARAMSTYPES.add("setShort");
+        PARAMSTYPES.add("setString");
+        PARAMSTYPES.add("setTime");
+        PARAMSTYPES.add("setTimestamp");
+        PARAMSTYPES.add("setURL");
+    }
+
+    private Log _log;
+    private T _delegate;
     private Map<String, Object> _paramsByName = new TreeMap<String, Object>();
     private Map<Integer, Object> _paramsByIdx = new TreeMap<Integer, Object>();
 
 
-       public LoggingInterceptor(T delegate, Log log) {
-               _log = log;
-               _delegate = delegate;
-       }
-       
+    public LoggingInterceptor(T delegate, Log log) {
+        _log = log;
+        _delegate = delegate;
+    }
+    
        public Object invoke(Object proxy, Method method, Object[] args)
-                       throws Throwable {
-               try {
-                       if (method.getDeclaringClass() == DataSource.class 
-                                       && 
"getConnection".equals(method.getName())) {
-                               Connection conn = 
(Connection)method.invoke(_delegate, args);
-                               print("getConnection (tx=" + 
conn.getTransactionIsolation() + ")");
-                               return 
Proxy.newProxyInstance(_delegate.getClass().getClassLoader(), 
-                                               new Class[] {Connection.class}, 
new LoggingInterceptor<Connection>(conn, _log));
-                       } else if (method.getDeclaringClass() == 
Connection.class 
-                                       && 
Statement.class.isAssignableFrom(method.getReturnType())) {
-                               Statement stmt = 
(Statement)method.invoke(_delegate, args);
-                               print(method, args);
-                               return 
Proxy.newProxyInstance(_delegate.getClass().getClassLoader(), 
-                                               new Class[] 
{method.getReturnType()}, new LoggingInterceptor<Statement>(stmt, _log));
-                       } else {
-                               print(method, args);
-                               return method.invoke(_delegate, args);
-                       }
+            throws Throwable {
+        try {
+            if (method.getDeclaringClass() == DataSource.class 
+                    && "getConnection".equals(method.getName())) {
+                Connection conn = (Connection)method.invoke(_delegate, args);
+                print("getConnection (tx=" + conn.getTransactionIsolation() + 
")");
+                return 
Proxy.newProxyInstance(_delegate.getClass().getClassLoader(), 
+                        new Class[] {Connection.class}, new 
LoggingInterceptor<Connection>(conn, _log));
+            } else if (method.getDeclaringClass() == Connection.class 
+                    && 
Statement.class.isAssignableFrom(method.getReturnType())) {
+                Statement stmt = (Statement)method.invoke(_delegate, args);
+                print(method, args);
+                return 
Proxy.newProxyInstance(_delegate.getClass().getClassLoader(), 
+                        new Class[] {method.getReturnType()}, new 
LoggingInterceptor<Statement>(stmt, _log));
+            } else {
+                print(method, args);
+                return method.invoke(_delegate, args);
+            }
         } catch (InvocationTargetException e) {
             throw e.getTargetException();
         }
-       }
+    }
 
        private void print(Method method, Object[] args) {
         if (shouldPrint()) {
-               // JDBC Connection
-               if ("prepareStatement".equals(method.getName())) {
-                       print("prepareStatement: " + args[0]);
-               } else if ("prepareCall".equals(method.getName())) {
-                       print("prepareCall: " + args[0]);
-               } else if ("close".equals(method.getName())) {
-                       print("close()");
-               } else if ("commit".equals(method.getName())) {
-                       print("commit()");
-               } else if ("rollback".equals(method.getName())) {
-                       print("rollback()");
-               } else if ("setTransactionIsolation".equals(method.getName())) {
-                       print("Set isolation level to " + args[0]);
-               } 
-               // JDBC Statement
-                 else if (method.getName().startsWith("execute")) {
-                       print(method.getName() + ", " + getParams());
-               } else if ("clearParameters".equals(method.getName())) {
-                       _paramsByIdx.clear();
-                       _paramsByName.clear();
-               } else if ("setNull".equals(method.getName())) {
-                       if (String.class.isAssignableFrom(args[0].getClass())) {
-                               _paramsByName.put((String)args[0], null);
-                       } else if 
(Integer.class.isAssignableFrom(args[0].getClass())) {
-                               _paramsByIdx.put((Integer)args[0], null);
-                       }
-               } else if (PARAMSTYPES.contains(method.getName())){
-                       if (String.class.isAssignableFrom(args[0].getClass())) {
-                               _paramsByName.put((String)args[0], args[1]);
-                       } else if 
(Integer.class.isAssignableFrom(args[0].getClass())) {
-                               _paramsByIdx.put((Integer)args[0], args[1]);
-                       }
-               }
+            // JDBC Connection
+            if ("prepareStatement".equals(method.getName())) {
+                print("prepareStatement: " + args[0]);
+            } else if ("prepareCall".equals(method.getName())) {
+                print("prepareCall: " + args[0]);
+            } else if ("close".equals(method.getName())) {
+                print("close()");
+            } else if ("commit".equals(method.getName())) {
+                print("commit()");
+            } else if ("rollback".equals(method.getName())) {
+                print("rollback()");
+            } else if ("setTransactionIsolation".equals(method.getName())) {
+                print("Set isolation level to " + args[0]);
+            } 
+            // JDBC Statement
+            else if (method.getName().startsWith("execute")) {
+                print(method.getName() + ", " + getParams());
+            } else if ("clearParameters".equals(method.getName())) {
+                _paramsByIdx.clear();
+                _paramsByName.clear();
+            } else if ("setNull".equals(method.getName())) {
+                if (String.class.isAssignableFrom(args[0].getClass())) {
+                    _paramsByName.put((String)args[0], null);
+                } else if (Integer.class.isAssignableFrom(args[0].getClass())) 
{
+                    _paramsByIdx.put((Integer)args[0], null);
+                }
+            } else if (PARAMSTYPES.contains(method.getName())){
+                if (String.class.isAssignableFrom(args[0].getClass())) {
+                    _paramsByName.put((String)args[0], args[1]);
+                } else if (Integer.class.isAssignableFrom(args[0].getClass())) 
{
+                    _paramsByIdx.put((Integer)args[0], args[1]);
+                }
+            }
         }
-       }
-       
+    }
+
     private String getParams() {
         if (_paramsByIdx.size() > 0 || _paramsByName.size() > 0) {
             StringBuffer buf = new StringBuffer();
@@ -130,7 +130,7 @@
             }
             return buf.toString();
         }
-               return "w/o params";
+        return "w/o params";
     }
 
        private boolean shouldPrint() {
@@ -146,7 +146,7 @@
     }
     
     public static DataSource createLoggingDS(DataSource ds, Log log) {
-               return 
(DataSource)Proxy.newProxyInstance(ds.getClass().getClassLoader(), 
-                               new Class[] {DataSource.class}, new 
LoggingInterceptor<DataSource>(ds,log));
+        return 
(DataSource)Proxy.newProxyInstance(ds.getClass().getClassLoader(), 
+                new Class[] {DataSource.class}, new 
LoggingInterceptor<DataSource>(ds,log));
     }
 }


Reply via email to