Example usage for com.google.common.io PatternFilenameFilter PatternFilenameFilter

List of usage examples for com.google.common.io PatternFilenameFilter PatternFilenameFilter

Introduction

In this page you can find the example usage for com.google.common.io PatternFilenameFilter PatternFilenameFilter.

Prototype

public PatternFilenameFilter(Pattern pattern) 

Source Link

Document

Constructs a pattern file name filter object.

Usage

From source file:com.github.jcustenborder.kafka.connect.spooldir.SpoolDirSourceConnectorConfig.java

public SpoolDirSourceConnectorConfig(final boolean isTask, ConfigDef configDef, Map<String, ?> settings) {
    super(configDef, settings);
    this.inputPath = ConfigUtils.getAbsoluteFile(this, INPUT_PATH_CONFIG);
    this.finishedPath = ConfigUtils.getAbsoluteFile(this, FINISHED_PATH_CONFIG);
    this.errorPath = ConfigUtils.getAbsoluteFile(this, ERROR_PATH_CONFIG);
    this.haltOnError = this.getBoolean(HALT_ON_ERROR_CONF);
    this.minimumFileAgeMS = this.getLong(FILE_MINIMUM_AGE_MS_CONF);
    this.batchSize = this.getInt(BATCH_SIZE_CONF);
    this.topic = this.getString(TOPIC_CONF);
    this.emptyPollWaitMs = this.getLong(EMPTY_POLL_WAIT_MS_CONF);
    this.processingFileExtension = this.getString(PROCESSING_FILE_EXTENSION_CONF);
    this.keyFields = this.getList(SCHEMA_GENERATION_KEY_FIELDS_CONF);
    this.schemaGenerationEnabled = this.getBoolean(SCHEMA_GENERATION_ENABLED_CONF);
    this.schemaGenerationKeyName = this.getString(SCHEMA_GENERATION_KEY_NAME_CONF);
    this.schemaGenerationValueName = this.getString(SCHEMA_GENERATION_VALUE_NAME_CONF);

    String timestampTimezone = this.getString(PARSER_TIMESTAMP_TIMEZONE_CONF);
    this.parserTimestampTimezone = TimeZone.getTimeZone(timestampTimezone);

    List<SimpleDateFormat> results = new ArrayList<>();
    List<String> formats = this.getList(PARSER_TIMESTAMP_DATE_FORMATS_CONF);
    for (String s : formats) {
        SimpleDateFormat dateFormat = new SimpleDateFormat(s);
        dateFormat.setTimeZone(this.parserTimestampTimezone);
        results.add(dateFormat);// www  .j  a v a 2  s .  com
    }
    this.parserTimestampDateFormats = results.toArray(new SimpleDateFormat[results.size()]);

    this.keySchema = readSchema(KEY_SCHEMA_CONF);
    this.valueSchema = readSchema(VALUE_SCHEMA_CONF);

    if (null != this.keySchema) {
        this.keyMetadataField = findMetadataField(this.keySchema);
        this.hasKeyMetadataField = null != this.keyMetadataField;
    } else {
        this.keyMetadataField = null;
        this.hasKeyMetadataField = false;
    }

    if (null != this.valueSchema) {
        this.valueMetadataField = findMetadataField(this.valueSchema);
        this.hasvalueMetadataField = null != this.valueMetadataField;
    } else {
        this.valueMetadataField = null;
        this.hasvalueMetadataField = false;
    }

    this.timestampMode = ConfigUtils.getEnum(TimestampMode.class, this, TIMESTAMP_MODE_CONF);

    if (TimestampMode.FIELD == this.timestampMode) {
        this.timestampField = this.getString(TIMESTAMP_FIELD_CONF);

        log.trace("ctor() - Looking for timestamp field '{}'", this.timestampField);
    } else {
        this.timestampField = null;
    }

    /*if (isTask && null == this.valueSchema) {
      throw new DataException(
          String.format("'%s' must be set to a valid schema.", VALUE_SCHEMA_CONF)
      );
    }*/

    final String inputPatternText = this.getString(INPUT_FILE_PATTERN_CONF);
    final Pattern inputPattern = Pattern.compile(inputPatternText);
    this.inputFilenameFilter = new PatternFilenameFilter(inputPattern);
}

From source file:de.hu_berlin.german.korpling.saltnpepper.debugger.MainFrame.java

private void btStartActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_btStartActionPerformed
{//GEN-HEADEREND:event_btStartActionPerformed

    // sync and write out configuration (in case we are disrupted)
    storeConfiguration();/*w w  w .jav a2 s  .  c om*/

    // clear
    txtOutput.setText("");

    File[] modulesAsArray = new File[modules.size()];
    modules.copyInto(modulesAsArray);

    File root = getRoot();

    File[] pepperInstallationMatch = root.listFiles(
            new PatternFilenameFilter("^de.hu_berlin.german.korpling.saltnpepper.pepper-starter_.*$"));

    if (pepperInstallationMatch.length > 0 && pepperInstallationMatch[0].isDirectory()) {
        File pepperRoot = pepperInstallationMatch[0];

        PepperConversionWorker worker = new PepperConversionWorker(modulesAsArray,
                new File(txtPepperParams.getText()), pepperRoot, btStart);
        worker.execute();
        btStart.setEnabled(false);

    } else {
        JOptionPane.showMessageDialog(this, "Could not find the \"pepper-install\" folder", "ERROR",
                JOptionPane.ERROR_MESSAGE);
    }
}

From source file:io.confluent.kafka.connect.source.SpoolDirectoryConfig.java

public PatternFilenameFilter inputFilePattern() {
    String input = this.getString(INPUT_FILE_PATTERN_CONF);
    Pattern pattern = Pattern.compile(input);
    return new PatternFilenameFilter(pattern);
}