5
0
mirror of https://github.com/apache/sqoop.git synced 2025-05-10 05:09:41 +08:00

SQOOP-921. Sqoop2: Create standalone shell package

(Mengwei Ding via Hari Shreedharan)
This commit is contained in:
Hari Shreedharan 2013-08-06 16:18:58 -07:00
parent ff8e0500ad
commit 21c1207b79
59 changed files with 431 additions and 280 deletions

View File

@ -32,7 +32,12 @@ limitations under the License.
<name>Sqoop Client</name> <name>Sqoop Client</name>
<dependencies> <dependencies>
<dependency> <dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId> <groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId> <artifactId>mockito-all</artifactId>
<scope>test</scope> <scope>test</scope>
@ -41,64 +46,11 @@ limitations under the License.
<groupId>org.apache.sqoop</groupId> <groupId>org.apache.sqoop</groupId>
<artifactId>sqoop-common</artifactId> <artifactId>sqoop-common</artifactId>
</dependency> </dependency>
<dependency>
<groupId>commons-cli</groupId>
<artifactId>commons-cli</artifactId>
<version>1.2</version>
</dependency>
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
<version>2.6</version>
</dependency>
<dependency> <dependency>
<groupId>com.sun.jersey</groupId> <groupId>com.sun.jersey</groupId>
<artifactId>jersey-client</artifactId> <artifactId>jersey-client</artifactId>
<version>1.11</version> <version>1.11</version>
</dependency> </dependency>
<dependency>
<groupId>jline</groupId>
<artifactId>jline</artifactId>
<version>0.9.94</version>
</dependency>
<dependency>
<groupId>org.fusesource.jansi</groupId>
<artifactId>jansi</artifactId>
<version>1.7</version>
</dependency>
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-all</artifactId>
<version>1.8.5</version>
</dependency>
</dependencies> </dependencies>
<profiles>
<profile>
<id>dist</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}/lib</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project> </project>

View File

@ -0,0 +1,48 @@
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you 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.sqoop.client;
import org.apache.sqoop.common.ErrorCode;
public enum ClientError implements ErrorCode {
/** An unknown error has occurred. */
CLIENT_0000("An unknown error has occurred"),
/** There occurred exception on server side **/
CLIENT_0001("Server has returned exception"),
/** Polling time of submission status cannot be negative */
CLIENT_0002("Polling time of submission status cannot be negative"),
;
private final String message;
private ClientError(String message) {
this.message = message;
}
public String getCode() {
return name();
}
public String getMessage() {
return message;
}
}

View File

@ -17,7 +17,6 @@
*/ */
package org.apache.sqoop.client; package org.apache.sqoop.client;
import org.apache.sqoop.client.core.ClientError;
import org.apache.sqoop.client.request.SqoopRequests; import org.apache.sqoop.client.request.SqoopRequests;
import org.apache.sqoop.common.SqoopException; import org.apache.sqoop.common.SqoopException;
import org.apache.sqoop.json.ConnectorBean; import org.apache.sqoop.json.ConnectorBean;
@ -396,7 +395,7 @@ public MSubmission startSubmission(long jid) {
*/ */
public MSubmission startSubmission(long jid, SubmissionCallback callback, long pollTime) throws InterruptedException { public MSubmission startSubmission(long jid, SubmissionCallback callback, long pollTime) throws InterruptedException {
if(pollTime <= 0) { if(pollTime <= 0) {
throw new SqoopException(ClientError.CLIENT_0008); throw new SqoopException(ClientError.CLIENT_0002);
} }
boolean first = true; boolean first = true;
MSubmission submission = requests.createSubmission(jid).getSubmissions().get(0); MSubmission submission = requests.createSubmission(jid).getSubmissions().get(0);

View File

@ -25,7 +25,8 @@
import com.sun.jersey.api.client.WebResource; import com.sun.jersey.api.client.WebResource;
import com.sun.jersey.api.client.WebResource.Builder; import com.sun.jersey.api.client.WebResource.Builder;
import com.sun.jersey.api.client.filter.ClientFilter; import com.sun.jersey.api.client.filter.ClientFilter;
import org.apache.sqoop.client.core.ClientError;
import org.apache.sqoop.client.ClientError;
import org.apache.sqoop.common.SqoopException; import org.apache.sqoop.common.SqoopException;
import org.apache.sqoop.common.SqoopProtocolConstants; import org.apache.sqoop.common.SqoopProtocolConstants;
import org.apache.sqoop.json.ThrowableBean; import org.apache.sqoop.json.ThrowableBean;
@ -99,7 +100,7 @@ public ClientResponse handle(ClientRequest cr) {
JSONObject json = (JSONObject) JSONValue.parse(responseText); JSONObject json = (JSONObject) JSONValue.parse(responseText);
ex.restore(json); ex.restore(json);
throw new SqoopException(ClientError.CLIENT_0006, ex.getThrowable()); throw new SqoopException(ClientError.CLIENT_0001, ex.getThrowable());
} }
} }

12
dist/pom.xml vendored
View File

@ -40,7 +40,7 @@ limitations under the License.
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.apache.sqoop</groupId> <groupId>org.apache.sqoop</groupId>
<artifactId>sqoop-client</artifactId> <artifactId>sqoop-shell</artifactId>
</dependency> </dependency>
</dependencies> </dependencies>
@ -167,16 +167,16 @@ limitations under the License.
<copy file="../server/target/sqoop.war" <copy file="../server/target/sqoop.war"
toDir="target/sqoop-${project.version}-bin-hadoop${hadoop.profile}/server/webapps"/> toDir="target/sqoop-${project.version}-bin-hadoop${hadoop.profile}/server/webapps"/>
<!-- Build client directory --> <!-- Build shell client directory -->
<copy todir="target/sqoop-${project.version}-bin-hadoop${hadoop.profile}/client/lib"> <copy todir="target/sqoop-${project.version}-bin-hadoop${hadoop.profile}/shell/lib">
<fileset dir="../client/target/lib"> <fileset dir="../shell/target/lib">
<include name="*.jar" /> <include name="*.jar" />
<exclude name="junit-*.jar" /> <exclude name="junit-*.jar" />
<exclude name="mockito-*.jar" /> <exclude name="mockito-*.jar" />
</fileset> </fileset>
</copy> </copy>
<copy file="../client/target/sqoop-client-${project.version}.jar" <copy file="../shell/target/sqoop-shell-${project.version}.jar"
toDir="target/sqoop-${project.version}-bin-hadoop${hadoop.profile}/client/lib"/> toDir="target/sqoop-${project.version}-bin-hadoop${hadoop.profile}/shell/lib"/>
<!-- Build "bin" directory --> <!-- Build "bin" directory -->
<copy todir="target/sqoop-${project.version}-bin-hadoop${hadoop.profile}/bin"> <copy todir="target/sqoop-${project.version}-bin-hadoop${hadoop.profile}/bin">

View File

@ -51,7 +51,7 @@ cd ${BASEDIR}
echo "Sqoop home directory: ${BASEDIR}" echo "Sqoop home directory: ${BASEDIR}"
CATALINA_BIN=${CATALINA_BIN:-server/bin} CATALINA_BIN=${CATALINA_BIN:-server/bin}
CLIENT_LIB=${CLIENT_LIB:-client/lib} CLIENT_LIB=${CLIENT_LIB:-shell/lib}
setup_catalina_opts() { setup_catalina_opts() {
# The Java System properties 'sqoop.http.port' and 'sqoop.admin.port' are # The Java System properties 'sqoop.http.port' and 'sqoop.admin.port' are
@ -107,7 +107,7 @@ case $COMMAND in
if [ -n "${JAVA_HOME}" ] ; then if [ -n "${JAVA_HOME}" ] ; then
EXEC_JAVA="${JAVA_HOME}/bin/java" EXEC_JAVA="${JAVA_HOME}/bin/java"
fi fi
${EXEC_JAVA} -classpath ${CLASSPATH} org.apache.sqoop.client.shell.SqoopShell $2 ${EXEC_JAVA} -classpath ${CLASSPATH} org.apache.sqoop.shell.SqoopShell $2
;; ;;
*) *)

View File

@ -246,6 +246,11 @@ limitations under the License.
<groupId>org.apache.sqoop</groupId> <groupId>org.apache.sqoop</groupId>
<artifactId>sqoop-client</artifactId> <artifactId>sqoop-client</artifactId>
<version>${project.version}</version> <version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.apache.sqoop</groupId>
<artifactId>sqoop-shell</artifactId>
<version>${project.version}</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.apache.sqoop</groupId> <groupId>org.apache.sqoop</groupId>
@ -413,6 +418,7 @@ limitations under the License.
<module>repository</module> <module>repository</module>
<module>server</module> <module>server</module>
<module>client</module> <module>client</module>
<module>shell</module>
<module>docs</module> <module>docs</module>
<module>connector</module> <module>connector</module>
<module>execution</module> <module>execution</module>

108
shell/pom.xml Normal file
View File

@ -0,0 +1,108 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You 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.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.apache</groupId>
<artifactId>sqoop</artifactId>
<version>2.0.0-SNAPSHOT</version>
</parent>
<groupId>org.apache.sqoop</groupId>
<artifactId>sqoop-shell</artifactId>
<name>Sqoop Shell</name>
<dependencies>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.sqoop</groupId>
<artifactId>sqoop-common</artifactId>
</dependency>
<dependency>
<groupId>org.apache.sqoop</groupId>
<artifactId>sqoop-client</artifactId>
</dependency>
<dependency>
<groupId>commons-cli</groupId>
<artifactId>commons-cli</artifactId>
<version>1.2</version>
</dependency>
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
<version>2.6</version>
</dependency>
<dependency>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-client</artifactId>
<version>1.11</version>
</dependency>
<dependency>
<groupId>jline</groupId>
<artifactId>jline</artifactId>
<version>0.9.94</version>
</dependency>
<dependency>
<groupId>org.fusesource.jansi</groupId>
<artifactId>jansi</artifactId>
<version>1.7</version>
</dependency>
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-all</artifactId>
<version>1.8.5</version>
</dependency>
</dependencies>
<profiles>
<profile>
<id>dist</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}/lib</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>

View File

@ -15,16 +15,16 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.apache.sqoop.client.shell; package org.apache.sqoop.shell;
import org.apache.sqoop.client.core.ClientError;
import org.apache.sqoop.client.core.Constants;
import org.apache.sqoop.common.SqoopException; import org.apache.sqoop.common.SqoopException;
import org.apache.sqoop.shell.core.ShellError;
import org.apache.sqoop.shell.core.Constants;
import org.codehaus.groovy.tools.shell.Shell; import org.codehaus.groovy.tools.shell.Shell;
import java.util.List; import java.util.List;
import static org.apache.sqoop.client.shell.ShellEnvironment.*; import static org.apache.sqoop.shell.ShellEnvironment.*;
/** /**
* Client side cloning of connection and job objects. * Client side cloning of connection and job objects.
@ -42,7 +42,7 @@ public CloneCommand(Shell shell) {
public Object executeCommand(List args) { public Object executeCommand(List args) {
if(!isInteractive()) { if(!isInteractive()) {
throw new SqoopException(ClientError.CLIENT_0007, "clone"); throw new SqoopException(ShellError.SHELL_0007, "clone");
} }
if (args.size() == 0) { if (args.size() == 0) {

View File

@ -15,23 +15,23 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.apache.sqoop.client.shell; package org.apache.sqoop.shell;
import jline.ConsoleReader; import jline.ConsoleReader;
import org.apache.commons.cli.CommandLine; import org.apache.commons.cli.CommandLine;
import org.apache.commons.cli.OptionBuilder; import org.apache.commons.cli.OptionBuilder;
import org.apache.sqoop.client.core.ClientError;
import org.apache.sqoop.client.core.Constants;
import org.apache.sqoop.common.SqoopException; import org.apache.sqoop.common.SqoopException;
import org.apache.sqoop.model.MConnection; import org.apache.sqoop.model.MConnection;
import org.apache.sqoop.model.MPersistableEntity; import org.apache.sqoop.model.MPersistableEntity;
import org.apache.sqoop.shell.core.ShellError;
import org.apache.sqoop.shell.core.Constants;
import org.apache.sqoop.validation.Status; import org.apache.sqoop.validation.Status;
import java.io.IOException; import java.io.IOException;
import java.util.ResourceBundle; import java.util.ResourceBundle;
import static org.apache.sqoop.client.shell.ShellEnvironment.*; import static org.apache.sqoop.shell.ShellEnvironment.*;
import static org.apache.sqoop.client.utils.FormFiller.*; import static org.apache.sqoop.shell.utils.FormFiller.*;
/** /**
* *
@ -56,7 +56,7 @@ public Object executeFunction(CommandLine line) {
try { try {
cloneConnection(getLong(line, Constants.OPT_XID)); cloneConnection(getLong(line, Constants.OPT_XID));
} catch (IOException ex) { } catch (IOException ex) {
throw new SqoopException(ClientError.CLIENT_0005, ex); throw new SqoopException(ShellError.SHELL_0005, ex);
} }
return null; return null;

View File

@ -15,23 +15,23 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.apache.sqoop.client.shell; package org.apache.sqoop.shell;
import jline.ConsoleReader; import jline.ConsoleReader;
import org.apache.commons.cli.CommandLine; import org.apache.commons.cli.CommandLine;
import org.apache.commons.cli.OptionBuilder; import org.apache.commons.cli.OptionBuilder;
import org.apache.sqoop.client.core.ClientError;
import org.apache.sqoop.client.core.Constants;
import org.apache.sqoop.common.SqoopException; import org.apache.sqoop.common.SqoopException;
import org.apache.sqoop.model.MJob; import org.apache.sqoop.model.MJob;
import org.apache.sqoop.model.MPersistableEntity; import org.apache.sqoop.model.MPersistableEntity;
import org.apache.sqoop.shell.core.ShellError;
import org.apache.sqoop.shell.core.Constants;
import org.apache.sqoop.validation.Status; import org.apache.sqoop.validation.Status;
import java.io.IOException; import java.io.IOException;
import java.util.ResourceBundle; import java.util.ResourceBundle;
import static org.apache.sqoop.client.shell.ShellEnvironment.*; import static org.apache.sqoop.shell.ShellEnvironment.*;
import static org.apache.sqoop.client.utils.FormFiller.*; import static org.apache.sqoop.shell.utils.FormFiller.*;
/** /**
* *
@ -55,7 +55,7 @@ public Object executeFunction(CommandLine line) {
try { try {
cloneJob(getLong(line, Constants.OPT_JID)); cloneJob(getLong(line, Constants.OPT_JID));
} catch (IOException ex) { } catch (IOException ex) {
throw new SqoopException(ClientError.CLIENT_0005, ex); throw new SqoopException(ShellError.SHELL_0005, ex);
} }
return null; return null;

View File

@ -15,16 +15,16 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.apache.sqoop.client.shell; package org.apache.sqoop.shell;
import org.apache.sqoop.client.core.ClientError;
import org.apache.sqoop.client.core.Constants;
import org.apache.sqoop.common.SqoopException; import org.apache.sqoop.common.SqoopException;
import org.apache.sqoop.shell.core.ShellError;
import org.apache.sqoop.shell.core.Constants;
import org.codehaus.groovy.tools.shell.Shell; import org.codehaus.groovy.tools.shell.Shell;
import java.util.List; import java.util.List;
import static org.apache.sqoop.client.shell.ShellEnvironment.*; import static org.apache.sqoop.shell.ShellEnvironment.*;
/** /**
* *
@ -42,7 +42,7 @@ public CreateCommand(Shell shell) {
public Object executeCommand(List args) { public Object executeCommand(List args) {
if(!isInteractive()) { if(!isInteractive()) {
throw new SqoopException(ClientError.CLIENT_0007, "create"); throw new SqoopException(ShellError.SHELL_0007, "create");
} }
if (args.size() == 0) { if (args.size() == 0) {

View File

@ -15,23 +15,23 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.apache.sqoop.client.shell; package org.apache.sqoop.shell;
import jline.ConsoleReader; import jline.ConsoleReader;
import org.apache.commons.cli.CommandLine; import org.apache.commons.cli.CommandLine;
import org.apache.commons.cli.OptionBuilder; import org.apache.commons.cli.OptionBuilder;
import org.apache.sqoop.client.core.ClientError;
import org.apache.sqoop.client.core.Constants;
import org.apache.sqoop.client.utils.FormDisplayer;
import org.apache.sqoop.common.SqoopException; import org.apache.sqoop.common.SqoopException;
import org.apache.sqoop.model.MConnection; import org.apache.sqoop.model.MConnection;
import org.apache.sqoop.shell.core.ShellError;
import org.apache.sqoop.shell.core.Constants;
import org.apache.sqoop.shell.utils.FormDisplayer;
import org.apache.sqoop.validation.Status; import org.apache.sqoop.validation.Status;
import java.io.IOException; import java.io.IOException;
import java.util.ResourceBundle; import java.util.ResourceBundle;
import static org.apache.sqoop.client.shell.ShellEnvironment.*; import static org.apache.sqoop.shell.ShellEnvironment.*;
import static org.apache.sqoop.client.utils.FormFiller.*; import static org.apache.sqoop.shell.utils.FormFiller.*;
/** /**
* *
@ -55,7 +55,7 @@ public Object executeFunction(CommandLine line) {
try { try {
createConnection(getLong(line, Constants.OPT_CID)); createConnection(getLong(line, Constants.OPT_CID));
} catch (IOException ex) { } catch (IOException ex) {
throw new SqoopException(ClientError.CLIENT_0005, ex); throw new SqoopException(ShellError.SHELL_0005, ex);
} }
return null; return null;

View File

@ -15,23 +15,23 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.apache.sqoop.client.shell; package org.apache.sqoop.shell;
import jline.ConsoleReader; import jline.ConsoleReader;
import org.apache.commons.cli.CommandLine; import org.apache.commons.cli.CommandLine;
import org.apache.commons.cli.OptionBuilder; import org.apache.commons.cli.OptionBuilder;
import org.apache.sqoop.client.core.ClientError;
import org.apache.sqoop.client.core.Constants;
import org.apache.sqoop.client.utils.FormDisplayer;
import org.apache.sqoop.common.SqoopException; import org.apache.sqoop.common.SqoopException;
import org.apache.sqoop.model.MJob; import org.apache.sqoop.model.MJob;
import org.apache.sqoop.shell.core.ShellError;
import org.apache.sqoop.shell.core.Constants;
import org.apache.sqoop.shell.utils.FormDisplayer;
import org.apache.sqoop.validation.Status; import org.apache.sqoop.validation.Status;
import java.io.IOException; import java.io.IOException;
import java.util.ResourceBundle; import java.util.ResourceBundle;
import static org.apache.sqoop.client.shell.ShellEnvironment.*; import static org.apache.sqoop.shell.ShellEnvironment.*;
import static org.apache.sqoop.client.utils.FormFiller.*; import static org.apache.sqoop.shell.utils.FormFiller.*;
/** /**
* Handles creation of new job objects. * Handles creation of new job objects.
@ -67,7 +67,7 @@ public Object executeFunction(CommandLine line) {
createJob(getLong(line, Constants.OPT_XID), createJob(getLong(line, Constants.OPT_XID),
line.getOptionValue(Constants.OPT_TYPE)); line.getOptionValue(Constants.OPT_TYPE));
} catch (IOException ex) { } catch (IOException ex) {
throw new SqoopException(ClientError.CLIENT_0005, ex); throw new SqoopException(ShellError.SHELL_0005, ex);
} }
return null; return null;

View File

@ -15,13 +15,13 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.apache.sqoop.client.shell; package org.apache.sqoop.shell;
import org.apache.sqoop.client.core.Constants; import org.apache.sqoop.shell.core.Constants;
import org.codehaus.groovy.tools.shell.Shell; import org.codehaus.groovy.tools.shell.Shell;
import java.util.List; import java.util.List;
import static org.apache.sqoop.client.shell.ShellEnvironment.*; import static org.apache.sqoop.shell.ShellEnvironment.*;
/** /**
* *

View File

@ -15,13 +15,13 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.apache.sqoop.client.shell; package org.apache.sqoop.shell;
import org.apache.commons.cli.CommandLine; import org.apache.commons.cli.CommandLine;
import org.apache.commons.cli.OptionBuilder; import org.apache.commons.cli.OptionBuilder;
import org.apache.sqoop.client.core.Constants; import org.apache.sqoop.shell.core.Constants;
import static org.apache.sqoop.client.shell.ShellEnvironment.*; import static org.apache.sqoop.shell.ShellEnvironment.*;
/** /**
* *

View File

@ -15,14 +15,14 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.apache.sqoop.client.shell; package org.apache.sqoop.shell;
import org.apache.commons.cli.CommandLine; import org.apache.commons.cli.CommandLine;
import org.apache.commons.cli.OptionBuilder; import org.apache.commons.cli.OptionBuilder;
import org.apache.sqoop.client.core.Constants;
import org.apache.sqoop.client.request.JobRequest; import org.apache.sqoop.client.request.JobRequest;
import org.apache.sqoop.shell.core.Constants;
import static org.apache.sqoop.client.shell.ShellEnvironment.*; import static org.apache.sqoop.shell.ShellEnvironment.*;
/** /**
* Handles deletion of a job object. * Handles deletion of a job object.

View File

@ -15,13 +15,13 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.apache.sqoop.client.shell; package org.apache.sqoop.shell;
import org.apache.sqoop.client.core.Constants; import org.apache.sqoop.shell.core.Constants;
import org.codehaus.groovy.tools.shell.Shell; import org.codehaus.groovy.tools.shell.Shell;
import java.util.List; import java.util.List;
import static org.apache.sqoop.client.shell.ShellEnvironment.*; import static org.apache.sqoop.shell.ShellEnvironment.*;
/** /**
* *

View File

@ -15,15 +15,13 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.apache.sqoop.client.shell; package org.apache.sqoop.shell;
import org.apache.commons.cli.CommandLine; import org.apache.commons.cli.CommandLine;
import org.apache.commons.cli.OptionBuilder; import org.apache.commons.cli.OptionBuilder;
import org.apache.sqoop.client.core.Constants; import org.apache.sqoop.shell.core.Constants;
import org.apache.sqoop.model.MConnection;
import org.apache.sqoop.validation.Status;
import static org.apache.sqoop.client.shell.ShellEnvironment.*; import static org.apache.sqoop.shell.ShellEnvironment.*;
/** /**
* Handles enabling of a connection object * Handles enabling of a connection object

View File

@ -15,16 +15,14 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.apache.sqoop.client.shell; package org.apache.sqoop.shell;
import org.apache.commons.cli.CommandLine; import org.apache.commons.cli.CommandLine;
import org.apache.commons.cli.OptionBuilder; import org.apache.commons.cli.OptionBuilder;
import org.apache.sqoop.client.core.Constants;
import org.apache.sqoop.client.request.JobRequest; import org.apache.sqoop.client.request.JobRequest;
import org.apache.sqoop.model.MJob; import org.apache.sqoop.shell.core.Constants;
import org.apache.sqoop.validation.Status;
import static org.apache.sqoop.client.shell.ShellEnvironment.*; import static org.apache.sqoop.shell.ShellEnvironment.*;
/** /**
* Handles disabling of a job object. * Handles disabling of a job object.

View File

@ -15,13 +15,13 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.apache.sqoop.client.shell; package org.apache.sqoop.shell;
import org.apache.sqoop.client.core.Constants; import org.apache.sqoop.shell.core.Constants;
import org.codehaus.groovy.tools.shell.Shell; import org.codehaus.groovy.tools.shell.Shell;
import java.util.List; import java.util.List;
import static org.apache.sqoop.client.shell.ShellEnvironment.*; import static org.apache.sqoop.shell.ShellEnvironment.*;
/** /**
* *

View File

@ -15,15 +15,13 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.apache.sqoop.client.shell; package org.apache.sqoop.shell;
import org.apache.commons.cli.CommandLine; import org.apache.commons.cli.CommandLine;
import org.apache.commons.cli.OptionBuilder; import org.apache.commons.cli.OptionBuilder;
import org.apache.sqoop.client.core.Constants; import org.apache.sqoop.shell.core.Constants;
import org.apache.sqoop.model.MConnection;
import org.apache.sqoop.validation.Status;
import static org.apache.sqoop.client.shell.ShellEnvironment.*; import static org.apache.sqoop.shell.ShellEnvironment.*;
/** /**
* Handles enabling of a connection object * Handles enabling of a connection object

View File

@ -15,16 +15,14 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.apache.sqoop.client.shell; package org.apache.sqoop.shell;
import org.apache.commons.cli.CommandLine; import org.apache.commons.cli.CommandLine;
import org.apache.commons.cli.OptionBuilder; import org.apache.commons.cli.OptionBuilder;
import org.apache.sqoop.client.core.Constants;
import org.apache.sqoop.client.request.JobRequest; import org.apache.sqoop.client.request.JobRequest;
import org.apache.sqoop.model.MJob; import org.apache.sqoop.shell.core.Constants;
import org.apache.sqoop.validation.Status;
import static org.apache.sqoop.client.shell.ShellEnvironment.*; import static org.apache.sqoop.shell.ShellEnvironment.*;
/** /**
* Handles disabling of a job object. * Handles disabling of a job object.

View File

@ -15,7 +15,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.apache.sqoop.client.shell; package org.apache.sqoop.shell;
import java.text.MessageFormat; import java.text.MessageFormat;
import java.util.Iterator; import java.util.Iterator;
@ -23,15 +23,15 @@
import java.util.List; import java.util.List;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
import org.apache.sqoop.client.core.ClientError;
import org.apache.sqoop.client.core.Constants;
import org.apache.sqoop.common.SqoopException; import org.apache.sqoop.common.SqoopException;
import org.apache.sqoop.shell.core.ShellError;
import org.apache.sqoop.shell.core.Constants;
import org.codehaus.groovy.tools.shell.Command; import org.codehaus.groovy.tools.shell.Command;
import org.codehaus.groovy.tools.shell.CommandSupport; import org.codehaus.groovy.tools.shell.CommandSupport;
import org.codehaus.groovy.tools.shell.Shell; import org.codehaus.groovy.tools.shell.Shell;
import org.codehaus.groovy.tools.shell.util.SimpleCompletor; import org.codehaus.groovy.tools.shell.util.SimpleCompletor;
import static org.apache.sqoop.client.shell.ShellEnvironment.*; import static org.apache.sqoop.shell.ShellEnvironment.*;
public class HelpCommand extends CommandSupport { public class HelpCommand extends CommandSupport {
@ -125,7 +125,7 @@ private void help(String name) {
if (command == null) { if (command == null) {
String msg = MessageFormat.format(resource.getString(Constants String msg = MessageFormat.format(resource.getString(Constants
.RES_UNRECOGNIZED_CMD), name); .RES_UNRECOGNIZED_CMD), name);
throw new SqoopException(ClientError.CLIENT_0001, msg); throw new SqoopException(ShellError.SHELL_0001, msg);
} }
printlnResource(Constants.RES_HELP_CMD_USAGE, command.getName(), command.getUsage()); printlnResource(Constants.RES_HELP_CMD_USAGE, command.getName(), command.getUsage());
println(); println();

View File

@ -15,14 +15,14 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.apache.sqoop.client.shell; package org.apache.sqoop.shell;
import java.util.List; import java.util.List;
import org.apache.sqoop.client.core.Constants; import org.apache.sqoop.shell.core.Constants;
import org.codehaus.groovy.tools.shell.Shell; import org.codehaus.groovy.tools.shell.Shell;
import static org.apache.sqoop.client.shell.ShellEnvironment.*; import static org.apache.sqoop.shell.ShellEnvironment.*;
public class SetCommand extends SqoopCommand { public class SetCommand extends SqoopCommand {

View File

@ -15,13 +15,13 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.apache.sqoop.client.shell; package org.apache.sqoop.shell;
import org.apache.commons.cli.CommandLine; import org.apache.commons.cli.CommandLine;
import org.apache.commons.cli.OptionBuilder; import org.apache.commons.cli.OptionBuilder;
import org.apache.sqoop.client.core.Constants; import org.apache.sqoop.shell.core.Constants;
import static org.apache.sqoop.client.shell.ShellEnvironment.*; import static org.apache.sqoop.shell.ShellEnvironment.*;
/** /**
* *

View File

@ -15,13 +15,13 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.apache.sqoop.client.shell; package org.apache.sqoop.shell;
import org.apache.commons.cli.CommandLine; import org.apache.commons.cli.CommandLine;
import org.apache.commons.cli.OptionBuilder; import org.apache.commons.cli.OptionBuilder;
import org.apache.sqoop.client.core.Constants; import org.apache.sqoop.shell.core.Constants;
import static org.apache.sqoop.client.shell.ShellEnvironment.*; import static org.apache.sqoop.shell.ShellEnvironment.*;
@SuppressWarnings("serial") @SuppressWarnings("serial")
public class SetServerFunction extends SqoopFunction { public class SetServerFunction extends SqoopFunction {

View File

@ -15,12 +15,12 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.apache.sqoop.client.shell; package org.apache.sqoop.shell;
import org.apache.sqoop.client.SqoopClient; import org.apache.sqoop.client.SqoopClient;
import org.apache.sqoop.client.core.ClientError;
import org.apache.sqoop.client.core.Constants;
import org.apache.sqoop.common.SqoopException; import org.apache.sqoop.common.SqoopException;
import org.apache.sqoop.shell.core.ShellError;
import org.apache.sqoop.shell.core.Constants;
import org.codehaus.groovy.tools.shell.IO; import org.codehaus.groovy.tools.shell.IO;
import java.net.MalformedURLException; import java.net.MalformedURLException;
@ -129,7 +129,7 @@ public static void setServerUrl(String ustr){
client.setServerUrl(getServerUrl()); client.setServerUrl(getServerUrl());
} catch (MalformedURLException ex) { } catch (MalformedURLException ex) {
throw new SqoopException(ClientError.CLIENT_0003, ex); throw new SqoopException(ShellError.SHELL_0003, ex);
} }
} }

View File

@ -15,13 +15,14 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.apache.sqoop.client.shell; package org.apache.sqoop.shell;
import java.util.List; import java.util.List;
import org.apache.sqoop.client.core.Constants;
import org.apache.sqoop.shell.core.Constants;
import org.codehaus.groovy.tools.shell.Shell; import org.codehaus.groovy.tools.shell.Shell;
import static org.apache.sqoop.client.shell.ShellEnvironment.*; import static org.apache.sqoop.shell.ShellEnvironment.*;
public class ShowCommand extends SqoopCommand public class ShowCommand extends SqoopCommand
{ {

View File

@ -15,20 +15,20 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.apache.sqoop.client.shell; package org.apache.sqoop.shell;
import org.apache.commons.cli.CommandLine; import org.apache.commons.cli.CommandLine;
import org.apache.commons.cli.OptionBuilder; import org.apache.commons.cli.OptionBuilder;
import org.apache.sqoop.client.core.Constants;
import org.apache.sqoop.client.utils.TableDisplayer;
import org.apache.sqoop.model.MConnection; import org.apache.sqoop.model.MConnection;
import org.apache.sqoop.shell.core.Constants;
import org.apache.sqoop.shell.utils.TableDisplayer;
import java.text.DateFormat; import java.text.DateFormat;
import java.util.LinkedList; import java.util.LinkedList;
import java.util.List; import java.util.List;
import static org.apache.sqoop.client.shell.ShellEnvironment.*; import static org.apache.sqoop.shell.ShellEnvironment.*;
import static org.apache.sqoop.client.utils.FormDisplayer.*; import static org.apache.sqoop.shell.utils.FormDisplayer.*;
/** /**
* *

View File

@ -15,7 +15,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.apache.sqoop.client.shell; package org.apache.sqoop.shell;
import java.util.Collection; import java.util.Collection;
import java.util.LinkedList; import java.util.LinkedList;
@ -23,12 +23,12 @@
import org.apache.commons.cli.CommandLine; import org.apache.commons.cli.CommandLine;
import org.apache.commons.cli.OptionBuilder; import org.apache.commons.cli.OptionBuilder;
import org.apache.sqoop.client.core.Constants;
import org.apache.sqoop.client.utils.TableDisplayer;
import org.apache.sqoop.model.MConnector; import org.apache.sqoop.model.MConnector;
import org.apache.sqoop.shell.core.Constants;
import org.apache.sqoop.shell.utils.TableDisplayer;
import static org.apache.sqoop.client.shell.ShellEnvironment.*; import static org.apache.sqoop.shell.ShellEnvironment.*;
import static org.apache.sqoop.client.utils.FormDisplayer.*; import static org.apache.sqoop.shell.utils.FormDisplayer.*;
@SuppressWarnings("serial") @SuppressWarnings("serial")
public class ShowConnectorFunction extends SqoopFunction { public class ShowConnectorFunction extends SqoopFunction {

View File

@ -15,16 +15,16 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.apache.sqoop.client.shell; package org.apache.sqoop.shell;
import org.apache.commons.cli.CommandLine; import org.apache.commons.cli.CommandLine;
import org.apache.sqoop.client.core.Constants;
import org.apache.sqoop.model.MFramework; import org.apache.sqoop.model.MFramework;
import org.apache.sqoop.shell.core.Constants;
import java.util.ResourceBundle; import java.util.ResourceBundle;
import static org.apache.sqoop.client.shell.ShellEnvironment.*; import static org.apache.sqoop.shell.ShellEnvironment.*;
import static org.apache.sqoop.client.utils.FormDisplayer.*; import static org.apache.sqoop.shell.utils.FormDisplayer.*;
/** /**
* *

View File

@ -15,20 +15,20 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.apache.sqoop.client.shell; package org.apache.sqoop.shell;
import org.apache.commons.cli.CommandLine; import org.apache.commons.cli.CommandLine;
import org.apache.commons.cli.OptionBuilder; import org.apache.commons.cli.OptionBuilder;
import org.apache.sqoop.client.core.Constants;
import org.apache.sqoop.client.utils.TableDisplayer;
import org.apache.sqoop.model.MJob; import org.apache.sqoop.model.MJob;
import org.apache.sqoop.shell.core.Constants;
import org.apache.sqoop.shell.utils.TableDisplayer;
import java.text.DateFormat; import java.text.DateFormat;
import java.util.LinkedList; import java.util.LinkedList;
import java.util.List; import java.util.List;
import static org.apache.sqoop.client.shell.ShellEnvironment.*; import static org.apache.sqoop.shell.ShellEnvironment.*;
import static org.apache.sqoop.client.utils.FormDisplayer.*; import static org.apache.sqoop.shell.utils.FormDisplayer.*;
/** /**
* *

View File

@ -15,13 +15,13 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.apache.sqoop.client.shell; package org.apache.sqoop.shell;
import org.apache.commons.cli.CommandLine; import org.apache.commons.cli.CommandLine;
import org.apache.commons.cli.OptionBuilder; import org.apache.commons.cli.OptionBuilder;
import org.apache.sqoop.client.core.Constants; import org.apache.sqoop.shell.core.Constants;
import static org.apache.sqoop.client.shell.ShellEnvironment.*; import static org.apache.sqoop.shell.ShellEnvironment.*;
/** /**
* Show client internal options * Show client internal options

View File

@ -15,13 +15,13 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.apache.sqoop.client.shell; package org.apache.sqoop.shell;
import org.apache.commons.cli.CommandLine; import org.apache.commons.cli.CommandLine;
import org.apache.commons.cli.OptionBuilder; import org.apache.commons.cli.OptionBuilder;
import org.apache.sqoop.client.core.Constants; import org.apache.sqoop.shell.core.Constants;
import static org.apache.sqoop.client.shell.ShellEnvironment.*; import static org.apache.sqoop.shell.ShellEnvironment.*;
@SuppressWarnings("serial") @SuppressWarnings("serial")
public class ShowServerFunction extends SqoopFunction { public class ShowServerFunction extends SqoopFunction {

View File

@ -15,20 +15,19 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.apache.sqoop.client.shell; package org.apache.sqoop.shell;
import java.util.LinkedList; import java.util.LinkedList;
import java.util.List; import java.util.List;
import org.apache.commons.cli.CommandLine; import org.apache.commons.cli.CommandLine;
import org.apache.commons.cli.OptionBuilder; import org.apache.commons.cli.OptionBuilder;
import org.apache.sqoop.client.core.Constants;
import org.apache.sqoop.client.utils.SubmissionDisplayer;
import org.apache.sqoop.client.utils.TableDisplayer;
import org.apache.sqoop.model.MSubmission; import org.apache.sqoop.model.MSubmission;
import org.apache.sqoop.submission.SubmissionStatus; import org.apache.sqoop.shell.core.Constants;
import org.apache.sqoop.shell.utils.SubmissionDisplayer;
import org.apache.sqoop.shell.utils.TableDisplayer;
import static org.apache.sqoop.client.shell.ShellEnvironment.*; import static org.apache.sqoop.shell.ShellEnvironment.*;
public class ShowSubmissionFunction extends SqoopFunction { public class ShowSubmissionFunction extends SqoopFunction {
@SuppressWarnings("static-access") @SuppressWarnings("static-access")

View File

@ -15,18 +15,18 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.apache.sqoop.client.shell; package org.apache.sqoop.shell;
import java.util.Arrays; import java.util.Arrays;
import org.apache.commons.cli.CommandLine; import org.apache.commons.cli.CommandLine;
import org.apache.commons.cli.OptionBuilder; import org.apache.commons.cli.OptionBuilder;
import org.apache.sqoop.client.core.Constants;
import org.apache.sqoop.client.request.VersionRequest; import org.apache.sqoop.client.request.VersionRequest;
import org.apache.sqoop.common.VersionInfo; import org.apache.sqoop.common.VersionInfo;
import org.apache.sqoop.json.VersionBean; import org.apache.sqoop.json.VersionBean;
import org.apache.sqoop.shell.core.Constants;
import static org.apache.sqoop.client.shell.ShellEnvironment.*; import static org.apache.sqoop.shell.ShellEnvironment.*;
@SuppressWarnings("serial") @SuppressWarnings("serial")
public class ShowVersionFunction extends SqoopFunction { public class ShowVersionFunction extends SqoopFunction {

View File

@ -15,7 +15,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.apache.sqoop.client.shell; package org.apache.sqoop.shell;
import groovy.lang.GroovyShell; import groovy.lang.GroovyShell;
import groovy.lang.MissingPropertyException; import groovy.lang.MissingPropertyException;
@ -23,8 +23,8 @@
import java.util.*; import java.util.*;
import org.apache.sqoop.client.core.ClientError;
import org.apache.sqoop.common.SqoopException; import org.apache.sqoop.common.SqoopException;
import org.apache.sqoop.shell.core.ShellError;
import org.codehaus.groovy.tools.shell.ComplexCommandSupport; import org.codehaus.groovy.tools.shell.ComplexCommandSupport;
import org.codehaus.groovy.tools.shell.Shell; import org.codehaus.groovy.tools.shell.Shell;
@ -144,7 +144,7 @@ protected void resolveVariables(List arg) {
temp.add(scr.run().toString()); temp.add(scr.run().toString());
} }
catch(MissingPropertyException e) { catch(MissingPropertyException e) {
throw new SqoopException(ClientError.CLIENT_0004, e.getMessage(), e); throw new SqoopException(ShellError.SHELL_0004, e.getMessage(), e);
} }
} }
Collections.copy(arg, temp); Collections.copy(arg, temp);

View File

@ -15,7 +15,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.apache.sqoop.client.shell; package org.apache.sqoop.shell;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
@ -26,10 +26,10 @@
import org.apache.commons.cli.HelpFormatter; import org.apache.commons.cli.HelpFormatter;
import org.apache.commons.cli.Options; import org.apache.commons.cli.Options;
import org.apache.commons.cli.ParseException; import org.apache.commons.cli.ParseException;
import org.apache.sqoop.client.core.ClientError;
import org.apache.sqoop.common.SqoopException; import org.apache.sqoop.common.SqoopException;
import org.apache.sqoop.shell.core.ShellError;
import static org.apache.sqoop.client.shell.ShellEnvironment.*; import static org.apache.sqoop.shell.ShellEnvironment.*;
@SuppressWarnings("serial") @SuppressWarnings("serial")
abstract public class SqoopFunction extends Options { abstract public class SqoopFunction extends Options {
@ -63,7 +63,7 @@ protected CommandLine parseOptions(Options options, int start, List<String> argl
try { try {
line = parser.parse(options, args); line = parser.parse(options, args);
} catch (ParseException e) { } catch (ParseException e) {
throw new SqoopException(ClientError.CLIENT_0003, e.getMessage(), e); throw new SqoopException(ShellError.SHELL_0003, e.getMessage(), e);
} }
return line; return line;
} }

View File

@ -15,7 +15,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.apache.sqoop.client.shell; package org.apache.sqoop.shell;
import java.io.BufferedReader; import java.io.BufferedReader;
import java.io.File; import java.io.File;
@ -24,15 +24,15 @@
import java.util.HashSet; import java.util.HashSet;
import java.util.Iterator; import java.util.Iterator;
import org.apache.sqoop.client.core.Constants; import org.apache.sqoop.shell.core.Constants;
import org.apache.sqoop.client.utils.ThrowableDisplayer; import org.apache.sqoop.shell.utils.ThrowableDisplayer;
import org.codehaus.groovy.runtime.MethodClosure; import org.codehaus.groovy.runtime.MethodClosure;
import org.codehaus.groovy.tools.shell.Command; import org.codehaus.groovy.tools.shell.Command;
import org.codehaus.groovy.tools.shell.CommandRegistry; import org.codehaus.groovy.tools.shell.CommandRegistry;
import org.codehaus.groovy.tools.shell.Groovysh; import org.codehaus.groovy.tools.shell.Groovysh;
import org.codehaus.groovy.tools.shell.IO.Verbosity; import org.codehaus.groovy.tools.shell.IO.Verbosity;
import static org.apache.sqoop.client.shell.ShellEnvironment.*; import static org.apache.sqoop.shell.ShellEnvironment.*;
/** /**
* Main entry point to Sqoop client. * Main entry point to Sqoop client.

View File

@ -15,15 +15,15 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.apache.sqoop.client.shell; package org.apache.sqoop.shell;
import java.util.List; import java.util.List;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
import org.apache.sqoop.client.core.Constants; import org.apache.sqoop.shell.core.Constants;
import org.codehaus.groovy.tools.shell.Shell; import org.codehaus.groovy.tools.shell.Shell;
import static org.apache.sqoop.client.shell.ShellEnvironment.printlnResource; import static org.apache.sqoop.shell.ShellEnvironment.printlnResource;
public class StartCommand extends SqoopCommand { public class StartCommand extends SqoopCommand {
public static final Logger LOG = Logger.getLogger(StartCommand.class); public static final Logger LOG = Logger.getLogger(StartCommand.class);

View File

@ -15,21 +15,21 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.apache.sqoop.client.shell; package org.apache.sqoop.shell;
import static org.apache.sqoop.client.shell.ShellEnvironment.client; import static org.apache.sqoop.shell.ShellEnvironment.client;
import static org.apache.sqoop.client.shell.ShellEnvironment.getPollTimeout; import static org.apache.sqoop.shell.ShellEnvironment.getPollTimeout;
import static org.apache.sqoop.client.shell.ShellEnvironment.resourceString; import static org.apache.sqoop.shell.ShellEnvironment.resourceString;
import org.apache.commons.cli.CommandLine; import org.apache.commons.cli.CommandLine;
import org.apache.commons.cli.OptionBuilder; import org.apache.commons.cli.OptionBuilder;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
import org.apache.sqoop.client.SubmissionCallback; import org.apache.sqoop.client.SubmissionCallback;
import org.apache.sqoop.client.core.ClientError;
import org.apache.sqoop.client.core.Constants;
import org.apache.sqoop.client.utils.SubmissionDisplayer;
import org.apache.sqoop.common.SqoopException; import org.apache.sqoop.common.SqoopException;
import org.apache.sqoop.model.MSubmission; import org.apache.sqoop.model.MSubmission;
import org.apache.sqoop.shell.core.ShellError;
import org.apache.sqoop.shell.core.Constants;
import org.apache.sqoop.shell.utils.SubmissionDisplayer;
public class StartJobFunction extends SqoopFunction { public class StartJobFunction extends SqoopFunction {
public static final Logger LOG = Logger.getLogger(StartJobFunction.class); public static final Logger LOG = Logger.getLogger(StartJobFunction.class);
@ -72,7 +72,7 @@ public void finished(MSubmission submission) {
try { try {
client.startSubmission(getLong(line, Constants.OPT_JID), callback, pollTimeout); client.startSubmission(getLong(line, Constants.OPT_JID), callback, pollTimeout);
} catch (InterruptedException e) { } catch (InterruptedException e) {
throw new SqoopException(ClientError.CLIENT_0009, e); throw new SqoopException(ShellError.SHELL_0008, e);
} }
} else if (line.hasOption(Constants.OPT_JID)) { } else if (line.hasOption(Constants.OPT_JID)) {
MSubmission submission = client.startSubmission(getLong(line, Constants.OPT_JID)); MSubmission submission = client.startSubmission(getLong(line, Constants.OPT_JID));

View File

@ -15,14 +15,14 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.apache.sqoop.client.shell; package org.apache.sqoop.shell;
import java.util.List; import java.util.List;
import org.apache.sqoop.client.core.Constants; import org.apache.sqoop.shell.core.Constants;
import org.codehaus.groovy.tools.shell.Shell; import org.codehaus.groovy.tools.shell.Shell;
import static org.apache.sqoop.client.shell.ShellEnvironment.printlnResource; import static org.apache.sqoop.shell.ShellEnvironment.printlnResource;
public class StatusCommand extends SqoopCommand { public class StatusCommand extends SqoopCommand {

View File

@ -15,16 +15,16 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.apache.sqoop.client.shell; package org.apache.sqoop.shell;
import static org.apache.sqoop.client.shell.ShellEnvironment.client; import static org.apache.sqoop.shell.ShellEnvironment.client;
import static org.apache.sqoop.client.shell.ShellEnvironment.resourceString; import static org.apache.sqoop.shell.ShellEnvironment.resourceString;
import org.apache.commons.cli.CommandLine; import org.apache.commons.cli.CommandLine;
import org.apache.commons.cli.OptionBuilder; import org.apache.commons.cli.OptionBuilder;
import org.apache.sqoop.client.core.Constants;
import org.apache.sqoop.client.utils.SubmissionDisplayer;
import org.apache.sqoop.model.MSubmission; import org.apache.sqoop.model.MSubmission;
import org.apache.sqoop.shell.core.Constants;
import org.apache.sqoop.shell.utils.SubmissionDisplayer;
import org.apache.sqoop.submission.SubmissionStatus; import org.apache.sqoop.submission.SubmissionStatus;
public class StatusJobFunction extends SqoopFunction{ public class StatusJobFunction extends SqoopFunction{

View File

@ -15,14 +15,14 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.apache.sqoop.client.shell; package org.apache.sqoop.shell;
import java.util.List; import java.util.List;
import org.apache.sqoop.client.core.Constants; import org.apache.sqoop.shell.core.Constants;
import org.codehaus.groovy.tools.shell.Shell; import org.codehaus.groovy.tools.shell.Shell;
import static org.apache.sqoop.client.shell.ShellEnvironment.printlnResource; import static org.apache.sqoop.shell.ShellEnvironment.printlnResource;
public class StopCommand extends SqoopCommand { public class StopCommand extends SqoopCommand {

View File

@ -15,16 +15,16 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.apache.sqoop.client.shell; package org.apache.sqoop.shell;
import static org.apache.sqoop.client.shell.ShellEnvironment.client; import static org.apache.sqoop.shell.ShellEnvironment.client;
import static org.apache.sqoop.client.shell.ShellEnvironment.resourceString; import static org.apache.sqoop.shell.ShellEnvironment.resourceString;
import org.apache.commons.cli.CommandLine; import org.apache.commons.cli.CommandLine;
import org.apache.commons.cli.OptionBuilder; import org.apache.commons.cli.OptionBuilder;
import org.apache.sqoop.client.core.Constants;
import org.apache.sqoop.client.utils.SubmissionDisplayer;
import org.apache.sqoop.model.MSubmission; import org.apache.sqoop.model.MSubmission;
import org.apache.sqoop.shell.core.Constants;
import org.apache.sqoop.shell.utils.SubmissionDisplayer;
public class StopJobFunction extends SqoopFunction { public class StopJobFunction extends SqoopFunction {

View File

@ -15,16 +15,16 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.apache.sqoop.client.shell; package org.apache.sqoop.shell;
import org.apache.sqoop.client.core.ClientError;
import org.apache.sqoop.client.core.Constants;
import org.apache.sqoop.common.SqoopException; import org.apache.sqoop.common.SqoopException;
import org.apache.sqoop.shell.core.ShellError;
import org.apache.sqoop.shell.core.Constants;
import org.codehaus.groovy.tools.shell.Shell; import org.codehaus.groovy.tools.shell.Shell;
import java.util.List; import java.util.List;
import static org.apache.sqoop.client.shell.ShellEnvironment.*; import static org.apache.sqoop.shell.ShellEnvironment.*;
/** /**
* *
@ -42,7 +42,7 @@ public UpdateCommand(Shell shell) {
public Object executeCommand(List args) { public Object executeCommand(List args) {
if(!isInteractive()) { if(!isInteractive()) {
throw new SqoopException(ClientError.CLIENT_0007, "update"); throw new SqoopException(ShellError.SHELL_0007, "update");
} }
if (args.size() == 0) { if (args.size() == 0) {

View File

@ -15,23 +15,23 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.apache.sqoop.client.shell; package org.apache.sqoop.shell;
import jline.ConsoleReader; import jline.ConsoleReader;
import org.apache.commons.cli.CommandLine; import org.apache.commons.cli.CommandLine;
import org.apache.commons.cli.OptionBuilder; import org.apache.commons.cli.OptionBuilder;
import org.apache.sqoop.client.core.ClientError;
import org.apache.sqoop.client.core.Constants;
import org.apache.sqoop.client.utils.FormDisplayer;
import org.apache.sqoop.common.SqoopException; import org.apache.sqoop.common.SqoopException;
import org.apache.sqoop.model.MConnection; import org.apache.sqoop.model.MConnection;
import org.apache.sqoop.shell.core.ShellError;
import org.apache.sqoop.shell.core.Constants;
import org.apache.sqoop.shell.utils.FormDisplayer;
import org.apache.sqoop.validation.Status; import org.apache.sqoop.validation.Status;
import java.io.IOException; import java.io.IOException;
import java.util.ResourceBundle; import java.util.ResourceBundle;
import static org.apache.sqoop.client.utils.FormFiller.*; import static org.apache.sqoop.shell.ShellEnvironment.*;
import static org.apache.sqoop.client.shell.ShellEnvironment.*; import static org.apache.sqoop.shell.utils.FormFiller.*;
/** /**
* *
@ -55,7 +55,7 @@ public Object executeFunction(CommandLine line) {
try { try {
updateConnection(getLong(line, Constants.OPT_XID)); updateConnection(getLong(line, Constants.OPT_XID));
} catch (IOException ex) { } catch (IOException ex) {
throw new SqoopException(ClientError.CLIENT_0005, ex); throw new SqoopException(ShellError.SHELL_0005, ex);
} }
return null; return null;

View File

@ -15,23 +15,23 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.apache.sqoop.client.shell; package org.apache.sqoop.shell;
import jline.ConsoleReader; import jline.ConsoleReader;
import org.apache.commons.cli.CommandLine; import org.apache.commons.cli.CommandLine;
import org.apache.commons.cli.OptionBuilder; import org.apache.commons.cli.OptionBuilder;
import org.apache.sqoop.client.core.ClientError;
import org.apache.sqoop.client.core.Constants;
import org.apache.sqoop.client.utils.FormDisplayer;
import org.apache.sqoop.common.SqoopException; import org.apache.sqoop.common.SqoopException;
import org.apache.sqoop.model.MJob; import org.apache.sqoop.model.MJob;
import org.apache.sqoop.shell.core.ShellError;
import org.apache.sqoop.shell.core.Constants;
import org.apache.sqoop.shell.utils.FormDisplayer;
import org.apache.sqoop.validation.Status; import org.apache.sqoop.validation.Status;
import java.io.IOException; import java.io.IOException;
import java.util.ResourceBundle; import java.util.ResourceBundle;
import static org.apache.sqoop.client.utils.FormFiller.*; import static org.apache.sqoop.shell.ShellEnvironment.*;
import static org.apache.sqoop.client.shell.ShellEnvironment.*; import static org.apache.sqoop.shell.utils.FormFiller.*;
/** /**
* *
@ -55,7 +55,7 @@ public Object executeFunction(CommandLine line) {
try { try {
updateJob(getLong(line, Constants.OPT_JID)); updateJob(getLong(line, Constants.OPT_JID));
} catch (IOException ex) { } catch (IOException ex) {
throw new SqoopException(ClientError.CLIENT_0005, ex); throw new SqoopException(ShellError.SHELL_0005, ex);
} }
return null; return null;

View File

@ -15,7 +15,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.apache.sqoop.client.core; package org.apache.sqoop.shell.core;
/** /**
* *
@ -23,7 +23,7 @@
public class Constants { public class Constants {
// General string constants // General string constants
public static final String RESOURCE_NAME = "client-resource"; public static final String RESOURCE_NAME = "shell-resource";
public static final String BOLD_STR_SEQUENCE = "@|bold"; public static final String BOLD_STR_SEQUENCE = "@|bold";
public static final String END_STR_SEQUENCE = "|@"; public static final String END_STR_SEQUENCE = "|@";

View File

@ -15,47 +15,44 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.apache.sqoop.client.core; package org.apache.sqoop.shell.core;
import org.apache.sqoop.common.ErrorCode; import org.apache.sqoop.common.ErrorCode;
public enum ClientError implements ErrorCode { public enum ShellError implements ErrorCode {
/** An unknown error has occurred. */ /** An unknown error has occurred. */
CLIENT_0000("An unknown error has occurred"), SHELL_0000("An unknown error has occurred"),
/** The specified command is not recognized. */ /** The specified command is not recognized. */
CLIENT_0001("The specified command is not recognized"), SHELL_0001("The specified command is not recognized"),
/** The specified function is not recognized. */ /** The specified function is not recognized. */
CLIENT_0002("The specified function is not recognized"), SHELL_0002("The specified function is not recognized"),
/** An error has occurred when parsing options. */ /** An error has occurred when parsing options. */
CLIENT_0003("An error has occurred when parsing options"), SHELL_0003("An error has occurred when parsing options"),
/** Unable to resolve the variables. */ /** Unable to resolve the variables. */
CLIENT_0004("Unable to resolve the variables"), SHELL_0004("Unable to resolve the variables"),
/** We're not able to get user input */ /** We're not able to get user input */
CLIENT_0005("Can't get user input"), SHELL_0005("Can't get user input"),
/** There occurred exception on server side **/ /** There occurred exception on server side **/
CLIENT_0006("Server has returned exception"), SHELL_0006("Server has returned exception"),
/** Command not compatible with batch mode */ /** Command not compatible with batch mode */
CLIENT_0007("Command not compatible with batch mode"), SHELL_0007("Command not compatible with batch mode"),
/** Polling time of submission status cannot be negative */
CLIENT_0008("Polling time of submission status cannot be negative"),
/** Job Submission : Cannot sleep */ /** Job Submission : Cannot sleep */
CLIENT_0009("Cannot sleep"), SHELL_0008("Cannot sleep"),
; ;
private final String message; private final String message;
private ClientError(String message) { private ShellError(String message) {
this.message = message; this.message = message;
} }

View File

@ -15,10 +15,9 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.apache.sqoop.client.utils; package org.apache.sqoop.shell.utils;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
import org.apache.sqoop.client.core.Constants;
import org.apache.sqoop.model.MAccountableEntity; import org.apache.sqoop.model.MAccountableEntity;
import org.apache.sqoop.model.MBooleanInput; import org.apache.sqoop.model.MBooleanInput;
import org.apache.sqoop.model.MConnection; import org.apache.sqoop.model.MConnection;
@ -32,6 +31,7 @@
import org.apache.sqoop.model.MJobForms; import org.apache.sqoop.model.MJobForms;
import org.apache.sqoop.model.MMapInput; import org.apache.sqoop.model.MMapInput;
import org.apache.sqoop.model.MStringInput; import org.apache.sqoop.model.MStringInput;
import org.apache.sqoop.shell.core.Constants;
import org.apache.sqoop.validation.Status; import org.apache.sqoop.validation.Status;
import java.util.ArrayList; import java.util.ArrayList;
@ -40,7 +40,7 @@
import java.util.Map; import java.util.Map;
import java.util.ResourceBundle; import java.util.ResourceBundle;
import static org.apache.sqoop.client.shell.ShellEnvironment.*; import static org.apache.sqoop.shell.ShellEnvironment.*;
/** /**
* Convenience static methods for displaying form related information * Convenience static methods for displaying form related information

View File

@ -15,7 +15,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.apache.sqoop.client.utils; package org.apache.sqoop.shell.utils;
import jline.ConsoleReader; import jline.ConsoleReader;
import org.apache.sqoop.model.MBooleanInput; import org.apache.sqoop.model.MBooleanInput;
@ -35,7 +35,7 @@
import java.util.HashMap; import java.util.HashMap;
import java.util.ResourceBundle; import java.util.ResourceBundle;
import static org.apache.sqoop.client.shell.ShellEnvironment.*; import static org.apache.sqoop.shell.ShellEnvironment.*;
/** /**
* Convenient methods for retrieving user input. * Convenient methods for retrieving user input.

View File

@ -15,10 +15,10 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.apache.sqoop.client.utils; package org.apache.sqoop.shell.utils;
import org.apache.sqoop.client.core.Constants;
import org.apache.sqoop.model.MSubmission; import org.apache.sqoop.model.MSubmission;
import org.apache.sqoop.shell.core.Constants;
import org.apache.sqoop.submission.SubmissionStatus; import org.apache.sqoop.submission.SubmissionStatus;
import org.apache.sqoop.submission.counter.Counter; import org.apache.sqoop.submission.counter.Counter;
import org.apache.sqoop.submission.counter.CounterGroup; import org.apache.sqoop.submission.counter.CounterGroup;
@ -26,7 +26,7 @@
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import static org.apache.sqoop.client.shell.ShellEnvironment.*; import static org.apache.sqoop.shell.ShellEnvironment.*;
/** /**
* Class used for displaying or printing the submission details * Class used for displaying or printing the submission details

View File

@ -15,14 +15,14 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.apache.sqoop.client.utils; package org.apache.sqoop.shell.utils;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
import java.util.LinkedList; import java.util.LinkedList;
import java.util.List; import java.util.List;
import static org.apache.sqoop.client.shell.ShellEnvironment.*; import static org.apache.sqoop.shell.ShellEnvironment.*;
/** /**
* Display table based data * Display table based data

View File

@ -15,13 +15,13 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.apache.sqoop.client.utils; package org.apache.sqoop.shell.utils;
import groovy.lang.MissingPropertyException; import groovy.lang.MissingPropertyException;
import org.apache.sqoop.client.core.ClientError;
import org.apache.sqoop.common.SqoopException; import org.apache.sqoop.common.SqoopException;
import org.apache.sqoop.shell.core.ShellError;
import static org.apache.sqoop.client.shell.ShellEnvironment.*; import static org.apache.sqoop.shell.ShellEnvironment.*;
/** /**
* Pretty printing of Throwable objects * Pretty printing of Throwable objects
@ -44,7 +44,7 @@ public static void errorHook(Throwable t) {
// If this is server exception from server // If this is server exception from server
if(t instanceof SqoopException if(t instanceof SqoopException
&& ((SqoopException)t).getErrorCode() == ClientError.CLIENT_0006) { && ((SqoopException)t).getErrorCode() == ShellError.SHELL_0006) {
print("@|red Server has returned exception: |@"); print("@|red Server has returned exception: |@");
printThrowable(t.getCause(), isVerbose()); printThrowable(t.getCause(), isVerbose());
} else if(t.getClass() == MissingPropertyException.class) { } else if(t.getClass() == MissingPropertyException.class) {

View File

@ -0,0 +1,24 @@
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You 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.
# Set root logger level to DEBUG and its only appender to A1.
log4j.rootLogger=WARN, A1
# A1 is set to be a ConsoleAppender.
log4j.appender.A1=org.apache.log4j.ConsoleAppender
# A1 uses PatternLayout.
log4j.appender.A1.layout=org.apache.log4j.PatternLayout
log4j.appender.A1.layout.ConversionPattern=%-4r [%t] %-5p %c %x - %m%n

View File

@ -0,0 +1,24 @@
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You 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.
# Set root logger level to DEBUG and its only appender to A1.
log4j.rootLogger=DEBUG, A1
# A1 is set to be a ConsoleAppender.
log4j.appender.A1=org.apache.log4j.ConsoleAppender
# A1 uses PatternLayout.
log4j.appender.A1.layout=org.apache.log4j.PatternLayout
log4j.appender.A1.layout.ConversionPattern=%-4r [%t] %-5p %c %x - %m%n