protected void failIfConfigured() throws ConfigurationException { if (configured) { throw new ConfigurationException("Already configured component." + componentName); } }
@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); } }
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; }
public void configure(Context context) throws ConfigurationException { failIfConfigured(); String confType = context.getString( BasicConfigurationConstants.CONFIG_TYPE); if (confType != null && !confType.isEmpty()) { this.type = confType; } // Type can be set by child class constructors, so check if it was. if (this.type == null || this.type.isEmpty()) { errors.add(new FlumeConfigurationError(componentName, BasicConfigurationConstants.CONFIG_TYPE, FlumeConfigurationErrorType.ATTRS_MISSING, ErrorOrWarning.ERROR)); throw new ConfigurationException( "Component has no type. Cannot configure. " + componentName); } }
@Override public synchronized void start() { LOGGER.info("Starting Morphline Sink {} ...", this); sinkCounter.start(); if (handler == null) { MorphlineHandler tmpHandler; try { tmpHandler = (MorphlineHandler) Class.forName(handlerClass).newInstance(); } catch (Exception e) { throw new ConfigurationException(e); } tmpHandler.configure(context); handler = tmpHandler; } super.start(); LOGGER.info("Morphline Sink {} started.", getName()); }
public void configure(Context context) throws ConfigurationException { super.configure(context); this.channel = context.getString("channel"); if (this.channel == null || this.channel.isEmpty()) { errors .add(new FlumeConfigurationError(componentName, "channel", FlumeConfigurationErrorType.PROPERTY_VALUE_NULL, ErrorOrWarning.ERROR)); throw new ConfigurationException("No channel configured for sink: " + this.getComponentName()); } }
@SuppressWarnings("unchecked") public SinkProcessorConfiguration getConfiguration(String name) throws ConfigurationException { Class<? extends SinkProcessorConfiguration> clazz; SinkProcessorConfiguration instance = null; try { if (processorClassName != null) { clazz = (Class<? extends SinkProcessorConfiguration>) Class .forName(processorClassName); instance = clazz.getConstructor(String.class).newInstance(name); } else { return new SinkProcessorConfiguration(name); } } catch (ClassNotFoundException e) { // Could not find the configuration stub, do basic validation instance = new SinkProcessorConfiguration(name); // Let the caller know that this was created because of this exception. instance.setNotFoundConfigClass(); } catch (Exception e) { throw new ConfigurationException( "Could not instantiate configuration!", e); } return instance; } }
@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); }
@SuppressWarnings("unchecked") public ConfigFilterConfiguration getConfiguration(String name) throws ConfigurationException { if (this == OTHER) { return new ConfigFilterConfiguration(name); } Class<? extends ConfigFilterConfiguration> clazz; ConfigFilterConfiguration instance = null; try { if (configurationName != null) { clazz = (Class<? extends ConfigFilterConfiguration>) Class .forName(configurationName); instance = clazz.getConstructor(String.class).newInstance(name); } else { return new ConfigFilterConfiguration(name); } } catch (ClassNotFoundException e) { // Could not find the configuration stub, do basic validation instance = new ConfigFilterConfiguration(name); // Let the caller know that this was created because of this exception. instance.setNotFoundConfigClass(); } catch (Exception e) { throw new ConfigurationException("Couldn't create configuration", e); } return instance; } }
@SuppressWarnings("unchecked") public SinkConfiguration getConfiguration(String name) throws ConfigurationException { if (this == OTHER) { return new SinkConfiguration(name); } Class<? extends SinkConfiguration> clazz; SinkConfiguration instance = null; try { if (sinkConfigurationName != null) { clazz = (Class<? extends SinkConfiguration>) Class .forName(sinkConfigurationName); instance = clazz.getConstructor(String.class).newInstance(name); } else { return new SinkConfiguration(name); } } catch (ClassNotFoundException e) { // Could not find the configuration stub, do basic validation instance = new SinkConfiguration(name); // Let the caller know that this was created because of this exception. instance.setNotFoundConfigClass(); } catch (Exception e) { throw new ConfigurationException("Couldn't create configuration", e); } return instance; }
@SuppressWarnings("unchecked") public ChannelConfiguration getConfiguration(String name) throws ConfigurationException { if (this == OTHER) { return new ChannelConfiguration(name); } Class<? extends ChannelConfiguration> clazz; ChannelConfiguration instance = null; try { if (channelConfigurationType != null) { clazz = (Class<? extends ChannelConfiguration>) Class .forName(channelConfigurationType); instance = clazz.getConstructor(String.class).newInstance(name); } else { return new ChannelConfiguration(name); } } catch (ClassNotFoundException e) { // Could not find the configuration stub, do basic validation instance = new ChannelConfiguration(name); // Let the caller know that this was created because of this exception. instance.setNotFoundConfigClass(); } catch (Exception e) { throw new ConfigurationException(e); } return instance; } }
@SuppressWarnings("unchecked") public ChannelSelectorConfiguration getConfiguration( String name) throws ConfigurationException { if (this == OTHER) { return new ChannelSelectorConfiguration(name); } Class<? extends ChannelSelectorConfiguration> clazz; ChannelSelectorConfiguration instance = null; try { // Components where it is null, no configuration is necessary. if (this.selectorType != null) { clazz = (Class<? extends ChannelSelectorConfiguration>) Class .forName(this.selectorType); instance = clazz.getConstructor(String.class).newInstance(name); } else { return new ChannelSelectorConfiguration(name); } } catch (ClassNotFoundException e) { // Could not find the configuration stub, do basic validation instance = new ChannelSelectorConfiguration(name); // Let the caller know that this was created because of this exception. instance.setNotFoundConfigClass(); } catch (Exception e) { throw new ConfigurationException("Configuration error!", e); } return instance; }
addError(sinkgroupName, CONFIG_ERROR, ERROR); if (conf != null) errorList.addAll(conf.getErrors()); throw new ConfigurationException( "No available sinks for sinkgroup: " + sinkgroupName + ". Sinkgroup will be removed");
throw new ConfigurationException("Error creating configuration", e);
throw new ConfigurationException("Bootstrap Servers must be specified");
String brokerList = ctx.getString(BROKER_LIST_FLUME_KEY); if (brokerList == null || brokerList.isEmpty()) { throw new ConfigurationException("Bootstrap Servers must be specified"); } else { ctx.put(BOOTSTRAP_SERVERS_CONFIG, brokerList);
throw new ConfigurationException("Bootstrap Servers must be specified");
String brokerList = ctx.getString(BROKER_LIST_FLUME_KEY); if (brokerList == null || brokerList.isEmpty()) { throw new ConfigurationException("Bootstrap Servers must be specified"); } else { ctx.put(BOOTSTRAP_SERVERS_CONFIG, brokerList);
@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()); } }