use of org.candlepin.resteasy.ResourceLocatorMap in project candlepin by candlepin.
the class CandlepinContextListener method withInjector.
@Override
public void withInjector(Injector injector) {
// Must call super.contextInitialized() before accessing injector
insertValidationEventListeners(injector);
ResourceLocatorMap map = injector.getInstance(ResourceLocatorMap.class);
map.init();
if (config.getBoolean(ConfigProperties.AMQP_INTEGRATION_ENABLED) && !config.getBoolean(ConfigProperties.SUSPEND_MODE_ENABLED)) {
QpidQmf qmf = injector.getInstance(QpidQmf.class);
QpidStatus status = qmf.getStatus();
if (status != QpidStatus.CONNECTED) {
log.error("Qpid is in status {}. Please fix Qpid configuration " + "and make sure Qpid is up and running. Candlepin will shutdown " + "now.", status);
throw new RuntimeException("Error during Startup: Qpid is in status " + status);
}
}
if (config.getBoolean(ConfigProperties.AMQP_INTEGRATION_ENABLED) && config.getBoolean(ConfigProperties.SUSPEND_MODE_ENABLED)) {
SuspendModeTransitioner mw = injector.getInstance(SuspendModeTransitioner.class);
mw.transitionAppropriately();
mw.startPeriodicExecutions();
}
if (config.getBoolean(ACTIVEMQ_ENABLED)) {
try {
activeMQContextListener = injector.getInstance(ActiveMQContextListener.class);
activeMQContextListener.contextInitialized(injector);
} catch (Exception e) {
log.error("Exception occurred while trying to load ActiveMQ", e);
}
}
if (config.getBoolean(ConfigProperties.CACHE_JMX_STATS)) {
MBeanServer mBeanServer = ManagementFactory.getPlatformMBeanServer();
ManagementService.registerMBeans(CacheManager.getInstance(), mBeanServer, true, true, true, true);
}
pinsetterListener = injector.getInstance(PinsetterContextListener.class);
pinsetterListener.contextInitialized();
loggerListener = injector.getInstance(LoggerContextListener.class);
/**
* Custom ModelConverter to handle our specific serialization requirements
*/
ModelConverters.getInstance().addConverter(injector.getInstance(CandlepinSwaggerModelConverter.class));
this.injector = injector;
}
Aggregations