Package org.nasutekds.quicksetup.util

Examples of org.nasutekds.quicksetup.util.InProcessServerController$ServerControllerTextWriter


   *         altogether or an LDIFException or IOException should other
   *         problems occur.
   */
  private void modify(File ldifFile, Component component)
          throws Exception {
    InProcessServerController ipsc =
            new InProcessServerController(installation);
    LDIFImportConfig importCfg =
            new LDIFImportConfig(
                    Utils.getPath(ldifFile));
    LDIFReader ldifReader =
            new LDIFReader(importCfg);
    ArrayList<ChangeRecordEntry> remainingChanges =
      new ArrayList<ChangeRecordEntry>();
    ChangeRecordEntry o = ldifReader.readChangeRecord(false);
    while (o != null)
    {
      remainingChanges.add(o);
      o = ldifReader.readChangeRecord(false);
    }
    ArrayList<ChangeRecordEntry> appliedChanges =
      new ArrayList<ChangeRecordEntry>();
    // In the particular case of the schema, the order on which the
    // the modifications are applied is important.  That is why we retry
    // until no modification works.
    while (remainingChanges.size() > 0)
    {
      Exception firstException = null;
      appliedChanges.clear();
      for (ChangeRecordEntry cre : remainingChanges)
      {
        try {
          ipsc.modify(cre);
          appliedChanges.add(cre);
        } catch (Exception e) {
          if (firstException == null)
          {
            firstException = e;
View Full Code Here


    try {
      ServerController control = new ServerController(getInstallation());
      if (getInstallation().getStatus().isServerRunning()) {
        control.stopServer(true);
      }
      InProcessServerController ipsc =
              new InProcessServerController(getInstallation());
      InProcessServerController.disableConnectionHandlers(true);
      ipsc.startServer();
    } catch (Throwable t) {
      Message msg = INFO_ERROR_STARTING_SERVER_WITH_NO_CONNECTION_HANDLERS.get(
              (t.getMessage() == null) ? t.toString() : t.getMessage());
      LOG.log(Level.INFO, msg.toString(), t);
      throw new ApplicationException(
View Full Code Here

              migration.isConfigurationCustomized()) {
        try {
          LOG.log(Level.INFO, "starting server");
          setCurrentProgressStep(
                  UpgradeProgressStep.PREPARING_CUSTOMIZATIONS);
          InProcessServerController ipsc =
                  new InProcessServerController(getInstallation());
          InProcessServerController.disableConnectionHandlers(true);
          InProcessServerController.disableAdminDataSynchronization(true);
          InProcessServerController.disableSynchronization(true);
          ipsc.startServer();
          LOG.log(Level.INFO, "start server finished");
          notifyListeners(getFormattedDoneWithLineBreak());
        } catch (Exception e) {
          LOG.log(Level.INFO,
                  "Error starting server in order to apply custom" +
                          "schema and/or configuration", e);
          throw new ApplicationException(
              ReturnCode.APPLICATION_ERROR,
              INFO_ERROR_STARTING_SERVER.get(), e);
        }

        checkAbort();

        if (migration.isSchemaCustomized()) {
          try {
            LOG.log(Level.INFO, "Applying schema customizations");
            setCurrentProgressStep(
                    UpgradeProgressStep.APPLYING_SCHEMA_CUSTOMIZATIONS);
            migration.migrateSchema();
            notifyListeners(getFormattedDoneWithLineBreak());
            LOG.log(Level.INFO, "custom schema application finished");
          } catch (ApplicationException e) {
            LOG.log(Level.INFO,
                    "Error applying schema customizations", e);
            throw e;
          }
        }

        checkAbort();

        if (migration.isConfigurationCustomized()) {
          try {
            LOG.log(Level.INFO, "Applying config customizations");
            setCurrentProgressStep(
                    UpgradeProgressStep.APPLYING_CONFIGURATION_CUSTOMIZATIONS);
            migration.migrateConfiguration();
            notifyListeners(getFormattedDoneWithLineBreak());
            LOG.log(Level.INFO, "custom config application finished");
          } catch (ApplicationException e) {
            LOG.log(Level.INFO,
                    "Error applying configuration customizations", e);
            throw e;
          }
        }

        checkAbort();

        if (migration.mustMigrateADS())
        {
          try {
            LOG.log(Level.INFO, "Applying registration changes");
            if (isVerbose())
            {
              setCurrentProgressStep(
                  UpgradeProgressStep.APPLYING_ADS_CUSTOMIZATIONS);
            }
            migration.migrateADS(
                getStagedInstallation().getADSBackendFile());
            if (isVerbose())
            {
              notifyListeners(getFormattedDone());
            }
            LOG.log(Level.INFO, "custom registration application finished");
          } catch (ApplicationException e) {
            LOG.log(Level.INFO,
                "Error applying registration customizations", e);
            throw e;
          }
        }

        checkAbort();

        if (migration.mustMigrateToolProperties())
        {
          try {
            LOG.log(Level.INFO, "Applying tools properties");
            migration.migrateToolPropertiesFile(
                getStagedInstallation().getToolsPropertiesFile());
            LOG.log(Level.INFO, "tools properties application finished");
          } catch (ApplicationException e) {
            LOG.log(Level.INFO,
                "Error applying tools properties changes", e);
            throw e;
          }
        }

        if (migration.mustRunDSJavaProperties())
        {
          try {
            LOG.log(Level.INFO, "Upgrading script with java properties");
//          Launch the script
            String propertiesFile = new File(
                getInstallation().getConfigurationDirectory(),
                Installation.DEFAULT_JAVA_PROPERTIES_FILE).getAbsolutePath();
            String setJavaFile =
              getInstallation().getSetJavaHomeFile().getAbsolutePath();
            String[] args =
            {
                "--propertiesFile", propertiesFile,
                "--destinationFile", setJavaFile,
                "--quiet"
            };

            int returnValue = JavaPropertiesTool.mainCLI(args);

            if ((returnValue !=
              JavaPropertiesTool.ErrorReturnCode.SUCCESSFUL.getReturnCode()) &&
              returnValue !=
              JavaPropertiesTool.ErrorReturnCode.SUCCESSFUL_NOP.getReturnCode())
            {
              throw new ApplicationException(ReturnCode.APPLICATION_ERROR,
              ERR_ERROR_CREATING_JAVA_HOME_SCRIPTS.get(returnValue), null);
            }
            LOG.log(Level.INFO, "scripts successfully upgraded");
          } catch (ApplicationException e) {
            LOG.log(Level.INFO,
                "Error upgrading scripts", e);
            throw e;
          }
        }

        checkAbort();

        try {
          LOG.log(Level.INFO, "stopping server");
          // This class imports classes from the server
          if (isVerbose())
          {
            notifyListeners(INFO_PROGRESS_UPGRADE_INTERNAL_STOP.get());
          }
          new InProcessServerController(
                  getInstallation()).stopServer();
          InProcessServerController.disableConnectionHandlers(false);
          if (isVerbose())
          {
            notifyListeners(getFormattedDone());
View Full Code Here

TOP

Related Classes of org.nasutekds.quicksetup.util.InProcessServerController$ServerControllerTextWriter

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.