streams-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sblack...@apache.org
Subject svn commit: r1556893 [25/25] - in /incubator/streams/branches/sblackmon: ./ streams-config-graph/ streams-config-graph/src/ streams-config-graph/src/main/ streams-config-graph/src/main/java/ streams-config-graph/src/main/java/org/ streams-config-graph/...
Date Thu, 09 Jan 2014 17:27:58 GMT
Added: incubator/streams/branches/sblackmon/streams-pojo/src/main/jsonschema/org/apache/streams/pojo/json/verbs/make-friend.json
URL: http://svn.apache.org/viewvc/incubator/streams/branches/sblackmon/streams-pojo/src/main/jsonschema/org/apache/streams/pojo/json/verbs/make-friend.json?rev=1556893&view=auto
==============================================================================
--- incubator/streams/branches/sblackmon/streams-pojo/src/main/jsonschema/org/apache/streams/pojo/json/verbs/make-friend.json
(added)
+++ incubator/streams/branches/sblackmon/streams-pojo/src/main/jsonschema/org/apache/streams/pojo/json/verbs/make-friend.json
Thu Jan  9 17:27:50 2014
@@ -0,0 +1,16 @@
+{
+  "type" : "object",
+  "title" : "Befriend",
+  "description" : "To friend an object. Usually a person",
+  "extends": {"$ref":"../activity.json"},
+  "properties" :{
+    "verb" :{
+      "type" : "string",
+      "default" : "make-friend"
+    },
+    "title" : {
+      "type" : "string",
+      "default" : "{actor.displayName} is now friends with {object.displayName}"
+    }
+  }
+}

Added: incubator/streams/branches/sblackmon/streams-pojo/src/main/jsonschema/org/apache/streams/pojo/json/verbs/play.json
URL: http://svn.apache.org/viewvc/incubator/streams/branches/sblackmon/streams-pojo/src/main/jsonschema/org/apache/streams/pojo/json/verbs/play.json?rev=1556893&view=auto
==============================================================================
--- incubator/streams/branches/sblackmon/streams-pojo/src/main/jsonschema/org/apache/streams/pojo/json/verbs/play.json
(added)
+++ incubator/streams/branches/sblackmon/streams-pojo/src/main/jsonschema/org/apache/streams/pojo/json/verbs/play.json
Thu Jan  9 17:27:50 2014
@@ -0,0 +1,16 @@
+{
+  "type" : "object",
+  "title" : "Play",
+  "description" : "To play an object",
+  "extends": {"$ref":"../activity.json"},
+  "properties" :{
+    "verb" :{
+      "type" : "string",
+      "default" : "play"
+    },
+    "title" : {
+      "type" : "string",
+      "default" : "{actor.displayName} played {object.displayName}"
+    }
+  }
+}

Added: incubator/streams/branches/sblackmon/streams-pojo/src/main/jsonschema/org/apache/streams/pojo/json/verbs/post.json
URL: http://svn.apache.org/viewvc/incubator/streams/branches/sblackmon/streams-pojo/src/main/jsonschema/org/apache/streams/pojo/json/verbs/post.json?rev=1556893&view=auto
==============================================================================
--- incubator/streams/branches/sblackmon/streams-pojo/src/main/jsonschema/org/apache/streams/pojo/json/verbs/post.json
(added)
+++ incubator/streams/branches/sblackmon/streams-pojo/src/main/jsonschema/org/apache/streams/pojo/json/verbs/post.json
Thu Jan  9 17:27:50 2014
@@ -0,0 +1,16 @@
+{
+  "type" : "object",
+  "title" : "Post",
+  "description" : "To publish an object",
+  "extends": {"$ref":"../activity.json"},
+  "properties" :{
+    "verb" :{
+      "type" : "string",
+      "default" : "post"
+    },
+    "title" : {
+      "type" : "string",
+      "default" : "{actor.displayName} posted {object.displayName}"
+    }
+  }
+}

Added: incubator/streams/branches/sblackmon/streams-pojo/src/main/jsonschema/org/apache/streams/pojo/json/verbs/rsvp-maybe.json
URL: http://svn.apache.org/viewvc/incubator/streams/branches/sblackmon/streams-pojo/src/main/jsonschema/org/apache/streams/pojo/json/verbs/rsvp-maybe.json?rev=1556893&view=auto
==============================================================================
--- incubator/streams/branches/sblackmon/streams-pojo/src/main/jsonschema/org/apache/streams/pojo/json/verbs/rsvp-maybe.json
(added)
+++ incubator/streams/branches/sblackmon/streams-pojo/src/main/jsonschema/org/apache/streams/pojo/json/verbs/rsvp-maybe.json
Thu Jan  9 17:27:50 2014
@@ -0,0 +1,16 @@
+{
+  "type" : "object",
+  "title" : "Rsvp Maybe",
+  "description" : "To indicate that the actor may attend an event",
+  "extends": {"$ref":"../activity.json"},
+  "properties" :{
+    "verb" :{
+      "type" : "string",
+      "default" : "rsvp-maybe"
+    },
+    "title" : {
+      "type" : "string",
+      "default" : "{actor.displayName} may be attending {object.displayName}"
+    }
+  }
+}

Added: incubator/streams/branches/sblackmon/streams-pojo/src/main/jsonschema/org/apache/streams/pojo/json/verbs/rsvp-no.json
URL: http://svn.apache.org/viewvc/incubator/streams/branches/sblackmon/streams-pojo/src/main/jsonschema/org/apache/streams/pojo/json/verbs/rsvp-no.json?rev=1556893&view=auto
==============================================================================
--- incubator/streams/branches/sblackmon/streams-pojo/src/main/jsonschema/org/apache/streams/pojo/json/verbs/rsvp-no.json
(added)
+++ incubator/streams/branches/sblackmon/streams-pojo/src/main/jsonschema/org/apache/streams/pojo/json/verbs/rsvp-no.json
Thu Jan  9 17:27:50 2014
@@ -0,0 +1,16 @@
+{
+  "type" : "object",
+  "title" : "Rsvp No",
+  "description" : "To indicate that the actor will not attend an event",
+  "extends": {"$ref":"../activity.json"},
+  "properties" :{
+    "verb" :{
+      "type" : "string",
+      "default" : "rsvp-no"
+    },
+    "title" : {
+      "type" : "string",
+      "default" : "{actor.displayName} will not attend {object.displayName}"
+    }
+  }
+}

Added: incubator/streams/branches/sblackmon/streams-pojo/src/main/jsonschema/org/apache/streams/pojo/json/verbs/rsvp-yes.json
URL: http://svn.apache.org/viewvc/incubator/streams/branches/sblackmon/streams-pojo/src/main/jsonschema/org/apache/streams/pojo/json/verbs/rsvp-yes.json?rev=1556893&view=auto
==============================================================================
--- incubator/streams/branches/sblackmon/streams-pojo/src/main/jsonschema/org/apache/streams/pojo/json/verbs/rsvp-yes.json
(added)
+++ incubator/streams/branches/sblackmon/streams-pojo/src/main/jsonschema/org/apache/streams/pojo/json/verbs/rsvp-yes.json
Thu Jan  9 17:27:50 2014
@@ -0,0 +1,16 @@
+{
+  "type" : "object",
+  "title" : "Rsvp Yes",
+  "description" : "To indicate that the actor will attend an event",
+  "extends": {"$ref":"../activity.json"},
+  "properties" :{
+    "verb" :{
+      "type" : "string",
+      "default" : "rsvp-yes"
+    },
+    "title" : {
+      "type" : "string",
+      "default" : "{actor.displayName} is attending {object.displayName}"
+    }
+  }
+}

Added: incubator/streams/branches/sblackmon/streams-pojo/src/main/jsonschema/org/apache/streams/pojo/json/verbs/save.json
URL: http://svn.apache.org/viewvc/incubator/streams/branches/sblackmon/streams-pojo/src/main/jsonschema/org/apache/streams/pojo/json/verbs/save.json?rev=1556893&view=auto
==============================================================================
--- incubator/streams/branches/sblackmon/streams-pojo/src/main/jsonschema/org/apache/streams/pojo/json/verbs/save.json
(added)
+++ incubator/streams/branches/sblackmon/streams-pojo/src/main/jsonschema/org/apache/streams/pojo/json/verbs/save.json
Thu Jan  9 17:27:50 2014
@@ -0,0 +1,16 @@
+{
+  "type" : "object",
+  "title" : "Save",
+  "description" : "To save an object",
+  "extends": {"$ref":"../activity.json"},
+  "properties" :{
+    "verb" :{
+      "type" : "string",
+      "default" : "save"
+    },
+    "title" : {
+      "type" : "string",
+      "default" : "{actor.displayName} saved {object.displayName}"
+    }
+  }
+}

Added: incubator/streams/branches/sblackmon/streams-pojo/src/main/jsonschema/org/apache/streams/pojo/json/verbs/share.json
URL: http://svn.apache.org/viewvc/incubator/streams/branches/sblackmon/streams-pojo/src/main/jsonschema/org/apache/streams/pojo/json/verbs/share.json?rev=1556893&view=auto
==============================================================================
--- incubator/streams/branches/sblackmon/streams-pojo/src/main/jsonschema/org/apache/streams/pojo/json/verbs/share.json
(added)
+++ incubator/streams/branches/sblackmon/streams-pojo/src/main/jsonschema/org/apache/streams/pojo/json/verbs/share.json
Thu Jan  9 17:27:50 2014
@@ -0,0 +1,16 @@
+{
+  "type" : "object",
+  "title" : "Share",
+  "description" : "To share an object.",
+  "extends": {"$ref":"../activity.json"},
+  "properties" :{
+    "verb" :{
+      "type" : "string",
+      "default" : "share"
+    },
+    "title" : {
+      "type" : "string",
+      "default" : "{actor.displayName} shared {object.displayName}"
+    }
+  }
+}

Added: incubator/streams/branches/sblackmon/streams-pojo/src/main/jsonschema/org/apache/streams/pojo/json/verbs/tag.json
URL: http://svn.apache.org/viewvc/incubator/streams/branches/sblackmon/streams-pojo/src/main/jsonschema/org/apache/streams/pojo/json/verbs/tag.json?rev=1556893&view=auto
==============================================================================
--- incubator/streams/branches/sblackmon/streams-pojo/src/main/jsonschema/org/apache/streams/pojo/json/verbs/tag.json
(added)
+++ incubator/streams/branches/sblackmon/streams-pojo/src/main/jsonschema/org/apache/streams/pojo/json/verbs/tag.json
Thu Jan  9 17:27:50 2014
@@ -0,0 +1,16 @@
+{
+  "type" : "object",
+  "title" : "Tag",
+  "description" : "To tag an object. Ex: A person being tagged in a photo",
+  "extends": {"$ref":"../activity.json"},
+  "properties" :{
+    "verb" :{
+      "type" : "string",
+      "default" : "tag"
+    },
+    "title" : {
+      "type" : "string",
+      "default" : "{actor.displayName} tagged {object.displayName} in {target.displayName}"
+    }
+  }
+}

Added: incubator/streams/branches/sblackmon/streams-pojo/src/main/jsonschema/org/apache/streams/pojo/json/verbs/update.json
URL: http://svn.apache.org/viewvc/incubator/streams/branches/sblackmon/streams-pojo/src/main/jsonschema/org/apache/streams/pojo/json/verbs/update.json?rev=1556893&view=auto
==============================================================================
--- incubator/streams/branches/sblackmon/streams-pojo/src/main/jsonschema/org/apache/streams/pojo/json/verbs/update.json
(added)
+++ incubator/streams/branches/sblackmon/streams-pojo/src/main/jsonschema/org/apache/streams/pojo/json/verbs/update.json
Thu Jan  9 17:27:50 2014
@@ -0,0 +1,26 @@
+{
+  "type" : "object",
+  "title" : "Update",
+  "description" : "To update a property on an object. Ex: Monica updated her street address
to 234 Awesome St.",
+  "notes" : "The new property value can be a scalar value or an object. See the property
object type",
+  "extends": {"$ref":"../activity.json"},
+  "properties" :{
+    "verb" :{
+      "type" : "string",
+      "default" : "update"
+    },
+    "title" : {
+      "type" : "string",
+      "default" : "{actor.displayName} updated {target.displayName}'s {object.displayName}
to {object.value}"
+    },
+    "object" : {
+      "type" : "object",
+      "$ref" : "../object.json"
+    },
+    "target" : {
+      "type" : "object",
+      "optional" : true,
+      "$ref" : "../object.json"
+    }
+  }
+}

Added: incubator/streams/branches/sblackmon/streams-pojo/src/main/xmlschema/org/apache/streams/pojo/xml/activity.xsd
URL: http://svn.apache.org/viewvc/incubator/streams/branches/sblackmon/streams-pojo/src/main/xmlschema/org/apache/streams/pojo/xml/activity.xsd?rev=1556893&view=auto
==============================================================================
--- incubator/streams/branches/sblackmon/streams-pojo/src/main/xmlschema/org/apache/streams/pojo/xml/activity.xsd
(added)
+++ incubator/streams/branches/sblackmon/streams-pojo/src/main/xmlschema/org/apache/streams/pojo/xml/activity.xsd
Thu Jan  9 17:27:50 2014
@@ -0,0 +1,94 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<!--
+  ~ 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.
+  -->
+
+<xs:schema version="1.0" xmlns:xs="http://www.w3.org/2001/XMLSchema">
+
+    <xs:element name="id" type="xs:string"/>
+    <xs:element name="actor" type="objectType"/>
+    <xs:element name="verb" type="verbType"/>
+    <xs:element name="object" type="objectType"/>
+    <xs:element name="target" type="objectType"/>
+    <xs:element name="object-type" type="xs:string"/>
+    <xs:element name="published" type="xs:dateTime"/>
+    <xs:element name="updated" type="xs:dateTime"/>
+    <xs:element name="provider" type="objectType"/>
+    <xs:element name="title" type="xs:string"/>
+    <xs:element name="content" type="xs:string"/>
+    <xs:element name="url" type="xs:string"/>
+
+    <xs:simpleType name="verbType">
+        <xs:restriction base="xs:string">
+            <xs:enumeration value="favorite"/>
+            <xs:enumeration value="follow"/>
+            <xs:enumeration value="join"/>
+            <xs:enumeration value="like"/>
+            <xs:enumeration value="make-friend"/>
+            <xs:enumeration value="play"/>
+            <xs:enumeration value="post"/>
+            <xs:enumeration value="rsvp-yes"/>
+            <xs:enumeration value="rsvp-no"/>
+            <xs:enumeration value="rsvp-maybe"/>
+            <xs:enumeration value="save"/>
+            <xs:enumeration value="share"/>
+            <xs:enumeration value="tag"/>
+            <xs:enumeration value="update"/>
+        </xs:restriction>
+    </xs:simpleType>
+
+    <xs:complexType name="objectType">
+        <xs:sequence>
+            <xs:element name="id" type="xs:string"/>
+            <xs:element name="image" type="mediaLink"/>
+            <xs:element name="displayName" type="xs:string"/>
+            <xs:element name="summary" type="xs:string"/>
+            <xs:element name="content" type="xs:string"/>
+            <xs:element name="url" type="xs:string"/>
+            <xs:element name="published" type="xs:string"/>
+            <xs:element name="updated" type="xs:string"/>
+            <xs:element name="object-type" >
+                <xs:simpleType>
+                    <xs:restriction base="xs:string">
+                        <xs:enumeration value="article"/>
+                        <xs:enumeration value="audio"/>
+                        <xs:enumeration value="badge"/>
+                        <xs:enumeration value="collection"/>
+                        <xs:enumeration value="comment"/>
+                        <xs:enumeration value="course"/>
+                        <xs:enumeration value="file"/>
+                        <xs:enumeration value="image"/>
+                        <xs:enumeration value="person"/>
+                        <xs:enumeration value="review"/>
+                        <xs:enumeration value="service"/>
+                    </xs:restriction>
+                </xs:simpleType>
+            </xs:element>
+        </xs:sequence>
+
+    </xs:complexType>
+
+    <xs:complexType name="mediaLink">
+        <xs:sequence>
+            <xs:element name="duration" type="xs:positiveInteger"/>
+            <xs:element name="height" type="xs:positiveInteger"/>
+            <xs:element name="width" type="xs:positiveInteger"/>
+            <xs:element name="url" type="xs:string"/>
+        </xs:sequence>
+    </xs:complexType>
+
+</xs:schema>
\ No newline at end of file

Added: incubator/streams/branches/sblackmon/streams-pojo/src/test/java/org/apache/streams/data/data/util/JsonUtilTest.java
URL: http://svn.apache.org/viewvc/incubator/streams/branches/sblackmon/streams-pojo/src/test/java/org/apache/streams/data/data/util/JsonUtilTest.java?rev=1556893&view=auto
==============================================================================
--- incubator/streams/branches/sblackmon/streams-pojo/src/test/java/org/apache/streams/data/data/util/JsonUtilTest.java
(added)
+++ incubator/streams/branches/sblackmon/streams-pojo/src/test/java/org/apache/streams/data/data/util/JsonUtilTest.java
Thu Jan  9 17:27:50 2014
@@ -0,0 +1,31 @@
+/*
+ * 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.
+ */
+
+package org.apache.streams.data.data.util;
+
+
+import org.junit.Ignore;
+import org.junit.Test;
+
+public class JsonUtilTest {
+
+    @Ignore @Test
+    public void testJsonToObject(){
+    }
+
+}

Added: incubator/streams/branches/sblackmon/streams-storm/pom.xml
URL: http://svn.apache.org/viewvc/incubator/streams/branches/sblackmon/streams-storm/pom.xml?rev=1556893&view=auto
==============================================================================
--- incubator/streams/branches/sblackmon/streams-storm/pom.xml (added)
+++ incubator/streams/branches/sblackmon/streams-storm/pom.xml Thu Jan  9 17:27:50 2014
@@ -0,0 +1,98 @@
+<?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">
+    <parent>
+        <artifactId>streams-project</artifactId>
+        <groupId>org.apache.streams</groupId>
+        <version>0.1-SNAPSHOT</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+    <artifactId>streams-storm</artifactId>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.streams</groupId>
+            <artifactId>streams-config</artifactId>
+            <version>0.1-SNAPSHOT</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.streams</groupId>
+            <artifactId>streams-config-graph</artifactId>
+            <version>0.1-SNAPSHOT</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.streams</groupId>
+            <artifactId>streams-util</artifactId>
+            <version>0.1-SNAPSHOT</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.commons</groupId>
+            <artifactId>commons-lang3</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>storm</groupId>
+            <artifactId>storm-core</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>storm</groupId>
+            <artifactId>storm-netty</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.scala-lang</groupId>
+            <artifactId>scala-library</artifactId>
+            <version>2.9.2</version>
+            <scope>compile</scope>
+            <type>jar</type>
+        </dependency>
+        <dependency>
+            <groupId>com.101tec</groupId>
+            <artifactId>zkclient</artifactId>
+            <version>0.2</version>
+            <scope>compile</scope>
+            <exclusions>
+                <exclusion>
+                    <groupId>log4j</groupId>
+                    <artifactId>log4j</artifactId>
+                </exclusion>
+                <exclusion>
+                    <groupId>org.slf4j</groupId>
+                    <artifactId>slf4j-log4j12</artifactId>
+                </exclusion>
+            </exclusions>
+        </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>
+    </build>
+</project>

Added: incubator/streams/branches/sblackmon/streams-storm/src/main/java/org/apache/streams/storm/PipelineGraphLauncher.java
URL: http://svn.apache.org/viewvc/incubator/streams/branches/sblackmon/streams-storm/src/main/java/org/apache/streams/storm/PipelineGraphLauncher.java?rev=1556893&view=auto
==============================================================================
--- incubator/streams/branches/sblackmon/streams-storm/src/main/java/org/apache/streams/storm/PipelineGraphLauncher.java
(added)
+++ incubator/streams/branches/sblackmon/streams-storm/src/main/java/org/apache/streams/storm/PipelineGraphLauncher.java
Thu Jan  9 17:27:50 2014
@@ -0,0 +1,196 @@
+/*
+ * 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.
+ */
+
+package org.apache.streams.storm;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.typesafe.config.Config;
+import org.apache.commons.io.FileUtils;
+import org.apache.commons.io.IOUtils;
+import org.apache.commons.lang3.tuple.ImmutablePair;
+import org.apache.commons.lang3.tuple.Pair;
+import org.apache.streams.config.StreamsConfigurator;
+import org.apache.streams.util.RegexUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.File;
+import java.io.IOException;
+import java.net.URISyntaxException;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Created with IntelliJ IDEA.
+ * User: sblackmon
+ * Date: 9/20/13
+ * Time: 11:17 AM
+ * To change this template use File | Settings | File Templates.
+ */
+public class PipelineGraphLauncher {
+
+    private static final Logger log = LoggerFactory.getLogger(PipelineGraphLauncher.class);
+
+    private static Config streamsConfiguration;
+
+    private static List<Pair<String,Class>> topologies;
+
+    private static List<Pair<String,Class>> resolveClasses(List<Pair<String,String>>
topologyPairs) throws IOException, ClassNotFoundException {
+
+        List<Pair<String,Class>> topologies = new ArrayList<Pair<String,Class>>();
+
+        for( Pair<String,String> pair : topologyPairs ) {
+            String topologyId = pair.getLeft();
+            Class topologyClass = Class.forName(pair.getRight());
+            topologies.add(new ImmutablePair(topologyId, topologyClass));
+        }
+
+        return topologies;
+    }
+
+    private static List<Pair<String,Class>> loadTopologiesFromPipelineTopologyListFile(File
file) throws IOException, ClassNotFoundException {
+
+        List<String> lines = IOUtils.readLines(FileUtils.openInputStream(file));
+        String pattern = "^([\\w-]*)[\\s]*?([\\w.]*)$";
+
+        List<Pair<String,String>> topologyPairs = RegexUtils.getTwoMatchedGroupsList(lines,
pattern);
+
+        topologies = resolveClasses(topologyPairs);
+
+        for( Pair<String,String> pair : topologyPairs ) {
+            String topologyId = pair.getLeft();
+            Class topologyClass = Class.forName(pair.getRight());
+            topologies.add(new ImmutablePair(topologyId, topologyClass));
+        }
+
+        return topologies;
+    }
+
+    private static List<Pair<String,Class>> loadTopologiesFromPipelineGraphFile(File
file) throws IOException, ClassNotFoundException {
+
+        List<String> lines = IOUtils.readLines(FileUtils.openInputStream(file));
+        String pattern = "$([\\w-]*)\\s([\\w.)";
+
+        List<Pair<String,String>> topologyPairs = RegexUtils.getTwoMatchedGroupsList(lines,
pattern);
+
+        topologies = resolveClasses(topologyPairs);
+
+        return topologies;
+    }
+
+    public static boolean isLocal(String[] args) {
+        if(args.length >= 1 && args[1].equals("deploy"))
+            return false;
+        else return true;
+    }
+
+    public static void main(String[] args) throws Exception {
+
+        if(args.length < 3) {
+            log.error("Not enough arguments");
+            log.error("  storm {local,deploy} <pipelinedef>");
+            return;
+        }
+        if(!args[1].equals("deploy")) {
+            log.error("Not a deploy");
+            log.error("  storm {local,deploy} <pipelinedef>");
+            return;
+        }
+
+        ObjectMapper mapper = new ObjectMapper();
+
+        URL configFileUrl = PipelineGraphLauncher.class.getResource(args[0]);
+
+        File configFile;
+        try {
+            configFile = new File(configFileUrl.toURI());
+        } catch(URISyntaxException e) {
+            configFile = new File(configFileUrl.getPath());
+        }
+
+        streamsConfiguration = StreamsConfigurator.config;
+
+//        String pipelineIdentifier = streamsConfiguration.getPipeline();
+//
+//        for( Map.Entry<String, Object> moduleConfig : streamsConfiguration.getAdditionalProperties().entrySet())
{
+//
+//        }
+
+//      each defined graph becomes a topology
+
+//
+//        URL pipelineFileUrl = PipelineGraphLauncher.class.getResource(args[1]);
+//
+//        File pipelineFile;
+//        try {
+//            pipelineFile = new File(pipelineFileUrl.toURI());
+//        } catch(URISyntaxException e) {
+//            pipelineFile = new File(pipelineFileUrl.getPath());
+//        }
+//
+//        topologies = loadTopologiesFromPipelineTopologyListFile(pipelineFile);
+//
+//        for( Pair<String,Class> topology : topologies ) {
+//            Class topologyClass = topology.getRight();
+//
+//            try {
+//                Constructor ctor = topologyClass.getDeclaredConstructor(
+//                    String.class,
+//                    StreamsConfiguration.class);
+//                ctor.setAccessible(true);
+//                Object topologyObject = ctor.newInstance(pipelineIdentifier, streamsConfiguration);
+//                Runnable runnable = (Runnable) topologyObject;
+//                runnable.run();
+//            } catch (InstantiationException x) {
+//                log.warn(x.getMessage());
+//                x.printStackTrace();
+//            } catch (IllegalAccessException x) {
+//                log.warn(x.getMessage());
+//                x.printStackTrace();
+//            } catch (InvocationTargetException x) {
+//                log.warn(x.getMessage());
+//                x.printStackTrace();
+//            } catch (NoSuchMethodException x) {
+//                log.warn(x.getMessage());
+//                x.printStackTrace();
+//
+//                try {
+//                    Constructor ctor = topologyClass.getDeclaredConstructor(
+//                            String[].class);
+//                    ctor.setAccessible(true);
+//                    Object topologyObject = ctor.newInstance(args);
+//                    Method main = topologyClass.getMethod("main", String[].class);
+//                    main.invoke(topologyObject, args);
+//                } catch (InstantiationException x2) {
+//                    log.warn(x2.getMessage());
+//                    x.printStackTrace();
+//                } catch (IllegalAccessException x2) {
+//                    log.warn(x2.getMessage());
+//                    x.printStackTrace();
+//                } catch (InvocationTargetException x2) {
+//                    log.warn(x2.getMessage());
+//                    x.printStackTrace();
+//                } catch (NoSuchMethodException x2) {
+//                    log.error(x2.getMessage());
+//                    x.printStackTrace();
+//                }
+//            }
+//        }
+    }
+}

Added: incubator/streams/branches/sblackmon/streams-storm/src/main/java/org/apache/streams/storm/trident/StreamsTopology.java
URL: http://svn.apache.org/viewvc/incubator/streams/branches/sblackmon/streams-storm/src/main/java/org/apache/streams/storm/trident/StreamsTopology.java?rev=1556893&view=auto
==============================================================================
--- incubator/streams/branches/sblackmon/streams-storm/src/main/java/org/apache/streams/storm/trident/StreamsTopology.java
(added)
+++ incubator/streams/branches/sblackmon/streams-storm/src/main/java/org/apache/streams/storm/trident/StreamsTopology.java
Thu Jan  9 17:27:50 2014
@@ -0,0 +1,73 @@
+/*
+ * 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.
+ */
+
+package org.apache.streams.storm.trident;
+
+import backtype.storm.Config;
+import org.apache.streams.StreamsConfiguration;
+import org.apache.streams.config.StreamsConfigurator;
+import storm.trident.TridentTopology;
+
+/**
+ * Created with IntelliJ IDEA.
+ * User: sblackmon
+ * Date: 9/20/13
+ * Time: 5:48 PM
+ * To change this template use File | Settings | File Templates.
+ */
+public abstract class StreamsTopology extends TridentTopology {
+
+    StreamsConfiguration configuration;
+    Config stormConfig;
+    String runmode;
+
+    protected StreamsTopology() {
+
+        runmode = StreamsConfigurator.config.getConfig("storm").getString("runmode");
+        stormConfig = new Config();
+
+    }
+
+    protected StreamsTopology(StreamsConfiguration configuration) {
+        this.configuration = configuration;
+    }
+
+    public StreamsConfiguration getConfiguration() {
+        return configuration;
+    }
+
+    public void setConfiguration(StreamsConfiguration configuration) {
+        this.configuration = configuration;
+    }
+
+    public String getRunmode() {
+        return runmode;
+    }
+
+    public void setRunmode(String runmode) {
+        this.runmode = runmode;
+    }
+
+    public Config getStormConfig() {
+        return stormConfig;
+    }
+
+    public void setStormConfig(Config stormConfig) {
+        this.stormConfig = stormConfig;
+    }
+}

Added: incubator/streams/branches/sblackmon/streams-util/pom.xml
URL: http://svn.apache.org/viewvc/incubator/streams/branches/sblackmon/streams-util/pom.xml?rev=1556893&view=auto
==============================================================================
--- incubator/streams/branches/sblackmon/streams-util/pom.xml (added)
+++ incubator/streams/branches/sblackmon/streams-util/pom.xml Thu Jan  9 17:27:50 2014
@@ -0,0 +1,44 @@
+<?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">
+    <parent>
+        <artifactId>streams-project</artifactId>
+        <groupId>org.apache.streams</groupId>
+        <version>0.1-SNAPSHOT</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+
+    <artifactId>streams-util</artifactId>
+    <packaging>jar</packaging>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.commons</groupId>
+            <artifactId>commons-lang3</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>com.google.guava</groupId>
+            <artifactId>guava</artifactId>
+        </dependency>
+
+    </dependencies>
+</project>
\ No newline at end of file

Added: incubator/streams/branches/sblackmon/streams-util/src/main/java/org/apache/streams/util/GuidUtils.java
URL: http://svn.apache.org/viewvc/incubator/streams/branches/sblackmon/streams-util/src/main/java/org/apache/streams/util/GuidUtils.java?rev=1556893&view=auto
==============================================================================
--- incubator/streams/branches/sblackmon/streams-util/src/main/java/org/apache/streams/util/GuidUtils.java
(added)
+++ incubator/streams/branches/sblackmon/streams-util/src/main/java/org/apache/streams/util/GuidUtils.java
Thu Jan  9 17:27:50 2014
@@ -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
+ *
+ *   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.streams.util;
+
+import com.google.common.base.Preconditions;
+import com.google.common.base.Strings;
+import com.google.common.hash.Hashing;
+
+import java.nio.charset.Charset;
+
+/**
+ * Created by sblackmon on 12/13/13.
+ */
+public class GuidUtils {
+
+    private static final Charset UTF8_CHARSET = Charset.forName("UTF-8");
+
+    public static String generateGuid(String... parts) {
+
+        StringBuilder seed = new StringBuilder();
+        for( String part : parts ) {
+            Preconditions.checkNotNull(part);
+            Preconditions.checkArgument(!Strings.isNullOrEmpty(part));
+            seed.append(part);
+        }
+
+        String hash = Hashing.goodFastHash(24).hashString(seed, UTF8_CHARSET).asBytes().toString();
+
+        return hash;
+
+    }
+}

Added: incubator/streams/branches/sblackmon/streams-util/src/main/java/org/apache/streams/util/RegexUtils.java
URL: http://svn.apache.org/viewvc/incubator/streams/branches/sblackmon/streams-util/src/main/java/org/apache/streams/util/RegexUtils.java?rev=1556893&view=auto
==============================================================================
--- incubator/streams/branches/sblackmon/streams-util/src/main/java/org/apache/streams/util/RegexUtils.java
(added)
+++ incubator/streams/branches/sblackmon/streams-util/src/main/java/org/apache/streams/util/RegexUtils.java
Thu Jan  9 17:27:50 2014
@@ -0,0 +1,93 @@
+/*
+ * 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.
+ */
+
+package org.apache.streams.util;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import org.apache.commons.lang3.StringUtils;
+import org.apache.commons.lang3.tuple.ImmutablePair;
+import org.apache.commons.lang3.tuple.Pair;
+
+public class RegexUtils {
+
+    public static boolean matches(String line, String regEx) {
+
+        boolean regExpMatches = false;
+
+        if (StringUtils.isNotBlank(line) && StringUtils.isNotBlank(regEx)) {
+            if (line.matches(regEx)) {
+                regExpMatches = true;
+            }
+        }
+        return regExpMatches;
+    }
+
+    public static List<String> getMatches(String line, String regEx, int group){
+        Pattern pattern = Pattern.compile(regEx);
+        Matcher matcher = pattern.matcher(line);
+        List<String> matches = new ArrayList<String>();
+
+        while (matcher.find()) {
+
+            matches.add(matcher.group(group));
+        }
+
+        return matches;
+    }
+
+    public static List<Pair<String,String>> getTwoMatchedGroupsList(List<String>
lines, String regEx){
+        List<Pair<String,String>> matches = new ArrayList<Pair<String,String>>();
+
+        for( String line : lines ) {
+
+            Pair<String,String> match = getTwoMatchedGroups(line, regEx);
+            if( match != null )
+                matches.add(match);
+
+        }
+        return matches;
+    }
+
+    public static Pair<String,String> getTwoMatchedGroups(String line, String regEx){
+        Pattern pattern = Pattern.compile(regEx);
+        Matcher matcher = pattern.matcher(line);
+        Pair<String,String> match = null;
+
+        while (matcher.find()) {
+            Pair<String,String> pair = new ImmutablePair<String,String>(matcher.group(0),
matcher.group(1));
+            match = pair;
+        }
+
+        return match;
+    }
+
+    public static String getMatchedContent(String line, String regEx){
+        Pattern pattern = Pattern.compile(regEx);
+        Matcher matcher = pattern.matcher(line);
+        String matchedContent = null;
+        if (matcher.find()) {
+            matchedContent = matcher.group();
+        }
+
+        return matchedContent;
+    }
+}



Mime
View raw message