You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sqoop.apache.org by hs...@apache.org on 2013/08/07 01:20:10 UTC
[3/3] git commit: SQOOP-921. Sqoop2: Create standalone shell package
SQOOP-921. Sqoop2: Create standalone shell package
(Mengwei Ding via Hari Shreedharan)
Project: http://git-wip-us.apache.org/repos/asf/sqoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/sqoop/commit/0d4efda1
Tree: http://git-wip-us.apache.org/repos/asf/sqoop/tree/0d4efda1
Diff: http://git-wip-us.apache.org/repos/asf/sqoop/diff/0d4efda1
Branch: refs/heads/sqoop2
Commit: 0d4efda170f3ec4ba8a2bb4cf4143b6290d4490d
Parents: ff8e050
Author: Hari Shreedharan <hs...@apache.org>
Authored: Tue Aug 6 16:18:58 2013 -0700
Committer: Hari Shreedharan <hs...@apache.org>
Committed: Tue Aug 6 16:18:58 2013 -0700
----------------------------------------------------------------------
client/pom.xml | 60 +-
.../org/apache/sqoop/client/SqoopClient.java | 3 +-
.../apache/sqoop/client/core/ClientError.java | 69 ---
.../org/apache/sqoop/client/core/Constants.java | 451 ---------------
.../apache/sqoop/client/request/Request.java | 5 +-
.../apache/sqoop/client/shell/CloneCommand.java | 69 ---
.../client/shell/CloneConnectionFunction.java | 96 ----
.../sqoop/client/shell/CloneJobFunction.java | 99 ----
.../sqoop/client/shell/CreateCommand.java | 69 ---
.../client/shell/CreateConnectionFunction.java | 93 ---
.../sqoop/client/shell/CreateJobFunction.java | 106 ----
.../sqoop/client/shell/DeleteCommand.java | 64 ---
.../client/shell/DeleteConnectionFunction.java | 50 --
.../sqoop/client/shell/DeleteJobFunction.java | 58 --
.../sqoop/client/shell/DisableCommand.java | 64 ---
.../client/shell/DisableConnectionFunction.java | 51 --
.../sqoop/client/shell/DisableJobFunction.java | 59 --
.../sqoop/client/shell/EnableCommand.java | 64 ---
.../client/shell/EnableConnectionFunction.java | 51 --
.../sqoop/client/shell/EnableJobFunction.java | 59 --
.../apache/sqoop/client/shell/HelpCommand.java | 153 -----
.../apache/sqoop/client/shell/SetCommand.java | 64 ---
.../sqoop/client/shell/SetOptionFunction.java | 87 ---
.../sqoop/client/shell/SetServerFunction.java | 78 ---
.../sqoop/client/shell/ShellEnvironment.java | 208 -------
.../apache/sqoop/client/shell/ShowCommand.java | 105 ----
.../client/shell/ShowConnectionFunction.java | 123 ----
.../client/shell/ShowConnectorFunction.java | 110 ----
.../client/shell/ShowFrameworkFunction.java | 55 --
.../sqoop/client/shell/ShowJobFunction.java | 125 ----
.../sqoop/client/shell/ShowOptionFunction.java | 89 ---
.../sqoop/client/shell/ShowServerFunction.java | 88 ---
.../client/shell/ShowSubmissionFunction.java | 106 ----
.../sqoop/client/shell/ShowVersionFunction.java | 127 -----
.../apache/sqoop/client/shell/SqoopCommand.java | 152 -----
.../sqoop/client/shell/SqoopFunction.java | 74 ---
.../apache/sqoop/client/shell/SqoopShell.java | 176 ------
.../apache/sqoop/client/shell/StartCommand.java | 58 --
.../sqoop/client/shell/StartJobFunction.java | 89 ---
.../sqoop/client/shell/StatusCommand.java | 56 --
.../sqoop/client/shell/StatusJobFunction.java | 55 --
.../apache/sqoop/client/shell/StopCommand.java | 54 --
.../sqoop/client/shell/StopJobFunction.java | 53 --
.../sqoop/client/shell/UpdateCommand.java | 69 ---
.../client/shell/UpdateConnectionFunction.java | 97 ----
.../sqoop/client/shell/UpdateJobFunction.java | 95 ----
.../sqoop/client/utils/FormDisplayer.java | 249 --------
.../apache/sqoop/client/utils/FormFiller.java | 566 -------------------
.../sqoop/client/utils/SubmissionDisplayer.java | 148 -----
.../sqoop/client/utils/TableDisplayer.java | 141 -----
.../sqoop/client/utils/ThrowableDisplayer.java | 90 ---
.../main/resources/client-resource.properties | 232 --------
dist/pom.xml | 12 +-
dist/src/main/bin/sqoop.sh | 4 +-
pom.xml | 6 +
55 files changed, 24 insertions(+), 5610 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/sqoop/blob/0d4efda1/client/pom.xml
----------------------------------------------------------------------
diff --git a/client/pom.xml b/client/pom.xml
index c6351ed..975773d 100644
--- a/client/pom.xml
+++ b/client/pom.xml
@@ -32,7 +32,12 @@ limitations under the License.
<name>Sqoop Client</name>
<dependencies>
- <dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
<scope>test</scope>
@@ -42,63 +47,10 @@ limitations under the License.
<artifactId>sqoop-common</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>
http://git-wip-us.apache.org/repos/asf/sqoop/blob/0d4efda1/client/src/main/java/org/apache/sqoop/client/SqoopClient.java
----------------------------------------------------------------------
diff --git a/client/src/main/java/org/apache/sqoop/client/SqoopClient.java b/client/src/main/java/org/apache/sqoop/client/SqoopClient.java
index 158e46c..f9e7ddd 100644
--- a/client/src/main/java/org/apache/sqoop/client/SqoopClient.java
+++ b/client/src/main/java/org/apache/sqoop/client/SqoopClient.java
@@ -17,7 +17,6 @@
*/
package org.apache.sqoop.client;
-import org.apache.sqoop.client.core.ClientError;
import org.apache.sqoop.client.request.SqoopRequests;
import org.apache.sqoop.common.SqoopException;
import org.apache.sqoop.json.ConnectorBean;
@@ -396,7 +395,7 @@ public class SqoopClient {
*/
public MSubmission startSubmission(long jid, SubmissionCallback callback, long pollTime) throws InterruptedException {
if(pollTime <= 0) {
- throw new SqoopException(ClientError.CLIENT_0008);
+ throw new SqoopException(ClientError.CLIENT_0002);
}
boolean first = true;
MSubmission submission = requests.createSubmission(jid).getSubmissions().get(0);
http://git-wip-us.apache.org/repos/asf/sqoop/blob/0d4efda1/client/src/main/java/org/apache/sqoop/client/core/ClientError.java
----------------------------------------------------------------------
diff --git a/client/src/main/java/org/apache/sqoop/client/core/ClientError.java b/client/src/main/java/org/apache/sqoop/client/core/ClientError.java
deleted file mode 100644
index d96f44e..0000000
--- a/client/src/main/java/org/apache/sqoop/client/core/ClientError.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/**
- * 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.core;
-
-import org.apache.sqoop.common.ErrorCode;
-
-public enum ClientError implements ErrorCode {
-
- /** An unknown error has occurred. */
- CLIENT_0000("An unknown error has occurred"),
-
- /** The specified command is not recognized. */
- CLIENT_0001("The specified command is not recognized"),
-
- /** The specified function is not recognized. */
- CLIENT_0002("The specified function is not recognized"),
-
- /** An error has occurred when parsing options. */
- CLIENT_0003("An error has occurred when parsing options"),
-
- /** Unable to resolve the variables. */
- CLIENT_0004("Unable to resolve the variables"),
-
- /** We're not able to get user input */
- CLIENT_0005("Can't get user input"),
-
- /** There occurred exception on server side **/
- CLIENT_0006("Server has returned exception"),
-
- /** Command not compatible with batch mode */
- CLIENT_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 */
- CLIENT_0009("Cannot sleep"),
-
- ;
-
- private final String message;
-
- private ClientError(String message) {
- this.message = message;
- }
-
- public String getCode() {
- return name();
- }
-
- public String getMessage() {
- return message;
- }
-}
http://git-wip-us.apache.org/repos/asf/sqoop/blob/0d4efda1/client/src/main/java/org/apache/sqoop/client/core/Constants.java
----------------------------------------------------------------------
diff --git a/client/src/main/java/org/apache/sqoop/client/core/Constants.java b/client/src/main/java/org/apache/sqoop/client/core/Constants.java
deleted file mode 100644
index 999790d..0000000
--- a/client/src/main/java/org/apache/sqoop/client/core/Constants.java
+++ /dev/null
@@ -1,451 +0,0 @@
-/**
- * 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.core;
-
-/**
- *
- */
-public class Constants {
-
- // General string constants
- public static final String RESOURCE_NAME = "client-resource";
- public static final String BOLD_STR_SEQUENCE = "@|bold";
- public static final String END_STR_SEQUENCE = "|@";
-
- // Environmental variables
- public static final String ENV_HOST = "SQOOP2_HOST";
- public static final String ENV_PORT = "SQOOP2_PORT";
- public static final String ENV_WEBAPP = "SQOOP2_WEBAPP";
-
- // Options
-
- public static final String OPT_XID = "xid";
- public static final String OPT_ALL = "all";
- public static final String OPT_JID = "jid";
- public static final String OPT_CID = "cid";
- public static final String OPT_TYPE = "type";
- public static final String OPT_NAME = "name";
- public static final String OPT_VALUE = "value";
- public static final String OPT_VERBOSE = "verbose";
- public static final String OPT_HOST = "host";
- public static final String OPT_PORT = "port";
- public static final String OPT_WEBAPP = "webapp";
- public static final String OPT_URL = "url";
- public static final String OPT_SERVER = "server";
- public static final String OPT_CLIENT = "client";
- public static final String OPT_PROTOCOL = "protocol";
- public static final String OPT_SYNCHRONOUS = "synchronous";
- public static final String OPT_POLL_TIMEOUT = "poll-timeout";
- public static final String OPT_DETAIL = "detail";
-
- public static final char OPT_XID_CHAR = 'x';
- public static final char OPT_ALL_CHAR = 'a';
- public static final char OPT_JID_CHAR = 'j';
- public static final char OPT_CID_CHAR = 'c';
- public static final char OPT_TYPE_CHAR = 't';
- public static final char OPT_NAME_CHAR = 'n';
- public static final char OPT_VALUE_CHAR = 'v';
- public static final char OPT_HOST_CHAR = 'h';
- public static final char OPT_PORT_CHAR = 'p';
- public static final char OPT_WEBAPP_CHAR = 'w';
- public static final char OPT_URL_CHAR = 'u';
- public static final char OPT_SERVER_CHAR = 's';
- public static final char OPT_CLIENT_CHAR = 'c';
- public static final char OPT_PROTOCOL_CHAR = 'p';
- public static final char OPT_SYNCHRONOUS_CHAR = 's';
- public static final char OPT_POLL_TIMEOUT_CHAR = 'p';
- public static final char OPT_DETAIL_CHAR = 'd';
-
- // Resource keys for various commands, command options,
- // functions and descriptions
- public static final String CMD_CLONE = "clone";
- public static final String CMD_CLONE_SC = "\\cl";
-
- public static final String CMD_CREATE = "create";
- public static final String CMD_CREATE_SC = "\\cr";
-
- public static final String CMD_DELETE = "delete";
- public static final String CMD_DELETE_SC = "\\d";
-
- public static final String CMD_HELP = "help";
- public static final String CMD_HELP_SC = "\\h";
-
- public static final String CMD_SET = "set";
- public static final String CMD_SET_SC = "\\st";
-
- public static final String CMD_SHOW = "show";
- public static final String CMD_SHOW_SC = "\\sh";
-
- public static final String CMD_UPDATE = "update";
- public static final String CMD_UPDATE_SC = "\\up";
-
- public static final String CMD_START = "start";
- public static final String CMD_START_SC = "\\sta";
-
- public static final String CMD_STOP = "stop";
- public static final String CMD_STOP_SC = "\\stp";
-
- public static final String CMD_STATUS = "status";
- public static final String CMD_STATUS_SC = "\\stu";
-
- public static final String CMD_ENABLE = "enable";
- public static final String CMD_ENABLE_SC = "\\en";
-
- public static final String CMD_DISABLE = "disable";
- public static final String CMD_DISABLE_SC = "\\di";
-
- public static final String FN_CONNECTION = "connection";
- public static final String FN_JOB = "job";
- public static final String FN_SUBMISSION = "submission";
- public static final String FN_SERVER = "server";
- public static final String FN_OPTION = "option";
- public static final String FN_CONNECTOR = "connector";
- public static final String FN_VERSION = "version";
- public static final String FN_FRAMEWORK = "framework";
-
- public static final String PRE_CLONE = "Clone";
- public static final String PRE_CREATE = "Create";
- public static final String PRE_DELETE = "Delete";
- public static final String PRE_SET = "Set";
- public static final String PRE_SHOW = "Show";
- public static final String PRE_UPDATE = "Update";
- public static final String PRE_START = "Start";
- public static final String PRE_STATUS = "Status";
- public static final String PRE_STOP = "Stop";
- public static final String PRE_ENABLE = "Enable";
- public static final String PRE_DISABLE = "Disable";
- public static final String SUF_INFO = "Info";
-
-
- public static final String PROP_HOMEDIR = "user.home";
- public static final String PROP_CURDIR = "user.dir";
- public static final String SQOOP_PROMPT = "sqoop";
-
-
- // Resource Keys for various messages
-
- public static final String RES_FUNCTION_UNKNOWN =
- "args.function.unknown";
- public static final String RES_ARGS_XID_MISSING =
- "args.xid_missing";
- public static final String RES_ARGS_JID_MISSING =
- "args.jid_missing";
- public static final String RES_ARGS_CID_MISSING =
- "args.cid_missing";
- public static final String RES_ARGS_TYPE_MISSING =
- "args.type_missing";
- public static final String RES_ARGS_NAME_MISSING =
- "args.name_missing";
- public static final String RES_ARGS_VALUE_MISSING =
- "args.value_missing";
-
- public static final String RES_PROMPT_CONN_ID =
- "prompt.conn_id";
- public static final String RES_PROMPT_JOB_ID =
- "prompt.job_id";
- public static final String RES_CONNECTOR_ID =
- "prompt.connector_id";
- public static final String RES_PROMPT_JOB_TYPE =
- "prompt.job_type";
- public static final String RES_PROMPT_UPDATE_CONN_METADATA =
- "prompt.update_conn_metadata";
- public static final String RES_PROMPT_UPDATE_JOB_METADATA =
- "prompt.update_job_metadata";
- public static final String RES_PROMPT_FILL_CONN_METADATA =
- "prompt.fill_conn_metadata";
- public static final String RES_PROMPT_FILL_JOB_METADATA =
- "prompt.fill_job_metadata";
-
- public static final String RES_CLONE_USAGE =
- "clone.usage";
- public static final String RES_CLONE_CONN_SUCCESSFUL =
- "clone.conn.successful";
- public static final String RES_CLONE_JOB_SUCCESSFUL =
- "clone.job.successful";
- public static final String RES_CLONE_CLONING_CONN =
- "clone.cloning_conn";
- public static final String RES_CLONE_CLONING_JOB =
- "clone.cloning_job";
-
- public static final String RES_CREATE_USAGE =
- "create.usage";
- public static final String RES_CREATE_CONN_SUCCESSFUL =
- "create.conn_successful";
- public static final String RES_CREATE_JOB_SUCCESSFUL =
- "create.job_successful";
- public static final String RES_CREATE_CREATING_CONN =
- "create.creating_conn";
- public static final String RES_CREATE_CREATING_JOB =
- "create.creating_job";
-
- public static final String RES_DELETE_USAGE =
- "delete.usage";
-
- public static final String RES_DISABLE_USAGE =
- "disable.usage";
- public static final String RES_DISABLE_CONNECTION_SUCCESSFUL =
- "disable.conn_successful";
- public static final String RES_DISABLE_JOB_SUCCESSFUL =
- "disable.job_successful";
-
- public static final String RES_ENABLE_USAGE =
- "enable.usage";
- public static final String RES_ENABLE_CONNECTION_SUCCESSFUL =
- "enable.conn_successful";
- public static final String RES_ENABLE_JOB_SUCCESSFUL =
- "enable.job_successful";
-
- public static final String RES_HELP_USAGE =
- "help.usage";
- public static final String RES_HELP_DESCRIPTION =
- "help.description";
- public static final String RES_HELP_CMD_USAGE =
- "help.cmd_usage";
- public static final String RES_HELP_MESSAGE =
- "help.message";
- public static final String RES_HELP_INFO =
- "help.info";
- public static final String RES_HELP_AVAIL_COMMANDS =
- "help.avail_commands";
- public static final String RES_HELP_CMD_DESCRIPTION =
- "help.cmd_description";
- public static final String RES_HELP_SPECIFIC_CMD_INFO =
- "help.specific_cmd_info";
-
- public static final String RES_UNRECOGNIZED_CMD =
- "unrecognized.cmd";
-
- public static final String RES_SET_USAGE =
- "set.usage";
- public static final String RES_SET_PROMPT_OPT_NAME =
- "set.prompt_opt_name";
- public static final String RES_SET_PROMPT_OPT_VALUE =
- "set.prompt_opt_value";
- public static final String RES_SET_VERBOSE_CHANGED =
- "set.verbose_changed";
- public static final String RES_SET_POLL_TIMEOUT_CHANGED =
- "set.poll_timeout_changed";
- public static final String RES_SET_UNKNOWN_OPT_IGNORED =
- "set.unknown_opt_ignored";
- public static final String RES_SET_HOST_DESCRIPTION =
- "set.host_description";
- public static final String RES_SET_PORT_DESCRIPTION =
- "set.port_description";
- public static final String RES_WEBAPP_DESCRIPTION =
- "set.webapp_description";
- public static final String RES_URL_DESCRIPTION =
- "set.url_description";
- public static final String RES_SET_SERVER_USAGE =
- "set.server_usage";
- public static final String RES_SET_SERVER_SUCCESSFUL =
- "set.server_successful";
- public static final String RES_SET_SERVER_IGNORED =
- "set.server_ignored";
-
- public static final String RES_SHOW_USAGE =
- "show.usage";
- public static final String RES_SHOW_PROMPT_DISPLAY_ALL_CONNS =
- "show.prompt_display_all_conns";
- public static final String RES_SHOW_PROMPT_DISPLAY_CONN_XID =
- "show.prompt_display_conn_xid";
- public static final String RES_SHOW_CONN_USAGE =
- "show.conn_usage";
- public static final String RES_SHOW_PROMPT_CONNS_TO_SHOW =
- "show.prompt_conns_to_show";
- public static final String RES_SHOW_PROMPT_CONN_INFO =
- "show.prompt_conn_info";
- public static final String RES_SHOW_PROMPT_CONN_CID_INFO =
- "show.prompt_conn_cid_info";
-
- public static final String RES_SHOW_PROMPT_DISPLAY_ALL_CONNECTORS =
- "show.prompt_display_all_connectors";
- public static final String RES_SHOW_PROMPT_DISPLAY_CONNECTOR_CID =
- "show.prompt_display_connector_cid";
- public static final String RES_SHOW_CONNECTOR_USAGE =
- "show.connector_usage";
- public static final String RES_SHOW_PROMPT_CONNECTORS_TO_SHOW =
- "show.prompt_connectors_to_show";
- public static final String RES_SHOW_PROMPT_CONNECTOR_INFO =
- "show.prompt_connector_info";
-
- public static final String RES_SHOW_FRAMEWORK_USAGE =
- "show.framework_usage";
- public static final String RES_SHOW_PROMPT_FRAMEWORK_OPTS =
- "show.prompt_framework_opts";
-
- public static final String RES_SHOW_PROMPT_DISPLAY_ALL_JOBS =
- "show.prompt_display_all_jobs";
- public static final String RES_SHOW_PROMPT_DISPLAY_JOB_JID =
- "show.prompt_display_job_jid";
- public static final String RES_SHOW_JOB_USAGE =
- "show.job_usage";
- public static final String RES_SHOW_PROMPT_JOBS_TO_SHOW =
- "show.prompt_jobs_to_show";
- public static final String RES_SHOW_PROMPT_JOB_INFO =
- "show.prompt_job_info";
- public static final String RES_SHOW_PROMPT_JOB_XID_CID_INFO =
- "show.prompt_job_xid_cid_info";
-
- public static final String RES_SHOW_PROMPT_DISPLAY_ALL_SUBMISSIONS =
- "show.prompt_display_all_submissions";
- public static final String RES_SHOW_PROMPT_DISPLAY_ALL_SUBMISSIONS_JOB_ID =
- "show.prompt_display_all_submissions_jid";
-
- public static final String RES_SHOW_PROMPT_DISPLAY_ALL_SERVERS =
- "show.prompt_display_all_servers";
- public static final String RES_SHOW_PROMPT_DISPLAY_SERVER_HOST =
- "show.prompt_display_server_host";
- public static final String RES_SHOW_PROMPT_DISPLAY_SERVER_PORT =
- "show.prompt_display_server_port";
- public static final String RES_SHOW_PROMPT_DISPLAY_SERVER_WEBAPP =
- "show.prompt_display_server_webapp";
- public static final String RES_SHOW_SERVER_USAGE =
- "show.server_usage";
- public static final String RES_SHOW_PROMPT_SERVER_HOST =
- "show.prompt_server_host";
- public static final String RES_SHOW_PROMPT_SERVER_PORT =
- "show.prompt_server_port";
- public static final String RES_SHOW_PROMPT_SERVER_WEBAPP =
- "show.prompt_server_webapp";
-
- public static final String RES_SHOW_PROMPT_DISPLAY_ALL_VERSIONS =
- "show.prompt_display_all_versions";
- public static final String RES_SHOW_PROMPT_DISPLAY_VERSION_SERVER =
- "show.prompt_display_version_server";
- public static final String RES_SHOW_PROMPT_DISPLAY_VERSION_CLIENT =
- "show.prompt_display_version_client";
- public static final String RES_SHOW_PROMPT_DISPLAY_VERSION_PROTOCOL =
- "show.prompt_display_version_protocol";
- public static final String RES_SHOW_VERSION_USAGE =
- "show.version_usage";
- public static final String RES_SHOW_PROMPT_VERSION_CLIENT_SERVER =
- "show.prompt_version_client_server";
- public static final String RES_SHOW_PROMPT_VERSION_PROTOCOL =
- "show.prompt_version_protocol";
-
- public static final String RES_START_USAGE =
- "start.usage";
-
- public static final String RES_STATUS_USAGE =
- "status.usage";
- public static final String RES_PROMPT_SYNCHRONOUS =
- "start.prompt_synchronous";
-
- public static final String RES_STOP_USAGE =
- "stop.usage";
-
- public static final String RES_SQOOP_SHELL_BANNER =
- "sqoop.shell_banner";
- public static final String RES_SQOOP_PROMPT_SHELL_LOADRC =
- "sqoop.prompt_shell_loadrc";
- public static final String RES_SQOOP_PROMPT_SHELL_LOADEDRC =
- "sqoop.prompt_shell_loadedrc";
-
- public static final String RES_UPDATE_USAGE =
- "update.usage";
- public static final String RES_UPDATE_UPDATING_CONN =
- "update.conn";
- public static final String RES_UPDATE_CONN_SUCCESSFUL =
- "update.conn_successful";
- public static final String RES_UPDATE_UPDATING_JOB =
- "update.job";
- public static final String RES_UPDATE_JOB_SUCCESSFUL =
- "update.job_successful";
-
- public static final String RES_TABLE_HEADER_ID =
- "table.header.id";
- public static final String RES_TABLE_HEADER_NAME =
- "table.header.name";
- public static final String RES_TABLE_HEADER_VERSION =
- "table.header.version";
- public static final String RES_TABLE_HEADER_CLASS =
- "table.header.class";
- public static final String RES_TABLE_HEADER_TYPE =
- "table.header.type";
- public static final String RES_TABLE_HEADER_CONNECTOR =
- "table.header.connector";
- public static final String RES_TABLE_HEADER_JOB_ID =
- "table.header.jid";
- public static final String RES_TABLE_HEADER_EXTERNAL_ID =
- "table.header.eid";
- public static final String RES_TABLE_HEADER_STATUS =
- "table.header.status";
- public static final String RES_TABLE_HEADER_DATE =
- "table.header.date";
- public static final String RES_TABLE_HEADER_ENABLED =
- "table.header.enabled";
-
- public static final String RES_FORMDISPLAYER_SUPPORTED_JOBTYPE =
- "formdisplayer.supported_job_types";
- public static final String RES_FORMDISPLAYER_CONNECTION =
- "formdisplayer.connection";
- public static final String RES_FORMDISPLAYER_JOB =
- "formdisplayer.job";
- public static final String RES_FORMDISPLAYER_FORM_JOBTYPE =
- "formdisplayer.forms_jobtype";
- public static final String RES_FORMDISPLAYER_FORM =
- "formdisplayer.form";
- public static final String RES_FORMDISPLAYER_NAME =
- "formdisplayer.name";
- public static final String RES_FORMDISPLAYER_LABEL =
- "formdisplayer.label";
- public static final String RES_FORMDISPLAYER_HELP =
- "formdisplayer.help";
- public static final String RES_FORMDISPLAYER_INPUT =
- "formdisplayer.input";
- public static final String RES_FORMDISPLAYER_TYPE =
- "formdisplayer.type";
- public static final String RES_FORMDISPLAYER_SENSITIVE =
- "formdisplayer.sensitive";
- public static final String RES_FORMDISPLAYER_SIZE =
- "formdisplayer.size";
- public static final String RES_FORMDISPLAYER_POSSIBLE_VALUES =
- "formdisplayer.possible_values";
- public static final String RES_FORMDISPLAYER_UNSUPPORTED_DATATYPE =
- "formdisplayer.unsupported_datatype";
- public static final String RES_FORMDISPLAYER_INPUT_SENSITIVE =
- "formdisplayer.input_sensitive";
-
- public static final String RES_FORMDISPLAYER_FORM_WARNING =
- "formdisplayer.warning_message";
-
- public static final String RES_SUBMISSION_SUBMISSION_DETAIL =
- "submission.submission_detail";
- public static final String RES_SUBMISSION_JOB_ID =
- "submission.job_id";
- public static final String RES_SUBMISSION_CREATION_DATE =
- "submission.creation_date";
- public static final String RES_SUBMISSION_EXTERNAL_ID =
- "submission.external_id";
- public static final String RES_SUBMISSION_PROGRESS_NOT_AVAIL =
- "submission.progress_not_available";
- public static final String RES_SUBMISSION_COUNTERS =
- "submission.counters";
- public static final String RES_SUBMISSION_EXECUTED_SUCCESS =
- "submission.executed_success";
- public static final String RES_SUBMISSION_SERVER_URL =
- "submission.server_url";
- public static final String RES_CONNECTOR_SCHEMA =
- "submission.connector_schema";
- public static final String RES_HIO_SCHEMA =
- "submission.hio_schema";
-
- private Constants() {
- // Instantiation is prohibited
- }
-}
http://git-wip-us.apache.org/repos/asf/sqoop/blob/0d4efda1/client/src/main/java/org/apache/sqoop/client/request/Request.java
----------------------------------------------------------------------
diff --git a/client/src/main/java/org/apache/sqoop/client/request/Request.java b/client/src/main/java/org/apache/sqoop/client/request/Request.java
index befb793..d9229f5 100644
--- a/client/src/main/java/org/apache/sqoop/client/request/Request.java
+++ b/client/src/main/java/org/apache/sqoop/client/request/Request.java
@@ -25,7 +25,8 @@ import com.sun.jersey.api.client.ClientResponse;
import com.sun.jersey.api.client.WebResource;
import com.sun.jersey.api.client.WebResource.Builder;
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.SqoopProtocolConstants;
import org.apache.sqoop.json.ThrowableBean;
@@ -99,7 +100,7 @@ public class Request
JSONObject json = (JSONObject) JSONValue.parse(responseText);
ex.restore(json);
- throw new SqoopException(ClientError.CLIENT_0006, ex.getThrowable());
+ throw new SqoopException(ClientError.CLIENT_0001, ex.getThrowable());
}
}
http://git-wip-us.apache.org/repos/asf/sqoop/blob/0d4efda1/client/src/main/java/org/apache/sqoop/client/shell/CloneCommand.java
----------------------------------------------------------------------
diff --git a/client/src/main/java/org/apache/sqoop/client/shell/CloneCommand.java b/client/src/main/java/org/apache/sqoop/client/shell/CloneCommand.java
deleted file mode 100644
index 283b025..0000000
--- a/client/src/main/java/org/apache/sqoop/client/shell/CloneCommand.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/**
- * 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.shell;
-
-import org.apache.sqoop.client.core.ClientError;
-import org.apache.sqoop.client.core.Constants;
-import org.apache.sqoop.common.SqoopException;
-import org.codehaus.groovy.tools.shell.Shell;
-
-import java.util.List;
-
-import static org.apache.sqoop.client.shell.ShellEnvironment.*;
-
-/**
- * Client side cloning of connection and job objects.
- */
-public class CloneCommand extends SqoopCommand {
-
- private CloneConnectionFunction connectionFunction;
- private CloneJobFunction jobFunction;
-
- public CloneCommand(Shell shell) {
- super(shell, Constants.CMD_CLONE, Constants.CMD_CLONE_SC,
- new String[] {Constants.FN_CONNECTION, Constants.FN_JOB},
- Constants.PRE_CLONE, Constants.SUF_INFO);
- }
-
- public Object executeCommand(List args) {
- if(!isInteractive()) {
- throw new SqoopException(ClientError.CLIENT_0007, "clone");
- }
-
- if (args.size() == 0) {
- printlnResource(Constants.RES_CLONE_USAGE, getUsage());
- return null;
- }
-
- String func = (String)args.get(0);
- if (func.equals(Constants.FN_CONNECTION)) {
- if (connectionFunction == null) {
- connectionFunction = new CloneConnectionFunction();
- }
- return connectionFunction.execute(args);
- } else if (func.equals(Constants.FN_JOB)) {
- if (jobFunction == null) {
- jobFunction = new CloneJobFunction();
- }
- return jobFunction.execute(args);
- } else {
- printlnResource(Constants.RES_FUNCTION_UNKNOWN, func);
- return null;
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/sqoop/blob/0d4efda1/client/src/main/java/org/apache/sqoop/client/shell/CloneConnectionFunction.java
----------------------------------------------------------------------
diff --git a/client/src/main/java/org/apache/sqoop/client/shell/CloneConnectionFunction.java b/client/src/main/java/org/apache/sqoop/client/shell/CloneConnectionFunction.java
deleted file mode 100644
index 0538901..0000000
--- a/client/src/main/java/org/apache/sqoop/client/shell/CloneConnectionFunction.java
+++ /dev/null
@@ -1,96 +0,0 @@
-/**
- * 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.shell;
-
-import jline.ConsoleReader;
-import org.apache.commons.cli.CommandLine;
-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.model.MConnection;
-import org.apache.sqoop.model.MPersistableEntity;
-import org.apache.sqoop.validation.Status;
-
-import java.io.IOException;
-import java.util.ResourceBundle;
-
-import static org.apache.sqoop.client.shell.ShellEnvironment.*;
-import static org.apache.sqoop.client.utils.FormFiller.*;
-
-/**
- *
- */
-public class CloneConnectionFunction extends SqoopFunction {
- @SuppressWarnings("static-access")
- public CloneConnectionFunction() {
- this.addOption(OptionBuilder
- .withDescription(resourceString(Constants.RES_PROMPT_CONN_ID))
- .withLongOpt(Constants.OPT_XID)
- .hasArg()
- .create(Constants.OPT_XID_CHAR)
- );
- }
-
- public Object executeFunction(CommandLine line) {
- if (!line.hasOption(Constants.OPT_XID)) {
- printlnResource(Constants.RES_ARGS_XID_MISSING);
- return null;
- }
-
- try {
- cloneConnection(getLong(line, Constants.OPT_XID));
- } catch (IOException ex) {
- throw new SqoopException(ClientError.CLIENT_0005, ex);
- }
-
- return null;
- }
-
- private void cloneConnection(Long connectionId) throws IOException {
- printlnResource(Constants.RES_CLONE_CLONING_CONN, connectionId);
-
- ConsoleReader reader = new ConsoleReader();
-
- MConnection connection = client.getConnection(connectionId);
- // Remove persistent id as we're making a clone
- connection.setPersistenceId(MPersistableEntity.PERSISTANCE_ID_DEFAULT);
-
- Status status = Status.FINE;
- printlnResource(Constants.RES_PROMPT_UPDATE_CONN_METADATA);
-
- ResourceBundle connectorBundle = client.getResourceBundle(connection.getConnectorId());
- ResourceBundle frameworkBundle = client.getFrameworkResourceBundle();
- do {
- // Print error introduction if needed
- if( !status.canProceed() ) {
- errorIntroduction();
- }
-
- // Fill in data from user
- if(!fillConnection(reader, connection, connectorBundle, frameworkBundle)) {
- return;
- }
-
- status = client.createConnection(connection);
-
- } while(!status.canProceed());
-
- printlnResource(Constants.RES_CLONE_CONN_SUCCESSFUL, status.name(), connection.getPersistenceId());
- }
-}
http://git-wip-us.apache.org/repos/asf/sqoop/blob/0d4efda1/client/src/main/java/org/apache/sqoop/client/shell/CloneJobFunction.java
----------------------------------------------------------------------
diff --git a/client/src/main/java/org/apache/sqoop/client/shell/CloneJobFunction.java b/client/src/main/java/org/apache/sqoop/client/shell/CloneJobFunction.java
deleted file mode 100644
index 6f62813..0000000
--- a/client/src/main/java/org/apache/sqoop/client/shell/CloneJobFunction.java
+++ /dev/null
@@ -1,99 +0,0 @@
-/**
- * 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.shell;
-
-import jline.ConsoleReader;
-import org.apache.commons.cli.CommandLine;
-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.model.MJob;
-import org.apache.sqoop.model.MPersistableEntity;
-import org.apache.sqoop.validation.Status;
-
-import java.io.IOException;
-import java.util.ResourceBundle;
-
-import static org.apache.sqoop.client.shell.ShellEnvironment.*;
-import static org.apache.sqoop.client.utils.FormFiller.*;
-
-/**
- *
- */
-public class CloneJobFunction extends SqoopFunction {
- @SuppressWarnings("static-access")
- public CloneJobFunction() {
- this.addOption(OptionBuilder
- .withDescription(resourceString(Constants.RES_PROMPT_JOB_ID))
- .withLongOpt(Constants.OPT_JID)
- .hasArg()
- .create(Constants.OPT_JID_CHAR));
- }
-
- public Object executeFunction(CommandLine line) {
- if (!line.hasOption(Constants.OPT_JID)) {
- printlnResource(Constants.RES_ARGS_JID_MISSING);
- return null;
- }
-
- try {
- cloneJob(getLong(line, Constants.OPT_JID));
- } catch (IOException ex) {
- throw new SqoopException(ClientError.CLIENT_0005, ex);
- }
-
- return null;
- }
-
- private void cloneJob(Long jobId) throws IOException {
- printlnResource(Constants.RES_CLONE_CLONING_JOB, jobId);
-
- ConsoleReader reader = new ConsoleReader();
-
- MJob job = client.getJob(jobId);
- job.setPersistenceId(MPersistableEntity.PERSISTANCE_ID_DEFAULT);
-
- ResourceBundle connectorBundle = client.getResourceBundle(job.getConnectorId());
- ResourceBundle frameworkBundle = client.getFrameworkResourceBundle();
-
- Status status = Status.FINE;
-
- // Remove persistent id as we're making a clone
- job.setPersistenceId(MPersistableEntity.PERSISTANCE_ID_DEFAULT);
-
- printlnResource(Constants.RES_PROMPT_UPDATE_JOB_METADATA);
- do {
- // Print error introduction if needed
- if( !status.canProceed() ) {
- errorIntroduction();
- }
-
- // Fill in data from user
- if(!fillJob(reader, job, connectorBundle, frameworkBundle)) {
- return;
- }
-
- // Try to create
- status = client.createJob(job);
- } while(!status.canProceed());
-
- printlnResource(Constants.RES_CLONE_JOB_SUCCESSFUL, status.name(), job.getPersistenceId());
- }
-
-}
http://git-wip-us.apache.org/repos/asf/sqoop/blob/0d4efda1/client/src/main/java/org/apache/sqoop/client/shell/CreateCommand.java
----------------------------------------------------------------------
diff --git a/client/src/main/java/org/apache/sqoop/client/shell/CreateCommand.java b/client/src/main/java/org/apache/sqoop/client/shell/CreateCommand.java
deleted file mode 100644
index ac555e1..0000000
--- a/client/src/main/java/org/apache/sqoop/client/shell/CreateCommand.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/**
- * 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.shell;
-
-import org.apache.sqoop.client.core.ClientError;
-import org.apache.sqoop.client.core.Constants;
-import org.apache.sqoop.common.SqoopException;
-import org.codehaus.groovy.tools.shell.Shell;
-
-import java.util.List;
-
-import static org.apache.sqoop.client.shell.ShellEnvironment.*;
-
-/**
- *
- */
-public class CreateCommand extends SqoopCommand {
-
- private CreateConnectionFunction connectionFunction;
- private CreateJobFunction jobFunction;
-
- public CreateCommand(Shell shell) {
- super(shell, Constants.CMD_CREATE, Constants.CMD_CREATE_SC,
- new String[] {Constants.FN_CONNECTION, Constants.FN_JOB},
- Constants.PRE_CREATE, Constants.SUF_INFO);
- }
-
- public Object executeCommand(List args) {
- if(!isInteractive()) {
- throw new SqoopException(ClientError.CLIENT_0007, "create");
- }
-
- if (args.size() == 0) {
- printlnResource(Constants.RES_CREATE_USAGE, getUsage());
- return null;
- }
-
- String func = (String)args.get(0);
- if (func.equals(Constants.FN_CONNECTION)) {
- if (connectionFunction == null) {
- connectionFunction = new CreateConnectionFunction();
- }
- return connectionFunction.execute(args);
- } else if (func.equals(Constants.FN_JOB)) {
- if (jobFunction == null) {
- jobFunction = new CreateJobFunction();
- }
- return jobFunction.execute(args);
- } else {
- printlnResource(Constants.RES_FUNCTION_UNKNOWN, func);
- return null;
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/sqoop/blob/0d4efda1/client/src/main/java/org/apache/sqoop/client/shell/CreateConnectionFunction.java
----------------------------------------------------------------------
diff --git a/client/src/main/java/org/apache/sqoop/client/shell/CreateConnectionFunction.java b/client/src/main/java/org/apache/sqoop/client/shell/CreateConnectionFunction.java
deleted file mode 100644
index 04b240c..0000000
--- a/client/src/main/java/org/apache/sqoop/client/shell/CreateConnectionFunction.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/**
- * 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.shell;
-
-import jline.ConsoleReader;
-import org.apache.commons.cli.CommandLine;
-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.model.MConnection;
-import org.apache.sqoop.validation.Status;
-
-import java.io.IOException;
-import java.util.ResourceBundle;
-
-import static org.apache.sqoop.client.shell.ShellEnvironment.*;
-import static org.apache.sqoop.client.utils.FormFiller.*;
-
-/**
- *
- */
-public class CreateConnectionFunction extends SqoopFunction {
- @SuppressWarnings("static-access")
- public CreateConnectionFunction() {
- this.addOption(OptionBuilder
- .withDescription(resourceString(Constants.RES_CONNECTOR_ID))
- .withLongOpt(Constants.OPT_CID)
- .hasArg()
- .create(Constants.OPT_CID_CHAR));
- }
-
- public Object executeFunction(CommandLine line) {
- if (!line.hasOption(Constants.OPT_CID)) {
- printlnResource(Constants.RES_ARGS_CID_MISSING);
- return null;
- }
-
- try {
- createConnection(getLong(line, Constants.OPT_CID));
- } catch (IOException ex) {
- throw new SqoopException(ClientError.CLIENT_0005, ex);
- }
-
- return null;
- }
-
- private void createConnection(long connectorId) throws IOException {
- printlnResource(Constants.RES_CREATE_CREATING_CONN, connectorId);
-
- ConsoleReader reader = new ConsoleReader();
-
- MConnection connection = client.newConnection(connectorId);
-
- ResourceBundle connectorBundle = client.getResourceBundle(connectorId);
- ResourceBundle frameworkBundle = client.getFrameworkResourceBundle();
-
- Status status = Status.FINE;
- printlnResource(Constants.RES_PROMPT_FILL_CONN_METADATA);
- do {
- // Print error introduction if needed
- if( !status.canProceed() ) {
- errorIntroduction();
- }
-
- // Fill in data from user
- if(!fillConnection(reader, connection, connectorBundle, frameworkBundle)) {
- return;
- }
-
- // Try to create
- status = client.createConnection(connection);
- } while(!status.canProceed());
- FormDisplayer.displayFormWarning(connection);
- printlnResource(Constants.RES_CREATE_CONN_SUCCESSFUL, status.name(), connection.getPersistenceId());
- }
-}
http://git-wip-us.apache.org/repos/asf/sqoop/blob/0d4efda1/client/src/main/java/org/apache/sqoop/client/shell/CreateJobFunction.java
----------------------------------------------------------------------
diff --git a/client/src/main/java/org/apache/sqoop/client/shell/CreateJobFunction.java b/client/src/main/java/org/apache/sqoop/client/shell/CreateJobFunction.java
deleted file mode 100644
index cc4d546..0000000
--- a/client/src/main/java/org/apache/sqoop/client/shell/CreateJobFunction.java
+++ /dev/null
@@ -1,106 +0,0 @@
-/**
- * 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.shell;
-
-import jline.ConsoleReader;
-import org.apache.commons.cli.CommandLine;
-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.model.MJob;
-import org.apache.sqoop.validation.Status;
-
-import java.io.IOException;
-import java.util.ResourceBundle;
-
-import static org.apache.sqoop.client.shell.ShellEnvironment.*;
-import static org.apache.sqoop.client.utils.FormFiller.*;
-
-/**
- * Handles creation of new job objects.
- */
-public class CreateJobFunction extends SqoopFunction {
- @SuppressWarnings("static-access")
- public CreateJobFunction() {
- this.addOption(OptionBuilder
- .withDescription(resourceString(Constants.RES_PROMPT_CONN_ID))
- .withLongOpt(Constants.OPT_XID)
- .hasArg()
- .create(Constants.OPT_XID_CHAR)
- );
- this.addOption(OptionBuilder
- .withDescription(resourceString(Constants.RES_PROMPT_JOB_TYPE))
- .withLongOpt(Constants.OPT_TYPE)
- .hasArg()
- .create(Constants.OPT_TYPE_CHAR)
- );
- }
-
- public Object executeFunction(CommandLine line) {
- if (!line.hasOption(Constants.OPT_XID)) {
- printlnResource(Constants.RES_ARGS_XID_MISSING);
- return null;
- }
- if (!line.hasOption(Constants.OPT_TYPE)) {
- printlnResource(Constants.RES_ARGS_TYPE_MISSING);
- return null;
- }
-
- try {
- createJob(getLong(line, Constants.OPT_XID),
- line.getOptionValue(Constants.OPT_TYPE));
- } catch (IOException ex) {
- throw new SqoopException(ClientError.CLIENT_0005, ex);
- }
-
- return null;
- }
-
- private void createJob(Long connectionId, String type) throws IOException {
- printlnResource(Constants.RES_CREATE_CREATING_JOB, connectionId);
-
- ConsoleReader reader = new ConsoleReader();
- MJob job = client.newJob(connectionId, MJob.Type.valueOf(type.toUpperCase()));
-
- ResourceBundle connectorBundle = client.getResourceBundle(job.getConnectorId());
- ResourceBundle frameworkBundle = client.getFrameworkResourceBundle();
-
- Status status = Status.FINE;
-
- printlnResource(Constants.RES_PROMPT_FILL_JOB_METADATA);
-
- do {
- // Print error introduction if needed
- if( !status.canProceed() ) {
- errorIntroduction();
- }
-
- // Fill in data from user
- if(!fillJob(reader, job, connectorBundle, frameworkBundle)) {
- return;
- }
-
- // Try to create
- status = client.createJob(job);
- } while(!status.canProceed());
- FormDisplayer.displayFormWarning(job);
- printlnResource(Constants.RES_CREATE_JOB_SUCCESSFUL, status.name(), job.getPersistenceId());
- }
-}
http://git-wip-us.apache.org/repos/asf/sqoop/blob/0d4efda1/client/src/main/java/org/apache/sqoop/client/shell/DeleteCommand.java
----------------------------------------------------------------------
diff --git a/client/src/main/java/org/apache/sqoop/client/shell/DeleteCommand.java b/client/src/main/java/org/apache/sqoop/client/shell/DeleteCommand.java
deleted file mode 100644
index 6a5b3a1..0000000
--- a/client/src/main/java/org/apache/sqoop/client/shell/DeleteCommand.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/**
- * 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.shell;
-
-import org.apache.sqoop.client.core.Constants;
-import org.codehaus.groovy.tools.shell.Shell;
-import java.util.List;
-
-import static org.apache.sqoop.client.shell.ShellEnvironment.*;
-
-/**
- *
- */
-public class DeleteCommand extends SqoopCommand {
-
- private DeleteConnectionFunction connectionFunction;
- private DeleteJobFunction jobFunction;
-
- public DeleteCommand(Shell shell) {
- super(shell, Constants.CMD_DELETE, Constants.CMD_DELETE_SC,
- new String[] {Constants.FN_CONNECTION, Constants.FN_JOB},
- Constants.PRE_DELETE, Constants.SUF_INFO);
- }
-
- @Override
- @SuppressWarnings("unchecked")
- public Object executeCommand(List args) {
- if (args.size() == 0) {
- printlnResource(Constants.RES_DELETE_USAGE, getUsage());
- return null;
- }
-
- String func = (String)args.get(0);
- if (func.equals(Constants.FN_CONNECTION)) {
- if (connectionFunction == null) {
- connectionFunction = new DeleteConnectionFunction();
- }
- return connectionFunction.execute(args);
- } else if (func.equals(Constants.FN_JOB)) {
- if (jobFunction == null) {
- jobFunction = new DeleteJobFunction();
- }
- return jobFunction.execute(args);
- } else {
- printlnResource(Constants.RES_FUNCTION_UNKNOWN, func);
- return null;
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/sqoop/blob/0d4efda1/client/src/main/java/org/apache/sqoop/client/shell/DeleteConnectionFunction.java
----------------------------------------------------------------------
diff --git a/client/src/main/java/org/apache/sqoop/client/shell/DeleteConnectionFunction.java b/client/src/main/java/org/apache/sqoop/client/shell/DeleteConnectionFunction.java
deleted file mode 100644
index 18d3a70..0000000
--- a/client/src/main/java/org/apache/sqoop/client/shell/DeleteConnectionFunction.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/**
- * 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.shell;
-
-import org.apache.commons.cli.CommandLine;
-import org.apache.commons.cli.OptionBuilder;
-import org.apache.sqoop.client.core.Constants;
-
-import static org.apache.sqoop.client.shell.ShellEnvironment.*;
-
-/**
- *
- */
-public class DeleteConnectionFunction extends SqoopFunction {
- @SuppressWarnings("static-access")
- public DeleteConnectionFunction() {
- this.addOption(OptionBuilder
- .withDescription(resourceString(Constants.RES_PROMPT_CONN_ID))
- .withLongOpt(Constants.OPT_XID)
- .hasArg()
- .create('x'));
- }
-
- public Object executeFunction(CommandLine line) {
- if (!line.hasOption(Constants.OPT_XID)) {
- printlnResource(Constants.RES_ARGS_XID_MISSING);
- return null;
- }
-
- client.deleteConnection(getLong(line, Constants.OPT_XID));
-
- return null;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/sqoop/blob/0d4efda1/client/src/main/java/org/apache/sqoop/client/shell/DeleteJobFunction.java
----------------------------------------------------------------------
diff --git a/client/src/main/java/org/apache/sqoop/client/shell/DeleteJobFunction.java b/client/src/main/java/org/apache/sqoop/client/shell/DeleteJobFunction.java
deleted file mode 100644
index 736be20..0000000
--- a/client/src/main/java/org/apache/sqoop/client/shell/DeleteJobFunction.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/**
- * 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.shell;
-
-import org.apache.commons.cli.CommandLine;
-import org.apache.commons.cli.OptionBuilder;
-import org.apache.sqoop.client.core.Constants;
-import org.apache.sqoop.client.request.JobRequest;
-
-import static org.apache.sqoop.client.shell.ShellEnvironment.*;
-
-/**
- * Handles deletion of a job object.
- */
-public class DeleteJobFunction extends SqoopFunction {
-
- private JobRequest jobRequest;
-
- @SuppressWarnings("static-access")
- public DeleteJobFunction() {
- this.addOption(OptionBuilder
- .withDescription(resourceString(Constants.RES_PROMPT_JOB_ID))
- .withLongOpt(Constants.OPT_JID)
- .hasArg()
- .create('j'));
- }
-
- public Object executeFunction(CommandLine line) {
- if (!line.hasOption(Constants.OPT_JID)) {
- printlnResource(Constants.RES_ARGS_JID_MISSING);
- return null;
- }
-
- if (jobRequest == null) {
- jobRequest = new JobRequest();
- }
-
- client.deleteJob(getLong(line, Constants.OPT_JID));
-
- return null;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/sqoop/blob/0d4efda1/client/src/main/java/org/apache/sqoop/client/shell/DisableCommand.java
----------------------------------------------------------------------
diff --git a/client/src/main/java/org/apache/sqoop/client/shell/DisableCommand.java b/client/src/main/java/org/apache/sqoop/client/shell/DisableCommand.java
deleted file mode 100644
index 5cbd6db..0000000
--- a/client/src/main/java/org/apache/sqoop/client/shell/DisableCommand.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/**
- * 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.shell;
-
-import org.apache.sqoop.client.core.Constants;
-import org.codehaus.groovy.tools.shell.Shell;
-import java.util.List;
-
-import static org.apache.sqoop.client.shell.ShellEnvironment.*;
-
-/**
- *
- */
-public class DisableCommand extends SqoopCommand {
-
- private DisableConnectionFunction connectionFunction;
- private DisableJobFunction jobFunction;
-
- public DisableCommand(Shell shell) {
- super(shell, Constants.CMD_DISABLE, Constants.CMD_DISABLE_SC,
- new String[] {Constants.FN_CONNECTION, Constants.FN_JOB},
- Constants.PRE_DISABLE, Constants.SUF_INFO);
- }
-
- @Override
- @SuppressWarnings("unchecked")
- public Object executeCommand(List args) {
- if (args.size() == 0) {
- printlnResource(Constants.RES_DISABLE_USAGE, getUsage());
- return null;
- }
-
- String func = (String)args.get(0);
- if (func.equals(Constants.FN_CONNECTION)) {
- if (connectionFunction == null) {
- connectionFunction = new DisableConnectionFunction();
- }
- return connectionFunction.execute(args);
- } else if (func.equals(Constants.FN_JOB)) {
- if (jobFunction == null) {
- jobFunction = new DisableJobFunction();
- }
- return jobFunction.execute(args);
- } else {
- printlnResource(Constants.RES_FUNCTION_UNKNOWN, func);
- return null;
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/sqoop/blob/0d4efda1/client/src/main/java/org/apache/sqoop/client/shell/DisableConnectionFunction.java
----------------------------------------------------------------------
diff --git a/client/src/main/java/org/apache/sqoop/client/shell/DisableConnectionFunction.java b/client/src/main/java/org/apache/sqoop/client/shell/DisableConnectionFunction.java
deleted file mode 100644
index e04292a..0000000
--- a/client/src/main/java/org/apache/sqoop/client/shell/DisableConnectionFunction.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/**
- * 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.shell;
-
-import org.apache.commons.cli.CommandLine;
-import org.apache.commons.cli.OptionBuilder;
-import org.apache.sqoop.client.core.Constants;
-import org.apache.sqoop.model.MConnection;
-import org.apache.sqoop.validation.Status;
-
-import static org.apache.sqoop.client.shell.ShellEnvironment.*;
-
-/**
- * Handles enabling of a connection object
- */
-public class DisableConnectionFunction extends SqoopFunction {
- @SuppressWarnings("static-access")
- public DisableConnectionFunction() {
- this.addOption(OptionBuilder
- .withDescription(resourceString(Constants.RES_PROMPT_CONN_ID))
- .withLongOpt(Constants.OPT_XID)
- .hasArg()
- .create('x'));
- }
-
- public Object executeFunction(CommandLine line) {
- if (!line.hasOption(Constants.OPT_XID)) {
- printlnResource(Constants.RES_ARGS_XID_MISSING);
- return null;
- }
-
- client.enableConnection(getLong(line, Constants.OPT_XID), false);
-
- return null;
- }
-}
http://git-wip-us.apache.org/repos/asf/sqoop/blob/0d4efda1/client/src/main/java/org/apache/sqoop/client/shell/DisableJobFunction.java
----------------------------------------------------------------------
diff --git a/client/src/main/java/org/apache/sqoop/client/shell/DisableJobFunction.java b/client/src/main/java/org/apache/sqoop/client/shell/DisableJobFunction.java
deleted file mode 100644
index 5962cd2..0000000
--- a/client/src/main/java/org/apache/sqoop/client/shell/DisableJobFunction.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/**
- * 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.shell;
-
-import org.apache.commons.cli.CommandLine;
-import org.apache.commons.cli.OptionBuilder;
-import org.apache.sqoop.client.core.Constants;
-import org.apache.sqoop.client.request.JobRequest;
-import org.apache.sqoop.model.MJob;
-import org.apache.sqoop.validation.Status;
-
-import static org.apache.sqoop.client.shell.ShellEnvironment.*;
-
-/**
- * Handles disabling of a job object.
- */
-public class DisableJobFunction extends SqoopFunction {
-
- private JobRequest jobRequest;
-
- @SuppressWarnings("static-access")
- public DisableJobFunction() {
- this.addOption(OptionBuilder
- .withDescription(resourceString(Constants.RES_PROMPT_JOB_ID))
- .withLongOpt(Constants.OPT_JID)
- .hasArg()
- .create('j'));
- }
-
- public Object executeFunction(CommandLine line) {
- if (!line.hasOption(Constants.OPT_JID)) {
- printlnResource(Constants.RES_ARGS_JID_MISSING);
- return null;
- }
-
- if (jobRequest == null) {
- jobRequest = new JobRequest();
- }
-
- client.enableJob(getLong(line, Constants.OPT_JID), false);
-
- return null;
- }
-}
http://git-wip-us.apache.org/repos/asf/sqoop/blob/0d4efda1/client/src/main/java/org/apache/sqoop/client/shell/EnableCommand.java
----------------------------------------------------------------------
diff --git a/client/src/main/java/org/apache/sqoop/client/shell/EnableCommand.java b/client/src/main/java/org/apache/sqoop/client/shell/EnableCommand.java
deleted file mode 100644
index 8a2c1c7..0000000
--- a/client/src/main/java/org/apache/sqoop/client/shell/EnableCommand.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/**
- * 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.shell;
-
-import org.apache.sqoop.client.core.Constants;
-import org.codehaus.groovy.tools.shell.Shell;
-import java.util.List;
-
-import static org.apache.sqoop.client.shell.ShellEnvironment.*;
-
-/**
- *
- */
-public class EnableCommand extends SqoopCommand {
-
- private EnableConnectionFunction connectionFunction;
- private EnableJobFunction jobFunction;
-
- public EnableCommand(Shell shell) {
- super(shell, Constants.CMD_ENABLE, Constants.CMD_ENABLE_SC,
- new String[] {Constants.FN_CONNECTION, Constants.FN_JOB},
- Constants.PRE_ENABLE, Constants.SUF_INFO);
- }
-
- @Override
- @SuppressWarnings("unchecked")
- public Object executeCommand(List args) {
- if (args.size() == 0) {
- printlnResource(Constants.RES_ENABLE_USAGE, getUsage());
- return null;
- }
-
- String func = (String)args.get(0);
- if (func.equals(Constants.FN_CONNECTION)) {
- if (connectionFunction == null) {
- connectionFunction = new EnableConnectionFunction();
- }
- return connectionFunction.execute(args);
- } else if (func.equals(Constants.FN_JOB)) {
- if (jobFunction == null) {
- jobFunction = new EnableJobFunction();
- }
- return jobFunction.execute(args);
- } else {
- printlnResource(Constants.RES_FUNCTION_UNKNOWN, func);
- return null;
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/sqoop/blob/0d4efda1/client/src/main/java/org/apache/sqoop/client/shell/EnableConnectionFunction.java
----------------------------------------------------------------------
diff --git a/client/src/main/java/org/apache/sqoop/client/shell/EnableConnectionFunction.java b/client/src/main/java/org/apache/sqoop/client/shell/EnableConnectionFunction.java
deleted file mode 100644
index ed6dc3c..0000000
--- a/client/src/main/java/org/apache/sqoop/client/shell/EnableConnectionFunction.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/**
- * 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.shell;
-
-import org.apache.commons.cli.CommandLine;
-import org.apache.commons.cli.OptionBuilder;
-import org.apache.sqoop.client.core.Constants;
-import org.apache.sqoop.model.MConnection;
-import org.apache.sqoop.validation.Status;
-
-import static org.apache.sqoop.client.shell.ShellEnvironment.*;
-
-/**
- * Handles enabling of a connection object
- */
-public class EnableConnectionFunction extends SqoopFunction {
- @SuppressWarnings("static-access")
- public EnableConnectionFunction() {
- this.addOption(OptionBuilder
- .withDescription(resourceString(Constants.RES_PROMPT_CONN_ID))
- .withLongOpt(Constants.OPT_XID)
- .hasArg()
- .create('x'));
- }
-
- public Object executeFunction(CommandLine line) {
- if (!line.hasOption(Constants.OPT_XID)) {
- printlnResource(Constants.RES_ARGS_XID_MISSING);
- return null;
- }
-
- client.enableConnection(getLong(line, Constants.OPT_XID), true);
-
- return null;
- }
-}
http://git-wip-us.apache.org/repos/asf/sqoop/blob/0d4efda1/client/src/main/java/org/apache/sqoop/client/shell/EnableJobFunction.java
----------------------------------------------------------------------
diff --git a/client/src/main/java/org/apache/sqoop/client/shell/EnableJobFunction.java b/client/src/main/java/org/apache/sqoop/client/shell/EnableJobFunction.java
deleted file mode 100644
index 9e4e320..0000000
--- a/client/src/main/java/org/apache/sqoop/client/shell/EnableJobFunction.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/**
- * 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.shell;
-
-import org.apache.commons.cli.CommandLine;
-import org.apache.commons.cli.OptionBuilder;
-import org.apache.sqoop.client.core.Constants;
-import org.apache.sqoop.client.request.JobRequest;
-import org.apache.sqoop.model.MJob;
-import org.apache.sqoop.validation.Status;
-
-import static org.apache.sqoop.client.shell.ShellEnvironment.*;
-
-/**
- * Handles disabling of a job object.
- */
-public class EnableJobFunction extends SqoopFunction {
-
- private JobRequest jobRequest;
-
- @SuppressWarnings("static-access")
- public EnableJobFunction() {
- this.addOption(OptionBuilder
- .withDescription(resourceString(Constants.RES_PROMPT_JOB_ID))
- .withLongOpt(Constants.OPT_JID)
- .hasArg()
- .create('j'));
- }
-
- public Object executeFunction(CommandLine line) {
- if (!line.hasOption(Constants.OPT_JID)) {
- printlnResource(Constants.RES_ARGS_JID_MISSING);
- return null;
- }
-
- if (jobRequest == null) {
- jobRequest = new JobRequest();
- }
-
- client.enableJob(getLong(line, Constants.OPT_JID), true);
-
- return null;
- }
-}
http://git-wip-us.apache.org/repos/asf/sqoop/blob/0d4efda1/client/src/main/java/org/apache/sqoop/client/shell/HelpCommand.java
----------------------------------------------------------------------
diff --git a/client/src/main/java/org/apache/sqoop/client/shell/HelpCommand.java b/client/src/main/java/org/apache/sqoop/client/shell/HelpCommand.java
deleted file mode 100644
index c6f831d..0000000
--- a/client/src/main/java/org/apache/sqoop/client/shell/HelpCommand.java
+++ /dev/null
@@ -1,153 +0,0 @@
-/**
- * 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.shell;
-
-import java.text.MessageFormat;
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.List;
-
-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.codehaus.groovy.tools.shell.Command;
-import org.codehaus.groovy.tools.shell.CommandSupport;
-import org.codehaus.groovy.tools.shell.Shell;
-import org.codehaus.groovy.tools.shell.util.SimpleCompletor;
-
-import static org.apache.sqoop.client.shell.ShellEnvironment.*;
-
-public class HelpCommand extends CommandSupport {
-
- protected HelpCommand(Shell shell) {
- super(shell, Constants.CMD_HELP, Constants.CMD_HELP_SC);
- }
-
- @Override
- public String getDescription() {
- return resourceString(Constants.RES_HELP_DESCRIPTION);
- }
-
- @Override
- public String getUsage() {
- return resourceString(Constants.RES_HELP_USAGE);
- }
-
- @Override
- public String getHelp() {
- return resourceString(Constants.RES_HELP_MESSAGE);
- }
-
- @SuppressWarnings("rawtypes")
- @Override
- public Object execute(List args) {
- if (args.size() == 0) {
- list();
- }
- else {
- help((String)args.get(0));
- }
- return null;
- }
-
- @SuppressWarnings("unchecked")
- private void list() {
- Iterator<Command> iterator;
-
- // Figure out the max command name and shortcut length dynamically
- int maxName = 0;
- int maxShortcut = 0;
- iterator = shell.getRegistry().commands().iterator();
- while (iterator.hasNext()) {
- Command command = iterator.next();
- if (command.getHidden()) {
- continue;
- }
-
- if (command.getName().length() > maxName) {
- maxName = command.getName().length();
- }
-
- if (command.getShortcut().length() > maxShortcut) {
- maxShortcut = command.getShortcut().length();
- }
- }
-
- printlnResource(Constants.RES_HELP_INFO);
- println();
-
- // List the commands we know about
- printlnResource(Constants.RES_HELP_AVAIL_COMMANDS);
-
- iterator = shell.getRegistry().commands().iterator();
- while (iterator.hasNext()) {
- Command command = iterator.next();
- if (command.getHidden()) {
- continue;
- }
-
- String paddedName = StringUtils.rightPad(command.getName(), maxName);
- String paddedShortcut = StringUtils.rightPad(command.getShortcut(), maxShortcut);
-
- String description = command.getDescription();
-
- StringBuilder sb = new StringBuilder();
- sb.append(" ")
- .append(MessageFormat.format(resource.getString(Constants
- .RES_HELP_CMD_DESCRIPTION), paddedName,
- paddedShortcut, description));
- println(sb.toString());
- }
-
- println();
- printlnResource(Constants.RES_HELP_SPECIFIC_CMD_INFO);
- println();
- }
-
- private void help(String name) {
- Command command = shell.getRegistry().find(name);
- if (command == null) {
- String msg = MessageFormat.format(resource.getString(Constants
- .RES_UNRECOGNIZED_CMD), name);
- throw new SqoopException(ClientError.CLIENT_0001, msg);
- }
- printlnResource(Constants.RES_HELP_CMD_USAGE, command.getName(), command.getUsage());
- println();
- println(command.getHelp());
- println();
- }
-
- @SuppressWarnings({ "rawtypes", "unchecked" })
- protected List createCompletors() {
- SimpleCompletor completor = new SimpleCompletor();
- Iterator<Command> iterator = registry.iterator();
- while (iterator.hasNext()) {
- Command command = iterator.next();
- if (command.getHidden()) {
- continue;
- }
-
- completor.add(command.getName());
- }
-
- List completors = new LinkedList();
- completors.add(completor);
- return completors;
- }
-}
http://git-wip-us.apache.org/repos/asf/sqoop/blob/0d4efda1/client/src/main/java/org/apache/sqoop/client/shell/SetCommand.java
----------------------------------------------------------------------
diff --git a/client/src/main/java/org/apache/sqoop/client/shell/SetCommand.java b/client/src/main/java/org/apache/sqoop/client/shell/SetCommand.java
deleted file mode 100644
index c831123..0000000
--- a/client/src/main/java/org/apache/sqoop/client/shell/SetCommand.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/**
- * 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.shell;
-
-import java.util.List;
-
-import org.apache.sqoop.client.core.Constants;
-import org.codehaus.groovy.tools.shell.Shell;
-
-import static org.apache.sqoop.client.shell.ShellEnvironment.*;
-
-public class SetCommand extends SqoopCommand {
-
- private SetServerFunction serverFunction;
- private SetOptionFunction optionFunction;
-
- protected SetCommand(Shell shell) {
- super(shell, Constants.CMD_SET, Constants.CMD_SET_SC,
- new String[] {Constants.FN_SERVER, Constants.FN_OPTION},
- Constants.PRE_SET, Constants.SUF_INFO);
- }
-
- @SuppressWarnings({ "rawtypes", "unchecked" })
- @Override
- public Object executeCommand(List args) {
-
- if (args.size() == 0) {
- printlnResource(Constants.RES_SET_USAGE, getUsage());
- return null;
- }
- String func = (String)args.get(0);
- if (func.equals(Constants.FN_SERVER)) {
- if (serverFunction == null) {
- serverFunction = new SetServerFunction();
- }
- return serverFunction.execute(args);
-
- } else if (func.equals(Constants.FN_OPTION)) {
- if (optionFunction == null) {
- optionFunction = new SetOptionFunction();
- }
- return optionFunction.execute(args);
-
- } else {
- printlnResource(Constants.RES_FUNCTION_UNKNOWN, func);
- return null;
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/sqoop/blob/0d4efda1/client/src/main/java/org/apache/sqoop/client/shell/SetOptionFunction.java
----------------------------------------------------------------------
diff --git a/client/src/main/java/org/apache/sqoop/client/shell/SetOptionFunction.java b/client/src/main/java/org/apache/sqoop/client/shell/SetOptionFunction.java
deleted file mode 100644
index e843ede..0000000
--- a/client/src/main/java/org/apache/sqoop/client/shell/SetOptionFunction.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/**
- * 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.shell;
-
-import org.apache.commons.cli.CommandLine;
-import org.apache.commons.cli.OptionBuilder;
-import org.apache.sqoop.client.core.Constants;
-
-import static org.apache.sqoop.client.shell.ShellEnvironment.*;
-
-/**
- *
- */
-public class SetOptionFunction extends SqoopFunction {
- @SuppressWarnings("static-access")
- protected SetOptionFunction() {
- this.addOption(OptionBuilder.hasArg()
- .withDescription(resourceString(Constants.RES_SET_PROMPT_OPT_NAME))
- .withLongOpt(Constants.OPT_NAME)
- .create(Constants.OPT_NAME_CHAR));
- this.addOption(OptionBuilder.hasArg()
- .withDescription(resourceString(Constants.RES_SET_PROMPT_OPT_VALUE))
- .withLongOpt(Constants.OPT_VALUE)
- .create(Constants.OPT_VALUE_CHAR));
- }
-
- public Object executeFunction(CommandLine line) {
- if (!line.hasOption(Constants.OPT_NAME)) {
- printlnResource(Constants.RES_ARGS_NAME_MISSING);
- return null;
- }
- if (!line.hasOption(Constants.OPT_VALUE)) {
- printlnResource(Constants.RES_ARGS_VALUE_MISSING);
- return null;
- }
-
- handleOptionSetting(line.getOptionValue(Constants.OPT_NAME), line.getOptionValue(Constants.OPT_VALUE));
-
- return null;
- }
-
- private void handleOptionSetting(String name, String value) {
- if(name.equals(Constants.OPT_VERBOSE)) {
- boolean newValue = false;
-
- if(value.equals("1") || value.equals("true")) {
- newValue = true;
- }
-
- setVerbose(newValue);
- printlnResource(Constants.RES_SET_VERBOSE_CHANGED, newValue);
- return;
- }
-
- if (name.equals(Constants.OPT_POLL_TIMEOUT)) {
- long newValue = 0;
-
- try {
- newValue = Long.parseLong(value);
- } catch (NumberFormatException ex) {
- // make the value stay the same
- newValue = getPollTimeout();
- }
-
- setPollTimeout(newValue);
- printlnResource(Constants.RES_SET_POLL_TIMEOUT_CHANGED, newValue);
- return;
- }
-
- printlnResource(Constants.RES_SET_UNKNOWN_OPT_IGNORED, name);
- }
-}
\ No newline at end of file