db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rhille...@apache.org
Subject svn commit: r1569611 [1/5] - in /db/derby/code/trunk/java/demo/vtis: ./ data/ java/org/apache/derbyDemo/vtis/example/ sql/
Date Wed, 19 Feb 2014 02:12:42 GMT
Author: rhillegas
Date: Wed Feb 19 02:12:41 2014
New Revision: 1569611

URL: http://svn.apache.org/r1569611
Log:
DERBY-6482: Revamp the VTI demo to behave more like the other demos; commit derby-6482-01-aa-moveResources.diff.

Added:
    db/derby/code/trunk/java/demo/vtis/ApacheServerLog.xml
      - copied unchanged from r1569008, db/derby/code/trunk/java/demo/vtis/data/ApacheServerLog.xml
    db/derby/code/trunk/java/demo/vtis/DerbyJiraReport.xml
      - copied unchanged from r1569008, db/derby/code/trunk/java/demo/vtis/data/DerbyJiraReport.xml
    db/derby/code/trunk/java/demo/vtis/demoFileVtis.sql
      - copied, changed from r1569008, db/derby/code/trunk/java/demo/vtis/sql/demoFileVtis.sql
    db/derby/code/trunk/java/demo/vtis/messages_en.properties   (with props)
    db/derby/code/trunk/java/demo/vtis/messages_fr.properties   (with props)
    db/derby/code/trunk/java/demo/vtis/svn_log.txt
      - copied unchanged from r1569008, db/derby/code/trunk/java/demo/vtis/data/svn_log.txt
Removed:
    db/derby/code/trunk/java/demo/vtis/data/
    db/derby/code/trunk/java/demo/vtis/sql/
Modified:
    db/derby/code/trunk/java/demo/vtis/README.html
    db/derby/code/trunk/java/demo/vtis/java/org/apache/derbyDemo/vtis/example/ApacheServerLogVTI.java
    db/derby/code/trunk/java/demo/vtis/java/org/apache/derbyDemo/vtis/example/DerbyJiraReportVTI.java

Modified: db/derby/code/trunk/java/demo/vtis/README.html
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/demo/vtis/README.html?rev=1569611&r1=1569610&r2=1569611&view=diff
==============================================================================
--- db/derby/code/trunk/java/demo/vtis/README.html (original)
+++ db/derby/code/trunk/java/demo/vtis/README.html Wed Feb 19 02:12:41 2014
@@ -44,5 +44,78 @@ report</li>
 <li><code>SubversionLogVTI</code> - a table function for making a table
from the
 output of the <code>svn log</code> command</li>
 </ul>
+
+<h2 class="Heading2"><a id="runembedded" name="runembedded">How to run this sample
application in an embedded environment</a>
+</h2>
+<p>
+This demo relies on the Derby embedded JDBC driver and the interactive
+ij tool (used for issuing SQL):
+</p>
+
+<table class="listing">
+  <tr>
+    <td class="listItem">Class name:</td>
+    <td class="listItem"><em class="javaObject">org.apache.derby.jdbc.EmbeddedDriver</em></td>
+  </tr>
+  <tr>
+    <td class="listItem">Library:</td>
+    <td class="listItem"><em class="fileName">derby.jar</em></td>
+  </tr>
+</table>
+
+<p>&nbsp;</p>
+
+<table class="listing">
+  <tr>
+    <td class="listItem">Class name:</td>
+    <td class="listItem"><em class="javaObject">org.apache.derby.tools.ij</em></td>
+  </tr>
+  <tr>
+    <td class="listItem">Library:</td>
+    <td class="listItem"><em class="fileName">derbytools.jar</em></td>
+  </tr>
+</table>
+
+<p>&nbsp;</p>
+
+<ol class="decimal">
+  <li class="Normal">Open a command window.
+  <li class="Normal">If you haven't set it already on a system-wide basis, set
+  the <var class="envVar">DERBY_HOME</var> environment variable to the location
+  of this Derby installation. This is not strictly required to run the demo, but
+  this environment variable will be used later on this page to refer to the
+  required Derby resources, files, etc. Examples:
+    <p class="BodyRelative">UNIX (ksh/bash)</p>
+    <p class="commandLine">export DERBY_HOME=/home/user/derby/db-derby-10.x.y.z-bin</p>
+    <p class="BodyRelative">Windows:</p>
+    <p class="commandLine">set DERBY_HOME=c:\programs\derby\db-derby-10.x.y.z-bin</p>
+  <li class="Normal">Change directory to the <em class="fileName">$DERBY_HOME/demo/programs/vtis</em>
directory.
+  <li class="Normal">In the command window, set the CLASSPATH to include the
+  current directory (the location of <em class="fileName">demoFileVtis.sql</em>),
+  Derby's embedded driver library (<em class="fileName">derby.jar</em>),
+  and Derby's tool library (<em class="fileName">derbytools.jar</em>).
+  (You may skip this step and provide the classpath as an option to the JVM
+  launch command instead, refer to your JVM's documentation for details).
+    <p class="BodyRelative">This may be done as follows:</p>
+    <p class="BodyRelative">UNIX (ksh/bash):</p>
+    <p class="commandLine">export CLASSPATH=.:${DERBY_HOME}/lib/derby.jar:${DERBY_HOME}/lib/derbytools.jar</p>
+    <p class="BodyRelative">WINDOWS:</p>
+    <p class="commandLine">set CLASSPATH=.;%DERBY_HOME%\lib\derby.jar;%DERBY_HOME%\lib\derbytools.jar</p>
+  <li class="Normal">Once you have your environment set up correctly, execute
+    the demo from the same directory (<em class="fileName">demo/programs/vtis</em>):
+    <p class="CommandLine">java org.apache.derby.tools.ij demoFileVtis.sql</p>
+    <p class="BodyRelative">A successful run produces many pages of SQL
+  commands and query results.</p>
+    <p class="BodyRelative">
+      If any error messages appear, and you are unable to resolve the error(s),
+      ask for help on the derby-user
+      <a href="http://db.apache.org/derby/derby_mail.html" target="_new">mailing list</a>.
+    </p>
+</ol>
+
+
+
+
+
 </body>
 </html>

Copied: db/derby/code/trunk/java/demo/vtis/demoFileVtis.sql (from r1569008, db/derby/code/trunk/java/demo/vtis/sql/demoFileVtis.sql)
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/demo/vtis/demoFileVtis.sql?p2=db/derby/code/trunk/java/demo/vtis/demoFileVtis.sql&p1=db/derby/code/trunk/java/demo/vtis/sql/demoFileVtis.sql&r1=1569008&r2=1569611&rev=1569611&view=diff
==============================================================================
--- db/derby/code/trunk/java/demo/vtis/sql/demoFileVtis.sql (original)
+++ db/derby/code/trunk/java/demo/vtis/demoFileVtis.sql Wed Feb 19 02:12:41 2014
@@ -20,14 +20,6 @@
 -- This script demonstrates how to declare and use several sample
 -- table functions.
 --
--- Several of the function calls in this script assume that your
--- Derby code client can be found at:
---
---          /opt/DerbyTrunk
---
---  If that is not the case, then you will need to adjust this
---  script accordingly.
---
 ----------------------------------------------------------------------------------------
 
 connect 'jdbc:derby:memory:vtitest;create=true';
@@ -111,7 +103,7 @@ external name 'org.apache.derbyDemo.vtis
 
 -- how active were the committers in 2006?
 select committer, count(*) as commits
-from table( svnLogReader( '/opt/DerbyTrunk/java/demo/vtis/data/svn_log.txt' ) ) s
+from table( svnLogReader( 'svn_log.txt' ) ) s
 where commit_time between timestamp( '2006-01-01 00:00:00' ) and timestamp( '2007-01-01 00:00:00'
)
 group by committer
 ;
@@ -124,11 +116,11 @@ group by committer
 
 -- find the messages which have not been translated into french
 select messageID, substr( m_english.messageText, 1, 100 )
-from table( propertyFileVTI( '/opt/DerbyTrunk/generated/java/org/apache/derby/loc/messages_en.properties'
) ) m_english
+from table( propertyFileVTI( 'messages_en.properties' ) ) m_english
 where m_english.messageID not in
 (
     select m_french.messageID
-    from table( propertyFileVTI( '/opt/DerbyTrunk/java/engine/org/apache/derby/loc/messages_fr.properties'
) ) m_french
+    from table( propertyFileVTI( 'messages_fr.properties' ) ) m_french
 );
 
 
@@ -144,24 +136,24 @@ where m_english.messageID not in
 
 -- this vti treats accessDate as a timestamp and fileSize as an int
 select s.*
-from table( apacheNaturalLogFile( 'file:///opt/DerbyTrunk/java/demo/vtis/data/ApacheServerLog.xml'
) ) s
+from table( apacheNaturalLogFile( 'ApacheServerLog.xml' ) ) s
 ;
 
 -- look for relevant status codes
 select s.*
-from table( apacheNaturalLogFile( 'file:///opt/DerbyTrunk/java/demo/vtis/data/ApacheServerLog.xml'
) ) s
+from table( apacheNaturalLogFile( 'ApacheServerLog.xml' ) ) s
 where s.statusCode = 206
 ;
 
 -- look for relevant IP addresses
 select s.*
-from table( apacheNaturalLogFile( 'file:///opt/DerbyTrunk/java/demo/vtis/data/ApacheServerLog.xml'
) ) s
+from table( apacheNaturalLogFile( 'ApacheServerLog.xml' ) ) s
 where IP like '208%'
 ;
 
 -- look for log records in a time range
 select s.*
-from table( apacheNaturalLogFile( 'file:///opt/DerbyTrunk/java/demo/vtis/data/ApacheServerLog.xml'
) ) s
+from table( apacheNaturalLogFile( 'ApacheServerLog.xml' ) ) s
 where accessDate between timestamp( '2002-07-01 08:40:56.0' ) and timestamp( '2002-07-01
08:42:56.0' )
 ;
 
@@ -171,14 +163,14 @@ where accessDate between timestamp( '200
 
 -- treat keys as ints and sort Derby JIRAs by key
 select s.*
-from table( apacheNaturalJiraReport( 'file:///opt/DerbyTrunk/java/demo/vtis/data/DerbyJiraReport.xml'
) ) s
+from table( apacheNaturalJiraReport( 'DerbyJiraReport.xml' ) ) s
 where s.keyCol between 2800 and 2950
 order by keyCol
 ;
 
 -- eliminate uninteresting Derby JIRAs
 select s.*
-from table( apacheNaturalJiraReport( 'file:///opt/DerbyTrunk/java/demo/vtis/data/DerbyJiraReport.xml'
) ) s
+from table( apacheNaturalJiraReport( 'DerbyJiraReport.xml' ) ) s
 where type != 'Sub-task'
 order by keyCol
 ;

Modified: db/derby/code/trunk/java/demo/vtis/java/org/apache/derbyDemo/vtis/example/ApacheServerLogVTI.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/demo/vtis/java/org/apache/derbyDemo/vtis/example/ApacheServerLogVTI.java?rev=1569611&r1=1569610&r2=1569611&view=diff
==============================================================================
--- db/derby/code/trunk/java/demo/vtis/java/org/apache/derbyDemo/vtis/example/ApacheServerLogVTI.java
(original)
+++ db/derby/code/trunk/java/demo/vtis/java/org/apache/derbyDemo/vtis/example/ApacheServerLogVTI.java
Wed Feb 19 02:12:41 2014
@@ -21,8 +21,8 @@ limitations under the License.
 
 package org.apache.derbyDemo.vtis.example;
 
+import java.io.FileInputStream;
 import java.io.InputStream;
-import java.net.URL;
 import java.sql.*;
 import java.text.SimpleDateFormat;
 
@@ -82,11 +82,11 @@ public  class   ApacheServerLogVTI  exte
     //
     ///////////////////////////////////////////////////////////////////////////////////
 
-    /** Create from an URL string identifying the server log file */
+    /** Create from a file name identifying the server log file */
     public  static  ApacheServerLogVTI  apacheNaturalLogFile( String xmlResourceName )
         throws Exception
     {
-        return new ApacheServerLogVTI( (new URL( xmlResourceName )).openStream() );
+        return new ApacheServerLogVTI( new FileInputStream( xmlResourceName ) );
     }
     
 

Modified: db/derby/code/trunk/java/demo/vtis/java/org/apache/derbyDemo/vtis/example/DerbyJiraReportVTI.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/demo/vtis/java/org/apache/derbyDemo/vtis/example/DerbyJiraReportVTI.java?rev=1569611&r1=1569610&r2=1569611&view=diff
==============================================================================
--- db/derby/code/trunk/java/demo/vtis/java/org/apache/derbyDemo/vtis/example/DerbyJiraReportVTI.java
(original)
+++ db/derby/code/trunk/java/demo/vtis/java/org/apache/derbyDemo/vtis/example/DerbyJiraReportVTI.java
Wed Feb 19 02:12:41 2014
@@ -21,8 +21,8 @@ limitations under the License.
 
 package org.apache.derbyDemo.vtis.example;
 
+import java.io.FileInputStream;
 import java.io.InputStream;
-import java.net.URL;
 import java.sql.*;
 import java.text.SimpleDateFormat;
 
@@ -80,11 +80,11 @@ public  class   DerbyJiraReportVTI  exte
     //
     ///////////////////////////////////////////////////////////////////////////////////
 
-    /** Create from an URL string identifying the server log file */
+    /** Create from an file name identifying the server log file */
     public  static  DerbyJiraReportVTI  apacheNaturalJiraReport( String xmlResourceName )
         throws Exception
     {
-        return new DerbyJiraReportVTI( (new URL( xmlResourceName )).openStream() );
+        return new DerbyJiraReportVTI( new FileInputStream( xmlResourceName ) );
     }
     
     ///////////////////////////////////////////////////////////////////////////////////



Mime
View raw message