labs-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From psm...@apache.org
Subject svn commit: r564890 - in /labs/pinpoint/trunk: ./ pinpoint-cli/src/main/java/org/apache/logging/pinpoint/ pinpoint-core/ pinpoint-core/src/main/java/org/apache/logging/pinpoint/ pinpoint-core/src/main/java/org/apache/logging/pinpoint/converter/ pinpoin...
Date Sat, 11 Aug 2007 10:43:29 GMT
Author: psmith
Date: Sat Aug 11 03:43:26 2007
New Revision: 564890

URL: http://svn.apache.org/viewvc?view=rev&rev=564890
Log:
Moved EventStore and impl's into seperate package.

Added HQSLDBStore implementation and test cases.

Tidied up some license headers (not perfect still).


Added:
    labs/pinpoint/trunk/pinpoint-core/src/main/java/org/apache/logging/pinpoint/store/EventStore.java
      - copied, changed from r564042, labs/pinpoint/trunk/pinpoint-core/src/main/java/org/apache/logging/pinpoint/converter/EventStore.java
    labs/pinpoint/trunk/pinpoint-core/src/main/java/org/apache/logging/pinpoint/store/HSQLDBEventStore.java
    labs/pinpoint/trunk/pinpoint-core/src/main/java/org/apache/logging/pinpoint/store/SimpleEventStore.java
      - copied, changed from r564042, labs/pinpoint/trunk/pinpoint-core/src/main/java/org/apache/logging/pinpoint/converter/SimpleEventStore.java
    labs/pinpoint/trunk/pinpoint-core/src/test/java/org/apache/logging/pinpoint/PinpointTestUtils.java
    labs/pinpoint/trunk/pinpoint-core/src/test/java/org/apache/logging/pinpoint/store/
    labs/pinpoint/trunk/pinpoint-core/src/test/java/org/apache/logging/pinpoint/store/AbstractStoreTest.java
    labs/pinpoint/trunk/pinpoint-core/src/test/java/org/apache/logging/pinpoint/store/HSQLDBEventStoreTest.java
    labs/pinpoint/trunk/pinpoint-core/src/test/java/org/apache/logging/pinpoint/store/HSQLDBTest.java
    labs/pinpoint/trunk/pinpoint-core/src/test/java/org/apache/logging/pinpoint/store/SimpleEventStoreTest.java
Removed:
    labs/pinpoint/trunk/pinpoint-core/src/main/java/org/apache/logging/pinpoint/converter/EventStore.java
    labs/pinpoint/trunk/pinpoint-core/src/main/java/org/apache/logging/pinpoint/converter/SimpleEventStore.java
Modified:
    labs/pinpoint/trunk/   (props changed)
    labs/pinpoint/trunk/TODO.txt
    labs/pinpoint/trunk/pinpoint-cli/src/main/java/org/apache/logging/pinpoint/Shell.java
    labs/pinpoint/trunk/pinpoint-core/pom.xml
    labs/pinpoint/trunk/pinpoint-core/src/main/java/org/apache/logging/pinpoint/PinpointContextUtils.java
    labs/pinpoint/trunk/pinpoint-core/src/main/java/org/apache/logging/pinpoint/converter/EventWriter.java
    labs/pinpoint/trunk/pinpoint-core/src/main/java/org/apache/logging/pinpoint/converter/PinpointAppender.java
    labs/pinpoint/trunk/pinpoint-core/src/main/java/org/apache/logging/pinpoint/resolver/OffsetAndLength.java
    labs/pinpoint/trunk/pinpoint-core/src/test/java/org/apache/logging/pinpoint/converter/EventWriterTest.java
    labs/pinpoint/trunk/pinpoint-importer/src/main/java/org/apache/logging/pinpoint/importer/Importer.java
    labs/pinpoint/trunk/pinpoint-search/src/main/java/org/apache/logging/pinpoint/search/PinpointSearcher.java
    labs/pinpoint/trunk/pom.xml

Propchange: labs/pinpoint/trunk/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Sat Aug 11 03:43:26 2007
@@ -1 +1,2 @@
 target
+.settings

Modified: labs/pinpoint/trunk/TODO.txt
URL: http://svn.apache.org/viewvc/labs/pinpoint/trunk/TODO.txt?view=diff&rev=564890&r1=564889&r2=564890
==============================================================================
--- labs/pinpoint/trunk/TODO.txt (original)
+++ labs/pinpoint/trunk/TODO.txt Sat Aug 11 03:43:26 2007
@@ -6,6 +6,30 @@
 * Document how to use it in Daemon or non-daemon mode
 * Document how to configure it for JMX-enabling
 
+pinpoint-search
+* (not sure if this is CLI or searcher) Initial display of events appear SLOOOOOW.
+
+pinpoint-core
+	bugs
+		* Getting a weird exception with some events that are being sent from the Aconex app:
+		pinpoint>search sqlexception
+				message:sqlexception
+				java.lang.RuntimeException: Failed to navigate to next hit
+				        at org.apache.logging.pinpoint.search.PinpointSearcher$HitIterator.next(PinpointSearcher.java:115)
+				        at org.apache.logging.pinpoint.search.PinpointSearcher$HitIterator.next(PinpointSearcher.java:90)
+				        at org.apache.logging.pinpoint.Shell.displayEvents(Shell.java:189)
+				        at org.apache.logging.pinpoint.Shell.searchContext(Shell.java:153)
+				        at org.apache.logging.pinpoint.Shell.main(Shell.java:73)
+				Caused by: java.lang.RuntimeException: Failed to deserialize an event at position 204460 for file '/Users/paulsmith/.pinpoint/ctx.2007-08-09/EVENTS.ser'
+				        at org.apache.logging.pinpoint.converter.SimpleEventStore.restore(SimpleEventStore.java:72)
+				        at org.apache.logging.pinpoint.search.PinpointSearcher$HitIterator.next(PinpointSearcher.java:113)
+				        ... 4 more
+				Caused by: java.io.StreamCorruptedException: invalid stream header
+				        at java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:764)
+				        at java.io.ObjectInputStream.<init>(ObjectInputStream.java:277)
+				        at org.apache.logging.pinpoint.converter.SimpleEventStore.restore(SimpleEventStore.java:63)
+				        ... 5 more
+        
 pinpoint-cli
 
 * try to work out the jline stuff a bit better

Modified: labs/pinpoint/trunk/pinpoint-cli/src/main/java/org/apache/logging/pinpoint/Shell.java
URL: http://svn.apache.org/viewvc/labs/pinpoint/trunk/pinpoint-cli/src/main/java/org/apache/logging/pinpoint/Shell.java?view=diff&rev=564890&r1=564889&r2=564890
==============================================================================
--- labs/pinpoint/trunk/pinpoint-cli/src/main/java/org/apache/logging/pinpoint/Shell.java (original)
+++ labs/pinpoint/trunk/pinpoint-cli/src/main/java/org/apache/logging/pinpoint/Shell.java Sat Aug 11 03:43:26 2007
@@ -13,6 +13,7 @@
 import java.io.IOException;
 import java.util.Arrays;
 import java.util.Collection;
+import java.util.Map;
 
 import jline.ArgumentCompletor;
 import jline.CandidateListCompletionHandler;
@@ -34,8 +35,8 @@
 import org.apache.log4j.LogManager;
 import org.apache.log4j.PatternLayout;
 import org.apache.log4j.spi.LoggingEvent;
-import org.apache.logging.pinpoint.converter.SimpleEventStore;
 import org.apache.logging.pinpoint.search.PinpointSearcher;
+import org.apache.logging.pinpoint.store.SimpleEventStore;
 import org.apache.logging.pinpoint.utils.PinpointUtils;
 import org.apache.lucene.analysis.Analyzer;
 import org.apache.lucene.analysis.standard.StandardAnalyzer;
@@ -93,14 +94,13 @@
     }
 
     private static void showContextInfo(PinpointContext ctx) {
-        Collection<String> contextPoints = PinpointContextUtils
-                .listContextPoints(ctx);
+        Map<String, Collection<String>> values = PinpointContextUtils
+                .listContextPointValues(ctx);
         System.out.format("Context: %s\n", ctx.getContextRoot()
                 .getAbsoluteFile());
-        for (String contextPoint : contextPoints) {
-            System.out.format("%s: ", contextPoint);
-            System.out.format("%s", PinpointContextUtils.listContexPointValues(
-                    ctx, contextPoint));
+        for (Map.Entry<String, Collection<String>> entry : values.entrySet()) {
+            System.out.format("%s: ", entry.getKey());
+            System.out.format("%s", entry.getValue());
             System.out.println("");
         }
     }
@@ -159,7 +159,7 @@
                 } catch (Exception e) {
                     /*
                      * This is deliberately not logged using log4j, designed to
-                     * go staight to the console unhindered.
+                     * go straight to the console unhindered.
                      */
                     e.printStackTrace();
                 }
@@ -169,15 +169,6 @@
         }
 
     }
-
-    //
-    // private static void browseContext(PinpointContext ctx) throws IOException
-    // {
-    // PinpointContextIterator iterator = new PinpointContextIterator(ctx);
-    //
-    // displayEvents(iterator);
-    //
-    // }
 
     private static void displayEvents(Iterable<LoggingEvent> iterable) {
         if (!iterable.iterator().hasNext()) {

Modified: labs/pinpoint/trunk/pinpoint-core/pom.xml
URL: http://svn.apache.org/viewvc/labs/pinpoint/trunk/pinpoint-core/pom.xml?view=diff&rev=564890&r1=564889&r2=564890
==============================================================================
--- labs/pinpoint/trunk/pinpoint-core/pom.xml (original)
+++ labs/pinpoint/trunk/pinpoint-core/pom.xml Sat Aug 11 03:43:26 2007
@@ -62,6 +62,16 @@
       <artifactId>commons-collections</artifactId>
       <version>3.2</version>
     </dependency>
+	<dependency>
+	    <groupId>hsqldb</groupId>
+	    <artifactId>hsqldb</artifactId>
+	    <version>1.8.0.7</version>
+	</dependency>
+	<dependency>
+      <groupId>org.springframework</groupId>
+      <artifactId>spring</artifactId>
+      <version>2.0.5</version>
+    </dependency>    
   </dependencies>
   <properties>
     <commonscli.version>1.0</commonscli.version>

Modified: labs/pinpoint/trunk/pinpoint-core/src/main/java/org/apache/logging/pinpoint/PinpointContextUtils.java
URL: http://svn.apache.org/viewvc/labs/pinpoint/trunk/pinpoint-core/src/main/java/org/apache/logging/pinpoint/PinpointContextUtils.java?view=diff&rev=564890&r1=564889&r2=564890
==============================================================================
--- labs/pinpoint/trunk/pinpoint-core/src/main/java/org/apache/logging/pinpoint/PinpointContextUtils.java (original)
+++ labs/pinpoint/trunk/pinpoint-core/src/main/java/org/apache/logging/pinpoint/PinpointContextUtils.java Sat Aug 11 03:43:26 2007
@@ -15,8 +15,10 @@
 import java.util.Arrays;
 import java.util.Collection;
 import java.util.Collections;
+import java.util.HashMap;
 import java.util.HashSet;
 import java.util.List;
+import java.util.Map;
 import java.util.Set;
 
 import org.apache.commons.collections.CollectionUtils;
@@ -31,15 +33,18 @@
 
 public class PinpointContextUtils {
 
-    private static final Logger LOG = PinpointUtils.getLogger(PinpointContextUtils.class);
+    private static final Logger LOG = PinpointUtils
+            .getLogger(PinpointContextUtils.class);
 
     /**
-     * A Predicate that returns true for field names that are NOT Context Points.
+     * A Predicate that returns true for field names that are NOT Context
+     * Points.
      */
     public static final Predicate NON_CONTEXT_POINT_FIELDS = new Predicate() {
 
-        private final Set<String> nonCtxPointFieldNames = new HashSet<String>(Arrays
-                .asList(new String[] { "eventdate", "eventtime", "level", "logger", "message" }));
+        private final Set<String> nonCtxPointFieldNames = new HashSet<String>(
+                Arrays.asList(new String[] { "eventdate", "eventtime", "level",
+                        "logger", "message" }));
 
         public boolean evaluate(Object o) {
             String fieldName = o.toString();
@@ -50,14 +55,15 @@
     };
 
     /**
-     * A Predicate that returns true if a field name is a context point, or more (in)formally, is
-     * NOT a non-context point field.
+     * A Predicate that returns true if a field name is a context point, or more
+     * (in)formally, is NOT a non-context point field.
      */
     public static final Predicate CONTEXT_POINT_FIELDS = PredicateUtils
             .notPredicate(NON_CONTEXT_POINT_FIELDS);
 
     /**
-     * Inspects the PinpointContext index and retrieves the Set of fields available for searching
+     * Inspects the PinpointContext index and retrieves the Set of fields
+     * available for searching
      * 
      * @param ctx
      * @return
@@ -71,10 +77,12 @@
                     .getFieldNames(FieldOption.INDEXED));
             CollectionUtils.filter(fieldNames, CONTEXT_POINT_FIELDS);
             Collections.sort(fieldNames);
-            LOG.info("Located the following context fields for searching: " + fieldNames);
+            LOG.info("Located the following context fields for searching: " +
+                    fieldNames);
             return fieldNames;
         } catch (Exception e) {
-            throw new RuntimeException("Failed to inspect the indexed fields", e);
+            throw new RuntimeException("Failed to inspect the indexed fields",
+                    e);
         } finally {
             if (reader != null) {
                 try {
@@ -86,35 +94,78 @@
         }
     }
 
+    public static Map<String, Collection<String>> listContextPointValues(
+            PinpointContext ctx) {
+        Map<String, Collection<String>> map = new HashMap<String, Collection<String>>();
+        IndexReader reader = null;
+        TermEnum termEnum = null;
+        try {
+            reader = IndexReader.open(ctx.getIndexDirectory());
+            termEnum = reader.terms(new Term("", ""));
+            List<String> terms = new ArrayList<String>();
+            while (termEnum.next()) {
+                Term term = termEnum.term();
+                if (CONTEXT_POINT_FIELDS.evaluate(term.field())) {
+                    Collection<String> collection = null;
+                    if (!map.containsKey(term.field())) {
+                        collection = new ArrayList<String>();
+                        map.put(term.field(), collection);
+                    } else {
+                        collection = map.get(term.field());
+                    }
+                    collection.add(term.text());
+                }
+            }
+            return map;
+        } catch (Exception e) {
+            throw new RuntimeException(
+                    "Failed to inspect the context point values for PinpointContexn '" +
+                            ctx.getContextRoot().getAbsolutePath() + "'", e);
+        } finally {
+            if (termEnum != null) {
+                try {
+                    termEnum.close();
+                } catch (IOException e) {
+                    LOG.error("Failed to close termEnum cleanly", e);
+                }
+            }
+            if (reader != null) {
+                try {
+                    reader.close();
+                } catch (IOException e) {
+                    LOG.error("Failed to close reader cleanly", e);
+                }
+            }
+        }
+    }
+
     /**
-     * Returns the set of unique values observed for a given context point (field) for a context.
+     * Returns the set of unique values observed for a given context point
+     * (field) for a context.
      * 
      * @param ctx
      * @param contexPoint
      * @return
      */
-    public static Collection<String> listContexPointValues(PinpointContext ctx, String contexPoint) {
+    public static Collection<String> listContexPointValues(PinpointContext ctx,
+            String contexPoint) {
         IndexReader reader = null;
         TermEnum termEnum = null;
         try {
             reader = IndexReader.open(ctx.getIndexDirectory());
-            termEnum = reader.terms(new Term(contexPoint, ""));
+            termEnum = reader.terms(new Term("", ""));
             List<String> terms = new ArrayList<String>();
             while (termEnum.next()) {
                 Term term = termEnum.term();
-                if (!term.field().equals(contexPoint)) {
-                    break;
+                if (term.field().equals(contexPoint)) {
+                    terms.add(term.text());
                 }
-                terms.add(term.text());
             }
             return terms;
-            // Collections.sort(fieldNames);
-            // LOG.info("Located the following context fields for searching: " + fieldNames);
-            // return fieldNames;
         } catch (Exception e) {
             throw new RuntimeException(
-                    "Failed to inspect the context point values for contextPoint '" + contexPoint
-                            + "'", e);
+                    "Failed to inspect the context point values for contextPoint '" +
+                            contexPoint + "'", e);
         } finally {
             if (termEnum != null) {
                 try {

Modified: labs/pinpoint/trunk/pinpoint-core/src/main/java/org/apache/logging/pinpoint/converter/EventWriter.java
URL: http://svn.apache.org/viewvc/labs/pinpoint/trunk/pinpoint-core/src/main/java/org/apache/logging/pinpoint/converter/EventWriter.java?view=diff&rev=564890&r1=564889&r2=564890
==============================================================================
--- labs/pinpoint/trunk/pinpoint-core/src/main/java/org/apache/logging/pinpoint/converter/EventWriter.java (original)
+++ labs/pinpoint/trunk/pinpoint-core/src/main/java/org/apache/logging/pinpoint/converter/EventWriter.java Sat Aug 11 03:43:26 2007
@@ -26,6 +26,7 @@
 import org.apache.log4j.spi.LoggingEvent;
 import org.apache.logging.pinpoint.analyser.AnalyzerFactory;
 import org.apache.logging.pinpoint.resolver.OffsetAndLength;
+import org.apache.logging.pinpoint.store.EventStore;
 import org.apache.logging.pinpoint.utils.PinpointUtils;
 import org.apache.lucene.analysis.Analyzer;
 import org.apache.lucene.document.Document;

Modified: labs/pinpoint/trunk/pinpoint-core/src/main/java/org/apache/logging/pinpoint/converter/PinpointAppender.java
URL: http://svn.apache.org/viewvc/labs/pinpoint/trunk/pinpoint-core/src/main/java/org/apache/logging/pinpoint/converter/PinpointAppender.java?view=diff&rev=564890&r1=564889&r2=564890
==============================================================================
--- labs/pinpoint/trunk/pinpoint-core/src/main/java/org/apache/logging/pinpoint/converter/PinpointAppender.java (original)
+++ labs/pinpoint/trunk/pinpoint-core/src/main/java/org/apache/logging/pinpoint/converter/PinpointAppender.java Sat Aug 11 03:43:26 2007
@@ -18,6 +18,8 @@
 import org.apache.logging.pinpoint.PinpointContext;
 import org.apache.logging.pinpoint.analyser.AnalyzerFactory;
 import org.apache.logging.pinpoint.selector.PinpointContextSelector;
+import org.apache.logging.pinpoint.store.EventStore;
+import org.apache.logging.pinpoint.store.SimpleEventStore;
 
 public class PinpointAppender extends AppenderSkeleton {
 

Modified: labs/pinpoint/trunk/pinpoint-core/src/main/java/org/apache/logging/pinpoint/resolver/OffsetAndLength.java
URL: http://svn.apache.org/viewvc/labs/pinpoint/trunk/pinpoint-core/src/main/java/org/apache/logging/pinpoint/resolver/OffsetAndLength.java?view=diff&rev=564890&r1=564889&r2=564890
==============================================================================
--- labs/pinpoint/trunk/pinpoint-core/src/main/java/org/apache/logging/pinpoint/resolver/OffsetAndLength.java (original)
+++ labs/pinpoint/trunk/pinpoint-core/src/main/java/org/apache/logging/pinpoint/resolver/OffsetAndLength.java Sat Aug 11 03:43:26 2007
@@ -27,12 +27,13 @@
 
     private static final String FIELD_NAME = "pinpoint.location";
 
-    private static final String SEPERATOR = ".";
+    private static final String SEPARATOR = ".";
+
     public long offset;
     public long length;
 
     public static OffsetAndLength decodeFromString(String eventLocation) {
-        String[] split = StringUtils.split(eventLocation, SEPERATOR);
+        String[] split = StringUtils.split(eventLocation, SEPARATOR);
         OffsetAndLength oal = new OffsetAndLength();
         oal.offset = Long.valueOf(split[0]);
         oal.length = Long.valueOf(split[1]);
@@ -40,7 +41,7 @@
     }
 
     public String encodeAsString() {
-        return offset + SEPERATOR + length;
+        return offset + SEPARATOR + length;
     }
 
     public String toString() {

Copied: labs/pinpoint/trunk/pinpoint-core/src/main/java/org/apache/logging/pinpoint/store/EventStore.java (from r564042, labs/pinpoint/trunk/pinpoint-core/src/main/java/org/apache/logging/pinpoint/converter/EventStore.java)
URL: http://svn.apache.org/viewvc/labs/pinpoint/trunk/pinpoint-core/src/main/java/org/apache/logging/pinpoint/store/EventStore.java?view=diff&rev=564890&p1=labs/pinpoint/trunk/pinpoint-core/src/main/java/org/apache/logging/pinpoint/converter/EventStore.java&r1=564042&p2=labs/pinpoint/trunk/pinpoint-core/src/main/java/org/apache/logging/pinpoint/store/EventStore.java&r2=564890
==============================================================================
--- labs/pinpoint/trunk/pinpoint-core/src/main/java/org/apache/logging/pinpoint/converter/EventStore.java (original)
+++ labs/pinpoint/trunk/pinpoint-core/src/main/java/org/apache/logging/pinpoint/store/EventStore.java Sat Aug 11 03:43:26 2007
@@ -1,4 +1,19 @@
-package org.apache.logging.pinpoint.converter;
+/*
+ * Copyright 1999-2005 The Apache Software Foundation.
+ * 
+ * Licensed 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.logging.pinpoint.store;
 
 import java.io.IOException;
 
@@ -10,25 +25,25 @@
  * instance that can be provided later on to deserialize the event back again
  * 
  * @author psmith
- *
+ * 
  */
 public interface EventStore {
 
     /**
      * Encodes the Event in some external stream, returing a String-encoded
-     * reference item that can be returned to an instance of this
-     * implementation to deserialize back again.
+     * reference item that can be returned to an instance of this implementation
+     * to deserialize back again.
      * 
-     * This return string forms a string-encoded Event Location within this 
+     * This return string forms a string-encoded Event Location within this
      * instances serialization mechanism.
      * 
      * @param e
      * @return
      */
-    public String store(LoggingEvent e) ;
-    
+    public String store(LoggingEvent e);
+
     public LoggingEvent restore(String eventLocationKey);
-    
+
     public void close() throws IOException;
-   
+
 }

Added: labs/pinpoint/trunk/pinpoint-core/src/main/java/org/apache/logging/pinpoint/store/HSQLDBEventStore.java
URL: http://svn.apache.org/viewvc/labs/pinpoint/trunk/pinpoint-core/src/main/java/org/apache/logging/pinpoint/store/HSQLDBEventStore.java?view=auto&rev=564890
==============================================================================
--- labs/pinpoint/trunk/pinpoint-core/src/main/java/org/apache/logging/pinpoint/store/HSQLDBEventStore.java (added)
+++ labs/pinpoint/trunk/pinpoint-core/src/main/java/org/apache/logging/pinpoint/store/HSQLDBEventStore.java Sat Aug 11 03:43:26 2007
@@ -0,0 +1,127 @@
+/*
+ * Copyright 1999-2005 The Apache Software Foundation.
+ * 
+ * Licensed 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.logging.pinpoint.store;
+
+import java.io.File;
+import java.io.IOException;
+import java.sql.Connection;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.Statement;
+
+import org.apache.log4j.spi.LoggingEvent;
+import org.hsqldb.jdbc.jdbcDataSource;
+import org.springframework.jdbc.core.JdbcTemplate;
+
+public class HSQLDBEventStore implements EventStore {
+
+    static {
+        try {
+            Class.forName("org.hsqldb.jdbcDriver");
+        } catch (Exception e) {
+            System.out.println("ERROR: failed to load HSQLDB JDBC driver.");
+            e.printStackTrace();
+        }
+    }
+
+    private final Connection connection;
+    private PreparedStatement insertStatement;
+    private jdbcDataSource dataSource;
+
+    private JdbcTemplate jdbcTemplate;
+    private Statement statement;
+    private String jdbcURL;
+
+    public HSQLDBEventStore(File storeLocation) {
+        jdbcURL = "jdbc:hsqldb:hsql:file:" +
+                storeLocation.getAbsolutePath().replace('\\', '/');
+        try {
+            this.dataSource = new jdbcDataSource();
+            dataSource.setDatabase(jdbcURL);
+            dataSource.setUser("sa");
+            dataSource.setPassword("");
+            this.connection = dataSource.getConnection();
+            createTableIfNecessary();
+            this.jdbcTemplate = new JdbcTemplate(dataSource);
+        } catch (SQLException e) {
+            throw new RuntimeException("Failed to create HSQLDB at location '" +
+                    storeLocation.getAbsolutePath() + "' using URL '" +
+                    jdbcURL + "'", e);
+        }
+    }
+
+    private void createTableIfNecessary() throws SQLException {
+        this.connection
+                .createStatement()
+                .execute(
+                        "create cached table events(eventid INTEGER GENERATED BY DEFAULT AS IDENTITY(start with 1, increment by 1) PRIMARY KEY, eventObject OTHER)");
+        this.insertStatement = connection
+                .prepareStatement("insert into events(eventObject) values (?)");
+        this.statement = this.connection.createStatement();
+    }
+
+    public void close() throws IOException {
+        try {
+            // TODO cleanup statements
+            // TODO 'SHUTDOWN'?
+            this.connection.close();
+        } catch (SQLException e) {
+            throw new RuntimeException("Failed to close JDBC connection", e);
+        }
+    }
+
+    public LoggingEvent restore(String eventLocationKey) {
+
+        return (LoggingEvent) jdbcTemplate.queryForObject(
+                "select eventobject from events where eventId=" +
+                        eventLocationKey, LoggingEvent.class);
+    }
+
+    private int getIdentity() throws SQLException {
+        /*
+         * We CANNOT use the jdbcTemplate because it will use a different
+         * Connection object than the query used to insert the row, and thus,
+         * never return a result.
+         */
+        int key = 0;
+
+        ResultSet rs = this.statement.executeQuery("Call IDENTITY();");
+        if (rs.next()) {
+            key = rs.getInt(1);
+        }
+        if (key < 1) {
+            throw new RuntimeException(
+                    "Did not successfully determine the last IDENTITY value");
+        }
+        return key;
+    }
+
+    public String store(LoggingEvent e) {
+        // jdbcTemplate.
+        try {
+            insertStatement.clearParameters();
+            int index = 1;
+            insertStatement.setObject(index++, e);
+            insertStatement.executeUpdate();
+            String key = String.valueOf(getIdentity());
+            return key;
+
+        } catch (SQLException ex) {
+            throw new RuntimeException("Failed to store event in HSQLDB", ex);
+        }
+
+    }
+}

Copied: labs/pinpoint/trunk/pinpoint-core/src/main/java/org/apache/logging/pinpoint/store/SimpleEventStore.java (from r564042, labs/pinpoint/trunk/pinpoint-core/src/main/java/org/apache/logging/pinpoint/converter/SimpleEventStore.java)
URL: http://svn.apache.org/viewvc/labs/pinpoint/trunk/pinpoint-core/src/main/java/org/apache/logging/pinpoint/store/SimpleEventStore.java?view=diff&rev=564890&p1=labs/pinpoint/trunk/pinpoint-core/src/main/java/org/apache/logging/pinpoint/converter/SimpleEventStore.java&r1=564042&p2=labs/pinpoint/trunk/pinpoint-core/src/main/java/org/apache/logging/pinpoint/store/SimpleEventStore.java&r2=564890
==============================================================================
--- labs/pinpoint/trunk/pinpoint-core/src/main/java/org/apache/logging/pinpoint/converter/SimpleEventStore.java (original)
+++ labs/pinpoint/trunk/pinpoint-core/src/main/java/org/apache/logging/pinpoint/store/SimpleEventStore.java Sat Aug 11 03:43:26 2007
@@ -1,4 +1,12 @@
-package org.apache.logging.pinpoint.converter;
+/*
+ * Copyright 1999-2005 The Apache Software Foundation. Licensed 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.logging.pinpoint.store;
 
 import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
@@ -26,7 +34,8 @@
  */
 public class SimpleEventStore implements EventStore {
 
-    private static final Logger LOG = PinpointUtils.getLogger(SimpleEventStore.class);
+    private static final Logger LOG = PinpointUtils
+            .getLogger(SimpleEventStore.class);
 
     private final File serializationFie;
     private FileChannel channel;
@@ -38,11 +47,13 @@
     public SimpleEventStore(File serializationFile) {
         this.serializationFie = serializationFile;
         try {
+            // TODO confirm file open mode
             RandomAccessFile raf = new RandomAccessFile(serializationFile, "rw");
             channel = raf.getChannel();
         } catch (FileNotFoundException e) {
-            throw new RuntimeException("Failed to create Output channel for file '"
-                    + serializationFile.getAbsolutePath() + "'", e);
+            throw new RuntimeException(
+                    "Failed to create Output channel for file '" +
+                            serializationFile.getAbsolutePath() + "'", e);
         }
 
     }
@@ -52,25 +63,29 @@
     }
 
     public LoggingEvent restore(String eventLocationKey) {
-        OffsetAndLength oal = OffsetAndLength.decodeFromString(eventLocationKey);
+        OffsetAndLength oal = OffsetAndLength
+                .decodeFromString(eventLocationKey);
 
         // TODO totally inefficient...
         try {
 
-            MappedByteBuffer byteBuffer = channel.map(MapMode.READ_ONLY, oal.offset, oal.length);
+            MappedByteBuffer byteBuffer = channel.map(MapMode.READ_ONLY,
+                    oal.offset, oal.length);
             byte[] byteArray = new byte[(int) oal.length];
             byteBuffer.get(byteArray);
-            LoggingEvent event = (LoggingEvent) new ObjectInputStream(new ByteArrayInputStream(
-                    byteArray)).readObject();
+            LoggingEvent event = (LoggingEvent) new ObjectInputStream(
+                    new ByteArrayInputStream(byteArray)).readObject();
 
             if (LOG.isDebugEnabled()) {
-                LOG.debug("Deserialized event at (offset:" + oal.offset + ", length:" + oal.length
-                        + "), event=" + event);
+                LOG.debug("Deserialized event at (offset:" + oal.offset +
+                        ", length:" + oal.length + "), event=" + event);
             }
             return event;
         } catch (Exception e) {
-            throw new RuntimeException("Failed to deserialize an event at position " + oal.offset
-                    + " for file '" + serializationFie.getAbsoluteFile() + "'", e);
+            throw new RuntimeException(
+                    "Failed to deserialize an event at position " + oal.offset +
+                            " with length " + oal.length + " for file '" +
+                            serializationFie.getAbsoluteFile() + "'", e);
         }
     }
 

Added: labs/pinpoint/trunk/pinpoint-core/src/test/java/org/apache/logging/pinpoint/PinpointTestUtils.java
URL: http://svn.apache.org/viewvc/labs/pinpoint/trunk/pinpoint-core/src/test/java/org/apache/logging/pinpoint/PinpointTestUtils.java?view=auto&rev=564890
==============================================================================
--- labs/pinpoint/trunk/pinpoint-core/src/test/java/org/apache/logging/pinpoint/PinpointTestUtils.java (added)
+++ labs/pinpoint/trunk/pinpoint-core/src/test/java/org/apache/logging/pinpoint/PinpointTestUtils.java Sat Aug 11 03:43:26 2007
@@ -0,0 +1,38 @@
+/*
+ * Copyright 1999-2005 The Apache Software Foundation.
+ * 
+ * Licensed 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.logging.pinpoint;
+
+import org.apache.log4j.Level;
+import org.apache.log4j.Logger;
+import org.apache.log4j.spi.LoggingEvent;
+
+public class PinpointTestUtils {
+
+    private PinpointTestUtils() {
+
+    }
+
+    public static LoggingEvent createEvent(Level level, Logger logger,
+            String msg, Throwable t) {
+        LoggingEvent e = new LoggingEvent(logger.getClass().getName(), logger,
+                level, msg, t);
+        e.setProperty("prop1", "foo");
+        e.setProperty("prop2", "eek");
+
+        e.getLocationInformation();
+
+        return e;
+    }
+}

Modified: labs/pinpoint/trunk/pinpoint-core/src/test/java/org/apache/logging/pinpoint/converter/EventWriterTest.java
URL: http://svn.apache.org/viewvc/labs/pinpoint/trunk/pinpoint-core/src/test/java/org/apache/logging/pinpoint/converter/EventWriterTest.java?view=diff&rev=564890&r1=564889&r2=564890
==============================================================================
--- labs/pinpoint/trunk/pinpoint-core/src/test/java/org/apache/logging/pinpoint/converter/EventWriterTest.java (original)
+++ labs/pinpoint/trunk/pinpoint-core/src/test/java/org/apache/logging/pinpoint/converter/EventWriterTest.java Sat Aug 11 03:43:26 2007
@@ -27,8 +27,9 @@
 import org.apache.log4j.Level;
 import org.apache.log4j.Logger;
 import org.apache.log4j.spi.LoggingEvent;
+import org.apache.logging.pinpoint.PinpointTestUtils;
 import org.apache.logging.pinpoint.analyser.DefaultAnalyzerFactory;
-import org.apache.lucene.analysis.WhitespaceAnalyzer;
+import org.apache.logging.pinpoint.store.SimpleEventStore;
 import org.apache.lucene.document.Document;
 import org.apache.lucene.index.IndexReader;
 
@@ -43,8 +44,10 @@
     }
 
     public void testWriteEvent() throws Exception {
-        File sFile = File.createTempFile(this.getClass().getCanonicalName(), ".ser");
-        File directory = new File(SystemUtils.getJavaIoTmpDir(), "EventWriterTest");
+        File sFile = File.createTempFile(this.getClass().getCanonicalName(),
+                ".ser");
+        File directory = new File(SystemUtils.getJavaIoTmpDir(),
+                "EventWriterTest");
 
         FileUtils.deleteDirectory(directory);
         directory.mkdirs();
@@ -60,10 +63,12 @@
         String baseString_ = "some_base_string";
         List<LoggingEvent> events = new ArrayList<LoggingEvent>();
 
-        events.add(createEvent(Level.TRACE, Logger.getLogger("foo"), "tracemsg" + i++,
-                new Exception("someexception-" + baseString_)));
+        events.add(PinpointTestUtils.createEvent(Level.TRACE, Logger
+                .getLogger("foo"), "tracemsg" + i++, new Exception(
+                "someexception-" + baseString_)));
 
-        events.add(createEvent(Level.INFO, Logger.getLogger("bar"), "infomsg" + i++, new Exception(
+        events.add(PinpointTestUtils.createEvent(Level.INFO, Logger
+                .getLogger("bar"), "infomsg" + i++, new Exception(
                 "someexception-" + baseString_)));
 
         for (LoggingEvent event : events) {
@@ -71,8 +76,8 @@
         }
 
         writer.close();
-        
-        //the eventWriter closes the store, so we have to reopen it 
+
+        // the eventWriter closes the store, so we have to reopen it
         eventStore = new SimpleEventStore(sFile);
 
         IndexReader reader = IndexReader.open(directory);
@@ -88,19 +93,13 @@
             // assertEquals(0, offset);
             LoggingEvent deSerializedEvent = eventStore.restore(eventLocation);
 
-            assertEquals(events.get(index).getLevel(), deSerializedEvent.getLevel());
-            assertEquals(events.get(index).getTimeStamp(), deSerializedEvent.getTimeStamp());
+            assertEquals(events.get(index).getLevel(), deSerializedEvent
+                    .getLevel());
+            assertEquals(events.get(index).getTimeStamp(), deSerializedEvent
+                    .getTimeStamp());
         }
 
         eventStore.close();
-    }
-
-    private LoggingEvent createEvent(Level level, Logger logger, String msg, Throwable t) {
-        LoggingEvent e = new LoggingEvent(logger.getClass().getName(), logger, level, msg, t);
-        e.setProperty("prop1", "foo");
-        e.setProperty("prop2", "eek");
-
-        return e;
     }
 
 }

Added: labs/pinpoint/trunk/pinpoint-core/src/test/java/org/apache/logging/pinpoint/store/AbstractStoreTest.java
URL: http://svn.apache.org/viewvc/labs/pinpoint/trunk/pinpoint-core/src/test/java/org/apache/logging/pinpoint/store/AbstractStoreTest.java?view=auto&rev=564890
==============================================================================
--- labs/pinpoint/trunk/pinpoint-core/src/test/java/org/apache/logging/pinpoint/store/AbstractStoreTest.java (added)
+++ labs/pinpoint/trunk/pinpoint-core/src/test/java/org/apache/logging/pinpoint/store/AbstractStoreTest.java Sat Aug 11 03:43:26 2007
@@ -0,0 +1,78 @@
+/*
+ * Copyright 1999-2005 The Apache Software Foundation.
+ * 
+ * Licensed 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.logging.pinpoint.store;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import junit.framework.TestCase;
+
+import org.apache.log4j.Level;
+import org.apache.log4j.Logger;
+import org.apache.log4j.spi.LoggingEvent;
+import org.apache.logging.pinpoint.PinpointTestUtils;
+
+public abstract class AbstractStoreTest extends TestCase {
+
+    public void testMulitpleEventStores() throws Exception {
+
+        EventStore readStore = createStoreForTest();
+
+        EventStore writeStore = createStoreForTest();
+
+        try {
+            List<String> refs = new ArrayList<String>();
+
+            refs.add(writeStore.store(PinpointTestUtils.createEvent(Level.INFO,
+                    Logger.getLogger(this.getClass()), "Hello World",
+                    new Exception())));
+            refs.add(writeStore.store(PinpointTestUtils.createEvent(Level.INFO,
+                    Logger.getLogger(this.getClass()), "Hello World2",
+                    new Exception())));
+
+            // after doing some writes, read and verify
+            checkRestoredEvents(readStore, refs);
+
+            // now do some more writes...
+            refs.add(writeStore.store(PinpointTestUtils.createEvent(Level.INFO,
+                    Logger.getLogger(this.getClass()), "Hello World",
+                    new Exception())));
+            refs.add(writeStore.store(PinpointTestUtils.createEvent(Level.INFO,
+                    Logger.getLogger(this.getClass()), "Hello World2",
+                    new Exception())));
+
+            // ... and check again, to make sure the writes haven't stuffed
+            // something.
+            checkRestoredEvents(readStore, refs);
+
+        } finally {
+            readStore.close();
+            writeStore.close();
+        }
+
+    }
+
+    protected abstract EventStore createStoreForTest();
+
+    private void checkRestoredEvents(EventStore readStore, List<String> refs) {
+        for (String string : refs) {
+            LoggingEvent event = readStore.restore(string);
+            assertTrue(
+                    "Should have found an event with 'Hello' in the message",
+                    event.getMessage().toString().startsWith("Hello"));
+        }
+    }
+
+}

Added: labs/pinpoint/trunk/pinpoint-core/src/test/java/org/apache/logging/pinpoint/store/HSQLDBEventStoreTest.java
URL: http://svn.apache.org/viewvc/labs/pinpoint/trunk/pinpoint-core/src/test/java/org/apache/logging/pinpoint/store/HSQLDBEventStoreTest.java?view=auto&rev=564890
==============================================================================
--- labs/pinpoint/trunk/pinpoint-core/src/test/java/org/apache/logging/pinpoint/store/HSQLDBEventStoreTest.java (added)
+++ labs/pinpoint/trunk/pinpoint-core/src/test/java/org/apache/logging/pinpoint/store/HSQLDBEventStoreTest.java Sat Aug 11 03:43:26 2007
@@ -0,0 +1,27 @@
+package org.apache.logging.pinpoint.store;
+
+import java.io.File;
+
+import org.apache.log4j.BasicConfigurator;
+import org.apache.log4j.Level;
+import org.apache.log4j.LogManager;
+
+public class HSQLDBEventStoreTest extends AbstractStoreTest {
+
+    private HSQLDBEventStore eventStore;
+
+    public void setUp() throws Exception {
+        BasicConfigurator.resetConfiguration();
+        BasicConfigurator.configure();
+        LogManager.getRootLogger().setLevel(Level.DEBUG);
+        File file = File.createTempFile(this.getClass().getName(), ".hsqldb");
+        file.deleteOnExit();
+        eventStore = new HSQLDBEventStore(file);
+    }
+
+    @Override
+    protected EventStore createStoreForTest() {
+        return eventStore;
+    }
+
+}

Added: labs/pinpoint/trunk/pinpoint-core/src/test/java/org/apache/logging/pinpoint/store/HSQLDBTest.java
URL: http://svn.apache.org/viewvc/labs/pinpoint/trunk/pinpoint-core/src/test/java/org/apache/logging/pinpoint/store/HSQLDBTest.java?view=auto&rev=564890
==============================================================================
--- labs/pinpoint/trunk/pinpoint-core/src/test/java/org/apache/logging/pinpoint/store/HSQLDBTest.java (added)
+++ labs/pinpoint/trunk/pinpoint-core/src/test/java/org/apache/logging/pinpoint/store/HSQLDBTest.java Sat Aug 11 03:43:26 2007
@@ -0,0 +1,132 @@
+/*
+ * Copyright 1999-2005 The Apache Software Foundation. Licensed 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.logging.pinpoint.store;
+
+import java.io.File;
+import java.io.Serializable;
+import java.sql.Connection;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+
+import junit.framework.TestCase;
+
+import org.hsqldb.jdbc.jdbcDataSource;
+import org.junit.After;
+import org.junit.Before;
+import org.springframework.jdbc.core.JdbcTemplate;
+
+public class HSQLDBTest extends TestCase {
+
+    private Connection connection;
+    private jdbcDataSource dataSource;
+
+    private JdbcTemplate jdbcTemplate;
+
+    @Before
+    public void setUp() throws Exception {
+        Class.forName("org.hsqldb.jdbcDriver");
+        String jdbcURL = "jdbc:hsqldb:hsql:file:" +
+                File.createTempFile(HSQLDBTest.class.getName(), ".hsqldb")
+                        .getAbsolutePath().replace('\\', '/');
+        this.dataSource = new jdbcDataSource();
+        dataSource.setDatabase(jdbcURL);
+        dataSource.setUser("sa");
+        dataSource.setPassword("");
+        this.connection = dataSource.getConnection();
+
+        this.jdbcTemplate = new JdbcTemplate(dataSource);
+
+    }
+
+    @After
+    public void tearDown() throws Exception {
+        connection.close();
+    }
+
+    public void testThatPaulIsNotGoingCompletelyMadBasic() throws Exception {
+
+        connection
+                .createStatement()
+                .execute(
+                        "create cached table events(eventid INTEGER GENERATED BY DEFAULT AS IDENTITY(start with 1, increment by 2) PRIMARY KEY, foo int)");
+
+        int update = 0;
+        ResultSet rs = null;
+
+        update = connection.createStatement().executeUpdate(
+                "insert into events(foo) values(" + 42 + ")");
+        assertEquals(1, update);
+        rs = connection.createStatement().executeQuery("Call IDENTITY();");
+        assertTrue(rs.next());
+        assertEquals(1, rs.getInt(1));
+        update = connection.createStatement().executeUpdate(
+                "insert into events(foo) values(" + 69 + ")");
+
+        rs = connection.createStatement().executeQuery("Call IDENTITY();");
+        assertTrue(rs.next());
+        assertEquals(3, rs.getInt(1));
+
+        rs = connection.createStatement().executeQuery(
+                "select foo from events where eventid=1");
+        assertTrue(rs.next());
+        assertEquals(42, rs.getInt(1));
+
+        rs = connection.createStatement().executeQuery(
+                "select foo from events where eventid=3");
+        assertTrue(rs.next());
+        assertEquals(69, rs.getInt(1));
+
+    }
+
+    public void testThatPaulIsNotGoingCompletelyMadObjectSerialization()
+            throws Exception {
+
+        connection
+                .createStatement()
+                .execute(
+                        "create cached table events(eventid INTEGER GENERATED BY DEFAULT AS IDENTITY(start with 1, increment by 2) PRIMARY KEY, event OTHER)");
+
+        ResultSet rs = null;
+        int update = 0;
+
+        PreparedStatement ps = connection
+                .prepareStatement("insert into events(event) values(?)");
+        ps.clearParameters();
+        ps.setObject(1, new Foo());
+        update = ps.executeUpdate();
+        assertEquals(1, update);
+
+        rs = connection.createStatement().executeQuery("Call IDENTITY();");
+        assertTrue(rs.next());
+        assertEquals(1, rs.getInt(1));
+
+        ps.clearParameters();
+        ps.setObject(1, new Foo());
+        update = ps.executeUpdate();
+        assertEquals(1, update);
+
+        rs = connection.createStatement().executeQuery("Call IDENTITY();");
+        assertTrue(rs.next());
+        assertEquals(3, rs.getInt(1));
+
+        rs = connection.createStatement().executeQuery(
+                "select event from events where eventid=1");
+        assertTrue(rs.next());
+        Object obj = null;
+        obj = rs.getObject(1);
+        assertNotNull(obj);
+        assertEquals(Foo.class, obj.getClass());
+
+    }
+
+    private static class Foo implements Serializable {
+
+    }
+
+}

Added: labs/pinpoint/trunk/pinpoint-core/src/test/java/org/apache/logging/pinpoint/store/SimpleEventStoreTest.java
URL: http://svn.apache.org/viewvc/labs/pinpoint/trunk/pinpoint-core/src/test/java/org/apache/logging/pinpoint/store/SimpleEventStoreTest.java?view=auto&rev=564890
==============================================================================
--- labs/pinpoint/trunk/pinpoint-core/src/test/java/org/apache/logging/pinpoint/store/SimpleEventStoreTest.java (added)
+++ labs/pinpoint/trunk/pinpoint-core/src/test/java/org/apache/logging/pinpoint/store/SimpleEventStoreTest.java Sat Aug 11 03:43:26 2007
@@ -0,0 +1,24 @@
+package org.apache.logging.pinpoint.store;
+
+import java.io.File;
+
+import org.apache.commons.lang.SystemUtils;
+
+public class SimpleEventStoreTest extends AbstractStoreTest {
+
+    private File testStoreFile = new File(SystemUtils.getJavaIoTmpDir(),
+            SimpleEventStoreTest.class.getName() + ".ser");
+
+    public void setUp() throws Exception {
+    }
+
+    public void tearDown() throws Exception {
+        testStoreFile.delete();
+    }
+
+    @Override
+    protected EventStore createStoreForTest() {
+        return new SimpleEventStore(testStoreFile);
+    }
+
+}

Modified: labs/pinpoint/trunk/pinpoint-importer/src/main/java/org/apache/logging/pinpoint/importer/Importer.java
URL: http://svn.apache.org/viewvc/labs/pinpoint/trunk/pinpoint-importer/src/main/java/org/apache/logging/pinpoint/importer/Importer.java?view=diff&rev=564890&r1=564889&r2=564890
==============================================================================
--- labs/pinpoint/trunk/pinpoint-importer/src/main/java/org/apache/logging/pinpoint/importer/Importer.java (original)
+++ labs/pinpoint/trunk/pinpoint-importer/src/main/java/org/apache/logging/pinpoint/importer/Importer.java Sat Aug 11 03:43:26 2007
@@ -45,7 +45,7 @@
 import org.apache.logging.pinpoint.analyser.DefaultAnalyzerFactory;
 import org.apache.logging.pinpoint.converter.BatchIndexWriterFactory;
 import org.apache.logging.pinpoint.converter.EventWriter;
-import org.apache.logging.pinpoint.converter.SimpleEventStore;
+import org.apache.logging.pinpoint.store.SimpleEventStore;
 import org.apache.logging.pinpoint.utils.PinpointUtils;
 
 public class Importer implements Runnable {

Modified: labs/pinpoint/trunk/pinpoint-search/src/main/java/org/apache/logging/pinpoint/search/PinpointSearcher.java
URL: http://svn.apache.org/viewvc/labs/pinpoint/trunk/pinpoint-search/src/main/java/org/apache/logging/pinpoint/search/PinpointSearcher.java?view=diff&rev=564890&r1=564889&r2=564890
==============================================================================
--- labs/pinpoint/trunk/pinpoint-search/src/main/java/org/apache/logging/pinpoint/search/PinpointSearcher.java (original)
+++ labs/pinpoint/trunk/pinpoint-search/src/main/java/org/apache/logging/pinpoint/search/PinpointSearcher.java Sat Aug 11 03:43:26 2007
@@ -20,8 +20,8 @@
 
 import org.apache.log4j.spi.LoggingEvent;
 import org.apache.logging.pinpoint.PinpointContext;
-import org.apache.logging.pinpoint.converter.EventStore;
 import org.apache.logging.pinpoint.resolver.OffsetAndLength;
+import org.apache.logging.pinpoint.store.EventStore;
 import org.apache.lucene.document.Document;
 import org.apache.lucene.search.Filter;
 import org.apache.lucene.search.Hit;
@@ -112,7 +112,8 @@
                         .resolveLocationFromDocument(document);
                 return eventStore.restore(eventLocationKey);
             } catch (Exception e) {
-                throw new RuntimeException("Failed to navigate to next hit", e);
+                throw new RuntimeException("Failed to navigate to next hit: " +
+                        debugHit(hit), e);
             }
         }
 
@@ -121,6 +122,16 @@
             throw new UnsupportedOperationException("remove() is not supported");
         }
 
+    }
+
+    private String debugHit(Hit hit) {
+        try {
+            StringBuilder buf = new StringBuilder();
+            buf.append("docId:").append(hit.getId());
+            return buf.toString();
+        } catch (Exception e) {
+            return "<failed to create debug String" + e.getMessage();
+        }
     }
 
     public void close() {

Modified: labs/pinpoint/trunk/pom.xml
URL: http://svn.apache.org/viewvc/labs/pinpoint/trunk/pom.xml?view=diff&rev=564890&r1=564889&r2=564890
==============================================================================
--- labs/pinpoint/trunk/pom.xml (original)
+++ labs/pinpoint/trunk/pom.xml Sat Aug 11 03:43:26 2007
@@ -48,15 +48,6 @@
           <target>1.5</target>
         </configuration>
       </plugin>
-<!--      <plugin>
-        <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-doap-plugin</artifactId>
-        <configuration>
-          <category>logging</category>
-          <language>Java</language>
-        </configuration>
-      </plugin>
--->
     </plugins>
   </build>
   <reporting>
@@ -78,4 +69,15 @@
       </plugin>
     </plugins>
   </reporting>
+  <distributionManagement>
+      <repository>
+      <id>logging.repo</id>
+      <url>scp://people.apache.org/home/psmith/public_html/logging.apache.org/repo/</url>
+    </repository>
+    <site>
+      <id>pinpoint.site</id>
+      <url>scp://people.apache.org/home/psmith/public_html/${project.artifactId}/</url>
+    </site>
+ </distributionManagement>
+  
 </project>



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@labs.apache.org
For additional commands, e-mail: commits-help@labs.apache.org


Mime
View raw message