Author: shawkins
Date: 2010-04-21 13:46:11 -0400 (Wed, 21 Apr 2010)
New Revision: 2069
Added:
trunk/adminshell/src/main/java/org/teiid/adminshell/SqlHelpCommand.java
trunk/adminshell/src/main/resources/org/teiid/adminshell/SqlHelpCommand.properties
trunk/build/kits/
trunk/build/kits/adminshell/
trunk/build/kits/jboss-container/
Removed:
trunk/build/kit-adminshell/
trunk/build/kit-jboss-container/
Modified:
trunk/adminshell/src/main/java/org/teiid/adminshell/GroovyAdminConsole.java
trunk/adminshell/src/main/java/org/teiid/adminshell/GroovySqlExtensions.java
trunk/adminshell/src/main/java/org/teiid/adminshell/Help.java
trunk/adminshell/src/main/resources/org/codehaus/groovy/tools/shell/commands.xml
trunk/build/assembly/adminshell/adminshell-dist.xml
trunk/build/assembly/jboss-container/dist.xml
trunk/build/kits/adminshell/adminconsole.bat
trunk/build/kits/adminshell/adminconsole.sh
trunk/build/kits/adminshell/adminshell.bat
trunk/build/kits/adminshell/adminshell.sh
trunk/build/pom.xml
Log:
TEIID-1052 fixing classpath of the adminshell and adding the sql help as a command.
Modified: trunk/adminshell/src/main/java/org/teiid/adminshell/GroovyAdminConsole.java
===================================================================
--- trunk/adminshell/src/main/java/org/teiid/adminshell/GroovyAdminConsole.java 2010-04-21
16:42:57 UTC (rev 2068)
+++ trunk/adminshell/src/main/java/org/teiid/adminshell/GroovyAdminConsole.java 2010-04-21
17:46:11 UTC (rev 2069)
@@ -36,9 +36,9 @@
public class GroovyAdminConsole {
- public static final String IMPORTS = "import static " +
AdminShell.class.getName() + ".*\n" + //$NON-NLS-1$ //$NON-NLS-2$
- "import static " + GroovySqlExtensions.class.getName() + ".*\n" +
//$NON-NLS-1$ //$NON-NLS-2$
- "import " + Admin.class.getPackage().getName() + ".*\n";
//$NON-NLS-1$ //$NON-NLS-2$
+ public static final String IMPORTS = "import static " +
AdminShell.class.getName() + ".*;\n" + //$NON-NLS-1$ //$NON-NLS-2$
+ "import static " + GroovySqlExtensions.class.getName() + ".*;\n" +
//$NON-NLS-1$ //$NON-NLS-2$
+ "import " + Admin.class.getPackage().getName() + ".*;\n";
//$NON-NLS-1$ //$NON-NLS-2$
public static void main(String[] args) throws Exception {
// allow the full stack traces to bubble up to the root logger
Modified: trunk/adminshell/src/main/java/org/teiid/adminshell/GroovySqlExtensions.java
===================================================================
---
trunk/adminshell/src/main/java/org/teiid/adminshell/GroovySqlExtensions.java 2010-04-21
16:42:57 UTC (rev 2068)
+++
trunk/adminshell/src/main/java/org/teiid/adminshell/GroovySqlExtensions.java 2010-04-21
17:46:11 UTC (rev 2069)
@@ -43,7 +43,7 @@
private static Help help = new Help(GroovySqlExtensions.class);
- @Help.Doc(text = "Get a Teiid connection - using connection.properties")
+ @Help.Doc(text = "Get a Teiid connection with a URL")
public static TeiidSql connect(
@Help.Doc(text = "url") String url) throws SQLException {
return connect(url, null, null);
@@ -76,8 +76,8 @@
AdminShell.p.getProperty("jdbc.user", "admin"),
AdminShell.p.getProperty("jdbc.password", "teiid"));
}
- @Help.Doc(text = "Alternate row to String method that pretty prints SQL/XML,"
+
- " \ne.g. sql.eachRow(\"select * from tables\", {row -> println
rowToString(row) })")
+ @Help.Doc(text = "Alternate row to String method that pretty prints SQL/XML",
+ moreText = "e.g. sql.eachRow(\"select * from tables\", {row ->
println rowToString(row) })")
public static String rowToString(ResultSet results) throws SQLException {
StringBuilder sb = new StringBuilder();
//alternative toString - see GroovyResultSetExtension
@@ -103,17 +103,19 @@
return sb.toString();
}
- @Help.Doc(text = "Pretty prints the ResultSetMetadata")
+ @Help.Doc(text = "Pretty prints the ResultSetMetadata",
+ moreText = {"e.g. sql.eachRow(\"select * from tables\", {rsmd ->
println resultSetMetaDataToString(rsmd)},",
+ " {row -> println rowToString(row) })"})
public static String resultSetMetaDataToString(ResultSetMetaData rsmd) throws
SQLException {
return ResultSetReader.resultSetMetaDataToString(rsmd, " ");
//$NON-NLS-1$
}
- @Help.Doc(text = "Show help for all Sql methods")
+ @Help.Doc(text = "Show help for all SQL Extension methods")
public static void sqlHelp() {
help.help();
}
- @Help.Doc(text = "Show help for the given Sql method")
+ @Help.Doc(text = "Show help for the given SQL Extension method")
public static void sqlHelp(
@Help.Doc(text = "method name") String method) {
help.help(method);
Modified: trunk/adminshell/src/main/java/org/teiid/adminshell/Help.java
===================================================================
--- trunk/adminshell/src/main/java/org/teiid/adminshell/Help.java 2010-04-21 16:42:57 UTC
(rev 2068)
+++ trunk/adminshell/src/main/java/org/teiid/adminshell/Help.java 2010-04-21 17:46:11 UTC
(rev 2069)
@@ -46,6 +46,7 @@
@Target({ElementType.METHOD, ElementType.PARAMETER})
public @interface Doc {
String text();
+ String[] moreText() default {};
}
private TreeMap<String, List<String>> help = new TreeMap<String,
List<String>>();
@@ -66,8 +67,12 @@
}
shortSb.append(")"); //$NON-NLS-1$
String shortHelpStr = String.format(" %-25s", shortSb.toString());
//$NON-NLS-1$
- if (doc != null && doc.text() != null) {
- sb.append("/*\n *").append(doc.text()).append("\n */\n");
//$NON-NLS-1$ //$NON-NLS-2$
+ if (doc != null) {
+ sb.append("/*\n *").append(doc.text()); //$NON-NLS-1$
+ for (String string : doc.moreText()) {
+ sb.append("\n *").append(string); //$NON-NLS-1$
+ }
+ sb.append("\n */\n"); //$NON-NLS-1$
shortHelpStr += " -- " + doc.text(); //$NON-NLS-1$
}
shortHelp.add(shortHelpStr);
@@ -108,7 +113,7 @@
}
public void help() {
- System.out.println("/* method(arg count) -- description */"); //$NON-NLS-1$
+ System.out.println("/* method(arg count) -- description */");
//$NON-NLS-1$
for (String helpString : shortHelp) {
System.out.println(helpString);
}
Added: trunk/adminshell/src/main/java/org/teiid/adminshell/SqlHelpCommand.java
===================================================================
--- trunk/adminshell/src/main/java/org/teiid/adminshell/SqlHelpCommand.java
(rev 0)
+++ trunk/adminshell/src/main/java/org/teiid/adminshell/SqlHelpCommand.java 2010-04-21
17:46:11 UTC (rev 2069)
@@ -0,0 +1,49 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General public static
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General public static License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General public static
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+
+package org.teiid.adminshell;
+
+import java.util.List;
+
+import org.codehaus.groovy.tools.shell.CommandSupport;
+import org.codehaus.groovy.tools.shell.Shell;
+
+public class SqlHelpCommand extends CommandSupport {
+
+ protected SqlHelpCommand(Shell shell) {
+ super(shell, "sqlhelp", "\\sh"); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
+ @Override
+ public Object execute(List args) {
+ if (args.size() > 1) {
+ fail(messages.format("error.unexpected_args", new Object[]
{args.toString()})); //$NON-NLS-1$
+ }
+ if (args.isEmpty()) {
+ GroovySqlExtensions.sqlHelp();
+ } else {
+ GroovySqlExtensions.sqlHelp(args.get(0).toString());
+ }
+ return null;
+ }
+
+}
Property changes on:
trunk/adminshell/src/main/java/org/teiid/adminshell/SqlHelpCommand.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified:
trunk/adminshell/src/main/resources/org/codehaus/groovy/tools/shell/commands.xml
===================================================================
---
trunk/adminshell/src/main/resources/org/codehaus/groovy/tools/shell/commands.xml 2010-04-21
16:42:57 UTC (rev 2068)
+++
trunk/adminshell/src/main/resources/org/codehaus/groovy/tools/shell/commands.xml 2010-04-21
17:46:11 UTC (rev 2069)
@@ -53,5 +53,7 @@
<command>org.codehaus.groovy.tools.shell.commands.RegisterCommand</command>
<command>org.teiid.adminshell.AdminHelpCommand</command>
+
+ <command>org.teiid.adminshell.SqlHelpCommand</command>
</commands>
Added: trunk/adminshell/src/main/resources/org/teiid/adminshell/SqlHelpCommand.properties
===================================================================
--- trunk/adminshell/src/main/resources/org/teiid/adminshell/SqlHelpCommand.properties
(rev 0)
+++
trunk/adminshell/src/main/resources/org/teiid/adminshell/SqlHelpCommand.properties 2010-04-21
17:46:11 UTC (rev 2069)
@@ -0,0 +1,3 @@
+command.description=Display Teiid SQL Extension Help
+command.usage=[<method>]
+command.help=Display the list of Teiid SQL Extension methods or the help text for @|BOLD
method|@. This reports the same information as the sqlHelp([method]) function.
\ No newline at end of file
Property changes on:
trunk/adminshell/src/main/resources/org/teiid/adminshell/SqlHelpCommand.properties
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: trunk/build/assembly/adminshell/adminshell-dist.xml
===================================================================
--- trunk/build/assembly/adminshell/adminshell-dist.xml 2010-04-21 16:42:57 UTC (rev
2068)
+++ trunk/build/assembly/adminshell/adminshell-dist.xml 2010-04-21 17:46:11 UTC (rev
2069)
@@ -39,7 +39,7 @@
<fileSets>
<fileSet>
- <directory>build/kit-adminshell</directory>
+ <directory>build/target/kits/adminshell</directory>
<outputDirectory>/</outputDirectory>
<includes>
<include>**/*.sh</include>
@@ -48,7 +48,7 @@
</fileSet>
<fileSet>
- <directory>build/kit-adminshell</directory>
+ <directory>build/target/kits/adminshell</directory>
<outputDirectory>/</outputDirectory>
<excludes>
<exclude>**/*.sh</exclude>
Modified: trunk/build/assembly/jboss-container/dist.xml
===================================================================
--- trunk/build/assembly/jboss-container/dist.xml 2010-04-21 16:42:57 UTC (rev 2068)
+++ trunk/build/assembly/jboss-container/dist.xml 2010-04-21 17:46:11 UTC (rev 2069)
@@ -13,7 +13,7 @@
<fileSets>
<fileSet>
- <directory>build/target/kit-jboss-container</directory>
+ <directory>build/target/kits/jboss-container</directory>
<outputDirectory>/</outputDirectory>
</fileSet>
Copied: trunk/build/kits/adminshell (from rev 2065, trunk/build/kit-adminshell)
Modified: trunk/build/kits/adminshell/adminconsole.bat
===================================================================
--- trunk/build/kit-adminshell/adminconsole.bat 2010-04-21 00:35:51 UTC (rev 2065)
+++ trunk/build/kits/adminshell/adminconsole.bat 2010-04-21 17:46:11 UTC (rev 2069)
@@ -53,7 +53,7 @@
)
)
-set TEIID_CLASSPATH=%TEIID_HOME%\lib\patches\*;%TEIID_HOME%\lib\*;
+set
TEIID_CLASSPATH=%TEIID_HOME%\lib\patches\*;%TEIID_HOME%\lib\teiid-adminshell-${pom.version}.jar;%TEIID_HOME%\lib\*;
rem JVM memory allocation pool parameters. Modify as appropriate.
set JAVA_OPTS=%JAVA_OPTS% -Xms128m -Xmx256m -XX:MaxPermSize=256m
Modified: trunk/build/kits/adminshell/adminconsole.sh
===================================================================
--- trunk/build/kit-adminshell/adminconsole.sh 2010-04-21 00:35:51 UTC (rev 2065)
+++ trunk/build/kits/adminshell/adminconsole.sh 2010-04-21 17:46:11 UTC (rev 2069)
@@ -63,7 +63,7 @@
# JPDA options. Uncomment and modify as appropriate to enable remote debugging.
# JAVA_OPTS="$JAVA_OPTS -Xdebug
-Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=n"
-TEIID_CLASSPATH="$TEIID_HOME/lib/patches/*:$TEIID_HOME/lib/*"
+TEIID_CLASSPATH="$TEIID_HOME/lib/patches/*:$TEIID_HOME/lib/teiid-adminshell-${pom.version}.jar:$TEIID_HOME/lib/*"
JAVA_OPTS="$JAVA_OPTS -Xms128m -Xmx256m -XX:MaxPermSize=256m"
JAVA_OPTS="$JAVA_OPTS -Djava.util.logging.config.file=log.properties"
Modified: trunk/build/kits/adminshell/adminshell.bat
===================================================================
--- trunk/build/kit-adminshell/adminshell.bat 2010-04-21 00:35:51 UTC (rev 2065)
+++ trunk/build/kits/adminshell/adminshell.bat 2010-04-21 17:46:11 UTC (rev 2069)
@@ -53,7 +53,7 @@
)
)
-set TEIID_CLASSPATH=%TEIID_HOME%\lib\patches\*;%TEIID_HOME%\lib\*;
+set
TEIID_CLASSPATH=%TEIID_HOME%\lib\patches\*;%TEIID_HOME%\lib\teiid-adminshell-${pom.version}.jar;%TEIID_HOME%\lib\*;
rem JVM memory allocation pool parameters. Modify as appropriate.
set JAVA_OPTS=%JAVA_OPTS% -Xms128m -Xmx256m -XX:MaxPermSize=256m
Modified: trunk/build/kits/adminshell/adminshell.sh
===================================================================
--- trunk/build/kit-adminshell/adminshell.sh 2010-04-21 00:35:51 UTC (rev 2065)
+++ trunk/build/kits/adminshell/adminshell.sh 2010-04-21 17:46:11 UTC (rev 2069)
@@ -63,7 +63,7 @@
# JPDA options. Uncomment and modify as appropriate to enable remote debugging.
# JAVA_OPTS="$JAVA_OPTS -Xdebug
-Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=n"
-TEIID_CLASSPATH="$TEIID_HOME/lib/patches/*:$TEIID_HOME/lib/*"
+TEIID_CLASSPATH="$TEIID_HOME/lib/patches/*:$TEIID_HOME/lib/teiid-adminshell-${pom.version}.jar:$TEIID_HOME/lib/*"
JAVA_OPTS="$JAVA_OPTS -Xms128m -Xmx256m -XX:MaxPermSize=256m"
JAVA_OPTS="$JAVA_OPTS -Djava.util.logging.config.file=log.properties"
Copied: trunk/build/kits/jboss-container (from rev 2065, trunk/build/kit-jboss-container)
Modified: trunk/build/pom.xml
===================================================================
--- trunk/build/pom.xml 2010-04-21 16:42:57 UTC (rev 2068)
+++ trunk/build/pom.xml 2010-04-21 17:46:11 UTC (rev 2069)
@@ -10,20 +10,26 @@
<name>Build</name>
<description>Teiid Build</description>
<build>
- <outputDirectory>target/kit-jboss-container</outputDirectory>
+ <outputDirectory>target/kits</outputDirectory>
<resources>
<resource>
- <directory>kit-jboss-container</directory>
+ <directory>kits</directory>
<filtering>true</filtering>
<includes>
<include>**/*.xml</include>
+ <include>**/*.properties</include>
+ <include>**/*.sh</include>
+ <include>**/*.bat</include>
</includes>
</resource>
<resource>
- <directory>kit-jboss-container</directory>
+ <directory>kits</directory>
<filtering>false</filtering>
<excludes>
<exclude>**/*.xml</exclude>
+ <exclude>**/*.properties</exclude>
+ <exclude>**/*.sh</exclude>
+ <exclude>**/*.bat</exclude>
</excludes>
</resource>
</resources>