Package org.apache.tools.ant.util

Examples of org.apache.tools.ant.util.FileUtils


            throw new BuildException("no property specified");
        }
        if (destDir == null) {
            destDir = getProject().resolveFile(".");
        }
        FileUtils utils = FileUtils.newFileUtils();
        File tfile = utils.createTempFile(prefix, suffix, destDir);
        getProject().setNewProperty(property, tfile.toString());
    }
View Full Code Here


            }
        }
       
        // Serialize the cactified deployment descriptor into a temporary file,
        // so that it can get picked up by the War task
        FileUtils fileUtils = FileUtils.newFileUtils();
        File tmpDir = fileUtils.createTempFile("cactus", "tmp.dir",
            getProject().getBaseDir());
        tmpDir.mkdirs();
        tmpDir.deleteOnExit();
        File webXmlFile = null;
        try
View Full Code Here

    protected void prepare(String theResourcePrefix, String theDirName)
        throws IOException
    {
        super.prepare(theResourcePrefix, theDirName);

        FileUtils fileUtils = FileUtils.newFileUtils();
       
        // Copy user-provided context xml file into the temporary webapp/
        // container directory
        File webappsDir = new File(getTmpDir(), "webapps");
        if (getContextXml() != null)
        {
            fileUtils.copyFile(getContextXml(),
                new File(webappsDir, getContextXml().getName()));
        }
       
    }
View Full Code Here

     *        directory
     * @throws IOException If an I/O error occurs
     */
    private void prepare(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
        File confDir = createDirectory(tmpDir, "conf");
        copyConfFiles(confDir);
        if (getServerXml() == null)
        {
            ResourceUtils.copyResource(getProject(),
                RESOURCE_PATH + "tomcat3x/server.xml",
                new File(confDir, "server.xml"), filterChain);
        }
        // TODO: only copy these files if they haven't been provided by the
        // user as a conf fileset
        ResourceUtils.copyResource(getProject(),
            RESOURCE_PATH + "tomcat3x/tomcat-users.xml",
            new File(confDir, "tomcat-users.xml"));
        ResourceUtils.copyResource(getProject(),
            RESOURCE_PATH + "tomcat3x/modules.xml",
            new File(confDir, "modules.xml"));
       
        // deploy the web-app by copying the WAR file
        File webappsDir = createDirectory(tmpDir, "webapps");
        fileUtils.copyFile(getDeployableFile().getFile(),
            new File(webappsDir, getDeployableFile().getFile().getName()),
            null, true);
    }
View Full Code Here

     */
    private File cactifyApplicationXml(ApplicationXml theAppXml)
    {
        theAppXml.addWebModule(cactusWar.getFileName(), cactusWar.getContext());
        // serialize the cactified app xml
        FileUtils fileUtils = FileUtils.newFileUtils();
        File tmpAppXml = fileUtils.createTempFile("cactus", "application.xml",
                                                  getProject().getBaseDir());
        tmpAppXml.deleteOnExit();
        try
        {
            ApplicationXmlIo.writeApplicationXml(theAppXml,
View Full Code Here

     *
     * @return the cactus.war
     */
    private File createCactusWar()
    {
        FileUtils fileUtils = FileUtils.newFileUtils();
        File tmpCactusWar = fileUtils.createTempFile("cactus", "cactus.war",
                                                     getProject().getBaseDir());
        tmpCactusWar.deleteOnExit();
        cactusWar.setDestFile(tmpCactusWar);
       
        if (addEjbReferences)
View Full Code Here

     * @throws IOException If an I/O error occurs
     */
    protected void prepare(String theResourcePrefix, String theDirName)
        throws IOException
    {
        FileUtils fileUtils = FileUtils.newFileUtils();
        FilterChain filterChain = createFilterChain();

        setTmpDir(setupTempDirectory(getTmpDir(), theDirName));
        cleanTempDirectory(getTmpDir());

        File confDir = createDirectory(getTmpDir(), "conf");
       
        // Copy first the default configuration files so that they can be
        // overriden by the user-provided ones.

        if (getServerXml() == null)
        {
            ResourceUtils.copyResource(getProject(),
                RESOURCE_PATH + theResourcePrefix + "/server.xml",
                new File(confDir, "server.xml"), filterChain);
        }
       
        ResourceUtils.copyResource(getProject(),
            RESOURCE_PATH + theResourcePrefix + "/tomcat-users.xml",
            new File(confDir, "tomcat-users.xml"));
        fileUtils.copyFile(new File(getDir(), "conf/web.xml"),
            new File(confDir, "web.xml"));

        // deploy the web-app by copying the WAR file into the webapps
        // directory
        File webappsDir = createDirectory(getTmpDir(), "webapps");
        fileUtils.copyFile(getDeployableFile().getFile(),
            new File(webappsDir, getDeployableFile().getFile().getName()),
            null, true);
       
        // Copy user-provided configuration files into the temporary conf/
        // container directory.
View Full Code Here

     */
    protected final void copyConfFiles(File theConfDir)
    {
        if (getServerXml() != null)
        {
            FileUtils fileUtils = FileUtils.newFileUtils();
            try
            {
                fileUtils.copyFile(getServerXml(),
                    new File(theConfDir, "server.xml"));
            }
            catch (IOException ioe)
            {
                throw new BuildException("Could not copy " + getServerXml()
View Full Code Here

     * @throws IOException If an I/O error occurs
     */
    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

        File confDir = createDirectory(tmpDir, "conf");

        // Configuration files are not the same whether we deploy a
        // WAR or an EAR
        String sharePath = RESOURCE_PATH + theResourcePrefix + "/share";
        String specificPath;
        if (getDeployableFile().isWar())
        {
            specificPath = RESOURCE_PATH + theResourcePrefix + "/war";
        }
        else
        {
            specificPath = RESOURCE_PATH + theResourcePrefix + "/ear";
        }

        ResourceUtils.copyResource(getProject(),
            specificPath + "/server.xml",
            new File(confDir, "server.xml"), filterChain);
        ResourceUtils.copyResource(getProject(),
            specificPath + "/application.xml",
            new File(confDir, "application.xml"), filterChain);
        ResourceUtils.copyResource(getProject(),
            specificPath + "/default-web-site.xml",
            new File(confDir, "default-web-site.xml"), filterChain);

        ResourceUtils.copyResource(getProject(),
            sharePath + "/global-web-application.xml",
            new File(confDir, "global-web-application.xml"), filterChain);
        ResourceUtils.copyResource(getProject(),
            sharePath + "/mime.types",
            new File(confDir, "mime.types"), filterChain);
        ResourceUtils.copyResource(getProject(),
            sharePath + "/principals.xml",
            new File(confDir, "principals.xml"), filterChain);
        ResourceUtils.copyResource(getProject(),
            sharePath + "/rmi.xml",
            new File(confDir, "rmi.xml"), filterChain);

        // Create default web app (required by Orion unfortunately...)
        File defaultWebAppDir = createDirectory(tmpDir,
            "default-web-app/WEB-INF");
        ResourceUtils.copyResource(getProject(),
            sharePath + "/web.xml",
            new File(defaultWebAppDir, "web.xml"), filterChain);      
       
        // Orion need to have a /persistence directory created, otherwise it
        // throws an error
        createDirectory(tmpDir, "persistence");

        // Directory where modules to be deployed are located
        File appDir = createDirectory(tmpDir, "applications");

        // Deployment directory (i.e. where Orion expands modules)
        createDirectory(tmpDir, "application-deployments");

        // Orion log directory
        createDirectory(tmpDir, "log");
              
        fileUtils.copyFile(getDeployableFile().getFile(),
            new File(appDir, getDeployableFile().getFile().getName()),
            null, true);
    }
View Full Code Here

public class PropertyFileCLITest {

    @Test
    public void testPropertyResolution() throws Exception {
        FileUtils fu = FileUtils.getFileUtils();
        File props = fu.createTempFile("propertyfilecli", ".properties",
                                       null, true, true);
        File build = fu.createTempFile("propertyfilecli", ".xml", null, true,
                                       true);
        File log = fu.createTempFile("propertyfilecli", ".log", null, true,
                                     true);
        FileWriter fw = null;
        FileReader fr = null;
        try {
            fw = new FileWriter(props);
View Full Code Here

TOP

Related Classes of org.apache.tools.ant.util.FileUtils

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.