private Class<? extends SecurityMasterDetailProvider> _detailProvider = HibernateSecurityMasterDetailProvider.class;
//-------------------------------------------------------------------------
@Override
public void init(ComponentRepository repo, LinkedHashMap<String, String> configuration) throws Exception {
ComponentInfo info = new ComponentInfo(SecurityMaster.class, getClassifier());
// create
DbSecurityMaster master = new DbSecurityMaster(getDbConnector());
master.registerMetrics(OpenGammaMetricRegistry.getSummaryInstance(), OpenGammaMetricRegistry.getDetailedInstance(), "DbSecurityMaster-" + getClassifier());
if (getUniqueIdScheme() != null) {
master.setUniqueIdScheme(getUniqueIdScheme());
}
if (getMaxRetries() != null) {
master.setMaxRetries(getMaxRetries());
}
if (getJmsChangeManagerTopic() != null) {
JmsChangeManager cm = new JmsChangeManager(getJmsConnector(), getJmsChangeManagerTopic());
master.setChangeManager(cm);
repo.registerLifecycle(cm);
if (getJmsConnector().getClientBrokerUri() != null) {
info.addAttribute(ComponentInfoAttributes.JMS_BROKER_URI, getJmsConnector().getClientBrokerUri().toString());
}
info.addAttribute(ComponentInfoAttributes.JMS_CHANGE_MANAGER_TOPIC, getJmsChangeManagerTopic());
}
if (getDetailProvider() != null) {
SecurityMasterDetailProvider dp = getDetailProvider().newInstance();
if (getCacheManager() != null) {
master.setDetailProvider(new EHCachingSecurityMasterDetailProvider(dp, getCacheManager()));
} else {
master.setDetailProvider(dp);
}
}
checkSchema(master.getSchemaVersion(), "sec");
// register
info.addAttribute(ComponentInfoAttributes.LEVEL, 1);
info.addAttribute(ComponentInfoAttributes.REMOTE_CLIENT_JAVA, RemoteSecurityMaster.class);
info.addAttribute(ComponentInfoAttributes.UNIQUE_ID_SCHEME, master.getUniqueIdScheme());
repo.registerComponent(info, master);
// publish
if (isPublishRest()) {
repo.getRestComponents().publish(info, new DataDbSecurityMasterResource(master));