SQOOP-1589: Sqoop2: Create common constants, error codes, and queries (Abraham Elmahrek via Jarek Jarcec Cecho)
Project: http://git-wip-us.apache.org/repos/asf/sqoop/repo Commit: http://git-wip-us.apache.org/repos/asf/sqoop/commit/5de4b437 Tree: http://git-wip-us.apache.org/repos/asf/sqoop/tree/5de4b437 Diff: http://git-wip-us.apache.org/repos/asf/sqoop/diff/5de4b437 Branch: refs/heads/sqoop2 Commit: 5de4b437826c6dde7f9b880ad24b453d7fcc8ef5 Parents: 4640d81 Author: Jarek Jarcec Cecho <[email protected]> Authored: Mon Nov 10 16:37:00 2014 -0800 Committer: Jarek Jarcec Cecho <[email protected]> Committed: Mon Nov 10 16:37:00 2014 -0800 ---------------------------------------------------------------------- pom.xml | 5 + repository/pom.xml | 1 + repository/repository-common/pom.xml | 60 + .../repository/common/CommonRepoConstants.java | 24 + .../common/CommonRepositoryError.java | 201 ++ .../common/CommonRepositoryHandler.java | 2286 ++++++++++++++++++ ...RepositoryInsertUpdateDeleteSelectQuery.java | 550 +++++ .../common/CommonRepositorySchemaConstants.java | 248 ++ repository/repository-derby/pom.xml | 5 + .../repository/derby/DerbyRepoConstants.java | 1 - .../sqoop/repository/derby/DerbyRepoError.java | 160 +- .../derby/DerbyRepositoryHandler.java | 2252 +---------------- ...erbySchemaInsertUpdateDeleteSelectQuery.java | 541 +---- .../sqoop/repository/derby/TestJobHandling.java | 3 +- .../repository/derby/TestLinkHandling.java | 5 +- .../derby/TestRespositorySchemaUpgrade.java | 2 +- server/pom.xml | 5 + test/pom.xml | 5 + 18 files changed, 3445 insertions(+), 2909 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/sqoop/blob/5de4b437/pom.xml ---------------------------------------------------------------------- diff --git a/pom.xml b/pom.xml index 8859398..9ff51d1 100644 --- a/pom.xml +++ b/pom.xml @@ -286,6 +286,11 @@ limitations under the License. </dependency> <dependency> <groupId>org.apache.sqoop.repository</groupId> + <artifactId>sqoop-repository-common</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>org.apache.sqoop.repository</groupId> <artifactId>sqoop-repository-derby</artifactId> <version>${project.version}</version> </dependency> http://git-wip-us.apache.org/repos/asf/sqoop/blob/5de4b437/repository/pom.xml ---------------------------------------------------------------------- diff --git a/repository/pom.xml b/repository/pom.xml index e3345c4..8c95c0e 100644 --- a/repository/pom.xml +++ b/repository/pom.xml @@ -33,6 +33,7 @@ limitations under the License. <packaging>pom</packaging> <modules> + <module>repository-common</module> <module>repository-derby</module> </modules> http://git-wip-us.apache.org/repos/asf/sqoop/blob/5de4b437/repository/repository-common/pom.xml ---------------------------------------------------------------------- diff --git a/repository/repository-common/pom.xml b/repository/repository-common/pom.xml new file mode 100644 index 0000000..37378c6 --- /dev/null +++ b/repository/repository-common/pom.xml @@ -0,0 +1,60 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- +Licensed to the Apache Software Foundation (ASF) under one or more +contributor license agreements. See the NOTICE file distributed with +this work for additional information regarding copyright ownership. +The ASF licenses this file to You under the Apache License, Version 2.0 +(the "License"); you may not use this file except in compliance with +the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +--> +<project xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + + <modelVersion>4.0.0</modelVersion> + + <parent> + <groupId>org.apache.sqoop</groupId> + <artifactId>repository</artifactId> + <version>2.0.0-SNAPSHOT</version> + </parent> + + <groupId>org.apache.sqoop.repository</groupId> + <artifactId>sqoop-repository-common</artifactId> + <name>Sqoop Common Repository</name> + + <dependencies> + <dependency> + <groupId>org.apache.sqoop</groupId> + <artifactId>sqoop-core</artifactId> + </dependency> + + <dependency> + <groupId>commons-lang</groupId> + <artifactId>commons-lang</artifactId> + </dependency> + + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <scope>test</scope> + </dependency> + + <dependency> + <groupId>org.apache.sqoop</groupId> + <artifactId>sqoop-core</artifactId> + <type>test-jar</type> + <scope>test</scope> + </dependency> + + </dependencies> + +</project> http://git-wip-us.apache.org/repos/asf/sqoop/blob/5de4b437/repository/repository-common/src/main/java/org/apache/sqoop/repository/common/CommonRepoConstants.java ---------------------------------------------------------------------- diff --git a/repository/repository-common/src/main/java/org/apache/sqoop/repository/common/CommonRepoConstants.java b/repository/repository-common/src/main/java/org/apache/sqoop/repository/common/CommonRepoConstants.java new file mode 100644 index 0000000..d1890b8 --- /dev/null +++ b/repository/repository-common/src/main/java/org/apache/sqoop/repository/common/CommonRepoConstants.java @@ -0,0 +1,24 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.sqoop.repository.common; + +public class CommonRepoConstants { + + public static final String SYSKEY_VERSION = "repository.version"; + +} http://git-wip-us.apache.org/repos/asf/sqoop/blob/5de4b437/repository/repository-common/src/main/java/org/apache/sqoop/repository/common/CommonRepositoryError.java ---------------------------------------------------------------------- diff --git a/repository/repository-common/src/main/java/org/apache/sqoop/repository/common/CommonRepositoryError.java b/repository/repository-common/src/main/java/org/apache/sqoop/repository/common/CommonRepositoryError.java new file mode 100644 index 0000000..7a7b28c --- /dev/null +++ b/repository/repository-common/src/main/java/org/apache/sqoop/repository/common/CommonRepositoryError.java @@ -0,0 +1,201 @@ +/** + * 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.common; + +import org.apache.sqoop.common.ErrorCode; + +public enum CommonRepositoryError implements ErrorCode { + // JDBC Repository Handler Errors: Prefix COMMON + + /** The system was unable to run the specified query. */ + COMMON_0000("Unable to run specified query"), + + /** The system was unable to query the repository for given entity */ + COMMON_0001("Unable to retrieve entity data"), + + /** The repository contains more than one connector with same name */ + COMMON_0002("Invalid entity state - multiple connectors with name"), + + /** The system does not support the given input type.*/ + COMMON_0003("Unknown input type encountered"), + + /** The system does not support the given config type.*/ + COMMON_0004("Unknown config type encountered"), + + /** No input was found for the given config. */ + COMMON_0005("The config contains no input"), + + /** The system could not load the config due to unexpected position of input.*/ + COMMON_0006("The config input retrieved does not match expected position"), + + /** + * The system could not load the connector due to unexpected position + * of config. + */ + COMMON_0007("The config retrieved does not match expected position"), + + /** + * The system was not able to register entity due to a pre-assigned + * persistence identifier. + */ + COMMON_0008("Entity cannot have preassigned persistence id"), + + /** + * The system was unable to register various entities. + */ + COMMON_0009("Unexpected update count when registering entity"), + + /** + * The system was unable to register entity due to a failure to retrieve + * the generated identifier. + */ + COMMON_0010("Unable to retrieve generated identifier"), + + /** + * The system was unable to register connector due to a server + * error. + */ + COMMON_0011("Registration of connector failed"), + + /** + * The system was not able to register connector due to an unexpected + * update count. + */ + COMMON_0012("Unexpected update count on config registration"), + + /** + * The system was unable to register connector due to a failure to + * retrieve the generated identifier for a config. + */ + COMMON_0013("Unable to retrieve generated identifier for config"), + + /** + * The system was unable to register connector due to an unexpected + * update count for config input registration. + */ + COMMON_0014("Unexpected update count for config input"), + + /** + * The system was unable to register connector due to a failure to + * retrieve the generated identifier for a config input. + */ + COMMON_0015("Unable to retrieve generated identifier for config input"), + + /** We cant create new link in repository **/ + COMMON_0016("Unable to create new link data"), + + /** We can't save values for input to repository **/ + COMMON_0017("Unable to save input values to the repository"), + + /** We can't update link in repository **/ + COMMON_0018("Unable to update link in repository"), + + /** We can't delete link in repository **/ + COMMON_0019("Unable to delete link in repository"), + + /** We can't restore link from repository **/ + COMMON_0020("Unable to load link from repository"), + + /** We can't restore specific link from repository **/ + COMMON_0021("Unable to load specific link from repository"), + + /** We're unable to check if given link already exists */ + COMMON_0022("Unable to check if given link exists"), + + /** We cant create new job in repository **/ + COMMON_0023("Unable to create new job data"), + + /** We can't update job in repository **/ + COMMON_0024("Unable to update job in repository"), + + /** We can't delete job in repository **/ + COMMON_0025("Unable to delete job in repository"), + + /** We're unable to check if given job already exists */ + COMMON_0026("Unable to check if given job exists"), + + /** We can't restore specific job from repository **/ + COMMON_0027("Unable to load specific job from repository"), + + /** We can't restore job from repository **/ + COMMON_0028("Unable to load job from repository"), + + /** Can't verify if link is referenced from somewhere **/ + COMMON_0029("Unable to check if link is in use"), + + /** We're unable to check if given submission already exists */ + COMMON_0030("Unable to check if given submission exists"), + + /** We cant create new submission in repository **/ + COMMON_0031("Unable to create new submission data"), + + /** We can't update submission in repository **/ + COMMON_0032("Unable to update submission in the repository"), + + /** Can't purge old submissions **/ + COMMON_0033("Unable to purge old submissions"), + + /** Can't retrieve unfinished submissions **/ + COMMON_0034("Can't retrieve unfinished submissions"), + + /** Can't update connector **/ + COMMON_0035("Update of connector failed"), + + /** Can't retrieve all submissions **/ + COMMON_0036("Can't retrieve all submissions"), + + /** Can't retrieve submissions for a job **/ + COMMON_0037("Can't retrieve submissions for a job"), + + /** Can't enable/disable link **/ + COMMON_0038("Can't enable/disable link"), + + /** Can't enable/disable job **/ + COMMON_0039("Can't enable/disable job"), + + /** Can't update driver config **/ + COMMON_0040("Update of driver config failed"), + + /** Can't retrieve all connectors **/ + COMMON_0041("Can't retrieve all connectors"), + + /** Can't register config direction **/ + COMMON_0042("Could not register config direction"), + + /** Can't set connector direction **/ + COMMON_0043("Could not set connector direction"), + + /** The system was unable to register driver due to a server error **/ + COMMON_0044("Registration of driver failed") + + ; + + private final String message; + + private CommonRepositoryError(String message) { + this.message = message; + } + + public String getCode() { + return name(); + } + + public String getMessage() { + return message; + } +}
