Example usage for org.apache.commons.io FilenameUtils concat

List of usage examples for org.apache.commons.io FilenameUtils concat

Introduction

In this page you can find the example usage for org.apache.commons.io FilenameUtils concat.

Prototype

public static String concat(String basePath, String fullFilenameToAdd) 

Source Link

Document

Concatenates a filename to a base path using normal command line style rules.

Usage

From source file:org.apache.pulsar.io.hdfs.sink.HdfsAbstractSink.java

protected final Path getPath() {
    if (path == null) {
        String ext = "";
        if (StringUtils.isNotBlank(hdfsSinkConfig.getFileExtension())) {
            ext = hdfsSinkConfig.getFileExtension();
        } else if (getCompressionCodec() != null) {
            ext = getCompressionCodec().getDefaultExtension();
        }/*from  w  w w .j  a  v  a 2  s  .c om*/

        path = new Path(FilenameUtils.concat(hdfsSinkConfig.getDirectory(),
                hdfsSinkConfig.getFilenamePrefix() + "-" + System.currentTimeMillis() + ext));
    }
    return path;
}

From source file:org.apache.sling.commons.log.logback.integration.ITJULIntegration.java

@Override
protected Option addExtraOptions() {
    return composite(systemProperty("org.apache.sling.commons.log.julenabled").value("true"),
            frameworkProperty("org.apache.sling.commons.log.configurationFile").value(FilenameUtils
                    .concat(new File(".").getAbsolutePath(), "src/test/resources/test-jul-config.xml")));
}

From source file:org.apache.sling.commons.log.logback.integration.ITWebConsoleRemote.java

@Override
protected Option addExtraOptions() {
    return composite(webSupport(),
            mavenBundle("org.apache.sling", "org.apache.sling.commons.logservice").versionAsInProject(),
            mavenBundle("org.apache.felix", "org.apache.felix.http.jetty").versionAsInProject(),
            mavenBundle("org.apache.felix", "org.apache.felix.webconsole").versionAsInProject(),
            mavenBundle("org.apache.felix", "org.apache.felix.metatype").versionAsInProject(),
            mavenBundle("org.apache.felix", "org.apache.felix.scr").versionAsInProject(),
            mavenBundle("commons-io", "commons-io").versionAsInProject(),
            wrappedBundle(mavenBundle("commons-fileupload", "commons-fileupload").versionAsInProject()),
            wrappedBundle(mavenBundle("org.json", "json").versionAsInProject()), configAdmin(),
            frameworkProperty("org.apache.sling.commons.log.configurationFile").value(FilenameUtils
                    .concat(new File(".").getAbsolutePath(), "src/test/resources/test-webconsole-remote.xml")),
            createWebConsoleTestBundle());
}

From source file:org.apache.sling.commons.log.logback.integration.LogTestBase.java

private static Option addDebugOptions() throws IOException {
    if (paxRunnerVmOption != null) {
        String workDir = FilenameUtils.concat(getBaseDir(), "target/pax");
        File workDirFile = new File(workDir);
        if (workDirFile.exists()) {
            FileUtils.deleteDirectory(workDirFile);
        }//from www.  j  av a2 s.  c  o  m
        return composite(CoreOptions.vmOption(paxRunnerVmOption), keepCaches(),
                systemTimeout(TimeUnit.MINUTES.toMillis(10)), workingDirectory(workDir));
    }
    return null;
}

From source file:org.apache.sling.commons.log.logback.integration.LogTestBase.java

private static Option addSlingHome() {
    String workDirName = FilenameUtils.concat(getBaseDir(), "target/sling");
    return systemProperty("sling.home").value(workDirName);
}

From source file:org.apache.sling.commons.log.logback.integration.LogTestBase.java

protected static String absolutePath(String configFileName) {
    return FilenameUtils.concat(new File(".").getAbsolutePath(), "src/test/resources/" + configFileName);
}

From source file:org.apache.sling.extensions.logback.integration.ITConfigAdminSupport.java

@Test
public void testExternalConfig() throws Exception {
    Configuration config = ca.getConfiguration(PID, null);
    Dictionary<String, Object> p = new Hashtable<String, Object>();
    p.put(LOG_LEVEL, "DEBUG");
    p.put(LOGBACK_FILE, FilenameUtils.concat(new File(".").getAbsolutePath(),
            "src/test/resources/test1-external-config.xml"));
    config.update(p);/*www . j a v  a 2  s  .c o  m*/

    delay();

    ch.qos.logback.classic.Logger rootLogger = (ch.qos.logback.classic.Logger) LoggerFactory
            .getLogger(Logger.ROOT_LOGGER_NAME);
    assertNotNull(rootLogger.getAppender("FILE"));
}

From source file:org.apache.sling.maven.projectsupport.BundleListContentProvider.java

private File getConfigFile(String path) {
    return new File(FilenameUtils.concat(getConfigDirectory().getAbsolutePath(),
            path.substring(CONFIG_PATH_PREFIX.length() + 1)));
}

From source file:org.apache.sling.maven.projectsupport.BundleListContentProviderTest.java

private File getConfigFile(File configRoot, String name) throws IOException {
    return new File(FilenameUtils.concat(configRoot.getAbsolutePath(), name));
}

From source file:org.apache.torque.generator.control.existingtargetstrategy.MergeTargetFileStrategy.java

/**
 * Processes the results of the generation.
 *
 * @param outputDirKey the key for the output directory
 *        into which the generated file should be written,
 *        null for the default output directory.
 * @param outputPath the location to which the output should be written.
 * @param encoding The character encoding of the generated file,
 *        or null for the platform default encoding.
 * @param generationResult the result of the generation, not null.
 * @param unitConfiguration the configuration of the current configuration
 *        unit, not null.//from  www  .j  a v a2s . co  m
 *
 * @throws GeneratorException on an error.
 */
public void afterGeneration(String outputDirKey, String outputPath, String encoding,
        OutletResult generationResult, UnitConfiguration unitConfiguration) throws GeneratorException {
    File generationStorageDir = new File(unitConfiguration.getWorkDirectory(), WORK_SUBDIR);
    File generationStorageFile;
    if (outputDirKey == null) {
        generationStorageFile = new File(generationStorageDir, FilenameUtils.concat("default", outputPath));
    } else {
        generationStorageFile = new File(generationStorageDir,
                FilenameUtils.concat("other", FilenameUtils.concat(outputDirKey, outputPath)));
    }
    String oldGenerationContent = readFileToString(generationStorageFile, encoding);

    File targetFile = ControllerHelper.getOutputFile(outputDirKey, outputPath, unitConfiguration);
    String oldTargetContent = readFileToString(targetFile, encoding);

    if (!generationResult.isStringResult()) {
        throw new GeneratorException("The merge target file strategy onlys works"
                + " for String generation results (target file=" + targetFile.getAbsolutePath() + ")");
    }

    String newTargetContent = null;
    if (oldTargetContent == null) {
        log.debug("no old target content found, using generation result");
        newTargetContent = generationResult.getStringResult();
    } else if (oldGenerationContent == null) {
        log.info("no old generation content found," + "using old target content."
                + " This is a bit unusual, but may be ok" + " depending on the circumstances");
        newTargetContent = generationResult.getStringResult();
    } else {
        log.debug("merging generation result and old target content");
        newTargetContent = merger.merge(oldGenerationContent, generationResult.getStringResult(),
                oldTargetContent, encoding);
    }
    writeStringToFile(targetFile, newTargetContent, encoding);
    writeStringToFile(generationStorageFile, generationResult.getStringResult(), encoding);
}