You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@streams.apache.org by sb...@apache.org on 2014/03/24 16:50:43 UTC

[06/13] adding uncommitted modules

http://git-wip-us.apache.org/repos/asf/incubator-streams/blob/89ff615e/streams-core/src/main/java/org/apache/streams/core/DatumStatus.java
----------------------------------------------------------------------
diff --git a/streams-core/src/main/java/org/apache/streams/core/DatumStatus.java b/streams-core/src/main/java/org/apache/streams/core/DatumStatus.java
new file mode 100644
index 0000000..be18707
--- /dev/null
+++ b/streams-core/src/main/java/org/apache/streams/core/DatumStatus.java
@@ -0,0 +1,7 @@
+package org.apache.streams.core;
+
+public enum DatumStatus {
+    SUCCESS,
+    PARTIAL,
+    FAIL
+}

http://git-wip-us.apache.org/repos/asf/incubator-streams/blob/89ff615e/streams-core/src/main/java/org/apache/streams/core/DatumStatusCounter.java
----------------------------------------------------------------------
diff --git a/streams-core/src/main/java/org/apache/streams/core/DatumStatusCounter.java b/streams-core/src/main/java/org/apache/streams/core/DatumStatusCounter.java
new file mode 100644
index 0000000..7798fcd
--- /dev/null
+++ b/streams-core/src/main/java/org/apache/streams/core/DatumStatusCounter.java
@@ -0,0 +1,41 @@
+package org.apache.streams.core;
+
+public class DatumStatusCounter
+{
+    private volatile int success = 0;
+    private volatile int fail = 0;
+    private volatile int partial = 0;
+    private volatile int recordsEmitted = 0;
+
+    public int getSuccess()             { return this.success; }
+    public int getFail()                { return  this.fail; }
+    public int getPartial()             { return this.partial; }
+    public int getEmitted()             { return this.recordsEmitted; }
+
+    public void add(DatumStatusCounter datumStatusCounter) {
+        this.success += datumStatusCounter.getSuccess();
+        this.partial = datumStatusCounter.getPartial();
+        this.fail += datumStatusCounter.getFail();
+        this.recordsEmitted += datumStatusCounter.getEmitted();
+    }
+
+    public void add(DatumStatus workStatus) {
+        // add this to the record counter
+        switch(workStatus) {
+            case SUCCESS: this.success++; break;
+            case PARTIAL: this.partial++; break;
+            case FAIL: this.fail++; break;
+        }
+        this.recordsEmitted += 1;
+    }
+
+    @Override
+    public String toString() {
+        return "DatumStatusCounter{" +
+                "success=" + success +
+                ", fail=" + fail +
+                ", partial=" + partial +
+                ", recordsEmitted=" + recordsEmitted +
+                '}';
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-streams/blob/89ff615e/streams-runtimes/pom.xml
----------------------------------------------------------------------
diff --git a/streams-runtimes/pom.xml b/streams-runtimes/pom.xml
new file mode 100644
index 0000000..cf0d57f
--- /dev/null
+++ b/streams-runtimes/pom.xml
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ 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
+  ~
+  ~   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.
+  -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+
+    <parent>
+        <groupId>org.apache.streams</groupId>
+        <artifactId>streams-project</artifactId>
+        <version>0.1-SNAPSHOT</version>
+    </parent>
+
+    <artifactId>streams-runtimes</artifactId>
+
+    <packaging>pom</packaging>
+
+    <modules>
+        <module>streams-runtime-local</module>
+        <module>streams-runtime-storm</module>
+    </modules>
+</project>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-streams/blob/89ff615e/streams-runtimes/streams-runtime-local/pom.xml
----------------------------------------------------------------------
diff --git a/streams-runtimes/streams-runtime-local/pom.xml b/streams-runtimes/streams-runtime-local/pom.xml
new file mode 100644
index 0000000..fa64225
--- /dev/null
+++ b/streams-runtimes/streams-runtime-local/pom.xml
@@ -0,0 +1,103 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ 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
+  ~
+  ~   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.
+  -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+
+    <parent>
+        <groupId>org.apache.streams</groupId>
+        <artifactId>streams-runtimes</artifactId>
+        <version>0.1-SNAPSHOT</version>
+    </parent>
+
+    <artifactId>streams-runtime-local</artifactId>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.streams</groupId>
+            <artifactId>streams-core</artifactId>
+            <version>0.1-SNAPSHOT</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.streams</groupId>
+            <artifactId>streams-util</artifactId>
+            <version>0.1-SNAPSHOT</version>
+        </dependency>
+    </dependencies>
+
+    <build>
+        <sourceDirectory>src/main/java</sourceDirectory>
+        <testSourceDirectory>src/test/java</testSourceDirectory>
+        <resources>
+            <resource>
+                <directory>src/main/resources</directory>
+            </resource>
+        </resources>
+        <testResources>
+            <testResource>
+                <directory>src/test/resources</directory>
+            </testResource>
+        </testResources>
+        <plugins>
+            <plugin>
+                <groupId>org.codehaus.mojo</groupId>
+                <artifactId>build-helper-maven-plugin</artifactId>
+                <version>1.8</version>
+                <executions>
+                    <execution>
+                        <id>add-source</id>
+                        <phase>generate-sources</phase>
+                        <goals>
+                            <goal>add-source</goal>
+                        </goals>
+                        <configuration>
+                            <sources>
+                                <source>target/generated-sources/jsonschema2pojo</source>
+                            </sources>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
+            <plugin>
+                <groupId>org.jsonschema2pojo</groupId>
+                <artifactId>jsonschema2pojo-maven-plugin</artifactId>
+                <configuration>
+                    <addCompileSourceRoot>true</addCompileSourceRoot>
+                    <generateBuilders>true</generateBuilders>
+                    <sourcePaths>
+                        <sourcePath>src/main/jsonschema/LocalRuntimeConfiguration.json</sourcePath>
+                    </sourcePaths>
+                    <outputDirectory>target/generated-sources/jsonschema2pojo</outputDirectory>
+                    <targetPackage>org.apache.streams.local</targetPackage>
+                    <useLongIntegers>true</useLongIntegers>
+                    <useJodaDates>false</useJodaDates>
+                </configuration>
+                <executions>
+                    <execution>
+                        <goals>
+                            <goal>generate</goal>
+                        </goals>
+                    </execution>
+                </executions>
+            </plugin>
+        </plugins>
+    </build>
+</project>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-streams/blob/89ff615e/streams-runtimes/streams-runtime-local/src/main/jsonschema/LocalRuntimeConfiguration.json
----------------------------------------------------------------------
diff --git a/streams-runtimes/streams-runtime-local/src/main/jsonschema/LocalRuntimeConfiguration.json b/streams-runtimes/streams-runtime-local/src/main/jsonschema/LocalRuntimeConfiguration.json
new file mode 100644
index 0000000..3432318
--- /dev/null
+++ b/streams-runtimes/streams-runtime-local/src/main/jsonschema/LocalRuntimeConfiguration.json
@@ -0,0 +1,12 @@
+{
+    "type": "object",
+    "$schema": "http://json-schema.org/draft-03/schema",
+    "id": "#",
+    "javaType" : "org.apache.streams.local.LocalRuntimeConfiguration",
+    "javaInterfaces": ["java.io.Serializable"],
+    "properties": {
+        "providerTimeoutMs": {
+            "type" : "integer"
+        }
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-streams/blob/89ff615e/streams-runtimes/streams-runtime-local/src/test/resources/TestFile.txt
----------------------------------------------------------------------
diff --git a/streams-runtimes/streams-runtime-local/src/test/resources/TestFile.txt b/streams-runtimes/streams-runtime-local/src/test/resources/TestFile.txt
new file mode 100644
index 0000000..9384ee5
--- /dev/null
+++ b/streams-runtimes/streams-runtime-local/src/test/resources/TestFile.txt
@@ -0,0 +1,4 @@
+Document1
+Document2
+Document3
+Document4
\ No newline at end of file