You are viewing a plain text version of this content. The canonical link for it is here.
Posted to s4-commits@incubator.apache.org by mm...@apache.org on 2012/07/25 21:15:25 UTC
[7/13] git commit: Javadoc updates - added package docs - updated
existing javadoc, added some missing javadoc - removed unused classes
Javadoc updates
- added package docs
- updated existing javadoc, added some missing javadoc
- removed unused classes
Project: http://git-wip-us.apache.org/repos/asf/incubator-s4/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-s4/commit/c349777b
Tree: http://git-wip-us.apache.org/repos/asf/incubator-s4/tree/c349777b
Diff: http://git-wip-us.apache.org/repos/asf/incubator-s4/diff/c349777b
Branch: refs/heads/S4-88
Commit: c349777b5bae0cdd4a05cadd054f995bc94fe558
Parents: 44e3546
Author: Matthieu Morel <mm...@apache.org>
Authored: Tue Jul 24 12:44:02 2012 +0200
Committer: Matthieu Morel <mm...@apache.org>
Committed: Tue Jul 24 18:54:00 2012 +0200
----------------------------------------------------------------------
.../src/main/java/org/apache/s4/base/Emitter.java | 12 +-
.../src/main/java/org/apache/s4/base/Event.java | 6 +-
.../main/java/org/apache/s4/base/EventMessage.java | 10 +-
.../src/main/java/org/apache/s4/base/Hasher.java | 4 +
.../src/main/java/org/apache/s4/base/Key.java | 13 +-
.../main/java/org/apache/s4/base/KeyFinder.java | 10 +-
.../src/main/java/org/apache/s4/base/Listener.java | 8 +-
.../java/org/apache/s4/base/RemoteEmitter.java | 4 +
.../org/apache/s4/base/SerializerDeserializer.java | 4 +
.../main/java/org/apache/s4/base/package-info.java | 4 +
.../org/apache/s4/base/util/JarClassLoader.java | 127 ---------
.../java/org/apache/s4/base/util/JarResources.java | 200 ---------------
.../org/apache/s4/base/util/MultiClassLoader.java | 142 ----------
.../org/apache/s4/base/util/TestClassLoader.java | 64 -----
.../java/org/apache/s4/base/util/package-info.java | 4 +
.../java/org/apache/s4/comm/DefaultHasher.java | 4 +
.../java/org/apache/s4/comm/QueueingEmitter.java | 121 ---------
.../java/org/apache/s4/comm/QueueingListener.java | 93 -------
.../org/apache/s4/comm/RemoteEmitterFactory.java | 5 +
.../apache/s4/comm/loopback/LoopBackEmitter.java | 55 ----
.../apache/s4/comm/loopback/LoopBackListener.java | 60 -----
.../main/java/org/apache/s4/comm/package-info.java | 4 +
.../org/apache/s4/comm/serialize/KryoSerDeser.java | 4 +
.../org/apache/s4/comm/serialize/package-info.java | 4 +
.../java/org/apache/s4/comm/tcp/package-info.java | 4 +
.../java/org/apache/s4/comm/tools/TaskSetup.java | 4 +
.../org/apache/s4/comm/tools/package-info.java | 4 +
.../apache/s4/comm/topology/AssignmentFromZK.java | 4 +
.../org/apache/s4/comm/topology/ClusterFromZK.java | 16 +-
.../org/apache/s4/comm/topology/ClusterNode.java | 19 +-
.../apache/s4/comm/topology/PhysicalCluster.java | 3 +-
.../apache/s4/comm/topology/StreamConsumer.java | 2 +-
.../org/apache/s4/comm/topology/package-info.java | 4 +
.../java/org/apache/s4/comm/udp/UDPEmitter.java | 4 +
.../org/apache/s4/comm/udp/UDPRemoteEmitter.java | 4 +
.../java/org/apache/s4/comm/udp/package-info.java | 4 +
.../src/main/java/org/apache/s4/core/App.java | 6 +-
.../src/main/java/org/apache/s4/core/Key.java | 13 +-
.../src/main/java/org/apache/s4/core/Main.java | 8 +
.../java/org/apache/s4/core/ProcessingElement.java | 6 +-
.../main/java/org/apache/s4/core/RemoteSender.java | 4 +
.../java/org/apache/s4/core/RemoteSenders.java | 5 +
.../src/main/java/org/apache/s4/core/Stream.java | 18 +-
.../org/apache/s4/core/adapter/package-info.java | 4 +
.../s4/core/ft/DefaultFileSystemStateStorage.java | 14 +-
.../org/apache/s4/core/ft/StorageCallback.java | 2 +-
.../java/org/apache/s4/core/ft/package-info.java | 21 ++
.../java/org/apache/s4/core/gen/package-info.java | 5 +
.../main/java/org/apache/s4/core/package-info.java | 4 +
.../java/org/apache/s4/core/util/package-info.java | 4 +
.../java/org/apache/s4/deploy/HttpS4RFetcher.java | 7 +-
.../java/org/apache/s4/deploy/package-info.java | 5 +
.../main/java/org/apache/s4/edsl/AppBuilder.java | 1 -
.../java/org/apache/s4/example/counter/Module.java | 2 -
.../java/org/apache/s4/example/counter/README.md | 2 +-
.../org/apache/s4/example/model/MaximizerPE.java | 11 +-
.../java/org/apache/s4/example/model/Module.java | 13 +-
.../java/org/apache/s4/example/model/MyApp.java | 2 -
.../org/apache/s4/model/GaussianMixtureModel.java | 1 -
.../java/org/apache/s4/model/GaussianModel.java | 1 -
.../src/main/java/org/apache/s4/model/Model.java | 5 -
.../main/java/org/apache/s4/util/MatrixOps.java | 1 -
.../java/org/apache/s4/tools/package-info.java | 4 +
.../src/main/java/s4app/ProducerPE.java | 2 +-
64 files changed, 226 insertions(+), 979 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-s4/blob/c349777b/subprojects/s4-base/src/main/java/org/apache/s4/base/Emitter.java
----------------------------------------------------------------------
diff --git a/subprojects/s4-base/src/main/java/org/apache/s4/base/Emitter.java b/subprojects/s4-base/src/main/java/org/apache/s4/base/Emitter.java
index 0738d11..c73dd1c 100644
--- a/subprojects/s4-base/src/main/java/org/apache/s4/base/Emitter.java
+++ b/subprojects/s4-base/src/main/java/org/apache/s4/base/Emitter.java
@@ -18,12 +18,18 @@
package org.apache.s4.base;
+/**
+ * Defines an event emitter, responsible for sending an event to a given partition of the cluster.
+ *
+ */
public interface Emitter {
- /*
- * @param partitionId - destination partition
+ /**
+ * @param partitionId
+ * - destination partition
*
- * @param message - message payload that needs to be sent
+ * @param message
+ * - message payload that needs to be sent
*
* @return - true - if message is sent across successfully - false - if send fails
*/
http://git-wip-us.apache.org/repos/asf/incubator-s4/blob/c349777b/subprojects/s4-base/src/main/java/org/apache/s4/base/Event.java
----------------------------------------------------------------------
diff --git a/subprojects/s4-base/src/main/java/org/apache/s4/base/Event.java b/subprojects/s4-base/src/main/java/org/apache/s4/base/Event.java
index 8cf180d..4e47723 100644
--- a/subprojects/s4-base/src/main/java/org/apache/s4/base/Event.java
+++ b/subprojects/s4-base/src/main/java/org/apache/s4/base/Event.java
@@ -71,10 +71,10 @@ public class Event {
}
/**
- * The stream id is used to identify streams uniquely in a cluster configuration. It is not required to operate in
- * local mode.
*
- * @param targetStreamId
+ * @param streamName
+ * used to identify streams uniquely in a cluster configuration. It is not required to operate in local
+ * mode.
*/
public void setStreamId(String streamName) {
this.streamName = streamName;
http://git-wip-us.apache.org/repos/asf/incubator-s4/blob/c349777b/subprojects/s4-base/src/main/java/org/apache/s4/base/EventMessage.java
----------------------------------------------------------------------
diff --git a/subprojects/s4-base/src/main/java/org/apache/s4/base/EventMessage.java b/subprojects/s4-base/src/main/java/org/apache/s4/base/EventMessage.java
index 2ae26f6..e777687 100644
--- a/subprojects/s4-base/src/main/java/org/apache/s4/base/EventMessage.java
+++ b/subprojects/s4-base/src/main/java/org/apache/s4/base/EventMessage.java
@@ -19,15 +19,17 @@
package org.apache.s4.base;
/**
- *
+ * <p>
* Encapsulates application-level events of type {@link Event}.
- *
+ * </p>
+ * <p>
* Indeed, events that are defined at the application level can only be handled by the classloader of the corresponding
* application.
- *
+ * </p>
+ * <p>
* Includes routing information (application name, stream name), so that this message can be dispatched at the
* communication level.
- *
+ * </p>
*
*/
public class EventMessage {
http://git-wip-us.apache.org/repos/asf/incubator-s4/blob/c349777b/subprojects/s4-base/src/main/java/org/apache/s4/base/Hasher.java
----------------------------------------------------------------------
diff --git a/subprojects/s4-base/src/main/java/org/apache/s4/base/Hasher.java b/subprojects/s4-base/src/main/java/org/apache/s4/base/Hasher.java
index 7e3a914..18d5d48 100644
--- a/subprojects/s4-base/src/main/java/org/apache/s4/base/Hasher.java
+++ b/subprojects/s4-base/src/main/java/org/apache/s4/base/Hasher.java
@@ -18,6 +18,10 @@
package org.apache.s4.base;
+/**
+ * Defines a transformation between a key and a hashcode.
+ *
+ */
public interface Hasher {
long hash(String hashKey);
}
http://git-wip-us.apache.org/repos/asf/incubator-s4/blob/c349777b/subprojects/s4-base/src/main/java/org/apache/s4/base/Key.java
----------------------------------------------------------------------
diff --git a/subprojects/s4-base/src/main/java/org/apache/s4/base/Key.java b/subprojects/s4-base/src/main/java/org/apache/s4/base/Key.java
index 19eb27f..ef959f6 100644
--- a/subprojects/s4-base/src/main/java/org/apache/s4/base/Key.java
+++ b/subprojects/s4-base/src/main/java/org/apache/s4/base/Key.java
@@ -22,14 +22,13 @@ import java.util.List;
import org.apache.commons.lang.StringUtils;
-/*
- * The Key class is used to get the value of the key on a specific type of
- * event. This is done to abstract all the complexity required to get the
- * value. The method for getting the value is implemented in a method of
- * an object of type KeyFinder<T>.
+/**
+ * The Key class is used to get the value of the key on a specific type of event. This is done to abstract all the
+ * complexity required to get the value. The method for getting the value is implemented in a method of an object of
+ * type KeyFinder<T>.
*
- * The application programmer provides the events and the corresponding
- * finders. The framework will use it to key on events.
+ * The application programmer provides the events and the corresponding finders. The framework will use it to key on
+ * events.
*/
public class Key<T extends Event> {
http://git-wip-us.apache.org/repos/asf/incubator-s4/blob/c349777b/subprojects/s4-base/src/main/java/org/apache/s4/base/KeyFinder.java
----------------------------------------------------------------------
diff --git a/subprojects/s4-base/src/main/java/org/apache/s4/base/KeyFinder.java b/subprojects/s4-base/src/main/java/org/apache/s4/base/KeyFinder.java
index 23cfe81..c1aa1f2 100644
--- a/subprojects/s4-base/src/main/java/org/apache/s4/base/KeyFinder.java
+++ b/subprojects/s4-base/src/main/java/org/apache/s4/base/KeyFinder.java
@@ -20,13 +20,11 @@ package org.apache.s4.base;
import java.util.List;
-
-/*
- * The KeyFinder returns a list with one or more String values
- * (One value for single keys, and more than one value for
- * composite keys.)
+/**
+ * The KeyFinder returns a list with one or more String values (One value for single keys, and more than one value for
+ * composite keys.)
* */
-abstract public interface KeyFinder<T extends Event> {
+public interface KeyFinder<T extends Event> {
public List<String> get(T event);
}
http://git-wip-us.apache.org/repos/asf/incubator-s4/blob/c349777b/subprojects/s4-base/src/main/java/org/apache/s4/base/Listener.java
----------------------------------------------------------------------
diff --git a/subprojects/s4-base/src/main/java/org/apache/s4/base/Listener.java b/subprojects/s4-base/src/main/java/org/apache/s4/base/Listener.java
index c4060b1..608d628 100644
--- a/subprojects/s4-base/src/main/java/org/apache/s4/base/Listener.java
+++ b/subprojects/s4-base/src/main/java/org/apache/s4/base/Listener.java
@@ -25,11 +25,13 @@ package org.apache.s4.base;
*/
public interface Listener {
- /*
+ /**
* Perform blocking receive on the appropriate communication channel
*
- * @return <ul><li> byte[] message returned by the channel </li> <li> null if the associated blocking thread is
- * interrupted </li> </ul>
+ * @return <ul>
+ * <li>byte[] message returned by the channel</li>
+ * <li>null if the associated blocking thread is interrupted</li>
+ * </ul>
*/
byte[] recv();
http://git-wip-us.apache.org/repos/asf/incubator-s4/blob/c349777b/subprojects/s4-base/src/main/java/org/apache/s4/base/RemoteEmitter.java
----------------------------------------------------------------------
diff --git a/subprojects/s4-base/src/main/java/org/apache/s4/base/RemoteEmitter.java b/subprojects/s4-base/src/main/java/org/apache/s4/base/RemoteEmitter.java
index f305bd6..dcd7728 100644
--- a/subprojects/s4-base/src/main/java/org/apache/s4/base/RemoteEmitter.java
+++ b/subprojects/s4-base/src/main/java/org/apache/s4/base/RemoteEmitter.java
@@ -18,6 +18,10 @@
package org.apache.s4.base;
+/**
+ * Marker interface for identifying emitters to remote S4 clusters.
+ *
+ */
public interface RemoteEmitter extends Emitter {
}
http://git-wip-us.apache.org/repos/asf/incubator-s4/blob/c349777b/subprojects/s4-base/src/main/java/org/apache/s4/base/SerializerDeserializer.java
----------------------------------------------------------------------
diff --git a/subprojects/s4-base/src/main/java/org/apache/s4/base/SerializerDeserializer.java b/subprojects/s4-base/src/main/java/org/apache/s4/base/SerializerDeserializer.java
index 834cc6b..f7ef101 100644
--- a/subprojects/s4-base/src/main/java/org/apache/s4/base/SerializerDeserializer.java
+++ b/subprojects/s4-base/src/main/java/org/apache/s4/base/SerializerDeserializer.java
@@ -18,6 +18,10 @@
package org.apache.s4.base;
+/**
+ * Defines serialization and deserialization methods used within the S4 platform, typically for events and PEs.
+ *
+ */
public interface SerializerDeserializer {
public byte[] serialize(Object message);
http://git-wip-us.apache.org/repos/asf/incubator-s4/blob/c349777b/subprojects/s4-base/src/main/java/org/apache/s4/base/package-info.java
----------------------------------------------------------------------
diff --git a/subprojects/s4-base/src/main/java/org/apache/s4/base/package-info.java b/subprojects/s4-base/src/main/java/org/apache/s4/base/package-info.java
new file mode 100644
index 0000000..3eafc92
--- /dev/null
+++ b/subprojects/s4-base/src/main/java/org/apache/s4/base/package-info.java
@@ -0,0 +1,4 @@
+/**
+ * Defines some of the basic elements of the S4 platforms.
+ */
+package org.apache.s4.base;
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-s4/blob/c349777b/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
deleted file mode 100644
index 41bcb00..0000000
--- a/subprojects/s4-base/src/main/java/org/apache/s4/base/util/JarClassLoader.java
+++ /dev/null
@@ -1,127 +0,0 @@
-/**
- * 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.s4.base.util;
-
-import java.io.Closeable;
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.net.URL;
-import java.net.URLClassLoader;
-import java.security.CodeSource;
-import java.security.ProtectionDomain;
-import java.util.Enumeration;
-import java.util.jar.JarEntry;
-import java.util.jar.JarFile;
-
-/**
- * Our goal is to be able to put apps and dependent classes in a single jar that
- * we can easily read using a URL.
- *
- * With derived work from <a href=
- * "http://qdolan.blogspot.com/2008/10/embedded-jar-classloader-in-under-100.html"
- * >this blog</a>.
- *
- * @author Leo Neumeyer
- *
- */
-public class JarClassLoader extends URLClassLoader {
-
- private static void close(Closeable closeable) {
- if (closeable != null) {
- try {
- closeable.close();
- } catch (IOException e) {
- e.printStackTrace();
- }
- }
- }
-
- private static boolean isJar(String fileName) {
- return fileName != null && fileName.toLowerCase().endsWith(".jar");
- }
-
- private static File jarEntryAsFile(JarFile jarFile, JarEntry jarEntry) throws IOException {
- InputStream input = null;
- OutputStream output = null;
- try {
- String name = jarEntry.getName().replace('/', '_');
- int i = name.lastIndexOf(".");
- String extension = i > -1 ? name.substring(i) : "";
- File file = File.createTempFile(name.substring(0, name.length() - extension.length()) + ".", extension);
- file.deleteOnExit();
- input = jarFile.getInputStream(jarEntry);
- output = new FileOutputStream(file);
- int readCount;
- byte[] buffer = new byte[4096];
- while ((readCount = input.read(buffer)) != -1) {
- output.write(buffer, 0, readCount);
- }
- return file;
- } finally {
- close(input);
- close(output);
- }
- }
-
- public JarClassLoader(URL[] urls, ClassLoader parent) {
- super(urls, parent);
- try {
- ProtectionDomain protectionDomain = getClass().getProtectionDomain();
- CodeSource codeSource = protectionDomain.getCodeSource();
- URL rootJarUrl = codeSource.getLocation();
- String rootJarName = rootJarUrl.getFile();
- if (isJar(rootJarName)) {
- addJarResource(new File(rootJarUrl.getPath()));
- }
- } catch (IOException e) {
- e.printStackTrace();
- }
- }
-
- private void addJarResource(File file) throws IOException {
- JarFile jarFile = new JarFile(file);
- addURL(file.toURI().toURL());
- Enumeration<JarEntry> jarEntries = jarFile.entries();
- while (jarEntries.hasMoreElements()) {
- JarEntry jarEntry = jarEntries.nextElement();
- if (!jarEntry.isDirectory() && isJar(jarEntry.getName())) {
- addJarResource(jarEntryAsFile(jarFile, jarEntry));
- }
- }
- }
-
- @Override
- protected synchronized Class<?> loadClass(String name, boolean resolve)
- throws ClassNotFoundException {
- try {
- Class<?> clazz = findLoadedClass(name);
- if (clazz == null) {
- clazz = findClass(name);
- if (resolve)
- resolveClass(clazz);
- }
- return clazz;
- } catch (ClassNotFoundException e) {
- return super.loadClass(name, resolve);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-s4/blob/c349777b/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
deleted file mode 100644
index 781fdb5..0000000
--- a/subprojects/s4-base/src/main/java/org/apache/s4/base/util/JarResources.java
+++ /dev/null
@@ -1,200 +0,0 @@
-/**
- * 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.s4.base.util;
-
-import java.io.*;
-import java.util.*;
-import java.util.zip.*;
-
-/**
- * JarResources: JarResources maps all resources included in a Zip or Jar file. Additionaly, it provides a method to
- * extract one as a blob.
- *
- * <p>
- * CREDITS
- *
- * <p>
- * The source code for this class was derived from <a href=
- * "http://code.google.com/p/db4o-om/source/browse/trunk/objectmanager-api/src/com/db4o/objectmanager/configuration/MultiClassLoader.java"
- * >this project</a>.
- *
- */
-public final class JarResources {
-
- // external debug flag
- public boolean debugOn = false;
-
- // jar resource mapping tables
- private Map<String, Integer> htSizes = new HashMap<String, Integer>();
- private Map<String, Object> htJarContents = new HashMap<String, Object>();
-
- // a jar file
- private String jarFileName;
-
- /**
- * creates a JarResources. It extracts all resources from a Jar into an internal hashtable, keyed by resource names.
- *
- * @param jarFileName
- * a jar or zip file
- */
- public JarResources(String jarFileName) {
- this.jarFileName = jarFileName;
- init();
- }
-
- /**
- * Extracts a jar resource as a blob.
- *
- * @param name
- * a resource name.
- */
- public byte[] getResource(String name) {
- return (byte[]) htJarContents.get(name);
- }
-
- /** initializes internal hash tables with Jar file resources. */
- private void init() {
- try {
- // extracts just sizes only.
- ZipFile zf = new ZipFile(jarFileName);
- Enumeration<? extends ZipEntry> e = zf.entries();
- while (e.hasMoreElements()) {
- ZipEntry ze = (ZipEntry) e.nextElement();
-
- if (debugOn) {
- System.out.println(dumpZipEntry(ze));
- }
-
- htSizes.put(ze.getName(), new Integer((int) ze.getSize()));
- }
- zf.close();
-
- // extract resources and put them into the hashtable.
- FileInputStream fis = new FileInputStream(jarFileName);
- BufferedInputStream bis = new BufferedInputStream(fis);
- ZipInputStream zis = new ZipInputStream(bis);
- ZipEntry ze = null;
- while ((ze = zis.getNextEntry()) != null) {
- if (ze.isDirectory()) {
- continue;
- }
-
- if (debugOn) {
- System.out.println("ze.getName()=" + ze.getName() + "," + "getSize()=" + ze.getSize());
- }
-
- int size = (int) ze.getSize();
- // -1 means unknown size.
- if (size == -1) {
- size = ((Integer) htSizes.get(ze.getName())).intValue();
- }
-
- byte[] b = new byte[(int) size];
- int rb = 0;
- int chunk = 0;
- while (((int) size - rb) > 0) {
- chunk = zis.read(b, rb, (int) size - rb);
- if (chunk == -1) {
- break;
- }
- rb += chunk;
- }
-
- // add to internal resource hashtable
- htJarContents.put(ze.getName(), b);
-
- if (debugOn) {
- System.out.println(ze.getName() + " rb=" + rb + ",size=" + size + ",csize="
- + ze.getCompressedSize());
- }
- }
- zis.close();
- } catch (NullPointerException e) {
- System.out.println("done.");
- } catch (FileNotFoundException e) {
- e.printStackTrace();
- } catch (IOException e) {
- e.printStackTrace();
- }
- }
-
- /**
- * Dumps a zip entry into a string.
- *
- * @param ze
- * a ZipEntry
- */
- private String dumpZipEntry(ZipEntry ze) {
- StringBuffer sb = new StringBuffer();
- if (ze.isDirectory()) {
- sb.append("d ");
- } else {
- sb.append("f ");
- }
-
- if (ze.getMethod() == ZipEntry.STORED) {
- sb.append("stored ");
- } else {
- sb.append("defalted ");
- }
-
- sb.append(ze.getName());
- sb.append("\t");
- sb.append("" + ze.getSize());
- if (ze.getMethod() == ZipEntry.DEFLATED) {
- sb.append("/" + ze.getCompressedSize());
- }
-
- return (sb.toString());
- }
-
- /**
- * Is a test driver. Given a jar file and a resource name, it trys to extract the resource and then tells us whether
- * it could or not.
- *
- * <strong>Example</strong> Let's say you have a JAR file which jarred up a bunch of gif image files. Now, by using
- * JarResources, you could extract, create, and display those images on-the-fly.
- *
- * <pre>
- * ...
- * JarResources JR=new JarResources("GifBundle.jar");
- * Image image=Toolkit.createImage(JR.getResource("logo.gif");
- * Image logo=Toolkit.getDefaultToolkit().createImage(
- * JR.getResources("logo.gif")
- * );
- * ...
- * </pre>
- */
- public static void main(String[] args) throws IOException {
- if (args.length != 2) {
- System.err.println("usage: java JarResources <jar file name> <resource name>");
- System.exit(1);
- }
-
- JarResources jr = new JarResources(args[0]);
- byte[] buff = jr.getResource(args[1]);
- if (buff == null) {
- System.out.println("Could not find " + args[1] + ".");
- } else {
- System.out.println("Found " + args[1] + " (length=" + buff.length + ").");
- }
- }
-
-} // End of JarResources class.
-
http://git-wip-us.apache.org/repos/asf/incubator-s4/blob/c349777b/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
deleted file mode 100644
index 47d9ba1..0000000
--- a/subprojects/s4-base/src/main/java/org/apache/s4/base/util/MultiClassLoader.java
+++ /dev/null
@@ -1,142 +0,0 @@
-/**
- * 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.s4.base.util;
-
-import java.util.Map;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.google.common.collect.MapMaker;
-
-/**
- * Custom class loader to load classes in its own classloader.
- *
- * <p>
- * CREDITS
- *
- * <p>
- * The source code for this class was derived from <a href=
- * "http://code.google.com/p/db4o-om/source/browse/trunk/objectmanager-api/src/com/db4o/objectmanager/configuration/MultiClassLoader.java"
- * >this project</a> which was derived from this <a href=
- * "http://www.javaworld.com/javaworld/jw-10-1996/jw-10-indepth.html?page=1" >article by Chuck McManis</a>.
- *
- *
- * Thank you to the authors!
- */
-abstract public class MultiClassLoader extends ClassLoader {
-
- private static final Logger logger = LoggerFactory.getLogger(MultiClassLoader.class);
-
- private final Map<String, Class<?>> classes;
- private char classNameReplacementChar;
-
- public MultiClassLoader() {
- classes = new MapMaker().makeMap();
- }
-
- // ---------- Superclass Overrides ------------------------
- /**
- * This is a simple version for external clients since they will always want the class resolved before it is
- * returned to them.
- */
- @Override
- public Class<?> loadClass(String className) throws ClassNotFoundException {
- return (loadClass(className, true));
- }
-
- @Override
- public synchronized Class<?> loadClass(String className, boolean resolveIt) throws ClassNotFoundException {
-
- Class<?> result;
- byte[] classBytes;
- logger.trace("MultiClassLoader loadClass - className: " + className + ", resolveIt: " + resolveIt);
-
- /* Check our local cache of classes. */
- result = classes.get(className);
- if (result != null) {
- logger.trace("Returning cached result for class [{}]", className);
- return result;
- }
-
- /* Check with the primordial class loader. */
- try {
- result = super.findSystemClass(className);
- logger.trace("Returning system class (in CLASSPATH) [{}]", className);
- return result;
- } catch (ClassNotFoundException e) {
- logger.trace("Not a system class [{}]", className);
- }
-
- classBytes = loadClassBytes(className);
- if (classBytes == null) {
- throw new ClassNotFoundException();
- }
-
- /* Define it (parse the class file). */
- try {
- result = defineClass(className, classBytes, 0, classBytes.length);
- if (result == null) {
- throw new ClassFormatError();
- }
- } catch (NoClassDefFoundError ex) {
- // Dependencies were not found
- logger.warn(ex.getMessage());
- }
-
- /* Resolve if necessary. */
- if (resolveIt)
- resolveClass(result);
-
- /* Done. */
- if (result == null)
- return null;
- classes.put(className, result);
- logger.trace("Returning newly loaded class [{}]", className);
- return result;
- }
-
- /**
- * This optional call allows a class name such as "COM.test.Hello" to be changed to "COM_test_Hello", which is
- * useful for storing classes from different packages in the same retrieval directory. In the above example the char
- * would be '_'.
- */
- public void setClassNameReplacementChar(char replacement) {
- classNameReplacementChar = replacement;
- }
-
- /** Simple method to read a class file from a known location. */
- abstract protected byte[] loadClassBytes(String className);
-
- protected String formatClassName(String className) {
- if (classNameReplacementChar == '\u0000') {
- // '/' is used to map the package to the path
- return className.replace('.', '/') + ".class";
- } else {
- // Replace '.' with custom char, such as '_'
- return className.replace('.', classNameReplacementChar) + ".class";
- }
- }
-
- // --- Std
- protected static void print(String text) {
- System.out.println(text);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-s4/blob/c349777b/subprojects/s4-base/src/main/java/org/apache/s4/base/util/TestClassLoader.java
----------------------------------------------------------------------
diff --git a/subprojects/s4-base/src/main/java/org/apache/s4/base/util/TestClassLoader.java b/subprojects/s4-base/src/main/java/org/apache/s4/base/util/TestClassLoader.java
deleted file mode 100644
index 6222ccf..0000000
--- a/subprojects/s4-base/src/main/java/org/apache/s4/base/util/TestClassLoader.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/**
- * 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.s4.base.util;
-
-import java.io.FileInputStream;
-import java.io.IOException;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class TestClassLoader extends MultiClassLoader {
-
- private static final Logger logger = LoggerFactory.getLogger(TestClassLoader.class);
-
- @Override
- /** Simple method to read a class file from a known location. */
- public byte[] loadClassBytes(String className) {
-
- byte[] bytes = null;
- String filename = "/tmp/" + className + ".impl";
- logger.debug("Reading: " + filename);
-
- FileInputStream fi = null;
- try {
- fi = new FileInputStream(filename);
- bytes = new byte[fi.available()];
- fi.read(bytes);
- return bytes;
- } catch (Exception e) {
-
- /*
- * If we caught an exception, either the class wasn't found or it was unreadable by our process.
- */
- logger.error("Unable to load class: {}.", filename);
- e.printStackTrace();
- return null;
- } finally {
- if (fi != null) {
- try {
- fi.close();
- } catch (IOException e) {
- logger.warn("Exception while closing input stream", e);
- }
- }
- }
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-s4/blob/c349777b/subprojects/s4-base/src/main/java/org/apache/s4/base/util/package-info.java
----------------------------------------------------------------------
diff --git a/subprojects/s4-base/src/main/java/org/apache/s4/base/util/package-info.java b/subprojects/s4-base/src/main/java/org/apache/s4/base/util/package-info.java
new file mode 100644
index 0000000..ea71f1c
--- /dev/null
+++ b/subprojects/s4-base/src/main/java/org/apache/s4/base/util/package-info.java
@@ -0,0 +1,4 @@
+/**
+ * Utility classes, mostly related to classloading.
+ */
+package org.apache.s4.base.util;
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-s4/blob/c349777b/subprojects/s4-comm/src/main/java/org/apache/s4/comm/DefaultHasher.java
----------------------------------------------------------------------
diff --git a/subprojects/s4-comm/src/main/java/org/apache/s4/comm/DefaultHasher.java b/subprojects/s4-comm/src/main/java/org/apache/s4/comm/DefaultHasher.java
index 656bfa4..377647a 100644
--- a/subprojects/s4-comm/src/main/java/org/apache/s4/comm/DefaultHasher.java
+++ b/subprojects/s4-comm/src/main/java/org/apache/s4/comm/DefaultHasher.java
@@ -20,6 +20,10 @@ package org.apache.s4.comm;
import org.apache.s4.base.Hasher;
+/**
+ * Simple hasher implementation.
+ *
+ */
public class DefaultHasher implements Hasher {
@Override
http://git-wip-us.apache.org/repos/asf/incubator-s4/blob/c349777b/subprojects/s4-comm/src/main/java/org/apache/s4/comm/QueueingEmitter.java
----------------------------------------------------------------------
diff --git a/subprojects/s4-comm/src/main/java/org/apache/s4/comm/QueueingEmitter.java b/subprojects/s4-comm/src/main/java/org/apache/s4/comm/QueueingEmitter.java
deleted file mode 100644
index e891f8d..0000000
--- a/subprojects/s4-comm/src/main/java/org/apache/s4/comm/QueueingEmitter.java
+++ /dev/null
@@ -1,121 +0,0 @@
-/**
- * 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.s4.comm;
-
-import java.util.concurrent.BlockingQueue;
-import java.util.concurrent.LinkedBlockingQueue;
-
-import org.apache.s4.base.Emitter;
-import org.apache.s4.base.EventMessage;
-
-import com.google.inject.Inject;
-import com.google.inject.name.Named;
-
-public class QueueingEmitter implements Emitter, Runnable {
- private Emitter emitter;
- private BlockingQueue<MessageHolder> queue;
- private long dropCount = 0;
- private volatile Thread thread;
-
- @Inject
- public QueueingEmitter(@Named("ll") Emitter emitter, @Named("comm.queue_emmiter_size") int queueSize) {
- this.emitter = emitter;
- queue = new LinkedBlockingQueue<MessageHolder>(queueSize);
- }
-
- public long getDropCount() {
- return dropCount;
- }
-
- public void start() {
- if (thread != null) {
- throw new IllegalStateException("QueueingEmitter is already started");
- }
- thread = new Thread(this, "QueueingEmitter");
- thread.start();
- }
-
- public void stop() {
- if (thread == null) {
- throw new IllegalStateException("QueueingEmitter is already stopped");
- }
- thread.interrupt();
- thread = null;
- }
-
- @Override
- public boolean send(int partitionId, EventMessage message) {
- MessageHolder mh = new MessageHolder(partitionId, message);
- if (!queue.offer(mh)) {
- dropCount++;
- return true;
- } else {
- return false;
- }
- }
-
- public void run() {
- while (!Thread.interrupted()) {
- try {
- MessageHolder mh = queue.take();
- // System.out.println("QueueingEmitter: Sending message on low-level emitter");
- emitter.send(mh.getPartitionId(), mh.getMessage());
- } catch (InterruptedException ie) {
- Thread.currentThread().interrupt();
- }
- }
- }
-
- public int getPartitionCount() {
- return emitter.getPartitionCount();
- }
-
- class MessageHolder {
- private int partitionId;
- private EventMessage message;
-
- public int getPartitionId() {
- return partitionId;
- }
-
- public void setPartitionId(int partitionId) {
- this.partitionId = partitionId;
- }
-
- public EventMessage getMessage() {
- return message;
- }
-
- public void setMessage(EventMessage message) {
- this.message = message;
- }
-
- public MessageHolder(int partitionId, EventMessage message) {
- super();
- this.partitionId = partitionId;
- this.message = message;
- }
- }
-
- @Override
- public void close() {
- // TODO Auto-generated method stub
-
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-s4/blob/c349777b/subprojects/s4-comm/src/main/java/org/apache/s4/comm/QueueingListener.java
----------------------------------------------------------------------
diff --git a/subprojects/s4-comm/src/main/java/org/apache/s4/comm/QueueingListener.java b/subprojects/s4-comm/src/main/java/org/apache/s4/comm/QueueingListener.java
deleted file mode 100644
index 5751527..0000000
--- a/subprojects/s4-comm/src/main/java/org/apache/s4/comm/QueueingListener.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/**
- * 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.s4.comm;
-
-import java.util.concurrent.BlockingQueue;
-import java.util.concurrent.LinkedBlockingQueue;
-
-import org.apache.s4.base.Listener;
-
-import com.google.inject.Inject;
-import com.google.inject.name.Named;
-
-public class QueueingListener implements Listener, Runnable {
- private Listener listener;
- private BlockingQueue<byte[]> queue;
- private long dropCount = 0;
- private volatile Thread thread;
-
- @Inject
- public QueueingListener(@Named("ll") Listener listener, @Named("comm.queue_listener_size") int queueSize) {
- this.listener = listener;
- queue = new LinkedBlockingQueue<byte[]>(queueSize);
- }
-
- public long getDropCount() {
- return dropCount;
- }
-
- public void start() {
- if (thread != null) {
- throw new IllegalStateException("QueueingListener is already started");
- }
- thread = new Thread(this, "QueueingListener");
- thread.start();
- }
-
- public void stop() {
- if (thread == null) {
- throw new IllegalStateException("QueueingListener is already stopped");
- }
- thread.interrupt();
- thread = null;
- }
-
- @Override
- public byte[] recv() {
- try {
- // System.out.println("QueueingListener: About to take message from queue");
- return queue.take();
- } catch (InterruptedException ie) {
- Thread.currentThread().interrupt();
- return null;
- }
- }
-
- public int getPartitionId() {
- return listener.getPartitionId();
- }
-
- public void run() {
- while (!Thread.interrupted()) {
- byte[] message = listener.recv();
- if (!queue.offer(message)) {
- dropCount++;
- } else {
- // System.out.println("QueueingListener: Adding message of size "
- // + message.length + " to queue");
- }
- }
- }
-
- @Override
- public void close() {
- // TODO Auto-generated method stub
-
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-s4/blob/c349777b/subprojects/s4-comm/src/main/java/org/apache/s4/comm/RemoteEmitterFactory.java
----------------------------------------------------------------------
diff --git a/subprojects/s4-comm/src/main/java/org/apache/s4/comm/RemoteEmitterFactory.java b/subprojects/s4-comm/src/main/java/org/apache/s4/comm/RemoteEmitterFactory.java
index 72bbce7..5d79859 100644
--- a/subprojects/s4-comm/src/main/java/org/apache/s4/comm/RemoteEmitterFactory.java
+++ b/subprojects/s4-comm/src/main/java/org/apache/s4/comm/RemoteEmitterFactory.java
@@ -21,6 +21,11 @@ package org.apache.s4.comm;
import org.apache.s4.base.RemoteEmitter;
import org.apache.s4.comm.topology.Cluster;
+/**
+ * Used for creating RemoteEmitter instances depending on the cluster configuration. Follows the "assisted injection"
+ * pattern from Guice 3.
+ *
+ */
public interface RemoteEmitterFactory {
RemoteEmitter createRemoteEmitter(Cluster topology);
http://git-wip-us.apache.org/repos/asf/incubator-s4/blob/c349777b/subprojects/s4-comm/src/main/java/org/apache/s4/comm/loopback/LoopBackEmitter.java
----------------------------------------------------------------------
diff --git a/subprojects/s4-comm/src/main/java/org/apache/s4/comm/loopback/LoopBackEmitter.java b/subprojects/s4-comm/src/main/java/org/apache/s4/comm/loopback/LoopBackEmitter.java
deleted file mode 100644
index ffa1802..0000000
--- a/subprojects/s4-comm/src/main/java/org/apache/s4/comm/loopback/LoopBackEmitter.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/**
- * 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.s4.comm.loopback;
-
-import org.apache.s4.base.Emitter;
-import org.apache.s4.base.EventMessage;
-import org.apache.s4.base.SerializerDeserializer;
-
-import com.google.inject.Inject;
-
-public class LoopBackEmitter implements Emitter {
- private LoopBackListener listener;
-
- @Inject
- SerializerDeserializer serDeser;
-
- public LoopBackEmitter(LoopBackListener listener) {
- this.listener = listener;
- }
-
- @Override
- public boolean send(int partitionId, EventMessage message) {
-
- listener.put(serDeser.serialize(message));
- return true;
- }
-
- @Override
- public int getPartitionCount() {
- return 1;
- }
-
- @Override
- public void close() {
- // TODO Auto-generated method stub
-
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-s4/blob/c349777b/subprojects/s4-comm/src/main/java/org/apache/s4/comm/loopback/LoopBackListener.java
----------------------------------------------------------------------
diff --git a/subprojects/s4-comm/src/main/java/org/apache/s4/comm/loopback/LoopBackListener.java b/subprojects/s4-comm/src/main/java/org/apache/s4/comm/loopback/LoopBackListener.java
deleted file mode 100644
index 14331b4..0000000
--- a/subprojects/s4-comm/src/main/java/org/apache/s4/comm/loopback/LoopBackListener.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/**
- * 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.s4.comm.loopback;
-
-import java.util.concurrent.BlockingQueue;
-import java.util.concurrent.SynchronousQueue;
-
-import org.apache.s4.base.Listener;
-
-public class LoopBackListener implements Listener {
-
- private BlockingQueue<byte[]> handoffQueue = new SynchronousQueue<byte[]>();
-
- @Override
- public byte[] recv() {
- try {
- // System.out.println("LoopBackListener: Taking message from handoff queue");
- return handoffQueue.take();
- } catch (InterruptedException e) {
- throw new RuntimeException(e);
- }
- }
-
- @Override
- public int getPartitionId() {
- return 0;
- }
-
- public void put(byte[] message) {
- try {
- // System.out.println("LoopBackListener: putting message into handoffqueue");
- handoffQueue.put(message);
- } catch (InterruptedException ie) {
- Thread.currentThread().interrupt();
- }
- }
-
- @Override
- public void close() {
- // TODO Auto-generated method stub
-
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-s4/blob/c349777b/subprojects/s4-comm/src/main/java/org/apache/s4/comm/package-info.java
----------------------------------------------------------------------
diff --git a/subprojects/s4-comm/src/main/java/org/apache/s4/comm/package-info.java b/subprojects/s4-comm/src/main/java/org/apache/s4/comm/package-info.java
new file mode 100644
index 0000000..1ae6963
--- /dev/null
+++ b/subprojects/s4-comm/src/main/java/org/apache/s4/comm/package-info.java
@@ -0,0 +1,4 @@
+/**
+ * This package and subpackages define mechanisms for low-level communications in the S4 platform.
+ */
+package org.apache.s4.comm;
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-s4/blob/c349777b/subprojects/s4-comm/src/main/java/org/apache/s4/comm/serialize/KryoSerDeser.java
----------------------------------------------------------------------
diff --git a/subprojects/s4-comm/src/main/java/org/apache/s4/comm/serialize/KryoSerDeser.java b/subprojects/s4-comm/src/main/java/org/apache/s4/comm/serialize/KryoSerDeser.java
index 8c315d6..b7fad75 100644
--- a/subprojects/s4-comm/src/main/java/org/apache/s4/comm/serialize/KryoSerDeser.java
+++ b/subprojects/s4-comm/src/main/java/org/apache/s4/comm/serialize/KryoSerDeser.java
@@ -27,6 +27,10 @@ import com.esotericsoftware.kryo.ObjectBuffer;
import com.esotericsoftware.kryo.serialize.ClassSerializer;
import com.esotericsoftware.kryo.serialize.SimpleSerializer;
+/**
+ * Serializazer/deserializer based on <a href="http://code.google.com/p/kryo/">kryo</a>
+ *
+ */
public class KryoSerDeser implements SerializerDeserializer {
private Kryo kryo = new Kryo();
http://git-wip-us.apache.org/repos/asf/incubator-s4/blob/c349777b/subprojects/s4-comm/src/main/java/org/apache/s4/comm/serialize/package-info.java
----------------------------------------------------------------------
diff --git a/subprojects/s4-comm/src/main/java/org/apache/s4/comm/serialize/package-info.java b/subprojects/s4-comm/src/main/java/org/apache/s4/comm/serialize/package-info.java
new file mode 100644
index 0000000..f8bba59
--- /dev/null
+++ b/subprojects/s4-comm/src/main/java/org/apache/s4/comm/serialize/package-info.java
@@ -0,0 +1,4 @@
+/**
+ * Serialization utilities for messages and PEs.
+ */
+package org.apache.s4.comm.serialize;
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-s4/blob/c349777b/subprojects/s4-comm/src/main/java/org/apache/s4/comm/tcp/package-info.java
----------------------------------------------------------------------
diff --git a/subprojects/s4-comm/src/main/java/org/apache/s4/comm/tcp/package-info.java b/subprojects/s4-comm/src/main/java/org/apache/s4/comm/tcp/package-info.java
new file mode 100644
index 0000000..606f6ea
--- /dev/null
+++ b/subprojects/s4-comm/src/main/java/org/apache/s4/comm/tcp/package-info.java
@@ -0,0 +1,4 @@
+/**
+ * TCP-based communication layer implementation.
+ */
+package org.apache.s4.comm.tcp;
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-s4/blob/c349777b/subprojects/s4-comm/src/main/java/org/apache/s4/comm/tools/TaskSetup.java
----------------------------------------------------------------------
diff --git a/subprojects/s4-comm/src/main/java/org/apache/s4/comm/tools/TaskSetup.java b/subprojects/s4-comm/src/main/java/org/apache/s4/comm/tools/TaskSetup.java
index ce5453c..b74bd19 100644
--- a/subprojects/s4-comm/src/main/java/org/apache/s4/comm/tools/TaskSetup.java
+++ b/subprojects/s4-comm/src/main/java/org/apache/s4/comm/tools/TaskSetup.java
@@ -25,6 +25,10 @@ import org.apache.s4.comm.topology.ZNRecord;
import org.apache.s4.comm.topology.ZNRecordSerializer;
import org.apache.s4.comm.topology.ZkClient;
+/**
+ * Used for defining and dimensioning logical clusters in Zookeeper.
+ *
+ */
public class TaskSetup {
private ZkClient zkclient;
http://git-wip-us.apache.org/repos/asf/incubator-s4/blob/c349777b/subprojects/s4-comm/src/main/java/org/apache/s4/comm/tools/package-info.java
----------------------------------------------------------------------
diff --git a/subprojects/s4-comm/src/main/java/org/apache/s4/comm/tools/package-info.java b/subprojects/s4-comm/src/main/java/org/apache/s4/comm/tools/package-info.java
new file mode 100644
index 0000000..4ca2702
--- /dev/null
+++ b/subprojects/s4-comm/src/main/java/org/apache/s4/comm/tools/package-info.java
@@ -0,0 +1,4 @@
+/**
+ * Utility classes.
+ */
+package org.apache.s4.comm.tools;
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-s4/blob/c349777b/subprojects/s4-comm/src/main/java/org/apache/s4/comm/topology/AssignmentFromZK.java
----------------------------------------------------------------------
diff --git a/subprojects/s4-comm/src/main/java/org/apache/s4/comm/topology/AssignmentFromZK.java b/subprojects/s4-comm/src/main/java/org/apache/s4/comm/topology/AssignmentFromZK.java
index 215a1d7..c3e2ffa 100644
--- a/subprojects/s4-comm/src/main/java/org/apache/s4/comm/topology/AssignmentFromZK.java
+++ b/subprojects/s4-comm/src/main/java/org/apache/s4/comm/topology/AssignmentFromZK.java
@@ -42,6 +42,10 @@ import com.google.inject.Inject;
import com.google.inject.Singleton;
import com.google.inject.name.Named;
+/**
+ * Handles partition assignment through Zookeeper.
+ *
+ */
@Singleton
public class AssignmentFromZK implements Assignment, IZkChildListener, IZkStateListener, IZkDataListener {
private static final Logger logger = LoggerFactory.getLogger(AssignmentFromZK.class);
http://git-wip-us.apache.org/repos/asf/incubator-s4/blob/c349777b/subprojects/s4-comm/src/main/java/org/apache/s4/comm/topology/ClusterFromZK.java
----------------------------------------------------------------------
diff --git a/subprojects/s4-comm/src/main/java/org/apache/s4/comm/topology/ClusterFromZK.java b/subprojects/s4-comm/src/main/java/org/apache/s4/comm/topology/ClusterFromZK.java
index 724b1cd..5635ff0 100644
--- a/subprojects/s4-comm/src/main/java/org/apache/s4/comm/topology/ClusterFromZK.java
+++ b/subprojects/s4-comm/src/main/java/org/apache/s4/comm/topology/ClusterFromZK.java
@@ -23,7 +23,6 @@ import java.net.UnknownHostException;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.TimeUnit;
-import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicReference;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;
@@ -39,23 +38,23 @@ import org.slf4j.LoggerFactory;
import com.google.inject.Inject;
import com.google.inject.name.Named;
+/**
+ * Represents a logical cluster definition fetched from Zookeeper. Notifies listeners of runtime changes in the
+ * configuration.
+ *
+ */
public class ClusterFromZK implements Cluster, IZkChildListener, IZkDataListener, IZkStateListener {
private static Logger logger = LoggerFactory.getLogger(ClusterFromZK.class);
private final AtomicReference<PhysicalCluster> clusterRef;
private final List<ClusterChangeListener> listeners;
- private KeeperState state;
private final ZkClient zkClient;
private final String taskPath;
private final String processPath;
private final Lock lock;
- private AtomicBoolean currentlyOwningTask;
- private String machineId;
private String clusterName;
- private int connectionTimeout;
-
/**
* only the local topology
*/
@@ -64,7 +63,6 @@ public class ClusterFromZK implements Cluster, IZkChildListener, IZkDataListener
@Named("cluster.zk_address") String zookeeperAddress,
@Named("cluster.zk_session_timeout") int sessionTimeout,
@Named("cluster.zk_connection_timeout") int connectionTimeout) throws Exception {
- this.connectionTimeout = connectionTimeout;
this.clusterName = clusterName;
this.taskPath = "/s4/clusters/" + clusterName + "/tasks";
this.processPath = "/s4/clusters/" + clusterName + "/process";
@@ -77,10 +75,9 @@ public class ClusterFromZK implements Cluster, IZkChildListener, IZkDataListener
throw new Exception("cannot connect to zookeeper");
}
try {
- machineId = InetAddress.getLocalHost().getCanonicalHostName();
+ InetAddress.getLocalHost().getCanonicalHostName();
} catch (UnknownHostException e) {
logger.warn("Unable to get hostname", e);
- machineId = "UNKNOWN";
}
this.clusterRef = new AtomicReference<PhysicalCluster>();
this.listeners = new ArrayList<ClusterChangeListener>();
@@ -103,7 +100,6 @@ public class ClusterFromZK implements Cluster, IZkChildListener, IZkDataListener
this.processPath = "/s4/clusters/" + clusterName + "/process";
this.clusterName = clusterName;
this.lock = new ReentrantLock();
- this.machineId = machineId;
this.listeners = new ArrayList<ClusterChangeListener>();
this.clusterRef = new AtomicReference<PhysicalCluster>();
zkClient.subscribeChildChanges(taskPath, this);
http://git-wip-us.apache.org/repos/asf/incubator-s4/blob/c349777b/subprojects/s4-comm/src/main/java/org/apache/s4/comm/topology/ClusterNode.java
----------------------------------------------------------------------
diff --git a/subprojects/s4-comm/src/main/java/org/apache/s4/comm/topology/ClusterNode.java b/subprojects/s4-comm/src/main/java/org/apache/s4/comm/topology/ClusterNode.java
index 00c403c..e622107 100644
--- a/subprojects/s4-comm/src/main/java/org/apache/s4/comm/topology/ClusterNode.java
+++ b/subprojects/s4-comm/src/main/java/org/apache/s4/comm/topology/ClusterNode.java
@@ -18,38 +18,43 @@
package org.apache.s4.comm.topology;
+/**
+ * Represents an node.
+ *
+ */
public class ClusterNode {
private int partition;
private int port;
private String machineName;
private String taskId;
-
+
public ClusterNode(int partition, int port, String machineName, String taskId) {
this.partition = partition;
this.port = port;
this.machineName = machineName;
this.taskId = taskId;
}
-
+
public int getPartition() {
return partition;
}
+
public int getPort() {
return port;
}
+
public String getMachineName() {
return machineName;
}
+
public String getTaskId() {
return taskId;
}
-
+
public String toString() {
StringBuffer sb = new StringBuffer();
- sb.append("{").append("partition=").append(partition).
- append(",port=").append(port).
- append(",machineName=").append(machineName).
- append(",taskId=").append(taskId).append("}");
+ sb.append("{").append("partition=").append(partition).append(",port=").append(port).append(",machineName=")
+ .append(machineName).append(",taskId=").append(taskId).append("}");
return sb.toString();
}
}
http://git-wip-us.apache.org/repos/asf/incubator-s4/blob/c349777b/subprojects/s4-comm/src/main/java/org/apache/s4/comm/topology/PhysicalCluster.java
----------------------------------------------------------------------
diff --git a/subprojects/s4-comm/src/main/java/org/apache/s4/comm/topology/PhysicalCluster.java b/subprojects/s4-comm/src/main/java/org/apache/s4/comm/topology/PhysicalCluster.java
index f96a940..7c590ac 100644
--- a/subprojects/s4-comm/src/main/java/org/apache/s4/comm/topology/PhysicalCluster.java
+++ b/subprojects/s4-comm/src/main/java/org/apache/s4/comm/topology/PhysicalCluster.java
@@ -91,9 +91,8 @@ public class PhysicalCluster {
}
/**
- * Number of partitions in the cluster.
*
- * @return
+ * @return Number of partitions in the cluster.
*/
public int getPartitionCount() {
return numPartitions;
http://git-wip-us.apache.org/repos/asf/incubator-s4/blob/c349777b/subprojects/s4-comm/src/main/java/org/apache/s4/comm/topology/StreamConsumer.java
----------------------------------------------------------------------
diff --git a/subprojects/s4-comm/src/main/java/org/apache/s4/comm/topology/StreamConsumer.java b/subprojects/s4-comm/src/main/java/org/apache/s4/comm/topology/StreamConsumer.java
index 1c17d50..52fa2a8 100644
--- a/subprojects/s4-comm/src/main/java/org/apache/s4/comm/topology/StreamConsumer.java
+++ b/subprojects/s4-comm/src/main/java/org/apache/s4/comm/topology/StreamConsumer.java
@@ -20,7 +20,7 @@ package org.apache.s4.comm.topology;
/**
* A subscriber to a published stream. Identified through its cluster name (for dispatching to the remote cluster) and
- * application ID (for dispatching within a node).
+ * application ID (for dispatching within a node (NOTE: this parameter is ignored)).
*
*/
public class StreamConsumer {
http://git-wip-us.apache.org/repos/asf/incubator-s4/blob/c349777b/subprojects/s4-comm/src/main/java/org/apache/s4/comm/topology/package-info.java
----------------------------------------------------------------------
diff --git a/subprojects/s4-comm/src/main/java/org/apache/s4/comm/topology/package-info.java b/subprojects/s4-comm/src/main/java/org/apache/s4/comm/topology/package-info.java
new file mode 100644
index 0000000..4469c5f
--- /dev/null
+++ b/subprojects/s4-comm/src/main/java/org/apache/s4/comm/topology/package-info.java
@@ -0,0 +1,4 @@
+/**
+ * Clusters configurations and partitions assignments to cluster nodes through Zookeeper.
+ */
+package org.apache.s4.comm.topology;
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-s4/blob/c349777b/subprojects/s4-comm/src/main/java/org/apache/s4/comm/udp/UDPEmitter.java
----------------------------------------------------------------------
diff --git a/subprojects/s4-comm/src/main/java/org/apache/s4/comm/udp/UDPEmitter.java b/subprojects/s4-comm/src/main/java/org/apache/s4/comm/udp/UDPEmitter.java
index 8d785dc..2f156b2 100644
--- a/subprojects/s4-comm/src/main/java/org/apache/s4/comm/udp/UDPEmitter.java
+++ b/subprojects/s4-comm/src/main/java/org/apache/s4/comm/udp/UDPEmitter.java
@@ -37,6 +37,10 @@ import org.slf4j.LoggerFactory;
import com.google.common.collect.HashBiMap;
import com.google.inject.Inject;
+/**
+ * UDP based emitter.
+ *
+ */
public class UDPEmitter implements Emitter, ClusterChangeListener {
private DatagramSocket socket;
private final HashBiMap<Integer, ClusterNode> nodes;
http://git-wip-us.apache.org/repos/asf/incubator-s4/blob/c349777b/subprojects/s4-comm/src/main/java/org/apache/s4/comm/udp/UDPRemoteEmitter.java
----------------------------------------------------------------------
diff --git a/subprojects/s4-comm/src/main/java/org/apache/s4/comm/udp/UDPRemoteEmitter.java b/subprojects/s4-comm/src/main/java/org/apache/s4/comm/udp/UDPRemoteEmitter.java
index b54042d..050a6ec 100644
--- a/subprojects/s4-comm/src/main/java/org/apache/s4/comm/udp/UDPRemoteEmitter.java
+++ b/subprojects/s4-comm/src/main/java/org/apache/s4/comm/udp/UDPRemoteEmitter.java
@@ -23,6 +23,10 @@ import org.apache.s4.comm.topology.Cluster;
import com.google.inject.Inject;
import com.google.inject.assistedinject.Assisted;
+/**
+ * UDP-based emitter for sending events to remote clusters.
+ *
+ */
public class UDPRemoteEmitter extends UDPEmitter {
/**
http://git-wip-us.apache.org/repos/asf/incubator-s4/blob/c349777b/subprojects/s4-comm/src/main/java/org/apache/s4/comm/udp/package-info.java
----------------------------------------------------------------------
diff --git a/subprojects/s4-comm/src/main/java/org/apache/s4/comm/udp/package-info.java b/subprojects/s4-comm/src/main/java/org/apache/s4/comm/udp/package-info.java
new file mode 100644
index 0000000..26301ec
--- /dev/null
+++ b/subprojects/s4-comm/src/main/java/org/apache/s4/comm/udp/package-info.java
@@ -0,0 +1,4 @@
+/**
+ * UDP-based implementation of the communication layer.
+ */
+package org.apache.s4.comm.udp;
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-s4/blob/c349777b/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 67e16ed..7c6dc9b 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
@@ -41,7 +41,7 @@ import com.google.inject.name.Named;
/**
* Container base class to hold all processing elements.
- *
+ *
* It is also where one defines the application graph: PE prototypes, internal streams, input and output streams.
*/
public abstract class App {
@@ -236,8 +236,8 @@ public abstract class App {
* Set the {@link ClockType}.
*
* @param clockType
- * the clockTyoe for this app must be {@link ClockType.WALL_CLOCK} (default) or
- * {@link ClockType.EVENT_CLOCK}
+ * the clockTyoe for this app must be {@link ClockType#WALL_CLOCK} (default) or
+ * {@link ClockType#EVENT_CLOCK}
*/
public void setClockType(ClockType clockType) {
this.clockType = clockType;
http://git-wip-us.apache.org/repos/asf/incubator-s4/blob/c349777b/subprojects/s4-core/src/main/java/org/apache/s4/core/Key.java
----------------------------------------------------------------------
diff --git a/subprojects/s4-core/src/main/java/org/apache/s4/core/Key.java b/subprojects/s4-core/src/main/java/org/apache/s4/core/Key.java
index a4de8cc..2a78213 100644
--- a/subprojects/s4-core/src/main/java/org/apache/s4/core/Key.java
+++ b/subprojects/s4-core/src/main/java/org/apache/s4/core/Key.java
@@ -24,14 +24,13 @@ import org.apache.commons.lang.StringUtils;
import org.apache.s4.base.Event;
import org.apache.s4.base.KeyFinder;
-/*
- * The Key class is used to get the value of the key on a specific type of
- * event. This is done to abstract all the complexity required to get the
- * value. The method for getting the value is implemented in a method of
- * an object of type KeyFinder<T>.
+/**
+ * The Key class is used to get the value of the key on a specific type of event. This is done to abstract all the
+ * complexity required to get the value. The method for getting the value is implemented in a method of an object of
+ * type KeyFinder<T>.
*
- * The application programmer provides the events and the corresponding
- * finders. The framework will use it to key on events.
+ * The application programmer provides the events and the corresponding finders. The framework will use it to key on
+ * events.
*/
public class Key<T extends Event> {
http://git-wip-us.apache.org/repos/asf/incubator-s4/blob/c349777b/subprojects/s4-core/src/main/java/org/apache/s4/core/Main.java
----------------------------------------------------------------------
diff --git a/subprojects/s4-core/src/main/java/org/apache/s4/core/Main.java b/subprojects/s4-core/src/main/java/org/apache/s4/core/Main.java
index d33e09f..1aae58d 100644
--- a/subprojects/s4-core/src/main/java/org/apache/s4/core/Main.java
+++ b/subprojects/s4-core/src/main/java/org/apache/s4/core/Main.java
@@ -158,6 +158,10 @@ public class Main {
}
}
+ /**
+ * Defines command parameters.
+ *
+ */
@Parameters(separators = "=")
public static class MainArgs {
@@ -190,6 +194,10 @@ public class Main {
}
+ /**
+ * Parameters parsing utility.
+ *
+ */
public static class InlineConfigParameterConverter implements IStringConverter<String> {
@Override
http://git-wip-us.apache.org/repos/asf/incubator-s4/blob/c349777b/subprojects/s4-core/src/main/java/org/apache/s4/core/ProcessingElement.java
----------------------------------------------------------------------
diff --git a/subprojects/s4-core/src/main/java/org/apache/s4/core/ProcessingElement.java b/subprojects/s4-core/src/main/java/org/apache/s4/core/ProcessingElement.java
index 91f0c0e..c96fb92 100644
--- a/subprojects/s4-core/src/main/java/org/apache/s4/core/ProcessingElement.java
+++ b/subprojects/s4-core/src/main/java/org/apache/s4/core/ProcessingElement.java
@@ -180,9 +180,9 @@ public abstract class ProcessingElement implements Cloneable {
}
/**
- * This method is called by the PE timer. By default it is synchronized with the {@link #onEvent()} and
- * {@link #onTrigger()} methods. To execute concurrently with other methods, the {@link ProcessingElelment} subclass
- * must be annotated with {@link @ThreadSafe}.
+ * This method is called by the PE timer. By default it is synchronized with the onEvent() and onTrigger() methods.
+ * To execute concurrently with other methods, the {@link ProcessingElement} subclass must be annotated with
+ * {@link ThreadSafe}.
*
* Override this method to implement a periodic process.
*/
http://git-wip-us.apache.org/repos/asf/incubator-s4/blob/c349777b/subprojects/s4-core/src/main/java/org/apache/s4/core/RemoteSender.java
----------------------------------------------------------------------
diff --git a/subprojects/s4-core/src/main/java/org/apache/s4/core/RemoteSender.java b/subprojects/s4-core/src/main/java/org/apache/s4/core/RemoteSender.java
index f49fc90..daccbaa 100644
--- a/subprojects/s4-core/src/main/java/org/apache/s4/core/RemoteSender.java
+++ b/subprojects/s4-core/src/main/java/org/apache/s4/core/RemoteSender.java
@@ -22,6 +22,10 @@ import org.apache.s4.base.Emitter;
import org.apache.s4.base.EventMessage;
import org.apache.s4.base.Hasher;
+/**
+ * Sends events to a remote cluster.
+ *
+ */
public class RemoteSender {
final private Emitter emitter;
http://git-wip-us.apache.org/repos/asf/incubator-s4/blob/c349777b/subprojects/s4-core/src/main/java/org/apache/s4/core/RemoteSenders.java
----------------------------------------------------------------------
diff --git a/subprojects/s4-core/src/main/java/org/apache/s4/core/RemoteSenders.java b/subprojects/s4-core/src/main/java/org/apache/s4/core/RemoteSenders.java
index 127788e..3a111d0 100644
--- a/subprojects/s4-core/src/main/java/org/apache/s4/core/RemoteSenders.java
+++ b/subprojects/s4-core/src/main/java/org/apache/s4/core/RemoteSenders.java
@@ -35,6 +35,11 @@ import org.slf4j.LoggerFactory;
import com.google.inject.Inject;
+/**
+ * Sends events to remote clusters. Target clusters are selected dynamically based on the stream name information from
+ * the event.
+ *
+ */
public class RemoteSenders {
Logger logger = LoggerFactory.getLogger(RemoteSenders.class);
http://git-wip-us.apache.org/repos/asf/incubator-s4/blob/c349777b/subprojects/s4-core/src/main/java/org/apache/s4/core/Stream.java
----------------------------------------------------------------------
diff --git a/subprojects/s4-core/src/main/java/org/apache/s4/core/Stream.java b/subprojects/s4-core/src/main/java/org/apache/s4/core/Stream.java
index bddf60b..6616d0f 100644
--- a/subprojects/s4-core/src/main/java/org/apache/s4/core/Stream.java
+++ b/subprojects/s4-core/src/main/java/org/apache/s4/core/Stream.java
@@ -37,7 +37,7 @@ import com.google.common.base.Preconditions;
* <p>
* Once a stream is instantiated, it is immutable.
* <p>
- * To build an application create stream objects using use the {@link StreamFactory} class.
+ * To build an application, create stream objects using relevant methods in the {@link App} class.
*/
public class Stream<T extends Event> implements Runnable, Streamable {
@@ -58,7 +58,7 @@ public class Stream<T extends Event> implements Runnable, Streamable {
private Class<T> eventType = null;
/**
- * Send events using a {@link KeyFinder<T>}. The key finder extracts the value of the key which is used to determine
+ * Send events using a {@link KeyFinder}. The key finder extracts the value of the key which is used to determine
* the target {@link org.apache.s4.comm.topology.ClusterNode} for an event.
*
* @param app
@@ -123,7 +123,7 @@ public class Stream<T extends Event> implements Runnable, Streamable {
/**
* Define the key finder for this stream using a descriptor.
*
- * @param keyFinderString
+ * @param keyName
* a descriptor to lookup up the value of the key.
* @return the stream object
*/
@@ -153,7 +153,7 @@ public class Stream<T extends Event> implements Runnable, Streamable {
/**
* Send events from this stream to various PEs.
*
- * @param pe
+ * @param pes
* a target PE array.
*
* @return the stream object
@@ -211,8 +211,7 @@ public class Stream<T extends Event> implements Runnable, Streamable {
}
/**
- * Implements the {@link ReceiverListener} interface. The low level {@link Receiver} object call this method when a
- * new {@link Event} is available.
+ * The low level {@link Receiver} object call this method when a new {@link Event} is available.
*/
public void receiveEvent(EventMessage event) {
try {
@@ -238,13 +237,6 @@ public class Stream<T extends Event> implements Runnable, Streamable {
}
/**
- * @return the stream id
- */
- // int getId() {
- // return id;
- // }
-
- /**
* @return the app
*/
public App getApp() {
http://git-wip-us.apache.org/repos/asf/incubator-s4/blob/c349777b/subprojects/s4-core/src/main/java/org/apache/s4/core/adapter/package-info.java
----------------------------------------------------------------------
diff --git a/subprojects/s4-core/src/main/java/org/apache/s4/core/adapter/package-info.java b/subprojects/s4-core/src/main/java/org/apache/s4/core/adapter/package-info.java
new file mode 100644
index 0000000..31009c1
--- /dev/null
+++ b/subprojects/s4-core/src/main/java/org/apache/s4/core/adapter/package-info.java
@@ -0,0 +1,4 @@
+/**
+ * This package contains utilities for creating and configuring adapter apps.
+ */
+package org.apache.s4.core.adapter;
http://git-wip-us.apache.org/repos/asf/incubator-s4/blob/c349777b/subprojects/s4-core/src/main/java/org/apache/s4/core/ft/DefaultFileSystemStateStorage.java
----------------------------------------------------------------------
diff --git a/subprojects/s4-core/src/main/java/org/apache/s4/core/ft/DefaultFileSystemStateStorage.java b/subprojects/s4-core/src/main/java/org/apache/s4/core/ft/DefaultFileSystemStateStorage.java
index 7fa131d..e5d4f9f 100644
--- a/subprojects/s4-core/src/main/java/org/apache/s4/core/ft/DefaultFileSystemStateStorage.java
+++ b/subprojects/s4-core/src/main/java/org/apache/s4/core/ft/DefaultFileSystemStateStorage.java
@@ -42,8 +42,8 @@ import com.google.inject.name.Named;
* file system such as NFS when running on a cluster.
* </p>
* <p>
- * Checkpoints are stored in individual files (1 file = 1 safeKeeperId) in directories according to the following
- * structure: <code>(storageRootpath)/prototypeId/safeKeeperId</code>
+ * Checkpoints are stored in individual files (1 file = 1 checkpointId) in directories according to the following
+ * structure: <code>(storageRootpath)/prototypeId/checkpointId</code>
* </p>
*
*/
@@ -69,7 +69,7 @@ public class DefaultFileSystemStateStorage implements StateStorage {
@Override
public byte[] fetchState(CheckpointId key) {
- File file = safeKeeperID2File(key, storageRootPath);
+ File file = checkpointID2File(key, storageRootPath);
if (file != null && file.exists()) {
logger.debug("Fetching " + file.getAbsolutePath() + "for : " + key);
@@ -103,20 +103,20 @@ public class DefaultFileSystemStateStorage implements StateStorage {
}
});
for (File file : files) {
- keys.add(file2SafeKeeperID(file));
+ keys.add(file2CheckpointID(file));
}
}
return keys;
}
// files kept as : root/<prototypeId>/encodedKeyWithFullInfo
- private static File safeKeeperID2File(CheckpointId key, String storageRootPath) {
+ private static File checkpointID2File(CheckpointId key, String storageRootPath) {
return new File(storageRootPath + File.separator + key.getPrototypeId() + File.separator
+ Base64.encodeBase64URLSafeString(key.getStringRepresentation().getBytes()));
}
- private static CheckpointId file2SafeKeeperID(File file) {
+ private static CheckpointId file2CheckpointID(File file) {
CheckpointId id = null;
id = new CheckpointId(new String(Base64.decodeBase64(file.getName())));
return id;
@@ -140,7 +140,7 @@ public class DefaultFileSystemStateStorage implements StateStorage {
@Override
public void saveState(CheckpointId key, byte[] state, StorageCallback callback) {
- File f = safeKeeperID2File(key, storageRootPath);
+ File f = checkpointID2File(key, storageRootPath);
if (logger.isDebugEnabled()) {
logger.debug("Checkpointing [" + key + "] into file: [" + f.getAbsolutePath() + "]");
}
http://git-wip-us.apache.org/repos/asf/incubator-s4/blob/c349777b/subprojects/s4-core/src/main/java/org/apache/s4/core/ft/StorageCallback.java
----------------------------------------------------------------------
diff --git a/subprojects/s4-core/src/main/java/org/apache/s4/core/ft/StorageCallback.java b/subprojects/s4-core/src/main/java/org/apache/s4/core/ft/StorageCallback.java
index 20d8390..95ea7ab 100644
--- a/subprojects/s4-core/src/main/java/org/apache/s4/core/ft/StorageCallback.java
+++ b/subprojects/s4-core/src/main/java/org/apache/s4/core/ft/StorageCallback.java
@@ -29,7 +29,7 @@ public interface StorageCallback {
* Notifies the result of a storage operation
*
* @param resultCode
- * code for the result : {@link SafeKeeper.StorageResultCode SafeKeeper.StorageResultCode}
+ * code for the result : {@link SafeKeeper.StorageResultCode}
* @param message
* whatever message object is suitable
*/
http://git-wip-us.apache.org/repos/asf/incubator-s4/blob/c349777b/subprojects/s4-core/src/main/java/org/apache/s4/core/ft/package-info.java
----------------------------------------------------------------------
diff --git a/subprojects/s4-core/src/main/java/org/apache/s4/core/ft/package-info.java b/subprojects/s4-core/src/main/java/org/apache/s4/core/ft/package-info.java
new file mode 100644
index 0000000..930f9f5
--- /dev/null
+++ b/subprojects/s4-core/src/main/java/org/apache/s4/core/ft/package-info.java
@@ -0,0 +1,21 @@
+/**
+ * <p>This package contains classes for providing some fault tolerance
+ * to S4 PEs.</p>
+ * <p>The current approach is based on <b>checkpointing</b>.</p>
+ * <p>Checkpoints are taken periodically (configurable by time or
+ * frequency of application events), and when restarting an S4 node,
+ * saved checkpoints are automatically and lazily restored.</p>
+ * <p><b>Lazy restoration</b> is triggered by an application event to a PE
+ * that has not yet been restored.</p>
+ * <p>Checkpoints are stored in storage backends. Storage backends may
+ * implement eager techniques to prefetch checkpoint data to be
+ * recovered. Storage backends can be implemented for various kinds of systems,
+ * and must implement the {@link org.apache.s4.core.ft.StateStorage} interface.
+ * They are pluggable throught the module system.
+ * <p>
+ * The application programmer must take care of marking as <b>transient</b>
+ * the fields that do not have to be persisted (or cannot be persisted).
+ * <p>Storage backends are pluggable and we provide some default
+ * implementations in this package</p>
+ */
+package org.apache.s4.core.ft;
http://git-wip-us.apache.org/repos/asf/incubator-s4/blob/c349777b/subprojects/s4-core/src/main/java/org/apache/s4/core/gen/package-info.java
----------------------------------------------------------------------
diff --git a/subprojects/s4-core/src/main/java/org/apache/s4/core/gen/package-info.java b/subprojects/s4-core/src/main/java/org/apache/s4/core/gen/package-info.java
new file mode 100644
index 0000000..b9bb18e
--- /dev/null
+++ b/subprojects/s4-core/src/main/java/org/apache/s4/core/gen/package-info.java
@@ -0,0 +1,5 @@
+/**
+ * Utility classes for dynamic code generation, in particular proxies to enable dispatching
+ * of events to methods of processing elements based on the runtime type of the event.
+ */
+package org.apache.s4.core.gen;
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-s4/blob/c349777b/subprojects/s4-core/src/main/java/org/apache/s4/core/package-info.java
----------------------------------------------------------------------
diff --git a/subprojects/s4-core/src/main/java/org/apache/s4/core/package-info.java b/subprojects/s4-core/src/main/java/org/apache/s4/core/package-info.java
new file mode 100644
index 0000000..ae43795
--- /dev/null
+++ b/subprojects/s4-core/src/main/java/org/apache/s4/core/package-info.java
@@ -0,0 +1,4 @@
+/**
+ * Key classes of the S4 platform, implementing concepts such as Stream, Processing Element.
+ */
+package org.apache.s4.core;
http://git-wip-us.apache.org/repos/asf/incubator-s4/blob/c349777b/subprojects/s4-core/src/main/java/org/apache/s4/core/util/package-info.java
----------------------------------------------------------------------
diff --git a/subprojects/s4-core/src/main/java/org/apache/s4/core/util/package-info.java b/subprojects/s4-core/src/main/java/org/apache/s4/core/util/package-info.java
new file mode 100644
index 0000000..a487974
--- /dev/null
+++ b/subprojects/s4-core/src/main/java/org/apache/s4/core/util/package-info.java
@@ -0,0 +1,4 @@
+/**
+ * Utility classes.
+ */
+package org.apache.s4.core.util;
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-s4/blob/c349777b/subprojects/s4-core/src/main/java/org/apache/s4/deploy/HttpS4RFetcher.java
----------------------------------------------------------------------
diff --git a/subprojects/s4-core/src/main/java/org/apache/s4/deploy/HttpS4RFetcher.java b/subprojects/s4-core/src/main/java/org/apache/s4/deploy/HttpS4RFetcher.java
index e1b7889..1bb4c01 100644
--- a/subprojects/s4-core/src/main/java/org/apache/s4/deploy/HttpS4RFetcher.java
+++ b/subprojects/s4-core/src/main/java/org/apache/s4/deploy/HttpS4RFetcher.java
@@ -59,11 +59,12 @@ import com.google.common.io.ByteStreams;
* Fetches S4R archive through HTTP.
* </p>
* <p>
- * The underlying implementation uses Netty, and borrows code from the Netty snoop example:</br>
+ * The underlying implementation uses Netty, and borrows code from the Netty snoop example.</br>
*
- * {@link http://docs.jboss.org/netty/3.2/xref/org/jboss/netty/example/http/snoop/package-summary.html}
+ * @see <a href="http://docs.jboss.org/netty/3.2/xref/org/jboss/netty/example/http/snoop/package-summary.html">Netty
+ * snoop example</a>
*
- * </p>
+ * </p>
*/
public class HttpS4RFetcher implements S4RFetcher {
http://git-wip-us.apache.org/repos/asf/incubator-s4/blob/c349777b/subprojects/s4-core/src/main/java/org/apache/s4/deploy/package-info.java
----------------------------------------------------------------------
diff --git a/subprojects/s4-core/src/main/java/org/apache/s4/deploy/package-info.java b/subprojects/s4-core/src/main/java/org/apache/s4/deploy/package-info.java
new file mode 100644
index 0000000..931f5ef
--- /dev/null
+++ b/subprojects/s4-core/src/main/java/org/apache/s4/deploy/package-info.java
@@ -0,0 +1,5 @@
+/**
+ * Dynamic application deployment framework, that allows identifying new available applications,
+ * downloading them through various protocols, loading them and starting them in the current S4 node.
+ */
+package org.apache.s4.deploy;
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-s4/blob/c349777b/subprojects/s4-edsl/src/main/java/org/apache/s4/edsl/AppBuilder.java
----------------------------------------------------------------------
diff --git a/subprojects/s4-edsl/src/main/java/org/apache/s4/edsl/AppBuilder.java b/subprojects/s4-edsl/src/main/java/org/apache/s4/edsl/AppBuilder.java
index 1b365b0..fb40b43 100644
--- a/subprojects/s4-edsl/src/main/java/org/apache/s4/edsl/AppBuilder.java
+++ b/subprojects/s4-edsl/src/main/java/org/apache/s4/edsl/AppBuilder.java
@@ -83,7 +83,6 @@ import com.google.common.collect.Sets;
* <p>
* See the <a href="http://code.google.com/p/diezel">Diezel</a> project for details.
*
- * @author Leo Neumeyer (@leoneu)
*/
public class AppBuilder extends App {
http://git-wip-us.apache.org/repos/asf/incubator-s4/blob/c349777b/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 af6d662..14d3483 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
@@ -32,9 +32,7 @@ import com.google.inject.name.Names;
/**
* Configures the controller.
*
- * Reads a properties file, provides a {@link Communicator} singleton, and configures Guice bindings.
*
- * @author Leo Neumeyer
*/
public class Module extends AbstractModule {
http://git-wip-us.apache.org/repos/asf/incubator-s4/blob/c349777b/subprojects/s4-example/src/main/java/org/apache/s4/example/counter/README.md
----------------------------------------------------------------------
diff --git a/subprojects/s4-example/src/main/java/org/apache/s4/example/counter/README.md b/subprojects/s4-example/src/main/java/org/apache/s4/example/counter/README.md
index 72e0a3d..ebe6228 100644
--- a/subprojects/s4-example/src/main/java/org/apache/s4/example/counter/README.md
+++ b/subprojects/s4-example/src/main/java/org/apache/s4/example/counter/README.md
@@ -1,4 +1,4 @@
-S4 Counter Example
+S4 Counter Example (NOT updated for 0.5.0)
==================
In this example we do the following: