当前位置: 首页>>代码示例>>Java>>正文


Java ConfigReader类代码示例

本文整理汇总了Java中org.wso2.siddhi.core.util.config.ConfigReader的典型用法代码示例。如果您正苦于以下问题:Java ConfigReader类的具体用法?Java ConfigReader怎么用?Java ConfigReader使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ConfigReader类属于org.wso2.siddhi.core.util.config包,在下文中一共展示了ConfigReader类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: init

import org.wso2.siddhi.core.util.config.ConfigReader; //导入依赖的package包/类
/**
 * Initialize the mapper and the mapping configurations.
 *
 * @param streamDefinition          The stream definition
 * @param optionHolder              Option holder containing static and dynamic options
 * @param payloadTemplateBuilderMap Unmapped list of payloads for reference
 */
@Override
public void init(StreamDefinition streamDefinition, OptionHolder optionHolder,
                 Map<String, TemplateBuilder> payloadTemplateBuilderMap, ConfigReader mapperConfigReader,
                 SiddhiAppContext siddhiAppContext) {

    attributeNameArray = streamDefinition.getAttributeNameArray();
    enclosingElement = optionHolder.validateAndGetStaticValue(ENCLOSING_ELEMENT_IDENTIFIER, null);
    isJsonValidationEnabled = Boolean.parseBoolean(optionHolder
            .validateAndGetStaticValue(JSON_VALIDATION_IDENTIFIER, "false"));

    //if @payload() is added there must be at least 1 element in it, otherwise a SiddhiParserException raised
    if (payloadTemplateBuilderMap != null && payloadTemplateBuilderMap.size() != 1) {
        throw new SiddhiAppCreationException("Json sink-mapper does not support multiple @payload mappings, " +
                "error at the mapper of '" + streamDefinition.getId() + "'");
    }
    if (payloadTemplateBuilderMap != null &&
            payloadTemplateBuilderMap.get(payloadTemplateBuilderMap.keySet().iterator().next()).isObjectMessage()) {
        throw new SiddhiAppCreationException("Json sink-mapper does not support object @payload mappings, " +
                "error at the mapper of '" + streamDefinition.getId() + "'");
    }
}
 
开发者ID:wso2-extensions,项目名称:siddhi-map-json,代码行数:29,代码来源:JsonSinkMapper.java

示例2: getSenderConfigurations

import org.wso2.siddhi.core.util.config.ConfigReader; //导入依赖的package包/类
/**
 * Method is responsible for set sender configuration values .
 *
 * @param httpStaticProperties the map that url details.
 * @param clientStoreFile      the client trust store file path.
 * @param clientStorePass      the client trust store pass path.
 * @return set of sender configurations.
 */
public static SenderConfiguration getSenderConfigurations(Map<String, String> httpStaticProperties, String
        clientStoreFile, String clientStorePass, ConfigReader configReader) {
    SenderConfiguration httpSender = new SenderConfiguration(httpStaticProperties
            .get(HttpConstants.PORT));
    if (httpStaticProperties.get(HttpConstants.SCHEME).equals(HttpConstants.SCHEME_HTTPS)) {
        httpSender.setTrustStoreFile(clientStoreFile);
        httpSender.setTrustStorePass(clientStorePass);
        httpSender.setId(httpStaticProperties.get(HttpConstants.TO));
        httpSender.setScheme(httpStaticProperties.get(HttpConstants.SCHEME));
    } else {
        httpSender.setScheme(httpStaticProperties.get(HttpConstants.SCHEME));
    }
    if (isHTTPTraceLoggerEnabled(configReader)) {
        httpSender.setHttpTraceLogEnabled(true);
    }
    return httpSender;
}
 
开发者ID:wso2-extensions,项目名称:siddhi-io-http,代码行数:26,代码来源:HttpSinkUtil.java

示例3: initBootstrapConfigIfFirst

import org.wso2.siddhi.core.util.config.ConfigReader; //导入依赖的package包/类
/**
 * Initialize and start the server connector factory. This should be created at once for siddhi.
 *
 * @param sourceConfigReader the siddhi source config reader.
 */
synchronized void initBootstrapConfigIfFirst(ConfigReader sourceConfigReader) {
    // to make sure it will create only once
    if ((this.sourceListenersMap.isEmpty()) && (httpConnectorFactory == null)) {
        String bootstrapWorker = sourceConfigReader.readConfig(HttpConstants
                .SERVER_BOOTSTRAP_WORKER_GROUP_SIZE, HttpConstants.SERVER_BOOTSTRAP_WORKER_GROUP_SIZE_VALUE);
        String bootstrapBoss = sourceConfigReader.readConfig(HttpConstants
                .SERVER_BOOTSTRAP_BOSS_GROUP_SIZE, HttpConstants.SERVER_BOOTSTRAP_BOSS_GROUP_SIZE_VALUE);
        if (!HttpConstants.EMPTY_STRING.equals(bootstrapBoss) && !HttpConstants.EMPTY_STRING.equals
                (bootstrapWorker)) {
            httpConnectorFactory = new HttpWsConnectorFactoryImpl(Integer.parseInt(bootstrapBoss), Integer
                    .parseInt(bootstrapWorker));
        } else {
            httpConnectorFactory = new HttpWsConnectorFactoryImpl();
        }
    }
}
 
开发者ID:wso2-extensions,项目名称:siddhi-io-http,代码行数:22,代码来源:HttpConnectorRegistry.java

示例4: init

import org.wso2.siddhi.core.util.config.ConfigReader; //导入依赖的package包/类
/**
 * The initialization method for FunctionExecutor, this method will be called before the other methods
 *  @param attributeExpressionExecutors are the executors of each function parameters
 * @param configReader
 * @param siddhiAppContext         the context of the siddhi app
 */
@Override
protected void init(ExpressionExecutor[] attributeExpressionExecutors, ConfigReader configReader,
                    SiddhiAppContext siddhiAppContext) {
    for (ExpressionExecutor expressionExecutor : attributeExpressionExecutors) {
        Attribute.Type attributeType = expressionExecutor.getReturnType();
        if (attributeType == Attribute.Type.DOUBLE) {
            returnType = attributeType;

        } else if ((attributeType == Attribute.Type.STRING) || (attributeType == Attribute.Type.BOOL)) {
            throw new SiddhiAppCreationException("Plus cannot have parameters with types String or Bool");
        } else {
            returnType = Attribute.Type.LONG;
        }
    }
}
 
开发者ID:wso2,项目名称:siddhi,代码行数:22,代码来源:CustomFunctionExtension.java

示例5: init

import org.wso2.siddhi.core.util.config.ConfigReader; //导入依赖的package包/类
public final void init(StreamDefinition streamDefinition,
                       String type,
                       OptionHolder mapOptionHolder,
                       List<Element> unmappedPayloadList,
                       Sink sink, ConfigReader mapperConfigReader,
                       LatencyTracker mapperLatencyTracker,
                       SiddhiAppContext siddhiAppContext) {
    this.mapperLatencyTracker = mapperLatencyTracker;
    this.siddhiAppContext = siddhiAppContext;
    sink.setTrpDynamicOptions(trpDynamicOptions);
    this.sinkListener = sink;
    this.optionHolder = mapOptionHolder;
    this.type = type;
    if (unmappedPayloadList != null && !unmappedPayloadList.isEmpty()) {
        templateBuilderMap = new HashMap<>();
        for (Element e : unmappedPayloadList) {
            TemplateBuilder templateBuilder = new TemplateBuilder(streamDefinition, e.getValue());
            if (templateBuilderMap.containsKey(e.getKey())) {
                throw new SiddhiAppCreationException("Duplicate Keys, " + e.getKey() + ", in @payload() ");
            }
            templateBuilderMap.put(e.getKey(), templateBuilder);
        }
    }

    init(streamDefinition, mapOptionHolder, templateBuilderMap, mapperConfigReader, siddhiAppContext);
}
 
开发者ID:wso2,项目名称:siddhi,代码行数:27,代码来源:SinkMapper.java

示例6: init

import org.wso2.siddhi.core.util.config.ConfigReader; //导入依赖的package包/类
/**
 * Initialize the Distribution strategy with the information it will require to make decisions.
 *  @param streamDefinition         The stream attached to the sink this DistributionStrategy is used in
 * @param transportOptionHolder    Sink options of the sink which uses this DistributionStrategy
 * @param destinationOptionHolders The list of options under @destination of the relevant sink.
 * @param configReader This hold the {@link PartitionedDistributionStrategy} configuration reader.
 */
@Override
public void init(StreamDefinition streamDefinition, OptionHolder transportOptionHolder,
                 OptionHolder distributionOptionHolder, List<OptionHolder> destinationOptionHolders,
                 ConfigReader configReader) {
    totalDestinationCount = destinationOptionHolders.size();
    String partitionKey = distributionOptionHolder.validateAndGetStaticValue(SiddhiConstants
            .PARTITION_KEY_FIELD_KEY);

    if (partitionKey == null || partitionKey.isEmpty()) {
        throw new SiddhiAppValidationException("PartitionKey is required for partitioned distribution " +
                "strategy.");
    }
    try {
        int partitionKeyFieldPosition = streamDefinition.getAttributePosition(partitionKey);
        partitionOption = new Option(partitionKeyFieldPosition);
    } catch (AttributeNotExistException e) {
        throw new SiddhiAppValidationException("Could not find partition key attribute", e);
    }

}
 
开发者ID:wso2,项目名称:siddhi,代码行数:28,代码来源:PartitionedDistributionStrategy.java

示例7: init

import org.wso2.siddhi.core.util.config.ConfigReader; //导入依赖的package包/类
public final void init(String sourceType, OptionHolder transportOptionHolder, SourceMapper sourceMapper,
                       String[] transportPropertyNames, ConfigReader configReader, String mapType,
                       OptionHolder mapOptionHolder, List<AttributeMapping> attributeMappings,
                       List<AttributeMapping> transportMappings, ConfigReader mapperConfigReader,
                       SourceHandler sourceHandler, StreamDefinition streamDefinition,
                       SiddhiAppContext siddhiAppContext) {
    this.type = sourceType;
    sourceMapper.init(streamDefinition, mapType, mapOptionHolder, attributeMappings, sourceType, transportMappings,
            sourceHandler, mapperConfigReader, siddhiAppContext);
    this.mapper = sourceMapper;
    this.streamDefinition = streamDefinition;
    this.elementId = siddhiAppContext.getElementIdGenerator().createNewId();
    this.siddhiAppContext = siddhiAppContext;
    init(sourceMapper, transportOptionHolder, transportPropertyNames, configReader, siddhiAppContext);
    scheduledExecutorService = siddhiAppContext.getScheduledExecutorService();
}
 
开发者ID:wso2,项目名称:siddhi,代码行数:17,代码来源:Source.java

示例8: init

import org.wso2.siddhi.core.util.config.ConfigReader; //导入依赖的package包/类
public final void init(StreamDefinition streamDefinition, String mapType, OptionHolder mapOptionHolder,
                       List<AttributeMapping> attributeMappings, String sourceType,
                       List<AttributeMapping> transportMappings, SourceHandler sourceHandler,
                       ConfigReader configReader, SiddhiAppContext siddhiAppContext) {
    this.streamDefinition = streamDefinition;
    this.mapType = mapType;
    this.sourceType = sourceType;
    this.transportMappings = transportMappings;
    if (sourceHandler != null) {
        sourceHandler.initSourceHandler(siddhiAppContext.getElementIdGenerator().createNewId(), streamDefinition);
    }
    this.sourceHandler = sourceHandler;
    this.siddhiAppContext = siddhiAppContext;
    if (siddhiAppContext.getStatisticsManager() != null) {
        this.throughputTracker = QueryParserHelper.createThroughputTracker(siddhiAppContext,
                streamDefinition.getId(),
                SiddhiConstants.METRIC_INFIX_SOURCES, sourceType);
        this.mapperLatencyTracker = QueryParserHelper.createLatencyTracker(siddhiAppContext,
                streamDefinition.getId(),
                SiddhiConstants.METRIC_INFIX_SOURCE_MAPPERS,
                sourceType + SiddhiConstants.METRIC_DELIMITER + mapType);
    }
    init(streamDefinition, mapOptionHolder, attributeMappings, configReader, siddhiAppContext);
}
 
开发者ID:wso2,项目名称:siddhi,代码行数:25,代码来源:SourceMapper.java

示例9: init

import org.wso2.siddhi.core.util.config.ConfigReader; //导入依赖的package包/类
@Override
public void init(SourceEventListener sourceEventListener, OptionHolder optionHolder,
                 String[] requestedTransportPropertyNames, ConfigReader configReader,
                 SiddhiAppContext siddhiAppContext) {
    this.sourceEventListener = sourceEventListener;
    String topic = optionHolder.validateAndGetStaticValue(TOPIC_KEY, "input inMemory source");
    this.subscriber = new InMemoryBroker.Subscriber() {
        @Override
        public void onMessage(Object event) {
            sourceEventListener.onEvent(event, null);
        }

        @Override
        public String getTopic() {
            return topic;
        }
    };
}
 
开发者ID:wso2,项目名称:siddhi,代码行数:19,代码来源:InMemorySource.java

示例10: init

import org.wso2.siddhi.core.util.config.ConfigReader; //导入依赖的package包/类
/**
 * The initialization method for FunctionExecutor
 *
 * @param attributeExpressionExecutors are the executors of each attributes in the function
 * @param configReader                 this hold the {@link MinForeverAttributeAggregator} configuration reader.
 * @param siddhiAppContext             Siddhi app runtime context
 */
@Override
protected void init(ExpressionExecutor[] attributeExpressionExecutors, ConfigReader configReader,
                    SiddhiAppContext siddhiAppContext) {
    if (attributeExpressionExecutors.length != 1) {
        throw new OperationNotSupportedException("MinForever aggregator has to have exactly 1 parameter, " +
                "currently " + attributeExpressionExecutors.length + " parameters provided");
    }
    Attribute.Type type = attributeExpressionExecutors[0].getReturnType();
    switch (type) {
        case FLOAT:
            minForeverAttributeAggregator = new MinForeverAttributeAggregatorFloat();
            break;
        case INT:
            minForeverAttributeAggregator = new MinForeverAttributeAggregatorInt();
            break;
        case LONG:
            minForeverAttributeAggregator = new MinForeverAttributeAggregatorLong();
            break;
        case DOUBLE:
            minForeverAttributeAggregator = new MinForeverAttributeAggregatorDouble();
            break;
        default:
            throw new OperationNotSupportedException("MinForever not supported for " + type);
    }
}
 
开发者ID:wso2,项目名称:siddhi,代码行数:33,代码来源:MinForeverAttributeAggregator.java

示例11: init

import org.wso2.siddhi.core.util.config.ConfigReader; //导入依赖的package包/类
/**
 * The initialization method for FunctionExecutor
 *
 * @param attributeExpressionExecutors are the executors of each attributes in the function
 * @param configReader                 this hold the {@link MaxAttributeAggregator} configuration reader.
 * @param siddhiAppContext             Siddhi app runtime context
 */
@Override
protected void init(ExpressionExecutor[] attributeExpressionExecutors, ConfigReader configReader,
                    SiddhiAppContext siddhiAppContext) {
    if (attributeExpressionExecutors.length != 1) {
        throw new OperationNotSupportedException("Max aggregator has to have exactly 1 parameter, currently " +
                attributeExpressionExecutors.length + " parameters provided");
    }
    Attribute.Type type = attributeExpressionExecutors[0].getReturnType();
    switch (type) {
        case FLOAT:
            maxOutputAttributeAggregator = new MaxAttributeAggregatorFloat();
            break;
        case INT:
            maxOutputAttributeAggregator = new MaxAttributeAggregatorInt();
            break;
        case LONG:
            maxOutputAttributeAggregator = new MaxAttributeAggregatorLong();
            break;
        case DOUBLE:
            maxOutputAttributeAggregator = new MaxAttributeAggregatorDouble();
            break;
        default:
            throw new OperationNotSupportedException("Max not supported for " + type);
    }
}
 
开发者ID:wso2,项目名称:siddhi,代码行数:33,代码来源:MaxAttributeAggregator.java

示例12: init

import org.wso2.siddhi.core.util.config.ConfigReader; //导入依赖的package包/类
/**
 * The initialization method for FunctionExecutor
 *
 * @param attributeExpressionExecutors are the executors of each attributes in the function
 * @param configReader                 this hold the {@link AvgAttributeAggregator} configuration reader.
 * @param siddhiAppContext             Siddhi app runtime context
 */
@Override
protected void init(ExpressionExecutor[] attributeExpressionExecutors, ConfigReader configReader,
                    SiddhiAppContext siddhiAppContext) {
    if (attributeExpressionExecutors.length != 1) {
        throw new OperationNotSupportedException("Avg aggregator has to have exactly 1 parameter, currently " +
                attributeExpressionExecutors.length + " parameters provided");
    }
    Attribute.Type type = attributeExpressionExecutors[0].getReturnType();
    switch (type) {
        case FLOAT:
            avgOutputAttributeAggregator = new AvgAttributeAggregatorFloat();
            break;
        case INT:
            avgOutputAttributeAggregator = new AvgAttributeAggregatorInt();
            break;
        case LONG:
            avgOutputAttributeAggregator = new AvgAttributeAggregatorLong();
            break;
        case DOUBLE:
            avgOutputAttributeAggregator = new AvgAttributeAggregatorDouble();
            break;
        default:
            throw new OperationNotSupportedException("Avg not supported for " + type);
    }
}
 
开发者ID:wso2,项目名称:siddhi,代码行数:33,代码来源:AvgAttributeAggregator.java

示例13: initAggregator

import org.wso2.siddhi.core.util.config.ConfigReader; //导入依赖的package包/类
public void initAggregator(ExpressionExecutor[] attributeExpressionExecutors, SiddhiAppContext
            siddhiAppContext, ConfigReader configReader) {
        this.configReader = configReader;
        try {
            this.siddhiAppContext = siddhiAppContext;
            this.attributeExpressionExecutors = attributeExpressionExecutors;
            this.attributeSize = attributeExpressionExecutors.length;
            if (elementId == null) {
                elementId = "AttributeAggregator-" + siddhiAppContext.getElementIdGenerator().createNewId();
            }
            //Not added to Snapshotable as the AggregationAttributeExecutors are added
//            siddhiAppContext.getSnapshotService().addSnapshotable(this);
            init(attributeExpressionExecutors, configReader, siddhiAppContext);
        } catch (Throwable t) {
            throw new SiddhiAppCreationException(t);
        }
    }
 
开发者ID:wso2,项目名称:siddhi,代码行数:18,代码来源:AttributeAggregator.java

示例14: init

import org.wso2.siddhi.core.util.config.ConfigReader; //导入依赖的package包/类
/**
 * The initialization method for FunctionExecutor
 *
 * @param attributeExpressionExecutors are the executors of each attributes in the function
 * @param configReader                 this hold the {@link MinAttributeAggregator} configuration reader.
 * @param siddhiAppContext             Siddhi app runtime context
 */
@Override
protected void init(ExpressionExecutor[] attributeExpressionExecutors, ConfigReader configReader,
                    SiddhiAppContext siddhiAppContext) {
    if (attributeExpressionExecutors.length != 1) {
        throw new OperationNotSupportedException("Min aggregator has to have exactly 1 parameter, currently " +
                attributeExpressionExecutors.length + " parameters provided");
    }
    Attribute.Type type = attributeExpressionExecutors[0].getReturnType();
    switch (type) {
        case FLOAT:
            minOutputAttributeAggregator = new MinAttributeAggregatorFloat();
            break;
        case INT:
            minOutputAttributeAggregator = new MinAttributeAggregatorInt();
            break;
        case LONG:
            minOutputAttributeAggregator = new MinAttributeAggregatorLong();
            break;
        case DOUBLE:
            minOutputAttributeAggregator = new MinAttributeAggregatorDouble();
            break;
        default:
            throw new OperationNotSupportedException("Min not supported for " + type);
    }
}
 
开发者ID:wso2,项目名称:siddhi,代码行数:33,代码来源:MinAttributeAggregator.java

示例15: init

import org.wso2.siddhi.core.util.config.ConfigReader; //导入依赖的package包/类
@Override
protected void init(ExpressionExecutor[] attributeExpressionExecutors, ConfigReader configReader, boolean
        outputExpectsExpiredEvents, SiddhiAppContext siddhiAppContext) {
    support = Double.parseDouble(String.valueOf(((ConstantExpressionExecutor) attributeExpressionExecutors[0])
            .getValue()));
    if (attributeExpressionExecutors.length > 1) {
        error = Double.parseDouble(String.valueOf(((ConstantExpressionExecutor) attributeExpressionExecutors[1])
                .getValue()));
    } else {
        error = support / 10; // recommended error is 10% of 20$ of support value;
    }
    if ((support > 1 || support < 0) || (error > 1 || error < 0)) {
        log.error("Wrong argument has provided, Error executing the window");
    }
    variableExpressionExecutors = new VariableExpressionExecutor[attributeExpressionExecutors.length - 2];
    if (attributeExpressionExecutors.length > 2) {  // by-default all the attributes will be compared
        for (int i = 2; i < attributeExpressionExecutors.length; i++) {
            variableExpressionExecutors[i - 2] = (VariableExpressionExecutor) attributeExpressionExecutors[i];
        }
    }
    windowWidth = Math.ceil(1 / error);
    currentBucketId = 1;
}
 
开发者ID:wso2,项目名称:siddhi,代码行数:24,代码来源:LossyFrequentWindowProcessor.java


注:本文中的org.wso2.siddhi.core.util.config.ConfigReader类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。