Java Code Examples for org.apache.flume.Context#getBoolean()
The following examples show how to use
org.apache.flume.Context#getBoolean() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SearchAndReplaceAndFilterInterceptor.java From Transwarp-Sample-Code with MIT License | 6 votes |
@Override public void configure(Context context) { searchAndReplace = context.getBoolean(SEARCH_AND_REPLACE_KEY); String searchPattern = context.getString(SEARCH_PATTERN_KEY); replaceString = context.getString(REPLACE_STRING_KEY); searchRegex = Pattern.compile(searchPattern); if (context.containsKey(CHARSET_KEY)) { // May throw IllegalArgumentException for unsupported charsets. charset = Charset.forName(context.getString(CHARSET_KEY)); } filterByRow = context.getBoolean(FILTER_BY_ROW_KEY); String regexString = context.getString(REGEX_KEY); regex = Pattern.compile(regexString); filterByCol = context.getBoolean(FILTER_BY_COL_KEY); colSeparator = context.getString(COL_SEPARATOR_KEY); index = context.getString(INDEX_KEY); }
Example 2
Source File: JettyWebSocketSource.java From sequenceiq-samples with Apache License 2.0 | 6 votes |
@Override protected void doConfigure(Context context) throws FlumeException { ensureRequiredNonNull(context, HOST_KEY, PORT_KEY, PATH_KEY); this.host = context.getString(HOST_KEY); this.port = context.getInteger(PORT_KEY); this.path = context.getString(PATH_KEY); this.enableSsl = context.getBoolean(SSL_KEY, false); this.keystore = context.getString(KEYSTORE_KEY); this.keystorePassword = context.getString(KEYSTORE_PASSWORD_KEY); if (enableSsl) { checkNotNull(keystore, KEYSTORE_KEY + " must be specified when SSL is enabled"); checkNotNull(keystorePassword, KEYSTORE_PASSWORD_KEY + " must be specified when SSL is enabled"); } }
Example 3
Source File: JettyWebSocketSource.java From sequenceiq-samples with Apache License 2.0 | 6 votes |
@Override protected void doConfigure(Context context) { ensureRequiredNonNull(context, HOST_KEY, PORT_KEY, PATH_KEY); this.host = context.getString(HOST_KEY); this.port = context.getInteger(PORT_KEY); this.path = context.getString(PATH_KEY); this.enableSsl = context.getBoolean(SSL_KEY, false); this.keystore = context.getString(KEYSTORE_KEY); this.keystorePassword = context.getString(KEYSTORE_PASSWORD_KEY); if (enableSsl) { checkNotNull(keystore, KEYSTORE_KEY + " must be specified when SSL is enabled"); checkNotNull(keystorePassword, KEYSTORE_PASSWORD_KEY + " must be specified when SSL is enabled"); } }
Example 4
Source File: RabbitMQSink.java From rabbitmq-flume-plugin with BSD 3-Clause "New" or "Revised" License | 6 votes |
@Override public void configure(Context context) { hostname = context.getString(HOST_KEY, ConnectionFactory.DEFAULT_HOST); port = context.getInteger(PORT_KEY, ConnectionFactory.DEFAULT_AMQP_PORT); sslEnabled = context.getBoolean(SSL_KEY, false); virtualHost = context.getString(VHOST_KEY, ConnectionFactory.DEFAULT_VHOST); username = context.getString(USER_KEY, ConnectionFactory.DEFAULT_USER); password = context.getString(PASSWORD_KEY, ConnectionFactory.DEFAULT_PASS); exchange = context.getString(EXCHANGE_KEY, DEFAULT_EXCHANGE); routingKey = context.getString(ROUTING_KEY, DEFAULT_ROUTING_KEY); autoProperties = context.getBoolean(AUTO_PROPERTIES_KEY, true); mandatory = context.getBoolean(MANDATORY_PUBLISH_KEY, false); publisherConfirms = context.getBoolean(PUBLISHER_CONFIRMS_KEY, false); counterGroup = new CounterGroup(); counterGroup.setName(getName()); }
Example 5
Source File: KafkaSink.java From ingestion with Apache License 2.0 | 6 votes |
@Override public void configure(Context context) { topic = context.getString(CONF_TOPIC); if (topic == null) { throw new ConfigurationException("Kafka topic must be specified."); } writeBody = context.getBoolean(CONF_WRITE_BODY, DEFAULT_WRITE_BODY); ImmutableMap<String, String> subProperties = context.getSubProperties(CONF_KAFKA); Properties properties = new Properties(); properties.putAll(subProperties); producer = new Producer<String, String>(new ProducerConfig(properties)); mapper = new ObjectMapper(); }
Example 6
Source File: HDFSStorage.java From attic-apex-malhar with Apache License 2.0 | 6 votes |
/** * This stores the Identifier information identified in the last store function call * * @param ctx */ @Override public void configure(Context ctx) { String tempId = ctx.getString(ID); if (tempId == null) { if (id == null) { throw new IllegalArgumentException("id can't be null."); } } else { id = tempId; } String tempBaseDir = ctx.getString(BASE_DIR_KEY); if (tempBaseDir != null) { baseDir = tempBaseDir; } restore = ctx.getBoolean(RESTORE_KEY, restore); Long tempBlockSize = ctx.getLong(BLOCKSIZE); if (tempBlockSize != null) { blockSize = tempBlockSize; } blockSizeMultiple = ctx.getInteger(BLOCK_SIZE_MULTIPLE, blockSizeMultiple); retryCount = ctx.getInteger(NUMBER_RETRY,retryCount); }
Example 7
Source File: RabbitMQSink.java From rabbitmq-flume-plugin with BSD 3-Clause "New" or "Revised" License | 6 votes |
@Override public void configure(Context context) { hostname = context.getString(HOST_KEY, ConnectionFactory.DEFAULT_HOST); port = context.getInteger(PORT_KEY, ConnectionFactory.DEFAULT_AMQP_PORT); sslEnabled = context.getBoolean(SSL_KEY, false); virtualHost = context.getString(VHOST_KEY, ConnectionFactory.DEFAULT_VHOST); username = context.getString(USER_KEY, ConnectionFactory.DEFAULT_USER); password = context.getString(PASSWORD_KEY, ConnectionFactory.DEFAULT_PASS); exchange = context.getString(EXCHANGE_KEY, DEFAULT_EXCHANGE); routingKey = context.getString(ROUTING_KEY, DEFAULT_ROUTING_KEY); autoProperties = context.getBoolean(AUTO_PROPERTIES_KEY, true); mandatory = context.getBoolean(MANDATORY_PUBLISH_KEY, false); publisherConfirms = context.getBoolean(PUBLISHER_CONFIRMS_KEY, false); counterGroup = new CounterGroup(); counterGroup.setName(getName()); }
Example 8
Source File: DirFileRecorder.java From flume_monitor_source with Apache License 2.0 | 6 votes |
public void Configure(Context context) { LOG.info("Configure DirFileRecorder."); file_monitor_.Configure(context); String meta_dir = context.getString(FlumeConstants.META_STORE_DIR, "./meta/"); send_interval_ = context.getLong(FlumeConstants.FILE_SEND_INTERVAL, 3L); String tmp_meta_store_file = meta_dir + FlumeConstants.DIR_SEP + file_monitor_.GetMonitorDir().hashCode(); File tmp_file = new File(tmp_meta_store_file); meta_store_file_ = tmp_file.getAbsolutePath(); // auto_delete_line_delimiter_ = context.getBoolean(FlumeConstants.AUTO_DELETE_LINE_DEILMITER, false); reader_writer_.Configure(meta_store_file_); file_parser_ = new MultiLineParser(); file_parser_.Configure(context); executor_service_ = Executors.newScheduledThreadPool(1); sender_runnable_ = new SenderRunnable(); file_info_map_ = new ConcurrentHashMap<Integer, FileInfo>(); }
Example 9
Source File: RegexEventSerializer.java From phoenix with BSD 3-Clause "New" or "Revised" License | 5 votes |
/** * */ @Override public void doConfigure(Context context) { final String regex = context.getString(CONFIG_REGULAR_EXPRESSION, REGEX_DEFAULT); final boolean regexIgnoreCase = context.getBoolean(IGNORE_CASE_CONFIG,IGNORE_CASE_DEFAULT); inputPattern = Pattern.compile(regex, Pattern.DOTALL + (regexIgnoreCase ? Pattern.CASE_INSENSITIVE : 0)); }
Example 10
Source File: LoadBalancingSinkProcessor.java From mt-flume with Apache License 2.0 | 5 votes |
@Override public void configure(Context context) { Preconditions.checkState(getSinks().size() > 1, "The LoadBalancingSinkProcessor cannot be used for a single sink. " + "Please configure more than one sinks and try again."); String selectorTypeName = context.getString(CONFIG_SELECTOR, SELECTOR_NAME_ROUND_ROBIN); Boolean shouldBackOff = context.getBoolean(CONFIG_BACKOFF, false); switchon = context.getBoolean(CONFIG_SWITCHON, true); selector = null; if (selectorTypeName.equalsIgnoreCase(SELECTOR_NAME_ROUND_ROBIN)) { selector = new RoundRobinSinkSelector(shouldBackOff); } else if (selectorTypeName.equalsIgnoreCase(SELECTOR_NAME_RANDOM)) { selector = new RandomOrderSinkSelector(shouldBackOff); } else { try { @SuppressWarnings("unchecked") Class<? extends SinkSelector> klass = (Class<? extends SinkSelector>) Class.forName(selectorTypeName); selector = klass.newInstance(); } catch (Exception ex) { throw new FlumeException("Unable to instantiate sink selector: " + selectorTypeName, ex); } } selector.setSinks(getSinks()); selector.configure( new Context(context.getSubProperties(CONFIG_SELECTOR_PREFIX))); LOGGER.debug("Sink selector: " + selector + " initialized"); }
Example 11
Source File: MongoSink.java From ingestion with Apache License 2.0 | 5 votes |
/** * {@inheritDoc} * * @param context */ @Override public void configure(Context context) { try { if (!"INJECTED".equals(context.getString(CONF_URI))) { this.mongoClientURI = new MongoClientURI( context.getString(CONF_URI), MongoClientOptions.builder().writeConcern(WriteConcern.SAFE) ); this.mongoClient = new MongoClient(mongoClientURI); if (mongoClientURI.getDatabase() != null) { this.mongoDefaultDb = mongoClient.getDB(mongoClientURI.getDatabase()); } if (mongoClientURI.getCollection() != null) { this.mongoDefaultCollection = mongoDefaultDb.getCollection(mongoClientURI.getCollection()); } } final String mappingFilename = context.getString(CONF_MAPPING_FILE); this.eventParser = (mappingFilename == null) ? new EventParser() : new EventParser(MappingDefinition.load(mappingFilename)); this.isDynamicMode = context.getBoolean(CONF_DYNAMIC, DEFAULT_DYNAMIC); if (!isDynamicMode && mongoDefaultCollection == null) { throw new MongoSinkException("Default MongoDB collection must be specified unless dynamic mode is enabled"); } this.dynamicDBField = context.getString(CONF_DYNAMIC_DB_FIELD, DEFAULT_DYNAMIC_DB_FIELD); this.dynamicCollectionField = context.getString(CONF_DYNAMIC_COLLECTION_FIELD, DEFAULT_DYNAMIC_COLLECTION_FIELD); this.sinkCounter = new SinkCounter(this.getName()); this.batchSize = context.getInteger(CONF_BATCH_SIZE, DEFAULT_BATCH_SIZE); this.updateInsteadReplace = context.getBoolean(CONF_UPDATE_INSTEAD_REPLACE,DEFAULT_UPDATE_INSTEAD_REPLACE); } catch (IOException ex) { throw new MongoSinkException(ex); } }
Example 12
Source File: RabbitMQSource.java From rabbitmq-flume-plugin with BSD 3-Clause "New" or "Revised" License | 5 votes |
@Override public void configure(Context context) { // Only the queue name does not have a default value Configurables.ensureRequiredNonNull(context, QUEUE_KEY); // Assign all of the configured values hostname = context.getString(HOST_KEY, ConnectionFactory.DEFAULT_HOST); port = context.getInteger(PORT_KEY, ConnectionFactory.DEFAULT_AMQP_PORT); enableSSL = context.getBoolean(SSL_KEY, false); virtualHost = context.getString(VHOST_KEY, ConnectionFactory.DEFAULT_VHOST); username = context.getString(USER_KEY, ConnectionFactory.DEFAULT_USER); password = context.getString(PASSWORD_KEY, ConnectionFactory.DEFAULT_PASS); queue = context.getString(QUEUE_KEY, null); exchange = context.getString(EXCHANGE_KEY, null); autoAck = context.getBoolean(AUTOACK_KEY, false); requeuing = context.getBoolean(REQUEUING, false); prefetchCount = context.getInteger(PREFETCH_COUNT_KEY, 0); timeout = context.getInteger(TIMEOUT_KEY, -1); consumerThreads = context.getInteger(THREAD_COUNT_KEY, 1); // Ensure that Flume can connect to RabbitMQ testRabbitMQConnection(); // Create and configure the counters sourceCounter = new SourceCounter(getName()); counterGroup = new CounterGroup(); counterGroup.setName(getName()); }
Example 13
Source File: MultiLineExecSource.java From flume-plugins with MIT License | 5 votes |
@Override public void configure(Context context) { command = context.getString("command"); eventTerminator = context.getString("event.terminator"); lineTerminator = context.getString("line.terminator", DEFAULT_LINE_TERMINATOR); Preconditions.checkState(command != null, "The parameter command must be specified"); Preconditions.checkState(lineTerminator != null, "The parameter line.terminator must be specified"); restartThrottle = context.getLong(CONFIG_RESTART_THROTTLE, DEFAULT_RESTART_THROTTLE); restart = context.getBoolean(CONFIG_RESTART, DEFAULT_RESTART); logStderr = context.getBoolean(CONFIG_LOG_STDERR, DEFAULT_LOG_STDERR); bufferCount = context.getInteger(CONFIG_BATCH_SIZE, DEFAULT_BATCH_SIZE); charset = Charset.forName(context.getString(CHARSET, DEFAULT_CHARSET)); }
Example 14
Source File: MultiLineDeserializer.java From flume-customized with Apache License 2.0 | 5 votes |
MultiLineDeserializer(Context context, ResettableInputStream in) { this.in = in; this.outputCharset = Charset.forName( context.getString(OUT_CHARSET_KEY, CHARSET_DFLT)); this.maxLineLength = context.getInteger(MAXLINE_KEY, MAXLINE_DFLT); this.newLineStartPrefix = context.getString(NEW_LINE_START_PREFIX, START_PREFIX_DFLT); this.wrappedByDocker = context.getBoolean(WRAPPED_BY_DOCKER, DEFAULT_WRAPPED_BY_DOCKER); this.isOpen = true; }
Example 15
Source File: HDFSCompressedDataStream.java From Transwarp-Sample-Code with MIT License | 5 votes |
@Override public void configure(Context context) { super.configure(context); serializerType = context.getString("serializer", "TEXT"); useRawLocalFileSystem = context.getBoolean("hdfs.useRawLocalFileSystem", false); serializerContext = new Context( context.getSubProperties(EventSerializer.CTX_PREFIX)); logger.info("Serializer = " + serializerType + ", UseRawLocalFileSystem = " + useRawLocalFileSystem); }
Example 16
Source File: HDFSDataStream.java From Transwarp-Sample-Code with MIT License | 5 votes |
@Override public void configure(Context context) { super.configure(context); serializerType = context.getString("serializer", "TEXT"); useRawLocalFileSystem = context.getBoolean("hdfs.useRawLocalFileSystem", false); serializerContext = new Context(context.getSubProperties(EventSerializer.CTX_PREFIX)); logger.info("Serializer = " + serializerType + ", UseRawLocalFileSystem = " + useRawLocalFileSystem); }
Example 17
Source File: NetcatSource.java From mt-flume with Apache License 2.0 | 5 votes |
@Override public void configure(Context context) { String hostKey = NetcatSourceConfigurationConstants.CONFIG_HOSTNAME; String portKey = NetcatSourceConfigurationConstants.CONFIG_PORT; String ackEventKey = NetcatSourceConfigurationConstants.CONFIG_ACKEVENT; Configurables.ensureRequiredNonNull(context, hostKey, portKey); hostName = context.getString(hostKey); port = context.getInteger(portKey); ackEveryEvent = context.getBoolean(ackEventKey, true); maxLineLength = context.getInteger( NetcatSourceConfigurationConstants.CONFIG_MAX_LINE_LENGTH, NetcatSourceConfigurationConstants.DEFAULT_MAX_LINE_LENGTH); }
Example 18
Source File: TimestampInterceptor.java From mt-flume with Apache License 2.0 | 4 votes |
@Override public void configure(Context context) { preserveExisting = context.getBoolean(PRESERVE, PRESERVE_DFLT); }
Example 19
Source File: StaticInterceptor.java From mt-flume with Apache License 2.0 | 4 votes |
@Override public void configure(Context context) { preserveExisting = context.getBoolean(PRESERVE, PRESERVE_DEFAULT); key = context.getString(KEY, KEY_DEFAULT); value = context.getString(VALUE, VALUE_DEFAULT); }
Example 20
Source File: UUIDInterceptor.java From mt-flume with Apache License 2.0 | 4 votes |
protected UUIDInterceptor(Context context) { headerName = context.getString(HEADER_NAME, "id"); preserveExisting = context.getBoolean(PRESERVE_EXISTING_NAME, true); prefix = context.getString(PREFIX_NAME, ""); }