[jboss-dev] Dependencies to JBoss as core libs
Tim Fox
tim.fox at jboss.com
Wed Jun 27 09:55:12 EDT 2007
Yes, this is the approach I was referring to in my previous post when I
said "minor changes", no need to write an essay ;)
Adrian wrote:
> On Wed, 2007-06-27 at 14:01 +0100, Tim Fox wrote:
>
>> The JBoss Messaging Bridge MBean has dependencies on JMSProviderLoader
>> since it uses these to connect to its source and target destinations.
>>
>> Are you suggesting we move the Bridge MBean into the AS project?
>>
>
> No, I'm suggesting you think about providing a clean api
> which can be used by the AS to integrate with its configuration
> mechanisms.
>
> Trying to do integration in your project just leads
> to JBAS-1796 style problems and bad api!
>
> IOC 101
>
> Why doesn't the bridge just take connection factories
> and destinations as injections (javabean setters)?
> That is a trivial "no dependency required"
> configuration api.
>
> public SimpleBridge
> {
> setSourceConnectionFactory(XAConnectionFactory cf) {};
> setTargetConnectionFactory(XAConnectionFactory cf) {};
> setSourceDestination(Destination destination) {};
> setTargetDestination(Destination destination) {};
>
> ...
> }
>
> ANY FORM OF INTEGRATION IS NOW EASY
>
> For standalone ease of use, you could subclass the simple bridge
> with a version that does something like (psuedo code):
>
> public JNDIBridge extends SimpleBridge
> {
>
> public void setTargetDestinationJndiName(String targetJNDI) {}
>
> public void setJNDITargetProperties(Properties targetProperties) { }
>
> // Create lifecycle that does base setters from jndi configuration
> public void create() throws Exception
> {
> if (targetJNDI == null)
> throw new IllegalStateException("Target jndi name not set!");
>
> InitialContext context;
> if (targetProperties == null)
> context = new InitialContext();
> else
> context = new InitialContext(targetProperties);
> try
> {
> Destination d = (Destination) context.lookup(targetJNDI);
> setTargetDestination(d);
>
> etc....
> }
> finally
> {
> context.close();
> }
>
> }
> }
>
> Which is basically what the JMSProvider really does anyway!
>
> JBOSS INTEGRATION IS ALSO TRIVIAL
>
> In the appserver we could have a JNDIProvider based version
> to integrate with the current way of configuring jms servers
> in one place.
>
> public JNDIProviderBridge extends SimpleBridge
> {
> public void setSourceJNDIProviderName(String jndiName) {}
> public void setTargetJNDIProviderName(String jndiName) {}
> public void setSourceDestination(String jndiName) {}
> public void setTargetDestination(String jndiName) {}
>
> etc....
> }
>
>
More information about the jboss-development
mailing list