-
Notifications
You must be signed in to change notification settings - Fork 8
Open
Description
What steps will reproduce the problem?
1. Create converter which returns a javax.naming.Reference populated with the
correct class and factory class (implementing ObjectFactory).
2. Retrieve Reference
What is the expected output? What do you see instead?
a. expected result: a class built by the factory class using the ObjectFactory
interface
b. actual result: just the Reference object
What version of the product are you using? On what operating system?
11.4.1 on Linux
Please provide any additional information below.
if I use the standard Java RefFSContextFactory as JNDI provider, this
works well:
1. Create Reference
2. bind()
3. lookup() returns specific object, here WSMQConnectionFactory
Also, the Glassfish custom resource are implemented that way.
In summary, I see two issues here:
1. References should be returned as actual objects
2. simple-jndi should provide a default converter for the Reference object:
public class SimpleJndiObjectFactoryConverter implements Converter {
private static final String OBJECT_FACTORY_NAME = "objectFactoryName";
/* (non-Javadoc)
* @see org.osjava.sj.loader.convert.Converter#convert(java.util.Properties, java.lang.String)
*/
public Object convert( final Properties properties, final String type ) {
final String factoryName = ( String ) properties.get( OBJECT_FACTORY_NAME );
final Reference ref = new Reference( type, factoryName, null );
for ( final Entry <Object, Object> entry : properties.entrySet() ) {
final String key = (String) entry.getKey();
if ( OBJECT_FACTORY_NAME.equals( key ) ) {
continue;
}
ref.add( new StringRefAddr( key, (String) entry.getValue() ) );
}
return ref;
}
}
Thanks, Jörg
Original issue reported on code.google.com by jfaram...@gmail.com on 25 May 2012 at 12:30