diff --git a/flink-contrib/flink-streaming-contrib/pom.xml b/flink-contrib/flink-streaming-contrib/pom.xml index e60833413d3ab..88ecf2003151b 100644 --- a/flink-contrib/flink-streaming-contrib/pom.xml +++ b/flink-contrib/flink-streaming-contrib/pom.xml @@ -42,6 +42,11 @@ under the License. flink-streaming-java_2.10 ${project.version} + + org.apache.flink + flink-streaming-scala_2.10 + ${project.version} + org.apache.flink flink-clients_2.10 @@ -79,4 +84,136 @@ under the License. + + + + + net.alchim31.maven + scala-maven-plugin + 3.1.4 + + + + scala-compile-first + process-resources + + compile + + + + + + scala-test-compile + process-test-resources + + testCompile + + + + + + -Xms128m + -Xmx512m + + + + org.scalamacros + paradise_${scala.version} + ${scala.macros.version} + + + + + + + + org.apache.maven.plugins + maven-eclipse-plugin + 2.8 + + true + + org.scala-ide.sdt.core.scalanature + org.eclipse.jdt.core.javanature + + + org.scala-ide.sdt.core.scalabuilder + + + org.scala-ide.sdt.launching.SCALA_CONTAINER + org.eclipse.jdt.launching.JRE_CONTAINER + + + org.scala-lang:scala-library + org.scala-lang:scala-compiler + + + **/*.scala + **/*.java + + + + + + + org.codehaus.mojo + build-helper-maven-plugin + 1.7 + + + + add-source + generate-sources + + add-source + + + + src/main/scala + + + + + + add-test-source + generate-test-sources + + add-test-source + + + + src/test/scala + + + + + + + + org.scalastyle + scalastyle-maven-plugin + 0.5.0 + + + + check + + + + + false + true + true + false + ${basedir}/src/main/scala + ${basedir}/src/test/scala + ${project.basedir}/../../tools/maven/scalastyle-config.xml + ${project.basedir}/scalastyle-output.xml + UTF-8 + + + + diff --git a/flink-contrib/flink-streaming-contrib/src/main/scala/org/apache/flink/contrib/streaming/scala/utils/package.scala b/flink-contrib/flink-streaming-contrib/src/main/scala/org/apache/flink/contrib/streaming/scala/utils/package.scala new file mode 100644 index 0000000000000..86a2bdcc23ea4 --- /dev/null +++ b/flink-contrib/flink-streaming-contrib/src/main/scala/org/apache/flink/contrib/streaming/scala/utils/package.scala @@ -0,0 +1,48 @@ +/* + * 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 + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * 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.streaming.scala + +import org.apache.flink.api.common.typeinfo.TypeInformation +import org.apache.flink.contrib.streaming.{DataStreamUtils => JavaStreamUtils} +import org.apache.flink.streaming.api.scala._ + +import _root_.scala.reflect.ClassTag +import scala.collection.JavaConverters._ + +package object utils { + + /** + * This class provides simple utility methods for collecting a [[DataStream]], + * effectively enriching it with the functionality encapsulated by [[JavaStreamUtils]]. + * + * @param self DataStream + */ + implicit class DataStreamUtils[T: TypeInformation : ClassTag](val self: DataStream[T]) { + + /** + * Returns a scala iterator to iterate over the elements of the DataStream. + * @return The iterator + */ + def collect() : Iterator[T] = { + JavaStreamUtils.collect(self.javaStream).asScala + } + + } + +}