Package org.apache.tools.ant.taskdefs.XSLTProcess

Examples of org.apache.tools.ant.taskdefs.XSLTProcess.Param


  /**
   * Create an instance of an XSL parameter for configuration by Ant.
   * @return an instance of the <code>Param</code> class to be configured.
   */
  @Override public Param createParam() {
    Param p = new Param();
    params.add(p);
    return p;
  }
View Full Code Here


    tempFileTask.execute();
  }

  private void createNewParams(XSLTProcess xsltTask) {
    for (Param param : params) {
      Param p = xsltTask.createParam();
      p.setProject(task.getProject());
      p.setName(param.getName());
      p.setExpression(param.getExpression());
    }
  }
View Full Code Here

      p.setExpression(param.getExpression());
    }
  }

  private void createOutputDirParam(XSLTProcess xsltTask) {
    Param p = xsltTask.createParam();
    p.setProject(task.getProject());
    p.setName("output.dir");
    p.setExpression(toDir.getAbsolutePath());
  }
View Full Code Here

         try
         {
            if (m_keystoreFile != null)
            {
               boolean bHasKeyStore = false;
               Param param = null;

               if (m_paramList != null)
               {
                  for (Iterator paramItr = m_paramList.iterator(); paramItr.hasNext();)
                  {
                     param = (Param)paramItr.next();

                     if (param.getName().equals("clusterKeyStore") && param.shouldUse())
                     {
                        bHasKeyStore = true;

                        break;
                     }
                  }
               }
              
               if (!bHasKeyStore)
               {
                  param = new Param();
                  fis = new BufferedInputStream(new FileInputStream(m_keystoreFile));

                  ByteArrayOutputStream dataStream = new ByteArrayOutputStream();

                  IOUtil.copy(dataStream, fis);
                  param.setName("clusterKeyStore");
                  param.setExpression(Base64Util.encode(dataStream.toByteArray()));
                  addConfiguredParam(param);

                  IOUtil.close(fis);
               }
            }

            fis = new BufferedInputStream(new FileInputStream(m_propFile));
            encReader = new InputStreamReader(fis, "UTF-8");

            Object cipher = dispatcher.create(encReader);
            Reader decReader = null;

            if (cipher instanceof CharacterStreamCipher)
            {
               decReader = ((CharacterStreamCipher)cipher).createDecryptedReader(encReader);
            }
            else
            {
               IOUtil.close(encReader);
               IOUtil.close(fis);
               fis = null;

               encReader = new StringReader((String)cipher);
               decReader = encReader;
               cipher = dispatcher;

               // The file was not encrypted at all
               props.setProperty("cipher.scheme",
                  props.getProperty("cipher.scheme", CharacterStreamCipherDispatcher.SCHEME_TEXT));
               dispatcher.init(props);
            }

            // Read from disk, applying XSLT transformation if necessary
            Document doc;

            if (m_styleFile != null)
            {
               TransformerFactory factory = (TransformerFactory)Class.forName(
               "org.apache.xalan.processor.TransformerFactoryImpl").newInstance();

               FileInputStream styleStream = new FileInputStream(m_styleFile);
               Transformer transformer = factory.newTransformer(new StreamSource(styleStream));

               // Read and set the transformation parameters
               if (m_paramList != null)
               {
                  for (int i = 0; i < m_paramList.size(); i++)
                  {
                     XSLTProcess.Param param = (XSLTProcess.Param)m_paramList.get(i);

                     if (param.shouldUse())
                     {
                        transformer.setParameter(param.getName(), param.getExpression());
                     }
                  }
               }

               Source source = new StreamSource(decReader);
View Full Code Here

TOP

Related Classes of org.apache.tools.ant.taskdefs.XSLTProcess.Param

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.