use of org.forgerock.openam.sts.rest.config.RestSTSInstanceModule in project OpenAM by OpenRock.
the class RestSTSInstancePublisherImpl method republishExistingInstances.
/**
* This method is only to be called by the RestSTSSetupListener, which calls it only to re-publish
* previously-published Rest STS instances during OpenAM startup.
*/
@Override
public void republishExistingInstances() throws STSPublishException {
/*
Do not trigger the republish if OpenAM is being installed or upgraded.
*/
if (AMSetupServlet.isCurrentConfigurationValid()) {
final List<RestSTSInstanceConfig> publishedInstances = getPublishedInstances();
for (RestSTSInstanceConfig instanceConfig : publishedInstances) {
Injector instanceInjector;
try {
instanceInjector = Guice.createInjector(new RestSTSInstanceModule(instanceConfig));
} catch (Exception e) {
logger.error("Exception caught creating the guice injector in republish corresponding to rest sts " + "instance: " + instanceConfig.toJson() + ". This instance cannot be republished. Exception: " + e);
continue;
}
try {
publishInstance(instanceConfig, instanceInjector.getInstance(RestSTS.class), true);
logger.info("Republished Rest STS instance corresponding to config " + instanceConfig.toJson());
} catch (STSPublishException e) {
logger.error("Exception caught publishing rest sts " + "instance: " + instanceConfig.toJson() + ". This instance cannot be republished. Exception: " + e);
continue;
}
}
}
}
Aggregations