http://git-wip-us.apache.org/repos/asf/sqoop/blob/049994a0/shell/src/main/java/org/apache/sqoop/shell/DeleteConnectionFunction.java ---------------------------------------------------------------------- diff --git a/shell/src/main/java/org/apache/sqoop/shell/DeleteConnectionFunction.java b/shell/src/main/java/org/apache/sqoop/shell/DeleteConnectionFunction.java deleted file mode 100644 index 1eb7e51..0000000 --- a/shell/src/main/java/org/apache/sqoop/shell/DeleteConnectionFunction.java +++ /dev/null @@ -1,47 +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.shell; - -import org.apache.commons.cli.CommandLine; -import org.apache.commons.cli.OptionBuilder; -import org.apache.sqoop.shell.core.Constants; -import org.apache.sqoop.validation.Status; - -import static org.apache.sqoop.shell.ShellEnvironment.*; - -/** - * - */ -@SuppressWarnings("serial") -public class DeleteConnectionFunction extends SqoopFunction { - @SuppressWarnings("static-access") - public DeleteConnectionFunction() { - this.addOption(OptionBuilder - .withDescription(resourceString(Constants.RES_PROMPT_CONN_ID)) - .withLongOpt(Constants.OPT_XID) - .isRequired() - .hasArg() - .create('x')); - } - - @Override - public Object executeFunction(CommandLine line, boolean isInteractive) { - client.deleteConnection(getLong(line, Constants.OPT_XID)); - return Status.FINE; - } -}
http://git-wip-us.apache.org/repos/asf/sqoop/blob/049994a0/shell/src/main/java/org/apache/sqoop/shell/DeleteJobFunction.java ---------------------------------------------------------------------- diff --git a/shell/src/main/java/org/apache/sqoop/shell/DeleteJobFunction.java b/shell/src/main/java/org/apache/sqoop/shell/DeleteJobFunction.java index 5d48c91..da26153 100644 --- a/shell/src/main/java/org/apache/sqoop/shell/DeleteJobFunction.java +++ b/shell/src/main/java/org/apache/sqoop/shell/DeleteJobFunction.java @@ -37,7 +37,7 @@ public class DeleteJobFunction extends SqoopFunction { .withLongOpt(Constants.OPT_JID) .isRequired() .hasArg() - .create('j')); + .create(Constants.OPT_JID_CHAR)); } @Override http://git-wip-us.apache.org/repos/asf/sqoop/blob/049994a0/shell/src/main/java/org/apache/sqoop/shell/DeleteLinkFunction.java ---------------------------------------------------------------------- diff --git a/shell/src/main/java/org/apache/sqoop/shell/DeleteLinkFunction.java b/shell/src/main/java/org/apache/sqoop/shell/DeleteLinkFunction.java new file mode 100644 index 0000000..c81917e --- /dev/null +++ b/shell/src/main/java/org/apache/sqoop/shell/DeleteLinkFunction.java @@ -0,0 +1,47 @@ +/** + * 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.shell; + +import org.apache.commons.cli.CommandLine; +import org.apache.commons.cli.OptionBuilder; +import org.apache.sqoop.shell.core.Constants; +import org.apache.sqoop.validation.Status; + +import static org.apache.sqoop.shell.ShellEnvironment.*; + +/** + * + */ +@SuppressWarnings("serial") +public class DeleteLinkFunction extends SqoopFunction { + @SuppressWarnings("static-access") + public DeleteLinkFunction() { + this.addOption(OptionBuilder + .withDescription(resourceString(Constants.RES_PROMPT_LINK_ID)) + .withLongOpt(Constants.OPT_LID) + .isRequired() + .hasArg() + .create(Constants.OPT_LID_CHAR)); + } + + @Override + public Object executeFunction(CommandLine line, boolean isInteractive) { + client.deleteLink(getLong(line, Constants.OPT_LID)); + return Status.FINE; + } +} http://git-wip-us.apache.org/repos/asf/sqoop/blob/049994a0/shell/src/main/java/org/apache/sqoop/shell/DisableCommand.java ---------------------------------------------------------------------- diff --git a/shell/src/main/java/org/apache/sqoop/shell/DisableCommand.java b/shell/src/main/java/org/apache/sqoop/shell/DisableCommand.java index fa3263f..03aa922 100644 --- a/shell/src/main/java/org/apache/sqoop/shell/DisableCommand.java +++ b/shell/src/main/java/org/apache/sqoop/shell/DisableCommand.java @@ -31,7 +31,7 @@ public class DisableCommand extends SqoopCommand { Constants.CMD_DISABLE, Constants.CMD_DISABLE_SC, ImmutableMap.of( - Constants.FN_CONNECTION, DisableConnectionFunction.class, + Constants.FN_LINK, DisableLinkFunction.class, Constants.FN_JOB, DisableJobFunction.class ) ); http://git-wip-us.apache.org/repos/asf/sqoop/blob/049994a0/shell/src/main/java/org/apache/sqoop/shell/DisableConnectionFunction.java ---------------------------------------------------------------------- diff --git a/shell/src/main/java/org/apache/sqoop/shell/DisableConnectionFunction.java b/shell/src/main/java/org/apache/sqoop/shell/DisableConnectionFunction.java deleted file mode 100644 index 816ff75..0000000 --- a/shell/src/main/java/org/apache/sqoop/shell/DisableConnectionFunction.java +++ /dev/null @@ -1,47 +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.shell; - -import org.apache.commons.cli.CommandLine; -import org.apache.commons.cli.OptionBuilder; -import org.apache.sqoop.shell.core.Constants; -import org.apache.sqoop.validation.Status; - -import static org.apache.sqoop.shell.ShellEnvironment.*; - -/** - * Handles enabling of a connection object - */ -@SuppressWarnings("serial") -public class DisableConnectionFunction extends SqoopFunction { - @SuppressWarnings("static-access") - public DisableConnectionFunction() { - this.addOption(OptionBuilder - .withDescription(resourceString(Constants.RES_PROMPT_CONN_ID)) - .withLongOpt(Constants.OPT_XID) - .isRequired() - .hasArg() - .create('x')); - } - - @Override - public Object executeFunction(CommandLine line, boolean isInteractive) { - client.enableConnection(getLong(line, Constants.OPT_XID), false); - return Status.FINE; - } -} http://git-wip-us.apache.org/repos/asf/sqoop/blob/049994a0/shell/src/main/java/org/apache/sqoop/shell/DisableLinkFunction.java ---------------------------------------------------------------------- diff --git a/shell/src/main/java/org/apache/sqoop/shell/DisableLinkFunction.java b/shell/src/main/java/org/apache/sqoop/shell/DisableLinkFunction.java new file mode 100644 index 0000000..6b85292 --- /dev/null +++ b/shell/src/main/java/org/apache/sqoop/shell/DisableLinkFunction.java @@ -0,0 +1,47 @@ +/** + * 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.shell; + +import org.apache.commons.cli.CommandLine; +import org.apache.commons.cli.OptionBuilder; +import org.apache.sqoop.shell.core.Constants; +import org.apache.sqoop.validation.Status; + +import static org.apache.sqoop.shell.ShellEnvironment.*; + +/** + * Handles enabling of a connection object + */ +@SuppressWarnings("serial") +public class DisableLinkFunction extends SqoopFunction { + @SuppressWarnings("static-access") + public DisableLinkFunction() { + this.addOption(OptionBuilder + .withDescription(resourceString(Constants.RES_PROMPT_LINK_ID)) + .withLongOpt(Constants.OPT_LID) + .isRequired() + .hasArg() + .create(Constants.OPT_LID_CHAR)); + } + + @Override + public Object executeFunction(CommandLine line, boolean isInteractive) { + client.enableLink(getLong(line, Constants.OPT_LID), false); + return Status.FINE; + } +} http://git-wip-us.apache.org/repos/asf/sqoop/blob/049994a0/shell/src/main/java/org/apache/sqoop/shell/EnableCommand.java ---------------------------------------------------------------------- diff --git a/shell/src/main/java/org/apache/sqoop/shell/EnableCommand.java b/shell/src/main/java/org/apache/sqoop/shell/EnableCommand.java index b48647b..42cc9fc 100644 --- a/shell/src/main/java/org/apache/sqoop/shell/EnableCommand.java +++ b/shell/src/main/java/org/apache/sqoop/shell/EnableCommand.java @@ -31,7 +31,7 @@ public class EnableCommand extends SqoopCommand { Constants.CMD_ENABLE, Constants.CMD_ENABLE_SC, ImmutableMap.of( - Constants.FN_CONNECTION, EnableConnectionFunction.class, + Constants.FN_LINK, EnableLinkFunction.class, Constants.FN_JOB, EnableJobFunction.class ) ); http://git-wip-us.apache.org/repos/asf/sqoop/blob/049994a0/shell/src/main/java/org/apache/sqoop/shell/EnableConnectionFunction.java ---------------------------------------------------------------------- diff --git a/shell/src/main/java/org/apache/sqoop/shell/EnableConnectionFunction.java b/shell/src/main/java/org/apache/sqoop/shell/EnableConnectionFunction.java deleted file mode 100644 index 174c3df..0000000 --- a/shell/src/main/java/org/apache/sqoop/shell/EnableConnectionFunction.java +++ /dev/null @@ -1,47 +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.shell; - -import org.apache.commons.cli.CommandLine; -import org.apache.commons.cli.OptionBuilder; -import org.apache.sqoop.shell.core.Constants; -import org.apache.sqoop.validation.Status; - -import static org.apache.sqoop.shell.ShellEnvironment.*; - -/** - * Handles enabling of a connection object - */ -@SuppressWarnings("serial") -public class EnableConnectionFunction extends SqoopFunction { - @SuppressWarnings("static-access") - public EnableConnectionFunction() { - this.addOption(OptionBuilder - .withDescription(resourceString(Constants.RES_PROMPT_CONN_ID)) - .withLongOpt(Constants.OPT_XID) - .isRequired() - .hasArg() - .create('x')); - } - - @Override - public Object executeFunction(CommandLine line, boolean isInteractive) { - client.enableConnection(getLong(line, Constants.OPT_XID), true); - return Status.FINE; - } -} http://git-wip-us.apache.org/repos/asf/sqoop/blob/049994a0/shell/src/main/java/org/apache/sqoop/shell/EnableLinkFunction.java ---------------------------------------------------------------------- diff --git a/shell/src/main/java/org/apache/sqoop/shell/EnableLinkFunction.java b/shell/src/main/java/org/apache/sqoop/shell/EnableLinkFunction.java new file mode 100644 index 0000000..1dd30e8 --- /dev/null +++ b/shell/src/main/java/org/apache/sqoop/shell/EnableLinkFunction.java @@ -0,0 +1,47 @@ +/** + * 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.shell; + +import org.apache.commons.cli.CommandLine; +import org.apache.commons.cli.OptionBuilder; +import org.apache.sqoop.shell.core.Constants; +import org.apache.sqoop.validation.Status; + +import static org.apache.sqoop.shell.ShellEnvironment.*; + +/** + * Handles enabling of a connection object + */ +@SuppressWarnings("serial") +public class EnableLinkFunction extends SqoopFunction { + @SuppressWarnings("static-access") + public EnableLinkFunction() { + this.addOption(OptionBuilder + .withDescription(resourceString(Constants.RES_PROMPT_LINK_ID)) + .withLongOpt(Constants.OPT_LID) + .isRequired() + .hasArg() + .create(Constants.OPT_LID_CHAR)); + } + + @Override + public Object executeFunction(CommandLine line, boolean isInteractive) { + client.enableLink(getLong(line, Constants.OPT_LID), true); + return Status.FINE; + } +} http://git-wip-us.apache.org/repos/asf/sqoop/blob/049994a0/shell/src/main/java/org/apache/sqoop/shell/ShowCommand.java ---------------------------------------------------------------------- diff --git a/shell/src/main/java/org/apache/sqoop/shell/ShowCommand.java b/shell/src/main/java/org/apache/sqoop/shell/ShowCommand.java index ba1d384..28bc752 100644 --- a/shell/src/main/java/org/apache/sqoop/shell/ShowCommand.java +++ b/shell/src/main/java/org/apache/sqoop/shell/ShowCommand.java @@ -31,8 +31,8 @@ public class ShowCommand extends SqoopCommand { .put(Constants.FN_SERVER, ShowServerFunction.class) .put(Constants.FN_VERSION, ShowVersionFunction.class) .put(Constants.FN_CONNECTOR, ShowConnectorFunction.class) - .put(Constants.FN_FRAMEWORK, ShowFrameworkFunction.class) - .put(Constants.FN_CONNECTION, ShowConnectionFunction.class) + .put(Constants.FN_DRIVER_CONFIG, ShowDriverConfigFunction.class) + .put(Constants.FN_LINK, ShowLinkFunction.class) .put(Constants.FN_JOB, ShowJobFunction.class) .put(Constants.FN_SUBMISSION, ShowSubmissionFunction.class) .put(Constants.FN_OPTION, ShowOptionFunction.class) http://git-wip-us.apache.org/repos/asf/sqoop/blob/049994a0/shell/src/main/java/org/apache/sqoop/shell/ShowConnectionFunction.java ---------------------------------------------------------------------- diff --git a/shell/src/main/java/org/apache/sqoop/shell/ShowConnectionFunction.java b/shell/src/main/java/org/apache/sqoop/shell/ShowConnectionFunction.java deleted file mode 100644 index b6cf403..0000000 --- a/shell/src/main/java/org/apache/sqoop/shell/ShowConnectionFunction.java +++ /dev/null @@ -1,128 +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.shell; - -import org.apache.commons.cli.CommandLine; -import org.apache.commons.cli.OptionBuilder; -import org.apache.sqoop.model.MConnection; -import org.apache.sqoop.shell.core.Constants; -import org.apache.sqoop.shell.utils.TableDisplayer; -import org.apache.sqoop.validation.Status; - -import java.text.DateFormat; -import java.util.LinkedList; -import java.util.List; - -import static org.apache.sqoop.shell.ShellEnvironment.*; -import static org.apache.sqoop.shell.utils.FormDisplayer.*; - -/** - * - */ -@SuppressWarnings("serial") -public class ShowConnectionFunction extends SqoopFunction { - @SuppressWarnings("static-access") - public ShowConnectionFunction() { - this.addOption(OptionBuilder - .withDescription(resourceString(Constants.RES_SHOW_PROMPT_DISPLAY_ALL_CONNS)) - .withLongOpt(Constants.OPT_ALL) - .create(Constants.OPT_ALL_CHAR)); - this.addOption(OptionBuilder.hasArg().withArgName(Constants.OPT_FROM) - .withDescription(resourceString(Constants.RES_SHOW_PROMPT_DISPLAY_CONN_XID)) - .withLongOpt(Constants.OPT_FROM) - .create(Constants.OPT_XID_CHAR)); - } - - @Override - public Object executeFunction(CommandLine line, boolean isInteractive) { - if (line.hasOption(Constants.OPT_ALL)) { - showConnections(); - } else if (line.hasOption(Constants.OPT_FROM)) { - showConnection(getLong(line, Constants.OPT_FROM)); - } else { - showSummary(); - } - - return Status.FINE; - } - - private void showSummary() { - List<MConnection> connections = client.getConnections(); - - List<String> header = new LinkedList<String>(); - header.add(resourceString(Constants.RES_TABLE_HEADER_ID)); - header.add(resourceString(Constants.RES_TABLE_HEADER_NAME)); - header.add(resourceString(Constants.RES_TABLE_HEADER_CONNECTOR)); - header.add(resourceString(Constants.RES_TABLE_HEADER_ENABLED)); - - List<String> ids = new LinkedList<String>(); - List<String> names = new LinkedList<String>(); - List<String> connectors = new LinkedList<String>(); - List<String> availabilities = new LinkedList<String>(); - - for(MConnection connection : connections) { - ids.add(String.valueOf(connection.getPersistenceId())); - names.add(connection.getName()); - connectors.add(String.valueOf(connection.getConnectorId())); - availabilities.add(String.valueOf(connection.getEnabled())); - } - - TableDisplayer.display(header, ids, names, connectors, availabilities); - } - - private void showConnections() { - List<MConnection> connections = client.getConnections(); - - printlnResource(Constants.RES_SHOW_PROMPT_CONNS_TO_SHOW, connections.size()); - - for (MConnection connection : connections) { - displayConnection(connection); - } - } - - private void showConnection(Long xid) { - MConnection connection = client.getConnection(xid); - - printlnResource(Constants.RES_SHOW_PROMPT_CONNS_TO_SHOW, 1); - - displayConnection(connection); - } - - private void displayConnection(MConnection connection) { - DateFormat formatter = DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT); - - printlnResource(Constants.RES_SHOW_PROMPT_CONN_INFO, - connection.getPersistenceId(), - connection.getName(), - connection.getEnabled(), - connection.getCreationUser(), - formatter.format(connection.getCreationDate()), - connection.getLastUpdateUser(), - formatter.format(connection.getLastUpdateDate()) - ); - - long connectorId = connection.getConnectorId(); - printlnResource(Constants.RES_SHOW_PROMPT_CONN_CID_INFO, connectorId); - - // Display connector part - displayForms(connection.getConnectorPart().getForms(), - client.getResourceBundle(connectorId)); - displayForms(connection.getFrameworkPart().getForms(), - client.getFrameworkResourceBundle()); - } -} http://git-wip-us.apache.org/repos/asf/sqoop/blob/049994a0/shell/src/main/java/org/apache/sqoop/shell/ShowConnectorFunction.java ---------------------------------------------------------------------- diff --git a/shell/src/main/java/org/apache/sqoop/shell/ShowConnectorFunction.java b/shell/src/main/java/org/apache/sqoop/shell/ShowConnectorFunction.java index 50978ff..2ba75b4 100644 --- a/shell/src/main/java/org/apache/sqoop/shell/ShowConnectorFunction.java +++ b/shell/src/main/java/org/apache/sqoop/shell/ShowConnectorFunction.java @@ -115,7 +115,7 @@ public class ShowConnectorFunction extends SqoopFunction { connector.getVersion(), getSupportedDirections(connector) ); - displayFormMetadataDetails(connector, client.getResourceBundle(connector.getPersistenceId())); + displayFormMetadataDetails(connector, client.getConnectorConfigResourceBundle(connector.getPersistenceId())); } /** http://git-wip-us.apache.org/repos/asf/sqoop/blob/049994a0/shell/src/main/java/org/apache/sqoop/shell/ShowDriverConfigFunction.java ---------------------------------------------------------------------- diff --git a/shell/src/main/java/org/apache/sqoop/shell/ShowDriverConfigFunction.java b/shell/src/main/java/org/apache/sqoop/shell/ShowDriverConfigFunction.java new file mode 100644 index 0000000..e6e1004 --- /dev/null +++ b/shell/src/main/java/org/apache/sqoop/shell/ShowDriverConfigFunction.java @@ -0,0 +1,60 @@ +/** + * 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.shell; + +import org.apache.commons.cli.CommandLine; +import org.apache.sqoop.model.MDriverConfig; +import org.apache.sqoop.shell.core.Constants; +import org.apache.sqoop.validation.Status; + +import java.util.ResourceBundle; + +import static org.apache.sqoop.shell.ShellEnvironment.*; +import static org.apache.sqoop.shell.utils.FormDisplayer.*; + +/** + * + */ +@SuppressWarnings("serial") +public class ShowDriverConfigFunction extends SqoopFunction { + public ShowDriverConfigFunction() { + } + + @Override + public boolean validateArgs(CommandLine line) { + if (line.getArgs().length != 0) { + printlnResource(Constants.RES_SHOW_DRIVER_CONFIG_USAGE); + return false; + } + return true; + } + + @Override + public Object executeFunction(CommandLine line, boolean isInteractive) { + showFramework(); + return Status.FINE; + } + + private void showFramework() { + MDriverConfig framework = client.getDriverConfig(); + ResourceBundle bundle = client.getDriverConfigBundle(); + + printlnResource(Constants.RES_SHOW_PROMPT_DRIVER_CONFIG_OPTS, framework.getPersistenceId()); + displayFormMetadataDetails(framework, bundle); + } +} http://git-wip-us.apache.org/repos/asf/sqoop/blob/049994a0/shell/src/main/java/org/apache/sqoop/shell/ShowFrameworkFunction.java ---------------------------------------------------------------------- diff --git a/shell/src/main/java/org/apache/sqoop/shell/ShowFrameworkFunction.java b/shell/src/main/java/org/apache/sqoop/shell/ShowFrameworkFunction.java deleted file mode 100644 index 0c587b2..0000000 --- a/shell/src/main/java/org/apache/sqoop/shell/ShowFrameworkFunction.java +++ /dev/null @@ -1,60 +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.shell; - -import org.apache.commons.cli.CommandLine; -import org.apache.sqoop.model.MFramework; -import org.apache.sqoop.shell.core.Constants; -import org.apache.sqoop.validation.Status; - -import java.util.ResourceBundle; - -import static org.apache.sqoop.shell.ShellEnvironment.*; -import static org.apache.sqoop.shell.utils.FormDisplayer.*; - -/** - * - */ -@SuppressWarnings("serial") -public class ShowFrameworkFunction extends SqoopFunction { - public ShowFrameworkFunction() { - } - - @Override - public boolean validateArgs(CommandLine line) { - if (line.getArgs().length != 0) { - printlnResource(Constants.RES_SHOW_FRAMEWORK_USAGE); - return false; - } - return true; - } - - @Override - public Object executeFunction(CommandLine line, boolean isInteractive) { - showFramework(); - return Status.FINE; - } - - private void showFramework() { - MFramework framework = client.getFramework(); - ResourceBundle bundle = client.getFrameworkResourceBundle(); - - printlnResource(Constants.RES_SHOW_PROMPT_FRAMEWORK_OPTS, framework.getPersistenceId()); - displayFormMetadataDetails(framework, bundle); - } -} http://git-wip-us.apache.org/repos/asf/sqoop/blob/049994a0/shell/src/main/java/org/apache/sqoop/shell/ShowJobFunction.java ---------------------------------------------------------------------- diff --git a/shell/src/main/java/org/apache/sqoop/shell/ShowJobFunction.java b/shell/src/main/java/org/apache/sqoop/shell/ShowJobFunction.java index 2fcd729..e3f1f47 100644 --- a/shell/src/main/java/org/apache/sqoop/shell/ShowJobFunction.java +++ b/shell/src/main/java/org/apache/sqoop/shell/ShowJobFunction.java @@ -120,16 +120,16 @@ public class ShowJobFunction extends SqoopFunction { job.getLastUpdateUser(), formatter.format(job.getLastUpdateDate()) ); - printlnResource(Constants.RES_SHOW_PROMPT_JOB_XID_CID_INFO, - job.getConnectionId(Direction.FROM), + printlnResource(Constants.RES_SHOW_PROMPT_JOB_LID_CID_INFO, + job.getLinkId(Direction.FROM), job.getConnectorId(Direction.FROM)); // Display connector part displayForms(job.getConnectorPart(Direction.FROM).getForms(), - client.getResourceBundle(job.getConnectorId(Direction.FROM))); + client.getConnectorConfigResourceBundle(job.getConnectorId(Direction.FROM))); displayForms(job.getFrameworkPart().getForms(), - client.getFrameworkResourceBundle()); + client.getDriverConfigBundle()); displayForms(job.getConnectorPart(Direction.TO).getForms(), - client.getResourceBundle(job.getConnectorId(Direction.TO))); + client.getConnectorConfigResourceBundle(job.getConnectorId(Direction.TO))); } } http://git-wip-us.apache.org/repos/asf/sqoop/blob/049994a0/shell/src/main/java/org/apache/sqoop/shell/ShowLinkFunction.java ---------------------------------------------------------------------- diff --git a/shell/src/main/java/org/apache/sqoop/shell/ShowLinkFunction.java b/shell/src/main/java/org/apache/sqoop/shell/ShowLinkFunction.java new file mode 100644 index 0000000..f500b9e --- /dev/null +++ b/shell/src/main/java/org/apache/sqoop/shell/ShowLinkFunction.java @@ -0,0 +1,128 @@ +/** + * 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.shell; + +import org.apache.commons.cli.CommandLine; +import org.apache.commons.cli.OptionBuilder; +import org.apache.sqoop.model.MLink; +import org.apache.sqoop.shell.core.Constants; +import org.apache.sqoop.shell.utils.TableDisplayer; +import org.apache.sqoop.validation.Status; + +import java.text.DateFormat; +import java.util.LinkedList; +import java.util.List; + +import static org.apache.sqoop.shell.ShellEnvironment.*; +import static org.apache.sqoop.shell.utils.FormDisplayer.*; + +/** + * + */ +@SuppressWarnings("serial") +public class ShowLinkFunction extends SqoopFunction { + @SuppressWarnings("static-access") + public ShowLinkFunction() { + this.addOption(OptionBuilder + .withDescription(resourceString(Constants.RES_SHOW_PROMPT_DISPLAY_ALL_LINKS)) + .withLongOpt(Constants.OPT_ALL) + .create(Constants.OPT_ALL_CHAR)); + this.addOption(OptionBuilder.hasArg().withArgName(Constants.OPT_FROM) + .withDescription(resourceString(Constants.RES_SHOW_PROMPT_DISPLAY_LINK_LID)) + .withLongOpt(Constants.OPT_FROM) + .create(Constants.OPT_LID_CHAR)); + } + + @Override + public Object executeFunction(CommandLine line, boolean isInteractive) { + if (line.hasOption(Constants.OPT_ALL)) { + showLinks(); + } else if (line.hasOption(Constants.OPT_FROM)) { + showLink(getLong(line, Constants.OPT_FROM)); + } else { + showSummary(); + } + + return Status.FINE; + } + + private void showSummary() { + List<MLink> links = client.getLinks(); + + List<String> header = new LinkedList<String>(); + header.add(resourceString(Constants.RES_TABLE_HEADER_ID)); + header.add(resourceString(Constants.RES_TABLE_HEADER_NAME)); + header.add(resourceString(Constants.RES_TABLE_HEADER_CONNECTOR)); + header.add(resourceString(Constants.RES_TABLE_HEADER_ENABLED)); + + List<String> ids = new LinkedList<String>(); + List<String> names = new LinkedList<String>(); + List<String> connectors = new LinkedList<String>(); + List<String> availabilities = new LinkedList<String>(); + + for(MLink link : links) { + ids.add(String.valueOf(link.getPersistenceId())); + names.add(link.getName()); + connectors.add(String.valueOf(link.getConnectorId())); + availabilities.add(String.valueOf(link.getEnabled())); + } + + TableDisplayer.display(header, ids, names, connectors, availabilities); + } + + private void showLinks() { + List<MLink> links = client.getLinks(); + + printlnResource(Constants.RES_SHOW_PROMPT_LINKS_TO_SHOW, links.size()); + + for (MLink link : links) { + displayLink(link); + } + } + + private void showLink(Long xid) { + MLink link = client.getLink(xid); + + printlnResource(Constants.RES_SHOW_PROMPT_LINKS_TO_SHOW, 1); + + displayLink(link); + } + + private void displayLink(MLink connection) { + DateFormat formatter = DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT); + + printlnResource(Constants.RES_SHOW_PROMPT_LINK_INFO, + connection.getPersistenceId(), + connection.getName(), + connection.getEnabled(), + connection.getCreationUser(), + formatter.format(connection.getCreationDate()), + connection.getLastUpdateUser(), + formatter.format(connection.getLastUpdateDate()) + ); + + long connectorId = connection.getConnectorId(); + printlnResource(Constants.RES_SHOW_PROMPT_LINK_CID_INFO, connectorId); + + // Display connector part + displayForms(connection.getConnectorPart().getForms(), + client.getConnectorConfigResourceBundle(connectorId)); + displayForms(connection.getFrameworkPart().getForms(), + client.getDriverConfigBundle()); + } +} http://git-wip-us.apache.org/repos/asf/sqoop/blob/049994a0/shell/src/main/java/org/apache/sqoop/shell/ShowVersionFunction.java ---------------------------------------------------------------------- diff --git a/shell/src/main/java/org/apache/sqoop/shell/ShowVersionFunction.java b/shell/src/main/java/org/apache/sqoop/shell/ShowVersionFunction.java index 6cb28e5..4e7ad38 100644 --- a/shell/src/main/java/org/apache/sqoop/shell/ShowVersionFunction.java +++ b/shell/src/main/java/org/apache/sqoop/shell/ShowVersionFunction.java @@ -21,7 +21,7 @@ import java.util.Arrays; import org.apache.commons.cli.CommandLine; import org.apache.commons.cli.OptionBuilder; -import org.apache.sqoop.client.request.VersionRequest; +import org.apache.sqoop.client.request.VersionResourceRequest; import org.apache.sqoop.common.VersionInfo; import org.apache.sqoop.json.VersionBean; import org.apache.sqoop.shell.core.Constants; @@ -31,7 +31,7 @@ import static org.apache.sqoop.shell.ShellEnvironment.*; @SuppressWarnings("serial") public class ShowVersionFunction extends SqoopFunction { - private VersionRequest versionRequest; + private VersionResourceRequest versionRequest; @SuppressWarnings("static-access") @@ -106,9 +106,9 @@ public class ShowVersionFunction extends SqoopFunction { } if (versionRequest == null) { - versionRequest = new VersionRequest(); + versionRequest = new VersionResourceRequest(); } - VersionBean versionBean = versionRequest.doGet(getServerUrl()); + VersionBean versionBean = versionRequest.read(getServerUrl()); if (server) { printlnResource(Constants.RES_SHOW_PROMPT_VERSION_CLIENT_SERVER, http://git-wip-us.apache.org/repos/asf/sqoop/blob/049994a0/shell/src/main/java/org/apache/sqoop/shell/UpdateCommand.java ---------------------------------------------------------------------- diff --git a/shell/src/main/java/org/apache/sqoop/shell/UpdateCommand.java b/shell/src/main/java/org/apache/sqoop/shell/UpdateCommand.java index d291c42..c75d5f5 100644 --- a/shell/src/main/java/org/apache/sqoop/shell/UpdateCommand.java +++ b/shell/src/main/java/org/apache/sqoop/shell/UpdateCommand.java @@ -31,7 +31,7 @@ public class UpdateCommand extends SqoopCommand { Constants.CMD_UPDATE, Constants.CMD_UPDATE_SC, ImmutableMap.of( - Constants.FN_CONNECTION, UpdateConnectionFunction.class, + Constants.FN_LINK, UpdateLinkFunction.class, Constants.FN_JOB, UpdateJobFunction.class ) ); http://git-wip-us.apache.org/repos/asf/sqoop/blob/049994a0/shell/src/main/java/org/apache/sqoop/shell/UpdateConnectionFunction.java ---------------------------------------------------------------------- diff --git a/shell/src/main/java/org/apache/sqoop/shell/UpdateConnectionFunction.java b/shell/src/main/java/org/apache/sqoop/shell/UpdateConnectionFunction.java deleted file mode 100644 index 405b0ea..0000000 --- a/shell/src/main/java/org/apache/sqoop/shell/UpdateConnectionFunction.java +++ /dev/null @@ -1,107 +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.shell; - -import jline.ConsoleReader; -import org.apache.commons.cli.CommandLine; -import org.apache.commons.cli.OptionBuilder; -import org.apache.sqoop.model.MConnection; -import org.apache.sqoop.shell.core.Constants; -import org.apache.sqoop.shell.utils.ConnectionDynamicFormOptions; -import org.apache.sqoop.shell.utils.FormDisplayer; -import org.apache.sqoop.shell.utils.FormOptions; -import org.apache.sqoop.validation.Status; - -import java.io.IOException; -import java.util.List; -import java.util.ResourceBundle; - -import static org.apache.sqoop.shell.ShellEnvironment.*; -import static org.apache.sqoop.shell.utils.FormFiller.*; - -/** - * - */ -@SuppressWarnings("serial") -public class UpdateConnectionFunction extends SqoopFunction { - @SuppressWarnings("static-access") - public UpdateConnectionFunction() { - this.addOption(OptionBuilder - .withDescription(resourceString(Constants.RES_PROMPT_CONN_ID)) - .withLongOpt(Constants.OPT_XID) - .isRequired() - .hasArg() - .create(Constants.OPT_XID_CHAR)); - } - - @Override - @SuppressWarnings("unchecked") - public Object executeFunction(CommandLine line, boolean isInteractive) throws IOException { - return updateConnection(getLong(line, Constants.OPT_XID), line.getArgList(), isInteractive); - } - - private Status updateConnection(Long connectionId, List<String> args, boolean isInteractive) throws IOException { - printlnResource(Constants.RES_UPDATE_UPDATING_CONN, connectionId); - - ConsoleReader reader = new ConsoleReader(); - - MConnection connection = client.getConnection(connectionId); - - ResourceBundle connectorBundle = client.getResourceBundle(connection.getConnectorId()); - ResourceBundle frameworkBundle = client.getFrameworkResourceBundle(); - - Status status = Status.FINE; - - if (isInteractive) { - printlnResource(Constants.RES_PROMPT_UPDATE_CONN_METADATA); - - do { - // Print error introduction if needed - if( !status.canProceed() ) { - errorIntroduction(); - } - - // Fill in data from user - if(!fillConnection(reader, connection, connectorBundle, frameworkBundle)) { - return null; - } - - // Try to create - status = client.updateConnection(connection); - } while(!status.canProceed()); - } else { - ConnectionDynamicFormOptions options = new ConnectionDynamicFormOptions(); - options.prepareOptions(connection); - CommandLine line = FormOptions.parseOptions(options, 0, args, false); - if (fillConnection(line, connection)) { - status = client.updateConnection(connection); - if (!status.canProceed()) { - printConnectionValidationMessages(connection); - return null; - } - } else { - printConnectionValidationMessages(connection); - return null; - } - } - FormDisplayer.displayFormWarning(connection); - printlnResource(Constants.RES_UPDATE_CONN_SUCCESSFUL, status.name()); - - return status; - } -} http://git-wip-us.apache.org/repos/asf/sqoop/blob/049994a0/shell/src/main/java/org/apache/sqoop/shell/UpdateJobFunction.java ---------------------------------------------------------------------- diff --git a/shell/src/main/java/org/apache/sqoop/shell/UpdateJobFunction.java b/shell/src/main/java/org/apache/sqoop/shell/UpdateJobFunction.java index 9fc9181..96d1fd8 100644 --- a/shell/src/main/java/org/apache/sqoop/shell/UpdateJobFunction.java +++ b/shell/src/main/java/org/apache/sqoop/shell/UpdateJobFunction.java @@ -63,16 +63,16 @@ public class UpdateJobFunction extends SqoopFunction { MJob job = client.getJob(jobId); - ResourceBundle fromConnectorBundle = client.getResourceBundle( + ResourceBundle fromConnectorBundle = client.getConnectorConfigResourceBundle( job.getConnectorId(Direction.FROM)); - ResourceBundle frameworkBundle = client.getFrameworkResourceBundle(); - ResourceBundle toConnectorBundle = client.getResourceBundle( + ResourceBundle driverConfigBundle = client.getDriverConfigBundle(); + ResourceBundle toConnectorBundle = client.getConnectorConfigResourceBundle( job.getConnectorId(Direction.TO)); Status status = Status.FINE; if (isInteractive) { - printlnResource(Constants.RES_PROMPT_UPDATE_JOB_METADATA); + printlnResource(Constants.RES_PROMPT_UPDATE_JOB_CONFIG); do { // Print error introduction if needed @@ -81,7 +81,7 @@ public class UpdateJobFunction extends SqoopFunction { } // Fill in data from user - if(!fillJob(reader, job, fromConnectorBundle, frameworkBundle, toConnectorBundle)) { + if(!fillJob(reader, job, fromConnectorBundle, driverConfigBundle, toConnectorBundle)) { return status; } http://git-wip-us.apache.org/repos/asf/sqoop/blob/049994a0/shell/src/main/java/org/apache/sqoop/shell/UpdateLinkFunction.java ---------------------------------------------------------------------- diff --git a/shell/src/main/java/org/apache/sqoop/shell/UpdateLinkFunction.java b/shell/src/main/java/org/apache/sqoop/shell/UpdateLinkFunction.java new file mode 100644 index 0000000..30bb63e --- /dev/null +++ b/shell/src/main/java/org/apache/sqoop/shell/UpdateLinkFunction.java @@ -0,0 +1,107 @@ +/** + * 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.shell; + +import jline.ConsoleReader; +import org.apache.commons.cli.CommandLine; +import org.apache.commons.cli.OptionBuilder; +import org.apache.sqoop.model.MLink; +import org.apache.sqoop.shell.core.Constants; +import org.apache.sqoop.shell.utils.LinkDynamicFormOptions; +import org.apache.sqoop.shell.utils.FormDisplayer; +import org.apache.sqoop.shell.utils.FormOptions; +import org.apache.sqoop.validation.Status; + +import java.io.IOException; +import java.util.List; +import java.util.ResourceBundle; + +import static org.apache.sqoop.shell.ShellEnvironment.*; +import static org.apache.sqoop.shell.utils.FormFiller.*; + +/** + * + */ +@SuppressWarnings("serial") +public class UpdateLinkFunction extends SqoopFunction { + @SuppressWarnings("static-access") + public UpdateLinkFunction() { + this.addOption(OptionBuilder + .withDescription(resourceString(Constants.RES_PROMPT_LINK_ID)) + .withLongOpt(Constants.OPT_LID) + .isRequired() + .hasArg() + .create(Constants.OPT_LID_CHAR)); + } + + @Override + @SuppressWarnings("unchecked") + public Object executeFunction(CommandLine line, boolean isInteractive) throws IOException { + return updateLink(getLong(line, Constants.OPT_LID), line.getArgList(), isInteractive); + } + + private Status updateLink(Long linkId, List<String> args, boolean isInteractive) throws IOException { + printlnResource(Constants.RES_UPDATE_UPDATING_LINK, linkId); + + ConsoleReader reader = new ConsoleReader(); + + MLink link = client.getLink(linkId); + + ResourceBundle connectorConfigBundle = client.getConnectorConfigResourceBundle(link.getConnectorId()); + ResourceBundle driverConfigBundle = client.getDriverConfigBundle(); + + Status status = Status.FINE; + + if (isInteractive) { + printlnResource(Constants.RES_PROMPT_UPDATE_LINK_CONFIG); + + do { + // Print error introduction if needed + if( !status.canProceed() ) { + errorIntroduction(); + } + + // Fill in data from user + if(!fillLink(reader, link, connectorConfigBundle, driverConfigBundle)) { + return null; + } + + // Try to create + status = client.updateLink(link); + } while(!status.canProceed()); + } else { + LinkDynamicFormOptions options = new LinkDynamicFormOptions(); + options.prepareOptions(link); + CommandLine line = FormOptions.parseOptions(options, 0, args, false); + if (fillConnection(line, link)) { + status = client.updateLink(link); + if (!status.canProceed()) { + printLinkValidationMessages(link); + return null; + } + } else { + printLinkValidationMessages(link); + return null; + } + } + FormDisplayer.displayFormWarning(link); + printlnResource(Constants.RES_UPDATE_LINK_SUCCESSFUL, status.name()); + + return status; + } +} http://git-wip-us.apache.org/repos/asf/sqoop/blob/049994a0/shell/src/main/java/org/apache/sqoop/shell/core/Constants.java ---------------------------------------------------------------------- diff --git a/shell/src/main/java/org/apache/sqoop/shell/core/Constants.java b/shell/src/main/java/org/apache/sqoop/shell/core/Constants.java index f0dc3a6..4d3838c 100644 --- a/shell/src/main/java/org/apache/sqoop/shell/core/Constants.java +++ b/shell/src/main/java/org/apache/sqoop/shell/core/Constants.java @@ -34,7 +34,7 @@ public class Constants { // Options - public static final String OPT_XID = "xid"; + public static final String OPT_LID = "lid"; public static final String OPT_FROM = "from"; public static final String OPT_TO = "to"; public static final String OPT_ALL = "all"; @@ -54,9 +54,9 @@ public class Constants { 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_FXID_CHAR = 'f'; - public static final char OPT_TXID_CHAR = 't'; + public static final char OPT_LID_CHAR = 'l'; + public static final char OPT_FROM_CHAR = 'f'; + public static final char OPT_TO_CHAR = 't'; public static final char OPT_ALL_CHAR = 'a'; public static final char OPT_JID_CHAR = 'j'; public static final char OPT_CID_CHAR = 'c'; @@ -111,14 +111,14 @@ public class Constants { 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_LINK = "link"; 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 FN_DRIVER_CONFIG = "driverConfig"; public static final String PROP_HOMEDIR = "user.home"; public static final String PROP_CURDIR = "user.dir"; @@ -130,8 +130,8 @@ public class Constants { // Resource Keys for various messages - public static final String RES_ARGS_XID_MISSING = - "args.xid_missing"; + public static final String RES_ARGS_LID_MISSING = + "args.lid_missing"; public static final String RES_ARGS_FROM_MISSING = "args.from_missing"; public static final String RES_ARGS_TO_MISSING = @@ -145,46 +145,46 @@ public class Constants { 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_LINK_ID = + "prompt.link_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_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_CONN_SUCCESSFUL = - "clone.conn.successful"; + public static final String RES_PROMPT_UPDATE_LINK_CONFIG = + "prompt.update_link_config"; + public static final String RES_PROMPT_UPDATE_JOB_CONFIG = + "prompt.update_job_config"; + public static final String RES_PROMPT_FILL_LINK_CONFIG = + "prompt.fill_link_config"; + public static final String RES_PROMPT_FILL_JOB_CONFIG = + "prompt.fill_job_config"; + + public static final String RES_CLONE_LINK_SUCCESSFUL = + "clone.link.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_LINK = + "clone.cloning_link"; public static final String RES_CLONE_CLONING_JOB = "clone.cloning_job"; - public static final String RES_CREATE_CONN_SUCCESSFUL = - "create.conn_successful"; + public static final String RES_CREATE_LINK_SUCCESSFUL = + "create.link_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_LINK = + "create.creating_link"; public static final String RES_CREATE_CREATING_JOB = "create.creating_job"; - public static final String RES_DISABLE_CONNECTION_SUCCESSFUL = - "disable.conn_successful"; + public static final String RES_DISABLE_LINK_SUCCESSFUL = + "disable.link_successful"; public static final String RES_DISABLE_JOB_SUCCESSFUL = "disable.job_successful"; - public static final String RES_ENABLE_CONNECTION_SUCCESSFUL = - "enable.conn_successful"; + public static final String RES_ENABLE_LINK_SUCCESSFUL = + "enable.link_successful"; public static final String RES_ENABLE_JOB_SUCCESSFUL = "enable.job_successful"; @@ -233,16 +233,16 @@ public class Constants { public static final String RES_SET_SERVER_IGNORED = "set.server_ignored"; - 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_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_LINKS = + "show.prompt_display_all_links"; + public static final String RES_SHOW_PROMPT_DISPLAY_LINK_LID = + "show.prompt_display_link_lid"; + public static final String RES_SHOW_PROMPT_LINKS_TO_SHOW = + "show.prompt_links_to_show"; + public static final String RES_SHOW_PROMPT_LINK_INFO = + "show.prompt_link_info"; + public static final String RES_SHOW_PROMPT_LINK_CID_INFO = + "show.prompt_link_cid_info"; public static final String RES_SHOW_PROMPT_DISPLAY_ALL_CONNECTORS = "show.prompt_display_all_connectors"; @@ -253,10 +253,10 @@ public class Constants { 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_DRIVER_CONFIG_USAGE = + "show.driver_config_usage"; + public static final String RES_SHOW_PROMPT_DRIVER_CONFIG_OPTS = + "show.prompt_driver_config_opts"; public static final String RES_SHOW_PROMPT_DISPLAY_ALL_JOBS = "show.prompt_display_all_jobs"; @@ -266,8 +266,8 @@ public class Constants { "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_JOB_LID_CID_INFO = + "show.prompt_job_lid_cid_info"; public static final String RES_SHOW_PROMPT_DISPLAY_ALL_SUBMISSIONS = "show.prompt_display_all_submissions"; @@ -316,10 +316,10 @@ public class Constants { public static final String RES_SQOOP_PROMPT_SHELL_LOADEDRC = "sqoop.prompt_shell_loadedrc"; - 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_LINK = + "update.link"; + public static final String RES_UPDATE_LINK_SUCCESSFUL = + "update.link_successful"; public static final String RES_UPDATE_UPDATING_JOB = "update.job"; public static final String RES_UPDATE_JOB_SUCCESSFUL = @@ -353,7 +353,7 @@ public class Constants { "table.header.enabled"; public static final String RES_FORMDISPLAYER_CONNECTION = - "formdisplayer.connection"; + "formdisplayer.link"; public static final String RES_FORMDISPLAYER_JOB = "formdisplayer.job"; public static final String RES_FORMDISPLAYER_FORM = @@ -402,10 +402,10 @@ public class Constants { "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"; + public static final String RES_FROM_SCHEMA = + "submission.from_schema"; + public static final String RES_TO_SCHEMA = + "submission.to_schema"; private Constants() { // Instantiation is prohibited http://git-wip-us.apache.org/repos/asf/sqoop/blob/049994a0/shell/src/main/java/org/apache/sqoop/shell/utils/ConnectionDynamicFormOptions.java ---------------------------------------------------------------------- diff --git a/shell/src/main/java/org/apache/sqoop/shell/utils/ConnectionDynamicFormOptions.java b/shell/src/main/java/org/apache/sqoop/shell/utils/ConnectionDynamicFormOptions.java deleted file mode 100644 index 6b6e858..0000000 --- a/shell/src/main/java/org/apache/sqoop/shell/utils/ConnectionDynamicFormOptions.java +++ /dev/null @@ -1,44 +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.shell.utils; - -import org.apache.commons.cli.Option; -import org.apache.commons.cli.OptionBuilder; -import org.apache.sqoop.model.MConnection; - -/** - * Automatically create dynamic options for connections. - */ -@SuppressWarnings("serial") -public class ConnectionDynamicFormOptions extends DynamicFormOptions<MConnection> { - - @SuppressWarnings("static-access") - @Override - public void prepareOptions(MConnection connection) { - this.addOption(OptionBuilder - .withLongOpt("name") - .hasArg() - .create()); - for (Option option : FormOptions.getFormsOptions("connector", connection.getConnectorPart().getForms())) { - this.addOption(option); - } - for (Option option : FormOptions.getFormsOptions("framework", connection.getFrameworkPart().getForms())) { - this.addOption(option); - } - } -} http://git-wip-us.apache.org/repos/asf/sqoop/blob/049994a0/shell/src/main/java/org/apache/sqoop/shell/utils/FormDisplayer.java ---------------------------------------------------------------------- diff --git a/shell/src/main/java/org/apache/sqoop/shell/utils/FormDisplayer.java b/shell/src/main/java/org/apache/sqoop/shell/utils/FormDisplayer.java index bbad183..dcbccef 100644 --- a/shell/src/main/java/org/apache/sqoop/shell/utils/FormDisplayer.java +++ b/shell/src/main/java/org/apache/sqoop/shell/utils/FormDisplayer.java @@ -21,11 +21,11 @@ import org.apache.commons.lang.StringUtils; import org.apache.sqoop.common.Direction; import org.apache.sqoop.model.MAccountableEntity; import org.apache.sqoop.model.MBooleanInput; -import org.apache.sqoop.model.MConnection; +import org.apache.sqoop.model.MLink; import org.apache.sqoop.model.MConnector; import org.apache.sqoop.model.MEnumInput; import org.apache.sqoop.model.MForm; -import org.apache.sqoop.model.MFramework; +import org.apache.sqoop.model.MDriverConfig; import org.apache.sqoop.model.MInput; import org.apache.sqoop.model.MInputType; import org.apache.sqoop.model.MIntegerInput; @@ -49,15 +49,15 @@ import static org.apache.sqoop.shell.ShellEnvironment.*; */ public final class FormDisplayer { - public static void displayFormMetadataDetails(MFramework framework, + public static void displayFormMetadataDetails(MDriverConfig driverConfig, ResourceBundle bundle) { displayFormsMetadata( - framework.getConnectionForms().getForms(), + driverConfig.getConnectionForms().getForms(), resourceString(Constants.RES_FORMDISPLAYER_CONNECTION), bundle); displayFormsMetadata( - framework.getJobForms().getForms(), + driverConfig.getJobForms().getForms(), resourceString(Constants.RES_FORMDISPLAYER_JOB), bundle); } @@ -143,15 +143,15 @@ public final class FormDisplayer { /** * Method prints the warning message of ACCEPTABLE status - * @param entity - connection or job instance + * @param entity - link or job instance */ public static void displayFormWarning(MAccountableEntity entity) { List<MForm> formList = new ArrayList<MForm>(); boolean showMessage = true; - if (entity instanceof MConnection) { - MConnection connection = (MConnection) entity; - formList.addAll(connection.getConnectorPart().getForms()); - formList.addAll(connection.getFrameworkPart().getForms()); + if (entity instanceof MLink) { + MLink link = (MLink) entity; + formList.addAll(link.getConnectorPart().getForms()); + formList.addAll(link.getFrameworkPart().getForms()); } else if(entity instanceof MJob) { MJob job = (MJob) entity; formList.addAll(job.getConnectorPart(Direction.FROM).getForms()); http://git-wip-us.apache.org/repos/asf/sqoop/blob/049994a0/shell/src/main/java/org/apache/sqoop/shell/utils/FormFiller.java ---------------------------------------------------------------------- diff --git a/shell/src/main/java/org/apache/sqoop/shell/utils/FormFiller.java b/shell/src/main/java/org/apache/sqoop/shell/utils/FormFiller.java index bbf7af7..a0a5dc2 100644 --- a/shell/src/main/java/org/apache/sqoop/shell/utils/FormFiller.java +++ b/shell/src/main/java/org/apache/sqoop/shell/utils/FormFiller.java @@ -23,7 +23,7 @@ import org.apache.commons.cli.CommandLine; import org.apache.commons.lang.StringUtils; import org.apache.sqoop.common.Direction; import org.apache.sqoop.model.MBooleanInput; -import org.apache.sqoop.model.MConnection; +import org.apache.sqoop.model.MLink; import org.apache.sqoop.model.MEnumInput; import org.apache.sqoop.model.MForm; import org.apache.sqoop.model.MInput; @@ -50,7 +50,7 @@ import static org.apache.sqoop.shell.ShellEnvironment.*; public final class FormFiller { /** - * Internal input that will be reused for loading names for connection and + * Internal input that will be reused for loading names for link and * job objects. */ private static MStringInput nameInput = new MStringInput("object-name", false, (short)25); @@ -81,14 +81,14 @@ public final class FormFiller { * @param reader Associated console reader object * @param job Job that user is suppose to fill in * @param fromConnectorBundle Connector resource bundle - * @param frameworkBundle Framework resource bundle + * @param driverConfigBundle Driver config resource bundle * @return True if we filled all inputs, false if user has stopped processing * @throws IOException */ public static boolean fillJob(ConsoleReader reader, MJob job, ResourceBundle fromConnectorBundle, - ResourceBundle frameworkBundle, + ResourceBundle driverConfigBundle, ResourceBundle toConnectorBundle) throws IOException { @@ -99,55 +99,55 @@ public final class FormFiller { job.getConnectorPart(Direction.FROM).getForms(), fromConnectorBundle, job.getFrameworkPart().getForms(), - frameworkBundle, + driverConfigBundle, job.getConnectorPart(Direction.TO).getForms(), toConnectorBundle); } /** - * Fill connection object based on CLI options. + * Fill link object based on CLI options. * * @param line Associated command line options - * @param connection Connection that user is suppose to fill in + * @param link Link that user is suppose to fill in * @return True if we filled all inputs, false if user has stopped processing * @throws IOException */ public static boolean fillConnection(CommandLine line, - MConnection connection) + MLink link) throws IOException { - connection.setName(line.getOptionValue("name")); + link.setName(line.getOptionValue("name")); // Fill in data from user return fillForms(line, - connection.getConnectorPart().getForms(), - connection.getFrameworkPart().getForms()); + link.getConnectorPart().getForms(), + link.getFrameworkPart().getForms()); } /** - * Fill connection object based on user input. + * Fill link object based on user input. * * @param reader Associated console reader object - * @param connection Connection that user is suppose to fill in - * @param connectorBundle Connector resource bundle - * @param frameworkBundle Framework resouce bundle + * @param link Link that user is suppose to fill in + * @param connectorConfigBundle Connector resource bundle + * @param driverConfigBundle Driver config resource bundle * @return True if we filled all inputs, false if user has stopped processing * @throws IOException */ - public static boolean fillConnection(ConsoleReader reader, - MConnection connection, - ResourceBundle connectorBundle, - ResourceBundle frameworkBundle) + public static boolean fillLink(ConsoleReader reader, + MLink link, + ResourceBundle connectorConfigBundle, + ResourceBundle driverConfigBundle) throws IOException { - connection.setName(getName(reader, connection.getName())); + link.setName(getName(reader, link.getName())); // Fill in data from user return fillForms(reader, - connection.getConnectorPart().getForms(), - connectorBundle, - connection.getFrameworkPart().getForms(), - frameworkBundle); + link.getConnectorPart().getForms(), + connectorConfigBundle, + link.getFrameworkPart().getForms(), + driverConfigBundle); } /** @@ -391,18 +391,18 @@ public final class FormFiller { public static boolean fillForms(ConsoleReader reader, List<MForm> connectorForms, - ResourceBundle connectorBundle, + ResourceBundle connectorConfigBundle, List<MForm> frameworkForms, - ResourceBundle frameworkBundle) throws IOException { + ResourceBundle driverConfigBundle) throws IOException { // Query connector forms - if(!fillForms(connectorForms, reader, connectorBundle)) { + if(!fillForms(connectorForms, reader, connectorConfigBundle)) { return false; } // Query framework forms - if(!fillForms(frameworkForms, reader, frameworkBundle)) { + if(!fillForms(frameworkForms, reader, driverConfigBundle)) { return false; } return true; @@ -412,7 +412,7 @@ public final class FormFiller { List<MForm> fromConnectorForms, ResourceBundle fromConnectorBundle, List<MForm> frameworkForms, - ResourceBundle frameworkBundle, + ResourceBundle driverConfigBundle, List<MForm> toConnectorForms, ResourceBundle toConnectorBundle) throws IOException { @@ -423,7 +423,7 @@ public final class FormFiller { } // Query framework forms - if(!fillForms(frameworkForms, reader, frameworkBundle)) { + if(!fillForms(frameworkForms, reader, driverConfigBundle)) { return false; } @@ -902,13 +902,13 @@ public final class FormFiller { println("@|red There are issues with entered data, please revise your input:|@"); } - public static void printConnectionValidationMessages(MConnection connection) { - for (MForm form : connection.getConnectorPart().getForms()) { + public static void printLinkValidationMessages(MLink link) { + for (MForm form : link.getConnectorPart().getForms()) { for (MInput<?> input : form.getInputs()) { printValidationMessage(input, true); } } - for (MForm form : connection.getFrameworkPart().getForms()) { + for (MForm form : link.getFrameworkPart().getForms()) { for (MInput<?> input : form.getInputs()) { printValidationMessage(input, true); } http://git-wip-us.apache.org/repos/asf/sqoop/blob/049994a0/shell/src/main/java/org/apache/sqoop/shell/utils/LinkDynamicFormOptions.java ---------------------------------------------------------------------- diff --git a/shell/src/main/java/org/apache/sqoop/shell/utils/LinkDynamicFormOptions.java b/shell/src/main/java/org/apache/sqoop/shell/utils/LinkDynamicFormOptions.java new file mode 100644 index 0000000..2952be2 --- /dev/null +++ b/shell/src/main/java/org/apache/sqoop/shell/utils/LinkDynamicFormOptions.java @@ -0,0 +1,43 @@ +/** + * 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.shell.utils; + +import org.apache.commons.cli.Option; +import org.apache.commons.cli.OptionBuilder; +import org.apache.sqoop.model.MLink; + +/** + * Automatically create dynamic options for connections. + */ +@SuppressWarnings("serial") +public class LinkDynamicFormOptions extends DynamicFormOptions<MLink> { + + @SuppressWarnings("static-access") + @Override + public void prepareOptions(MLink link) { + this.addOption(OptionBuilder.withLongOpt("name").hasArg().create()); + for (Option option : FormOptions.getFormsOptions("connector", link.getConnectorPart() + .getForms())) { + this.addOption(option); + } + for (Option option : FormOptions.getFormsOptions("framework", link.getFrameworkPart() + .getForms())) { + this.addOption(option); + } + } +} http://git-wip-us.apache.org/repos/asf/sqoop/blob/049994a0/shell/src/main/java/org/apache/sqoop/shell/utils/SubmissionDisplayer.java ---------------------------------------------------------------------- diff --git a/shell/src/main/java/org/apache/sqoop/shell/utils/SubmissionDisplayer.java b/shell/src/main/java/org/apache/sqoop/shell/utils/SubmissionDisplayer.java index 51f778b..60acfb6 100644 --- a/shell/src/main/java/org/apache/sqoop/shell/utils/SubmissionDisplayer.java +++ b/shell/src/main/java/org/apache/sqoop/shell/utils/SubmissionDisplayer.java @@ -69,12 +69,12 @@ public final class SubmissionDisplayer { } if(isVerbose() && submission.getFromSchema() != null) { - print(resourceString(Constants.RES_CONNECTOR_SCHEMA)+": "); + print(resourceString(Constants.RES_FROM_SCHEMA)+": "); println(submission.getFromSchema()); } if(isVerbose() && submission.getToSchema() != null) { - print(resourceString(Constants.RES_HIO_SCHEMA)+": "); + print(resourceString(Constants.RES_TO_SCHEMA)+": "); println(submission.getToSchema()); } } http://git-wip-us.apache.org/repos/asf/sqoop/blob/049994a0/shell/src/main/resources/shell-resource.properties ---------------------------------------------------------------------- diff --git a/shell/src/main/resources/shell-resource.properties b/shell/src/main/resources/shell-resource.properties index 247ceae..b59bd81 100644 --- a/shell/src/main/resources/shell-resource.properties +++ b/shell/src/main/resources/shell-resource.properties @@ -32,65 +32,65 @@ shared.usage = @|bold Usage:|@ {0} {1} shared.unknown.function = The specified function "{0}" is not recognized. # Argument related -args.xid_missing = Required argument --xid is missing. +args.lid_missing = Required argument --link Id is missing. args.from_missing = Required argument --from is missing. args.to_missing = Required argument --to is missing. -args.jid_missing = Required argument --jid is missing. -args.cid_missing = Required argument --cid is missing. +args.jid_missing = Required argument --job Id is missing. +args.cid_missing = Required argument --connector Id is missing. args.name_missing = Required argument --name is missing. args.value_missing = Required argument --value is missing. ## Generic description of various ids, types etc -prompt.conn_id = Connection ID -prompt.connector_id = Connector ID -prompt.job_id = Job ID +prompt.link_id = Link Id +prompt.connector_id = Connector Id +prompt.job_id = Job Id prompt.job_type = Job type -## Prompt messages for updating, filling metadata info +## Prompt messages for updating, filling entity info -prompt.update_conn_metadata = Please update connection metadata: -prompt.update_job_metadata = Please update job metadata: -prompt.fill_conn_metadata = Please fill following values to create new \ -connection object -prompt.fill_job_metadata = Please fill following values to create new \ +prompt.update_link_config = Please update link: +prompt.update_job_config = Please update job: +prompt.fill_link_config = Please fill following values to create new \ +link object +prompt.fill_job_config = Please fill following values to create new \ job object # Update command update.description = Update objects in Sqoop repository -update.conn = Updating connection with id {0} +update.link = Updating link with id {0} update.job = Updating job with id {0} -update.conn_successful = Connection was successfully updated with status {0} +update.link_successful = link was successfully updated with status {0} update.job_successful = Job was successfully updated with status {0} # Clone command clone.description = Create new object based on existing one -clone.conn.successful = Connection was successfully created with validation \ +clone.link.successful = link was successfully created with validation \ status {0} and persistent id {1} clone.job.successful = Job was successfully created with validation \ status {0} and persistent id {1} -clone.cloning_conn = Cloning connection with id {0} +clone.cloning_link = Cloning link with id {0} clone.cloning_job = Cloning job with id {0} # Create command create.description = Create new object in Sqoop repository -create.conn_successful = New connection was successfully created with \ +create.link_successful = New link was successfully created with \ validation status {0} and persistent id {1} create.job_successful = New job was successfully created with validation \ status {0} and persistent id {1} -create.creating_conn = Creating connection for connector with id {0} -create.creating_job = Creating job for connections with id {0} and {1} +create.creating_link = Creating link for connector with id {0} +create.creating_job = Creating job for links with from id {0} and to id {1} # Delete command delete.description = Delete existing object in Sqoop repository # Enable command enable.description = Enable object in Sqoop repository -enable.conn_successful = Connection {0} was successfully enabled +enable.link_successful = link {0} was successfully enabled enable.job_successful = Job {0} was successfully enabled # Disable command disable.description = Disable object in Sqoop repository -disable.conn_successful = Connection {0} was successfully disabled +disable.link_successful = link {0} was successfully disabled disable.job_successful = Job {0} was successfully disabled # Help command @@ -126,12 +126,12 @@ set.server_ignored = --host, --port or --webapp option is ignored, because --url # Show command show.description = Display various objects and configuration options -show.prompt_display_all_conns = Display all connections -show.prompt_display_conn_xid = Display the connection with xid -show.conn_usage = Usage: show connection -show.prompt_conns_to_show = @|bold {0} connection(s) to show: |@ -show.prompt_conn_info = Connection with id {0} and name {1} (Enabled: {2}, Created by {3} at {4}, Updated by {5} at {6}) -show.prompt_conn_cid_info = Using Connector id {0} +show.prompt_display_all_links = Display all links +show.prompt_display_link_lid = Display the link with lid +show.link_usage = Usage: show link +show.prompt_links_to_show = @|bold {0} link(s) to show: |@ +show.prompt_link_info = link with id {0} and name {1} (Enabled: {2}, Created by {3} at {4}, Updated by {5} at {6}) +show.prompt_link_cid_info = Using Connector id {0} show.prompt_display_all_connectors = Display all connectors show.prompt_display_connector_cid = Display the connector with cid @@ -140,15 +140,15 @@ show.prompt_connectors_to_show = @|bold {0} connector(s) to show: |@ show.prompt_connector_info = Connector with id {0}:\n Name: {1} \n \ Class: {2}\n Version: {3}\n Supported Directions {4} -show.framework_usage = Usage: show framework -show.prompt_framework_opts = @|bold Framework specific options: |@\nPersistent id: {0} +show.driver_config_usage = Usage: show driver config +show.prompt_driver_config_opts = @|bold Driver config specific options: |@\nPersistent id: {0} show.prompt_display_all_jobs = Display all jobs show.prompt_display_job_jid = Display jobwith given jid show.job_usage = Usage: show job show.prompt_jobs_to_show = @|bold {0} job(s) to show: |@ show.prompt_job_info = Job with id {0} and name {1} (Enabled: {2}, Created by {3} at {4}, Updated by {5} at {6}) -show.prompt_job_xid_cid_info = Using Connection id {0} and Connector id {1} +show.prompt_job_lid_cid_info = Using link id {0} and Connector id {1} show.prompt_display_all_submissions = Display all submissions show.prompt_display_all_submissions_jid = Display all submissions given jid @@ -201,7 +201,7 @@ table.header.date = Last Update Date table.header.enabled = Enabled #Form displayer resources -formdisplayer.connection = Connection +formdisplayer.link = link formdisplayer.job = Job formdisplayer.form = form formdisplayer.name = Name @@ -227,5 +227,5 @@ submission.progress_not_available = Progress is not available submission.counters = Counters submission.executed_success = Job executed successfully submission.server_url = Server URL -submission.connector_schema = Connector schema -submission.hio_schema = Input/Output schema +submission.from_schema = From schema +submission.to_schema = To schema \ No newline at end of file http://git-wip-us.apache.org/repos/asf/sqoop/blob/049994a0/spi/src/main/java/org/apache/sqoop/connector/spi/MetadataUpgrader.java ---------------------------------------------------------------------- diff --git a/spi/src/main/java/org/apache/sqoop/connector/spi/MetadataUpgrader.java b/spi/src/main/java/org/apache/sqoop/connector/spi/MetadataUpgrader.java deleted file mode 100644 index 328f9b0..0000000 --- a/spi/src/main/java/org/apache/sqoop/connector/spi/MetadataUpgrader.java +++ /dev/null @@ -1,46 +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.connector.spi; - -import org.apache.sqoop.model.MConnectionForms; -import org.apache.sqoop.model.MJobForms; - -public abstract class MetadataUpgrader { - - /** - * Upgrade the original connection and fill into the upgradeTarget. Note - * that any metadata already in {@code upgradeTarget} maybe overwritten. - * @param original - original connection metadata as in the repository - * @param upgradeTarget - the instance that will be filled in with the - * upgraded metadata. - */ - public abstract void upgrade(MConnectionForms original, - MConnectionForms upgradeTarget); - /** - * Upgrade the original job and fill into the upgradeTarget. Note - * that any metadata already in {@code upgradeTarget} maybe overwritten. - * This method must be called only after the connection metadata has - * already been upgraded. - * @param original - original connection metadata as in the repository - * @param upgradeTarget - the instance that will be filled in with the - * upgraded metadata. - */ - public abstract void upgrade(MJobForms original, MJobForms upgradeTarget); -} - http://git-wip-us.apache.org/repos/asf/sqoop/blob/049994a0/spi/src/main/java/org/apache/sqoop/connector/spi/RepositoryUpgrader.java ---------------------------------------------------------------------- diff --git a/spi/src/main/java/org/apache/sqoop/connector/spi/RepositoryUpgrader.java b/spi/src/main/java/org/apache/sqoop/connector/spi/RepositoryUpgrader.java new file mode 100644 index 0000000..e00b404 --- /dev/null +++ b/spi/src/main/java/org/apache/sqoop/connector/spi/RepositoryUpgrader.java @@ -0,0 +1,51 @@ +/* + * 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.connector.spi; + +import org.apache.sqoop.model.MConnectionForms; +import org.apache.sqoop.model.MJobForms; + +/** + * Repository represents the sqoop entity store. Sqoop entities include + * the connectors, links, jobs and submissions and corresponding configs. + * + */ +public abstract class RepositoryUpgrader { + + /** + * Upgrade the original connection and fill into the upgradeTarget. Note + * that any metadata already in {@code upgradeTarget} maybe overwritten. + * @param original - original connection metadata as in the repository + * @param upgradeTarget - the instance that will be filled in with the + * upgraded metadata. + */ + public abstract void upgrade(MConnectionForms original, + MConnectionForms upgradeTarget); + /** + * Upgrade the original job and fill into the upgradeTarget. Note + * that any metadata already in {@code upgradeTarget} maybe overwritten. + * This method must be called only after the connection metadata has + * already been upgraded. + * @param original - original connection metadata as in the repository + * @param upgradeTarget - the instance that will be filled in with the + * upgraded metadata. + */ + public abstract void upgrade(MJobForms original, MJobForms upgradeTarget); +} + http://git-wip-us.apache.org/repos/asf/sqoop/blob/049994a0/spi/src/main/java/org/apache/sqoop/connector/spi/SqoopConnector.java ---------------------------------------------------------------------- diff --git a/spi/src/main/java/org/apache/sqoop/connector/spi/SqoopConnector.java b/spi/src/main/java/org/apache/sqoop/connector/spi/SqoopConnector.java index 2774e8b..7b78ba0 100644 --- a/spi/src/main/java/org/apache/sqoop/connector/spi/SqoopConnector.java +++ b/spi/src/main/java/org/apache/sqoop/connector/spi/SqoopConnector.java @@ -60,7 +60,7 @@ public abstract class SqoopConnector { /** * @return Get connection configuration class */ - public abstract Class getConnectionConfigurationClass(); + public abstract Class getLinkConfigurationClass(); /** * @return Get job configuration class for given type or null if not supported @@ -78,7 +78,7 @@ public abstract class SqoopConnector { public abstract To getTo(); /** - * Returns validation object that Sqoop framework can use to validate user + * Returns validation object that Sqoop can use to validate user * supplied forms before accepting them. This object will be used both for * connection and job forms. * @@ -87,11 +87,11 @@ public abstract class SqoopConnector { public abstract Validator getValidator(); /** - * Returns an {@linkplain MetadataUpgrader} object that can upgrade the - * connection and job metadata. - * @return MetadataUpgrader object + * Returns an {@linkplain RepositoryUpgrader} object that can upgrade the + * configs related to the link and job + * @return RespositoryUpgrader object */ - public abstract MetadataUpgrader getMetadataUpgrader(); + public abstract RepositoryUpgrader getRepositoryUpgrader(); /** * Returns the {@linkplain IntermediateDataFormat} this connector http://git-wip-us.apache.org/repos/asf/sqoop/blob/049994a0/spi/src/main/java/org/apache/sqoop/job/etl/Destroyer.java ---------------------------------------------------------------------- diff --git a/spi/src/main/java/org/apache/sqoop/job/etl/Destroyer.java b/spi/src/main/java/org/apache/sqoop/job/etl/Destroyer.java index 149ad2c..f965bdd 100644 --- a/spi/src/main/java/org/apache/sqoop/job/etl/Destroyer.java +++ b/spi/src/main/java/org/apache/sqoop/job/etl/Destroyer.java @@ -21,17 +21,17 @@ package org.apache.sqoop.job.etl; * This allows connector to define work to complete execution, for example, * resource cleaning. */ -public abstract class Destroyer<ConnectionConfiguration, JobConfiguration> { +public abstract class Destroyer<LinkConfiguration, JobConfiguration> { /** * Callback to clean up after job execution. * * @param context Destroyer context - * @param connectionConfiguration Connection configuration object + * @param linkConfiguration link configuration object * @param jobConfiguration Job configuration object */ public abstract void destroy(DestroyerContext context, - ConnectionConfiguration connectionConfiguration, + LinkConfiguration linkConfiguration, JobConfiguration jobConfiguration); }