db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From myrn...@apache.org
Subject svn commit: r596793 - in /db/derby/code/branches/10.3: java/demo/ java/demo/simple/ java/demo/simplemobile/ tools/release/
Date Tue, 20 Nov 2007 19:35:12 GMT
Author: myrnavl
Date: Tue Nov 20 11:35:11 2007
New Revision: 596793

URL: http://svn.apache.org/viewvc?rev=596793&view=rev
Log:
DERBY-3187, DERBY-3190 - backport of revision 593673 and 596792 to fix up
  the SimpleApp demo to work with derbynetclient as per instructions, and
  to implement an alternative demo for Java ME platform.
  Patches contributed by John Embretsen

Added:
    db/derby/code/branches/10.3/java/demo/simplemobile/
      - copied from r596792, db/derby/code/trunk/java/demo/simplemobile/
    db/derby/code/branches/10.3/java/demo/simplemobile/SimpleMobileApp.java
      - copied unchanged from r596792, db/derby/code/trunk/java/demo/simplemobile/SimpleMobileApp.java
    db/derby/code/branches/10.3/java/demo/simplemobile/readme.html
      - copied unchanged from r596792, db/derby/code/trunk/java/demo/simplemobile/readme.html
Modified:
    db/derby/code/branches/10.3/java/demo/build.xml
    db/derby/code/branches/10.3/java/demo/csfull.css
    db/derby/code/branches/10.3/java/demo/demo.html
    db/derby/code/branches/10.3/java/demo/navbar.html
    db/derby/code/branches/10.3/java/demo/simple/SimpleApp.java
    db/derby/code/branches/10.3/java/demo/simple/example.html
    db/derby/code/branches/10.3/tools/release/build.xml

Modified: db/derby/code/branches/10.3/java/demo/build.xml
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.3/java/demo/build.xml?rev=596793&r1=596792&r2=596793&view=diff
==============================================================================
--- db/derby/code/branches/10.3/java/demo/build.xml (original)
+++ db/derby/code/branches/10.3/java/demo/build.xml Tue Nov 20 11:35:11 2007
@@ -74,6 +74,7 @@
         <pathelement location="${jcc}"/>
       </classpath>
     </javac>
+    <!-- "simple" demos under java/demo/ (SimpleApp, SimpleMobileApp) -->
     <javac
       source="1.4"
       target="1.4"
@@ -85,8 +86,9 @@
       optimize="${optimize}"
       proceed="${proceed}"
       verbose="${verbose}"
-      srcdir="${derby.demo.src.dir}/simple"
-      destdir="${out.dir}">
+      srcdir="${derby.demo.src.dir}"
+      destdir="${out.dir}"
+      includes="simple/**,simplemobile/**">
       <classpath>
         <pathelement location="${javasrc.dir};${jcc}"/>
         <pathelement path="${java14compile.classpath};${jcc}"/>

Modified: db/derby/code/branches/10.3/java/demo/csfull.css
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.3/java/demo/csfull.css?rev=596793&r1=596792&r2=596793&view=diff
==============================================================================
--- db/derby/code/branches/10.3/java/demo/csfull.css (original)
+++ db/derby/code/branches/10.3/java/demo/csfull.css Tue Nov 20 11:35:11 2007
@@ -329,6 +329,11 @@
 	background-color : transparent;
 }
 
+OL.decimal {
+        background-color : transparent;
+        list-style-type : decimal;
+}
+
 P {
 	text-align : left;
 	font-style : normal;

Modified: db/derby/code/branches/10.3/java/demo/demo.html
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.3/java/demo/demo.html?rev=596793&r1=596792&r2=596793&view=diff
==============================================================================
--- db/derby/code/branches/10.3/java/demo/demo.html (original)
+++ db/derby/code/branches/10.3/java/demo/demo.html Tue Nov 20 11:35:11 2007
@@ -28,10 +28,14 @@
 the <A href="../../docs/html/adminguide/index.html">Apache Derby Server and Administration
Guide</A> 
 .</p>
 <UL>
-	<LI><A href="simple/example.html">Simple</A>
+<LI><A href="simple/example.html">Simple</A>
         <p class="BodyRelative">A very simple JDBC application that boots the driver,
                                 creates a database, and loads some data.</p></LI>
-</LI>
+<li><a href="simplemobile/readme.html">Simple Mobile Demo</a>
+    <p class="BodyRelative">A simple JDBC application for Java ME (J2ME) environments.
+    This demo application uses Derby's EmbeddedSimpleDataSource to create a database and
+    insert, modify and retreive some data.</p>
+</li>
 <LI><A href="nserverdemo/readme.html">Network Server Sample Programs</A>
 	<p class="BodyRelative">Two examples are provided to demonstrate how to obtain an
<em class="Emphasis">embedded connection</em> 
 and <em class="Emphasis">client connections</em> using the Network Server to
connect to the same database. 
@@ -44,9 +48,9 @@
 The document describes the tables, the names and types of columns in those tables, and the
constraints, indexes, and triggers in the database.
     </p>
 </li>
-	<LI><A href="workingwithderby/readme.html">Getting Started With Derby</A>
+<LI><A href="workingwithderby/readme.html">Getting Started With Derby</A>
         <p class="BodyRelative">Programs described and modified as part of the activities
documented in 
-the <A href="../../docs/html/getstart/index.html">Getting Started With Derby</A>
manual.</p></LI>
+the <A href="../../docs/html/getstart/index.html">Getting Started With Derby</A>
manual.</p>
 </LI>
 </UL>
 

Modified: db/derby/code/branches/10.3/java/demo/navbar.html
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.3/java/demo/navbar.html?rev=596793&r1=596792&r2=596793&view=diff
==============================================================================
--- db/derby/code/branches/10.3/java/demo/navbar.html (original)
+++ db/derby/code/branches/10.3/java/demo/navbar.html Tue Nov 20 11:35:11 2007
@@ -25,6 +25,7 @@
 
 <p class="NavBar"><a href="demo.html" target="mainPage">Demo home</a></li></p>
 <p class="NavBar1"><a href="simple/example.html" target="mainPage">Simple</a></p>
+<p class="NavBar1"><a href="simplemobile/readme.html" target="mainPage">Simple
Mobile Demo</a></p>
 <p class="NavBar1"><a href="nserverdemo/readme.html" target="mainPage">Network
Server Sample Programs</a></p>
 <p class="NavBar1"><a href="toursdb/toursdb_readme.html" target="mainPage">ToursDB
sample database schema</a></p>
 <p class="NavBar1"><a href="workingwithderby/readme.html" target="mainPage">Getting
Started With Derby Activities Programs</a></p>

Modified: db/derby/code/branches/10.3/java/demo/simple/SimpleApp.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.3/java/demo/simple/SimpleApp.java?rev=596793&r1=596792&r2=596793&view=diff
==============================================================================
--- db/derby/code/branches/10.3/java/demo/simple/SimpleApp.java (original)
+++ db/derby/code/branches/10.3/java/demo/simple/SimpleApp.java Tue Nov 20 11:35:11 2007
@@ -55,9 +55,6 @@
     public String framework = "embedded";
     public String driver = "org.apache.derby.jdbc.EmbeddedDriver";
     public String protocol = "jdbc:derby:";
-    
-    public String username = "user1";
-    public String password = "user1";
 
     public static void main(String[] args)
     {
@@ -69,14 +66,6 @@
         /* parse the arguments to determine which framework is desired*/
         parseArguments(args);
 
-        /* check for J2ME specification - J2ME must use a DataSource further on */
-        String javaspec = System.getProperty( "java.specification.name" );
-        boolean java2me = false;
-        if( javaspec.indexOf( "J2ME" ) > -1 )
-        {
-            java2me = true;
-        }
-        
         System.out.println("SimpleApp starting in " + framework + " mode.");
 
         try
@@ -85,56 +74,26 @@
                The driver is installed by loading its class.
                In an embedded environment, this will start up Derby, since it is not already
running.
              */
-            org.apache.derby.jdbc.EmbeddedSimpleDataSource ds = null;
+            Class.forName(driver).newInstance();
+            System.out.println("Loaded the appropriate driver.");
+
             Connection conn = null;
             Properties props = new Properties();
-            props.put("user", username);
-            props.put("password", password);
+            props.put("user", "user1");
+            props.put("password", "user1");
 
-            /* If we are using a J2ME jvm, we need to use a DataSource, otherwise
-             * we can use java.sql.DriverManager to get the connection, or
-             * a Datasource. This example program uses a DataSource with J2ME
-             * but uses DriverManager otherwise.
-             * If we were to use a DataSource for J2SE, we could use
-             * the org.apache.derby.jdbc.EmbeddedDataSource, rather than the
-             * org.apache.derby.jdbc.EmbeddedSimpleDataSource we need to use for J2ME.
-             */
-         
-            if( java2me )
-            {
-                /*
-                   The connection specifies create in the DataSource settings for
-                   the database to be created. To remove the database,
-                   remove the directory derbyDB and its contents.
-                   The directory derbyDB will be created under
-                   the directory that the system property
-                   derby.system.home points to, or the current
-                   directory if derby.system.home is not set.
-                 */
-       
-                ds = new org.apache.derby.jdbc.EmbeddedSimpleDataSource();
-                ds.setDatabaseName("derbyDB");
-                ds.setCreateDatabase("create");
-                conn = ds.getConnection(username, password);
-            }
-            else
-            {
-                /*
-                   The connection specifies create=true in the url to cause
-                   the database to be created. To remove the database,
-                   remove the directory derbyDB and its contents.
-                   The directory derbyDB will be created under
-                   the directory that the system property
-                   derby.system.home points to, or the current
-                   directory if derby.system.home is not set.
-                 */
-          
-                Class.forName(driver).newInstance();
-                System.out.println("Loaded the appropriate driver.");
-            
-                conn = DriverManager.getConnection(protocol +
+            /*
+               The connection specifies create=true to cause
+               the database to be created. To remove the database,
+               remove the directory derbyDB and its contents.
+               The directory derbyDB will be created under
+               the directory that the system property
+               derby.system.home points to, or the current
+               directory if derby.system.home is not set.
+             */
+            conn = DriverManager.getConnection(protocol +
                     "derbyDB;create=true", props);
-            }
+
             System.out.println("Connected to and created database derbyDB");
 
             conn.setAutoCommit(false);
@@ -224,32 +183,13 @@
 
             if (framework.equals("embedded"))
             {
-                /* again, with J2ME, we need to use a datasource to get the connection */
-                if( java2me )
+                try
                 {
-                    try
-                    {
-                        ds.setShutdownDatabase( "shutdown" );
-                        conn = ds.getConnection(username, password);
-                    }
-                    catch (SQLException se)
-                    {
-                        if( se.getErrorCode() == 45000 )
-                        {
-                            gotSQLExc = true;
-                        }
-                    }
+                    DriverManager.getConnection("jdbc:derby:;shutdown=true");
                 }
-                else                  
-                {   
-                    try
-                    {
-                        DriverManager.getConnection("jdbc:derby:;shutdown=true");
-                    }
-                    catch (SQLException se)
-                    {
-                        gotSQLExc = true;
-                    }
+                catch (SQLException se)
+                {
+                    gotSQLExc = true;
                 }
 
                 if (!gotSQLExc)
@@ -308,4 +248,4 @@
             }
         }
     }
-}
\ No newline at end of file
+}

Modified: db/derby/code/branches/10.3/java/demo/simple/example.html
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.3/java/demo/simple/example.html?rev=596793&r1=596792&r2=596793&view=diff
==============================================================================
--- db/derby/code/branches/10.3/java/demo/simple/example.html (original)
+++ db/derby/code/branches/10.3/java/demo/simple/example.html Tue Nov 20 11:35:11 2007
@@ -18,7 +18,7 @@
 <html>
 <head>
 <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
-<meta name="LASTUPDATED" content="07/18/01 06:12:42">
+<meta name="LASTUPDATED" content="2007-11-08 09:18:20 UTC">
 <link rel="StyleSheet" href="../csfull.css" type="text/css" media="screen">
 <title>Simple JDBC Application</title>
 
@@ -69,7 +69,6 @@
   <a name="820012"> </a>This example program is a very minimal JDBC application.
JDBC is the primary API for interacting with Apache Derby. This program:
 </p><ul class="Normal">  
   <li class="Normal">runs in either embedded mode (the default) or as a client in a
server environment, depending on the arguments passed to the program.
-  <li class="Normal">runs in J2ME or J2SE Java Virtual Machines.
   <li class="Normal"><a name="817266"> </a>starts up the Derby engine,
if running in embedded mode
   <li class="Normal"><a name="817266"> </a>connects to the Derby Network
Server, if running in client mode
   <li class="Normal"><a name="817275"> </a>creates and connects to a database
@@ -82,7 +81,7 @@
   <li class="Normal"><a name="817282"> </a>shuts down Derby, if running
in embedded mode
 </ul>
 <p class="Body">
-  <a name="817267"> </a>In embedded mode, the application starts up an instance
of Derby within the current Java Virtual Machine and shuts down the instance before it completes.
For a J2ME Java Virtual Machine an appropriate DataSource is used, otherwise, the java.sql.Driver
mechanism is used. No network access is involved. Only one application can access a database
at a time. 
+  <a name="817267"> </a>In embedded mode, the application starts up an instance
of Derby within the current Java Virtual Machine and shuts down the instance before it completes.
No network access is involved. Only one application can access a database at a time. 
 </p>
 <p>In a server environment, the application demonstrates the use of the Derby network
client or the IBM DB2 JDBC Universal Driver by connecting to the Network Server and running
the demo. Note that the client drivers allow multiple instances of the application to run
at the same time.  However, the SQL operations performed by this demo will cause failures
when multiple simultaneous instances of the application are run. Use of a client driver to
connect to the Network Server in this application is intended only to demonstrate this type
of connection. The SimpleApp demo is not suited for simultaneous executions because it creates
and drops the table on which it operates.
 </p>

Modified: db/derby/code/branches/10.3/tools/release/build.xml
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.3/tools/release/build.xml?rev=596793&r1=596792&r2=596793&view=diff
==============================================================================
--- db/derby/code/branches/10.3/tools/release/build.xml (original)
+++ db/derby/code/branches/10.3/tools/release/build.xml Tue Nov 20 11:35:11 2007
@@ -167,6 +167,8 @@
                   fullpath="${derby.bin}/demo/templates/server.policy"/>
       <zipfileset dir="${basedir}/classes" includes="SimpleApp.class"
                   prefix="${derby.bin}/demo/programs/simple"/>
+      <zipfileset dir="${basedir}/classes" includes="SimpleMobileApp.class"
+                  prefix="${derby.bin}/demo/programs/simplemobile"/>            
       <zipfileset dir="${basedir}/classes" includes="SimpleNetwork*.class"
                   prefix="${derby.bin}/demo/programs/nserverdemo"/>
       <zipfileset dir="${basedir}/classes/nserverdemo" includes="*.class"
@@ -219,6 +221,8 @@
                   fullpath="${derby.bin}/demo/templates/server.policy"/>
       <tarfileset dir="${basedir}/classes" includes="SimpleApp.class"
                   prefix="${derby.bin}/demo/programs/simple"/>
+      <tarfileset dir="${basedir}/classes" includes="SimpleMobileApp.class"
+                  prefix="${derby.bin}/demo/programs/simplemobile"/>
       <tarfileset dir="${basedir}/classes" includes="SimpleNetwork*.class"
                   prefix="${derby.bin}/demo/programs/nserverdemo"/>
       <tarfileset dir="${basedir}/classes/nserverdemo" includes="*.class"



Mime
View raw message