incubator-s4-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mmo...@apache.org
Subject [17/50] [abbrv] git commit: Added getStrems() to EventSource.
Date Tue, 03 Jan 2012 14:03:28 GMT
Added getStrems() to EventSource.


Project: http://git-wip-us.apache.org/repos/asf/incubator-s4/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-s4/commit/5b6fae2b
Tree: http://git-wip-us.apache.org/repos/asf/incubator-s4/tree/5b6fae2b
Diff: http://git-wip-us.apache.org/repos/asf/incubator-s4/diff/5b6fae2b

Branch: refs/heads/piper
Commit: 5b6fae2b81522e766ce45511fe0176ca1693e459
Parents: edaa346
Author: Leo Neumeyer <leo@s4.io>
Authored: Wed Dec 7 14:24:47 2011 -0800
Committer: Leo Neumeyer <leo@s4.io>
Committed: Wed Dec 7 14:24:47 2011 -0800

----------------------------------------------------------------------
 .../src/main/java/org/apache/s4/base/MapEvent.java |   15 +++++++
 .../main/java/org/apache/s4/core/EventSource.java  |   31 ++++++++-------
 .../src/main/java/org/apache/s4/core/Server.java   |    5 ++-
 3 files changed, 35 insertions(+), 16 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-s4/blob/5b6fae2b/subprojects/s4-base/src/main/java/org/apache/s4/base/MapEvent.java
----------------------------------------------------------------------
diff --git a/subprojects/s4-base/src/main/java/org/apache/s4/base/MapEvent.java b/subprojects/s4-base/src/main/java/org/apache/s4/base/MapEvent.java
new file mode 100644
index 0000000..2baefcd
--- /dev/null
+++ b/subprojects/s4-base/src/main/java/org/apache/s4/base/MapEvent.java
@@ -0,0 +1,15 @@
+package org.apache.s4.base;
+
+public class MapEvent extends Event {
+
+    public <T> void put(Class<T> type, String name, T value) {
+
+    }
+
+    public <T> T get(String name) {
+
+        T x = null;
+
+        return x;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-s4/blob/5b6fae2b/subprojects/s4-core/src/main/java/org/apache/s4/core/EventSource.java
----------------------------------------------------------------------
diff --git a/subprojects/s4-core/src/main/java/org/apache/s4/core/EventSource.java b/subprojects/s4-core/src/main/java/org/apache/s4/core/EventSource.java
index 0b672c3..b72f34e 100644
--- a/subprojects/s4-core/src/main/java/org/apache/s4/core/EventSource.java
+++ b/subprojects/s4-core/src/main/java/org/apache/s4/core/EventSource.java
@@ -7,22 +7,18 @@ import org.apache.s4.base.Event;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-
 /**
  * 
- * A producer app uses one or more EventSource classes to provide events to
- * streams. AT runtime, consumer apps subscribe to an event source by providing
- * a stream object. Each EventSource instance may correspond to a different type
- * of event stream. Each EventSource may have an unlimited number of
- * subscribers.
+ * A producer app uses one or more EventSource classes to provide events to streams. AT runtime,
consumer apps subscribe
+ * to an event source by providing a stream object. Each EventSource instance may correspond
to a different type of
+ * event stream. Each EventSource may have an unlimited number of subscribers.
  * 
  */
 public class EventSource<T extends Event> implements Streamable<T> {
 
     /* No need to synchronize this object because we expect a single thread. */
     private Set<Stream<T>> streams = new HashSet<Stream<T>>();
-    private static final Logger logger = LoggerFactory
-            .getLogger(EventSource.class);
+    private static final Logger logger = LoggerFactory.getLogger(EventSource.class);
     final private String name;
 
     public EventSource(App app, String name) {
@@ -36,8 +32,7 @@ public class EventSource<T extends Event> implements Streamable<T>
{
      * @param stream
      */
     public void subscribeStream(Stream<T> stream) {
-        logger.info("Subscribing stream: {} to event source: {}.",
-                stream.getName(), getName());
+        logger.info("Subscribing stream: {} to event source: {}.", stream.getName(), getName());
         streams.add(stream);
     }
 
@@ -47,8 +42,7 @@ public class EventSource<T extends Event> implements Streamable<T>
{
      * @param stream
      */
     public void unsubscribeStream(Stream<T> stream) {
-        logger.info("Unsubsubscribing stream: {} to event source: {}.",
-                stream.getName(), getName());
+        logger.info("Unsubsubscribing stream: {} to event source: {}.", stream.getName(),
getName());
         streams.remove(stream);
     }
 
@@ -73,7 +67,7 @@ public class EventSource<T extends Event> implements Streamable<T>
{
     }
 
     /**
-     * @return the name of this event source
+     * @return the name of this event source.
      */
     public String getName() {
         return name;
@@ -85,9 +79,16 @@ public class EventSource<T extends Event> implements Streamable<T>
{
     @Override
     public void close() {
         for (Stream<T> stream : streams) {
-            logger.info("Closing stream: {} in event source: {}.",
-                    stream.getName(), getName());
+            logger.info("Closing stream: {} in event source: {}.", stream.getName(), getName());
             stream.close();
         }
     }
+
+    /**
+     * 
+     * @return the set of streams subscribed to this event source.
+     */
+    public Set<Stream<T>> getStreams() {
+        return streams;
+    }
 }

http://git-wip-us.apache.org/repos/asf/incubator-s4/blob/5b6fae2b/subprojects/s4-core/src/main/java/org/apache/s4/core/Server.java
----------------------------------------------------------------------
diff --git a/subprojects/s4-core/src/main/java/org/apache/s4/core/Server.java b/subprojects/s4-core/src/main/java/org/apache/s4/core/Server.java
index f736d88..7d52c74 100644
--- a/subprojects/s4-core/src/main/java/org/apache/s4/core/Server.java
+++ b/subprojects/s4-core/src/main/java/org/apache/s4/core/Server.java
@@ -70,8 +70,10 @@ public class Server {
         Sender sender = injector.getInstance(Sender.class);
         Receiver receiver = injector.getInstance(Receiver.class);
 
-        File[] s4rFiles = new File(appsDir).listFiles(new PatternFilenameFilter("\\w+\\.s4r"));
+        // File[] s4rFiles = new File(appsDir).listFiles(new PatternFilenameFilter("\\w+\\.s4r"));
+        File[] s4rFiles = new File(appsDir).listFiles(new PatternFilenameFilter(".+.s4r"));
         for (File s4rFile : s4rFiles) {
+            logger.info("Loading app: " + s4rFile.getPath());
             loadApp(sender, receiver, s4rFile);
         }
 
@@ -100,6 +102,7 @@ public class Server {
                 return;
             }
             String appClassName = s4rFile.getManifest().getMainAttributes().getValue(MANIFEST_S4_APP_CLASS);
+            logger.info("App class name is: " + appClassName);
             App app = null;
 
             try {


Mime
View raw message