Examples of CannotPrepareSystemException


Examples of it.unina.seclab.jafimon.exceptions.CannotPrepareSystemException

  private void restoreScript(String bakFileName, String origFileName) throws CannotPrepareSystemException {
    File bakFile = new File(bakFileName);
    File origFile = new File(origFileName);
    if (! bakFile.renameTo(origFile)) {
      logger.error("Unable to rstore " + bakFileName);
      throw new CannotPrepareSystemException(sysName, "Unable to restore " + bakFileName);
    }
  }
View Full Code Here

Examples of it.unina.seclab.jafimon.exceptions.CannotPrepareSystemException

      catalinaHome = SystemEnvironmentVariables.getEnvironmentVariable("CATALINA_HOME");
      logger.debug("\"CATALINA_HOME\" = " + catalinaHome);
     
    } catch (IOException e) {
      logger.error("Unable to prepare " + sysName + " system. Error message is \"" + e.getLocalizedMessage() + "\"");
      throw new CannotPrepareSystemException(sysName, e.getLocalizedMessage());
    }
    catalina_sh_name = catalinaHome + File.separator + scriptName;

    // Verifico l'esistenza e la possibilita' di leggere e scrivere
    catalina_file = new File(catalina_sh_name);
    if (! catalina_file.exists()) {
      logger.error("File \"" + catalina_sh_name + "\" non exists. Unable to proceed.");
      throw new CannotPrepareSystemException(sysName, "File \"" + catalina_sh_name + "\" non exists. Unable to proceed.");
    } else if (! catalina_file.canRead()) {
          logger.error("Can't read \"" + catalina_sh_name + "\". Unable to proceed.");
          throw new CannotPrepareSystemException(sysName, "Can't read \"" + catalina_sh_name + "\". Unable to proceed.");
    } else if (! catalina_file.canWrite()) {
          logger.error("Can't write to \"" + catalina_sh_name + "\". Unable to proceed.");
          throw new CannotPrepareSystemException(sysName, "Can't write to \"" + catalina_sh_name + "\". Unable to proceed.");
    }
   
    // Ora modifico il file
    try {
      File catalinaBak_file = new File(catalina_sh_name + ".BAK");
      if (! catalina_file.renameTo(catalinaBak_file)) {
        logger.error("Unable to rename " + catalina_sh_name);
        throw new CannotPrepareSystemException(sysName, "Unable to rename " + catalina_sh_name);
      }
      modifyScript(catalinaBak_file,catalina_file,cfg,dataMgr);
      changePermissions(catalina_file);

    } catch (IOException e) {
      logger.error("Unable to prepare " + sysName + " system. Error message is \"" + e.getLocalizedMessage() + "\"");
      throw new CannotPrepareSystemException(sysName, e.getLocalizedMessage());
    }
   
    logger.trace("Physical Activator for Tomca5 has prepared the system");

    catalina_file = null;
View Full Code Here

Examples of it.unina.seclab.jafimon.exceptions.CannotPrepareSystemException

      FileTools.toFile(contextFile, new StringBuffer(contextXml));
      cfg.save(axisHome + "/META-INF");
     
    } catch (IOException e) {
      logger.error("Unable to prepare " + sysName + " system. Error message is \"" + e.getLocalizedMessage() + "\"");
      throw new CannotPrepareSystemException(sysName, e.getLocalizedMessage());
    } catch (CannotWriteFileException e) {
      logger.error("Unable to prepare " + sysName + " system. Error message is \"" + e.getLocalizedMessage() + "\"");
      throw new CannotPrepareSystemException(sysName, e.getLocalizedMessage());
    } catch (GenericConfigurationTrasformException e) {
      logger.error("Unable to prepare " + sysName + " system. Error message is \"" + e.getLocalizedMessage() + "\"");
      throw new CannotPrepareSystemException(sysName, e.getLocalizedMessage());
    }
   
  }
View Full Code Here

Examples of it.unina.seclab.jafimon.exceptions.CannotPrepareSystemException

  public void restoreSystem(Configuration cfg, MonitoredDataManager dataMg)
      throws CannotPrepareSystemException {
   
    if (!contextFile.delete()) {
      logger.error("Unable to restore " + sysName + " system. Unable to delete context.xml");
      throw new CannotPrepareSystemException(sysName,"Unable to restore " + sysName + " system. Unable to delete context.xml");
    }
   
    String baseName = axisHome + "/META-INF", fileName;
    File f = new File(baseName + File.separator + cfg.getName());
   
    try {
      fileName = f.getCanonicalPath();
      fileName = fileName.substring(fileName.lastIndexOf(File.separator), fileName.length());
      while (! fileName.equalsIgnoreCase("/META-INF")) {
        logger.info("Deleting \"" + f.getCanonicalPath() + "\"");
        if (!f.delete()) {
          throw new IOException("Unable to delete \"" + f.getCanonicalPath() + "\"");
        }
        f = new File(f.getCanonicalPath().substring(0, f.getCanonicalPath().lastIndexOf(File.separator)));
        fileName = f.getCanonicalPath();
        fileName = fileName.substring(fileName.lastIndexOf(File.separator), fileName.length());
      }
    } catch (IOException e) {
      logger.error("Unable to restore " + sysName + " system. " + e.getLocalizedMessage());
      throw new CannotPrepareSystemException(sysName,"Unable to restore " + sysName + " system. " + e.getLocalizedMessage());
    }
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.