Search in sources :

Example 1 with ServiceListeners

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();
}
Also used : ServiceListeners(com.iplanet.services.naming.ServiceListeners) PrivilegedAction(java.security.PrivilegedAction) SSOToken(com.iplanet.sso.SSOToken) TypeLiteral(com.google.inject.TypeLiteral) SMSException(com.sun.identity.sm.SMSException) SSOException(com.iplanet.sso.SSOException) ServiceSchemaManager(com.sun.identity.sm.ServiceSchemaManager) ServerEntryNotFoundException(com.iplanet.services.naming.ServerEntryNotFoundException) SMSException(com.sun.identity.sm.SMSException) MalformedURLException(java.net.MalformedURLException) SSOException(com.iplanet.sso.SSOException)

Aggregations

TypeLiteral (com.google.inject.TypeLiteral)1 ServerEntryNotFoundException (com.iplanet.services.naming.ServerEntryNotFoundException)1 ServiceListeners (com.iplanet.services.naming.ServiceListeners)1 SSOException (com.iplanet.sso.SSOException)1 SSOToken (com.iplanet.sso.SSOToken)1 SMSException (com.sun.identity.sm.SMSException)1 ServiceSchemaManager (com.sun.identity.sm.ServiceSchemaManager)1 MalformedURLException (java.net.MalformedURLException)1 PrivilegedAction (java.security.PrivilegedAction)1