flink-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From apivovarov <...@git.apache.org>
Subject [GitHub] flink pull request #2487: [FLINK-4520][flink-siddhi] Integrate Siddhi as a l...
Date Sat, 10 Sep 2016 04:12:42 GMT
Github user apivovarov commented on a diff in the pull request:

    https://github.com/apache/flink/pull/2487#discussion_r78270750
  
    --- Diff: flink-contrib/flink-siddhi/src/main/java/org/apache/flink/contrib/siddhi/SiddhiCEP.java
---
    @@ -0,0 +1,118 @@
    +/*
    + * Licensed to the Apache Software Foundation (ASF) under one or more
    + * contributor license agreements.  See the NOTICE file distributed with
    + * this work for additional information regarding copyright ownership.
    + * The ASF licenses this file to You under the Apache License, Version 2.0
    + * (the "License"); you may not use this file except in compliance with
    + * the License.  You may obtain a copy of the License at
    + * <p/>
    + * http://www.apache.org/licenses/LICENSE-2.0
    + * <p/>
    + * Unless required by applicable law or agreed to in writing, software
    + * distributed under the License is distributed on an "AS IS" BASIS,
    + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    + * See the License for the specific language governing permissions and
    + * limitations under the License.
    + */
    +
    +package org.apache.flink.contrib.siddhi;
    +
    +import org.apache.flink.annotation.PublicEvolving;
    +import org.apache.flink.contrib.siddhi.exception.DuplicatedStreamException;
    +import org.apache.flink.contrib.siddhi.exception.UndefinedStreamException;
    +import org.apache.flink.contrib.siddhi.schema.SiddhiStreamSchema;
    +import org.apache.flink.streaming.api.datastream.DataStream;
    +import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;
    +
    +import java.util.HashMap;
    +import java.util.Map;
    +
    +/**
    + * Siddhi CEP Execution Environment
    + */
    +@PublicEvolving
    +public class SiddhiCEP {
    +	private final StreamExecutionEnvironment executionEnvironment;
    +	private final Map<String, DataStream<?>> dataStreams;
    +	private final Map<String, SiddhiStreamSchema<?>> dataStreamSchemas;
    +	private final Map<String,Class<?>> extensions = new HashMap<>();
    +
    +	public Map<String, DataStream<?>> getDataStreams(){
    +		return this.dataStreams;
    +	}
    +
    +	public Map<String, SiddhiStreamSchema<?>> getDataStreamSchemas(){
    +		return this.dataStreamSchemas;
    +	}
    +
    +	public boolean isStreamDefined(String streamId){
    +		return dataStreams.containsKey(streamId);
    +	}
    +
    +	public Map<String,Class<?>> getExtensions(){
    +		return this.extensions;
    +	}
    +
    +	public void checkStreamDefined(String streamId) throws UndefinedStreamException {
    +		if(!isStreamDefined(streamId)){
    +			throw new UndefinedStreamException("Stream (streamId: "+streamId+") not defined");
    +		}
    +	}
    +
    +	public SiddhiCEP(StreamExecutionEnvironment streamExecutionEnvironment) {
    +		this.executionEnvironment = streamExecutionEnvironment;
    +		this.dataStreams = new HashMap<>();
    +		this.dataStreamSchemas = new HashMap<>();
    --- End diff --
    
    lines 64 and 65 can be removed.
    Add `= new HashMap<>();` to lines 36 and 37 similar as it was done on line 38


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message