You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@hivemind.apache.org by Jake Shapiro <Ja...@iag.com.au> on 2007/02/08 08:14:15 UTC
How to pass runtime jndiName param to EJBProxyFactory in hivemind 1.1.1
_______________________________________________________________________________________
Note: This e-mail is subject to the disclaimer contained at the bottom of this message.
_______________________________________________________________________________________
I'm using hivemind 1.1.1 to perform JNDI lookup of remote session EJB
whose providerUrl and jndiName are only known at runtime.
The providerUrl and jndiName are provided by the client with the
original request and during post-processing callback to the client is
made using these values to locate client remote service. While I managed
to pass providerUrl to NameLookup I'm unable to pass jndiName as neither
NameLookupImpl nor EJBProxyFactory have setter for it.
I have tried playing with configuration points and own implementation of
ServiceImplementationFactory without success. If I hard-code jndi-name
attribute value it works but the problem is it's unknown at the
build/deployment time so it must be a run-time arg
Descriptor and code follows.
<?xml version="1.0"?>
<module id="au.com.cgu.webinsure.common.service" version="1.1.1">
<!-- Client-side Service -->
<service-point id="ClientService"
interface="au.com.companyname.service.ClientService" />
<implementation service-id="ClientService">
<invoke-factory>
<construct class="impl.ClientServiceImpl">
<set-service property="remoteRef"
service-id="ClientServiceRemote" />
</construct>
</invoke-factory>
</implementation>
<service-point id="ClientServiceRemote"
interface="au.com.companyname.service.ClientServiceRemote"
visibility="private">
<invoke-factory
service-id="hivemind.lib.EJBProxyFactory">
<construct
home-interface="au.com.companyname.ejb.ClientServiceHome"
jndi-name="${jndiNameKey}" name-lookup-service-id="NameLookupService" />
</invoke-factory>
<interceptor service-id="hivemind.LoggingInterceptor" />
</service-point>
<service-point id="NameLookupService"
interface="org.apache.hivemind.lib.NameLookup">
<invoke-factory service-id="hivemind.BuilderFactory"
model="singleton">
<construct
class="org.apache.hivemind.lib.impl.NameLookupImpl">
<set property="initialFactory"
value="com.ibm.websphere.naming.WsnInitialContextFactory" />
<set property="providerURL"
value="${java.naming.provider.url}" />
</construct>
</invoke-factory>
<interceptor service-id="hivemind.LoggingInterceptor" />
</service-point>
</module>
/////////////////////////////////////////////
...
ClientService service = getClientService(providerUrl, jndiName);
service.doSomething(); // barfs here
...
protected final ClientService getClientService(final String
providerUrl,final String jndiName) {
System.setProperty(Context.PROVIDER_URL, providerUrl);
System.setProperty("jndiNameKey", jndiName);
// Construct Hivemind registry.
// By that time all system properties hivemind relies upon
should be set.
RegistryBuilder builder = new RegistryBuilder();
builder.addDefaultModuleDescriptorProvider();
Registry registry =
builder.constructRegistry(Locale.getDefault());
return (ClientService ) registry.getService(
"au.com.companyname.service.ClientService",
ClientService.class);
Any thoughts?
Thanks,
Jake
_______________________________________________________________________________________
The information transmitted in this message and its attachments (if any) is intended
only for the person or entity to which it is addressed.
The message may contain confidential and/or privileged material. Any review,
retransmission, dissemination or other use of, or taking of any action in reliance
upon this information, by persons or entities other than the intended recipient is
prohibited.
If you have received this in error, please contact the sender and delete this e-mail
and associated material from any computer.
The intended recipient of this e-mail may only use, reproduce, disclose or distribute
the information contained in this e-mail and any attached files, with the permission
of the sender.
This message has been scanned for viruses with Symantec Scan Engine and cleared by
MailMarshal.
_______________________________________________________________________________________