incubator-s4-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mmo...@apache.org
Subject [42/50] [abbrv] git commit: Fixed bug in dynamic app loading but there seems to be a conflict with dynamic dispatching.
Date Tue, 03 Jan 2012 14:03:29 GMT
Fixed bug in dynamic app loading but there seems to be a conflict with dynamic dispatching.


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

Branch: refs/heads/piper
Commit: 62d5b503d153f1a6081c9651ae45d1e4a38a2126
Parents: 9fec63d
Author: Leo Neumeyer <leo@s4.io>
Authored: Sat Oct 22 19:55:42 2011 -0700
Committer: Leo Neumeyer <leo@s4.io>
Committed: Sat Oct 22 19:55:42 2011 -0700

----------------------------------------------------------------------
 NOTES.md                                           |   42 ++++++++-------
 .../org/apache/s4/base/util/JarClassLoader.java    |    4 +-
 .../java/org/apache/s4/base/util/JarLoader.java    |    7 +--
 .../java/org/apache/s4/base/util/JarResources.java |    6 +-
 .../org/apache/s4/base/util/MultiClassLoader.java  |    1 -
 .../src/main/java/org/apache/s4/core/App.java      |    1 -
 .../src/main/java/org/apache/s4/core/Server.java   |    3 +-
 .../src/main/resources/apps/CounterExample.s4r     |  Bin 12923 -> 53070 bytes
 .../java/org/apache/s4/example/counter/Module.java |    2 -
 .../java/org/apache/s4/example/counter/MyApp.java  |   16 ++----
 .../src/main/resources/s4-piper-example.properties |    1 -
 11 files changed, 35 insertions(+), 48 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-s4/blob/62d5b503/NOTES.md
----------------------------------------------------------------------
diff --git a/NOTES.md b/NOTES.md
index 6206285..c096e43 100644
--- a/NOTES.md
+++ b/NOTES.md
@@ -74,26 +74,28 @@ Implementation-Vendor: Apache S4
 Implementation-Vendor-Id: io.s4
 S4-App-Class: io.s4.example.counter.MyApp
   
-$ jar cmf MANIFEST.MF CounterExample.s4r io
-$ jar tvf CounterExample.s4r 
-     0 Tue Oct 18 22:10:58 PDT 2011 META-INF/
-   272 Tue Oct 18 22:10:58 PDT 2011 META-INF/MANIFEST.MF
-     0 Tue Oct 18 22:10:22 PDT 2011 io/
-     0 Tue Oct 18 22:10:40 PDT 2011 io/s4/
-     0 Tue Oct 18 22:10:44 PDT 2011 io/s4/example/
-     0 Tue Oct 18 22:10:22 PDT 2011 io/s4/example/counter/
-  1160 Tue Oct 18 22:10:22 PDT 2011 io/s4/example/counter/AgeKeyFinder.class
-  1556 Tue Oct 18 22:10:22 PDT 2011 io/s4/example/counter/CounterPE.class
-  1306 Tue Oct 18 22:10:22 PDT 2011 io/s4/example/counter/CountEvent.class
-  1117 Tue Oct 18 22:10:22 PDT 2011 io/s4/example/counter/CountKeyFinder.class
-  1174 Tue Oct 18 22:10:22 PDT 2011 io/s4/example/counter/GenderKeyFinder.class
-  2242 Tue Oct 18 22:10:22 PDT 2011 io/s4/example/counter/GenerateUserEventPE.class
-  3286 Tue Oct 18 22:10:22 PDT 2011 io/s4/example/counter/Module.class
-  4100 Tue Oct 18 22:10:22 PDT 2011 io/s4/example/counter/MyApp.class
-   841 Tue Oct 18 22:10:22 PDT 2011 io/s4/example/counter/PrintPE.class
-   532 Tue Oct 18 22:10:22 PDT 2011 io/s4/example/counter/README.md
-  1209 Tue Oct 18 22:10:22 PDT 2011 io/s4/example/counter/UserEvent.class
-  1118 Tue Oct 18 22:10:22 PDT 2011 io/s4/example/counter/UserIDKeyFinder.class
+$ jar cmf MANIFEST.MF CounterExample.s4r org
+$ jar tfv CounterExample.s4r 
+     0 Sat Oct 22 19:21:06 PDT 2011 META-INF/
+   307 Sat Oct 22 19:21:06 PDT 2011 META-INF/MANIFEST.MF
+     0 Wed Oct 19 08:55:18 PDT 2011 org/
+     0 Wed Oct 19 08:55:18 PDT 2011 org/apache/
+     0 Wed Oct 19 08:55:36 PDT 2011 org/apache/s4/
+     0 Wed Oct 19 08:55:44 PDT 2011 org/apache/s4/example/
+     0 Wed Oct 19 08:55:18 PDT 2011 org/apache/s4/example/counter/
+  1240 Wed Oct 19 08:55:18 PDT 2011 org/apache/s4/example/counter/AgeKeyFinder.class
+  1708 Wed Oct 19 08:55:18 PDT 2011 org/apache/s4/example/counter/CounterPE.class
+  1330 Wed Oct 19 08:55:18 PDT 2011 org/apache/s4/example/counter/CountEvent.class
+  1197 Wed Oct 19 08:55:18 PDT 2011 org/apache/s4/example/counter/CountKeyFinder.class
+  1254 Wed Oct 19 08:55:18 PDT 2011 org/apache/s4/example/counter/GenderKeyFinder.class
+  2378 Wed Oct 19 08:55:18 PDT 2011 org/apache/s4/example/counter/GenerateUserEventPE.class
+  3414 Wed Oct 19 08:55:18 PDT 2011 org/apache/s4/example/counter/Module.class
+  4196 Sat Oct 22 19:19:14 PDT 2011 org/apache/s4/example/counter/MyApp.class
+   897 Wed Oct 19 08:55:18 PDT 2011 org/apache/s4/example/counter/PrintPE.class
+   532 Wed Oct 19 08:55:18 PDT 2011 org/apache/s4/example/counter/README.md
+  1233 Wed Oct 19 08:55:18 PDT 2011 org/apache/s4/example/counter/UserEvent.class
+  1198 Wed Oct 19 08:55:18 PDT 2011 org/apache/s4/example/counter/UserIDKeyFinder.class
+
 </pre>
 
 

http://git-wip-us.apache.org/repos/asf/incubator-s4/blob/62d5b503/subprojects/s4-base/src/main/java/org/apache/s4/base/util/JarClassLoader.java
----------------------------------------------------------------------
diff --git a/subprojects/s4-base/src/main/java/org/apache/s4/base/util/JarClassLoader.java
b/subprojects/s4-base/src/main/java/org/apache/s4/base/util/JarClassLoader.java
index 34ba1e6..8301f62 100644
--- a/subprojects/s4-base/src/main/java/org/apache/s4/base/util/JarClassLoader.java
+++ b/subprojects/s4-base/src/main/java/org/apache/s4/base/util/JarClassLoader.java
@@ -79,9 +79,9 @@ public class JarClassLoader extends URLClassLoader {
         }
        }
        
-       private void addJarResource(File file) throws IOException {
+    private void addJarResource(File file) throws IOException {
         JarFile jarFile = new JarFile(file);
-        addURL(file.toURL());
+        addURL(file.toURI().toURL());
         Enumeration<JarEntry> jarEntries = jarFile.entries();
         while (jarEntries.hasMoreElements()) {
          JarEntry jarEntry = jarEntries.nextElement();

http://git-wip-us.apache.org/repos/asf/incubator-s4/blob/62d5b503/subprojects/s4-base/src/main/java/org/apache/s4/base/util/JarLoader.java
----------------------------------------------------------------------
diff --git a/subprojects/s4-base/src/main/java/org/apache/s4/base/util/JarLoader.java b/subprojects/s4-base/src/main/java/org/apache/s4/base/util/JarLoader.java
index b996270..7fc9c06 100644
--- a/subprojects/s4-base/src/main/java/org/apache/s4/base/util/JarLoader.java
+++ b/subprojects/s4-base/src/main/java/org/apache/s4/base/util/JarLoader.java
@@ -1,6 +1,5 @@
 package org.apache.s4.base.util;
 
-import java.io.IOException;
 import java.util.ArrayList;
 import java.util.Enumeration;
 import java.util.List;
@@ -32,8 +31,8 @@ public class JarLoader extends MultiClassLoader {
         return jarResource.getResource(className);
     }
 
-    public List<Class> getClasses(String path) {
-        List<Class> classes = new ArrayList<Class>();
+    public List<Class<?>> getClasses(String path) {
+        List<Class<?>> classes = new ArrayList<Class<?>>();
         try {
             JarLoader jarLoader = new JarLoader(path);
             JarFile jarFile = new JarFile(path);
@@ -47,7 +46,7 @@ public class JarLoader extends MultiClassLoader {
                                 .substring(0, entry.getName().indexOf(".class"))
                                 .replace("/", ".").replace("\\", ".");
 
-                        Class clazz = jarLoader.loadClass(className);
+                        Class<?> clazz = jarLoader.loadClass(className);
                         // clazz.asSubclass(IoAdapter.class);
                         if (clazz != null) {
                             classes.add(clazz);

http://git-wip-us.apache.org/repos/asf/incubator-s4/blob/62d5b503/subprojects/s4-base/src/main/java/org/apache/s4/base/util/JarResources.java
----------------------------------------------------------------------
diff --git a/subprojects/s4-base/src/main/java/org/apache/s4/base/util/JarResources.java b/subprojects/s4-base/src/main/java/org/apache/s4/base/util/JarResources.java
index 61c441b..2e96c3c 100644
--- a/subprojects/s4-base/src/main/java/org/apache/s4/base/util/JarResources.java
+++ b/subprojects/s4-base/src/main/java/org/apache/s4/base/util/JarResources.java
@@ -23,8 +23,8 @@ public final class JarResources {
     public boolean debugOn = false;
 
     // jar resource mapping tables
-    private Hashtable htSizes = new Hashtable();
-    private Hashtable htJarContents = new Hashtable();
+    private Map<String, Integer> htSizes = new HashMap<String, Integer>();
+    private Map<String, Object> htJarContents = new HashMap<String, Object>();
 
     // a jar file
     private String jarFileName;
@@ -56,7 +56,7 @@ public final class JarResources {
         try {
             // extracts just sizes only.
             ZipFile zf = new ZipFile(jarFileName);
-            Enumeration e = zf.entries();
+            Enumeration<? extends ZipEntry> e = zf.entries();
             while (e.hasMoreElements()) {
                 ZipEntry ze = (ZipEntry) e.nextElement();
 

http://git-wip-us.apache.org/repos/asf/incubator-s4/blob/62d5b503/subprojects/s4-base/src/main/java/org/apache/s4/base/util/MultiClassLoader.java
----------------------------------------------------------------------
diff --git a/subprojects/s4-base/src/main/java/org/apache/s4/base/util/MultiClassLoader.java
b/subprojects/s4-base/src/main/java/org/apache/s4/base/util/MultiClassLoader.java
index 51221fa..ab1dabf 100644
--- a/subprojects/s4-base/src/main/java/org/apache/s4/base/util/MultiClassLoader.java
+++ b/subprojects/s4-base/src/main/java/org/apache/s4/base/util/MultiClassLoader.java
@@ -1,6 +1,5 @@
 package org.apache.s4.base.util;
 
-import java.io.FileInputStream;
 import java.util.Map;
 
 import org.slf4j.Logger;

http://git-wip-us.apache.org/repos/asf/incubator-s4/blob/62d5b503/subprojects/s4-core/src/main/java/org/apache/s4/core/App.java
----------------------------------------------------------------------
diff --git a/subprojects/s4-core/src/main/java/org/apache/s4/core/App.java b/subprojects/s4-core/src/main/java/org/apache/s4/core/App.java
index cbf9223..ecca99d 100644
--- a/subprojects/s4-core/src/main/java/org/apache/s4/core/App.java
+++ b/subprojects/s4-core/src/main/java/org/apache/s4/core/App.java
@@ -23,7 +23,6 @@ import java.util.List;
 import java.util.concurrent.TimeUnit;
 
 import org.apache.s4.base.Event;
-import org.apache.s4.core.App.ClockType;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 

http://git-wip-us.apache.org/repos/asf/incubator-s4/blob/62d5b503/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 fff8e7d..414ec84 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
@@ -80,7 +80,7 @@ public class Server {
         
         // LOOK AT the custom classloader class MultiClassLoader, for now it
 
-        String appClassName = "io.s4.example.counter.MyApp"; // THE APP CLASS WE NEED TO
GET FROM THE MANIFEST.
+        String appClassName = "org.apache.s4.example.counter.MyApp"; // THE APP CLASS WE
NEED TO GET FROM THE MANIFEST.
         App myApp=null;
         
         try {
@@ -90,7 +90,6 @@ public class Server {
             System.out.println("Caught exception : " + e);
             e.printStackTrace();
         }
-        myApp.start();
         
         Sender sender = injector.getInstance(Sender.class);
         Receiver receiver = injector.getInstance(Receiver.class);

http://git-wip-us.apache.org/repos/asf/incubator-s4/blob/62d5b503/subprojects/s4-core/src/main/resources/apps/CounterExample.s4r
----------------------------------------------------------------------
diff --git a/subprojects/s4-core/src/main/resources/apps/CounterExample.s4r b/subprojects/s4-core/src/main/resources/apps/CounterExample.s4r
index 9eced41..a7c311c 100644
Binary files a/subprojects/s4-core/src/main/resources/apps/CounterExample.s4r and b/subprojects/s4-core/src/main/resources/apps/CounterExample.s4r
differ

http://git-wip-us.apache.org/repos/asf/incubator-s4/blob/62d5b503/subprojects/s4-example/src/main/java/org/apache/s4/example/counter/Module.java
----------------------------------------------------------------------
diff --git a/subprojects/s4-example/src/main/java/org/apache/s4/example/counter/Module.java
b/subprojects/s4-example/src/main/java/org/apache/s4/example/counter/Module.java
index 98961d2..d8df20a 100644
--- a/subprojects/s4-example/src/main/java/org/apache/s4/example/counter/Module.java
+++ b/subprojects/s4-example/src/main/java/org/apache/s4/example/counter/Module.java
@@ -107,7 +107,5 @@ public class Module extends AbstractModule {
         /* Use Kryo to serialize events. */
         bind(SerializerDeserializer.class).to(KryoSerDeser.class);
 
-        bind(Integer.class).annotatedWith(Names.named("pe.counter.interval"))
-                .toInstance(config.getInt("pe.counter.interval"));
     }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-s4/blob/62d5b503/subprojects/s4-example/src/main/java/org/apache/s4/example/counter/MyApp.java
----------------------------------------------------------------------
diff --git a/subprojects/s4-example/src/main/java/org/apache/s4/example/counter/MyApp.java
b/subprojects/s4-example/src/main/java/org/apache/s4/example/counter/MyApp.java
index 80ece4f..7ac1d7a 100644
--- a/subprojects/s4-example/src/main/java/org/apache/s4/example/counter/MyApp.java
+++ b/subprojects/s4-example/src/main/java/org/apache/s4/example/counter/MyApp.java
@@ -24,9 +24,7 @@ import org.apache.s4.core.Sender;
 import org.apache.s4.core.Stream;
 
 import com.google.inject.Guice;
-import com.google.inject.Inject;
 import com.google.inject.Injector;
-import com.google.inject.name.Named;
 
 
 /*
@@ -37,14 +35,11 @@ import com.google.inject.name.Named;
 
 final public class MyApp extends App {
 
-    final private int interval;
+    final private int interval = 1;
     private GenerateUserEventPE generateUserEventPE;
 
     /*
-     * We use Guice to pass parameters to the application. This is just a
-     * trivial example where we get the value for the variable interval from a
-     * properties file. (Saved under "src/main/resources".) All configuration
-     * details are done in Module.java.
+     * 
      * 
      * The application graph itself is created in this Class. However,
      * developers may provide tools for creating apps which will generate the
@@ -54,12 +49,9 @@ final public class MyApp extends App {
      * instance that is used as a prototype from which all PE instance will be
      * created. The prototype itself is not used as an instance. (Except when
      * the PE is of type Singleton PE). To create a data structure for each PE
-     * instance you must do in the method ProcessingElement.initPEInstance().
+     * instance you must do it in the method ProcessingElement.onCreate().
      */
-    @Inject
-    public MyApp(@Named("pe.counter.interval") int interval) {
-        this.interval = interval;
-    }
+
 
     /*
      * Build the application graph using POJOs. Don't like it? Write a nice

http://git-wip-us.apache.org/repos/asf/incubator-s4/blob/62d5b503/subprojects/s4-example/src/main/resources/s4-piper-example.properties
----------------------------------------------------------------------
diff --git a/subprojects/s4-example/src/main/resources/s4-piper-example.properties b/subprojects/s4-example/src/main/resources/s4-piper-example.properties
index e9dd18c..b60f40a 100644
--- a/subprojects/s4-example/src/main/resources/s4-piper-example.properties
+++ b/subprojects/s4-example/src/main/resources/s4-piper-example.properties
@@ -1,4 +1,3 @@
-pe.counter.interval = 1
 comm.queue_emmiter_size = 8000
 comm.queue_listener_size = 8000
 cluster.hosts = localhost


Mime
View raw message