@Override public void configure(Context context) { port = context.getInteger(CONFIG_PORT, DEFAULT_PORT); }
/** * Gets value mapped to key, returning null if unmapped. * <p> * Note that this method returns an object as opposed to a * primitive. The configuration key requested may not be mapped * to a value and by returning the primitive object wrapper we can * return null. If the key does not exist the return value of * this method is assigned directly to a primitive, a * {@link NullPointerException} will be thrown. * </p> * @param key to be found * @return value associated with key or null if unmapped */ public Integer getInteger(String key) { return getInteger(key, null); } /**
@Override public void configure(Context context) { port = context.getInteger("port", DEFAULT_PORT); maxReadBufferBytes = context.getInteger("maxReadBufferBytes", DEFAULT_MAX_READ_BUFFER_BYTES); if(maxReadBufferBytes <= 0){ maxReadBufferBytes = DEFAULT_MAX_READ_BUFFER_BYTES; } workers = context.getInteger("workerThreads", DEFAULT_WORKERS); if (workers <= 0) { workers = DEFAULT_WORKERS; } if (sourceCounter == null) { sourceCounter = new SourceCounter(getName()); } }
@Override public void configure(Context context) { this.maxBlobLength = context.getInteger(MAX_BLOB_LENGTH_KEY, MAX_BLOB_LENGTH_DEFAULT); if (this.maxBlobLength <= 0) { throw new ConfigurationException("Configuration parameter " + MAX_BLOB_LENGTH_KEY + " must be greater than zero: " + maxBlobLength); } }
@Override public void configure(Context context) { batchSize = context.getInteger("batchSize", DFLT_BATCH_SIZE); logger.debug(this.getName() + " " + "batch size set to " + String.valueOf(batchSize)); Preconditions.checkArgument(batchSize > 0, "Batch size must be > 0"); logEveryNEvents = context.getInteger("logEveryNEvents", DFLT_LOG_EVERY_N_EVENTS); logger.debug(this.getName() + " " + "log event N events set to " + logEveryNEvents); Preconditions.checkArgument(logEveryNEvents > 0, "logEveryNEvents must be > 0"); }
protected BlobDeserializer(Context context, ResettableInputStream in) { this.in = in; this.maxBlobLength = context.getInteger(MAX_BLOB_LENGTH_KEY, MAX_BLOB_LENGTH_DEFAULT); if (this.maxBlobLength <= 0) { throw new ConfigurationException("Configuration parameter " + MAX_BLOB_LENGTH_KEY + " must be greater than zero: " + maxBlobLength); } this.isOpen = true; }
LineDeserializer(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.isOpen = true; }
@Override public void configure(Context context) { Integer capacity = context.getInteger("capacity"); keepAlive = context.getInteger("keep-alive"); if (capacity == null) { capacity = defaultCapacity; } if (keepAlive == null) { keepAlive = defaultKeepAlive; } queue = new ArrayBlockingQueue<Event>(capacity); if (channelCounter == null) { channelCounter = new ChannelCounter(getName()); } }
@Override public void configure(Context context) { syncIntervalBytes = context.getInteger(SYNC_INTERVAL_BYTES, DEFAULT_SYNC_INTERVAL_BYTES); compressionCodec = context.getString(COMPRESSION_CODEC, DEFAULT_COMPRESSION_CODEC); staticSchemaURL = context.getString(STATIC_SCHEMA_URL, DEFAULT_STATIC_SCHEMA_URL); }
@Override public void configure(Context context) { syncIntervalBytes = context.getInteger(SYNC_INTERVAL_BYTES, DEFAULT_SYNC_INTERVAL_BYTES); compressionCodec = context.getString(COMPRESSION_CODEC, DEFAULT_COMPRESSION_CODEC); schemaSource.configure(context); }
/** * Read parameters from context * <li>batchSize = type int that defines the size of event batches */ @Override protected void doConfigure(Context context) throws FlumeException { batchSize = context.getInteger("batchSize", 1); totalEvents = context.getLong("totalEvents", Long.MAX_VALUE); Preconditions.checkArgument(batchSize > 0, "batchSize was %s but expected positive", batchSize); if (sourceCounter == null) { sourceCounter = new SourceCounter(getName()); } }
@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); sourceEncoding = context.getString( NetcatSourceConfigurationConstants.CONFIG_SOURCE_ENCODING, NetcatSourceConfigurationConstants.DEFAULT_ENCODING ); }
@Override public void configure(Context context) { this.context = context; maxBatchSize = context.getInteger(BATCH_SIZE, maxBatchSize); maxBatchDurationMillis = context.getLong(BATCH_DURATION_MILLIS, maxBatchDurationMillis); handlerClass = context.getString(HANDLER_CLASS, MorphlineHandlerImpl.class.getName()); if (sinkCounter == null) { sinkCounter = new SinkCounter(getName()); } }
@Override public void configure(Context context) { this.pollFrequency = context.getInteger(this.CONF_POLL_FREQUENCY, 60); String localHosts = context.getString(this.CONF_HOSTS); if (localHosts == null || localHosts.isEmpty()) { throw new ConfigurationException("Hosts list cannot be empty."); } this.hosts = this.getHostsFromString(localHosts); this.isGanglia3 = context.getBoolean(this.CONF_ISGANGLIA3, false); }
@Override public void configure(Context context) { Configurables.ensureRequiredNonNull( context, CONFIG_PORT); port = context.getInteger(CONFIG_PORT); host = context.getString(CONFIG_HOST); remoteHostHeader = context.getString(REMOTE_ADDRESS_HEADER); }
/** * Sink configurations with Ignite-specific settings. * * @param context Context for sink. */ @Override public void configure(Context context) { springCfgPath = context.getString(IgniteSinkConstants.CFG_PATH); cacheName = context.getString(IgniteSinkConstants.CFG_CACHE_NAME); eventTransformerCls = context.getString(IgniteSinkConstants.CFG_EVENT_TRANSFORMER); batchSize = context.getInteger(IgniteSinkConstants.CFG_BATCH_SIZE, DFLT_BATCH_SIZE); if (sinkCounter == null) sinkCounter = new SinkCounter(getName()); }
@Override public void configure(Context context) { String consumerKey = context.getString("consumerKey"); String consumerSecret = context.getString("consumerSecret"); String accessToken = context.getString("accessToken"); String accessTokenSecret = context.getString("accessTokenSecret"); twitterStream = new TwitterStreamFactory().getInstance(); twitterStream.setOAuthConsumer(consumerKey, consumerSecret); twitterStream.setOAuthAccessToken(new AccessToken(accessToken, accessTokenSecret)); twitterStream.addListener(this); avroSchema = createAvroSchema(); dataFileWriter = new DataFileWriter<GenericRecord>( new GenericDatumWriter<GenericRecord>(avroSchema)); maxBatchSize = context.getInteger("maxBatchSize", maxBatchSize); maxBatchDurationMillis = context.getInteger("maxBatchDurationMillis", maxBatchDurationMillis); }
@Override public void configure(Context context) { int syncIntervalBytes = context.getInteger(SYNC_INTERVAL_BYTES, DEFAULT_SYNC_INTERVAL_BYTES); String compressionCodec = context.getString(COMPRESSION_CODEC, DEFAULT_COMPRESSION_CODEC); writer = new ReflectDatumWriter<T>(getSchema()); dataFileWriter = new DataFileWriter<T>(writer); dataFileWriter.setSyncInterval(syncIntervalBytes); try { CodecFactory codecFactory = CodecFactory.fromString(compressionCodec); dataFileWriter.setCodec(codecFactory); } catch (AvroRuntimeException e) { logger.warn("Unable to instantiate avro codec with name (" + compressionCodec + "). Compression disabled. Exception follows.", e); } }
@Override protected void doConfigure(Context context) throws FlumeException { nameServer = context.getString(NAME_SERVER_CONFIG); if (nameServer == null) { throw new ConfigurationException("NameServer must not be null"); } topic = context.getString(TOPIC_CONFIG, TOPIC_DEFAULT); tag = context.getString(TAG_CONFIG, TAG_DEFAULT); consumerGroup = context.getString(CONSUMER_GROUP_CONFIG, CONSUMER_GROUP_DEFAULT); messageModel = context.getString(MESSAGE_MODEL_CONFIG, MESSAGE_MODEL_DEFAULT); batchSize = context.getInteger(BATCH_SIZE_CONFIG, BATCH_SIZE_DEFAULT); if (sourceCounter == null) { sourceCounter = new SourceCounter(getName()); } }
@Override public void configure(Context context) { nameServer = context.getString(NAME_SERVER_CONFIG); if (nameServer == null) { throw new ConfigurationException("NameServer must not be null"); } topic = context.getString(TOPIC_CONFIG, TOPIC_DEFAULT); tag = context.getString(TAG_CONFIG, TAG_DEFAULT); producerGroup = context.getString(PRODUCER_GROUP_CONFIG, PRODUCER_GROUP_DEFAULT); batchSize = context.getInteger(BATCH_SIZE_CONFIG, BATCH_SIZE_DEFAULT); maxProcessTime = context.getLong(MAX_PROCESS_TIME_CONFIG, MAX_PROCESS_TIME_DEFAULT); if (sinkCounter == null) { sinkCounter = new SinkCounter(getName()); } }