コード例 #1
0
  /**
   * starts various services configured according to the configuration present in the given
   * instance's layout
   *
   * @param instanceLayout the on disk location's layout of the intance to be started
   * @throws Exception
   */
  public void start(InstanceLayout instanceLayout, CacheService cacheService) throws Exception {
    File partitionsDir = instanceLayout.getPartitionsDirectory();

    if (!partitionsDir.exists()) {
      LOG.info("partition directory doesn't exist, creating {}", partitionsDir.getAbsolutePath());
      if (!partitionsDir.mkdirs()) {
        throw new IOException(I18n.err(I18n.ERR_112_COULD_NOT_CREATE_DIRECORY, partitionsDir));
      }
    }

    LOG.info("using partition dir {}", partitionsDir.getAbsolutePath());

    initSchemaManager(instanceLayout);
    initSchemaLdifPartition(instanceLayout);
    initConfigPartition(instanceLayout);

    // Read the configuration
    cpReader = new ConfigPartitionReader(configPartition);

    ConfigBean configBean = cpReader.readConfig();

    DirectoryServiceBean directoryServiceBean = configBean.getDirectoryServiceBean();

    // Initialize the DirectoryService now
    DirectoryService directoryService =
        initDirectoryService(instanceLayout, directoryServiceBean, cacheService);

    // start the LDAP server
    startLdap(directoryServiceBean.getLdapServerBean(), directoryService);

    // start the NTP server
    startNtp(directoryServiceBean.getNtpServerBean(), directoryService);

    // Initialize the DNS server (Not ready yet)
    // initDns( configBean );

    // Initialize the DHCP server (Not ready yet)
    // initDhcp( configBean );

    // start the ChangePwd server (Not ready yet)
    // startChangePwd( directoryServiceBean.getChangePasswordServerBean(), directoryService );

    // start the Kerberos server
    startKerberos(directoryServiceBean.getKdcServerBean(), directoryService);

    // start the jetty http server
    // startHttpServer( directoryServiceBean.getHttpServerBean(), directoryService );
  }