aries-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tjwat...@apache.org
Subject svn commit: r1653940 - in /aries/branches/subsystemsR6: ./ blueprint/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/model/ blueprint/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/test/ jpa/jpa-container-...
Date Thu, 22 Jan 2015 16:51:15 GMT
Author: tjwatson
Date: Thu Jan 22 16:51:14 2015
New Revision: 1653940

URL: http://svn.apache.org/r1653940
Log:
Merged latest trunk into subsystemsR6

Added:
    aries/branches/subsystemsR6/blueprint/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/test/ParentBean.java
      - copied unchanged from r1653939, aries/trunk/blueprint/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/test/ParentBean.java
Modified:
    aries/branches/subsystemsR6/   (props changed)
    aries/branches/subsystemsR6/blueprint/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/model/Bean.java
    aries/branches/subsystemsR6/blueprint/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/model/Context.java
    aries/branches/subsystemsR6/blueprint/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/model/Property.java
    aries/branches/subsystemsR6/blueprint/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/test/MyBean1.java
    aries/branches/subsystemsR6/blueprint/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/test/MyBean3.java
    aries/branches/subsystemsR6/jpa/jpa-container-context/src/main/java/org/apache/aries/jpa/container/context/transaction/impl/JTAEntityManagerHandler.java
    aries/branches/subsystemsR6/jpa/jpa-container/src/main/java/org/apache/aries/jpa/container/impl/EntityManagerFactoryManager.java
    aries/branches/subsystemsR6/jpa/jpa-container/src/main/java/org/apache/aries/jpa/container/quiesce/impl/EntityManagerProxyFactory.java
    aries/branches/subsystemsR6/jpa/jpa-container/src/main/java/org/apache/aries/jpa/container/quiesce/impl/QuiesceEMFHandler.java
    aries/branches/subsystemsR6/jpa/jpa-container/src/main/java/org/apache/aries/jpa/container/quiesce/impl/QuiesceParticipantImpl.java
    aries/branches/subsystemsR6/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/archive/Grammar.java
    aries/branches/subsystemsR6/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/archive/SubsystemExportServiceHeader.java
    aries/branches/subsystemsR6/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/archive/SubsystemImportServiceHeader.java
    aries/branches/subsystemsR6/subsystem/subsystem-itests/src/test/resources/composite2/OSGI-INF/SUBSYSTEM.MF
    aries/branches/subsystemsR6/transaction/transaction-jdbc/src/main/java/org/apache/aries/transaction/jdbc/internal/XADataSourceMCFFactory.java

Propchange: aries/branches/subsystemsR6/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Thu Jan 22 16:51:14 2015
@@ -1,2 +1,2 @@
 /aries/branches/1.0-prototype:1306564-1337594
-/aries/trunk:1535830-1649881
+/aries/trunk:1535830-1653939

Modified: aries/branches/subsystemsR6/blueprint/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/model/Bean.java
URL: http://svn.apache.org/viewvc/aries/branches/subsystemsR6/blueprint/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/model/Bean.java?rev=1653940&r1=1653939&r2=1653940&view=diff
==============================================================================
--- aries/branches/subsystemsR6/blueprint/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/model/Bean.java
(original)
+++ aries/branches/subsystemsR6/blueprint/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/model/Bean.java
Thu Jan 22 16:51:14 2015
@@ -18,6 +18,7 @@
  */
 package org.apache.aries.blueprint.plugin.model;
 
+import java.lang.annotation.Annotation;
 import java.lang.reflect.Field;
 import java.lang.reflect.Method;
 import java.util.SortedSet;
@@ -43,11 +44,11 @@ public class Bean implements Comparable<
         this.clazz = clazz;
         this.id = getBeanName(clazz);
         for (Method method : clazz.getDeclaredMethods()) {
-            PostConstruct postConstruct = method.getAnnotation(PostConstruct.class);
+            PostConstruct postConstruct = getEffectiveAnnotation(method, PostConstruct.class);
             if (postConstruct != null) {
                 this.initMethod = method.getName();
             }
-            PreDestroy preDestroy = method.getAnnotation(PreDestroy.class);
+            PreDestroy preDestroy = getEffectiveAnnotation(method, PreDestroy.class);
             if (preDestroy != null) {
                 this.destroyMethod = method.getName();
             }
@@ -104,6 +105,46 @@ public class Bean implements Comparable<
     private static String getBeanNameFromSimpleName(String name) {
         return name.substring(0, 1).toLowerCase() + name.substring(1, name.length());
     }
+    
+    private static <T extends Annotation> T getEffectiveAnnotation(Method method, Class<T>
annotationClass) {
+        final Class<?> methodClass = method.getDeclaringClass();
+        final String name = method.getName();
+        final Class<?>[] params = method.getParameterTypes();
+
+        // 1. Current class
+        final T rootAnnotation = method.getAnnotation(annotationClass);
+        if (rootAnnotation != null) {
+            return rootAnnotation;
+        }
+
+        // 2. Superclass
+        final Class<?> superclass = methodClass.getSuperclass();
+        if (superclass != null) {
+            final T annotation = getMethodAnnotation(superclass, name, params, annotationClass);
+            if (annotation != null)
+                return annotation;
+        }
+
+        // 3. Interfaces
+        for (final Class<?> intfs : methodClass.getInterfaces()) {
+            final T annotation = getMethodAnnotation(intfs, name, params, annotationClass);
+            if (annotation != null)
+                return annotation;
+        }
+
+        return null;
+    }
+
+    private static <T extends Annotation> T getMethodAnnotation(Class<?> searchClass,
String name, Class<?>[] params,
+            Class<T> annotationClass) {
+        try {
+            Method method = searchClass.getMethod(name, params);
+            return getEffectiveAnnotation(method, annotationClass);
+        } catch (NoSuchMethodException e) {
+            return null;
+        }
+    }
+    
 
     public boolean matches(Class<?> destType, String destId) {
         boolean assignable = destType.isAssignableFrom(this.clazz);

Modified: aries/branches/subsystemsR6/blueprint/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/model/Context.java
URL: http://svn.apache.org/viewvc/aries/branches/subsystemsR6/blueprint/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/model/Context.java?rev=1653940&r1=1653939&r2=1653940&view=diff
==============================================================================
--- aries/branches/subsystemsR6/blueprint/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/model/Context.java
(original)
+++ aries/branches/subsystemsR6/blueprint/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/model/Context.java
Thu Jan 22 16:51:14 2015
@@ -27,6 +27,7 @@ import java.util.TreeSet;
 import javax.inject.Named;
 
 import org.ops4j.pax.cdi.api.OsgiService;
+import org.springframework.beans.factory.annotation.Qualifier;
 
 public class Context implements Matcher {
 
@@ -67,8 +68,7 @@ public class Context implements Matcher
     }
     
     public Bean getMatching(Field field) {
-        Named named = field.getAnnotation(Named.class);
-        String destId = (named == null) ? null : named.value();
+        String destId = getDestinationId(field);
         // TODO Replace loop by lookup
         for (Bean bean : beans) {
             if (bean.matches(field.getType(), destId)) {
@@ -83,6 +83,18 @@ public class Context implements Matcher
         return null;
     }
 
+	private String getDestinationId(Field field) {
+		Named named = field.getAnnotation(Named.class);
+		if (named != null) {
+			return named.value();
+		}
+		Qualifier qualifier = field.getAnnotation(Qualifier.class);
+        if (qualifier != null) {
+        	return qualifier.value();
+        }
+		return null;
+	}
+
     public SortedSet<Bean> getBeans() {
         return beans;
     }

Modified: aries/branches/subsystemsR6/blueprint/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/model/Property.java
URL: http://svn.apache.org/viewvc/aries/branches/subsystemsR6/blueprint/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/model/Property.java?rev=1653940&r1=1653939&r2=1653940&view=diff
==============================================================================
--- aries/branches/subsystemsR6/blueprint/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/model/Property.java
(original)
+++ aries/branches/subsystemsR6/blueprint/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/model/Property.java
Thu Jan 22 16:51:14 2015
@@ -24,6 +24,7 @@ import javax.inject.Inject;
 import javax.inject.Named;
 
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Qualifier;
 import org.springframework.beans.factory.annotation.Value;
 
 public class Property implements Comparable<Property> {
@@ -58,7 +59,14 @@ public class Property implements Compara
      */
     private static String getRefName(Field field) {
         Named named = field.getAnnotation(Named.class);
-        return (named != null) ? named.value() : Bean.getBeanName(field.getType());
+        if (named != null) {
+        	return named.value();
+        }
+    	Qualifier qualifier = field.getAnnotation(Qualifier.class);
+        if (qualifier != null) {
+        	return qualifier.value();
+        }
+        return Bean.getBeanName(field.getType());
     }
 
     private static boolean needsInject(Field field) {

Modified: aries/branches/subsystemsR6/blueprint/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/test/MyBean1.java
URL: http://svn.apache.org/viewvc/aries/branches/subsystemsR6/blueprint/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/test/MyBean1.java?rev=1653940&r1=1653939&r2=1653940&view=diff
==============================================================================
--- aries/branches/subsystemsR6/blueprint/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/test/MyBean1.java
(original)
+++ aries/branches/subsystemsR6/blueprint/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/test/MyBean1.java
Thu Jan 22 16:51:14 2015
@@ -18,8 +18,6 @@
  */
 package org.apache.aries.blueprint.plugin.test;
 
-import javax.annotation.PostConstruct;
-import javax.annotation.PreDestroy;
 import javax.inject.Singleton;
 import javax.persistence.EntityManager;
 import javax.persistence.PersistenceUnit;
@@ -30,7 +28,7 @@ import org.springframework.beans.factory
 
 @Singleton
 @Transactional(value=TxType.REQUIRED)
-public class MyBean1 {
+public class MyBean1 extends ParentBean {
 
     @Autowired
     ServiceA bean2;
@@ -38,14 +36,10 @@ public class MyBean1 {
     @PersistenceUnit(unitName="person")
     EntityManager em;
     
-    @PostConstruct
     public void init() {
-        
     }
     
-    @PreDestroy
     public void destroy() {
-        
     }
 
     public void saveData() {

Modified: aries/branches/subsystemsR6/blueprint/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/test/MyBean3.java
URL: http://svn.apache.org/viewvc/aries/branches/subsystemsR6/blueprint/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/test/MyBean3.java?rev=1653940&r1=1653939&r2=1653940&view=diff
==============================================================================
--- aries/branches/subsystemsR6/blueprint/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/test/MyBean3.java
(original)
+++ aries/branches/subsystemsR6/blueprint/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/test/MyBean3.java
Thu Jan 22 16:51:14 2015
@@ -22,6 +22,7 @@ import javax.inject.Inject;
 import javax.inject.Named;
 import javax.inject.Singleton;
 
+import org.springframework.beans.factory.annotation.Qualifier;
 import org.springframework.transaction.annotation.Propagation;
 import org.springframework.transaction.annotation.Transactional;
 
@@ -34,7 +35,7 @@ public class MyBean3 {
     ServiceA serviceA1;
 
     @Inject
-    @Named("my2")
+    @Qualifier("my2")
     ServiceA serviceA2;
 
     @Inject

Modified: aries/branches/subsystemsR6/jpa/jpa-container-context/src/main/java/org/apache/aries/jpa/container/context/transaction/impl/JTAEntityManagerHandler.java
URL: http://svn.apache.org/viewvc/aries/branches/subsystemsR6/jpa/jpa-container-context/src/main/java/org/apache/aries/jpa/container/context/transaction/impl/JTAEntityManagerHandler.java?rev=1653940&r1=1653939&r2=1653940&view=diff
==============================================================================
--- aries/branches/subsystemsR6/jpa/jpa-container-context/src/main/java/org/apache/aries/jpa/container/context/transaction/impl/JTAEntityManagerHandler.java
(original)
+++ aries/branches/subsystemsR6/jpa/jpa-container-context/src/main/java/org/apache/aries/jpa/container/context/transaction/impl/JTAEntityManagerHandler.java
Thu Jan 22 16:51:14 2015
@@ -97,17 +97,11 @@ public class JTAEntityManagerHandler imp
      */
     private EntityManager getPersistenceContext(boolean forceTransaction) {
         if (forceTransaction) {
-            EntityManager manager = activeManager.get();
-            if (manager != null) {
-                manager.clear();
-            }
+            clearDetachedManager();
             return reg.getCurrentPersistenceContext(emf, props, instanceCount, callback);
         } else {
             if (reg.isTransactionActive()) {
-                EntityManager manager = activeManager.get();
-                if (manager != null) {
-                    manager.clear();
-                }
+                clearDetachedManager();
                 return reg.getCurrentPersistenceContext(emf, props, instanceCount, callback);
             } else {
                 if (!!!reg.jtaIntegrationAvailable() && _logger.isDebugEnabled())
@@ -126,6 +120,13 @@ public class JTAEntityManagerHandler imp
         }
     }
 
+    private void clearDetachedManager() {
+        EntityManager manager = activeManager.get();
+        if (manager != null) {
+            manager.clear();
+        }
+    }
+
     /**
      * Called reflectively by blueprint
      */

Modified: aries/branches/subsystemsR6/jpa/jpa-container/src/main/java/org/apache/aries/jpa/container/impl/EntityManagerFactoryManager.java
URL: http://svn.apache.org/viewvc/aries/branches/subsystemsR6/jpa/jpa-container/src/main/java/org/apache/aries/jpa/container/impl/EntityManagerFactoryManager.java?rev=1653940&r1=1653939&r2=1653940&view=diff
==============================================================================
--- aries/branches/subsystemsR6/jpa/jpa-container/src/main/java/org/apache/aries/jpa/container/impl/EntityManagerFactoryManager.java
(original)
+++ aries/branches/subsystemsR6/jpa/jpa-container/src/main/java/org/apache/aries/jpa/container/impl/EntityManagerFactoryManager.java
Thu Jan 22 16:51:14 2015
@@ -25,8 +25,15 @@ import java.util.HashMap;
 import java.util.Hashtable;
 import java.util.Map;
 import java.util.Map.Entry;
+import java.util.concurrent.Callable;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.ConcurrentMap;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.Future;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.TimeoutException;
 
 import javax.persistence.EntityManagerFactory;
 import javax.persistence.spi.PersistenceProvider;
@@ -162,7 +169,17 @@ public class EntityManagerFactoryManager
               "org.osgi.service.jdbc.DataSourceFactory", this);
           tracker.open();
         }
-        registerEntityManagerFactories();
+        ExecutorService executor = Executors.newSingleThreadExecutor();
+        Future<Void> result = executor.submit(new Callable<Void>() {
+            
+            @Override
+            public Void call() throws InvalidPersistenceUnitException {
+                registerEntityManagerFactories();
+                return null;
+            }
+        });
+        executor.shutdown();
+        handleCreationResult(result);
         break;
         //Stopping means the EMFs should
       case Bundle.STOPPING :
@@ -180,6 +197,22 @@ public class EntityManagerFactoryManager
     }
   }
 
+    private void handleCreationResult(Future<Void> result) throws InvalidPersistenceUnitException
{
+        try {
+            result.get(5000, TimeUnit.SECONDS);
+        } catch (InterruptedException e) {
+            _logger.warn(e.getMessage(), e);
+        } catch (ExecutionException e) {
+            if (e.getCause() instanceof InvalidPersistenceUnitException) {
+                throw (InvalidPersistenceUnitException) e.getCause();
+            } else if (e.getCause() instanceof RuntimeException) {
+                throw (RuntimeException) e.getCause();
+            }
+        } catch (TimeoutException e) {
+            _logger.info("EntityManagerFactory creation takes long. Continuing in background",
e);
+        }
+    }
+
   /**
    * Unregister all {@link EntityManagerFactory} services
    */

Modified: aries/branches/subsystemsR6/jpa/jpa-container/src/main/java/org/apache/aries/jpa/container/quiesce/impl/EntityManagerProxyFactory.java
URL: http://svn.apache.org/viewvc/aries/branches/subsystemsR6/jpa/jpa-container/src/main/java/org/apache/aries/jpa/container/quiesce/impl/EntityManagerProxyFactory.java?rev=1653940&r1=1653939&r2=1653940&view=diff
==============================================================================
--- aries/branches/subsystemsR6/jpa/jpa-container/src/main/java/org/apache/aries/jpa/container/quiesce/impl/EntityManagerProxyFactory.java
(original)
+++ aries/branches/subsystemsR6/jpa/jpa-container/src/main/java/org/apache/aries/jpa/container/quiesce/impl/EntityManagerProxyFactory.java
Thu Jan 22 16:51:14 2015
@@ -1,6 +1,7 @@
 package org.apache.aries.jpa.container.quiesce.impl;
 
 import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
 import java.lang.reflect.Proxy;
 
@@ -35,7 +36,9 @@ class EntityManagerProxyFactory {
               new PersistenceException(NLS.MESSAGES.getMessage("wrong.JPA.version", new Object[]{
                   method.getName(), delegate
               }), e);
-            }
+            } catch (InvocationTargetException e) {
+                throw e.getCause();
+            } 
             
             // This will only ever be called once, the second time there
             // will be an IllegalStateException from the line above

Modified: aries/branches/subsystemsR6/jpa/jpa-container/src/main/java/org/apache/aries/jpa/container/quiesce/impl/QuiesceEMFHandler.java
URL: http://svn.apache.org/viewvc/aries/branches/subsystemsR6/jpa/jpa-container/src/main/java/org/apache/aries/jpa/container/quiesce/impl/QuiesceEMFHandler.java?rev=1653940&r1=1653939&r2=1653940&view=diff
==============================================================================
--- aries/branches/subsystemsR6/jpa/jpa-container/src/main/java/org/apache/aries/jpa/container/quiesce/impl/QuiesceEMFHandler.java
(original)
+++ aries/branches/subsystemsR6/jpa/jpa-container/src/main/java/org/apache/aries/jpa/container/quiesce/impl/QuiesceEMFHandler.java
Thu Jan 22 16:51:14 2015
@@ -1,6 +1,7 @@
 package org.apache.aries.jpa.container.quiesce.impl;
 
 import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
 import java.util.concurrent.atomic.AtomicLong;
 import java.util.concurrent.atomic.AtomicReference;
@@ -59,7 +60,9 @@ class QuiesceEMFHandler implements Invoc
           new PersistenceException(NLS.MESSAGES.getMessage("wrong.JPA.version", new Object[]{
               method.getName(), delegate
           }), e);
-        }
+        } catch (InvocationTargetException e) {
+            throw e.getCause();
+        } 
 
         // This will only ever be called once, the second time there
         // will be an IllegalStateException from the line above

Modified: aries/branches/subsystemsR6/jpa/jpa-container/src/main/java/org/apache/aries/jpa/container/quiesce/impl/QuiesceParticipantImpl.java
URL: http://svn.apache.org/viewvc/aries/branches/subsystemsR6/jpa/jpa-container/src/main/java/org/apache/aries/jpa/container/quiesce/impl/QuiesceParticipantImpl.java?rev=1653940&r1=1653939&r2=1653940&view=diff
==============================================================================
--- aries/branches/subsystemsR6/jpa/jpa-container/src/main/java/org/apache/aries/jpa/container/quiesce/impl/QuiesceParticipantImpl.java
(original)
+++ aries/branches/subsystemsR6/jpa/jpa-container/src/main/java/org/apache/aries/jpa/container/quiesce/impl/QuiesceParticipantImpl.java
Thu Jan 22 16:51:14 2015
@@ -110,6 +110,7 @@ public class QuiesceParticipantImpl impl
 
   private QuiesceHandler quiesceHandler;
   private final BundleContext context;
+  @SuppressWarnings("rawtypes")
   private ServiceRegistration quiesceReg;
   
   /** Some events that we need to tidy up */

Modified: aries/branches/subsystemsR6/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/archive/Grammar.java
URL: http://svn.apache.org/viewvc/aries/branches/subsystemsR6/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/archive/Grammar.java?rev=1653940&r1=1653939&r2=1653940&view=diff
==============================================================================
--- aries/branches/subsystemsR6/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/archive/Grammar.java
(original)
+++ aries/branches/subsystemsR6/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/archive/Grammar.java
Thu Jan 22 16:51:14 2015
@@ -134,9 +134,6 @@ public interface Grammar {
 
 	public static final String OBJECTCLASS = PACKAGENAME;
 	public static final String SERVICE_OR_WILDCARD = "(" + OBJECTCLASS + "|[*])(?:;\\s*(?:"
+ PARAMETER + "))*";
-	public static final String SUBSYSTEM_IMPORTEXPORTSERVICE = SERVICE_OR_WILDCARD + "(?:,\\s*(?:"
+ SERVICE_OR_WILDCARD + "))*";
-    public static final String SUBSYSTEM_EXPORTSERVICE = SUBSYSTEM_IMPORTEXPORTSERVICE;
-	public static final String SUBSYSTEM_IMPORTSERVICE = SUBSYSTEM_IMPORTEXPORTSERVICE;
 
 	public static final String RESOURCE = SYMBOLICNAME + "(?:;\\s*(?:" + PARAMETER + "))*";
 	public static final String PREFERRED_PROVIDER = RESOURCE + "(?:,\\s*(?:" + RESOURCE + "))*";

Modified: aries/branches/subsystemsR6/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/archive/SubsystemExportServiceHeader.java
URL: http://svn.apache.org/viewvc/aries/branches/subsystemsR6/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/archive/SubsystemExportServiceHeader.java?rev=1653940&r1=1653939&r2=1653940&view=diff
==============================================================================
--- aries/branches/subsystemsR6/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/archive/SubsystemExportServiceHeader.java
(original)
+++ aries/branches/subsystemsR6/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/archive/SubsystemExportServiceHeader.java
Thu Jan 22 16:51:14 2015
@@ -164,7 +164,7 @@ public class SubsystemExportServiceHeade
 
 	public static final String NAME = SubsystemConstants.SUBSYSTEM_EXPORTSERVICE;
 
-    private static final Pattern PATTERN = Pattern.compile("(" + Grammar.SUBSYSTEM_EXPORTSERVICE
+ ")(?=,|\\z)");
+    private static final Pattern PATTERN = Pattern.compile("(" + Grammar.SERVICE_OR_WILDCARD
+ ")(?=,|\\z)");
 
 	private final Set<Clause> clauses = new HashSet<Clause>();
 

Modified: aries/branches/subsystemsR6/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/archive/SubsystemImportServiceHeader.java
URL: http://svn.apache.org/viewvc/aries/branches/subsystemsR6/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/archive/SubsystemImportServiceHeader.java?rev=1653940&r1=1653939&r2=1653940&view=diff
==============================================================================
--- aries/branches/subsystemsR6/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/archive/SubsystemImportServiceHeader.java
(original)
+++ aries/branches/subsystemsR6/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/archive/SubsystemImportServiceHeader.java
Thu Jan 22 16:51:14 2015
@@ -144,7 +144,7 @@ public class SubsystemImportServiceHeade
 
 	public static final String NAME = SubsystemConstants.SUBSYSTEM_IMPORTSERVICE;
 
-    private static final Pattern PATTERN = Pattern.compile("(" + Grammar.SUBSYSTEM_IMPORTSERVICE
+ ")(?=,|\\z)");
+    private static final Pattern PATTERN = Pattern.compile("(" + Grammar.SERVICE_OR_WILDCARD
+ ")(?=,|\\z)");
 
 	private static Collection<Clause> processHeader(String header) {
 		Matcher matcher = PATTERN.matcher(header);

Modified: aries/branches/subsystemsR6/subsystem/subsystem-itests/src/test/resources/composite2/OSGI-INF/SUBSYSTEM.MF
URL: http://svn.apache.org/viewvc/aries/branches/subsystemsR6/subsystem/subsystem-itests/src/test/resources/composite2/OSGI-INF/SUBSYSTEM.MF?rev=1653940&r1=1653939&r2=1653940&view=diff
==============================================================================
--- aries/branches/subsystemsR6/subsystem/subsystem-itests/src/test/resources/composite2/OSGI-INF/SUBSYSTEM.MF
(original)
+++ aries/branches/subsystemsR6/subsystem/subsystem-itests/src/test/resources/composite2/OSGI-INF/SUBSYSTEM.MF
Thu Jan 22 16:51:14 2015
@@ -2,5 +2,5 @@ Subsystem-SymbolicName: org.apache.aries
 Subsystem-Type: osgi.subsystem.composite
 Subsystem-Content: org.apache.aries.subsystem.itests.tb4;version="[1.0.0,1.0.0]"
 Import-Package: org.osgi.framework,org.osgi.util.tracker
-Subsystem-ExportService: *;filter:="(test=tb4)"
-Subsystem-ImportService: *;filter:="(test=testCompositeServiceImports)"
+Subsystem-ExportService: does.not.exist; filter:="(a=b)",*;filter:="(test=tb4)", does.not.exist1;
filter:="(q=g)"
+Subsystem-ImportService: does.not.exist; filter:="(a=b)",*;filter:="(test=testCompositeServiceImports)",does.not.exist1;
filter:="(q=g)"
\ No newline at end of file

Modified: aries/branches/subsystemsR6/transaction/transaction-jdbc/src/main/java/org/apache/aries/transaction/jdbc/internal/XADataSourceMCFFactory.java
URL: http://svn.apache.org/viewvc/aries/branches/subsystemsR6/transaction/transaction-jdbc/src/main/java/org/apache/aries/transaction/jdbc/internal/XADataSourceMCFFactory.java?rev=1653940&r1=1653939&r2=1653940&view=diff
==============================================================================
--- aries/branches/subsystemsR6/transaction/transaction-jdbc/src/main/java/org/apache/aries/transaction/jdbc/internal/XADataSourceMCFFactory.java
(original)
+++ aries/branches/subsystemsR6/transaction/transaction-jdbc/src/main/java/org/apache/aries/transaction/jdbc/internal/XADataSourceMCFFactory.java
Thu Jan 22 16:51:14 2015
@@ -25,11 +25,15 @@ import org.tranql.connector.NoExceptions
 import org.tranql.connector.jdbc.AbstractXADataSourceMCF;
 import org.tranql.connector.jdbc.ConfigurableSQLStateExceptionSorter;
 import org.tranql.connector.jdbc.KnownSQLStateExceptionSorter;
+import org.tranql.connector.jdbc.ManagedXAConnection;
 
 import javax.resource.ResourceException;
+import javax.resource.spi.ConnectionRequestInfo;
+import javax.resource.spi.ManagedConnection;
 import javax.resource.spi.ManagedConnectionFactory;
 import javax.resource.spi.ResourceAdapterInternalException;
 import javax.resource.spi.TransactionSupport;
+import javax.security.auth.Subject;
 import javax.sql.XAConnection;
 import javax.sql.XADataSource;
 
@@ -64,6 +68,26 @@ public class XADataSourceMCFFactory exte
         }
 
         @Override
+        public ManagedConnection createManagedConnection(Subject subject, ConnectionRequestInfo
connectionRequestInfo) throws ResourceException {
+            CredentialExtractor credentialExtractor = new CredentialExtractor(subject, connectionRequestInfo,
this);
+
+            XAConnection sqlConnection = getPhysicalConnection(credentialExtractor);
+            try {
+                return new ManagedXAConnection(this, sqlConnection, credentialExtractor,
exceptionSorter) {
+                    @Override
+                    public void cleanup() throws ResourceException {
+                        // ARIES-1279 - Transaction does not work on error SQLException
+                        // that's why we don't call super.cleanup() which calls con.setAutocommit(true)
+                        // super.cleanup();
+                        dissociateConnections();
+                    }
+                };
+            } catch (SQLException e) {
+                throw new ResourceAdapterInternalException("Could not set up ManagedXAConnection",
e);
+            }
+        }
+
+        @Override
         protected XAConnection getPhysicalConnection(CredentialExtractor credentialExtractor)
throws ResourceException {
             try {
                 String userName = credentialExtractor.getUserName();



Mime
View raw message