Package org.apache.tools.ant.types

Examples of org.apache.tools.ant.types.FilterChain


     */
    protected final void prepare(String theResourcePrefix, String theDirName)
        throws IOException
    {
        FileUtils fileUtils = FileUtils.newFileUtils();
        FilterChain filterChain = createFilterChain();

        this.tmpDir = setupTempDirectory(this.tmpDir, theDirName);
        cleanTempDirectory(this.tmpDir);

        // Copy configuration files into the temporary container directory
View Full Code Here


        final Vector<Object> finalFilters = new Vector<Object>();
        final ArrayList<AntClassLoader> classLoadersToCleanUp =
            new ArrayList<AntClassLoader>();

        for (int i = 0; i < filterReadersCount; i++) {
            final FilterChain filterchain =
                filterChains.elementAt(i);
            final Vector<Object> filterReaders = filterchain.getFilterReaders();
            final int readerCount = filterReaders.size();
            for (int j = 0; j < readerCount; j++) {
                finalFilters.addElement(filterReaders.elementAt(j));
            }
        }
View Full Code Here

        beginExecution();

        //patch the redirector to save output to a file
        RedirectorElement redirector = getRedirector();
        redirector.setAlwaysLog(true);
        FilterChain outputFilterChain = redirector.createOutputFilterChain();
        outputFilterChain.add(outputCache);

        try {
            Path sources = createUnifiedSourcePath();
            for (Resource r : sources) {
                FileProvider fr = r.as(FileProvider.class);
View Full Code Here

        File srcFile = new File(srcDir, file);
        long lastModified = srcFile.lastModified();
        File destD = destDir == null ? srcDir : destDir;

        if (fcv == null) {
            FilterChain fc = new FilterChain();
            fc.add(filter);
            fcv = new Vector<FilterChain>(1);
            fcv.add(fc);
        }
        File tmpFile = FILE_UTILS.createTempFile("fixcrlf", "", null, true, true);
        try {
View Full Code Here

    /**
     * Add a FilterChain.
     * @return a filter chain object.
     */
    public FilterChain createFilterChain() {
        FilterChain filterChain = new FilterChain();
        filterChains.addElement(filterChain);
        return filterChain;
    }
View Full Code Here

            assertEquals("You must not specify nested elements when using refid",
                         be.getMessage());
        }

        rl = new ResourceList();
        rl.addFilterChain(new FilterChain());
        try {
            rl.setRefid(new Reference(buildRule.getProject(), "dummyref"));
            fail("Can add reference to ResourceList with nested filter chain.");
        } catch (BuildException be) {
            assertEquals("You must not specify nested elements when using refid",
                         be.getMessage());
        }

        rl = new ResourceList();
        rl.setRefid(new Reference(buildRule.getProject(), "dummyref"));
        try {
            rl.addFilterChain(new FilterChain());
            fail("Can add reference to ResourceList with nested filter chain.");
        } catch (BuildException be) {
            assertEquals("You must not specify nested elements when using refid",
                         be.getMessage());
        }
View Full Code Here

    }

    private void configureConcat() {
        concat.setProject(getProject());
        concat.setTaskName(getTaskName());
        FilterChain filterChain = new FilterChain();
        LineContainsRegExp lcre = new LineContainsRegExp();
        RegularExpression regexp = new RegularExpression();
        regexp.setPattern("^import .+;");
        lcre.addConfiguredRegexp(regexp);
        filterChain.add(lcre);
        TokenFilter tf = new TokenFilter();
        TokenFilter.ReplaceRegex rre = new TokenFilter.ReplaceRegex();
        rre.setPattern("import (.+);.*");
        rre.setReplace("\\1");
        tf.add(rre);
        filterChain.add(tf);
        concat.addFilterChain(filterChain);
    }
View Full Code Here

        // Note that we needed to add a last character to the string
        // after the @cactus.context@ token as otherwise the Ant code
        // fails! It looks like an Ant bug to me...      
        String buffer = "@cactus.port@:@cactus.context@:";
                       
        FilterChain chain = this.container.createFilterChain();       

        ChainReaderHelper helper = new ChainReaderHelper();
        Vector chains = new Vector();
        chains.addElement(chain);
        helper.setFilterChains(chains);
View Full Code Here

     * @return The default filter chain
     */
    protected final FilterChain createFilterChain()
    {
        ReplaceTokens.Token token = null;
        FilterChain filterChain = new FilterChain();

        // Token for the cactus port
        ReplaceTokens replacePort = new ReplaceTokens();
        token = new ReplaceTokens.Token();
        token.setKey("cactus.port");
        token.setValue(String.valueOf(getPort()));
        replacePort.addConfiguredToken(token);
        filterChain.addReplaceTokens(replacePort);

        // Token for the cactus webapp context
        ReplaceTokens replaceContext = new ReplaceTokens();
        token = new ReplaceTokens.Token();
        token.setKey("cactus.context");
        token.setValue(getDeployableFile().getTestContext());
        replaceContext.addConfiguredToken(token);
        filterChain.addReplaceTokens(replaceContext);

        return filterChain;
    }
View Full Code Here

     *        directory
     * @throws IOException If an I/O error occurs
     */
    private void prepare(String theDirName) throws IOException
    {
        FilterChain filterChain = createFilterChain();
       
        if (this.tmpDir == null)
        {
            this.tmpDir = createTempDirectory(theDirName);
        }
View Full Code Here

TOP

Related Classes of org.apache.tools.ant.types.FilterChain

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.