geronimo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Jencks <david_jen...@yahoo.com>
Subject Re: svn commit: r963537 - in /geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-builder-1_6/src/main/java/org/apache/geronimo/connector/deployment: AdminObjectRefBuilder.java ResourceRefBuilder.java
Date Wed, 21 Jul 2010 07:49:02 GMT

On Jul 20, 2010, at 10:24 PM, Jarek Gawor wrote:

> David,
> 
> Most jndi lookups via the java namespace are supposed to return an
> unique instance on each lookup. If we route the java namespace lookups
> directly to service registry lookups we will no longer be returning
> unique instances because service registry lookups are cached
> automatically. So we really need to do what we have done before and
> lookup a gbean in SR and call .$getResource() on it. That also means
> that each gbean that implements ResourceSource interface must not
> implement the ServiceFactory interface where getService() calls
> $getResource().
> 

Does this mean that if we want to make the datasources available directly in the osgi or aries
namespace, perhaps always returning the same instance, and also want to satisfy the uniqueness
requirement for looking it up in the java: namespace, we need to register 2 services in the
service registry?

thanks
david jencks

> Jarek
> 
> On Mon, Jul 12, 2010 at 8:00 PM,  <djencks@apache.org> wrote:
>> Author: djencks
>> Date: Tue Jul 13 00:00:40 2010
>> New Revision: 963537
>> 
>> URL: http://svn.apache.org/viewvc?rev=963537&view=rev
>> Log:
>> GERONIMO-5445 use aries jndi with osgi service lookup instead of kernel gbean registry
lookup in java: jndi
>> 
>> Modified:
>>    geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-builder-1_6/src/main/java/org/apache/geronimo/connector/deployment/AdminObjectRefBuilder.java
>>    geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-builder-1_6/src/main/java/org/apache/geronimo/connector/deployment/ResourceRefBuilder.java
>> 
>> Modified: geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-builder-1_6/src/main/java/org/apache/geronimo/connector/deployment/AdminObjectRefBuilder.java
>> URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-builder-1_6/src/main/java/org/apache/geronimo/connector/deployment/AdminObjectRefBuilder.java?rev=963537&r1=963536&r2=963537&view=diff
>> ==============================================================================
>> --- geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-builder-1_6/src/main/java/org/apache/geronimo/connector/deployment/AdminObjectRefBuilder.java
(original)
>> +++ geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-builder-1_6/src/main/java/org/apache/geronimo/connector/deployment/AdminObjectRefBuilder.java
Tue Jul 13 00:00:40 2010
>> @@ -32,6 +32,7 @@ import javax.naming.StringRefAddr;
>>  import javax.xml.namespace.QName;
>>  import org.apache.geronimo.common.DeploymentException;
>>  import org.apache.geronimo.common.UnresolvedReferenceException;
>> +import org.apache.geronimo.gbean.AbstractName;
>>  import org.apache.geronimo.gbean.AbstractNameQuery;
>>  import org.apache.geronimo.gbean.annotation.GBean;
>>  import org.apache.geronimo.gbean.annotation.ParamAttribute;
>> @@ -44,7 +45,6 @@ import org.apache.geronimo.kernel.config
>>  import org.apache.geronimo.kernel.repository.Environment;
>>  import org.apache.geronimo.naming.deployment.AbstractNamingBuilder;
>>  import org.apache.geronimo.naming.reference.JndiReference;
>> -import org.apache.geronimo.naming.reference.ResourceReferenceFactory;
>>  import org.apache.geronimo.naming.reference.UserTransactionReference;
>>  import org.apache.geronimo.xbeans.geronimo.naming.GerMessageDestinationDocument;
>>  import org.apache.geronimo.xbeans.geronimo.naming.GerMessageDestinationType;
>> @@ -268,7 +268,7 @@ public class AdminObjectRefBuilder exten
>>         }
>>         try {
>>             AbstractNameQuery containerId = getAdminObjectContainerId(name, gerResourceEnvRef);
>> -            ResourceReferenceFactory<RuntimeException> ref = buildAdminObjectReference(module,
containerId, iface);
>> +            Reference ref = buildAdminObjectReference(module, containerId);
>>             return ref;
>>         } catch (UnresolvedReferenceException e) {
>>             throw new DeploymentException("Unable to resolve resource env reference
'" + name + "' (" + (e.isMultiple() ? "found multiple matching resources" : "no matching resources
found") + ")", e);
>> @@ -308,7 +308,7 @@ public class AdminObjectRefBuilder exten
>>         //try to resolve ref based only matching resource-ref-name
>>         //throws exception if it can't locate ref.
>>         AbstractNameQuery containerId = buildAbstractNameQuery(null, moduleURI, linkName,
NameFactory.JCA_ADMIN_OBJECT, NameFactory.RESOURCE_ADAPTER_MODULE);
>> -        ResourceReferenceFactory<RuntimeException> ref = buildAdminObjectReference(module,
containerId, iface);
>> +        Reference ref = buildAdminObjectReference(module, containerId);
>>         return ref;
>>     }
>> 
>> @@ -344,14 +344,15 @@ public class AdminObjectRefBuilder exten
>>     }
>> 
>> 
>> -    private ResourceReferenceFactory<RuntimeException> buildAdminObjectReference(Module
module, AbstractNameQuery containerId, Class iface) throws DeploymentException {
>> +    private Reference buildAdminObjectReference(Module module, AbstractNameQuery
containerId) throws DeploymentException {
>>         Configuration localConfiguration = module.getEarContext().getConfiguration();
>>         try {
>> -            localConfiguration.findGBean(containerId);
>> +            AbstractName abstractName = localConfiguration.findGBean(containerId);
>> +            String osgiJndiName = "aries:services/" + module.getEarContext().getNaming().toOsgiJndiName(abstractName);
>> +            return new JndiReference(osgiJndiName);
>>         } catch (GBeanNotFoundException e) {
>>             throw new DeploymentException("Can not resolve admin object ref " + containerId
+ " in configuration " + localConfiguration.getId(), e);
>>         }
>> -        return new ResourceReferenceFactory<RuntimeException>(module.getConfigId(),
containerId, iface);
>>     }
>> 
>>     private static AbstractNameQuery getAdminObjectContainerId(String name, GerResourceEnvRefType
gerResourceEnvRef) {
>> 
>> Modified: geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-builder-1_6/src/main/java/org/apache/geronimo/connector/deployment/ResourceRefBuilder.java
>> URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-builder-1_6/src/main/java/org/apache/geronimo/connector/deployment/ResourceRefBuilder.java?rev=963537&r1=963536&r2=963537&view=diff
>> ==============================================================================
>> --- geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-builder-1_6/src/main/java/org/apache/geronimo/connector/deployment/ResourceRefBuilder.java
(original)
>> +++ geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-builder-1_6/src/main/java/org/apache/geronimo/connector/deployment/ResourceRefBuilder.java
Tue Jul 13 00:00:40 2010
>> @@ -31,7 +31,6 @@ import java.util.Map;
>>  import java.util.Set;
>> 
>>  import javax.annotation.Resource;
>> -import javax.resource.ResourceException;
>>  import javax.xml.namespace.QName;
>>  import org.apache.geronimo.common.DeploymentException;
>>  import org.apache.geronimo.deployment.service.EnvironmentBuilder;
>> @@ -57,7 +56,6 @@ import org.apache.geronimo.naming.deploy
>>  import org.apache.geronimo.naming.deployment.ResourceEnvironmentSetter;
>>  import org.apache.geronimo.naming.reference.JndiReference;
>>  import org.apache.geronimo.naming.reference.ORBReference;
>> -import org.apache.geronimo.naming.reference.ResourceReferenceFactory;
>>  import org.apache.geronimo.naming.reference.URLReference;
>>  import org.apache.geronimo.xbeans.geronimo.naming.GerPatternType;
>>  import org.apache.geronimo.xbeans.geronimo.naming.GerResourceRefDocument;
>> @@ -70,7 +68,6 @@ import org.apache.openejb.jee.ResourceRe
>>  import org.apache.openejb.jee.Text;
>>  import org.apache.xmlbeans.QNameSet;
>>  import org.apache.xmlbeans.XmlObject;
>> -import org.omg.CORBA.ORB;
>>  import org.osgi.framework.Bundle;
>>  import org.slf4j.Logger;
>>  import org.slf4j.LoggerFactory;
>> @@ -218,9 +215,11 @@ public class ResourceRefBuilder extends
>>             try {
>>                 AbstractNameQuery containerId = getResourceContainerId(name, j2eeType,
null, gerResourceRef);
>> 
>> -                module.getEarContext().findGBean(containerId);
>> +                AbstractName abstractName = module.getEarContext().findGBean(containerId);
>> +                String osgiJndiName = "aries:services/" + module.getEarContext().getNaming().toOsgiJndiName(abstractName);
>> 
>> -                return new ResourceReferenceFactory<ResourceException>(module.getConfigId(),
containerId, iface);
>> +                return new JndiReference(osgiJndiName);
>> +                        //ResourceReferenceFactory<ResourceException>(module.getConfigId(),
containerId, iface);
>>             } catch (GBeanNotFoundException e) {
>>                 StringBuffer errorMessage = new StringBuffer("Unable to resolve resource
reference '");
>>                 errorMessage.append(name);
>> 
>> 
>> 


Mime
View raw message