Search in sources :

Example 11 with ComponentConfigException

use of com.hortonworks.streamline.common.exception.ComponentConfigException in project streamline by hortonworks.

the class CustomProcessorBoltFluxComponent method validateConfig.

@Override
public void validateConfig() throws ComponentConfigException {
    super.validateConfig();
    validateStringFields();
    String fieldToValidate = TopologyLayoutConstants.JSON_KEY_OUTPUT_STREAMS_SCHEMA;
    try {
        Map<String, Map> outputSchema = (Map) conf.get(fieldToValidate);
        if (outputSchema == null || outputSchema.keySet().isEmpty()) {
            throw new ComponentConfigException(String.format(TopologyLayoutConstants.ERR_MSG_MISSING_INVALID_CONFIG, fieldToValidate));
        }
        for (Map.Entry<String, Map> entry : outputSchema.entrySet()) {
            Utils.getSchemaFromConfig(entry.getValue());
        }
        this.validateCustomConfigFields();
    } catch (ClassCastException | IOException e) {
        throw new ComponentConfigException(String.format(TopologyLayoutConstants.ERR_MSG_MISSING_INVALID_CONFIG, fieldToValidate));
    }
}
Also used : ComponentConfigException(com.hortonworks.streamline.common.exception.ComponentConfigException) IOException(java.io.IOException) Map(java.util.Map) HashMap(java.util.HashMap)

Aggregations

ComponentConfigException (com.hortonworks.streamline.common.exception.ComponentConfigException)11 Map (java.util.Map)10 List (java.util.List)6 IOException (java.io.IOException)4 ArrayList (java.util.ArrayList)2 HashSet (java.util.HashSet)2 LinkedHashMap (java.util.LinkedHashMap)2 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1 Schema (com.hortonworks.registries.common.Schema)1 CustomProcessorInfo (com.hortonworks.streamline.streams.catalog.processor.CustomProcessorInfo)1 BufferedInputStream (java.io.BufferedInputStream)1 ByteArrayInputStream (java.io.ByteArrayInputStream)1 File (java.io.File)1 FileInputStream (java.io.FileInputStream)1 InputStream (java.io.InputStream)1 NoSuchAlgorithmException (java.security.NoSuchAlgorithmException)1 HashMap (java.util.HashMap)1 TarArchiveInputStream (org.apache.commons.compress.archivers.tar.TarArchiveInputStream)1