Package org.apache.tools.ant.taskdefs

Examples of org.apache.tools.ant.taskdefs.Replace


        if ("hibernate".equals(daoFramework)) {
            log("Removing mapping for '" + pojoName + "' from hibernate.cfg.xml");
            String className = project.getGroupId() + ".model." + pojoName;
            Project antProject = AntUtils.createProject();
            Replace replace = (Replace) antProject.createTask("replace");
            replace.setFile(new File(hibernateCfgLocation));
            replace.setToken("    <mapping class=\"" + className + "\"/>");
            replace.execute();
        }

        log("Removal succeeded! Please run 'mvn clean' to remove any compiled classes.");
    }
View Full Code Here


        }
        componentAttr += symbolicDir+componentFile.getName();
    }
   
    protected void replace(File file, String token, String value) {
        Replace replace = new Replace();
        replace.setProject(getProject());
        replace.setFile(file);
        replace.setToken(token);
       
        replace.setValue(value);
        replace.execute();
    }
View Full Code Here

            componentAttr += algName+"/component.xml";
        }
    }
   
    protected void replace(File file, String token, String value) {
        Replace replace = new Replace();
        replace.setProject(getProject());
        replace.setFile(file);
        replace.setToken(token);
       
        replace.setValue(value);
        replace.execute();
    }
View Full Code Here

            componentAttr += algName+"/component.xml";
        }
    }
   
    protected void replace(File file, String token, String value) {
        Replace replace = new Replace();
        replace.setProject(getProject());
        replace.setFile(file);
        replace.setToken(token);
       
        replace.setValue(value);
        replace.execute();
    }
View Full Code Here

        if (existingFile.exists()) {

            parseXMLFile(existingFile, pojoName);

            // Remove tests in run-all-tests target
            Replace replace = (Replace) antProject.createTask("replace");
            replace.setFile(existingFile);
            replace.setToken("," + pojoName + "Tests");
            replace.execute();
        }
    }
View Full Code Here

    private void parseXMLFile(File existingFile, String beanName) {
        String nameInComment = beanName;
        if (beanName == null) {
            nameInComment = pojoName;
        }
        Replace replace1 = (Replace) antProject.createTask("replace");
        replace1.setFile(existingFile);
        replace1.setToken("<!--" + nameInComment + "-START-->");
        replace1.setValue("REGULAR-START");
        replace1.execute();

        Replace replace2 = (Replace) antProject.createTask("replace");
        replace2.setFile(existingFile);
        replace2.setToken("<!--" + nameInComment + "-END-->");
        replace2.setValue("REGULAR-END");
        replace2.execute();

        ReplaceRegExp regExpTask = (ReplaceRegExp) antProject.createTask("replaceregexp");
        regExpTask.setFile(existingFile);
        regExpTask.setMatch("REGULAR-START(?s:.)*REGULAR-END");
        regExpTask.setReplace("");
View Full Code Here

        String nameInComment = beanName;
        if (beanName == null) {
            nameInComment = pojoName;
        }

        Replace replace1 = (Replace) antProject.createTask("replace");
        replace1.setFile(existingFile);
        replace1.setToken("# -- " + nameInComment + "-START");
        replace1.setValue("REGULAR-START");
        replace1.execute();

        Replace replace2 = (Replace) antProject.createTask("replace");
        replace2.setFile(existingFile);
        replace2.setToken("# -- " + nameInComment + "-END");
        replace2.setValue("REGULAR-END");
        replace2.execute();

        ReplaceRegExp regExpTask = (ReplaceRegExp) antProject.createTask("replaceregexp");
        regExpTask.setFile(existingFile);
        regExpTask.setMatch("REGULAR-START(?s:.)*REGULAR-END");
        regExpTask.setReplace("");
View Full Code Here

        if (webTestsExist && existingFile.exists()) {
            createLoadFileTask("src/test/resources/" + pojoName + "-web-tests.xml", "web.tests").execute();
            parseXMLFile(existingFile, pojoName, "</project>", "web.tests");

            // Add main target to run-all-tests target
            Replace replace = (Replace) antProject.createTask("replace");
            replace.setFile(existingFile);

            try {
                if (FileUtils.readFileToString(existingFile).contains("FileUpload")) {
                    // todo: figure out how to fix the 2 lines below so they don't include pojoNameTest
                    // multiple times on subsequent installs
                    replace.setToken(",FileUpload");
                    replace.setValue(",FileUpload," + pojoName + "Tests");
                } else {
                    // AppFuse Light
                    replace.setToken("depends=\"UserTests");
                    replace.setValue("depends=\"UserTests," + pojoName + "Tests");
                }
            } catch (IOException e) {
                e.printStackTrace();
            }
            replace.execute();
        } else {
            log("Project doesn't use Canoo WebTest, disabling UI test generation.");
            log("Support for jWebUnit will be added in a future release.");
            log("See http://issues.appfuse.org/browse/EQX-215 for more information.");
        }
View Full Code Here

    private void parseXMLFile(File existingFile, String beanName, String tokenToReplace, String fileVariable) {
        String nameInComment = beanName;
        if (beanName == null) {
            nameInComment = pojoName;
        }
        Replace replace1 = (Replace) antProject.createTask("replace");
        replace1.setFile(existingFile);
        replace1.setToken("<!--" + nameInComment + "-START-->");
        replace1.setValue("REGULAR-START");
        replace1.execute();

        Replace replace2 = (Replace) antProject.createTask("replace");
        replace2.setFile(existingFile);
        replace2.setToken("<!--" + nameInComment + "-END-->");
        replace2.setValue("REGULAR-END");
        replace2.execute();

        ReplaceRegExp regExpTask = (ReplaceRegExp) antProject.createTask("replaceregexp");
        regExpTask.setFile(existingFile);
        regExpTask.setMatch("REGULAR-START(?s:.)*REGULAR-END");
        regExpTask.setReplace("");
        regExpTask.setFlags("g");
        regExpTask.execute();

        Replace replaceData = (Replace) antProject.createTask("replace");
        replaceData.setFile(existingFile);
        replaceData.setToken(tokenToReplace);
        String stringWithProperLineEndings = adjustLineEndingsForOS(antProject.getProperty(fileVariable));
        replaceData.setValue(stringWithProperLineEndings);
        replaceData.execute();
    }
View Full Code Here

        String nameInComment = beanName;
        if (beanName == null) {
            nameInComment = pojoName;
        }

        Replace replace1 = (Replace) antProject.createTask("replace");
        replace1.setFile(existingFile);
        replace1.setToken("# -- " + nameInComment + "-START");
        replace1.setValue("REGULAR-START");
        replace1.execute();

        Replace replace2 = (Replace) antProject.createTask("replace");
        replace2.setFile(existingFile);
        replace2.setToken("# -- " + nameInComment + "-END");
        replace2.setValue("REGULAR-END");
        replace2.execute();

        ReplaceRegExp regExpTask = (ReplaceRegExp) antProject.createTask("replaceregexp");
        regExpTask.setFile(existingFile);
        regExpTask.setMatch("REGULAR-START(?s:.)*REGULAR-END");
        regExpTask.setReplace("");
View Full Code Here

TOP

Related Classes of org.apache.tools.ant.taskdefs.Replace

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.