Package com.sun.enterprise.cli.framework

Examples of com.sun.enterprise.cli.framework.CommandValidationException


    {
        super.validateOptions();

        //verify adminpassword is greater than 8 characters 
        if (!isPasswordValid(newMasterPassword)) {
            throw new CommandValidationException(getLocalizedString("PasswordLimit",
                new Object[]{NEW_MASTER_PASSWORD}));
        }
               
        return true;
    }
View Full Code Here


    command = CmdType.valueOf(cmd);
   
    if(command == null)
    {
      // This shouldn't happen unless somebody erred editing CLIDescriptor.xml
      throw new CommandValidationException(
        getLocalizedString("NoUsageText", new String[] {cmd}) );
    }
  }
View Full Code Here

    {
      domainName = getDomainName();
    }
    catch(CommandException ce)
    {
      throw new CommandValidationException(ce);
    }
    //domainName = (String)operands.firstElement();
  }
View Full Code Here

      verbose = true;
   
    // it is an error for both to be true (duh!)
   
    if(verbose && terse)
      throw new CommandValidationException(getLocalizedString("NoVerboseAndTerseAtTheSameTime"));
  }
View Full Code Here

    // disallow backup & restore if server is running.  list-backups is OK anytime...
    if(command == CmdType.BACKUP || command == CmdType.RESTORE)
    {
      if(!isNotRunning())
      {
        throw new CommandValidationException(getLocalizedString("DomainIsNotStopped",
          new String[] {command.name} ));
      }
    }
    // make sure we have a domainsDir
    if(domainsDir == null || domainsDir.length() <= 0)
    {
      throw new CommandValidationException(getLocalizedString("InvalidDomainPath",
        new String[] {domainsDir}) );
    }

    File domainsDirFile = new File(domainsDir);

    // make sure domainsDir exists and is a directory
    if(!domainsDirFile.isDirectory())
    {
      throw new CommandValidationException(getLocalizedString("InvalidDomainPath",
        new String[] {domainsDir}) );
    }

    File domainFile = new File(domainsDirFile, domainName);

    // BACKUP, LIST: make sure the domain dir exists and is
    //              a directory and is writable
    // RESTORE: It must exist if backupFilename isn't set.
    boolean domainDirDoesNotHaveToExist =
      (command == CmdType.RESTORE) && backupFilename != null;
             
    if(!domainDirDoesNotHaveToExist)
    {
      if(!domainFile.isDirectory() || !domainFile.canWrite())
      {
        throw new CommandValidationException(getLocalizedString("InvalidDirectory",
          new String[] {domainFile.getPath()}) );
      }
    }
   
    if(backupFilename != null)
    {
      File f = new File(backupFilename);
     
      if(!f.exists() || !f.canRead())
      {
        throw new CommandValidationException(getLocalizedString("FileDoesNotExist",
          new String[] { backupFilename } ));
      }
    }
  }
View Full Code Here

      return state == Status.kInstanceNotRunningCode;
    }
    catch(Exception e)
    {
      throw new CommandValidationException(e);
    }
  }
View Full Code Here

        }
        if (found) {
            return option;
        }
        else {
            throw new CommandValidationException(getLocalizedString("InvalidValueInOption",
                                                    new Object[]{optionName}));
        }
    }
View Full Code Here

        {
            Integer.parseInt(port);
        }
        catch(Exception e)
        {
            throw new CommandValidationException(getLocalizedString("InvalidPortNumber", new Object[] {port}));
        }
    }
View Full Code Here

            final int portbase = convertPortStr(getOption(PORTBASE_OPTION));
            setOptionsWithPortBase(portbase);
        }
        else if (getOption(ADMIN_PORT)==null)
        {
            throw new CommandValidationException(getLocalizedString("RequireEitherOrOption",
                                                                     new Object[]{ADMIN_PORT,
                                                                                  PORTBASE_OPTION}
                                                                    ));
        }
    }
View Full Code Here

    /* validates adminpassword and masterpassword */
    public void validatePasswords() throws CommandValidationException
    {
        //verify adminpassword is greater than 8 characters 
        if (!isPasswordValid(adminPassword)) {
            throw new CommandValidationException(getLocalizedString("PasswordLimit",
                new Object[]{ADMIN_PASSWORD}));
        }
       
        //verify masterpassword is greater than 8 characters
        if (!isPasswordValid(masterPassword)) {
            throw new CommandValidationException(getLocalizedString("PasswordLimit",
                new Object[]{MASTER_PASSWORD}));
        }

        //verify that domainName is valid
        CLILogger.getInstance().printDebugMessage("domainName = " + domainName);
View Full Code Here

TOP

Related Classes of com.sun.enterprise.cli.framework.CommandValidationException

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.