You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by da...@apache.org on 2007/05/03 22:13:04 UTC
svn commit: r534981 - in /geronimo/server/trunk/modules:
geronimo-connector-builder/src/main/java/org/apache/geronimo/connector/deployment/
geronimo-naming/src/main/java/org/apache/geronimo/naming/reference/
Author: dain
Date: Thu May 3 13:13:03 2007
New Revision: 534981
URL: http://svn.apache.org/viewvc?view=rev&rev=534981
Log:
Add custom handling for resource-env-ref of type UserTransaction
Added:
geronimo/server/trunk/modules/geronimo-naming/src/main/java/org/apache/geronimo/naming/reference/UserTransactionReference.java
Modified:
geronimo/server/trunk/modules/geronimo-connector-builder/src/main/java/org/apache/geronimo/connector/deployment/AdminObjectRefBuilder.java
Modified: geronimo/server/trunk/modules/geronimo-connector-builder/src/main/java/org/apache/geronimo/connector/deployment/AdminObjectRefBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-connector-builder/src/main/java/org/apache/geronimo/connector/deployment/AdminObjectRefBuilder.java?view=diff&rev=534981&r1=534980&r2=534981
==============================================================================
--- geronimo/server/trunk/modules/geronimo-connector-builder/src/main/java/org/apache/geronimo/connector/deployment/AdminObjectRefBuilder.java (original)
+++ geronimo/server/trunk/modules/geronimo-connector-builder/src/main/java/org/apache/geronimo/connector/deployment/AdminObjectRefBuilder.java Thu May 3 13:13:03 2007
@@ -44,6 +44,7 @@
import org.apache.geronimo.kernel.repository.Environment;
import org.apache.geronimo.naming.deployment.AbstractNamingBuilder;
import org.apache.geronimo.naming.reference.ResourceReference;
+import org.apache.geronimo.naming.reference.UserTransactionReference;
import org.apache.geronimo.xbeans.geronimo.naming.GerMessageDestinationDocument;
import org.apache.geronimo.xbeans.geronimo.naming.GerMessageDestinationType;
import org.apache.geronimo.xbeans.geronimo.naming.GerPatternType;
@@ -143,8 +144,8 @@
try {
String refType = getStringValue(resourceEnvRef.getResourceEnvRefType());
if (refType.equals("javax.transaction.UserTransaction")) {
- LinkRef linkRef = new LinkRef("java:comp/UserTransaction");
- getJndiContextMap(componentContext).put(ENV + name, linkRef);
+ Reference ref = new UserTransactionReference();
+ getJndiContextMap(componentContext).put(ENV + name, ref);
} else {
AbstractNameQuery containerId = getAdminObjectContainerId(name, gerResourceEnvRef);
Reference ref = buildAdminObjectReference(localConfiguration, remoteConfiguration, containerId, iface);
@@ -351,14 +352,6 @@
addResourceEnvRef(annotatedApp, resourceName, resourceType, method, field, annotation);
return true;
} else {
- //look for an JCAAdminObject gbean with the right name
- AbstractNameQuery containerId = buildAbstractNameQuery(null, null, resourceName, NameFactory.JCA_ADMIN_OBJECT, NameFactory.RESOURCE_ADAPTER_MODULE);
- try {
- localConfiguration.findGBean(containerId);
- } catch (GBeanNotFoundException e) {
- //not identifiable as an admin object ref
- return false;
- }
addResourceEnvRef(annotatedApp, resourceName, resourceType, method, field, annotation);
return true;
}
Added: geronimo/server/trunk/modules/geronimo-naming/src/main/java/org/apache/geronimo/naming/reference/UserTransactionReference.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-naming/src/main/java/org/apache/geronimo/naming/reference/UserTransactionReference.java?view=auto&rev=534981
==============================================================================
--- geronimo/server/trunk/modules/geronimo-naming/src/main/java/org/apache/geronimo/naming/reference/UserTransactionReference.java (added)
+++ geronimo/server/trunk/modules/geronimo-naming/src/main/java/org/apache/geronimo/naming/reference/UserTransactionReference.java Thu May 3 13:13:03 2007
@@ -0,0 +1,41 @@
+/**
+ *
+ * Copyright 2006 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.geronimo.naming.reference;
+
+import org.apache.geronimo.kernel.Kernel;
+
+import javax.naming.NameNotFoundException;
+import javax.naming.NamingException;
+import javax.transaction.UserTransaction;
+
+/**
+ * @version $Rev: 476049 $ $Date: 2006-11-16 20:35:17 -0800 (Thu, 16 Nov 2006) $
+ */
+public class UserTransactionReference extends SimpleAwareReference {
+ public String getClassName() {
+ return UserTransaction.class.getName();
+ }
+
+ public Object getContent() throws NamingException {
+ Kernel kernel = getKernel();
+ try {
+ return kernel.getGBean(UserTransaction.class);
+ } catch (Exception e) {
+ throw (NameNotFoundException) new NameNotFoundException("Error getting UserTransaction from kernel").initCause(e);
+ }
+ }
+}