try {
// test to see if this name if the listener is already bound...
dataService.getServiceBinding(StandardProperties.APP_LISTENER);
} catch (NameNotBoundException nnbe) {
// ...if it's not, create and then bind the listener
AppListener listener =
(new PropertiesWrapper(properties)).
getClassInstanceProperty(StandardProperties.APP_LISTENER,
AppListener.class, new Class[] {});
if (listener instanceof ManagedObject) {
dataService.setServiceBinding(
StandardProperties.APP_LISTENER, listener);
} else {
dataService.setServiceBinding(
StandardProperties.APP_LISTENER,
new ManagedSerializable<AppListener>(listener));
}
// since we created the listener, we're the first one to
// start the app, so we also need to start it up
listener.initialize(properties);
}
}