Repository: sqoop Updated Branches: refs/heads/sqoop2 b835c69a6 -> dedd84a4a
SQOOP-2172: Sqoop2: Move ErrorCode's sub-class from sqoop-core to sqoop-common (Richard Zhou via Abraham Elmahrek) Project: http://git-wip-us.apache.org/repos/asf/sqoop/repo Commit: http://git-wip-us.apache.org/repos/asf/sqoop/commit/dedd84a4 Tree: http://git-wip-us.apache.org/repos/asf/sqoop/tree/dedd84a4 Diff: http://git-wip-us.apache.org/repos/asf/sqoop/diff/dedd84a4 Branch: refs/heads/sqoop2 Commit: dedd84a4af766b2d80797dfde2a0cd2971234a8a Parents: b835c69 Author: Abraham Elmahrek <[email protected]> Authored: Thu Mar 5 18:33:28 2015 -0800 Committer: Abraham Elmahrek <[email protected]> Committed: Thu Mar 5 18:33:28 2015 -0800 ---------------------------------------------------------------------- .../sqoop/error/code/AuditLoggerError.java | 50 +++++++ .../apache/sqoop/error/code/ConnectorError.java | 77 ++++++++++ .../org/apache/sqoop/error/code/CoreError.java | 72 ++++++++++ .../apache/sqoop/error/code/DriverError.java | 67 +++++++++ .../sqoop/error/code/RepositoryError.java | 142 +++++++++++++++++++ .../apache/sqoop/error/code/SecurityError.java | 82 +++++++++++ .../apache/sqoop/audit/AuditLoggerError.java | 50 ------- .../apache/sqoop/audit/AuditLoggerManager.java | 1 + .../org/apache/sqoop/audit/FileAuditLogger.java | 1 + .../apache/sqoop/connector/ConnectorError.java | 77 ---------- .../sqoop/connector/ConnectorHandler.java | 1 + .../sqoop/connector/ConnectorManager.java | 1 + .../sqoop/connector/ConnectorManagerUtils.java | 1 + .../java/org/apache/sqoop/core/CoreError.java | 72 ---------- .../core/PropertiesConfigurationProvider.java | 2 + .../apache/sqoop/core/SqoopConfiguration.java | 1 + .../org/apache/sqoop/driver/DriverError.java | 67 --------- .../org/apache/sqoop/driver/JobManager.java | 1 + .../apache/sqoop/repository/JdbcRepository.java | 1 + .../sqoop/repository/JdbcRepositoryContext.java | 1 + .../repository/JdbcRepositoryProvider.java | 1 + .../repository/JdbcRepositoryTransaction.java | 1 + .../org/apache/sqoop/repository/Repository.java | 1 + .../sqoop/repository/RepositoryError.java | 142 ------------------- .../sqoop/repository/RepositoryManager.java | 1 + .../apache/sqoop/security/SecurityError.java | 82 ----------- .../apache/sqoop/security/SecurityFactory.java | 1 + .../sqoop/core/TestSqoopConfiguration.java | 1 + .../org/apache/sqoop/driver/TestJobManager.java | 1 + .../sqoop/repository/TestJdbcRepository.java | 1 + .../sqoop/repository/TestRepositoryManager.java | 1 + .../KerberosAuthenticationHandler.java | 2 +- .../DefaultAuthenticationProvider.java | 2 +- .../sqoop/filter/SqoopAuthenticationFilter.java | 2 +- .../handler/AuthorizationRequestHandler.java | 2 +- .../sqoop/server/SqoopProtocolServlet.java | 2 +- .../SubmissionWithDisabledModelObjectsTest.java | 2 +- 37 files changed, 516 insertions(+), 496 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/sqoop/blob/dedd84a4/common/src/main/java/org/apache/sqoop/error/code/AuditLoggerError.java ---------------------------------------------------------------------- diff --git a/common/src/main/java/org/apache/sqoop/error/code/AuditLoggerError.java b/common/src/main/java/org/apache/sqoop/error/code/AuditLoggerError.java new file mode 100644 index 0000000..1af8d7d --- /dev/null +++ b/common/src/main/java/org/apache/sqoop/error/code/AuditLoggerError.java @@ -0,0 +1,50 @@ +/** + * 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.error.code; + +import org.apache.sqoop.common.ErrorCode; + +public enum AuditLoggerError implements ErrorCode { + + /** An unknown error has occurred. */ + AUDIT_0000("An unknown error has occurred"), + + /** The system was unable to find or load the audit logger provider. */ + AUDIT_0001("The system was unable to find or load audit logger class"), + + /** The audit logger output file is not given. */ + AUDIT_0002("The output file for FileAuditLogger is not given"), + + ; + + private final String message; + + private AuditLoggerError(String message) { + this.message = message; + } + + @Override + public String getCode() { + return name(); + } + + @Override + public String getMessage() { + return message; + } +} http://git-wip-us.apache.org/repos/asf/sqoop/blob/dedd84a4/common/src/main/java/org/apache/sqoop/error/code/ConnectorError.java ---------------------------------------------------------------------- diff --git a/common/src/main/java/org/apache/sqoop/error/code/ConnectorError.java b/common/src/main/java/org/apache/sqoop/error/code/ConnectorError.java new file mode 100644 index 0000000..2f17d95 --- /dev/null +++ b/common/src/main/java/org/apache/sqoop/error/code/ConnectorError.java @@ -0,0 +1,77 @@ +/** + * 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.error.code; + +import org.apache.sqoop.common.ErrorCode; + +public enum ConnectorError implements ErrorCode { + + /** An unknown error has occurred. */ + CONN_0000("An unknown error has occurred"), + + /** The system was not able to initialize the configured connectors. */ + CONN_0001("Unable to initialize connectors"), + + /** No connectors were found in the system. */ + CONN_0002("No connectors were found in the system"), + + /** A problem was encountered while loading the connector configuration. */ + CONN_0003("Failed to load connector configuration"), + + /** A connector configuration file did not include the provider class name.*/ + CONN_0004("Connector configuration did not include provider class name"), + + /** An exception occurred while attempting to instantiate the connector. */ + CONN_0005("Failed to instantiate connector class"), + + /** More than one connectors use the same name resulting in conflict. */ + CONN_0006("More than one connector uses the same name"), + + /** The registration of connector during system initialization failed.*/ + CONN_0007("Connector registration failed"), + + /** The configuration of connector does not specify it's unique name. */ + CONN_0008("No name specified for connector"), + + /** + * A connector is being registered with the same name as what has been + * previously registered. Or the connector being registered is the same but + * it's metadata has changed in an incompatible manner since the last time it + * was registered. + */ + CONN_0009("Attempt to register connector with a name associated with a " + + "previously registered connector; or the connector metadata has " + + "changed since it was registered previously."), + + /** A connector is not assigned with a valid id yet. */ + CONN_0010("A connector is not assigned with a valid id yet"); + + private final String message; + + private ConnectorError(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/dedd84a4/common/src/main/java/org/apache/sqoop/error/code/CoreError.java ---------------------------------------------------------------------- diff --git a/common/src/main/java/org/apache/sqoop/error/code/CoreError.java b/common/src/main/java/org/apache/sqoop/error/code/CoreError.java new file mode 100644 index 0000000..24e73c3 --- /dev/null +++ b/common/src/main/java/org/apache/sqoop/error/code/CoreError.java @@ -0,0 +1,72 @@ +/** + * 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.error.code; + +import org.apache.sqoop.common.ErrorCode; + +public enum CoreError implements ErrorCode { + + /** An unknown error has occurred. */ + CORE_0000("An unknown error has occurred"), + + /** The system was unable to find the configuration directory. */ + CORE_0001("Invalid confiugration directory"), + + /** The system was unable to load bootstrap configuration. */ + CORE_0002("Invalid bootstrap configuration"), + + /** + * The bootstrap configuration did not contain the class name of + * configuration provider. + */ + CORE_0003("No configuration provider set for the system"), + + /** The system was unable locate configuration provider implementation.*/ + CORE_0004("Configuration provider was not found"), + + /** The system was unable to load configuration provider */ + CORE_0005("Unable to load configuration provider"), + + /** + * The PropertiesConfigurationProvider is unable to load the configuration + * properties file. + */ + CORE_0006("Properties configuration provider unable to load config file"), + + /** The configuration system has not been initialized correctly. */ + CORE_0007("System not initialized"), + + /** The system has not been reconfigured */ + CORE_0008("System not reconfigured"); + + ; + + private final String message; + + private CoreError(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/dedd84a4/common/src/main/java/org/apache/sqoop/error/code/DriverError.java ---------------------------------------------------------------------- diff --git a/common/src/main/java/org/apache/sqoop/error/code/DriverError.java b/common/src/main/java/org/apache/sqoop/error/code/DriverError.java new file mode 100644 index 0000000..0ec9310 --- /dev/null +++ b/common/src/main/java/org/apache/sqoop/error/code/DriverError.java @@ -0,0 +1,67 @@ +/** + * 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.error.code; + +import org.apache.sqoop.common.ErrorCode; + +/** + * + */ +//TODO(https://issues.apache.org/jira/browse/SQOOP-1652): why is this called Driver Error since it is used in JobManager? + +public enum DriverError implements ErrorCode { + + DRIVER_0001("Invalid submission engine"), + + DRIVER_0002("Given job is already running"), + + DRIVER_0003("Given job is not running"), + + DRIVER_0004("Unknown job id"), + + DRIVER_0005("Unsupported job type"), + + DRIVER_0006("Can't bootstrap job"), + + DRIVER_0007("Invalid execution engine"), + + DRIVER_0008("Invalid combination of submission and execution engines"), + + //TODO(https://issues.apache.org/jira/browse/SQOOP-1652): address the submit/start terminology difference + DRIVER_0009("Job has been disabled. Cannot submit this job."), + + DRIVER_0010("Link for this job has been disabled. Cannot submit this job."), + + DRIVER_0011("Connector does not support specified direction. Cannot submit this job."), + + ; + + private final String message; + + private DriverError(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/dedd84a4/common/src/main/java/org/apache/sqoop/error/code/RepositoryError.java ---------------------------------------------------------------------- diff --git a/common/src/main/java/org/apache/sqoop/error/code/RepositoryError.java b/common/src/main/java/org/apache/sqoop/error/code/RepositoryError.java new file mode 100644 index 0000000..fb8d9c5 --- /dev/null +++ b/common/src/main/java/org/apache/sqoop/error/code/RepositoryError.java @@ -0,0 +1,142 @@ +/** + * 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.error.code; + +import org.apache.sqoop.common.ErrorCode; + +public enum RepositoryError implements ErrorCode { + + // General Repository Errors: Prefix REPO + + /** An unknown error has occurred. */ + REPO_0000("An unknown error has occurred"), + + /** The system was unable to find or load the repository provider. */ + REPO_0001("Invalid repository provider specified"), + + /** Repository on disk structures are not suitable for use */ + REPO_0002("Repository structures are not in suitable state, might require upgrade"), + + // JDBC Repository Errors: Prefix JDBCREP + + /** An unknown error has occurred. */ + JDBCREPO_0000("An unknown error has occurred"), + + /** The system was unable to find or load the JDBC repository handler. */ + JDBCREPO_0001("Invalid JDBC Repository Handler specified"), + + /** An invalid JDBC link URL was specified. */ + JDBCREPO_0002("Invalid JDBC link URL specified"), + + /** An invalid JDBC driver class name was specified. */ + JDBCREPO_0003("Invalid JDBC driver class specified"), + + /** An invalid JDBC transaction isolation level was specified. */ + JDBCREPO_0004("Invalid JDBC transaction isolation level specified"), + + /** The value specified for maximum link pool links is invalid.*/ + JDBCREPO_0005("Invalid maximum links specified for link pool"), + + /** The system attempted to use an inactive transaction. */ + JDBCREPO_0006("Transaction is not active"), + + /** + * The system was unable to obtain a link lease for the + * requested transaction. + */ + JDBCREPO_0007("Unable to lease link"), + + /** The system attempted to commit a transaction marked for rollback.*/ + JDBCREPO_0008("Attempt to commit a transaction marked for rollback"), + + /** The system was unable to finalize the transaction. */ + JDBCREPO_0009("Failed to finalize transaction"), + + /** The system was not able to deregister the driver during shutdown. */ + JDBCREPO_0010("Unable to deregister driver during shutdown"), + + /** + * An attempt was made to reinitialize already + * initialized JDBC repository context. + */ + JDBCREPO_0011("Attempt to reinitialize JDBC repository context"), + + /** Failure in config repository operation. */ + JDBCREPO_0012("Failure in config repository operation."), + + /** The system found a change in connector config that requires upgrade. */ + JDBCREPO_0013("Connector config changed - upgrade may be required"), + + /** The system found a change in driver config that requires upgrade. */ + JDBCREPO_0014("Driver config changed - upgrade may be required"), + + /** link that we're trying to create is already saved in repository **/ + JDBCREPO_0015("Cannot create link that was already created"), + + /** link that we're trying to update is not yet saved **/ + JDBCREPO_0016("Cannot update link that was not yet created"), + + /** Invalid link id **/ + JDBCREPO_0017("Given link id is invalid"), + + /** Job that we're trying to create is already saved in repository **/ + JDBCREPO_0018("Cannot create job that was already created"), + + /** Job that we're trying to update is not yet saved **/ + JDBCREPO_0019("Cannot update job that was not yet created"), + + /** Invalid job id **/ + JDBCREPO_0020("Given job id is invalid"), + + /** link ID is in use **/ + JDBCREPO_0021("Given link id is in use"), + + /** Job ID is in use **/ + JDBCREPO_0022("Given job id is in use"), + + /** Cannot create submission that was already created **/ + JDBCREPO_0023("Cannot create submission that was already created"), + + /** Submission that we're trying to update is not yet created **/ + JDBCREPO_0024("Cannot update submission that was not yet created"), + + /** Invalid submission id **/ + JDBCREPO_0025("Given submission id is invalid"), + + /** Upgrade required but not allowed **/ + JDBCREPO_0026("Upgrade required but not allowed"), + + /** Invalid links or jobs when upgrading connector **/ + JDBCREPO_0027("Invalid links or jobs when upgrading connector") + + ; + + private final String message; + + private RepositoryError(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/dedd84a4/common/src/main/java/org/apache/sqoop/error/code/SecurityError.java ---------------------------------------------------------------------- diff --git a/common/src/main/java/org/apache/sqoop/error/code/SecurityError.java b/common/src/main/java/org/apache/sqoop/error/code/SecurityError.java new file mode 100644 index 0000000..dee745d --- /dev/null +++ b/common/src/main/java/org/apache/sqoop/error/code/SecurityError.java @@ -0,0 +1,82 @@ +/** + * 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.error.code; + +import org.apache.sqoop.common.ErrorCode; + +public enum SecurityError implements ErrorCode { + + /** An unknown error has occurred. */ + AUTH_0000("An unknown error has occurred"), + + /** The system was not able to find Kerberos keytab in sqoop configuration. */ + AUTH_0001("Unable to find Kerberos keytab"), + + /** The system was not able to find Kerberos principal in sqoop configuration. */ + AUTH_0002("Unable to find Kerberos principal"), + + /** The system was not able to login using Kerberos keytab and principal in sqoop configuration. */ + AUTH_0003("Unable to login using Kerberos keytab and principal"), + + /** Invalid authentication type {simple, Kerberos}. */ + AUTH_0004("Invalid authentication type"), + + /** The system was not able to find Kerberos keytab for http in sqoop configuration. */ + AUTH_0005("Unable to find Kerberos keytab for http"), + + /** The system was not able to find Kerberos principal for http in sqoop configuration. */ + AUTH_0006("Unable to find Kerberos principal for http"), + + /** The system was not able to find authorization handler. */ + AUTH_0007("Unable to find authorization handler"), + + /** The system was not able to find authorization access controller. */ + AUTH_0008("Unable to find authorization access controller"), + + /** The system was not able to find authorization validator. */ + AUTH_0009("Unable to find authorization validator"), + + /** The system was not able to find authentication provider. */ + AUTH_0010("Unable to find authentication provider"), + + /** The system was not able to get authentication from http request. */ + AUTH_0011("Unable to get remote authentication from http request"), + + /** The system was not able to get role name from http request. */ + AUTH_0012("Unable to get role name from http request"), + + /** The system was not able to get principal from http request. */ + AUTH_0013("Unable to get principal from http request"), + + /** Authorization Exception, used by authorization implementation, etc. Sentry. */ + AUTH_0014("Authorization exception"); + + private final String message; + + private SecurityError(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/dedd84a4/core/src/main/java/org/apache/sqoop/audit/AuditLoggerError.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/sqoop/audit/AuditLoggerError.java b/core/src/main/java/org/apache/sqoop/audit/AuditLoggerError.java deleted file mode 100644 index 5999e1c..0000000 --- a/core/src/main/java/org/apache/sqoop/audit/AuditLoggerError.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.audit; - -import org.apache.sqoop.common.ErrorCode; - -public enum AuditLoggerError implements ErrorCode { - - /** An unknown error has occurred. */ - AUDIT_0000("An unknown error has occurred"), - - /** The system was unable to find or load the audit logger provider. */ - AUDIT_0001("The system was unable to find or load audit logger class"), - - /** The audit logger output file is not given. */ - AUDIT_0002("The output file for FileAuditLogger is not given"), - - ; - - private final String message; - - private AuditLoggerError(String message) { - this.message = message; - } - - @Override - public String getCode() { - return name(); - } - - @Override - public String getMessage() { - return message; - } -} http://git-wip-us.apache.org/repos/asf/sqoop/blob/dedd84a4/core/src/main/java/org/apache/sqoop/audit/AuditLoggerManager.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/sqoop/audit/AuditLoggerManager.java b/core/src/main/java/org/apache/sqoop/audit/AuditLoggerManager.java index 17a996f..728127b 100644 --- a/core/src/main/java/org/apache/sqoop/audit/AuditLoggerManager.java +++ b/core/src/main/java/org/apache/sqoop/audit/AuditLoggerManager.java @@ -23,6 +23,7 @@ import org.apache.sqoop.common.SqoopException; import org.apache.sqoop.core.Reconfigurable; import org.apache.sqoop.core.SqoopConfiguration; import org.apache.sqoop.core.SqoopConfiguration.CoreConfigurationListener; +import org.apache.sqoop.error.code.AuditLoggerError; import org.apache.sqoop.utils.ClassUtils; import java.util.ArrayList; http://git-wip-us.apache.org/repos/asf/sqoop/blob/dedd84a4/core/src/main/java/org/apache/sqoop/audit/FileAuditLogger.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/sqoop/audit/FileAuditLogger.java b/core/src/main/java/org/apache/sqoop/audit/FileAuditLogger.java index ca93266..42cb330 100644 --- a/core/src/main/java/org/apache/sqoop/audit/FileAuditLogger.java +++ b/core/src/main/java/org/apache/sqoop/audit/FileAuditLogger.java @@ -23,6 +23,7 @@ import java.util.Properties; import org.apache.log4j.Logger; import org.apache.log4j.PropertyConfigurator; import org.apache.sqoop.common.SqoopException; +import org.apache.sqoop.error.code.AuditLoggerError; public class FileAuditLogger extends AuditLogger { http://git-wip-us.apache.org/repos/asf/sqoop/blob/dedd84a4/core/src/main/java/org/apache/sqoop/connector/ConnectorError.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/sqoop/connector/ConnectorError.java b/core/src/main/java/org/apache/sqoop/connector/ConnectorError.java deleted file mode 100644 index d544fb1..0000000 --- a/core/src/main/java/org/apache/sqoop/connector/ConnectorError.java +++ /dev/null @@ -1,77 +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; - -import org.apache.sqoop.common.ErrorCode; - -public enum ConnectorError implements ErrorCode { - - /** An unknown error has occurred. */ - CONN_0000("An unknown error has occurred"), - - /** The system was not able to initialize the configured connectors. */ - CONN_0001("Unable to initialize connectors"), - - /** No connectors were found in the system. */ - CONN_0002("No connectors were found in the system"), - - /** A problem was encountered while loading the connector configuration. */ - CONN_0003("Failed to load connector configuration"), - - /** A connector configuration file did not include the provider class name.*/ - CONN_0004("Connector configuration did not include provider class name"), - - /** An exception occurred while attempting to instantiate the connector. */ - CONN_0005("Failed to instantiate connector class"), - - /** More than one connectors use the same name resulting in conflict. */ - CONN_0006("More than one connector uses the same name"), - - /** The registration of connector during system initialization failed.*/ - CONN_0007("Connector registration failed"), - - /** The configuration of connector does not specify it's unique name. */ - CONN_0008("No name specified for connector"), - - /** - * A connector is being registered with the same name as what has been - * previously registered. Or the connector being registered is the same but - * it's metadata has changed in an incompatible manner since the last time it - * was registered. - */ - CONN_0009("Attempt to register connector with a name associated with a " - + "previously registered connector; or the connector metadata has " - + "changed since it was registered previously."), - - /** A connector is not assigned with a valid id yet. */ - CONN_0010("A connector is not assigned with a valid id yet"); - - private final String message; - - private ConnectorError(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/dedd84a4/core/src/main/java/org/apache/sqoop/connector/ConnectorHandler.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/sqoop/connector/ConnectorHandler.java b/core/src/main/java/org/apache/sqoop/connector/ConnectorHandler.java index bfdb7b3..716a5b1 100644 --- a/core/src/main/java/org/apache/sqoop/connector/ConnectorHandler.java +++ b/core/src/main/java/org/apache/sqoop/connector/ConnectorHandler.java @@ -26,6 +26,7 @@ import org.apache.sqoop.common.Direction; import org.apache.sqoop.common.SqoopException; import org.apache.sqoop.connector.spi.SqoopConnector; import org.apache.sqoop.core.ConfigurationConstants; +import org.apache.sqoop.error.code.ConnectorError; import org.apache.sqoop.model.ConfigUtils; import org.apache.sqoop.model.MConnector; import org.apache.sqoop.model.MFromConfig; http://git-wip-us.apache.org/repos/asf/sqoop/blob/dedd84a4/core/src/main/java/org/apache/sqoop/connector/ConnectorManager.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/sqoop/connector/ConnectorManager.java b/core/src/main/java/org/apache/sqoop/connector/ConnectorManager.java index 0907efb..0b15046 100644 --- a/core/src/main/java/org/apache/sqoop/connector/ConnectorManager.java +++ b/core/src/main/java/org/apache/sqoop/connector/ConnectorManager.java @@ -35,6 +35,7 @@ import org.apache.sqoop.core.ConfigurationConstants; import org.apache.sqoop.core.Reconfigurable; import org.apache.sqoop.core.SqoopConfiguration; import org.apache.sqoop.core.SqoopConfiguration.CoreConfigurationListener; +import org.apache.sqoop.error.code.ConnectorError; import org.apache.sqoop.model.MConnector; import org.apache.sqoop.repository.Repository; import org.apache.sqoop.repository.RepositoryManager; http://git-wip-us.apache.org/repos/asf/sqoop/blob/dedd84a4/core/src/main/java/org/apache/sqoop/connector/ConnectorManagerUtils.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/sqoop/connector/ConnectorManagerUtils.java b/core/src/main/java/org/apache/sqoop/connector/ConnectorManagerUtils.java index bd85e99..99736c6 100644 --- a/core/src/main/java/org/apache/sqoop/connector/ConnectorManagerUtils.java +++ b/core/src/main/java/org/apache/sqoop/connector/ConnectorManagerUtils.java @@ -20,6 +20,7 @@ package org.apache.sqoop.connector; import org.apache.commons.lang.StringUtils; import org.apache.sqoop.common.SqoopException; import org.apache.sqoop.core.ConfigurationConstants; +import org.apache.sqoop.error.code.ConnectorError; import java.io.File; import java.io.IOException; http://git-wip-us.apache.org/repos/asf/sqoop/blob/dedd84a4/core/src/main/java/org/apache/sqoop/core/CoreError.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/sqoop/core/CoreError.java b/core/src/main/java/org/apache/sqoop/core/CoreError.java deleted file mode 100644 index eb7c1dc..0000000 --- a/core/src/main/java/org/apache/sqoop/core/CoreError.java +++ /dev/null @@ -1,72 +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.core; - -import org.apache.sqoop.common.ErrorCode; - -public enum CoreError implements ErrorCode { - - /** An unknown error has occurred. */ - CORE_0000("An unknown error has occurred"), - - /** The system was unable to find the configuration directory. */ - CORE_0001("Invalid confiugration directory"), - - /** The system was unable to load bootstrap configuration. */ - CORE_0002("Invalid bootstrap configuration"), - - /** - * The bootstrap configuration did not contain the class name of - * configuration provider. - */ - CORE_0003("No configuration provider set for the system"), - - /** The system was unable locate configuration provider implementation.*/ - CORE_0004("Configuration provider was not found"), - - /** The system was unable to load configuration provider */ - CORE_0005("Unable to load configuration provider"), - - /** - * The PropertiesConfigurationProvider is unable to load the configuration - * properties file. - */ - CORE_0006("Properties configuration provider unable to load config file"), - - /** The configuration system has not been initialized correctly. */ - CORE_0007("System not initialized"), - - /** The system has not been reconfigured */ - CORE_0008("System not reconfigured"); - - ; - - private final String message; - - private CoreError(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/dedd84a4/core/src/main/java/org/apache/sqoop/core/PropertiesConfigurationProvider.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/sqoop/core/PropertiesConfigurationProvider.java b/core/src/main/java/org/apache/sqoop/core/PropertiesConfigurationProvider.java index 023fabc..f1c4820 100644 --- a/core/src/main/java/org/apache/sqoop/core/PropertiesConfigurationProvider.java +++ b/core/src/main/java/org/apache/sqoop/core/PropertiesConfigurationProvider.java @@ -31,6 +31,8 @@ import java.util.Properties; import org.apache.log4j.Logger; import org.apache.sqoop.common.SqoopException; +import org.apache.sqoop.error.code.CoreError; + import static org.apache.sqoop.core.ConfigurationConstants.PROPERTIES_PROVIDER_SLEEP; public class PropertiesConfigurationProvider implements ConfigurationProvider { http://git-wip-us.apache.org/repos/asf/sqoop/blob/dedd84a4/core/src/main/java/org/apache/sqoop/core/SqoopConfiguration.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/sqoop/core/SqoopConfiguration.java b/core/src/main/java/org/apache/sqoop/core/SqoopConfiguration.java index 13bbfc2..383a8c0 100644 --- a/core/src/main/java/org/apache/sqoop/core/SqoopConfiguration.java +++ b/core/src/main/java/org/apache/sqoop/core/SqoopConfiguration.java @@ -28,6 +28,7 @@ import org.apache.log4j.Logger; import org.apache.log4j.PropertyConfigurator; import org.apache.sqoop.common.MapContext; import org.apache.sqoop.common.SqoopException; +import org.apache.sqoop.error.code.CoreError; /** * Configuration manager that loads Sqoop configuration. http://git-wip-us.apache.org/repos/asf/sqoop/blob/dedd84a4/core/src/main/java/org/apache/sqoop/driver/DriverError.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/sqoop/driver/DriverError.java b/core/src/main/java/org/apache/sqoop/driver/DriverError.java deleted file mode 100644 index 25a1b70..0000000 --- a/core/src/main/java/org/apache/sqoop/driver/DriverError.java +++ /dev/null @@ -1,67 +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.driver; - -import org.apache.sqoop.common.ErrorCode; - -/** - * - */ -//TODO(https://issues.apache.org/jira/browse/SQOOP-1652): why is this called Driver Error since it is used in JobManager? - -public enum DriverError implements ErrorCode { - - DRIVER_0001("Invalid submission engine"), - - DRIVER_0002("Given job is already running"), - - DRIVER_0003("Given job is not running"), - - DRIVER_0004("Unknown job id"), - - DRIVER_0005("Unsupported job type"), - - DRIVER_0006("Can't bootstrap job"), - - DRIVER_0007("Invalid execution engine"), - - DRIVER_0008("Invalid combination of submission and execution engines"), - - //TODO(https://issues.apache.org/jira/browse/SQOOP-1652): address the submit/start terminology difference - DRIVER_0009("Job has been disabled. Cannot submit this job."), - - DRIVER_0010("Link for this job has been disabled. Cannot submit this job."), - - DRIVER_0011("Connector does not support specified direction. Cannot submit this job."), - - ; - - private final String message; - - private DriverError(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/dedd84a4/core/src/main/java/org/apache/sqoop/driver/JobManager.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/sqoop/driver/JobManager.java b/core/src/main/java/org/apache/sqoop/driver/JobManager.java index dc441bc..d64c148 100644 --- a/core/src/main/java/org/apache/sqoop/driver/JobManager.java +++ b/core/src/main/java/org/apache/sqoop/driver/JobManager.java @@ -31,6 +31,7 @@ import org.apache.sqoop.core.Reconfigurable; import org.apache.sqoop.core.SqoopConfiguration; import org.apache.sqoop.core.SqoopConfiguration.CoreConfigurationListener; import org.apache.sqoop.driver.configuration.JobConfiguration; +import org.apache.sqoop.error.code.DriverError; import org.apache.sqoop.job.etl.Destroyer; import org.apache.sqoop.job.etl.DestroyerContext; import org.apache.sqoop.job.etl.Initializer; http://git-wip-us.apache.org/repos/asf/sqoop/blob/dedd84a4/core/src/main/java/org/apache/sqoop/repository/JdbcRepository.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/sqoop/repository/JdbcRepository.java b/core/src/main/java/org/apache/sqoop/repository/JdbcRepository.java index 9c5e15e..052adba 100644 --- a/core/src/main/java/org/apache/sqoop/repository/JdbcRepository.java +++ b/core/src/main/java/org/apache/sqoop/repository/JdbcRepository.java @@ -23,6 +23,7 @@ import java.util.List; import org.apache.log4j.Logger; import org.apache.sqoop.common.SqoopException; +import org.apache.sqoop.error.code.RepositoryError; import org.apache.sqoop.model.MConfig; import org.apache.sqoop.model.MConfigUpdateEntityType; import org.apache.sqoop.model.MConnector; http://git-wip-us.apache.org/repos/asf/sqoop/blob/dedd84a4/core/src/main/java/org/apache/sqoop/repository/JdbcRepositoryContext.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/sqoop/repository/JdbcRepositoryContext.java b/core/src/main/java/org/apache/sqoop/repository/JdbcRepositoryContext.java index 0a8139a..99cd4ee 100644 --- a/core/src/main/java/org/apache/sqoop/repository/JdbcRepositoryContext.java +++ b/core/src/main/java/org/apache/sqoop/repository/JdbcRepositoryContext.java @@ -25,6 +25,7 @@ import javax.sql.DataSource; import org.apache.log4j.Logger; import org.apache.sqoop.common.SqoopException; import org.apache.sqoop.common.MapContext; +import org.apache.sqoop.error.code.RepositoryError; public final class JdbcRepositoryContext { http://git-wip-us.apache.org/repos/asf/sqoop/blob/dedd84a4/core/src/main/java/org/apache/sqoop/repository/JdbcRepositoryProvider.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/sqoop/repository/JdbcRepositoryProvider.java b/core/src/main/java/org/apache/sqoop/repository/JdbcRepositoryProvider.java index 011527f..56b859e 100644 --- a/core/src/main/java/org/apache/sqoop/repository/JdbcRepositoryProvider.java +++ b/core/src/main/java/org/apache/sqoop/repository/JdbcRepositoryProvider.java @@ -35,6 +35,7 @@ import org.apache.log4j.Logger; import org.apache.sqoop.common.SqoopException; import org.apache.sqoop.common.MapContext; import org.apache.sqoop.core.SqoopConfiguration; +import org.apache.sqoop.error.code.RepositoryError; import org.apache.sqoop.utils.ClassUtils; http://git-wip-us.apache.org/repos/asf/sqoop/blob/dedd84a4/core/src/main/java/org/apache/sqoop/repository/JdbcRepositoryTransaction.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/sqoop/repository/JdbcRepositoryTransaction.java b/core/src/main/java/org/apache/sqoop/repository/JdbcRepositoryTransaction.java index 86be30f..bc7c316 100644 --- a/core/src/main/java/org/apache/sqoop/repository/JdbcRepositoryTransaction.java +++ b/core/src/main/java/org/apache/sqoop/repository/JdbcRepositoryTransaction.java @@ -26,6 +26,7 @@ import javax.sql.DataSource; import org.apache.log4j.LogManager; import org.apache.log4j.Logger; import org.apache.sqoop.common.SqoopException; +import org.apache.sqoop.error.code.RepositoryError; public class JdbcRepositoryTransaction implements RepositoryTransaction { http://git-wip-us.apache.org/repos/asf/sqoop/blob/dedd84a4/core/src/main/java/org/apache/sqoop/repository/Repository.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/sqoop/repository/Repository.java b/core/src/main/java/org/apache/sqoop/repository/Repository.java index aa91661..ceedc5d 100644 --- a/core/src/main/java/org/apache/sqoop/repository/Repository.java +++ b/core/src/main/java/org/apache/sqoop/repository/Repository.java @@ -30,6 +30,7 @@ import org.apache.sqoop.connector.spi.ConnectorConfigurableUpgrader; import org.apache.sqoop.connector.spi.SqoopConnector; import org.apache.sqoop.driver.Driver; import org.apache.sqoop.driver.DriverUpgrader; +import org.apache.sqoop.error.code.RepositoryError; import org.apache.sqoop.json.DriverBean; import org.apache.sqoop.model.ConfigUtils; import org.apache.sqoop.model.MConfig; http://git-wip-us.apache.org/repos/asf/sqoop/blob/dedd84a4/core/src/main/java/org/apache/sqoop/repository/RepositoryError.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/sqoop/repository/RepositoryError.java b/core/src/main/java/org/apache/sqoop/repository/RepositoryError.java deleted file mode 100644 index f684e85..0000000 --- a/core/src/main/java/org/apache/sqoop/repository/RepositoryError.java +++ /dev/null @@ -1,142 +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.repository; - -import org.apache.sqoop.common.ErrorCode; - -public enum RepositoryError implements ErrorCode { - - // General Repository Errors: Prefix REPO - - /** An unknown error has occurred. */ - REPO_0000("An unknown error has occurred"), - - /** The system was unable to find or load the repository provider. */ - REPO_0001("Invalid repository provider specified"), - - /** Repository on disk structures are not suitable for use */ - REPO_0002("Repository structures are not in suitable state, might require upgrade"), - - // JDBC Repository Errors: Prefix JDBCREP - - /** An unknown error has occurred. */ - JDBCREPO_0000("An unknown error has occurred"), - - /** The system was unable to find or load the JDBC repository handler. */ - JDBCREPO_0001("Invalid JDBC Repository Handler specified"), - - /** An invalid JDBC link URL was specified. */ - JDBCREPO_0002("Invalid JDBC link URL specified"), - - /** An invalid JDBC driver class name was specified. */ - JDBCREPO_0003("Invalid JDBC driver class specified"), - - /** An invalid JDBC transaction isolation level was specified. */ - JDBCREPO_0004("Invalid JDBC transaction isolation level specified"), - - /** The value specified for maximum link pool links is invalid.*/ - JDBCREPO_0005("Invalid maximum links specified for link pool"), - - /** The system attempted to use an inactive transaction. */ - JDBCREPO_0006("Transaction is not active"), - - /** - * The system was unable to obtain a link lease for the - * requested transaction. - */ - JDBCREPO_0007("Unable to lease link"), - - /** The system attempted to commit a transaction marked for rollback.*/ - JDBCREPO_0008("Attempt to commit a transaction marked for rollback"), - - /** The system was unable to finalize the transaction. */ - JDBCREPO_0009("Failed to finalize transaction"), - - /** The system was not able to deregister the driver during shutdown. */ - JDBCREPO_0010("Unable to deregister driver during shutdown"), - - /** - * An attempt was made to reinitialize already - * initialized JDBC repository context. - */ - JDBCREPO_0011("Attempt to reinitialize JDBC repository context"), - - /** Failure in config repository operation. */ - JDBCREPO_0012("Failure in config repository operation."), - - /** The system found a change in connector config that requires upgrade. */ - JDBCREPO_0013("Connector config changed - upgrade may be required"), - - /** The system found a change in driver config that requires upgrade. */ - JDBCREPO_0014("Driver config changed - upgrade may be required"), - - /** link that we're trying to create is already saved in repository **/ - JDBCREPO_0015("Cannot create link that was already created"), - - /** link that we're trying to update is not yet saved **/ - JDBCREPO_0016("Cannot update link that was not yet created"), - - /** Invalid link id **/ - JDBCREPO_0017("Given link id is invalid"), - - /** Job that we're trying to create is already saved in repository **/ - JDBCREPO_0018("Cannot create job that was already created"), - - /** Job that we're trying to update is not yet saved **/ - JDBCREPO_0019("Cannot update job that was not yet created"), - - /** Invalid job id **/ - JDBCREPO_0020("Given job id is invalid"), - - /** link ID is in use **/ - JDBCREPO_0021("Given link id is in use"), - - /** Job ID is in use **/ - JDBCREPO_0022("Given job id is in use"), - - /** Cannot create submission that was already created **/ - JDBCREPO_0023("Cannot create submission that was already created"), - - /** Submission that we're trying to update is not yet created **/ - JDBCREPO_0024("Cannot update submission that was not yet created"), - - /** Invalid submission id **/ - JDBCREPO_0025("Given submission id is invalid"), - - /** Upgrade required but not allowed **/ - JDBCREPO_0026("Upgrade required but not allowed"), - - /** Invalid links or jobs when upgrading connector **/ - JDBCREPO_0027("Invalid links or jobs when upgrading connector") - - ; - - private final String message; - - private RepositoryError(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/dedd84a4/core/src/main/java/org/apache/sqoop/repository/RepositoryManager.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/sqoop/repository/RepositoryManager.java b/core/src/main/java/org/apache/sqoop/repository/RepositoryManager.java index 121f388..8015216 100644 --- a/core/src/main/java/org/apache/sqoop/repository/RepositoryManager.java +++ b/core/src/main/java/org/apache/sqoop/repository/RepositoryManager.java @@ -25,6 +25,7 @@ import org.apache.sqoop.common.MapContext; import org.apache.sqoop.core.Reconfigurable; import org.apache.sqoop.core.SqoopConfiguration; import org.apache.sqoop.core.SqoopConfiguration.CoreConfigurationListener; +import org.apache.sqoop.error.code.RepositoryError; import org.apache.sqoop.utils.ClassUtils; public class RepositoryManager implements Reconfigurable { http://git-wip-us.apache.org/repos/asf/sqoop/blob/dedd84a4/core/src/main/java/org/apache/sqoop/security/SecurityError.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/sqoop/security/SecurityError.java b/core/src/main/java/org/apache/sqoop/security/SecurityError.java deleted file mode 100644 index 9f85b9e..0000000 --- a/core/src/main/java/org/apache/sqoop/security/SecurityError.java +++ /dev/null @@ -1,82 +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.security; - -import org.apache.sqoop.common.ErrorCode; - -public enum SecurityError implements ErrorCode { - - /** An unknown error has occurred. */ - AUTH_0000("An unknown error has occurred"), - - /** The system was not able to find Kerberos keytab in sqoop configuration. */ - AUTH_0001("Unable to find Kerberos keytab"), - - /** The system was not able to find Kerberos principal in sqoop configuration. */ - AUTH_0002("Unable to find Kerberos principal"), - - /** The system was not able to login using Kerberos keytab and principal in sqoop configuration. */ - AUTH_0003("Unable to login using Kerberos keytab and principal"), - - /** Invalid authentication type {simple, Kerberos}. */ - AUTH_0004("Invalid authentication type"), - - /** The system was not able to find Kerberos keytab for http in sqoop configuration. */ - AUTH_0005("Unable to find Kerberos keytab for http"), - - /** The system was not able to find Kerberos principal for http in sqoop configuration. */ - AUTH_0006("Unable to find Kerberos principal for http"), - - /** The system was not able to find authorization handler. */ - AUTH_0007("Unable to find authorization handler"), - - /** The system was not able to find authorization access controller. */ - AUTH_0008("Unable to find authorization access controller"), - - /** The system was not able to find authorization validator. */ - AUTH_0009("Unable to find authorization validator"), - - /** The system was not able to find authentication provider. */ - AUTH_0010("Unable to find authentication provider"), - - /** The system was not able to get authentication from http request. */ - AUTH_0011("Unable to get remote authentication from http request"), - - /** The system was not able to get role name from http request. */ - AUTH_0012("Unable to get role name from http request"), - - /** The system was not able to get principal from http request. */ - AUTH_0013("Unable to get principal from http request"), - - /** Authorization Exception, used by authorization implementation, etc. Sentry. */ - AUTH_0014("Authorization exception"); - - private final String message; - - private SecurityError(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/dedd84a4/core/src/main/java/org/apache/sqoop/security/SecurityFactory.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/sqoop/security/SecurityFactory.java b/core/src/main/java/org/apache/sqoop/security/SecurityFactory.java index 727d3be..9fdf5f8 100644 --- a/core/src/main/java/org/apache/sqoop/security/SecurityFactory.java +++ b/core/src/main/java/org/apache/sqoop/security/SecurityFactory.java @@ -18,6 +18,7 @@ package org.apache.sqoop.security; import org.apache.sqoop.common.SqoopException; +import org.apache.sqoop.error.code.SecurityError; import org.apache.sqoop.utils.ClassUtils; /** http://git-wip-us.apache.org/repos/asf/sqoop/blob/dedd84a4/core/src/test/java/org/apache/sqoop/core/TestSqoopConfiguration.java ---------------------------------------------------------------------- diff --git a/core/src/test/java/org/apache/sqoop/core/TestSqoopConfiguration.java b/core/src/test/java/org/apache/sqoop/core/TestSqoopConfiguration.java index 956e6ab..b11587c 100644 --- a/core/src/test/java/org/apache/sqoop/core/TestSqoopConfiguration.java +++ b/core/src/test/java/org/apache/sqoop/core/TestSqoopConfiguration.java @@ -20,6 +20,7 @@ package org.apache.sqoop.core; import java.util.Properties; import org.apache.sqoop.common.SqoopException; +import org.apache.sqoop.error.code.CoreError; import org.testng.Assert; import org.testng.annotations.BeforeMethod; import org.testng.annotations.Test; http://git-wip-us.apache.org/repos/asf/sqoop/blob/dedd84a4/core/src/test/java/org/apache/sqoop/driver/TestJobManager.java ---------------------------------------------------------------------- diff --git a/core/src/test/java/org/apache/sqoop/driver/TestJobManager.java b/core/src/test/java/org/apache/sqoop/driver/TestJobManager.java index baca35f..2a14ff2 100644 --- a/core/src/test/java/org/apache/sqoop/driver/TestJobManager.java +++ b/core/src/test/java/org/apache/sqoop/driver/TestJobManager.java @@ -31,6 +31,7 @@ import org.apache.sqoop.common.Direction; import org.apache.sqoop.common.SqoopException; import org.apache.sqoop.connector.ConnectorManager; import org.apache.sqoop.connector.spi.SqoopConnector; +import org.apache.sqoop.error.code.DriverError; import org.apache.sqoop.model.MJob; import org.apache.sqoop.model.MLink; import org.apache.sqoop.model.MSubmission; http://git-wip-us.apache.org/repos/asf/sqoop/blob/dedd84a4/core/src/test/java/org/apache/sqoop/repository/TestJdbcRepository.java ---------------------------------------------------------------------- diff --git a/core/src/test/java/org/apache/sqoop/repository/TestJdbcRepository.java b/core/src/test/java/org/apache/sqoop/repository/TestJdbcRepository.java index 9b153fc..1c97c32 100644 --- a/core/src/test/java/org/apache/sqoop/repository/TestJdbcRepository.java +++ b/core/src/test/java/org/apache/sqoop/repository/TestJdbcRepository.java @@ -47,6 +47,7 @@ import org.apache.sqoop.connector.spi.ConnectorConfigurableUpgrader; import org.apache.sqoop.connector.spi.SqoopConnector; import org.apache.sqoop.driver.Driver; import org.apache.sqoop.driver.DriverUpgrader; +import org.apache.sqoop.error.code.RepositoryError; import org.apache.sqoop.json.DriverBean; import org.apache.sqoop.model.ConfigUtils; import org.apache.sqoop.model.ConfigurationClass; http://git-wip-us.apache.org/repos/asf/sqoop/blob/dedd84a4/core/src/test/java/org/apache/sqoop/repository/TestRepositoryManager.java ---------------------------------------------------------------------- diff --git a/core/src/test/java/org/apache/sqoop/repository/TestRepositoryManager.java b/core/src/test/java/org/apache/sqoop/repository/TestRepositoryManager.java index 95b868a..ba53552 100644 --- a/core/src/test/java/org/apache/sqoop/repository/TestRepositoryManager.java +++ b/core/src/test/java/org/apache/sqoop/repository/TestRepositoryManager.java @@ -24,6 +24,7 @@ import org.apache.sqoop.core.ConfigurationConstants; import org.apache.sqoop.core.PropertiesConfigurationProvider; import org.apache.sqoop.core.SqoopConfiguration; import org.apache.sqoop.core.TestUtils; +import org.apache.sqoop.error.code.RepositoryError; import org.testng.Assert; import org.testng.annotations.Test; http://git-wip-us.apache.org/repos/asf/sqoop/blob/dedd84a4/security/src/main/java/org/apache/sqoop/security/Authentication/KerberosAuthenticationHandler.java ---------------------------------------------------------------------- diff --git a/security/src/main/java/org/apache/sqoop/security/Authentication/KerberosAuthenticationHandler.java b/security/src/main/java/org/apache/sqoop/security/Authentication/KerberosAuthenticationHandler.java index db89a2d..3515b81 100644 --- a/security/src/main/java/org/apache/sqoop/security/Authentication/KerberosAuthenticationHandler.java +++ b/security/src/main/java/org/apache/sqoop/security/Authentication/KerberosAuthenticationHandler.java @@ -26,7 +26,7 @@ import org.apache.sqoop.common.SqoopException; import org.apache.sqoop.core.SqoopConfiguration; import org.apache.sqoop.security.AuthenticationHandler; import org.apache.sqoop.security.SecurityConstants; -import org.apache.sqoop.security.SecurityError; +import org.apache.sqoop.error.code.SecurityError; import java.io.IOException; http://git-wip-us.apache.org/repos/asf/sqoop/blob/dedd84a4/security/src/main/java/org/apache/sqoop/security/Authorization/DefaultAuthenticationProvider.java ---------------------------------------------------------------------- diff --git a/security/src/main/java/org/apache/sqoop/security/Authorization/DefaultAuthenticationProvider.java b/security/src/main/java/org/apache/sqoop/security/Authorization/DefaultAuthenticationProvider.java index 547040b..e05f1de 100644 --- a/security/src/main/java/org/apache/sqoop/security/Authorization/DefaultAuthenticationProvider.java +++ b/security/src/main/java/org/apache/sqoop/security/Authorization/DefaultAuthenticationProvider.java @@ -22,7 +22,7 @@ import org.apache.hadoop.security.UserGroupInformation; import org.apache.hadoop.security.token.delegation.web.HttpUserGroupInformation; import org.apache.sqoop.common.SqoopException; import org.apache.sqoop.security.AuthenticationProvider; -import org.apache.sqoop.security.SecurityError; +import org.apache.sqoop.error.code.SecurityError; public class DefaultAuthenticationProvider extends AuthenticationProvider { http://git-wip-us.apache.org/repos/asf/sqoop/blob/dedd84a4/server/src/main/java/org/apache/sqoop/filter/SqoopAuthenticationFilter.java ---------------------------------------------------------------------- diff --git a/server/src/main/java/org/apache/sqoop/filter/SqoopAuthenticationFilter.java b/server/src/main/java/org/apache/sqoop/filter/SqoopAuthenticationFilter.java index ddca9d4..20d43e4 100644 --- a/server/src/main/java/org/apache/sqoop/filter/SqoopAuthenticationFilter.java +++ b/server/src/main/java/org/apache/sqoop/filter/SqoopAuthenticationFilter.java @@ -29,7 +29,7 @@ import org.apache.sqoop.common.MapContext; import org.apache.sqoop.common.SqoopException; import org.apache.sqoop.core.SqoopConfiguration; import org.apache.sqoop.security.SecurityConstants; -import org.apache.sqoop.security.SecurityError; +import org.apache.sqoop.error.code.SecurityError; import javax.servlet.FilterConfig; import javax.servlet.ServletException; http://git-wip-us.apache.org/repos/asf/sqoop/blob/dedd84a4/server/src/main/java/org/apache/sqoop/handler/AuthorizationRequestHandler.java ---------------------------------------------------------------------- diff --git a/server/src/main/java/org/apache/sqoop/handler/AuthorizationRequestHandler.java b/server/src/main/java/org/apache/sqoop/handler/AuthorizationRequestHandler.java index 5562592..d5e6555 100644 --- a/server/src/main/java/org/apache/sqoop/handler/AuthorizationRequestHandler.java +++ b/server/src/main/java/org/apache/sqoop/handler/AuthorizationRequestHandler.java @@ -28,7 +28,7 @@ import org.apache.sqoop.model.MResource; import org.apache.sqoop.model.MRole; import org.apache.sqoop.security.AuthorizationHandler; import org.apache.sqoop.security.AuthorizationManager; -import org.apache.sqoop.security.SecurityError; +import org.apache.sqoop.error.code.SecurityError; import org.apache.sqoop.server.RequestContext; import org.apache.sqoop.server.RequestHandler; import org.json.simple.JSONObject; http://git-wip-us.apache.org/repos/asf/sqoop/blob/dedd84a4/server/src/main/java/org/apache/sqoop/server/SqoopProtocolServlet.java ---------------------------------------------------------------------- diff --git a/server/src/main/java/org/apache/sqoop/server/SqoopProtocolServlet.java b/server/src/main/java/org/apache/sqoop/server/SqoopProtocolServlet.java index 896c605..6b76b0b 100644 --- a/server/src/main/java/org/apache/sqoop/server/SqoopProtocolServlet.java +++ b/server/src/main/java/org/apache/sqoop/server/SqoopProtocolServlet.java @@ -30,7 +30,7 @@ import org.apache.sqoop.json.ThrowableBean; import org.apache.sqoop.common.SqoopException; import org.apache.sqoop.common.SqoopProtocolConstants; import org.apache.sqoop.common.SqoopResponseCode; -import org.apache.sqoop.core.CoreError; +import org.apache.sqoop.error.code.CoreError; import org.apache.sqoop.json.JsonBean; @SuppressWarnings("serial") http://git-wip-us.apache.org/repos/asf/sqoop/blob/dedd84a4/test/src/test/java/org/apache/sqoop/integration/server/SubmissionWithDisabledModelObjectsTest.java ---------------------------------------------------------------------- diff --git a/test/src/test/java/org/apache/sqoop/integration/server/SubmissionWithDisabledModelObjectsTest.java b/test/src/test/java/org/apache/sqoop/integration/server/SubmissionWithDisabledModelObjectsTest.java index 9b3babd..3823583 100644 --- a/test/src/test/java/org/apache/sqoop/integration/server/SubmissionWithDisabledModelObjectsTest.java +++ b/test/src/test/java/org/apache/sqoop/integration/server/SubmissionWithDisabledModelObjectsTest.java @@ -21,7 +21,7 @@ import org.apache.sqoop.client.ClientError; import org.apache.sqoop.common.Direction; import org.apache.sqoop.common.SqoopException; import org.apache.sqoop.connector.hdfs.configuration.ToFormat; -import org.apache.sqoop.driver.DriverError; +import org.apache.sqoop.error.code.DriverError; import org.apache.sqoop.model.MLink; import org.apache.sqoop.model.MConfigList; import org.apache.sqoop.model.MJob;
