From d2dab2fba19cf35c5eb66eec1200814b96a9c5b5 Mon Sep 17 00:00:00 2001 From: brettlangdon Date: Thu, 14 Jun 2012 08:09:23 -0400 Subject: [PATCH] Setup basic skeleton for project --- .gitignore | 9 +++ LICENSE | 8 +++ README.md | 5 ++ build.xml | 41 ++++++++++++ .../blangdon/flume/kestrel/KestrelSink.java | 65 +++++++++++++++++++ 5 files changed, 128 insertions(+) create mode 100644 .gitignore create mode 100644 LICENSE create mode 100644 README.md create mode 100644 build.xml create mode 100644 src/com/blangdon/flume/kestrel/KestrelSink.java diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..8c58301 --- /dev/null +++ b/.gitignore @@ -0,0 +1,9 @@ +*.class + +# Package Files # +*.jar +*.war +*.ear + +*#*# +*~ \ No newline at end of file diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..4c05cba --- /dev/null +++ b/LICENSE @@ -0,0 +1,8 @@ +The MIT License (MIT) +Copyright (c) 2012 Brett Langdon + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..87779a2 --- /dev/null +++ b/README.md @@ -0,0 +1,5 @@ +Flume Kestrel Plugin +======= + +## Overview +This plugins provides a Sink to be able to send events from Cloudera's Flume v0.9.4 to a Kestrel server. diff --git a/build.xml b/build.xml new file mode 100644 index 0000000..f093833 --- /dev/null +++ b/build.xml @@ -0,0 +1,41 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/com/blangdon/flume/kestrel/KestrelSink.java b/src/com/blangdon/flume/kestrel/KestrelSink.java new file mode 100644 index 0000000..e6d4c4c --- /dev/null +++ b/src/com/blangdon/flume/kestrel/KestrelSink.java @@ -0,0 +1,65 @@ +package com.blangdon.flume.Kestrel; + + +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; + + +import com.cloudera.flume.conf.Context; +import com.cloudera.flume.conf.SinkFactory.SinkBuilder; +import com.cloudera.flume.core.Event; +import com.cloudera.flume.core.EventSink; +import com.cloudera.util.Pair; +import com.google.common.base.Preconditions; + +/** + * Sink that sends events to HornetQ queue + */ +public class KestrelSink extends EventSink.Base { + + + public KestrelSink(){ + //constructor + } + + @Override + public void open() throws IOException { + // Initialized the sink + } + + @Override + public void append(Event e) throws IOException { + //send to Kestrel + } + + + @Override + public void close() throws IOException { + // Cleanup + } + + public static SinkBuilder builder() { + return new SinkBuilder() { + // construct a new parameterized sink + @Override + public EventSink build(Context context, String... argv) { + Preconditions.checkArgument(argv.length > 1, + "usage: kestrelSink(queueName, server:port, [server2:port, server3:port,...])"); + + return new KestrelSink(); + } + }; + } + + /** + * This is a special function used by the SourceFactory to pull in this class + * as a plugin sink. + */ + public static List> getSinkBuilders() { + List> builders = + new ArrayList>(); + builders.add(new Pair("kestrelSink", builder())); + return builders; + } +}