Example usage for org.apache.commons.io FileUtils touch

List of usage examples for org.apache.commons.io FileUtils touch

Introduction

In this page you can find the example usage for org.apache.commons.io FileUtils touch.

Prototype

public static void touch(File file) throws IOException 

Source Link

Document

Implements the same behaviour as the "touch" utility on Unix.

Usage

From source file:org.geoserver.importer.ImporterTest.java

public void testCreateContextIgnoreHidden() throws Exception {
    File dir = unpack("shape/archsites_epsg_prj.zip");
    FileUtils.touch(new File(dir, ".DS_Store"));

    ImportContext context = importer.createContext(new Directory(dir));
    assertEquals(1, context.getTasks().size());
}

From source file:org.globus.gsi.stores.CertKeyCredential.java

public CertKeyCredential(GlobusResource certResource, GlobusResource keyResource, X509Credential credential)
        throws ResourceStoreException {
    this.globusCertFile = certResource;
    try {/* ww  w.  j a v a2s . c om*/
        if (!certResource.exists()) {
            FileUtils.touch(certResource.getFile());
            this.certLastModified = certResource.lastModified();
        }
        this.globusKeyFile = keyResource;
        if (!keyResource.exists()) {
            FileUtils.touch(keyResource.getFile());
            this.keyLastModified = keyResource.lastModified();
        }
    } catch (IOException e) {
        throw new ResourceStoreException(e);
    }
    this.credential = credential;
}

From source file:org.globus.security.stores.CertKeyCredential.java

public CertKeyCredential(Resource certResource, Resource keyResource, X509Credential credential)
        throws ResourceStoreException {
    this.certFile = certResource;
    try {/*w w w .java 2s.  c o m*/
        if (!certResource.exists()) {
            FileUtils.touch(certResource.getFile());
            this.certLastModified = certResource.lastModified();
        }
        this.keyFile = keyResource;
        if (!keyResource.exists()) {
            FileUtils.touch(keyResource.getFile());
            this.keyLastModified = keyResource.lastModified();
        }
    } catch (IOException e) {
        throw new ResourceStoreException(e);
    }
    this.credential = credential;
}

From source file:org.gradle.util.GFileUtils.java

public static void touch(File file) {
    try {//from w ww .  j av  a  2s .  c om
        FileUtils.touch(file);
    } catch (IOException e) {
        throw new UncheckedIOException(e);
    }
}

From source file:org.gradle.util.TestFile.java

public TestFile touch() {
    try {//from   w  w  w .  j  a  v  a2  s  .  c o  m
        FileUtils.touch(this);
    } catch (IOException e) {
        throw new UncheckedIOException(e);
    }
    assertIsFile();
    return this;
}

From source file:org.grails.ide.eclipse.runonserver.GrailsAppModuleDelegate.java

private void touchTimeStamp() {
    File file = getTimeStampFile();
    if (file != null) {
        try {//from   w  w  w. java2s  .  co  m
            FileUtils.touch(file);
        } catch (IOException e) {
            GrailsCoreActivator.log("Problems touching time stamp file in Grails RunOnServer", e);
        }
    }
}

From source file:org.jahia.utils.maven.plugin.buildautomation.ConfigureMojo.java

private void initConfigTargetDir() {
    // initialize configuration directory location
    String path = null;/*from   w ww.  j a v  a 2  s.  co  m*/
    boolean isTomcat = false;
    boolean isJBoss = false;
    if (targetServerType != null) {
        if (targetServerType.startsWith("jboss")) {
            isJBoss = true;
            path = "${jahiaWebAppRoot}/../../digital-factory-config.jar/";
        } else if (targetServerType.startsWith("tomcat")) {
            isTomcat = true;
            path = "${jahiaWebAppRoot}/../../digital-factory-config/";
        }
    }
    if (path == null) {
        throw new IllegalArgumentException("Externalized configuration is activated,"
                + " but the target directory could not be detected. Please, specify it explicitly.");
    }
    externalizedConfigTargetPath = JahiaGlobalConfigurator
            .resolveDataDir(path, getWebappDeploymentDir().getAbsolutePath()).getAbsolutePath();
    getLog().info("Configuration directory path resolved to: " + externalizedConfigTargetPath);

    try {
        if (isTomcat) {
            adjustCatalinaProperties();
        } else if (isJBoss) {
            FileUtils.touch(new File(externalizedConfigTargetPath, "../digital-factory-config.jar.dodeploy"));
        }
    } catch (IOException e) {
        getLog().error(e.getMessage(), e);
    }
}

From source file:org.jahia.utils.maven.plugin.DeployMojo.java

/**
 * Deploy all EAR dependencies ( WARs / SARs / RARs / shared resources ) to application server
 * @throws Exception/*from w  w  w. j a v  a2  s . c  o  m*/
 */
private void deployEarProject() throws Exception {
    if (getDeployer().isEarDeployment()) {
        getLog().info("Deploying application server specific files for " + getDeployer().getName()
                + " in directory " + targetServerDirectory);
        File targetEarFolder = getDeployer().getDeploymentFilePath("digitalfactory", "ear");
        getLog().info("Updating EAR resources in " + targetEarFolder);
        int updateFileCount = updateFiles(new File(baseDir, "src/main/resources"), targetEarFolder);
        getLog().info("Updated " + updateFileCount + " resources");
        if ("jboss".equals(targetServerType)) {
            // for JBoss create deployment marker file
            FileUtils.touch(new File(targetEarFolder.getParentFile(), targetEarFolder.getName() + ".dodeploy"));
        }
    }
}

From source file:org.jbb.system.impl.install.InstallationFileManager.java

public void createInstallationFile(InstallationData installationData) {
    Parameters params = new Parameters();
    File installFile = getInstallFile();
    try {/*from w  w  w. j  a  v  a2  s .  co  m*/
        FileUtils.touch(installFile);
    } catch (IOException e) {
        throw new IllegalStateException(e);
    }
    FileBasedConfigurationBuilder<FileBasedConfiguration> builder = new FileBasedConfigurationBuilder<FileBasedConfiguration>(
            PropertiesConfiguration.class).configure(params.fileBased().setFile(installFile));
    builder.setAutoSave(true);

    try {
        FileBasedConfiguration configuration = builder.getConfiguration();
        configuration.addProperty("installationId", UUID.randomUUID().toString());
        configuration.addProperty("installationVersion", jbbMetaData.jbbVersion());
        configuration.addProperty("installationDate", LocalDateTime.now().toString());
        configuration.addProperty("boardFounderUsername", installationData.getAdminUsername());
        builder.save();
    } catch (ConfigurationException e) {
        throw new IllegalStateException(e);
    }
}

From source file:org.jenkinsci.plugins.workflow.steps.scm.GitStepTest.java

static File createSampleRepo(TemporaryFolder tmp) throws Exception {
    File sampleRepo = tmp.newFolder();
    git(sampleRepo, "init");
    FileUtils.touch(new File(sampleRepo, "file"));
    git(sampleRepo, "add", "file");
    git(sampleRepo, "commit", "--message=init");
    return sampleRepo;
}