You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-commits@db.apache.org by fu...@apache.org on 2006/02/22 23:04:22 UTC
svn commit: r379939 - in /db/derby/code/trunk: build.xml
java/tools/org/apache/derby/iapi/tools/run.java
java/tools/org/apache/derby/loc/toolsmessages.properties
tools/jar/tools.properties
Author: fuzzylogic
Date: Wed Feb 22 14:04:14 2006
New Revision: 379939
URL: http://svn.apache.org/viewcvs?rev=379939&view=rev
Log:
DERBY-1019: Add Main-Class to derbytools.jar to allow running the tools with
java -jar.
Added:
db/derby/code/trunk/java/tools/org/apache/derby/iapi/tools/run.java (with props)
Modified:
db/derby/code/trunk/build.xml
db/derby/code/trunk/java/tools/org/apache/derby/loc/toolsmessages.properties
db/derby/code/trunk/tools/jar/tools.properties
Modified: db/derby/code/trunk/build.xml
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/build.xml?rev=379939&r1=379938&r2=379939&view=diff
==============================================================================
--- db/derby/code/trunk/build.xml (original)
+++ db/derby/code/trunk/build.xml Wed Feb 22 14:04:14 2006
@@ -951,11 +951,17 @@
<fileset dir="${basedir}" includes="LICENSE*,NOTICE*,COPYRIGHT*"/>
</copy>
+ <manifest file="${derby.jar.dir}/lists/smftools.mf">
+ <attribute name="Main-Class" value="org.apache.derby.tools.iapi.run"/>
+ <attribute name="Class-Path" value="derby.jar derbyclient.jar"/>
+ </manifest>
+
<delete file="${derby.jar.dir}/derbytools.jar"/>
<jar destfile="${derby.jar.dir}/derbytools.jar"
basedir="${out.dir}"
includesfile="${derby.jar.dir}/lists/derbytools.list"
compress="true"
+ manifest="${derby.jar.dir}/lists/smftools.mf"
filesonly="true"/>
<jar destfile="${derby.jar.dir}/derbytools.jar"
compress="true"
Added: db/derby/code/trunk/java/tools/org/apache/derby/iapi/tools/run.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/tools/org/apache/derby/iapi/tools/run.java?rev=379939&view=auto
==============================================================================
--- db/derby/code/trunk/java/tools/org/apache/derby/iapi/tools/run.java (added)
+++ db/derby/code/trunk/java/tools/org/apache/derby/iapi/tools/run.java Wed Feb 22 14:04:14 2006
@@ -0,0 +1,82 @@
+/*
+
+ Derby - Class org.apache.derby.tools.iapi.run
+
+ Copyright 2006 The Apache Software Foundation or its licensors, as applicable.
+
+ 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.derby.tools.iapi;
+
+import java.io.IOException;
+import org.apache.derby.tools.dblook;
+import org.apache.derby.tools.ij;
+import org.apache.derby.tools.sysinfo;
+import org.apache.derby.iapi.tools.i18n.LocalizedResource;
+
+/**
+ The run class facilitates running the various Derby utilities with the
+ java -jar command. For example:
+
+ java -jar derbytools.jar ij
+ java -jar derbytools.jar sysinfo
+ java -jar derbytools.jar dblook
+*/
+public class run {
+
+ /**
+ Switch on the first argument to choose the tool, pass the remaining
+ arguments to the tool.
+ */
+ static public void main(String[] args) throws IOException {
+ if (args.length < 1) {
+ printUsage();
+ } else if (args[0].equals("ij")) {
+ ij.main(trimArgs(args));
+ } else if (args[0].equals("sysinfo")) {
+ sysinfo.main(trimArgs(args));
+ } else if (args[0].equals("dblook")) {
+ dblook.main(trimArgs(args));
+ } else printUsage();
+ }
+
+ /*
+ Private constructor. No instances allowed.
+ */
+ private run() {
+ }
+
+ /*
+ Utility method to trim one element off of the argument array.
+ @param args the arguments array
+ @return trimmed the trimmed array
+ */
+ private static String[] trimArgs(String[] args)
+ {
+ String [] trimmed = new String[args.length - 1];
+ System.arraycopy(args, 1, trimmed, 0, args.length - 1);
+ return trimmed;
+ }
+
+ /*
+ Print the usage statement if the user didn't enter a valid choice
+ of tool.
+ */
+ public static void printUsage()
+ {
+ LocalizedResource locRes = LocalizedResource.getInstance();
+ System.err.println(locRes.getTextMessage("RUN_Usage"));
+ }
+}
Propchange: db/derby/code/trunk/java/tools/org/apache/derby/iapi/tools/run.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: db/derby/code/trunk/java/tools/org/apache/derby/loc/toolsmessages.properties
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/tools/org/apache/derby/loc/toolsmessages.properties?rev=379939&r1=379938&r2=379939&view=diff
==============================================================================
--- db/derby/code/trunk/java/tools/org/apache/derby/loc/toolsmessages.properties (original)
+++ db/derby/code/trunk/java/tools/org/apache/derby/loc/toolsmessages.properties Wed Feb 22 14:04:14 2006
@@ -232,3 +232,5 @@
-- encountered during DDL generation. See dblook.log\n\
-- to review the message(s).\n\
\n
+# Directory org/apache/derby/tools/iapi
+RUN_Usage=Usage: java -jar derbytools.jar ij | sysinfo | dblook [args]
Modified: db/derby/code/trunk/tools/jar/tools.properties
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/tools/jar/tools.properties?rev=379939&r1=379938&r2=379939&view=diff
==============================================================================
--- db/derby/code/trunk/tools/jar/tools.properties (original)
+++ db/derby/code/trunk/tools/jar/tools.properties Wed Feb 22 14:04:14 2006
@@ -12,3 +12,4 @@
derby.module.Attribute=org.apache.derby.iapi.reference.Attribute
derby.module.cslook=org.apache.derby.tools.dblook
derby.module.sysinfo=org.apache.derby.tools.sysinfo
+derby.module.run=org.apache.derby.tools.iapi.run