felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From clem...@apache.org
Subject svn commit: r786963 - in /felix/sandbox/clement/ipojo-utils/transaction/org.apache.felix.ipojo.transaction: pom.xml src/main/java/org/apache/felix/ipojo/transaction/TransactionHandler.java
Date Sun, 21 Jun 2009 09:29:57 GMT
Author: clement
Date: Sun Jun 21 09:29:55 2009
New Revision: 786963

URL: http://svn.apache.org/viewvc?rev=786963&view=rev
Log:
Update the artifact id to be consistent with others handlers

Modified:
    felix/sandbox/clement/ipojo-utils/transaction/org.apache.felix.ipojo.transaction/pom.xml
    felix/sandbox/clement/ipojo-utils/transaction/org.apache.felix.ipojo.transaction/src/main/java/org/apache/felix/ipojo/transaction/TransactionHandler.java

Modified: felix/sandbox/clement/ipojo-utils/transaction/org.apache.felix.ipojo.transaction/pom.xml
URL: http://svn.apache.org/viewvc/felix/sandbox/clement/ipojo-utils/transaction/org.apache.felix.ipojo.transaction/pom.xml?rev=786963&r1=786962&r2=786963&view=diff
==============================================================================
--- felix/sandbox/clement/ipojo-utils/transaction/org.apache.felix.ipojo.transaction/pom.xml
(original)
+++ felix/sandbox/clement/ipojo-utils/transaction/org.apache.felix.ipojo.transaction/pom.xml
Sun Jun 21 09:29:55 2009
@@ -2,10 +2,10 @@
   <modelVersion>4.0.0</modelVersion>
   <packaging>bundle</packaging>
   <groupId>org.apache.felix</groupId>
-  <artifactId>org.apache.felix.ipojo.transaction</artifactId>
+  <artifactId>org.apache.felix.ipojo.handler.transaction</artifactId>
   <version>1.3.0-SNAPSHOT</version>
-  <name>Apache Felix iPOJO Transaction</name>
-  
+  <name>Apache Felix iPOJO Transaction Handler</name>
+
   <build>
     <plugins>
       <plugin>
@@ -17,7 +17,7 @@
           <instructions>
             <Bundle-SymbolicName>${pom.artifactId}</Bundle-SymbolicName>
             <Private-Package>org.apache.felix.ipojo.transaction</Private-Package>
-            <Import-Package>*</Import-Package> <!-- YOUR_IMPORTED_PACKAGES
-->
+            <Import-Package>*</Import-Package>
           </instructions>
         </configuration>
       </plugin>
@@ -43,7 +43,7 @@
 		</plugin>
     </plugins>
   </build>
-  
+
   <dependencies>
   	<dependency>
   		<groupId>org.apache.felix</groupId>

Modified: felix/sandbox/clement/ipojo-utils/transaction/org.apache.felix.ipojo.transaction/src/main/java/org/apache/felix/ipojo/transaction/TransactionHandler.java
URL: http://svn.apache.org/viewvc/felix/sandbox/clement/ipojo-utils/transaction/org.apache.felix.ipojo.transaction/src/main/java/org/apache/felix/ipojo/transaction/TransactionHandler.java?rev=786963&r1=786962&r2=786963&view=diff
==============================================================================
--- felix/sandbox/clement/ipojo-utils/transaction/org.apache.felix.ipojo.transaction/src/main/java/org/apache/felix/ipojo/transaction/TransactionHandler.java
(original)
+++ felix/sandbox/clement/ipojo-utils/transaction/org.apache.felix.ipojo.transaction/src/main/java/org/apache/felix/ipojo/transaction/TransactionHandler.java
Sun Jun 21 09:29:55 2009
@@ -5,7 +5,6 @@
 import java.util.Dictionary;
 import java.util.List;
 
-import javax.transaction.RollbackException;
 import javax.transaction.Status;
 import javax.transaction.Synchronization;
 import javax.transaction.SystemException;
@@ -22,50 +21,50 @@
 import org.apache.felix.ipojo.util.Callback;
 
 public class TransactionHandler extends PrimitiveHandler implements Synchronization {
-    
+
     public static final String NAMESPACE= "org.apache.felix.ipojo.transaction";
-    
+
     public static final String NAME= "transaction";
-    
+
     private static final String FIELD_ATTRIBUTE= "field";
-    
+
     private static final String ONCOMMIT_ATTRIBUTE= "oncommit";
-    
+
     private static final String ONROLLBACK_ATTRIBUTE= "onrollback";
-    
+
     private static final String TRANSACTIONNAL_ELEMENT = "transactionnal";
-        
+
     private static final String METHOD_ATTRIBUTE = "method";
-    
+
     private static final String TIMEOUT_ATTRIBUTE = "timeout";
-    
+
     private static final String PROPAGATION_ATTRIBUTE = "propagation";
-    
+
     private static final String EXCEPTIONONROLLBACK_ATTRIBUTE = "exceptiononrollback";
-        
+
     private static final String NOROLLBACKFOR_ATTRIBUTE = "norollbackfor";
-    
+
     public static final int DEFAULT_PROPAGATION = TransactionnalMethod.REQUIRES;
-    
-    
+
+
     private TransactionManager m_transactionManager; // Service Dependency
-    
+
     private List<TransactionnalMethod> m_methods = new ArrayList<TransactionnalMethod>();
-    
+
     private Callback m_onRollback;
-    
+
     private Callback m_onCommit;
 
     private List<Transaction> m_transactions = new ArrayList<Transaction>();
-    
-    
+
+
     public void configure(Element arg0, Dictionary arg1)
             throws ConfigurationException {
         Element[] elements = arg0.getElements(NAME, NAMESPACE);
         if (elements.length > 1) {
             throw new ConfigurationException("The handler " + NAMESPACE + ":" + NAME + "
cannot be declared several times");
         }
-        
+
         String field = elements[0].getAttribute(FIELD_ATTRIBUTE);
         if (field != null) {
             FieldMetadata meta = getPojoMetadata().getField(field);
@@ -73,29 +72,29 @@
                 throw new ConfigurationException("The transaction field does not exist in
the pojo class : " + field);
             }
             if (! meta.getFieldType().equals(Transaction.class.getName())) {
-                throw new ConfigurationException("The transaction field type must be " +
Transaction.class.getName());   
+                throw new ConfigurationException("The transaction field type must be " +
Transaction.class.getName());
             }
             // Register the interceptor
             getInstanceManager().register(meta, this);
-           
+
         }
-        
+
         String oncommit = elements[0].getAttribute(ONCOMMIT_ATTRIBUTE);
         if (oncommit != null) {
             m_onCommit = new Callback(oncommit, new String[] { Transaction.class.getName()
}, false, getInstanceManager());
         }
-        
+
         String onrollback = elements[0].getAttribute(ONROLLBACK_ATTRIBUTE);
         if (onrollback != null) {
             m_onRollback = new Callback(onrollback, new String[] { Transaction.class.getName()
}, false, getInstanceManager());
-        } 
-        
-        
+        }
+
+
         Element[] sub = elements[0].getElements(TRANSACTIONNAL_ELEMENT);
         if (sub == null  || sub.length == 0) {
             throw new ConfigurationException("The handler " + NAMESPACE + ":" + NAME + "
must have " + TRANSACTIONNAL_ELEMENT + " subelement");
         }
-        
+
         for (int i = 0; i < sub.length; i++) {
             String method = sub[i].getAttribute(METHOD_ATTRIBUTE);
             String to = sub[i].getAttribute(TIMEOUT_ATTRIBUTE);
@@ -110,54 +109,54 @@
             if (meta == null) {
                 throw new ConfigurationException("A transactionnal method is not in the pojo
class : " + method);
             }
-            
+
             int timeout = 0;
             if (to != null) {
                 timeout = new Integer(to).intValue();
             }
-            
+
             int propagation = DEFAULT_PROPAGATION;
             if (propa != null) {
                 propagation = parsePropagation(propa);
             }
-            
+
             List<String> exceptions = new ArrayList<String>();
             if (nrbf != null) {
                 exceptions = (List<String>) ParseUtils.parseArraysAsList(nrbf);
             }
-            
+
             boolean exceptionOnRollback = false;
             if (eorb != null) {
                 exceptionOnRollback = new Boolean(eorb).booleanValue();
             }
-            
+
             TransactionnalMethod tm = new TransactionnalMethod(method, propagation, timeout,
exceptions, exceptionOnRollback, this);
             m_methods.add(tm);
             this.getInstanceManager().register(meta, tm);
         }
-        
+
     }
 
     private int parsePropagation(String propa) throws ConfigurationException {
        if (propa.equalsIgnoreCase("requires")) {
            return TransactionnalMethod.REQUIRES;
-           
+
        } else if (propa.equalsIgnoreCase("mandatory")){
            return TransactionnalMethod.MANDATORY;
-           
+
        } else if (propa.equalsIgnoreCase("notsupported")) {
            return TransactionnalMethod.NOT_SUPPORTED;
-           
+
        } else if (propa.equalsIgnoreCase("supported")) {
            return TransactionnalMethod.SUPPORTED;
-           
+
        } else if (propa.equalsIgnoreCase("never")) {
            return TransactionnalMethod.NEVER;
-       
+
         } else if (propa.equalsIgnoreCase("requiresnew")) {
             return TransactionnalMethod.REQUIRES_NEW;
         }
-       
+
        throw new ConfigurationException("Unknown propgation policy : " + propa);
     }
 
@@ -171,13 +170,13 @@
     public void stop() {
         // Nothing to do.
     }
-    
+
     public synchronized void bind(TransactionManager tm) {
         for (TransactionnalMethod method : m_methods) {
             method.setTransactionManager(tm);
         }
     }
-    
+
     public synchronized void unbind(TransactionManager tm) {
         for (TransactionnalMethod method : m_methods) {
             method.setTransactionManager(null);
@@ -200,7 +199,7 @@
                         "Cannot invoke the onRollback method,the method thrown an exception",
                         e1.getTargetException());
             }
-        } 
+        }
     }
 
     public void transactionCommitted(Transaction t) {
@@ -219,17 +218,17 @@
                         "Cannot invoke the onCommit callback,the method thrown an exception",
                         e1.getTargetException());
             }
-        } 
-        
+        }
+
     }
-    
+
     public void stateChanged(int newState) {
         if (newState == ComponentInstance.INVALID) {
-            // rollback all ownded transactions.
+            // rollback all owned transactions.
             for (int i = 0; i < m_methods.size(); i++) {
                 m_methods.get(i).rollbackOwnedTransactions();
             }
-            
+
             for (int i =0; i < m_transactions.size(); i++) {
                 try {
                     m_transactions.get(i).setRollbackOnly();
@@ -239,9 +238,8 @@
             }
         }
     }
-    
+
     public synchronized Object onGet(Object pojo, String fieldName, Object value) {
-        System.out.println("onGet on a transaction object !");
         try {
             if (m_transactionManager != null) {
                 return m_transactionManager.getTransaction();
@@ -269,10 +267,10 @@
         }
     }
 
-    public void beforeCompletion() { 
-        
+    public void beforeCompletion() {
+
     }
-    
+
     public void addTransaction(Transaction transaction) {
         if (m_transactions.contains(transaction)) {
             return;
@@ -288,6 +286,6 @@
     public List<Transaction> getTransactions() {
         return m_transactions;
     }
-  
+
 
 }



Mime
View raw message