private static void initialize() throws Exception {
  try (IDiagnosticsContextScope diagCtxt=DiagnosticsContextFactory.createContext("IDM Startup","")){
    logger.info("Starting IDM Server...");
    logger.debug("Creating RMI registry on port {}",Tenant.RMI_PORT);
    boolean allowRemoteConnections=Boolean.parseBoolean(System.getProperty(ALLOW_REMOTE_PROPERTY,"false"));
    if (allowRemoteConnections) {
      logger.warn("RMI registry is allowing remote connections!");
      registry=LocateRegistry.createRegistry(Tenant.RMI_PORT);
    }
 else {
      logger.debug("RMI registry is restricted to the localhost");
      RMIClientSocketFactory csf=RMISocketFactory.getDefaultSocketFactory();
      RMIServerSocketFactory ssf=new LocalRMIServerSocketFactory();
      registry=LocateRegistry.createRegistry(Tenant.RMI_PORT,csf,ssf);
    }
    if (System.getSecurityManager() == null) {
      logger.debug("Creating RMI Security Manager...");
      System.setSecurityManager(new RMISecurityManager());
    }
    logger.debug("Creating Config Store factory...");
    IConfigStoreFactory cfgStoreFactory=new ConfigStoreFactory();
    logger.debug("Creating Identity Provider factory...");
    IProviderFactory providerFactory=new ProviderFactory();
    logger.debug("Checking VMware Directory Service...");
    ServerUtils.check_directory_service();
    logger.debug("Setting system properties...");
    System.setProperties(new ThreadLocalProperties(System.getProperties()));
    logger.debug("Creating Identity Manager instance...");
    manager=new IdentityManager(cfgStoreFactory,providerFactory);
    String rmiAddress=String.format("rmi://localhost:%d/%s",Tenant.RMI_PORT,IDENTITY_MANAGER_BIND_NAME);
    logger.debug("Binding to RMI address '{}'",rmiAddress);
    loginManager=new IdmLoginManager(manager);
    ILoginManager stub=(ILoginManager)UnicastRemoteObject.exportObject(loginManager,0);
    Naming.rebind(rmiAddress,stub);
    startHeartbeat();
    logger.info(VmEvent.SERVER_STARTED,"IDM Server has started");
  }
 catch (  Throwable t) {
    logger.error(VmEvent.SERVER_FAILED_TOSTART,"IDM Server has failed to start",t);
    throw t;
  }
}

private static void initialize ( ) throws Exception { try ( IDiagnosticsContextScope diagCtxt = DiagnosticsContextFactory . createContext ( "IDM Startup" , "" ) ) { logger . info ( "Starting IDM Server..." ) ; logger . debug ( "Creating RMI registry on port {}" , Tenant . RMI_PORT ) ; boolean allowRemoteConnections = Boolean . parseBoolean ( System . getProperty ( ALLOW_REMOTE_PROPERTY , "false" ) ) ; if ( allowRemoteConnections ) { logger . warn ( "RMI registry is allowing remote connections!" ) ; registry = LocateRegistry . createRegistry ( Tenant . RMI_PORT ) ; } else { logger . debug ( "RMI registry is restricted to the localhost" ) ; RMIClientSocketFactory csf = RMISocketFactory . getDefaultSocketFactory ( ) ; RMIServerSocketFactory ssf = new LocalRMIServerSocketFactory ( ) ; registry = LocateRegistry . createRegistry ( Tenant . RMI_PORT , csf , ssf ) ; } if ( System . getSecurityManager ( ) == null ) { logger . debug ( "Creating RMI Security Manager..." ) ; System . setSecurityManager ( new RMISecurityManager ( ) ) ; } logger . debug ( "Creating Config Store factory..." ) ; IConfigStoreFactory cfgStoreFactory = new ConfigStoreFactory ( ) ; logger . debug ( "Creating Identity Provider factory..." ) ; IProviderFactory providerFactory = new ProviderFactory ( ) ; logger . debug ( "Checking VMware Directory Service..." ) ; ServerUtils . check_directory_service ( ) ; logger . debug ( "Setting system properties..." ) ; System . setProperties ( new ThreadLocalProperties ( System . getProperties ( ) ) ) ; logger . debug ( "Creating Identity Manager instance..." ) ; manager = new IdentityManager ( cfgStoreFactory , providerFactory ) ; String rmiAddress = String . format ( "rmi://localhost:%d/%s" , Tenant . RMI_PORT , IDENTITY_MANAGER_BIND_NAME ) ; logger . debug ( "Binding to RMI address '{}'" , rmiAddress ) ; loginManager = new IdmLoginManager ( manager ) ; ILoginManager stub = ( ILoginManager ) UnicastRemoteObject . exportObject ( loginManager , 0 ) ; Naming . rebind ( rmiAddress , stub ) ; startHeartbeat ( ) ; logger . info ( VmEvent . SERVER_STARTED , "IDM Server has started" ) ; } catch ( Throwable t ) { logger . error ( VmEvent . SERVER_FAILED_TOSTART , "IDM Server has failed to start" , t ) ; throw t ; } }
initialize the idm service .
