Author: jsdelfino
Date: Wed Jun 2 04:02:52 2010
New Revision: 950360
URL: http://svn.apache.org/viewvc?rev=950360&view=rev
Log:
Sample module showing how to use the Scribe logging API to connect to a Scribe
server and log a string under a given log category. The sample module shows two
components: a ScribeLogger component that encapsulates the calls to the Scribe
API behind a simple Logger service interface, and a HelloWorld component that
uses an SCA reference wired to the ScribeLogger component to log the string
that it's given. See the README file for build and test instructions.
Added:
tuscany/sca-java-2.x/trunk/samples/logging-scribe/
tuscany/sca-java-2.x/trunk/samples/logging-scribe/README
tuscany/sca-java-2.x/trunk/samples/logging-scribe/pom.xml
tuscany/sca-java-2.x/trunk/samples/logging-scribe/src/
tuscany/sca-java-2.x/trunk/samples/logging-scribe/src/main/
tuscany/sca-java-2.x/trunk/samples/logging-scribe/src/main/java/
tuscany/sca-java-2.x/trunk/samples/logging-scribe/src/main/java/generated/
tuscany/sca-java-2.x/trunk/samples/logging-scribe/src/main/java/generated/com/
tuscany/sca-java-2.x/trunk/samples/logging-scribe/src/main/java/generated/com/facebook/
tuscany/sca-java-2.x/trunk/samples/logging-scribe/src/main/java/generated/com/facebook/fb303/
tuscany/sca-java-2.x/trunk/samples/logging-scribe/src/main/java/generated/com/facebook/fb303/FacebookService.java
tuscany/sca-java-2.x/trunk/samples/logging-scribe/src/main/java/generated/com/facebook/fb303/fb_status.java
tuscany/sca-java-2.x/trunk/samples/logging-scribe/src/main/java/generated/scribe/
tuscany/sca-java-2.x/trunk/samples/logging-scribe/src/main/java/generated/scribe/thrift/
tuscany/sca-java-2.x/trunk/samples/logging-scribe/src/main/java/generated/scribe/thrift/LogEntry.java
tuscany/sca-java-2.x/trunk/samples/logging-scribe/src/main/java/generated/scribe/thrift/ResultCode.java
tuscany/sca-java-2.x/trunk/samples/logging-scribe/src/main/java/generated/scribe/thrift/scribe.java
tuscany/sca-java-2.x/trunk/samples/logging-scribe/src/main/java/sample/
tuscany/sca-java-2.x/trunk/samples/logging-scribe/src/main/java/sample/HelloWorld.java
tuscany/sca-java-2.x/trunk/samples/logging-scribe/src/main/java/sample/HelloWorldImpl.java
tuscany/sca-java-2.x/trunk/samples/logging-scribe/src/main/java/sample/Logger.java
tuscany/sca-java-2.x/trunk/samples/logging-scribe/src/main/java/sample/ScribeLoggerImpl.java
tuscany/sca-java-2.x/trunk/samples/logging-scribe/src/main/resources/
tuscany/sca-java-2.x/trunk/samples/logging-scribe/src/main/resources/META-INF/
tuscany/sca-java-2.x/trunk/samples/logging-scribe/src/main/resources/META-INF/sca-contribution.xml
tuscany/sca-java-2.x/trunk/samples/logging-scribe/src/main/resources/fb303.thrift
tuscany/sca-java-2.x/trunk/samples/logging-scribe/src/main/resources/scribe.composite
tuscany/sca-java-2.x/trunk/samples/logging-scribe/src/main/resources/scribe.thrift
tuscany/sca-java-2.x/trunk/samples/logging-scribe/src/test/
tuscany/sca-java-2.x/trunk/samples/logging-scribe/src/test/java/
tuscany/sca-java-2.x/trunk/samples/logging-scribe/src/test/java/sample/
tuscany/sca-java-2.x/trunk/samples/logging-scribe/src/test/java/sample/LoggingTest.java
Added: tuscany/sca-java-2.x/trunk/samples/logging-scribe/README
URL:
http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/samples/logging-scribe/README?rev=950360&view=auto
==============================================================================
--- tuscany/sca-java-2.x/trunk/samples/logging-scribe/README (added)
+++ tuscany/sca-java-2.x/trunk/samples/logging-scribe/README Wed Jun 2
04:02:52 2010
@@ -0,0 +1,51 @@
+This Tuscany sample shows how to implement and use a simple Logger component
+that logs string messages to a Scribe logging server.
+
+Scribe is an Open Source server for aggregating streaming log data. It is
+designed to scale to a very large number of nodes and be robust to network
+and node failures.
+
+See the Scribe Wiki [1] for more information on Scribe.
+
+Getting the required Apache Thrift library
+==========================================
+This sample uses Apache Thrift's libthrift.jar to communicate with Scribe
+servers. Libthrift is not yet available in a Maven repository, so before
+building the sample with Maven, you need to download libthrift [2] and
+install it in your local Maven repository like this:
+
+mvn install:install-file -DgroupId=org.apache.thrift -DartifactId=libthrift \
+-Dversion=1.0-SNAPSHOT -Dpackaging=jar -Dfile=libthrift-r917130.jar
+
+Starting a Scribe server
+========================
+Before running the LoggingTest sample test program, you need to start a Scribe
+server for the sample program to connect to.
+
+Steps to start a Scribe server are described in the Scribe examples README [3].
+A simple Scribe server configuration can be found in the Scribe examples [4].
+
+LoggingTest will try to connect to a Scribe server at localhost:1463. To use
+a Scribe server at a different host or port, configure the host and port
+properties in scribe.composite to match your server.
+
+Running the LoggingTest sample test program
+===========================================
+
+To run the LoggingTest sample test program, do this:
+mvn -Dtest=LoggingTest test
+
+Checking the Scribe log output
+==============================
+After running LoggingTest, you should find the logged string "Hello There" in
+file sample/sample_current under your Scribe log store directory.
+
+If you've used the example1.conf Scribe configuration from the Scribe examples
+[4], you should find your log message in /tmp/scribetest/sample/sample_current.
+
+
+[1] http://wiki.github.com/facebook/scribe/
+[2] http://svn.apache.org/repos/asf/cassandra/trunk/lib/libthrift-r917130.jar
+[3] http://github.com/facebook/scribe/blob/master/examples/README
+[4] http://github.com/facebook/scribe/blob/master/examples/example1.conf
+
Added: tuscany/sca-java-2.x/trunk/samples/logging-scribe/pom.xml
URL:
http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/samples/logging-scribe/pom.xml?rev=950360&view=auto
==============================================================================
--- tuscany/sca-java-2.x/trunk/samples/logging-scribe/pom.xml (added)
+++ tuscany/sca-java-2.x/trunk/samples/logging-scribe/pom.xml Wed Jun 2
04:02:52 2010
@@ -0,0 +1,96 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * 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.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-sca</artifactId>
+ <version>2.0-SNAPSHOT</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent>
+
+ <packaging>jar</packaging>
+ <artifactId>sample-logging-scribe</artifactId>
+ <name>Apache Tuscany SCA Scribe Logging Sample</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-node-api</artifactId>
+ <version>2.0-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-node-impl</artifactId>
+ <version>2.0-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>2.0-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.thrift</groupId>
+ <artifactId>libthrift</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ <version>1.5.8</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-simple</artifactId>
+ <version>1.5.8</version>
+ </dependency>
+
+ <dependency>
+ <groupId>commons-lang</groupId>
+ <artifactId>commons-lang</artifactId>
+ <version>2.4</version>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.8.1</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <finalName>${artifactId}</finalName>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.tuscany.maven.plugins</groupId>
+ <artifactId>maven-tuscany-plugin</artifactId>
+ <version>2.0-SNAPSHOT</version>
+ </plugin>
+ </plugins>
+ </build>
+</project>