Tomcat's BeanFactory analog in WebSphere

guys. I've faced a problem while migrating from Tomcat to WAS. Here's the problem. I've got such resourse in tomcat context:

<Resource name="serverConnectorType"
              auth="Container"
              factory="org.apache.naming.factory.BeanFactory"
              type="com.vdsirotkin.service.ServerConnectorType"
              url="http://someip:9080/sfs/sfs/"
              connectorType="SOAP"
            />

Some explanation. I need this class to be filled from resources, and i've been using BeanFactory to do that. And now i need to migrate to WAS. So, here's the question. Is there any way to do the same in WAS?

Upvotes: 2

Views: 148

Answers (1)

Alasdair
Alasdair

Reputation: 3176

There isn't a direct equivalence to the BeanFactory, but WAS Liberty does support Object Factories for JNDI so you could write an equivalent to the BeanFactory and use configuration like this:

<jndiObjectFactory id="beanFactory" className="com.example.BeanFactory" libraryRef="beanFactoryClasses"/>
<jndiReferenceEntry factoryRef="beanFactory" jndiName="serverConnectorType">
    <properties className="com.vdsirotkin.service.ServerConnectorType" myProp="value"/>
</jndiReferenceEntry>

The ObjectFactory would get a JNDI Reference with a StringRefAddr for each attribute on the properties element. The type will be the attribute name and the content will be the value.

Upvotes: 3

Related Questions