use of com.iplanet.services.naming.ServiceListeners in project OpenAM by OpenRock.
the class NamingService method initialize.
public static void initialize() {
namingDebug = Debug.getInstance("amNaming");
platformProperties = SystemProperties.getAll();
server_proto = platformProperties.getProperty("com.iplanet.am.server.protocol", "");
server_host = platformProperties.getProperty("com.iplanet.am.server.host", "");
server_port = platformProperties.getProperty(Constants.AM_SERVER_PORT, "");
PrivilegedAction<SSOToken> adminAction = InjectorHolder.getInstance(Key.get(new TypeLiteral<PrivilegedAction<SSOToken>>() {
}));
sso = AccessController.doPrivileged(adminAction);
try {
ssmNaming = new ServiceSchemaManager(NAMING_SERVICE, sso);
ssmPlatform = new ServiceSchemaManager(PLATFORM_SERVICE, sso);
serviceRevNumber = ssmPlatform.getRevisionNumber();
} catch (SMSException | SSOException e) {
throw new IllegalStateException(e);
}
ServiceListeners.Action action = new ServiceListeners.Action() {
@Override
public void performUpdate() {
try {
updateNamingTable();
WebtopNaming.updateNamingTable();
} catch (Exception ex) {
namingDebug.error("Error occured in updating naming table", ex);
}
}
};
ServiceListeners builder = InjectorHolder.getInstance(ServiceListeners.class);
builder.config(NAMING_SERVICE).global(action).schema(action).listen();
builder.config(PLATFORM_SERVICE).global(action).schema(action).listen();
}
Aggregations