Repository: sqoop Updated Branches: refs/heads/sqoop2 587f50d18 -> d68737ecf
SQOOP-2251: Sqoop2: ErrorCodes: Move RepositoryError to core module (Jarek Jarcec Cecho 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/d68737ec Tree: http://git-wip-us.apache.org/repos/asf/sqoop/tree/d68737ec Diff: http://git-wip-us.apache.org/repos/asf/sqoop/diff/d68737ec Branch: refs/heads/sqoop2 Commit: d68737ecfdefe110b8ac68afe349058cc6579072 Parents: 587f50d Author: Abraham Elmahrek <[email protected]> Authored: Mon Mar 23 15:24:55 2015 -0700 Committer: Abraham Elmahrek <[email protected]> Committed: Mon Mar 23 15:24:55 2015 -0700 ---------------------------------------------------------------------- .../sqoop/error/code/RepositoryError.java | 142 ------------------- .../apache/sqoop/repository/JdbcRepository.java | 2 - .../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 - .../sqoop/repository/TestJdbcRepository.java | 1 - .../sqoop/repository/TestRepositoryManager.java | 1 - 10 files changed, 142 insertions(+), 151 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/sqoop/blob/d68737ec/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 deleted file mode 100644 index fb8d9c5..0000000 --- a/common/src/main/java/org/apache/sqoop/error/code/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.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/d68737ec/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 052adba..c09b77b 100644 --- a/core/src/main/java/org/apache/sqoop/repository/JdbcRepository.java +++ b/core/src/main/java/org/apache/sqoop/repository/JdbcRepository.java @@ -23,12 +23,10 @@ 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; import org.apache.sqoop.model.MDriver; -import org.apache.sqoop.model.MInput; 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/d68737ec/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 99cd4ee..0a8139a 100644 --- a/core/src/main/java/org/apache/sqoop/repository/JdbcRepositoryContext.java +++ b/core/src/main/java/org/apache/sqoop/repository/JdbcRepositoryContext.java @@ -25,7 +25,6 @@ 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/d68737ec/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 56b859e..011527f 100644 --- a/core/src/main/java/org/apache/sqoop/repository/JdbcRepositoryProvider.java +++ b/core/src/main/java/org/apache/sqoop/repository/JdbcRepositoryProvider.java @@ -35,7 +35,6 @@ 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/d68737ec/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 bc7c316..86be30f 100644 --- a/core/src/main/java/org/apache/sqoop/repository/JdbcRepositoryTransaction.java +++ b/core/src/main/java/org/apache/sqoop/repository/JdbcRepositoryTransaction.java @@ -26,7 +26,6 @@ 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/d68737ec/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 ceedc5d..aa91661 100644 --- a/core/src/main/java/org/apache/sqoop/repository/Repository.java +++ b/core/src/main/java/org/apache/sqoop/repository/Repository.java @@ -30,7 +30,6 @@ 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/d68737ec/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 new file mode 100644 index 0000000..f684e85 --- /dev/null +++ b/core/src/main/java/org/apache/sqoop/repository/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.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/d68737ec/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 8015216..121f388 100644 --- a/core/src/main/java/org/apache/sqoop/repository/RepositoryManager.java +++ b/core/src/main/java/org/apache/sqoop/repository/RepositoryManager.java @@ -25,7 +25,6 @@ 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/d68737ec/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 1c97c32..9b153fc 100644 --- a/core/src/test/java/org/apache/sqoop/repository/TestJdbcRepository.java +++ b/core/src/test/java/org/apache/sqoop/repository/TestJdbcRepository.java @@ -47,7 +47,6 @@ 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/d68737ec/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 ba53552..95b868a 100644 --- a/core/src/test/java/org/apache/sqoop/repository/TestRepositoryManager.java +++ b/core/src/test/java/org/apache/sqoop/repository/TestRepositoryManager.java @@ -24,7 +24,6 @@ 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;
