Search in sources :

Example 1 with ID

use of org.wso2.carbon.idp.mgt.util.IdPManagementConstants.ID in project siddhi by wso2.

the class PartitionRuntime method addQuery.

public QueryRuntime addQuery(QueryRuntime metaQueryRuntime) {
    Query query = metaQueryRuntime.getQuery();
    if (query.getOutputStream() instanceof InsertIntoStream && metaQueryRuntime.getOutputCallback() instanceof InsertIntoStreamCallback) {
        InsertIntoStreamCallback insertIntoStreamCallback = (InsertIntoStreamCallback) metaQueryRuntime.getOutputCallback();
        StreamDefinition streamDefinition = insertIntoStreamCallback.getOutputStreamDefinition();
        String id = streamDefinition.getId();
        if (((InsertIntoStream) query.getOutputStream()).isInnerStream()) {
            metaQueryRuntime.setToLocalStream(true);
            localStreamDefinitionMap.putIfAbsent(id, streamDefinition);
            DefinitionParserHelper.validateOutputStream(streamDefinition, localStreamDefinitionMap.get(id));
            StreamJunction outputStreamJunction = localStreamJunctionMap.get(id);
            if (outputStreamJunction == null) {
                outputStreamJunction = new StreamJunction(streamDefinition, siddhiAppContext.getExecutorService(), siddhiAppContext.getBufferSize(), siddhiAppContext);
                localStreamJunctionMap.putIfAbsent(id, outputStreamJunction);
            }
            insertIntoStreamCallback.init(localStreamJunctionMap.get(id));
        } else {
            streamDefinitionMap.putIfAbsent(id, streamDefinition);
            DefinitionParserHelper.validateOutputStream(streamDefinition, streamDefinitionMap.get(id));
            StreamJunction outputStreamJunction = streamJunctionMap.get(id);
            if (outputStreamJunction == null) {
                outputStreamJunction = new StreamJunction(streamDefinition, siddhiAppContext.getExecutorService(), siddhiAppContext.getBufferSize(), siddhiAppContext);
                streamJunctionMap.putIfAbsent(id, outputStreamJunction);
            }
            insertIntoStreamCallback.init(streamJunctionMap.get(id));
        }
    }
    metaQueryRuntimeMap.put(metaQueryRuntime.getQueryId(), metaQueryRuntime);
    return metaQueryRuntime;
}
Also used : Query(org.wso2.siddhi.query.api.execution.query.Query) StreamDefinition(org.wso2.siddhi.query.api.definition.StreamDefinition) InsertIntoStream(org.wso2.siddhi.query.api.execution.query.output.stream.InsertIntoStream) StreamJunction(org.wso2.siddhi.core.stream.StreamJunction) InsertIntoStreamCallback(org.wso2.siddhi.core.query.output.callback.InsertIntoStreamCallback)

Example 2 with ID

use of org.wso2.carbon.idp.mgt.util.IdPManagementConstants.ID in project siddhi by wso2.

the class InputManager method constructInputHandler.

public InputHandler constructInputHandler(String streamId) {
    InputHandler inputHandler = new InputHandler(streamId, inputHandlerMap.size(), inputEntryValve);
    StreamJunction streamJunction = streamJunctionMap.get(streamId);
    if (streamJunction == null) {
        throw new DefinitionNotExistException("Stream with stream ID " + streamId + " has not been defined");
    }
    inputDistributor.addInputProcessor(streamJunctionMap.get(streamId).constructPublisher());
    inputHandlerMap.put(streamId, inputHandler);
    return inputHandler;
}
Also used : StreamJunction(org.wso2.siddhi.core.stream.StreamJunction) DefinitionNotExistException(org.wso2.siddhi.core.exception.DefinitionNotExistException)

Example 3 with ID

use of org.wso2.carbon.idp.mgt.util.IdPManagementConstants.ID in project siddhi by wso2.

the class QuerySelector method clone.

public QuerySelector clone(String key) {
    QuerySelector clonedQuerySelector = new QuerySelector(id + key, selector, currentOn, expiredOn, siddhiAppContext);
    List<AttributeProcessor> clonedAttributeProcessorList = new ArrayList<AttributeProcessor>();
    for (AttributeProcessor attributeProcessor : attributeProcessorList) {
        clonedAttributeProcessorList.add(attributeProcessor.cloneProcessor(key));
    }
    clonedQuerySelector.attributeProcessorList = clonedAttributeProcessorList;
    clonedQuerySelector.isGroupBy = isGroupBy;
    clonedQuerySelector.containsAggregator = containsAggregator;
    clonedQuerySelector.groupByKeyGenerator = groupByKeyGenerator;
    clonedQuerySelector.havingConditionExecutor = havingConditionExecutor;
    clonedQuerySelector.eventPopulator = eventPopulator;
    clonedQuerySelector.batchingEnabled = batchingEnabled;
    clonedQuerySelector.isOrderBy = isOrderBy;
    clonedQuerySelector.orderByEventComparator = orderByEventComparator;
    clonedQuerySelector.limit = limit;
    return clonedQuerySelector;
}
Also used : ArrayList(java.util.ArrayList) AttributeProcessor(org.wso2.siddhi.core.query.selector.attribute.processor.AttributeProcessor)

Example 4 with ID

use of org.wso2.carbon.idp.mgt.util.IdPManagementConstants.ID in project siddhi by wso2.

the class ExpressionBuilder method buildStreamVariableExecutor.

private void buildStreamVariableExecutor(Variable variable, int streamEventChainIndex, ExpressionVisitor expressionVisitor, Attribute.Type type) {
    String id = variable.getAttributeName();
    if (variable.getStreamId() != null) {
        id = variable.getStreamId() + "." + id;
    }
    expressionVisitor.beginVisitStreamVariable(id, variable.getStreamId(), variable.getAttributeName(), type);
    if (!variableExpressionExecutorMap.containsKey(id)) {
        ExpressionExecutor variableExpressionExecutor = ExpressionParser.parseExpression(variable, matchingMetaInfoHolder.getMetaStateEvent(), streamEventChainIndex, tableMap, variableExpressionExecutors, siddhiAppContext, false, 0, queryName);
        variableExpressionExecutorMap.put(id, variableExpressionExecutor);
    }
    expressionVisitor.endVisitStreamVariable(id, variable.getStreamId(), variable.getAttributeName(), type);
}
Also used : VariableExpressionExecutor(org.wso2.siddhi.core.executor.VariableExpressionExecutor) ExpressionExecutor(org.wso2.siddhi.core.executor.ExpressionExecutor)

Example 5 with ID

use of org.wso2.carbon.idp.mgt.util.IdPManagementConstants.ID in project siddhi by wso2.

the class OutputParser method constructOutputCallback.

public static OutputCallback constructOutputCallback(OutputStream outStream, String key, ConcurrentMap<String, StreamJunction> streamJunctionMap, StreamDefinition outputStreamDefinition, SiddhiAppContext siddhiAppContext, String queryName) {
    String id = outStream.getId();
    // Construct CallBack
    if (outStream instanceof InsertIntoStream) {
        StreamJunction outputStreamJunction = streamJunctionMap.get(id + key);
        if (outputStreamJunction == null) {
            outputStreamJunction = new StreamJunction(outputStreamDefinition, siddhiAppContext.getExecutorService(), siddhiAppContext.getBufferSize(), siddhiAppContext);
            streamJunctionMap.putIfAbsent(id + key, outputStreamJunction);
        }
        InsertIntoStreamCallback insertIntoStreamCallback = new InsertIntoStreamCallback(outputStreamDefinition, queryName);
        insertIntoStreamCallback.init(streamJunctionMap.get(id + key));
        return insertIntoStreamCallback;
    } else {
        throw new SiddhiAppCreationException(outStream.getClass().getName() + " not supported", outStream.getQueryContextStartIndex(), outStream.getQueryContextEndIndex());
    }
}
Also used : SiddhiAppCreationException(org.wso2.siddhi.core.exception.SiddhiAppCreationException) InsertIntoStream(org.wso2.siddhi.query.api.execution.query.output.stream.InsertIntoStream) StreamJunction(org.wso2.siddhi.core.stream.StreamJunction) InsertIntoStreamCallback(org.wso2.siddhi.core.query.output.callback.InsertIntoStreamCallback)

Aggregations

PreparedStatement (java.sql.PreparedStatement)311 SQLException (java.sql.SQLException)307 Test (org.testng.annotations.Test)278 Connection (java.sql.Connection)266 ArrayList (java.util.ArrayList)261 ResultSet (java.sql.ResultSet)238 HashMap (java.util.HashMap)229 APIManagementException (org.wso2.carbon.apimgt.api.APIManagementException)224 Map (java.util.Map)113 API (org.wso2.carbon.apimgt.core.models.API)108 IdentityOAuth2Exception (org.wso2.carbon.identity.oauth2.IdentityOAuth2Exception)108 UserStoreException (org.wso2.carbon.user.api.UserStoreException)107 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)102 APIManagementException (org.wso2.carbon.apimgt.core.exception.APIManagementException)97 HashSet (java.util.HashSet)84 IOException (java.io.IOException)78 RegistryException (org.wso2.carbon.registry.core.exceptions.RegistryException)71 SCIMResourceTypeSchema (org.wso2.charon3.core.schema.SCIMResourceTypeSchema)71 APIMgtDAOException (org.wso2.carbon.apimgt.core.exception.APIMgtDAOException)69 SCIMResponse (org.wso2.charon3.core.protocol.SCIMResponse)64