Package jcmdline

Examples of jcmdline.FileParam


   
    SlideShowParsedCommand parsedCommandDTO = new SlideShowParsedCommand();
   
    if(cmdLineHandler != null){
      //-o
      FileParam oOption = (FileParam) cmdLineHandler.getOption(SlideShowParsedCommand.O_ARG);
      if ((oOption.isSet())){
              File outFile = oOption.getFile();
              ValidationUtility.assertValidDirectory(outFile);
              parsedCommandDTO.setOutputFile(outFile);           
          }else{
            throw new ParseException(ParseException.ERR_NO_O);
          }
      //-p
          StringParam pOption = (StringParam) cmdLineHandler.getOption(SlideShowParsedCommand.P_ARG);
          if(pOption.isSet()){
            parsedCommandDTO.setOutputFilesPrefix(pOption.getValue());
          }

          //-f
          PdfFileParam fOption = (PdfFileParam) cmdLineHandler.getOption(SlideShowParsedCommand.F_ARG);          
          if(fOption.isSet()){
            PdfFile inputFile = fOption.getPdfFile();
            ValidationUtility.assertValidPdfExtension(inputFile.getFile().getName())
              parsedCommandDTO.setInputFile(FileUtility.getPdfFile(inputFile));                 
          }else{
            throw new ParseException(ParseException.ERR_NO_F)
          }
         
          //-t
          StringParam tOption = (StringParam) cmdLineHandler.getOption(SlideShowParsedCommand.T_ARG);
          if(tOption.isSet()){
            HashSet transitionsList = new HashSet(tOption.getValues().size());
            for(Iterator tIterator = tOption.getValues().iterator(); tIterator.hasNext();){
              String transition = (String) tIterator.next();
              Transition transitionObject = stringToTransition(transition);
              if(!transitionsList.add(transitionObject)){
                throw new SlideShowException(SlideShowException.UNABLE_TO_ADD_TRANSITION, new String[]{transition,transitionObject.toString()});
              }
            }
            parsedCommandDTO.setTransitions((Transition[])transitionsList.toArray(new Transition[transitionsList.size()]));
          }
         
          //-dt
          StringParam dtOption = (StringParam) cmdLineHandler.getOption(SlideShowParsedCommand.DT_ARG);
          if(dtOption.isSet()){
            parsedCommandDTO.setDefaultTransition(stringToTransition(dtOption.getValue()));
          }
         
          //-l
          FileParam lOption = (FileParam) cmdLineHandler.getOption(SlideShowParsedCommand.L_ARG);
          if(lOption.isSet()){
            if(lOption.getFile().getPath().toLowerCase().endsWith(XML_EXTENSION)){
          parsedCommandDTO.setInputXmlFile(lOption.getFile());
        }else{
          throw new ParseException(ParseException.ERR_NOT_XML);
        }
          }
         
View Full Code Here


   
    RotateParsedCommand parsedCommandDTO = new RotateParsedCommand();
   
    if(cmdLineHandler != null){
      //-o
      FileParam oOption = (FileParam) cmdLineHandler.getOption(RotateParsedCommand.O_ARG);
      if ((oOption.isSet())){
              File outFile = oOption.getFile();
              ValidationUtility.assertValidDirectory(outFile);
              parsedCommandDTO.setOutputFile(outFile);           
          }else{
            throw new ParseException(ParseException.ERR_NO_O);
          }
View Full Code Here

     
      SetViewerParsedCommand parsedCommandDTO = new SetViewerParsedCommand();
     
      if(cmdLineHandler != null){
        //-o
        FileParam oOption = (FileParam) cmdLineHandler.getOption(SetViewerParsedCommand.O_ARG);
        if ((oOption.isSet())){
                File outFile = oOption.getFile();
                ValidationUtility.assertValidDirectory(outFile);
                parsedCommandDTO.setOutputFile(outFile);             
            }else{
              throw new ParseException(ParseException.ERR_NO_O);
            }
       
        //-p
            StringParam pOption = (StringParam) cmdLineHandler.getOption(SetViewerParsedCommand.P_ARG);
            if(pOption.isSet()){
              parsedCommandDTO.setOutputFilesPrefix(pOption.getValue());
            }
           
        //-mode
            StringParam mOption = (StringParam) cmdLineHandler.getOption(SetViewerParsedCommand.M_ARG);
            if(mOption.isSet()){
              parsedCommandDTO.setMode(getMode(mOption.getValue()));        
            }
        //-layout
            StringParam lOption = (StringParam) cmdLineHandler.getOption(SetViewerParsedCommand.L_ARG);
            if(lOption.isSet()){
              parsedCommandDTO.setLayout(getLayout(lOption.getValue()));        
            }
           
        //-nfsmode
            StringParam nfsmOption = (StringParam) cmdLineHandler.getOption(SetViewerParsedCommand.NFSM_ARG);         
            if(nfsmOption.isSet()){
              parsedCommandDTO.setNfsmode(getNFSMode(nfsmOption.getValue()));
            }
           
        //-direction
            StringParam directionOption = (StringParam) cmdLineHandler.getOption(SetViewerParsedCommand.DIRECTION_ARG);
            if(directionOption.isSet()){
              parsedCommandDTO.setDirection(getDirection(directionOption.getValue()));
            }
           
         //-f -d
        PdfFileParam fOption = (PdfFileParam) cmdLineHandler.getOption(SetViewerParsedCommand.F_ARG);
        FileParam dOption = (FileParam) cmdLineHandler.getOption(SetViewerParsedCommand.D_ARG);
        if(fOption.isSet() || dOption.isSet()){
          //-f
              if(fOption.isSet()){
            //validate file extensions
                for(Iterator fIterator = fOption.getPdfFiles().iterator(); fIterator.hasNext();){
                  PdfFile currentFile = (PdfFile) fIterator.next();
                  ValidationUtility.assertValidPdfExtension(currentFile.getFile().getName());                 
                }
                parsedCommandDTO.setInputFileList(FileUtility.getPdfFiles(fOption.getPdfFiles()));
              }
              //-d
          if ((dOption.isSet())){
                  File inputDir = dOption.getFile();
                  ValidationUtility.assertValidDirectory(inputDir);
                  parsedCommandDTO.setInputDirectory(inputDir);               
              }           
        }else{
          throw new ParseException(ParseException.ERR_NO_F_OR_D);
View Full Code Here

   
    DecryptParsedCommand parsedCommandDTO = new DecryptParsedCommand();
   
    if(cmdLineHandler != null){
      //-o
      FileParam oOption = (FileParam) cmdLineHandler.getOption(DecryptParsedCommand.O_ARG);
      if ((oOption.isSet())){
              File outFile = oOption.getFile();
              ValidationUtility.assertValidDirectory(outFile);
              parsedCommandDTO.setOutputFile(outFile);           
          }else{
            throw new ParseException(ParseException.ERR_NO_O);
          }
View Full Code Here

   
    UnpackParsedCommand parsedCommandDTO = new UnpackParsedCommand();
   
    if(cmdLineHandler != null){ 
      //-o
      FileParam oOption = (FileParam) cmdLineHandler.getOption(UnpackParsedCommand.O_ARG);
      if ((oOption.isSet())){
              File outFile = oOption.getFile();
              ValidationUtility.assertValidDirectory(outFile);
              parsedCommandDTO.setOutputFile(outFile)
          }else{
            throw new ParseException(ParseException.ERR_NO_O);
          }
     
      //-f and -d
      PdfFileParam fOption = (PdfFileParam) cmdLineHandler.getOption(UnpackParsedCommand.F_ARG);
          FileParam dOption = (FileParam) cmdLineHandler.getOption(UnpackParsedCommand.D_ARG);
      if (fOption.isSet() || dOption.isSet()) {
        // -f
        if (fOption.isSet()) {
          // validate file extensions
          for (Iterator fIterator = fOption.getPdfFiles().iterator(); fIterator.hasNext();) {
            PdfFile currentFile = (PdfFile) fIterator.next();
            ValidationUtility.assertValidPdfExtension(currentFile.getFile().getName());           
          }
          parsedCommandDTO.setInputFileList(FileUtility.getPdfFiles(fOption.getPdfFiles()));
        }
        // -d
        if ((dOption.isSet())) {
          File inputDir = dOption.getFile();
          ValidationUtility.assertValidDirectory(inputDir);
          parsedCommandDTO.setInputDirectory(inputDir);
        }
      } else {
        throw new ParseException(ParseException.ERR_NO_F_OR_D);
View Full Code Here

   
    SplitParsedCommand parsedCommandDTO = new SplitParsedCommand();
   
    if(cmdLineHandler != null){
      //-o
      FileParam oOption = (FileParam) cmdLineHandler.getOption(SplitParsedCommand.O_ARG);
      if ((oOption.isSet())){
              File outFile = oOption.getFile();
              ValidationUtility.assertValidDirectory(outFile);
              parsedCommandDTO.setOutputFile(outFile);           
          }else{
            throw new ParseException(ParseException.ERR_NO_O);
          }
View Full Code Here

   
    PageLabelsParsedCommand parsedCommandDTO = new PageLabelsParsedCommand();
   
    if(cmdLineHandler != null){
      //-o
      FileParam oOption = (FileParam) cmdLineHandler.getOption(PageLabelsParsedCommand.O_ARG);
      if ((oOption.isSet())){
              File outFile = oOption.getFile();
              //checking extension
              ValidationUtility.assertValidPdfExtension(outFile.getName());
              parsedCommandDTO.setOutputFile(outFile)
          }else{
            throw new ParseException(ParseException.ERR_NO_O);
View Full Code Here

    DocumentInfoParsedCommand parsedCommandDTO = new DocumentInfoParsedCommand();

    if (cmdLineHandler != null) {
      // -o
      FileParam oOption = (FileParam) cmdLineHandler.getOption(DocumentInfoParsedCommand.O_ARG);
      if ((oOption.isSet())) {
        File outFile = oOption.getFile();
        // checking extension
        ValidationUtility.assertValidPdfExtension(outFile.getName());
        parsedCommandDTO.setOutputFile(outFile);

      } else {
View Full Code Here

   
    MixParsedCommand parsedCommandDTO = new MixParsedCommand();
   
    if(cmdLineHandler != null){
      //-o
      FileParam oOption = (FileParam) cmdLineHandler.getOption(MixParsedCommand.O_ARG);
          if ((oOption.isSet())){
              File outFile = oOption.getFile();
              //checking extension
              ValidationUtility.assertValidPdfExtension(outFile.getName());
              parsedCommandDTO.setOutputFile(outFile)
         
          }else{
View Full Code Here

   
    EncryptParsedCommand parsedCommandDTO = new EncryptParsedCommand();
   
    if(cmdLineHandler != null){
      //-o
      FileParam oOption = (FileParam) cmdLineHandler.getOption(EncryptParsedCommand.O_ARG);
      if ((oOption.isSet())){
              File outFile = oOption.getFile();
              ValidationUtility.assertValidDirectory(outFile);
              parsedCommandDTO.setOutputFile(outFile);           
          }else{
            throw new ParseException(ParseException.ERR_NO_O);
          }
     
      //-p
          StringParam pOption = (StringParam) cmdLineHandler.getOption(EncryptParsedCommand.P_ARG);
          if(pOption.isSet()){
            parsedCommandDTO.setOutputFilesPrefix(pOption.getValue());
          }
         
          //-apwd
          StringParam apwdOption = (StringParam) cmdLineHandler.getOption(EncryptParsedCommand.APWD_ARG);
          if(apwdOption.isSet()){
            parsedCommandDTO.setOwnerPwd(apwdOption.getValue());
          }
         
          //-upwd
          StringParam upwdOption = (StringParam) cmdLineHandler.getOption(EncryptParsedCommand.UPWD_ARG);
          if(upwdOption.isSet()){
            parsedCommandDTO.setUserPwd(upwdOption.getValue());
          }
         
          //-etype
          StringParam etypeOption = (StringParam) cmdLineHandler.getOption(EncryptParsedCommand.ETYPE_ARG);
          if(etypeOption.isSet()){
            parsedCommandDTO.setEncryptionType(etypeOption.getValue());
          }
         
          //-f - d
      PdfFileParam fOption = (PdfFileParam) cmdLineHandler.getOption(EncryptParsedCommand.F_ARG);
      FileParam dOption = (FileParam) cmdLineHandler.getOption(EncryptParsedCommand.D_ARG);
      if(fOption.isSet() || dOption.isSet()){
        //-f
            if(fOption.isSet()){
          //validate file extensions
              for(Iterator fIterator = fOption.getPdfFiles().iterator(); fIterator.hasNext();){
                PdfFile currentFile = (PdfFile) fIterator.next();
                ValidationUtility.assertValidPdfExtension(currentFile.getFile().getName());             
              }
              parsedCommandDTO.setInputFileList(FileUtility.getPdfFiles(fOption.getPdfFiles()));
            }
            //-d
        if ((dOption.isSet())){
                File inputDir = dOption.getFile();
                ValidationUtility.assertValidDirectory(inputDir);
                parsedCommandDTO.setInputDirectory(inputDir)
            }
      }else{
        throw new ParseException(ParseException.ERR_NO_F_OR_D);
View Full Code Here

TOP

Related Classes of jcmdline.FileParam

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.