You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@aries.apache.org by tj...@apache.org on 2014/07/24 15:55:50 UTC
svn commit: r1613136 [1/2] - in /aries/branches/subsystemsR6: ./ blueprint/
blueprint/blueprint-authz/ blueprint/blueprint-bundle/
blueprint/blueprint-compatibility/ blueprint/blueprint-core/
blueprint/blueprint-core/src/main/java/org/apache/aries/blue...
Author: tjwatson
Date: Thu Jul 24 13:55:49 2014
New Revision: 1613136
URL: http://svn.apache.org/r1613136
Log:
Merged latest trunk into subsystemsR6
Added:
aries/branches/subsystemsR6/blueprint/blueprint-authz/
- copied from r1613135, aries/trunk/blueprint/blueprint-authz/
aries/branches/subsystemsR6/blueprint/blueprint-itests/src/test/java/org/apache/aries/blueprint/itests/BlueprintContainerUseSystemContextTest.java
- copied unchanged from r1613135, aries/trunk/blueprint/blueprint-itests/src/test/java/org/apache/aries/blueprint/itests/BlueprintContainerUseSystemContextTest.java
aries/branches/subsystemsR6/blueprint/blueprint-itests/src/test/java/org/apache/aries/blueprint/itests/ParserServiceIgnoreUnknownNamespaceHandlerTest.java
- copied unchanged from r1613135, aries/trunk/blueprint/blueprint-itests/src/test/java/org/apache/aries/blueprint/itests/ParserServiceIgnoreUnknownNamespaceHandlerTest.java
aries/branches/subsystemsR6/blueprint/blueprint-itests/src/test/java/org/apache/aries/blueprint/itests/authz/
- copied from r1613135, aries/trunk/blueprint/blueprint-itests/src/test/java/org/apache/aries/blueprint/itests/authz/
aries/branches/subsystemsR6/blueprint/blueprint-itests/src/test/java/org/apache/aries/blueprint/itests/cm/ManagedServiceFactoryUseSystemBundleTest.java
- copied unchanged from r1613135, aries/trunk/blueprint/blueprint-itests/src/test/java/org/apache/aries/blueprint/itests/cm/ManagedServiceFactoryUseSystemBundleTest.java
aries/branches/subsystemsR6/blueprint/blueprint-itests/src/test/resources/authz.xml
- copied unchanged from r1613135, aries/trunk/blueprint/blueprint-itests/src/test/resources/authz.xml
aries/branches/subsystemsR6/blueprint/blueprint-parser/.gitignore
- copied unchanged from r1613135, aries/trunk/blueprint/blueprint-parser/.gitignore
Modified:
aries/branches/subsystemsR6/ (props changed)
aries/branches/subsystemsR6/blueprint/blueprint-bundle/pom.xml
aries/branches/subsystemsR6/blueprint/blueprint-compatibility/pom.xml
aries/branches/subsystemsR6/blueprint/blueprint-core/pom.xml
aries/branches/subsystemsR6/blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/container/BlueprintExtender.java
aries/branches/subsystemsR6/blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/container/ParserServiceImpl.java
aries/branches/subsystemsR6/blueprint/blueprint-itests/pom.xml
aries/branches/subsystemsR6/blueprint/blueprint-itests/src/test/java/org/apache/aries/blueprint/itests/AbstractBlueprintIntegrationTest.java
aries/branches/subsystemsR6/blueprint/blueprint-noosgi/pom.xml
aries/branches/subsystemsR6/blueprint/blueprint-parser/pom.xml
aries/branches/subsystemsR6/blueprint/blueprint-parser/src/main/java/org/apache/aries/blueprint/parser/Parser.java
aries/branches/subsystemsR6/blueprint/pom.xml
aries/branches/subsystemsR6/ejb/ejb-modeller-itest/pom.xml
aries/branches/subsystemsR6/jmx/jmx-bundle/pom.xml
aries/branches/subsystemsR6/jmx/jmx-core-whiteboard/pom.xml
aries/branches/subsystemsR6/jmx/jmx-itests/pom.xml
aries/branches/subsystemsR6/jpa/jpa-api/pom.xml
aries/branches/subsystemsR6/jpa/jpa-blueprint-aries/pom.xml
aries/branches/subsystemsR6/jpa/jpa-blueprint-testbundle/pom.xml
aries/branches/subsystemsR6/jpa/jpa-container-advancedtestbundle/pom.xml
aries/branches/subsystemsR6/jpa/jpa-container-context/pom.xml
aries/branches/subsystemsR6/jpa/jpa-container-context/src/main/java/org/apache/aries/jpa/container/context/impl/ManagedPersistenceContextFactory.java
aries/branches/subsystemsR6/jpa/jpa-container-context/src/main/java/org/apache/aries/jpa/container/context/transaction/impl/JTAEntityManager.java
aries/branches/subsystemsR6/jpa/jpa-container-context/src/main/java/org/apache/aries/jpa/container/context/transaction/impl/SynchronizedEntityManagerWrapper.java
aries/branches/subsystemsR6/jpa/jpa-container-itest/pom.xml
aries/branches/subsystemsR6/jpa/jpa-container-itest/src/test/java/org/apache/aries/jpa/blueprint/aries/itest/JPAInjectionTest.java
aries/branches/subsystemsR6/jpa/jpa-container-itest/src/test/java/org/apache/aries/jpa/itest/AbstractJPAItest.java
aries/branches/subsystemsR6/jpa/jpa-container-testbundle/pom.xml
aries/branches/subsystemsR6/jpa/jpa-container/pom.xml
aries/branches/subsystemsR6/jpa/jpa-container/src/main/java/org/apache/aries/jpa/container/impl/CountingEntityManagerFactory.java
aries/branches/subsystemsR6/jpa/jpa-container/src/main/java/org/apache/aries/jpa/container/impl/EntityManagerWrapper.java
aries/branches/subsystemsR6/jpa/jpa-container/src/main/java/org/apache/aries/jpa/container/impl/PersistenceBundleManager.java
aries/branches/subsystemsR6/jpa/jpa-container/src/main/java/org/apache/aries/jpa/container/unit/impl/ManagedPersistenceUnitInfoFactoryImpl.java
aries/branches/subsystemsR6/proxy/proxy-bundle/pom.xml
aries/branches/subsystemsR6/proxy/proxy-itests/pom.xml
aries/branches/subsystemsR6/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/internal/SubsystemResourceUninstaller.java
aries/branches/subsystemsR6/transaction/transaction-itests/pom.xml
Propchange: aries/branches/subsystemsR6/
------------------------------------------------------------------------------
Merged /aries/trunk:r1609470-1613135
Modified: aries/branches/subsystemsR6/blueprint/blueprint-bundle/pom.xml
URL: http://svn.apache.org/viewvc/aries/branches/subsystemsR6/blueprint/blueprint-bundle/pom.xml?rev=1613136&r1=1613135&r2=1613136&view=diff
==============================================================================
--- aries/branches/subsystemsR6/blueprint/blueprint-bundle/pom.xml (original)
+++ aries/branches/subsystemsR6/blueprint/blueprint-bundle/pom.xml Thu Jul 24 13:55:49 2014
@@ -32,7 +32,7 @@
<artifactId>org.apache.aries.blueprint</artifactId>
<packaging>bundle</packaging>
<name>Apache Aries Blueprint Bundle</name>
- <version>1.2.0-SNAPSHOT</version>
+ <version>1.3.0-SNAPSHOT</version>
<description>
This bundle contains the standalone implementation along with the API.
It's composed of the blueprint-api, blueprint-core and blueprint-cm modules.
@@ -94,7 +94,7 @@
OSGI-INF*;-split-package:=merge-first
</aries.osgi.private.pkg>
<aries.osgi.export.service>
- org.apache.aries.blueprint.ParserService
+ org.apache.aries.blueprint.services.ParserService
</aries.osgi.export.service>
<aries.osgi.import.service>
org.osgi.service.cm.ConfigurationAdmin;availability:=optional
@@ -110,7 +110,7 @@
<dependency>
<groupId>org.apache.aries.blueprint</groupId>
<artifactId>org.apache.aries.blueprint.api</artifactId>
- <version>1.0.0</version>
+ <version>1.0.2-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
@@ -122,13 +122,13 @@
<dependency>
<groupId>org.apache.aries.blueprint</groupId>
<artifactId>org.apache.aries.blueprint.core</artifactId>
- <version>1.2.0</version>
+ <version>1.4.2-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.aries.blueprint</groupId>
<artifactId>org.apache.aries.blueprint.cm</artifactId>
- <version>1.0.1</version>
+ <version>1.0.5-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
@@ -140,7 +140,7 @@
<dependency>
<groupId>org.apache.aries.proxy</groupId>
<artifactId>org.apache.aries.proxy.impl</artifactId>
- <version>1.0.3-SNAPSHOT</version>
+ <version>1.0.3</version>
<scope>test</scope>
</dependency>
<dependency>
Modified: aries/branches/subsystemsR6/blueprint/blueprint-compatibility/pom.xml
URL: http://svn.apache.org/viewvc/aries/branches/subsystemsR6/blueprint/blueprint-compatibility/pom.xml?rev=1613136&r1=1613135&r2=1613136&view=diff
==============================================================================
--- aries/branches/subsystemsR6/blueprint/blueprint-compatibility/pom.xml (original)
+++ aries/branches/subsystemsR6/blueprint/blueprint-compatibility/pom.xml Thu Jul 24 13:55:49 2014
@@ -58,7 +58,7 @@
<dependency>
<groupId>org.apache.aries.blueprint</groupId>
<artifactId>org.apache.aries.blueprint</artifactId>
- <version>1.2.0-SNAPSHOT</version>
+ <version>1.3.0-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
</dependencies>
Modified: aries/branches/subsystemsR6/blueprint/blueprint-core/pom.xml
URL: http://svn.apache.org/viewvc/aries/branches/subsystemsR6/blueprint/blueprint-core/pom.xml?rev=1613136&r1=1613135&r2=1613136&view=diff
==============================================================================
--- aries/branches/subsystemsR6/blueprint/blueprint-core/pom.xml (original)
+++ aries/branches/subsystemsR6/blueprint/blueprint-core/pom.xml Thu Jul 24 13:55:49 2014
@@ -83,7 +83,7 @@
org.apache.aries.blueprint.utils.*
</aries.osgi.private.pkg>
<aries.osgi.export.service>
- org.apache.aries.blueprint.ParserService
+ org.apache.aries.blueprint.services.ParserService
</aries.osgi.export.service>
<aries.osgi.include.resource>
{maven-resources},
@@ -91,7 +91,7 @@
</aries.osgi.include.resource>
<blueprint.annotation.api.version>1.0.0</blueprint.annotation.api.version>
<blueprint.api.version>1.0.0</blueprint.api.version>
- <blueprint.parser.version>1.2.1</blueprint.parser.version>
+ <blueprint.parser.version>1.3.0-SNAPSHOT</blueprint.parser.version>
<proxy.api.version>1.0.0</proxy.api.version>
<proxy.impl.version>1.0.3</proxy.impl.version>
<quiesce.api.version>1.0.0</quiesce.api.version>
Modified: aries/branches/subsystemsR6/blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/container/BlueprintExtender.java
URL: http://svn.apache.org/viewvc/aries/branches/subsystemsR6/blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/container/BlueprintExtender.java?rev=1613136&r1=1613135&r2=1613136&view=diff
==============================================================================
--- aries/branches/subsystemsR6/blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/container/BlueprintExtender.java (original)
+++ aries/branches/subsystemsR6/blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/container/BlueprintExtender.java Thu Jul 24 13:55:49 2014
@@ -53,6 +53,7 @@ import org.osgi.framework.ServiceRegistr
import org.osgi.framework.SynchronousBundleListener;
import org.osgi.service.blueprint.container.BlueprintContainer;
import org.osgi.service.blueprint.container.BlueprintEvent;
+import org.osgi.util.tracker.BundleTracker;
import org.osgi.util.tracker.BundleTrackerCustomizer;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -74,7 +75,7 @@ public class BlueprintExtender implement
private final ConcurrentMap<Bundle, FutureTask> destroying = new ConcurrentHashMap<Bundle, FutureTask>();
private BlueprintEventDispatcher eventDispatcher;
private NamespaceHandlerRegistry handlers;
- private RecursiveBundleTracker bt;
+ private Object bt;
private ServiceRegistration parserServiceReg;
private ServiceRegistration blueprintServiceReg;
private ServiceRegistration quiesceParticipantReg;
@@ -86,7 +87,10 @@ public class BlueprintExtender implement
LOGGER.debug("Starting blueprint extender...");
this.context = ctx;
- handlers = new NamespaceHandlerRegistryImpl(ctx);
+ boolean useSystemContext = Boolean.parseBoolean(ctx.getProperty("org.apache.aries.blueprint.use.system.context"));
+ BundleContext trackingContext = useSystemContext ? ctx.getBundle(Constants.SYSTEM_BUNDLE_LOCATION).getBundleContext() : ctx;
+
+ handlers = new NamespaceHandlerRegistryImpl(trackingContext);
executors = new ScheduledExecutorServiceWrapper(ctx, "Blueprint Extender", new ScheduledExecutorServiceFactory() {
public ScheduledExecutorService create(String name)
{
@@ -102,12 +106,16 @@ public class BlueprintExtender implement
// handled.
context.addBundleListener(this);
int mask = Bundle.INSTALLED | Bundle.RESOLVED | Bundle.STARTING | Bundle.STOPPING | Bundle.ACTIVE;
- bt = new RecursiveBundleTracker(ctx, mask, this);
+ bt = useSystemContext ? new BundleTracker(trackingContext, mask, this) : new RecursiveBundleTracker(ctx, mask, this);
proxyManager = new SingleServiceTracker<ProxyManager>(ctx, ProxyManager.class, new SingleServiceListener() {
public void serviceFound() {
LOGGER.debug("Found ProxyManager service, starting to process blueprint bundles");
- bt.open();
+ if (bt instanceof BundleTracker) {
+ ((BundleTracker) bt).open();
+ } else if (bt instanceof RecursiveBundleTracker) {
+ ((RecursiveBundleTracker) bt).open();
+ }
}
public void serviceLost() {
while (!containers.isEmpty()) {
@@ -115,16 +123,22 @@ public class BlueprintExtender implement
destroyContainer(bundle);
}
}
- bt.close();
+ if (bt instanceof BundleTracker) {
+ ((BundleTracker) bt).close();
+ } else if (bt instanceof RecursiveBundleTracker) {
+ ((RecursiveBundleTracker) bt).close();
+ }
}
public void serviceReplaced() {
}
});
proxyManager.open();
+ // Determine if the ParserService should ignore unknown namespace handlers
+ boolean ignoreUnknownNamespaceHandlers = Boolean.parseBoolean(ctx.getProperty("org.apache.aries.blueprint.parser.service.ignore.unknown.namespace.handlers"));
// Create and publish a ParserService
parserServiceReg = ctx.registerService(ParserService.class.getName(),
- new ParserServiceImpl (handlers),
+ new ParserServiceImpl (handlers, ignoreUnknownNamespaceHandlers),
new Hashtable<String, Object>());
// Create and publish a BlueprintContainerService
@@ -165,7 +179,11 @@ public class BlueprintExtender implement
}
}
- bt.close();
+ if (bt instanceof BundleTracker) {
+ ((BundleTracker) bt).close();
+ } else if (bt instanceof RecursiveBundleTracker) {
+ ((RecursiveBundleTracker) bt).close();
+ }
proxyManager.close();
this.eventDispatcher.destroy();
Modified: aries/branches/subsystemsR6/blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/container/ParserServiceImpl.java
URL: http://svn.apache.org/viewvc/aries/branches/subsystemsR6/blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/container/ParserServiceImpl.java?rev=1613136&r1=1613135&r2=1613136&view=diff
==============================================================================
--- aries/branches/subsystemsR6/blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/container/ParserServiceImpl.java (original)
+++ aries/branches/subsystemsR6/blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/container/ParserServiceImpl.java Thu Jul 24 13:55:49 2014
@@ -34,13 +34,15 @@ import org.xml.sax.SAXException;
public class ParserServiceImpl implements ParserService {
- NamespaceHandlerRegistry _namespaceHandlerRegistry;
-
- public ParserServiceImpl (NamespaceHandlerRegistry nhr) {
- _namespaceHandlerRegistry = nhr;
- }
-
- public ComponentDefinitionRegistry parse(URL url, Bundle clientBundle) throws Exception {
+ final NamespaceHandlerRegistry _namespaceHandlerRegistry;
+ final boolean _ignoreUnknownNamespaceHandlers;
+
+ public ParserServiceImpl (NamespaceHandlerRegistry nhr, boolean ignoreUnknownNamespaceHandlers) {
+ _namespaceHandlerRegistry = nhr;
+ _ignoreUnknownNamespaceHandlers = ignoreUnknownNamespaceHandlers;
+ }
+
+ public ComponentDefinitionRegistry parse(URL url, Bundle clientBundle) throws Exception {
return parse (url, clientBundle, false);
}
@@ -56,7 +58,7 @@ public class ParserServiceImpl implement
}
public ComponentDefinitionRegistry parse(List<URL> urls, Bundle clientBundle, boolean validate) throws Exception {
- Parser parser = new Parser();
+ Parser parser = new Parser(null, _ignoreUnknownNamespaceHandlers);
parser.parse(urls);
return validateAndPopulate (parser, clientBundle, validate);
}
@@ -66,7 +68,7 @@ public class ParserServiceImpl implement
}
public ComponentDefinitionRegistry parse(InputStream is, Bundle clientBundle, boolean validate) throws Exception {
- Parser parser = new Parser();
+ Parser parser = new Parser(null, _ignoreUnknownNamespaceHandlers);
parser.parse(is);
return validateAndPopulate (parser, clientBundle, validate);
}
Modified: aries/branches/subsystemsR6/blueprint/blueprint-itests/pom.xml
URL: http://svn.apache.org/viewvc/aries/branches/subsystemsR6/blueprint/blueprint-itests/pom.xml?rev=1613136&r1=1613135&r2=1613136&view=diff
==============================================================================
--- aries/branches/subsystemsR6/blueprint/blueprint-itests/pom.xml (original)
+++ aries/branches/subsystemsR6/blueprint/blueprint-itests/pom.xml Thu Jul 24 13:55:49 2014
@@ -62,17 +62,22 @@
<dependency>
<groupId>org.apache.aries.blueprint</groupId>
<artifactId>org.apache.aries.blueprint.core</artifactId>
- <version>1.4.1-SNAPSHOT</version>
+ <version>1.4.2-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.apache.aries.blueprint</groupId>
<artifactId>blueprint-parser</artifactId>
- <version>1.2.1-SNAPSHOT</version>
+ <version>1.3.0-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.aries.blueprint</groupId>
+ <artifactId>org.apache.aries.blueprint.authz</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.apache.aries.proxy</groupId>
<artifactId>org.apache.aries.proxy.impl</artifactId>
- <version>1.0.3-SNAPSHOT</version>
+ <version>1.0.3</version>
</dependency>
<dependency>
<groupId>org.apache.aries.quiesce</groupId>
@@ -84,7 +89,7 @@
<dependency>
<groupId>org.apache.aries.blueprint</groupId>
<artifactId>org.apache.aries.blueprint.cm</artifactId>
- <version>1.0.4-SNAPSHOT</version>
+ <version>1.0.5-SNAPSHOT</version>
<type>bundle</type>
<scope>compile</scope>
<exclusions>
@@ -244,14 +249,16 @@
<dependency>
<groupId>org.apache.aries.blueprint</groupId>
<artifactId>org.apache.aries.blueprint.annotation.api</artifactId>
- <version>1.0.1-SNAPSHOT</version>
+ <version>1.0.2-SNAPSHOT</version>
<type>bundle</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.apache.aries.blueprint</groupId>
<artifactId>org.apache.aries.blueprint.annotation.impl</artifactId>
- <version>1.0.1-SNAPSHOT</version>
+ <!-- TODO using 1.0.1 released or 1.0.2.SNAPSHOT causes failures in
+ org.apache.aries.blueprint.itests.BlueprintAnnotationTest -->
+ <version>1.0.0</version>
<type>bundle</type>
<scope>compile</scope>
</dependency>
Modified: aries/branches/subsystemsR6/blueprint/blueprint-itests/src/test/java/org/apache/aries/blueprint/itests/AbstractBlueprintIntegrationTest.java
URL: http://svn.apache.org/viewvc/aries/branches/subsystemsR6/blueprint/blueprint-itests/src/test/java/org/apache/aries/blueprint/itests/AbstractBlueprintIntegrationTest.java?rev=1613136&r1=1613135&r2=1613136&view=diff
==============================================================================
--- aries/branches/subsystemsR6/blueprint/blueprint-itests/src/test/java/org/apache/aries/blueprint/itests/AbstractBlueprintIntegrationTest.java (original)
+++ aries/branches/subsystemsR6/blueprint/blueprint-itests/src/test/java/org/apache/aries/blueprint/itests/AbstractBlueprintIntegrationTest.java Thu Jul 24 13:55:49 2014
@@ -71,7 +71,7 @@ public abstract class AbstractBlueprintI
}
return composite(
junitBundles(),
- systemProperty("org.ops4j.pax.logging.DefaultServiceLog.level").value("INFO"),
+ systemProperty("org.ops4j.pax.logging.DefaultServiceLog.level").value("DEBUG"),
when(localRepo != null).useOptions(vmOption("-Dorg.ops4j.pax.url.mvn.localRepository=" + localRepo)),
mvnBundle("org.ops4j.pax.logging", "pax-logging-api"),
mvnBundle("org.ops4j.pax.logging", "pax-logging-service")
Modified: aries/branches/subsystemsR6/blueprint/blueprint-noosgi/pom.xml
URL: http://svn.apache.org/viewvc/aries/branches/subsystemsR6/blueprint/blueprint-noosgi/pom.xml?rev=1613136&r1=1613135&r2=1613136&view=diff
==============================================================================
--- aries/branches/subsystemsR6/blueprint/blueprint-noosgi/pom.xml (original)
+++ aries/branches/subsystemsR6/blueprint/blueprint-noosgi/pom.xml Thu Jul 24 13:55:49 2014
@@ -47,7 +47,7 @@
<blueprint.api.version>1.0.0</blueprint.api.version>
<blueprint.core.version>1.0.0</blueprint.core.version>
<blueprint.parser.version>1.0.0</blueprint.parser.version>
- <proxy.impl.version>1.0.3-SNAPSHOT</proxy.impl.version>
+ <proxy.impl.version>1.0.3</proxy.impl.version>
</properties>
<profiles>
Modified: aries/branches/subsystemsR6/blueprint/blueprint-parser/pom.xml
URL: http://svn.apache.org/viewvc/aries/branches/subsystemsR6/blueprint/blueprint-parser/pom.xml?rev=1613136&r1=1613135&r2=1613136&view=diff
==============================================================================
--- aries/branches/subsystemsR6/blueprint/blueprint-parser/pom.xml (original)
+++ aries/branches/subsystemsR6/blueprint/blueprint-parser/pom.xml Thu Jul 24 13:55:49 2014
@@ -32,7 +32,7 @@
<artifactId>blueprint-parser</artifactId>
<packaging>jar</packaging>
<name>Apache Aries Blueprint Parser</name>
- <version>1.2.2-SNAPSHOT</version>
+ <version>1.3.0-SNAPSHOT</version>
<description>
This bundle contains the blueprint parser in a plain jar.
</description>
Modified: aries/branches/subsystemsR6/blueprint/blueprint-parser/src/main/java/org/apache/aries/blueprint/parser/Parser.java
URL: http://svn.apache.org/viewvc/aries/branches/subsystemsR6/blueprint/blueprint-parser/src/main/java/org/apache/aries/blueprint/parser/Parser.java?rev=1613136&r1=1613135&r2=1613136&view=diff
==============================================================================
--- aries/branches/subsystemsR6/blueprint/blueprint-parser/src/main/java/org/apache/aries/blueprint/parser/Parser.java (original)
+++ aries/branches/subsystemsR6/blueprint/blueprint-parser/src/main/java/org/apache/aries/blueprint/parser/Parser.java Thu Jul 24 13:55:49 2014
@@ -36,8 +36,10 @@ import javax.xml.parsers.DocumentBuilder
import javax.xml.transform.dom.DOMSource;
import javax.xml.validation.Schema;
import javax.xml.validation.Validator;
+
import org.apache.aries.blueprint.ComponentDefinitionRegistry;
import org.apache.aries.blueprint.NamespaceHandler;
+import org.apache.aries.blueprint.ParserContext;
import org.apache.aries.blueprint.reflect.BeanArgumentImpl;
import org.apache.aries.blueprint.reflect.BeanMetadataImpl;
import org.apache.aries.blueprint.reflect.BeanPropertyImpl;
@@ -175,11 +177,31 @@ public class Parser {
public static final String ACTIVATION_DEFAULT = ACTIVATION_EAGER;
private static DocumentBuilderFactory documentBuilderFactory;
+ private static final NamespaceHandler missingNamespace = new NamespaceHandler() {
+ @Override
+ public Metadata parse(Element element, ParserContext context) {
+ return null;
+ }
+ @Override
+ public URL getSchemaLocation(String namespace) {
+ return null;
+ }
+ @Override
+ public Set<Class> getManagedClasses() {
+ return null;
+ }
+ @Override
+ public ComponentMetadata decorate(Node node, ComponentMetadata component,
+ ParserContext context) {
+ return component;
+ }
+ };
private final List<Document> documents = new ArrayList<Document>();
private ComponentDefinitionRegistry registry;
private NamespaceHandlerSet handlers;
- private String idPrefix = "component-";
+ private final String idPrefix;
+ private final boolean ignoreUnknownNamespaces;
private final Set<String> ids = new HashSet<String>();
private int idCounter;
private String defaultTimeout;
@@ -187,10 +209,17 @@ public class Parser {
private String defaultActivation;
private Set<URI> namespaces;
- public Parser() {}
+ public Parser() {
+ this(null);
+ }
public Parser(String idPrefix) {
- this.idPrefix = idPrefix;
+ this(idPrefix, false);
+ }
+
+ public Parser(String idPrefix, boolean ignoreUnknownNamespaces) {
+ this.idPrefix = idPrefix == null ? "component-" : idPrefix;
+ this.ignoreUnknownNamespaces = ignoreUnknownNamespaces;
}
/**
@@ -1290,6 +1319,9 @@ public class Parser {
}
NamespaceHandler handler = this.handlers.getNamespaceHandler(uri);
if (handler == null) {
+ if (ignoreUnknownNamespaces) {
+ return missingNamespace;
+ }
throw new ComponentDefinitionException("Unsupported node namespace: " + uri);
}
return handler;
Modified: aries/branches/subsystemsR6/blueprint/pom.xml
URL: http://svn.apache.org/viewvc/aries/branches/subsystemsR6/blueprint/pom.xml?rev=1613136&r1=1613135&r2=1613136&view=diff
==============================================================================
--- aries/branches/subsystemsR6/blueprint/pom.xml (original)
+++ aries/branches/subsystemsR6/blueprint/pom.xml Thu Jul 24 13:55:49 2014
@@ -52,6 +52,7 @@
<module>blueprint-sample</module>
<module>blueprint-annotation-api</module>
<module>blueprint-annotation-impl</module>
+ <module>blueprint-authz</module>
<module>blueprint-sample-annotation</module>
<module>blueprint-sample-fragment</module>
<module>blueprint-sample-war</module>
Modified: aries/branches/subsystemsR6/ejb/ejb-modeller-itest/pom.xml
URL: http://svn.apache.org/viewvc/aries/branches/subsystemsR6/ejb/ejb-modeller-itest/pom.xml?rev=1613136&r1=1613135&r2=1613136&view=diff
==============================================================================
--- aries/branches/subsystemsR6/ejb/ejb-modeller-itest/pom.xml (original)
+++ aries/branches/subsystemsR6/ejb/ejb-modeller-itest/pom.xml Thu Jul 24 13:55:49 2014
@@ -82,7 +82,7 @@
<dependency>
<groupId>org.apache.aries.blueprint</groupId>
<artifactId>org.apache.aries.blueprint</artifactId>
- <version>1.2.0-SNAPSHOT</version>
+ <version>1.3.0-SNAPSHOT</version>
<scope>test</scope>
</dependency>
Modified: aries/branches/subsystemsR6/jmx/jmx-bundle/pom.xml
URL: http://svn.apache.org/viewvc/aries/branches/subsystemsR6/jmx/jmx-bundle/pom.xml?rev=1613136&r1=1613135&r2=1613136&view=diff
==============================================================================
--- aries/branches/subsystemsR6/jmx/jmx-bundle/pom.xml (original)
+++ aries/branches/subsystemsR6/jmx/jmx-bundle/pom.xml Thu Jul 24 13:55:49 2014
@@ -92,12 +92,12 @@
<dependency>
<groupId>org.apache.aries.jmx</groupId>
<artifactId>org.apache.aries.jmx.api</artifactId>
- <version>1.1.1-SNAPSHOT</version>
+ <version>1.1.1</version>
</dependency>
<dependency>
<groupId>org.apache.aries.jmx</groupId>
<artifactId>org.apache.aries.jmx.core</artifactId>
- <version>1.1.2-SNAPSHOT</version>
+ <version>1.1.2</version>
</dependency>
<dependency>
<groupId>org.osgi</groupId>
Modified: aries/branches/subsystemsR6/jmx/jmx-core-whiteboard/pom.xml
URL: http://svn.apache.org/viewvc/aries/branches/subsystemsR6/jmx/jmx-core-whiteboard/pom.xml?rev=1613136&r1=1613135&r2=1613136&view=diff
==============================================================================
--- aries/branches/subsystemsR6/jmx/jmx-core-whiteboard/pom.xml (original)
+++ aries/branches/subsystemsR6/jmx/jmx-core-whiteboard/pom.xml Thu Jul 24 13:55:49 2014
@@ -78,7 +78,7 @@
<dependency>
<groupId>org.apache.aries.jmx</groupId>
<artifactId>org.apache.aries.jmx.core</artifactId>
- <version>1.1.2-SNAPSHOT</version>
+ <version>1.1.3-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.osgi</groupId>
Modified: aries/branches/subsystemsR6/jmx/jmx-itests/pom.xml
URL: http://svn.apache.org/viewvc/aries/branches/subsystemsR6/jmx/jmx-itests/pom.xml?rev=1613136&r1=1613135&r2=1613136&view=diff
==============================================================================
--- aries/branches/subsystemsR6/jmx/jmx-itests/pom.xml (original)
+++ aries/branches/subsystemsR6/jmx/jmx-itests/pom.xml Thu Jul 24 13:55:49 2014
@@ -58,13 +58,13 @@
<dependency>
<groupId>org.apache.aries.jmx</groupId>
<artifactId>org.apache.aries.jmx.api</artifactId>
- <version>1.1.1-SNAPSHOT</version>
+ <version>1.1.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.aries.jmx</groupId>
<artifactId>org.apache.aries.jmx.core</artifactId>
- <version>1.1.2-SNAPSHOT</version>
+ <version>1.1.2</version>
<scope>provided</scope>
</dependency>
<dependency>
Modified: aries/branches/subsystemsR6/jpa/jpa-api/pom.xml
URL: http://svn.apache.org/viewvc/aries/branches/subsystemsR6/jpa/jpa-api/pom.xml?rev=1613136&r1=1613135&r2=1613136&view=diff
==============================================================================
--- aries/branches/subsystemsR6/jpa/jpa-api/pom.xml (original)
+++ aries/branches/subsystemsR6/jpa/jpa-api/pom.xml Thu Jul 24 13:55:49 2014
@@ -32,7 +32,7 @@
<artifactId>org.apache.aries.jpa.api</artifactId>
<packaging>bundle</packaging>
<name>Aries JPA Container API</name>
- <version>1.0.1-SNAPSHOT</version>
+ <version>1.0.2-SNAPSHOT</version>
<scm>
<connection>scm:svn:http://svn.apache.org/repos/asf/aries/trunk/jpa/jpa-api</connection>
@@ -48,8 +48,8 @@
org.apache.aries.jpa.container.context
</aries.osgi.export.pkg>
<aries.osgi.import>
- javax.persistence;version="[1.0.0,2.1.0)",
- javax.persistence.spi;version="[1.0.0,2.1.0)",
+ javax.persistence;version="[1.0.0,3.0.0)",
+ javax.persistence.spi;version="[1.0.0,3.0.0)",
org.osgi.framework;version="[1.5.0,2.0.0)"
</aries.osgi.import>
<aries.osgi.private.pkg />
@@ -63,9 +63,9 @@
<scope>provided</scope>
</dependency>
<dependency>
- <groupId>org.apache.geronimo.specs</groupId>
- <artifactId>geronimo-jpa_2.0_spec</artifactId>
- <version>1.1</version>
+ <groupId>org.hibernate.javax.persistence</groupId>
+ <artifactId>hibernate-jpa-2.1-api</artifactId>
+ <version>1.0.0.Final</version>
<scope>provided</scope>
</dependency>
</dependencies>
Modified: aries/branches/subsystemsR6/jpa/jpa-blueprint-aries/pom.xml
URL: http://svn.apache.org/viewvc/aries/branches/subsystemsR6/jpa/jpa-blueprint-aries/pom.xml?rev=1613136&r1=1613135&r2=1613136&view=diff
==============================================================================
--- aries/branches/subsystemsR6/jpa/jpa-blueprint-aries/pom.xml (original)
+++ aries/branches/subsystemsR6/jpa/jpa-blueprint-aries/pom.xml Thu Jul 24 13:55:49 2014
@@ -30,7 +30,7 @@
<groupId>org.apache.aries.jpa</groupId>
<artifactId>org.apache.aries.jpa.blueprint.aries</artifactId>
- <version>1.0.2-SNAPSHOT</version>
+ <version>1.0.3-SNAPSHOT</version>
<name>Aries JPA Container blueprint integration for Aries blueprint</name>
<packaging>bundle</packaging>
@@ -62,9 +62,9 @@
<scope>provided</scope>
</dependency>
<dependency>
- <groupId>org.apache.geronimo.specs</groupId>
- <artifactId>geronimo-jpa_2.0_spec</artifactId>
- <version>1.1</version>
+ <groupId>org.hibernate.javax.persistence</groupId>
+ <artifactId>hibernate-jpa-2.1-api</artifactId>
+ <version>1.0.0.Final</version>
<scope>provided</scope>
</dependency>
<dependency>
@@ -76,7 +76,7 @@
<dependency>
<groupId>org.apache.aries.jpa</groupId>
<artifactId>org.apache.aries.jpa.api</artifactId>
- <version>1.0.0</version>
+ <version>1.0.1</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
Modified: aries/branches/subsystemsR6/jpa/jpa-blueprint-testbundle/pom.xml
URL: http://svn.apache.org/viewvc/aries/branches/subsystemsR6/jpa/jpa-blueprint-testbundle/pom.xml?rev=1613136&r1=1613135&r2=1613136&view=diff
==============================================================================
--- aries/branches/subsystemsR6/jpa/jpa-blueprint-testbundle/pom.xml (original)
+++ aries/branches/subsystemsR6/jpa/jpa-blueprint-testbundle/pom.xml Thu Jul 24 13:55:49 2014
@@ -53,9 +53,9 @@
<dependencies>
<dependency>
- <groupId>org.apache.geronimo.specs</groupId>
- <artifactId>geronimo-jpa_2.0_spec</artifactId>
- <version>1.1</version>
+ <groupId>org.hibernate.javax.persistence</groupId>
+ <artifactId>hibernate-jpa-2.1-api</artifactId>
+ <version>1.0.0.Final</version>
<scope>provided</scope>
</dependency>
</dependencies>
Modified: aries/branches/subsystemsR6/jpa/jpa-container-advancedtestbundle/pom.xml
URL: http://svn.apache.org/viewvc/aries/branches/subsystemsR6/jpa/jpa-container-advancedtestbundle/pom.xml?rev=1613136&r1=1613135&r2=1613136&view=diff
==============================================================================
--- aries/branches/subsystemsR6/jpa/jpa-container-advancedtestbundle/pom.xml (original)
+++ aries/branches/subsystemsR6/jpa/jpa-container-advancedtestbundle/pom.xml Thu Jul 24 13:55:49 2014
@@ -46,7 +46,7 @@
org.apache.aries.jpa.container.advanced.itest.bundle.entities
</aries.osgi.export.pkg>
<aries.osgi.import>
- javax.persistence;version="[1.0.0,2.0.0)",
+ javax.persistence;version="[1.0.0,3.0.0)",
org.apache.derby.jdbc,
*
</aries.osgi.import>
@@ -56,9 +56,9 @@
<dependencies>
<dependency>
- <groupId>org.apache.geronimo.specs</groupId>
- <artifactId>geronimo-jpa_2.0_spec</artifactId>
- <version>1.1</version>
+ <groupId>org.hibernate.javax.persistence</groupId>
+ <artifactId>hibernate-jpa-2.1-api</artifactId>
+ <version>1.0.0.Final</version>
<scope>provided</scope>
</dependency>
</dependencies>
Modified: aries/branches/subsystemsR6/jpa/jpa-container-context/pom.xml
URL: http://svn.apache.org/viewvc/aries/branches/subsystemsR6/jpa/jpa-container-context/pom.xml?rev=1613136&r1=1613135&r2=1613136&view=diff
==============================================================================
--- aries/branches/subsystemsR6/jpa/jpa-container-context/pom.xml (original)
+++ aries/branches/subsystemsR6/jpa/jpa-container-context/pom.xml Thu Jul 24 13:55:49 2014
@@ -30,7 +30,7 @@
<groupId>org.apache.aries.jpa</groupId>
<artifactId>org.apache.aries.jpa.container.context</artifactId>
- <version>1.0.2-SNAPSHOT</version>
+ <version>1.0.3-SNAPSHOT</version>
<name>Aries JPA Container Managed Contexts</name>
<packaging>bundle</packaging>
@@ -44,9 +44,9 @@
<!-- Export package versions are maintained in packageinfo files -->
<aries.osgi.export.pkg />
<aries.osgi.import>
- javax.persistence;version="[1.0.0,2.1.0)",
- javax.persistence.criteria;version="[1.1.0,2.1.0)";resolution:=optional,
- javax.persistence.metamodel;version="[1.1.0,2.1.0)";resolution:=optional,
+ javax.persistence;version="[1.0.0,3.0.0)",
+ javax.persistence.criteria;version="[1.1.0,3.0.0)";resolution:=optional,
+ javax.persistence.metamodel;version="[1.1.0,3.0.0)";resolution:=optional,
org.apache.aries.jpa.container.context;provide:=true,
org.apache.aries.quiesce.manager;provide:=true;resolution:=optional,
org.apache.aries.quiesce.participant;provide:=true;resolution:=optional,
@@ -70,9 +70,9 @@
<scope>provided</scope>
</dependency>
<dependency>
- <groupId>org.apache.geronimo.specs</groupId>
- <artifactId>geronimo-jpa_2.0_spec</artifactId>
- <version>1.1</version>
+ <groupId>org.hibernate.javax.persistence</groupId>
+ <artifactId>hibernate-jpa-2.1-api</artifactId>
+ <version>1.0.0.Final</version>
<scope>provided</scope>
</dependency>
<dependency>
@@ -90,7 +90,7 @@
<dependency>
<groupId>org.apache.aries.jpa</groupId>
<artifactId>org.apache.aries.jpa.api</artifactId>
- <version>1.0.0</version>
+ <version>1.0.1</version>
<scope>provided</scope>
</dependency>
<dependency>
Modified: aries/branches/subsystemsR6/jpa/jpa-container-context/src/main/java/org/apache/aries/jpa/container/context/impl/ManagedPersistenceContextFactory.java
URL: http://svn.apache.org/viewvc/aries/branches/subsystemsR6/jpa/jpa-container-context/src/main/java/org/apache/aries/jpa/container/context/impl/ManagedPersistenceContextFactory.java?rev=1613136&r1=1613135&r2=1613136&view=diff
==============================================================================
--- aries/branches/subsystemsR6/jpa/jpa-container-context/src/main/java/org/apache/aries/jpa/container/context/impl/ManagedPersistenceContextFactory.java (original)
+++ aries/branches/subsystemsR6/jpa/jpa-container-context/src/main/java/org/apache/aries/jpa/container/context/impl/ManagedPersistenceContextFactory.java Thu Jul 24 13:55:49 2014
@@ -26,11 +26,7 @@ import java.util.concurrent.atomic.Atomi
import java.util.concurrent.atomic.AtomicLong;
import java.util.concurrent.atomic.AtomicReference;
-import javax.persistence.Cache;
-import javax.persistence.EntityManager;
-import javax.persistence.EntityManagerFactory;
-import javax.persistence.PersistenceContextType;
-import javax.persistence.PersistenceUnitUtil;
+import javax.persistence.*;
import javax.persistence.criteria.CriteriaBuilder;
import javax.persistence.metamodel.Metamodel;
@@ -42,111 +38,135 @@ import org.apache.aries.jpa.container.co
import org.osgi.framework.ServiceReference;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+
/**
* A factory that can lazily create managed persistence contexts.
* This is registered in the Service registry to be looked up by blueprint.
* The EntityManagerFactory interface is used to ensure a shared class space
* with the client. Only the createEntityManager() method is supported.
- *
+ * <p/>
* Also this class receives a callback on cleanup
*/
public class ManagedPersistenceContextFactory implements EntityManagerFactory, DestroyCallback {
- /** Logger */
- private static final Logger _logger = LoggerFactory.getLogger("org.apache.aries.jpa.container.context");
-
- private final ServiceReference emf;
- private final Map<String, Object> properties;
- private final JTAPersistenceContextRegistry registry;
- private final PersistenceContextType type;
- private final AtomicLong activeCount = new AtomicLong(0);
- private final String unitName;
-
- private final AtomicReference<QuiesceTidyUp> tidyUp = new AtomicReference<QuiesceTidyUp>();
-
- public ManagedPersistenceContextFactory(String name, ServiceReference unit,
- Map<String, Object> props, JTAPersistenceContextRegistry contextRegistry) {
- unitName = name;
- emf = unit;
- //Take a copy of the Map so that we don't modify the original
- properties = new HashMap<String, Object>(props);
- registry = contextRegistry;
- //Remove our internal property so that it doesn't get passed on the createEntityManager call
- type = (PersistenceContextType) properties.remove(PersistenceContextProvider.PERSISTENCE_CONTEXT_TYPE);
- }
-
- public EntityManager createEntityManager() {
- if(_logger.isDebugEnabled()) {
- _logger.debug("Creating a container managed entity manager for the perstence unit {} with the following properties {}",
- new Object[] {emf, properties});
- }
- //Getting the BundleContext is a privileged operation that the
- //client might not be able to do.
- EntityManagerFactory factory = AccessController.doPrivileged(
- new PrivilegedAction<EntityManagerFactory>() {
- public EntityManagerFactory run() {
- return (EntityManagerFactory) emf.getBundle().getBundleContext().getService(emf);
- }
- });
-
- if(type == PersistenceContextType.TRANSACTION || type == null)
- return new JTAEntityManager(factory, properties, registry, activeCount, this);
- else {
- _logger.error(NLS.MESSAGES.getMessage("extended.em.not.supported"));
- return null;
- }
-
- }
-
- public void close() {
- throw new UnsupportedOperationException();
- }
-
- public EntityManager createEntityManager(Map arg0) {
- throw new UnsupportedOperationException();
- }
-
- public Cache getCache() {
- throw new UnsupportedOperationException();
- }
-
- public CriteriaBuilder getCriteriaBuilder() {
- throw new UnsupportedOperationException();
- }
-
- public Metamodel getMetamodel() {
- throw new UnsupportedOperationException();
- }
-
- public PersistenceUnitUtil getPersistenceUnitUtil() {
- throw new UnsupportedOperationException();
- }
-
- public Map<String, Object> getProperties() {
- throw new UnsupportedOperationException();
- }
-
- public boolean isOpen() {
- throw new UnsupportedOperationException();
- }
-
- /**
- * Register an async Quiesce operation with this peristence context
- * @param tidyUp
- */
- public void quiesce(QuiesceTidyUp tidyUp) {
- this.tidyUp.compareAndSet(null, tidyUp);
- if(activeCount.get() == 0) {
- tidyUp.unitQuiesced(unitName);
- }
- }
-
- /**
- * Quiesce this unit after the last context is destroyed
- */
- public void callback() {
- if(tidyUp.get() != null && activeCount.get() == 0) {
- tidyUp.get().unitQuiesced(unitName);
+ /**
+ * Logger
+ */
+ private static final Logger _logger = LoggerFactory.getLogger("org.apache.aries.jpa.container.context");
+
+ private final ServiceReference emf;
+ private final Map<String, Object> properties;
+ private final JTAPersistenceContextRegistry registry;
+ private final PersistenceContextType type;
+ private final AtomicLong activeCount = new AtomicLong(0);
+ private final String unitName;
+
+ private final AtomicReference<QuiesceTidyUp> tidyUp = new AtomicReference<QuiesceTidyUp>();
+
+ public ManagedPersistenceContextFactory(String name, ServiceReference unit,
+ Map<String, Object> props, JTAPersistenceContextRegistry contextRegistry) {
+ unitName = name;
+ emf = unit;
+ //Take a copy of the Map so that we don't modify the original
+ properties = new HashMap<String, Object>(props);
+ registry = contextRegistry;
+ //Remove our internal property so that it doesn't get passed on the createEntityManager call
+ type = (PersistenceContextType) properties.remove(PersistenceContextProvider.PERSISTENCE_CONTEXT_TYPE);
+ }
+
+ public EntityManager createEntityManager() {
+ if (_logger.isDebugEnabled()) {
+ _logger.debug("Creating a container managed entity manager for the perstence unit {} with the following properties {}",
+ new Object[]{emf, properties});
+ }
+ //Getting the BundleContext is a privileged operation that the
+ //client might not be able to do.
+ EntityManagerFactory factory = AccessController.doPrivileged(
+ new PrivilegedAction<EntityManagerFactory>() {
+ public EntityManagerFactory run() {
+ return (EntityManagerFactory) emf.getBundle().getBundleContext().getService(emf);
+ }
+ });
+
+ if (type == PersistenceContextType.TRANSACTION || type == null)
+ return new JTAEntityManager(factory, properties, registry, activeCount, this);
+ else {
+ _logger.error(NLS.MESSAGES.getMessage("extended.em.not.supported"));
+ return null;
+ }
+
+ }
+
+ public void close() {
+ throw new UnsupportedOperationException();
+ }
+
+ public EntityManager createEntityManager(Map arg0) {
+ throw new UnsupportedOperationException();
+ }
+
+ public Cache getCache() {
+ throw new UnsupportedOperationException();
+ }
+
+ public CriteriaBuilder getCriteriaBuilder() {
+ throw new UnsupportedOperationException();
+ }
+
+ public Metamodel getMetamodel() {
+ throw new UnsupportedOperationException();
+ }
+
+ public PersistenceUnitUtil getPersistenceUnitUtil() {
+ throw new UnsupportedOperationException();
+ }
+
+ public Map<String, Object> getProperties() {
+ throw new UnsupportedOperationException();
}
- }
-
+
+ public boolean isOpen() {
+ throw new UnsupportedOperationException();
+ }
+
+ /**
+ * Register an async Quiesce operation with this peristence context
+ *
+ * @param tidyUp
+ */
+ public void quiesce(QuiesceTidyUp tidyUp) {
+ this.tidyUp.compareAndSet(null, tidyUp);
+ if (activeCount.get() == 0) {
+ tidyUp.unitQuiesced(unitName);
+ }
+ }
+
+ /**
+ * Quiesce this unit after the last context is destroyed
+ */
+ public void callback() {
+ if (tidyUp.get() != null && activeCount.get() == 0) {
+ tidyUp.get().unitQuiesced(unitName);
+ }
+ }
+
+ public <T> void addNamedEntityGraph(String arg0, EntityGraph<T> arg1) {
+ throw new UnsupportedOperationException();
+ }
+
+ public void addNamedQuery(String arg0, Query arg1) {
+ throw new UnsupportedOperationException();
+ }
+
+ public EntityManager createEntityManager(SynchronizationType arg0) {
+ throw new UnsupportedOperationException();
+ }
+
+ public EntityManager createEntityManager(SynchronizationType arg0, Map arg1) {
+ throw new UnsupportedOperationException();
+ }
+
+ public <T> T unwrap(Class<T> arg0) {
+ throw new UnsupportedOperationException();
+ }
+
}
Modified: aries/branches/subsystemsR6/jpa/jpa-container-context/src/main/java/org/apache/aries/jpa/container/context/transaction/impl/JTAEntityManager.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/JTAEntityManager.java?rev=1613136&r1=1613135&r2=1613136&view=diff
==============================================================================
--- aries/branches/subsystemsR6/jpa/jpa-container-context/src/main/java/org/apache/aries/jpa/container/context/transaction/impl/JTAEntityManager.java (original)
+++ aries/branches/subsystemsR6/jpa/jpa-container-context/src/main/java/org/apache/aries/jpa/container/context/transaction/impl/JTAEntityManager.java Thu Jul 24 13:55:49 2014
@@ -18,19 +18,15 @@
*/
package org.apache.aries.jpa.container.context.transaction.impl;
+import java.util.List;
import java.util.Map;
import java.util.concurrent.atomic.AtomicLong;
-import javax.persistence.EntityManager;
-import javax.persistence.EntityManagerFactory;
-import javax.persistence.EntityTransaction;
-import javax.persistence.FlushModeType;
-import javax.persistence.LockModeType;
-import javax.persistence.Query;
-import javax.persistence.TransactionRequiredException;
-import javax.persistence.TypedQuery;
+import javax.persistence.*;
import javax.persistence.criteria.CriteriaBuilder;
+import javax.persistence.criteria.CriteriaDelete;
import javax.persistence.criteria.CriteriaQuery;
+import javax.persistence.criteria.CriteriaUpdate;
import javax.persistence.metamodel.Metamodel;
import org.apache.aries.jpa.container.context.impl.NLS;
@@ -41,430 +37,508 @@ import org.slf4j.LoggerFactory;
* A <code>PersistenceContextType.TRANSACTION</code> {@link EntityManager} instance
*/
public class JTAEntityManager implements EntityManager {
- /** Logger */
- private static final Logger _logger = LoggerFactory.getLogger("org.apache.aries.jpa.container.context");
-
- /** The {@link EntityManagerFactory} that can create new {@link EntityManager} instances */
- private final EntityManagerFactory emf;
- /** The map of properties to pass when creating EntityManagers */
- private final Map<String, Object> props;
- /** A registry for creating new persistence contexts */
- private final JTAPersistenceContextRegistry reg;
- /** The number of EntityManager instances that are open */
- private final AtomicLong instanceCount;
- /** A callback for when we're quiescing */
- private final DestroyCallback callback;
-
-
- /**
- * The entity manager to use when there is no transaction. Note that there is one of these
- * per injection site.
- */
- private EntityManager detachedManager = null;
-
- public JTAEntityManager(EntityManagerFactory factory,
- Map<String, Object> properties, JTAPersistenceContextRegistry registry, AtomicLong activeCount,
- DestroyCallback onDestroy) {
- emf = factory;
- props = properties;
- reg = registry;
- instanceCount = activeCount;
- callback = onDestroy;
- }
-
- /**
- * Get the target persistence context
- * @param forceTransaction Whether the returned entity manager needs to be bound to a transaction
- * @throws TransactionRequiredException if forceTransaction is true and no transaction is available
- * @return
- */
- private EntityManager getPersistenceContext(boolean forceTransaction)
- {
- if (forceTransaction) {
- return reg.getCurrentPersistenceContext(emf, props, instanceCount, callback);
- } else {
- if (reg.isTransactionActive()) {
- return reg.getCurrentPersistenceContext(emf, props, instanceCount, callback);
- } else {
- if(!!!reg.jtaIntegrationAvailable() && _logger.isDebugEnabled())
- _logger.debug("No integration with JTA transactions is available. No transaction context is active.");
-
- if (detachedManager == null) {
- EntityManager temp = emf.createEntityManager(props);
-
- synchronized (this) {
- if (detachedManager == null) {
- detachedManager = new SynchronizedEntityManagerWrapper(temp);
- temp = null;
+
+ /**
+ * Logger
+ */
+ private static final Logger _logger = LoggerFactory.getLogger("org.apache.aries.jpa.container.context");
+
+ /**
+ * The {@link EntityManagerFactory} that can create new {@link EntityManager} instances
+ */
+ private final EntityManagerFactory emf;
+ /**
+ * The map of properties to pass when creating EntityManagers
+ */
+ private final Map<String, Object> props;
+ /**
+ * A registry for creating new persistence contexts
+ */
+ private final JTAPersistenceContextRegistry reg;
+ /**
+ * The number of EntityManager instances that are open
+ */
+ private final AtomicLong instanceCount;
+ /**
+ * A callback for when we're quiescing
+ */
+ private final DestroyCallback callback;
+
+
+ /**
+ * The entity manager to use when there is no transaction. Note that there is one of these
+ * per injection site.
+ */
+ private EntityManager detachedManager = null;
+
+ public JTAEntityManager(EntityManagerFactory factory,
+ Map<String, Object> properties, JTAPersistenceContextRegistry registry, AtomicLong activeCount,
+ DestroyCallback onDestroy) {
+ emf = factory;
+ props = properties;
+ reg = registry;
+ instanceCount = activeCount;
+ callback = onDestroy;
+ }
+
+ /**
+ * Get the target persistence context
+ *
+ * @param forceTransaction Whether the returned entity manager needs to be bound to a transaction
+ * @return
+ * @throws TransactionRequiredException if forceTransaction is true and no transaction is available
+ */
+ private EntityManager getPersistenceContext(boolean forceTransaction) {
+ if (forceTransaction) {
+ return reg.getCurrentPersistenceContext(emf, props, instanceCount, callback);
+ } else {
+ if (reg.isTransactionActive()) {
+ return reg.getCurrentPersistenceContext(emf, props, instanceCount, callback);
+ } else {
+ if (!!!reg.jtaIntegrationAvailable() && _logger.isDebugEnabled())
+ _logger.debug("No integration with JTA transactions is available. No transaction context is active.");
+
+ if (detachedManager == null) {
+ EntityManager temp = emf.createEntityManager(props);
+
+ synchronized (this) {
+ if (detachedManager == null) {
+ detachedManager = new SynchronizedEntityManagerWrapper(temp);
+ temp = null;
+ }
+ }
+
+ if (temp != null)
+ temp.close();
+ }
+ return detachedManager;
}
- }
-
- if (temp != null)
+ }
+ }
+
+ /**
+ * Called reflectively by blueprint
+ */
+ public void internalClose() {
+ EntityManager temp = null;
+
+ synchronized (this) {
+ temp = detachedManager;
+ detachedManager = null;
+ }
+
+ if (temp != null)
temp.close();
+ }
+
+ public void clear() {
+ getPersistenceContext(false).clear();
+ }
+
+ public void close() {
+ throw new IllegalStateException(NLS.MESSAGES.getMessage("close.called.on.container.manged.em"));
+ }
+
+ public boolean contains(Object arg0) {
+ EntityManager em = getPersistenceContext(false);
+ try {
+ return em.contains(arg0);
+ } finally {
+ if (em == detachedManager)
+ em.clear();
+ }
+ }
+
+ public Query createNamedQuery(String arg0) {
+ EntityManager em = getPersistenceContext(false);
+ try {
+ return em.createNamedQuery(arg0);
+ } finally {
+ if (em == detachedManager)
+ em.clear();
+ }
+ }
+
+ public Query createNativeQuery(String arg0) {
+ EntityManager em = getPersistenceContext(false);
+ try {
+ return em.createNativeQuery(arg0);
+ } finally {
+ if (em == detachedManager)
+ em.clear();
+ }
+ }
+
+ @SuppressWarnings("unchecked")
+ public Query createNativeQuery(String arg0, Class arg1) {
+ EntityManager em = getPersistenceContext(false);
+ try {
+ return em.createNativeQuery(arg0, arg1);
+ } finally {
+ if (em == detachedManager)
+ em.clear();
+ }
+ }
+
+ public Query createNativeQuery(String arg0, String arg1) {
+ EntityManager em = getPersistenceContext(false);
+ try {
+ return em.createNativeQuery(arg0, arg1);
+ } finally {
+ if (em == detachedManager)
+ em.clear();
+ }
+ }
+
+ public Query createQuery(String arg0) {
+ EntityManager em = getPersistenceContext(false);
+ try {
+ return em.createQuery(arg0);
+ } finally {
+ if (em == detachedManager)
+ em.clear();
+ }
+ }
+
+ public <T> T find(Class<T> arg0, Object arg1) {
+ EntityManager em = getPersistenceContext(false);
+ try {
+ return em.find(arg0, arg1);
+ } finally {
+ if (em == detachedManager)
+ em.clear();
+ }
+ }
+
+ /**
+ * @throws TransactionRequiredException
+ */
+ public void flush() {
+ getPersistenceContext(true).flush();
+ }
+
+ public Object getDelegate() {
+ return getPersistenceContext(false).getDelegate();
+ }
+
+ public FlushModeType getFlushMode() {
+ return getPersistenceContext(false).getFlushMode();
+ }
+
+ public <T> T getReference(Class<T> arg0, Object arg1) {
+ EntityManager em = getPersistenceContext(false);
+ try {
+ return em.getReference(arg0, arg1);
+ } finally {
+ if (em == detachedManager)
+ em.clear();
+ }
+ }
+
+ public EntityTransaction getTransaction() {
+ throw new IllegalStateException(NLS.MESSAGES.getMessage("getTransaction.called.on.container.managed.em"));
+ }
+
+ public boolean isOpen() {
+ return true;
+ }
+
+ public void joinTransaction() {
+ //This should be a no-op for a JTA entity manager
+ }
+
+ /**
+ * @throws TransactionRequiredException
+ */
+ public void lock(Object arg0, LockModeType arg1) {
+ getPersistenceContext(true).lock(arg0, arg1);
+ }
+
+ /**
+ * @throws TransactionRequiredException
+ */
+ public <T> T merge(T arg0) {
+ return getPersistenceContext(true).merge(arg0);
+ }
+
+ public boolean isJoinedToTransaction() {
+ return getPersistenceContext(true).isJoinedToTransaction();
+ }
+
+ /**
+ * @throws TransactionRequiredException
+ */
+ public void persist(Object arg0) {
+ getPersistenceContext(true).persist(arg0);
+ }
+
+ /**
+ * @throws TransactionRequiredException
+ */
+ public void refresh(Object arg0) {
+ getPersistenceContext(true).refresh(arg0);
+ }
+
+ /**
+ * @throws TransactionRequiredException
+ */
+ public void remove(Object arg0) {
+ getPersistenceContext(true).remove(arg0);
+ }
+
+ public void setFlushMode(FlushModeType arg0) {
+ EntityManager em = getPersistenceContext(false);
+ try {
+ em.setFlushMode(arg0);
+ } finally {
+ if (em == detachedManager)
+ em.clear();
+ }
+ }
+
+ public <T> TypedQuery<T> createNamedQuery(String arg0, Class<T> arg1) {
+ EntityManager em = getPersistenceContext(false);
+ try {
+ return em.createNamedQuery(arg0, arg1);
+ } finally {
+ if (em == detachedManager)
+ em.clear();
+ }
+ }
+
+ public <T> TypedQuery<T> createQuery(CriteriaQuery<T> arg0) {
+ EntityManager em = getPersistenceContext(false);
+ try {
+ return em.createQuery(arg0);
+ } finally {
+ if (em == detachedManager)
+ em.clear();
+ }
+ }
+
+ public <T> TypedQuery<T> createQuery(String arg0, Class<T> arg1) {
+ EntityManager em = getPersistenceContext(false);
+ try {
+ return em.createQuery(arg0, arg1);
+ } finally {
+ if (em == detachedManager)
+ em.clear();
+ }
+ }
+
+ public void detach(Object arg0) {
+ EntityManager em = getPersistenceContext(false);
+ //The detatched manager auto-detaches everything, so only
+ //detach from a "real" entity manager
+ if (em != detachedManager)
+ em.detach(arg0);
+ }
+
+ public <T> T find(Class<T> arg0, Object arg1, Map<String, Object> arg2) {
+ EntityManager em = getPersistenceContext(false);
+ try {
+ return em.find(arg0, arg1, arg2);
+ } finally {
+ if (em == detachedManager)
+ em.clear();
+ }
+ }
+
+ /**
+ * @throws TransactionRequiredException if lock mode is not NONE
+ */
+ public <T> T find(Class<T> arg0, Object arg1, LockModeType arg2) {
+ EntityManager em = getPersistenceContext(arg2 != LockModeType.NONE);
+ try {
+ return em.find(arg0, arg1, arg2);
+ } finally {
+ if (em == detachedManager)
+ em.clear();
+ }
+ }
+
+ /**
+ * @throws TransactionRequiredException if lock mode is not NONE
+ */
+ public <T> T find(Class<T> arg0, Object arg1, LockModeType arg2, Map<String, Object> arg3) {
+ EntityManager em = getPersistenceContext(arg2 != LockModeType.NONE);
+ try {
+ return em.find(arg0, arg1, arg2, arg3);
+ } finally {
+ if (em == detachedManager)
+ em.clear();
+ }
+ }
+
+ public StoredProcedureQuery createStoredProcedureQuery(String arg0) {
+ EntityManager em = getPersistenceContext(false);
+ try {
+ return em.createStoredProcedureQuery(arg0);
+ } finally {
+ if (em == detachedManager)
+ em.clear();
+ }
+ }
+
+ public StoredProcedureQuery createStoredProcedureQuery(String arg0, Class ... arg1) {
+ EntityManager em = getPersistenceContext(false);
+ try {
+ return em.createStoredProcedureQuery(arg0, arg1);
+ } finally {
+ if (em == detachedManager)
+ em.clear();
+ }
+ }
+
+ public StoredProcedureQuery createStoredProcedureQuery(String arg0, String ... arg1) {
+ EntityManager em = getPersistenceContext(false);
+ try {
+ return em.createStoredProcedureQuery(arg0, arg1);
+ } finally {
+ if (em == detachedManager)
+ em.clear();
}
- return detachedManager;
- }
}
- }
-
- /**
- * Called reflectively by blueprint
- */
- public void internalClose() {
- EntityManager temp = null;
-
- synchronized (this) {
- temp = detachedManager;
- detachedManager = null;
- }
-
- if (temp != null)
- temp.close();
- }
-
- public void clear()
- {
- getPersistenceContext(false).clear();
- }
-
- public void close()
- {
- throw new IllegalStateException(NLS.MESSAGES.getMessage("close.called.on.container.manged.em"));
- }
-
- public boolean contains(Object arg0)
- {
- EntityManager em = getPersistenceContext(false);
- try {
- return em.contains(arg0);
- } finally {
- if(em == detachedManager)
- em.clear();
- }
- }
-
- public Query createNamedQuery(String arg0)
- {
- EntityManager em = getPersistenceContext(false);
- try {
- return em.createNamedQuery(arg0);
- } finally {
- if(em == detachedManager)
- em.clear();
- }
- }
-
- public Query createNativeQuery(String arg0)
- {
- EntityManager em = getPersistenceContext(false);
- try {
- return em.createNativeQuery(arg0);
- } finally {
- if(em == detachedManager)
- em.clear();
- }
- }
-
- @SuppressWarnings("unchecked")
- public Query createNativeQuery(String arg0, Class arg1)
- {
- EntityManager em = getPersistenceContext(false);
- try {
- return em.createNativeQuery(arg0, arg1);
- } finally {
- if(em == detachedManager)
- em.clear();
- }
- }
-
- public Query createNativeQuery(String arg0, String arg1)
- {
- EntityManager em = getPersistenceContext(false);
- try {
- return em.createNativeQuery(arg0, arg1);
- } finally {
- if(em == detachedManager)
- em.clear();
- }
- }
-
- public Query createQuery(String arg0)
- {
- EntityManager em = getPersistenceContext(false);
- try {
- return em.createQuery(arg0);
- } finally {
- if(em == detachedManager)
- em.clear();
- }
- }
-
- public <T> T find(Class<T> arg0, Object arg1)
- {
- EntityManager em = getPersistenceContext(false);
- try {
- return em.find(arg0, arg1);
- } finally {
- if(em == detachedManager)
- em.clear();
- }
- }
-
- /**
- * @throws TransactionRequiredException
- */
- public void flush()
- {
- getPersistenceContext(true).flush();
- }
-
- public Object getDelegate()
- {
- return getPersistenceContext(false).getDelegate();
- }
-
- public FlushModeType getFlushMode()
- {
- return getPersistenceContext(false).getFlushMode();
- }
-
- public <T> T getReference(Class<T> arg0, Object arg1)
- {
- EntityManager em = getPersistenceContext(false);
- try {
- return em.getReference(arg0, arg1);
- } finally {
- if(em == detachedManager)
- em.clear();
- }
- }
-
- public EntityTransaction getTransaction()
- {
- throw new IllegalStateException(NLS.MESSAGES.getMessage("getTransaction.called.on.container.managed.em"));
- }
-
- public boolean isOpen()
- {
- return true;
- }
-
- public void joinTransaction()
- {
- //This should be a no-op for a JTA entity manager
- }
-
- /**
- * @throws TransactionRequiredException
- */
- public void lock(Object arg0, LockModeType arg1)
- {
- getPersistenceContext(true).lock(arg0, arg1);
- }
-
- /**
- * @throws TransactionRequiredException
- */
- public <T> T merge(T arg0)
- {
- return getPersistenceContext(true).merge(arg0);
- }
-
- /**
- * @throws TransactionRequiredException
- */
- public void persist(Object arg0)
- {
- getPersistenceContext(true).persist(arg0);
- }
-
- /**
- * @throws TransactionRequiredException
- */
- public void refresh(Object arg0)
- {
- getPersistenceContext(true).refresh(arg0);
- }
-
- /**
- * @throws TransactionRequiredException
- */
- public void remove(Object arg0)
- {
- getPersistenceContext(true).remove(arg0);
- }
-
- public void setFlushMode(FlushModeType arg0)
- {
- EntityManager em = getPersistenceContext(false);
- try {
- em.setFlushMode(arg0);
- } finally {
- if(em == detachedManager)
- em.clear();
- }
- }
-
- public <T> TypedQuery<T> createNamedQuery(String arg0, Class<T> arg1)
- {
- EntityManager em = getPersistenceContext(false);
- try {
- return em.createNamedQuery(arg0, arg1);
- } finally {
- if(em == detachedManager)
- em.clear();
- }
- }
-
- public <T> TypedQuery<T> createQuery(CriteriaQuery<T> arg0)
- {
- EntityManager em = getPersistenceContext(false);
- try {
- return em.createQuery(arg0);
- } finally {
- if(em == detachedManager)
- em.clear();
- }
- }
-
- public <T> TypedQuery<T> createQuery(String arg0, Class<T> arg1)
- {
- EntityManager em = getPersistenceContext(false);
- try {
- return em.createQuery(arg0, arg1);
- } finally {
- if(em == detachedManager)
- em.clear();
- }
- }
-
- public void detach(Object arg0)
- {
- EntityManager em = getPersistenceContext(false);
- //The detatched manager auto-detaches everything, so only
- //detach from a "real" entity manager
- if(em != detachedManager)
- em.detach(arg0);
- }
-
- public <T> T find(Class<T> arg0, Object arg1, Map<String, Object> arg2)
- {
- EntityManager em = getPersistenceContext(false);
- try {
- return em.find(arg0, arg1, arg2);
- } finally {
- if(em == detachedManager)
- em.clear();
- }
- }
-
- /**
- * @throws TransactionRequiredException if lock mode is not NONE
- */
- public <T> T find(Class<T> arg0, Object arg1, LockModeType arg2)
- {
- EntityManager em = getPersistenceContext(arg2 != LockModeType.NONE);
- try {
- return em.find(arg0, arg1, arg2);
- } finally {
- if(em == detachedManager)
- em.clear();
- }
- }
-
- /**
- * @throws TransactionRequiredException if lock mode is not NONE
- */
- public <T> T find(Class<T> arg0, Object arg1, LockModeType arg2, Map<String, Object> arg3)
- {
- EntityManager em = getPersistenceContext(arg2 != LockModeType.NONE);
- try {
- return em.find(arg0, arg1, arg2, arg3);
- } finally {
- if(em == detachedManager)
- em.clear();
- }
- }
-
- public CriteriaBuilder getCriteriaBuilder()
- {
- return getPersistenceContext(false).getCriteriaBuilder();
- }
-
- public EntityManagerFactory getEntityManagerFactory()
- {
- return emf;
- }
-
- /**
- * @throws TransactionRequiredException
- */
- public LockModeType getLockMode(Object arg0)
- {
- return getPersistenceContext(true).getLockMode(arg0);
- }
-
- public Metamodel getMetamodel()
- {
- return getPersistenceContext(false).getMetamodel();
- }
-
- public Map<String, Object> getProperties()
- {
- return getPersistenceContext(false).getProperties();
- }
-
- /**
- * @throws TransactionRequiredException
- */
- public void lock(Object arg0, LockModeType arg1, Map<String, Object> arg2)
- {
- getPersistenceContext(true).lock(arg0, arg1, arg2);
- }
-
- /**
- * @throws TransactionRequiredException
- */
- public void refresh(Object arg0, Map<String, Object> arg1)
- {
- getPersistenceContext(true).refresh(arg0, arg1);
- }
-
- /**
- * @throws TransactionRequiredException
- */
- public void refresh(Object arg0, LockModeType arg1)
- {
- getPersistenceContext(true).refresh(arg0, arg1);
- }
-
- /**
- * @throws TransactionRequiredException
- */
- public void refresh(Object arg0, LockModeType arg1, Map<String, Object> arg2)
- {
- getPersistenceContext(true).refresh(arg0, arg1, arg2);
- }
-
- public void setProperty(String arg0, Object arg1)
- {
- EntityManager em = getPersistenceContext(false);
- try {
- em.setProperty(arg0, arg1);
- } finally {
- if(em == detachedManager)
- em.clear();
- }
- }
-
- public <T> T unwrap(Class<T> arg0)
- {
- EntityManager em = getPersistenceContext(false);
- try {
- return em.unwrap(arg0);
- } finally {
- if(em == detachedManager)
- em.clear();
+
+ public StoredProcedureQuery createNamedStoredProcedureQuery(String arg0) {
+ EntityManager em = getPersistenceContext(false);
+ try {
+ return em.createNamedStoredProcedureQuery(arg0);
+ } finally {
+ if (em == detachedManager)
+ em.clear();
+ }
+ }
+
+ public CriteriaBuilder getCriteriaBuilder() {
+ return getPersistenceContext(false).getCriteriaBuilder();
+ }
+
+ public EntityManagerFactory getEntityManagerFactory() {
+ return emf;
+ }
+
+ /**
+ * @throws TransactionRequiredException
+ */
+ public LockModeType getLockMode(Object arg0) {
+ return getPersistenceContext(true).getLockMode(arg0);
+ }
+
+ public Metamodel getMetamodel() {
+ return getPersistenceContext(false).getMetamodel();
+ }
+
+ public Map<String, Object> getProperties() {
+ return getPersistenceContext(false).getProperties();
}
- }
+
+ /**
+ * @throws TransactionRequiredException
+ */
+ public void lock(Object arg0, LockModeType arg1, Map<String, Object> arg2) {
+ getPersistenceContext(true).lock(arg0, arg1, arg2);
+ }
+
+ /**
+ * @throws TransactionRequiredException
+ */
+ public void refresh(Object arg0, Map<String, Object> arg1) {
+ getPersistenceContext(true).refresh(arg0, arg1);
+ }
+
+ /**
+ * @throws TransactionRequiredException
+ */
+ public void refresh(Object arg0, LockModeType arg1) {
+ getPersistenceContext(true).refresh(arg0, arg1);
+ }
+
+ /**
+ * @throws TransactionRequiredException
+ */
+ public void refresh(Object arg0, LockModeType arg1, Map<String, Object> arg2) {
+ getPersistenceContext(true).refresh(arg0, arg1, arg2);
+ }
+
+ public void setProperty(String arg0, Object arg1) {
+ EntityManager em = getPersistenceContext(false);
+ try {
+ em.setProperty(arg0, arg1);
+ } finally {
+ if (em == detachedManager)
+ em.clear();
+ }
+ }
+
+ public <T> T unwrap(Class<T> arg0) {
+ EntityManager em = getPersistenceContext(false);
+ try {
+ return em.unwrap(arg0);
+ } finally {
+ if (em == detachedManager)
+ em.clear();
+ }
+ }
+
+ public Query createQuery(CriteriaUpdate arg0) {
+ EntityManager em = getPersistenceContext(false);
+ try {
+ return em.createQuery(arg0);
+ } finally {
+ if (em == detachedManager)
+ em.clear();
+ }
+ }
+
+ public Query createQuery(CriteriaDelete arg0) {
+ EntityManager em = getPersistenceContext(false);
+ try {
+ return em.createQuery(arg0);
+ } finally {
+ if (em == detachedManager)
+ em.clear();
+ }
+ }
+
+ public <T> EntityGraph<T> createEntityGraph(Class<T> arg0) {
+ EntityManager em = getPersistenceContext(false);
+ try {
+ return em.createEntityGraph(arg0);
+ } finally {
+ if (em == detachedManager)
+ em.clear();
+ }
+ }
+
+ public EntityGraph<?> createEntityGraph(String arg0) {
+ EntityManager em = getPersistenceContext(false);
+ try {
+ return em.createEntityGraph(arg0);
+ } finally {
+ if (em == detachedManager)
+ em.clear();
+ }
+ }
+
+ public EntityGraph<?> getEntityGraph(String arg0) {
+ EntityManager em = getPersistenceContext(false);
+ try {
+ return em.getEntityGraph(arg0);
+ } finally {
+ if (em == detachedManager)
+ em.clear();
+ }
+ }
+
+ public <T> List<EntityGraph<? super T>> getEntityGraphs(Class<T> arg0) {
+ EntityManager em = getPersistenceContext(false);
+ try {
+ return em.getEntityGraphs(arg0);
+ } finally {
+ if (em == detachedManager)
+ em.clear();
+ }
+ }
+
}
Modified: aries/branches/subsystemsR6/jpa/jpa-container-context/src/main/java/org/apache/aries/jpa/container/context/transaction/impl/SynchronizedEntityManagerWrapper.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/SynchronizedEntityManagerWrapper.java?rev=1613136&r1=1613135&r2=1613136&view=diff
==============================================================================
--- aries/branches/subsystemsR6/jpa/jpa-container-context/src/main/java/org/apache/aries/jpa/container/context/transaction/impl/SynchronizedEntityManagerWrapper.java (original)
+++ aries/branches/subsystemsR6/jpa/jpa-container-context/src/main/java/org/apache/aries/jpa/container/context/transaction/impl/SynchronizedEntityManagerWrapper.java Thu Jul 24 13:55:49 2014
@@ -18,23 +18,20 @@
*/
package org.apache.aries.jpa.container.context.transaction.impl;
+import java.util.List;
import java.util.Map;
-import javax.persistence.EntityManager;
-import javax.persistence.EntityManagerFactory;
-import javax.persistence.EntityTransaction;
-import javax.persistence.FlushModeType;
-import javax.persistence.LockModeType;
-import javax.persistence.Query;
-import javax.persistence.TypedQuery;
+import javax.persistence.*;
import javax.persistence.criteria.CriteriaBuilder;
+import javax.persistence.criteria.CriteriaDelete;
import javax.persistence.criteria.CriteriaQuery;
+import javax.persistence.criteria.CriteriaUpdate;
import javax.persistence.metamodel.Metamodel;
/**
* A synchronized wrapper for the EntityManager
*/
public class SynchronizedEntityManagerWrapper implements EntityManager {
-
+
private final EntityManager entityManager;
public SynchronizedEntityManagerWrapper(EntityManager entityManager) {
@@ -145,6 +142,14 @@ public class SynchronizedEntityManagerWr
return entityManager.createQuery(qlString, resultClass);
}
+ public synchronized Query createQuery(CriteriaUpdate arg0) {
+ return entityManager.createQuery(arg0);
+ }
+
+ public synchronized Query createQuery(CriteriaDelete arg0) {
+ return entityManager.createQuery(arg0);
+ }
+
public synchronized Query createNamedQuery(String name) {
return entityManager.createNamedQuery(name);
}
@@ -153,6 +158,22 @@ public class SynchronizedEntityManagerWr
return entityManager.createNamedQuery(name, resultClass);
}
+ public synchronized StoredProcedureQuery createNamedStoredProcedureQuery(String arg0) {
+ return entityManager.createNamedStoredProcedureQuery(arg0);
+ }
+
+ public synchronized StoredProcedureQuery createStoredProcedureQuery(String arg0) {
+ return entityManager.createStoredProcedureQuery(arg0);
+ }
+
+ public synchronized StoredProcedureQuery createStoredProcedureQuery(String arg0, Class ... arg1) {
+ return entityManager.createStoredProcedureQuery(arg0, arg1);
+ }
+
+ public synchronized StoredProcedureQuery createStoredProcedureQuery(String arg0, String ... arg1) {
+ return entityManager.createStoredProcedureQuery(arg0, arg1);
+ }
+
public synchronized Query createNativeQuery(String sqlString) {
return entityManager.createNativeQuery(sqlString);
}
@@ -169,6 +190,10 @@ public class SynchronizedEntityManagerWr
entityManager.joinTransaction();
}
+ public synchronized boolean isJoinedToTransaction() {
+ return entityManager.isJoinedToTransaction();
+ }
+
public synchronized <T> T unwrap(Class<T> cls) {
return entityManager.unwrap(cls);
}
@@ -200,4 +225,21 @@ public class SynchronizedEntityManagerWr
public synchronized Metamodel getMetamodel() {
return entityManager.getMetamodel();
}
+
+ public synchronized <T> EntityGraph<T> createEntityGraph(Class<T> arg0) {
+ return entityManager.createEntityGraph(arg0);
+ }
+
+ public synchronized EntityGraph<?> createEntityGraph(String arg0) {
+ return entityManager.createEntityGraph(arg0);
+ }
+
+ public synchronized EntityGraph<?> getEntityGraph(String arg0) {
+ return entityManager.getEntityGraph(arg0);
+ }
+
+ public synchronized <T> List<EntityGraph<? super T>> getEntityGraphs(Class<T> arg0) {
+ return entityManager.getEntityGraphs(arg0);
+ }
+
}
Modified: aries/branches/subsystemsR6/jpa/jpa-container-itest/pom.xml
URL: http://svn.apache.org/viewvc/aries/branches/subsystemsR6/jpa/jpa-container-itest/pom.xml?rev=1613136&r1=1613135&r2=1613136&view=diff
==============================================================================
--- aries/branches/subsystemsR6/jpa/jpa-container-itest/pom.xml (original)
+++ aries/branches/subsystemsR6/jpa/jpa-container-itest/pom.xml Thu Jul 24 13:55:49 2014
@@ -75,7 +75,7 @@
<dependency>
<groupId>org.apache.aries.proxy</groupId>
<artifactId>org.apache.aries.proxy.impl</artifactId>
- <version>1.0.3-SNAPSHOT</version>
+ <version>1.0.3</version>
<scope>test</scope>
</dependency>
<dependency>
@@ -97,10 +97,10 @@
<scope>test</scope>
</dependency>
<dependency>
- <groupId>org.apache.geronimo.specs</groupId>
- <artifactId>geronimo-jpa_2.0_spec</artifactId>
- <version>1.1</version>
- <scope>provided</scope>
+ <groupId>org.hibernate.javax.persistence</groupId>
+ <artifactId>hibernate-jpa-2.1-api</artifactId>
+ <version>1.0.0.Final</version>
+ <scope>test</scope>
</dependency>
<dependency>
<artifactId>org.apache.aries.jpa.api</artifactId>
@@ -111,19 +111,19 @@
<dependency>
<groupId>org.apache.aries.jpa</groupId>
<artifactId>org.apache.aries.jpa.container</artifactId>
- <version>1.0.1-SNAPSHOT</version>
+ <version>1.0.2-SNAPSHOT</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.aries.jpa</groupId>
<artifactId>org.apache.aries.jpa.container.context</artifactId>
- <version>1.0.2-SNAPSHOT</version>
+ <version>1.0.3-SNAPSHOT</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.aries.jpa</groupId>
<artifactId>org.apache.aries.jpa.blueprint.aries</artifactId>
- <version>1.0.2-SNAPSHOT</version>
+ <version>1.0.3-SNAPSHOT</version>
<!--<scope>test</scope>-->
</dependency>
<dependency>
Modified: aries/branches/subsystemsR6/jpa/jpa-container-itest/src/test/java/org/apache/aries/jpa/blueprint/aries/itest/JPAInjectionTest.java
URL: http://svn.apache.org/viewvc/aries/branches/subsystemsR6/jpa/jpa-container-itest/src/test/java/org/apache/aries/jpa/blueprint/aries/itest/JPAInjectionTest.java?rev=1613136&r1=1613135&r2=1613136&view=diff
==============================================================================
--- aries/branches/subsystemsR6/jpa/jpa-container-itest/src/test/java/org/apache/aries/jpa/blueprint/aries/itest/JPAInjectionTest.java (original)
+++ aries/branches/subsystemsR6/jpa/jpa-container-itest/src/test/java/org/apache/aries/jpa/blueprint/aries/itest/JPAInjectionTest.java Thu Jul 24 13:55:49 2014
@@ -16,10 +16,12 @@
package org.apache.aries.jpa.blueprint.aries.itest;
import static org.junit.Assert.assertTrue;
+import static org.ops4j.pax.exam.CoreOptions.mavenBundle;
import static org.ops4j.pax.exam.CoreOptions.options;
import org.apache.aries.jpa.blueprint.itest.JPATestBean;
import org.apache.aries.jpa.itest.AbstractJPAItest;
+import org.junit.Ignore;
import org.junit.Test;
import org.ops4j.pax.exam.Configuration;
import org.ops4j.pax.exam.Option;
@@ -27,6 +29,7 @@ import org.ops4j.pax.exam.Option;
public class JPAInjectionTest extends AbstractJPAItest {
@Test
+ @Ignore
public void findResources() throws Exception {
JPATestBean bean = context().getService(JPATestBean.class, "(version=1.0.0)");
@@ -35,6 +38,7 @@ public class JPAInjectionTest extends Ab
}
@Test
+ @Ignore
public void findResources_110() throws Exception {
JPATestBean bean = context().getService(JPATestBean.class, "(version=1.1.0)");
@@ -46,6 +50,7 @@ public class JPAInjectionTest extends Ab
}
@Test
+ @Ignore
public void testLifecycle() throws Exception {
JPATestBean bean = context().getService(JPATestBean.class, "(lifecycle=true)");
assertTrue("No persistence context injection", bean.pContextAvailable());
Modified: aries/branches/subsystemsR6/jpa/jpa-container-itest/src/test/java/org/apache/aries/jpa/itest/AbstractJPAItest.java
URL: http://svn.apache.org/viewvc/aries/branches/subsystemsR6/jpa/jpa-container-itest/src/test/java/org/apache/aries/jpa/itest/AbstractJPAItest.java?rev=1613136&r1=1613135&r2=1613136&view=diff
==============================================================================
--- aries/branches/subsystemsR6/jpa/jpa-container-itest/src/test/java/org/apache/aries/jpa/itest/AbstractJPAItest.java (original)
+++ aries/branches/subsystemsR6/jpa/jpa-container-itest/src/test/java/org/apache/aries/jpa/itest/AbstractJPAItest.java Thu Jul 24 13:55:49 2014
@@ -104,8 +104,9 @@ public abstract class AbstractJPAItest e
mavenBundle("org.apache.aries.blueprint", "org.apache.aries.blueprint.api").versionAsInProject(),
mavenBundle("org.apache.aries.blueprint", "org.apache.aries.blueprint.core").versionAsInProject(),
-
- mavenBundle("org.apache.geronimo.specs", "geronimo-jpa_2.0_spec").versionAsInProject(),
+
+ mavenBundle("org.apache.geronimo.specs", "geronimo-jpa_2.0_spec", "1.1"),
+ // mavenBundle("org.hibernate.javax.persistence", "hibernate-jpa-2.1-api").versionAsInProject(),
mavenBundle("org.apache.aries.jpa", "org.apache.aries.jpa.api").versionAsInProject(),
mavenBundle("org.apache.aries.jpa", "org.apache.aries.jpa.container").versionAsInProject(),
mavenBundle("org.apache.aries.jpa", "org.apache.aries.jpa.container.context").versionAsInProject(),
Modified: aries/branches/subsystemsR6/jpa/jpa-container-testbundle/pom.xml
URL: http://svn.apache.org/viewvc/aries/branches/subsystemsR6/jpa/jpa-container-testbundle/pom.xml?rev=1613136&r1=1613135&r2=1613136&view=diff
==============================================================================
--- aries/branches/subsystemsR6/jpa/jpa-container-testbundle/pom.xml (original)
+++ aries/branches/subsystemsR6/jpa/jpa-container-testbundle/pom.xml Thu Jul 24 13:55:49 2014
@@ -55,15 +55,15 @@
<dependencies>
<dependency>
- <groupId>org.apache.geronimo.specs</groupId>
- <artifactId>geronimo-jpa_2.0_spec</artifactId>
- <version>1.1</version>
+ <groupId>org.hibernate.javax.persistence</groupId>
+ <artifactId>hibernate-jpa-2.1-api</artifactId>
+ <version>1.0.0.Final</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.openjpa</groupId>
<artifactId>openjpa</artifactId>
- <version>2.0.0</version>
+ <version>2.2.2</version>
<scope>provided</scope>
</dependency>
</dependencies>
Modified: aries/branches/subsystemsR6/jpa/jpa-container/pom.xml
URL: http://svn.apache.org/viewvc/aries/branches/subsystemsR6/jpa/jpa-container/pom.xml?rev=1613136&r1=1613135&r2=1613136&view=diff
==============================================================================
--- aries/branches/subsystemsR6/jpa/jpa-container/pom.xml (original)
+++ aries/branches/subsystemsR6/jpa/jpa-container/pom.xml Thu Jul 24 13:55:49 2014
@@ -31,7 +31,7 @@
<groupId>org.apache.aries.jpa</groupId>
<artifactId>org.apache.aries.jpa.container</artifactId>
<packaging>bundle</packaging>
- <version>1.0.1-SNAPSHOT</version>
+ <version>1.0.2-SNAPSHOT</version>
<name>Aries JPA Container</name>
<scm>
@@ -44,10 +44,10 @@
<!-- Export package versions are maintained in packageinfo files -->
<aries.osgi.export.pkg />
<aries.osgi.import>
- javax.persistence;version="[1.0.0,2.1.0)",
- javax.persistence.spi;version="[1.0.0,2.1.0)",
- javax.persistence.criteria;version="[1.1.0,2.1.0)";resolution:=optional,
- javax.persistence.metamodel;version="[1.1.0,2.1.0)";resolution:=optional,
+ javax.persistence;version="[1.0.0,3.0.0)",
+ javax.persistence.spi;version="[1.0.0,3.0.0)",
+ javax.persistence.criteria;version="[1.1.0,3.0.0)";resolution:=optional,
+ javax.persistence.metamodel;version="[1.1.0,3.0.0)";resolution:=optional,
!javax.transaction,
org.apache.aries.jpa.container*;provide:=true,
org.apache.aries.quiesce.manager;provide:=true;resolution:=optional,
@@ -81,7 +81,7 @@
<dependency>
<artifactId>org.apache.aries.jpa.api</artifactId>
<groupId>org.apache.aries.jpa</groupId>
- <version>1.0.0</version>
+ <version>1.0.1</version>
</dependency>
<dependency>
<groupId>org.apache.aries.quiesce</groupId>
@@ -94,11 +94,11 @@
<groupId>org.apache.aries</groupId>
<version>1.0.0</version>
<scope>provided</scope>
- </dependency>
+ </dependency>
<dependency>
- <groupId>org.apache.geronimo.specs</groupId>
- <artifactId>geronimo-jpa_2.0_spec</artifactId>
- <version>1.1</version>
+ <groupId>org.hibernate.javax.persistence</groupId>
+ <artifactId>hibernate-jpa-2.1-api</artifactId>
+ <version>1.0.0.Final</version>
<scope>provided</scope>
</dependency>
<dependency>