// note that we can provide an actual implementation instance here because there will be only one
// adapter, normally you'd want to specify a Class here
// also, create a callback instance which will be used for both callbacks on resource changes and
// life cycle callbacks on the adapters themselves
CallbackInstance callbackInstance = new CallbackInstance(e);
Component component = m.createResourceAdapterService("(&(path=/path/to/*.txt)(host=localhost))", false, callbackInstance, "changed")
.setImplementation(new ResourceAdapter(e))
.setCallbacks(callbackInstance, "init", "start", "stop", "destroy")
.add(m.createServiceDependency()
.setService(ServiceInterface.class)
.setRequired(true)
.setInstanceBound(true));
// add a component state listener
component.addStateListener(new ComponentStateListenerImpl(e));
// add the resource adapter
m.add(component);
// wait until the single resource is available (the adapter has been started)
e.waitForStep(1, 5000);
// trigger a 'change' in our resource