// Enable bindings into the cluster
try {
ConfigurationRepository.getServerConfiguration().enableCMI(this.cmiProperties);
} catch (Exception e) {
this.logger.error("Cannot configure Carol to use CMI", e);
throw new EZBComponentException("Cannot configure Carol to use CMI", e);
}
ClusterViewManagerFactory clusterViewManagerFactory = ClusterViewManagerFactory.getFactory();
// Start the manager
try {
this.clusterViewManager = (ServerClusterViewManager) clusterViewManagerFactory.create();
} catch (Exception e) {
this.logger.error("Cannot retrieve the CMI Server", e);
throw new EZBComponentException("Cannot retrieve the CMI Server", e);
}
if (this.clusterViewManager != null
&& this.clusterViewManager.getState().equals(ClusterViewManager.State.STOPPED)) {
if (this.eventComponent != null) {
List<Component> components =
clusterViewManagerFactory.getConfig().getComponents().getComponents();
if (components != null) {
for (Component cmiEventComponent : components) {
if (org.ow2.cmi.component.event.EventComponent.class.isAssignableFrom(cmiEventComponent.getClass())) {
((org.ow2.cmi.component.event.EventComponent) cmiEventComponent).setEventService(
this.eventComponent.getEventService());
}
}
}
}
try {
this.clusterViewManager.start();
} catch (Exception e) {
this.logger.error("Cannot start the CMI Server", e);
throw new EZBComponentException("Cannot start the CMI Server", e);
}
}
}
// register the listener.
EZBEventListener eventListener = new CmiEventListener();