use of org.apache.felix.jmood.compendium.ConfigAdminManager in project felix by apache.
the class CompendiumHandler method handleEvent.
private void handleEvent(ServiceReference serviceReference, String iService, int eType) {
try {
if (iService.equals(ConfigurationAdmin.class.getName())) {
switch(eType) {
case ServiceEvent.REGISTERED:
ConfigAdminManagerMBean ca = new ConfigAdminManager(ac);
server.registerMBean(ca, new ObjectName(ObjectNames.CM_SERVICE));
break;
case ServiceEvent.UNREGISTERING:
server.unregisterMBean(new ObjectName(ObjectNames.CM_SERVICE));
break;
default:
break;
}
}
if (iService.equals(LogService.class.getName())) {
switch(eType) {
case ServiceEvent.REGISTERED:
LogManagerMBean lm = new LogManager(ac);
server.registerMBean(lm, new ObjectName(ObjectNames.LOG_SERVICE));
break;
case ServiceEvent.UNREGISTERING:
server.unregisterMBean(new ObjectName(ObjectNames.LOG_SERVICE));
break;
default:
break;
}
}
if (iService.equals(UserAdmin.class.getName())) {
switch(eType) {
case ServiceEvent.REGISTERED:
UserManagerMBean um = new UserManager(ac);
server.registerMBean(um, new ObjectName(ObjectNames.UA_SERVICE));
break;
case ServiceEvent.UNREGISTERING:
server.unregisterMBean(new ObjectName(ObjectNames.UA_SERVICE));
break;
default:
break;
}
}
} catch (InstanceAlreadyExistsException e) {
ac.error("Unexpected error", e);
} catch (MBeanRegistrationException e) {
ac.error("Unexpected error", e);
} catch (NotCompliantMBeanException e) {
ac.error("Unexpected error", e);
} catch (MalformedObjectNameException e) {
ac.error("Unexpected error", e);
} catch (NullPointerException e) {
ac.error("Unexpected error", e);
} catch (InstanceNotFoundException e) {
ac.error("Unexpected error", e);
}
}
use of org.apache.felix.jmood.compendium.ConfigAdminManager in project felix by apache.
the class CompendiumHandler method initController.
public void initController() {
try {
if (ac.getConfigurationAdmin() != null) {
ConfigAdminManagerMBean ca = new ConfigAdminManager(ac);
server.registerMBean(ca, new ObjectName(ObjectNames.CM_SERVICE));
}
if (ac.getLogservice() != null) {
LogManagerMBean lm = new LogManager(ac);
server.registerMBean(lm, new ObjectName(ObjectNames.LOG_SERVICE));
}
if (ac.getUserAdmin() != null) {
UserManagerMBean um = new UserManager(ac);
server.registerMBean(um, new ObjectName(ObjectNames.UA_SERVICE));
}
} catch (InstanceAlreadyExistsException e) {
ac.error("Unexpected error", e);
} catch (MBeanRegistrationException e) {
ac.error("Unexpected error", e);
} catch (NotCompliantMBeanException e) {
ac.error("Unexpected error", e);
} catch (MalformedObjectNameException e) {
ac.error("Unexpected error", e);
} catch (NullPointerException e) {
ac.error("Unexpected error", e);
}
ac.getBundleContext().addServiceListener(sl);
}
Aggregations