public static String getApplicationName(Context context) { ApplicationInfo applicationInfo = context.getApplicationInfo(); int stringId = applicationInfo.labelRes; return stringId == 0 ? applicationInfo.nonLocalizedLabel.toString() : context.getString(stringId); }
@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 initialize(Event event, byte[] columnFamily) { this.headers = event.getHeaders(); this.payload = event.getBody(); this.cf = columnFamily; }
protected UUIDInterceptor(Context context) { headerName = context.getString(HEADER_NAME, "id"); preserveExisting = context.getBoolean(PRESERVE_EXISTING_NAME, true); prefix = context.getString(PREFIX_NAME, ""); }
@Override public void initialize(Event event, byte[] cf) { this.payload = event.getBody(); this.cf = cf; }
public Status process() throws EventDeliveryException { Exception exception = getStartException(); if (exception != null) { throw new FlumeException("Source had error configuring or starting", exception); } if (!isStarted()) { throw new EventDeliveryException("Source is not started. It is in '" + getLifecycleState() + "' state"); } return doProcess(); }
@Override public Event call() { return channel.take(); } });
@Override public Status appendBatch(List<ThriftFlumeEvent> events) throws TException { throw new FlumeException("Forced Error"); } }
public PollingPropertiesFileConfigurationProvider(String agentName, File file, EventBus eventBus, int interval) { super(agentName, file); this.eventBus = eventBus; this.file = file; this.interval = interval; counterGroup = new CounterGroup(); lifecycleState = LifecycleState.IDLE; }
@Override public void start() { for (Sink s : sinkList) { s.start(); } state = LifecycleState.START; }
@Override public void stop() { for (Sink s : sinkList) { s.stop(); } state = LifecycleState.STOP; }
/** * Gets value mapped to key, returning null if unmapped. * @param key to be found * @return value associated with key or null if unmapped */ public String getString(String key) { return get(key); }
/** * Get the branch on which this originated. * @return The branch name, e.g. "trunk" or "branches/branch-1.1" */ public static String getBranch() { return version != null ? version.branch() : "Unknown"; }
/** * The date that Flume was compiled. * @return the compilation date in unix date format */ public static String getDate() { return version != null ? version.date() : "Unknown"; }
/** * Get the subversion URL for the root Flume directory. */ public static String getUrl() { return version != null ? version.url() : "Unknown"; }
@Override public void configure(Context context) { preserveExisting = context.getBoolean(Constants.PRESERVE, Constants.PRESERVE_DEFAULT); key = context.getString(Constants.KEY, Constants.KEY_DEFAULT); value = context.getString(Constants.VALUE, Constants.VALUE_DEFAULT); }
@Override public void initialize(Event event, byte[] columnFamily) { this.headers = event.getHeaders(); this.payload = event.getBody(); this.cf = columnFamily; }
private long estimateEventSize(Event event) { byte[] body = event.getBody(); if (body != null && body.length != 0) { return body.length; } //Each event occupies at least 1 slot, so return 1. return 1; }
/** * Gets value mapped to key, returning defaultValue if unmapped. * @param key to be found * @param defaultValue returned if key is unmapped * @return value associated with key */ public String getString(String key, String defaultValue) { return get(key, defaultValue); } /**
private long estimateEventSize(Event event) { byte[] body = event.getBody(); if (body != null && body.length != 0) { return body.length; } //Each event occupies at least 1 slot, so return 1. return 1; }