What if an adapter requires additional settings?

If an adapter - as for example the Castor adapter - does require further settings for a meaningful employment, the AdapterFactory can be used.

The AdapterFactory is used by EJOE to register adapters, cache them and/or make them available through synonyms.

EJOE does create an instance for each adapter listed in the file ejoe-adapter-conf.properties by invoking the default constructor. These adapters will be registered automatically with the AdapterRegistry while using their classnames as synonyms.

For example also for the CastorAdapter such an instance is produced. This instance is however not really useable because the adapter is missing a typical Castor mappingfile.

To overwrite the default mechanism of creating and registering SerializeAdapters the method registerAdapter(SerializeAdapter) should be used. Do not forget to register the SerializeAdapter on both server and client!

//does register a custom instance of the CastorAdapter
AdapterFactory.registerAdapter( new CastorAdapter( "castor-mapping.xml" ) );