org.apache.derbyDemo.vtis.example
Class SubversionLogVTI

java.lang.Object
  extended by org.apache.derbyDemo.vtis.core.VTITemplate
      extended by org.apache.derbyDemo.vtis.core.StringColumnVTI
          extended by org.apache.derbyDemo.vtis.core.FlatFileVTI
              extended by org.apache.derbyDemo.vtis.example.SubversionLogVTI
All Implemented Interfaces:
java.sql.ResultSet, java.sql.Wrapper

public class SubversionLogVTI
extends FlatFileVTI

This VTI makes a table out of the output of the subversion log ("svn log") command.


Nested Class Summary
 
Nested classes/interfaces inherited from class org.apache.derbyDemo.vtis.core.StringColumnVTI
StringColumnVTI.SimpleBlob, StringColumnVTI.SimpleClob
 
Field Summary
private  java.text.SimpleDateFormat _dateFormatter
           
private static java.lang.String[] COLUMN_NAMES
           
private static int COMMIT_TIME
           
private static int COMMITTER
           
private static int DESCRIPTION
           
private static int LINE_COUNT
           
private static java.lang.String RECORD_HEADER
           
private static int XID
           
 
Fields inherited from interface java.sql.ResultSet
CLOSE_CURSORS_AT_COMMIT, CONCUR_READ_ONLY, CONCUR_UPDATABLE, FETCH_FORWARD, FETCH_REVERSE, FETCH_UNKNOWN, HOLD_CURSORS_OVER_COMMIT, TYPE_FORWARD_ONLY, TYPE_SCROLL_INSENSITIVE, TYPE_SCROLL_SENSITIVE
 
Constructor Summary
SubversionLogVTI(java.lang.String logFileName)
           Build a SubversionLogVTI given the name of the output file created by the "svn log" command.
 
Method Summary
private  java.text.SimpleDateFormat getDateFormatter()
           Subversion formats timestamps thusly: "2007-09-16 11:17:37 -0700 (Sun, 16 Sep 2007)"
 java.sql.Timestamp getTimestamp(int columnIndex)
           Subversion formats timestamps thusly: "2007-09-16 11:17:37 -0700 (Sun, 16 Sep 2007)"
private  boolean isRecordHeader(java.lang.String line)
           Returns true if a line is a record header.
protected  java.lang.String[] parseRow()
           Parse the next chunk of text, using readLine(), and return the next row.
private  java.lang.String readField(java.lang.String mainline, int[] oldIdx)
           Read the next field in the main line of the record.
private  java.lang.String readNextLine()
           Read a line, possibly just using the last line that was pushed back.
static java.sql.ResultSet subversionLogVTI(java.lang.String logFileName)
           This is the method which is registered as a table function.
 
Methods inherited from class org.apache.derbyDemo.vtis.core.FlatFileVTI
close, getLineNumber, getMetaData, getRawColumn, getTextFileName, next, readLine, wrap, wrap
 
Methods inherited from class org.apache.derbyDemo.vtis.core.StringColumnVTI
findColumn, getAsciiStream, getBigDecimal, getBinaryStream, getBlob, getBoolean, getByte, getBytes, getClob, getColumnNames, getDate, getDouble, getFloat, getInt, getLong, getShort, getString, getTime, setWasNull, wasNull
 
Methods inherited from class org.apache.derbyDemo.vtis.core.VTITemplate
absolute, afterLast, beforeFirst, cancelRowUpdates, clearWarnings, deleteRow, first, getArray, getArray, getAsciiStream, getBigDecimal, getBigDecimal, getBigDecimal, getBinaryStream, getBlob, getBoolean, getByte, getBytes, getCharacterStream, getCharacterStream, getClob, getConcurrency, getCursorName, getDate, getDate, getDate, getDouble, getFetchDirection, getFetchSize, getFloat, getInt, getLong, getObject, getObject, getObject, getObject, getRef, getRef, getRow, getShort, getStatement, getString, getTime, getTime, getTime, getTimestamp, getTimestamp, getTimestamp, getType, getUnicodeStream, getUnicodeStream, getURL, getURL, getWarnings, insertRow, isAfterLast, isBeforeFirst, isFirst, isLast, last, moveToCurrentRow, moveToInsertRow, previous, refreshRow, relative, rowDeleted, rowInserted, rowUpdated, setFetchDirection, setFetchSize, updateArray, updateArray, updateAsciiStream, updateAsciiStream, updateBigDecimal, updateBigDecimal, updateBinaryStream, updateBinaryStream, updateBlob, updateBlob, updateBoolean, updateBoolean, updateByte, updateByte, updateBytes, updateBytes, updateCharacterStream, updateCharacterStream, updateClob, updateClob, updateDate, updateDate, updateDouble, updateDouble, updateFloat, updateFloat, updateInt, updateInt, updateLong, updateLong, updateNull, updateNull, updateObject, updateObject, updateObject, updateObject, updateRef, updateRef, updateRow, updateShort, updateShort, updateString, updateString, updateTime, updateTime, updateTimestamp, updateTimestamp
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.sql.ResultSet
getHoldability, getNCharacterStream, getNCharacterStream, getNClob, getNClob, getNString, getNString, getRowId, getRowId, getSQLXML, getSQLXML, isClosed, updateAsciiStream, updateAsciiStream, updateBinaryStream, updateBinaryStream, updateBlob, updateBlob, updateCharacterStream, updateCharacterStream, updateClob, updateClob, updateNCharacterStream, updateNCharacterStream, updateNClob, updateNClob, updateNClob, updateNClob, updateNString, updateNString, updateRowId, updateRowId, updateSQLXML, updateSQLXML
 
Methods inherited from interface java.sql.Wrapper
isWrapperFor, unwrap
 

Field Detail

COLUMN_NAMES

private static final java.lang.String[] COLUMN_NAMES

XID

private static final int XID
See Also:
Constant Field Values

COMMITTER

private static final int COMMITTER
See Also:
Constant Field Values

COMMIT_TIME

private static final int COMMIT_TIME
See Also:
Constant Field Values

LINE_COUNT

private static final int LINE_COUNT
See Also:
Constant Field Values

DESCRIPTION

private static final int DESCRIPTION
See Also:
Constant Field Values

RECORD_HEADER

private static final java.lang.String RECORD_HEADER
See Also:
Constant Field Values

_dateFormatter

private java.text.SimpleDateFormat _dateFormatter
Constructor Detail

SubversionLogVTI

public SubversionLogVTI(java.lang.String logFileName)

Build a SubversionLogVTI given the name of the output file created by the "svn log" command.

Method Detail

subversionLogVTI

public static java.sql.ResultSet subversionLogVTI(java.lang.String logFileName)
                                           throws java.sql.SQLException

This is the method which is registered as a table function.

Throws:
java.sql.SQLException

parseRow

protected java.lang.String[] parseRow()
                               throws java.sql.SQLException

Parse the next chunk of text, using readLine(), and return the next row. Returns null if the file is exhausted.

Specified by:
parseRow in class FlatFileVTI
Throws:
java.sql.SQLException

getTimestamp

public java.sql.Timestamp getTimestamp(int columnIndex)
                                throws java.sql.SQLException

Subversion formats timestamps thusly: "2007-09-16 11:17:37 -0700 (Sun, 16 Sep 2007)"

Specified by:
getTimestamp in interface java.sql.ResultSet
Overrides:
getTimestamp in class StringColumnVTI
Throws:
java.sql.SQLException - on unexpected JDBC error
See Also:
ResultSet

readField

private java.lang.String readField(java.lang.String mainline,
                                   int[] oldIdx)
                            throws java.sql.SQLException

Read the next field in the main line of the record. Fields are delimited by | or line-end.

Throws:
java.sql.SQLException

isRecordHeader

private boolean isRecordHeader(java.lang.String line)

Returns true if a line is a record header.


readNextLine

private java.lang.String readNextLine()
                               throws java.sql.SQLException

Read a line, possibly just using the last line that was pushed back.

Throws:
java.sql.SQLException

getDateFormatter

private java.text.SimpleDateFormat getDateFormatter()

Subversion formats timestamps thusly: "2007-09-16 11:17:37 -0700 (Sun, 16 Sep 2007)"