Repository: sqoop Updated Branches: refs/heads/sqoop2 1cf075fdf -> c7ef89dba
SQOOP-1870: Sqoop2: Merge SPI and connector-sdk packages (Veena Basavaraj 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/c7ef89db Tree: http://git-wip-us.apache.org/repos/asf/sqoop/tree/c7ef89db Diff: http://git-wip-us.apache.org/repos/asf/sqoop/diff/c7ef89db Branch: refs/heads/sqoop2 Commit: c7ef89dba067b9cc21383fca129c4eb84a20eacc Parents: 1cf075f Author: Abraham Elmahrek <[email protected]> Authored: Mon Jan 5 10:47:10 2015 -0800 Committer: Abraham Elmahrek <[email protected]> Committed: Mon Jan 5 10:47:10 2015 -0800 ---------------------------------------------------------------------- connector/connector-generic-jdbc/pom.xml | 4 - connector/connector-hdfs/pom.xml | 5 - connector/connector-kafka/pom.xml | 4 - connector/connector-kite/pom.xml | 4 - .../sqoop/configurable/ConfigurableError.java | 42 +++++++++ .../configurable/ConfigurableUpgradeUtil.java | 62 +++++++++++++ .../spi/ConnectorConfigurableUpgrader.java | 84 +++++++++++++++++ .../sqoop/connector/spi/SqoopConnector.java | 98 ++++++++++++++++++++ .../java/org/apache/sqoop/job/Constants.java | 44 +++++++++ .../org/apache/sqoop/job/etl/Destroyer.java | 39 ++++++++ .../org/apache/sqoop/job/etl/Extractor.java | 52 +++++++++++ .../java/org/apache/sqoop/job/etl/From.java | 58 ++++++++++++ .../org/apache/sqoop/job/etl/Initializer.java | 77 +++++++++++++++ .../java/org/apache/sqoop/job/etl/Loader.java | 48 ++++++++++ .../org/apache/sqoop/job/etl/Partition.java | 46 +++++++++ .../org/apache/sqoop/job/etl/Partitioner.java | 40 ++++++++ .../main/java/org/apache/sqoop/job/etl/To.java | 51 ++++++++++ .../org/apache/sqoop/job/etl/Transferable.java | 51 ++++++++++ core/pom.xml | 10 +- pom.xml | 6 -- .../sqoop/configurable/ConfigurableError.java | 43 --------- .../configurable/ConfigurableUpgradeUtil.java | 62 ------------- .../spi/ConnectorConfigurableUpgrader.java | 84 ----------------- .../sqoop/connector/spi/SqoopConnector.java | 98 -------------------- .../java/org/apache/sqoop/job/Constants.java | 44 --------- .../org/apache/sqoop/job/etl/Destroyer.java | 39 -------- .../org/apache/sqoop/job/etl/Extractor.java | 52 ----------- .../java/org/apache/sqoop/job/etl/From.java | 58 ------------ .../org/apache/sqoop/job/etl/Initializer.java | 77 --------------- .../java/org/apache/sqoop/job/etl/Loader.java | 48 ---------- .../org/apache/sqoop/job/etl/Partition.java | 46 --------- .../org/apache/sqoop/job/etl/Partitioner.java | 40 -------- .../main/java/org/apache/sqoop/job/etl/To.java | 51 ---------- .../org/apache/sqoop/job/etl/Transferable.java | 51 ---------- 34 files changed, 796 insertions(+), 822 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/sqoop/blob/c7ef89db/connector/connector-generic-jdbc/pom.xml ---------------------------------------------------------------------- diff --git a/connector/connector-generic-jdbc/pom.xml b/connector/connector-generic-jdbc/pom.xml index fc6cab4..a96b348 100644 --- a/connector/connector-generic-jdbc/pom.xml +++ b/connector/connector-generic-jdbc/pom.xml @@ -32,10 +32,6 @@ limitations under the License. <name>Sqoop Generic JDBC Connector</name> <dependencies> - <dependency> - <groupId>org.apache.sqoop</groupId> - <artifactId>sqoop-spi</artifactId> - </dependency> <dependency> <groupId>org.apache.sqoop</groupId> http://git-wip-us.apache.org/repos/asf/sqoop/blob/c7ef89db/connector/connector-hdfs/pom.xml ---------------------------------------------------------------------- diff --git a/connector/connector-hdfs/pom.xml b/connector/connector-hdfs/pom.xml index 8b1e11f..b06275a 100644 --- a/connector/connector-hdfs/pom.xml +++ b/connector/connector-hdfs/pom.xml @@ -39,11 +39,6 @@ limitations under the License. <dependency> <groupId>org.apache.sqoop</groupId> - <artifactId>sqoop-spi</artifactId> - </dependency> - - <dependency> - <groupId>org.apache.sqoop</groupId> <artifactId>connector-sdk</artifactId> </dependency> http://git-wip-us.apache.org/repos/asf/sqoop/blob/c7ef89db/connector/connector-kafka/pom.xml ---------------------------------------------------------------------- diff --git a/connector/connector-kafka/pom.xml b/connector/connector-kafka/pom.xml index e8fea9b..82e43b3 100644 --- a/connector/connector-kafka/pom.xml +++ b/connector/connector-kafka/pom.xml @@ -32,10 +32,6 @@ limitations under the License. <dependencies> <dependency> <groupId>org.apache.sqoop</groupId> - <artifactId>sqoop-spi</artifactId> - </dependency> - <dependency> - <groupId>org.apache.sqoop</groupId> <artifactId>connector-sdk</artifactId> </dependency> <dependency> http://git-wip-us.apache.org/repos/asf/sqoop/blob/c7ef89db/connector/connector-kite/pom.xml ---------------------------------------------------------------------- diff --git a/connector/connector-kite/pom.xml b/connector/connector-kite/pom.xml index 10ed099..17821f9 100644 --- a/connector/connector-kite/pom.xml +++ b/connector/connector-kite/pom.xml @@ -35,10 +35,6 @@ limitations under the License. <!-- Common modules --> <dependency> <groupId>org.apache.sqoop</groupId> - <artifactId>sqoop-spi</artifactId> - </dependency> - <dependency> - <groupId>org.apache.sqoop</groupId> <artifactId>connector-sdk</artifactId> </dependency> <dependency> http://git-wip-us.apache.org/repos/asf/sqoop/blob/c7ef89db/connector/connector-sdk/src/main/java/org/apache/sqoop/configurable/ConfigurableError.java ---------------------------------------------------------------------- diff --git a/connector/connector-sdk/src/main/java/org/apache/sqoop/configurable/ConfigurableError.java b/connector/connector-sdk/src/main/java/org/apache/sqoop/configurable/ConfigurableError.java new file mode 100644 index 0000000..ee11846 --- /dev/null +++ b/connector/connector-sdk/src/main/java/org/apache/sqoop/configurable/ConfigurableError.java @@ -0,0 +1,42 @@ +/** + * 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.configurable; + +import org.apache.sqoop.common.ErrorCode; + +public enum ConfigurableError implements ErrorCode { + + /** An unknown error has occurred. */ + CONFIGURABLE_0001("Link object upgrade called, but no upgrade routine provided for LINK config"), + CONFIGURABLE_0002("Job object upgrade called, but no upgrade routine provided for FROM job config"), + CONFIGURABLE_0003("Job object upgrade called, but no upgrade routine provided for TO job config"), + ; + private final String message; + + private ConfigurableError(String message) { + this.message = message; + } + + public String getCode() { + return name(); + } + + public String getMessage() { + return message; + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/sqoop/blob/c7ef89db/connector/connector-sdk/src/main/java/org/apache/sqoop/configurable/ConfigurableUpgradeUtil.java ---------------------------------------------------------------------- diff --git a/connector/connector-sdk/src/main/java/org/apache/sqoop/configurable/ConfigurableUpgradeUtil.java b/connector/connector-sdk/src/main/java/org/apache/sqoop/configurable/ConfigurableUpgradeUtil.java new file mode 100644 index 0000000..715a61c --- /dev/null +++ b/connector/connector-sdk/src/main/java/org/apache/sqoop/configurable/ConfigurableUpgradeUtil.java @@ -0,0 +1,62 @@ +/** + * 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.configurable; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.apache.log4j.Logger; +import org.apache.sqoop.common.SqoopException; +import org.apache.sqoop.model.MConfig; +import org.apache.sqoop.model.MInput; + +public class ConfigurableUpgradeUtil { + + private static final Logger LOG = Logger.getLogger(ConfigurableUpgradeUtil.class); + /* + * For now, there is no real upgrade. So copy all data over, + * set the validation messages and error messages to be the same as for the + * inputs in the original one. + */ + @SuppressWarnings("unchecked") + public static void doUpgrade(List<MConfig> original, List<MConfig> target) { + Map<String, MConfig> configMap = new HashMap<String, MConfig>(); + for (MConfig config : original) { + configMap.put(config.getName(), config); + } + for (MConfig config : target) { + List<MInput<?>> inputs = config.getInputs(); + MConfig originalConfig = configMap.get(config.getName()); + if (originalConfig == null) { + LOG.warn("Config: '" + config.getName() + "' not present in old " + + "configurable. So it and its inputs will not be transferred by the upgrader."); + continue; + } + for (MInput input : inputs) { + try { + MInput originalInput = originalConfig.getInput(input.getName()); + input.setValue(originalInput.getValue()); + } catch (SqoopException ex) { + LOG.warn("Input: '" + input.getName() + "' not present in old " + + "configurable. So it will not be transferred by the upgrader."); + } + } + } + } +} http://git-wip-us.apache.org/repos/asf/sqoop/blob/c7ef89db/connector/connector-sdk/src/main/java/org/apache/sqoop/connector/spi/ConnectorConfigurableUpgrader.java ---------------------------------------------------------------------- diff --git a/connector/connector-sdk/src/main/java/org/apache/sqoop/connector/spi/ConnectorConfigurableUpgrader.java b/connector/connector-sdk/src/main/java/org/apache/sqoop/connector/spi/ConnectorConfigurableUpgrader.java new file mode 100644 index 0000000..b5e0c0d --- /dev/null +++ b/connector/connector-sdk/src/main/java/org/apache/sqoop/connector/spi/ConnectorConfigurableUpgrader.java @@ -0,0 +1,84 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.sqoop.connector.spi; + +import org.apache.sqoop.common.SqoopException; +import org.apache.sqoop.configurable.ConfigurableError; +import org.apache.sqoop.model.MFromConfig; +import org.apache.sqoop.model.MLinkConfig; +import org.apache.sqoop.model.MToConfig; + +/** + * Configurable represents an entity that can provide configurations for the + * support config types {@linkplain ConfigType} + * This api represents the interface that configurable such as the connector/driver + * will implement to upgrade both the config and its corresponding data across different + * versions + * + */ +public abstract class ConnectorConfigurableUpgrader { + + /** + * Upgrade the original link config for the given config type and fill into the upgradeTarget. Note + * that any data already in {@code upgradeTarget} maybe overwritten. + * @param original - original config as in the repository + * @param upgradeTarget - the instance that will be filled in with the + * upgraded config + */ + public void upgradeLinkConfig(MLinkConfig original, MLinkConfig upgradeTarget) { + // The reasoning for throwing an exception by default is as follows. + // Sqoop calls the upgrade apis for every connector if and only if the + // corresponding link object that the config is associated with exists in the sqoop + // repository. In unexpected scenarios, if a link object is created in the + // sqoop repository without a corresponding upgrade routine for + // the link config, then this exception will be thrown to indicate a + // unexpected code path. In normal circumstances this + // scenario of having a link object for a connector without link config is + // very unlikely to happen. A likely scenario is that a connector will not have a link config and hence + // no link object will be created and thus this method will not be invoked. + throw new SqoopException(ConfigurableError.CONFIGURABLE_0001); + + } + + /** + * Upgrade the original FROM job config for the given config type and fill into the upgradeTarget. Note + * that any data already in {@code upgradeTarget} maybe overwritten. + * @param original - original config as in the repository + * @param upgradeTarget - the instance that will be filled in with the + * upgraded config + */ + + public void upgradeFromJobConfig(MFromConfig original, MFromConfig upgradeTarget) { + // see above for the reasoning behind the exception + throw new SqoopException(ConfigurableError.CONFIGURABLE_0002); + } + /** + * Upgrade the original TO job config for the given config type and fill into the upgradeTarget. Note + * that any data already in {@code upgradeTarget} maybe overwritten. + * @param original - original config as in the repository + * @param upgradeTarget - the instance that will be filled in with the + * upgraded config + */ + public void upgradeToJobConfig(MToConfig original, MToConfig upgradeTarget) { + // see above for the reasoning behind the exception + throw new SqoopException(ConfigurableError.CONFIGURABLE_0003); + + } + +} http://git-wip-us.apache.org/repos/asf/sqoop/blob/c7ef89db/connector/connector-sdk/src/main/java/org/apache/sqoop/connector/spi/SqoopConnector.java ---------------------------------------------------------------------- diff --git a/connector/connector-sdk/src/main/java/org/apache/sqoop/connector/spi/SqoopConnector.java b/connector/connector-sdk/src/main/java/org/apache/sqoop/connector/spi/SqoopConnector.java new file mode 100644 index 0000000..ff6392e --- /dev/null +++ b/connector/connector-sdk/src/main/java/org/apache/sqoop/connector/spi/SqoopConnector.java @@ -0,0 +1,98 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.sqoop.connector.spi; + +import java.util.Arrays; +import java.util.List; +import java.util.Locale; +import java.util.ResourceBundle; + +import org.apache.sqoop.common.Direction; +import org.apache.sqoop.connector.idf.CSVIntermediateDataFormat; +import org.apache.sqoop.connector.idf.IntermediateDataFormat; +import org.apache.sqoop.job.etl.From; +import org.apache.sqoop.job.etl.To; + +/** + * Service provider interface for Sqoop Connectors. + */ +public abstract class SqoopConnector { + + /** + * Retrieve connector version. + * + * @return Version encoded as a string + */ + public abstract String getVersion(); + + /** + * @param locale + * @return the resource bundle associated with the given locale. + */ + public abstract ResourceBundle getBundle(Locale locale); + + /** + * @return The supported directions + */ + public List<Direction> getSupportedDirections() { + return Arrays.asList(new Direction[]{ + Direction.FROM, + Direction.TO + }); + } + + /** + * @return Get link configuration group class + */ + @SuppressWarnings("rawtypes") + public abstract Class getLinkConfigurationClass(); + + /** + * @return Get job configuration group class per direction type or null if not supported + */ + @SuppressWarnings("rawtypes") + public abstract Class getJobConfigurationClass(Direction direction); + + /** + * @return an <tt>From</tt> that provides classes for performing import. + */ + public abstract From getFrom(); + + /** + * @return an <tt>To</tt> that provides classes for performing export.n + */ + public abstract To getTo(); + + /** + * Returns an {@linkplain ConnectorConfigurableUpgrader} object that can upgrade the + * configs related to the link and job + * @return RespositoryUpgrader object + */ + public abstract ConnectorConfigurableUpgrader getConfigurableUpgrader(); + + /** + * Returns the {@linkplain IntermediateDataFormat} this connector + * can return natively in. This will support retrieving the data as text + * and an array of objects. This should never return null. + * + * @return {@linkplain IntermediateDataFormat} object + */ + public Class<? extends IntermediateDataFormat<?>> getIntermediateDataFormat() { + return CSVIntermediateDataFormat.class; + } +} http://git-wip-us.apache.org/repos/asf/sqoop/blob/c7ef89db/connector/connector-sdk/src/main/java/org/apache/sqoop/job/Constants.java ---------------------------------------------------------------------- diff --git a/connector/connector-sdk/src/main/java/org/apache/sqoop/job/Constants.java b/connector/connector-sdk/src/main/java/org/apache/sqoop/job/Constants.java new file mode 100644 index 0000000..90935cf --- /dev/null +++ b/connector/connector-sdk/src/main/java/org/apache/sqoop/job/Constants.java @@ -0,0 +1,44 @@ +/** + * 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.job; + +public class Constants { + + /** + * All job related configuration is prefixed with this: + * <tt>org.apache.sqoop.job.</tt> + */ + public static final String PREFIX_CONFIG = "org.apache.sqoop.job."; + + public static final String JOB_ETL_NUMBER_PARTITIONS = PREFIX_CONFIG + + "etl.number.partitions"; + + public static final String JOB_ETL_FIELD_NAMES = PREFIX_CONFIG + + "etl.field.names"; + + public static final String JOB_ETL_OUTPUT_DIRECTORY = PREFIX_CONFIG + + "etl.output.directory"; + + public static final String JOB_ETL_INPUT_DIRECTORY = PREFIX_CONFIG + + "etl.input.directory"; + + protected Constants() { + // Disable explicit object creation + } + +} http://git-wip-us.apache.org/repos/asf/sqoop/blob/c7ef89db/connector/connector-sdk/src/main/java/org/apache/sqoop/job/etl/Destroyer.java ---------------------------------------------------------------------- diff --git a/connector/connector-sdk/src/main/java/org/apache/sqoop/job/etl/Destroyer.java b/connector/connector-sdk/src/main/java/org/apache/sqoop/job/etl/Destroyer.java new file mode 100644 index 0000000..8486154 --- /dev/null +++ b/connector/connector-sdk/src/main/java/org/apache/sqoop/job/etl/Destroyer.java @@ -0,0 +1,39 @@ +/** + * 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.job.etl; + +/** + * This allows connector to define work to complete execution, for example, + * resource cleaning. + */ +public abstract class Destroyer<LinkConfiguration, JobConfiguration> { + + /** + * Callback to clean up after job execution + * + * @param context Destroyer context + * @param linkConfiguration link configuration object + * @param jobConfiguration job configuration object for the FROM and TO + * In case of the FROM destroyer this will represent the FROM job configuration + * In case of the TO destroyer this will represent the TO job configuration + */ + public abstract void destroy(DestroyerContext context, + LinkConfiguration linkConfiguration, + JobConfiguration jobConfiguration); + +} http://git-wip-us.apache.org/repos/asf/sqoop/blob/c7ef89db/connector/connector-sdk/src/main/java/org/apache/sqoop/job/etl/Extractor.java ---------------------------------------------------------------------- diff --git a/connector/connector-sdk/src/main/java/org/apache/sqoop/job/etl/Extractor.java b/connector/connector-sdk/src/main/java/org/apache/sqoop/job/etl/Extractor.java new file mode 100644 index 0000000..85e91ef --- /dev/null +++ b/connector/connector-sdk/src/main/java/org/apache/sqoop/job/etl/Extractor.java @@ -0,0 +1,52 @@ +/** + * 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.job.etl; + +/** + * This allows connector to extract data from a source system + * based on each partition. + */ +public abstract class Extractor<LinkConfiguration, FromJobConfiguration, SqoopPartition> { + + /** + * Extract data from source and pass them into the Sqoop. + * + * @param context Extractor context object + * @param linkConfiguration link configuration object + * @param jobConfiguration FROM job configuration object + * @param partition Partition that this extracter should work on + */ + public abstract void extract(ExtractorContext context, + LinkConfiguration linkConfiguration, + FromJobConfiguration jobConfiguration, + SqoopPartition partition); + + /** + * Return the number of rows read by the last call to + * {@linkplain Extractor#extract(org.apache.sqoop.job.etl.ExtractorContext, java.lang.Object, java.lang.Object, Partition) } + * method. This method returns only the number of rows read in the last call, + * and not a cumulative total of the number of rows read by this Extractor + * since its creation. If no calls were made to the run method, this method's + * behavior is undefined. + * + * @return the number of rows read by the last call to + * {@linkplain Extractor#extract(org.apache.sqoop.job.etl.ExtractorContext, java.lang.Object, java.lang.Object, Partition) } + */ + public abstract long getRowsRead(); + +} http://git-wip-us.apache.org/repos/asf/sqoop/blob/c7ef89db/connector/connector-sdk/src/main/java/org/apache/sqoop/job/etl/From.java ---------------------------------------------------------------------- diff --git a/connector/connector-sdk/src/main/java/org/apache/sqoop/job/etl/From.java b/connector/connector-sdk/src/main/java/org/apache/sqoop/job/etl/From.java new file mode 100644 index 0000000..3dd8fb9 --- /dev/null +++ b/connector/connector-sdk/src/main/java/org/apache/sqoop/job/etl/From.java @@ -0,0 +1,58 @@ +/** + * 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.job.etl; + +/** + * This specifies classes that perform connector-defined steps + * within import execution: + * Initializer + * -> Partitioner + * -> Extractor + * -> (Sqoop-defined steps) + * -> Destroyer + */ +public class From extends Transferable { + + private Class<? extends Partitioner> partitioner; + private Class<? extends Extractor> extractor; + + public From(Class<? extends Initializer> initializer, + Class<? extends Partitioner> partitioner, + Class<? extends Extractor> extractor, + Class<? extends Destroyer> destroyer) { + super(initializer, destroyer); + this.partitioner = partitioner; + this.extractor = extractor; + } + + public Class<? extends Partitioner> getPartitioner() { + return partitioner; + } + + public Class<? extends Extractor> getExtractor() { + return extractor; + } + + @Override + public String toString() { + return "From{" + super.toString() + + ", partitioner=" + partitioner.getName() + + ", extractor=" + extractor.getName() + + '}'; + } +} http://git-wip-us.apache.org/repos/asf/sqoop/blob/c7ef89db/connector/connector-sdk/src/main/java/org/apache/sqoop/job/etl/Initializer.java ---------------------------------------------------------------------- diff --git a/connector/connector-sdk/src/main/java/org/apache/sqoop/job/etl/Initializer.java b/connector/connector-sdk/src/main/java/org/apache/sqoop/job/etl/Initializer.java new file mode 100644 index 0000000..7dd156e --- /dev/null +++ b/connector/connector-sdk/src/main/java/org/apache/sqoop/job/etl/Initializer.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.job.etl; + +import java.util.HashSet; +import java.util.Set; + +import org.apache.sqoop.schema.NullSchema; +import org.apache.sqoop.schema.Schema; + +/** + * This allows connector to define initialization work for execution, + * for example, context configuration. + */ +public abstract class Initializer<LinkConfiguration, JobConfiguration> { + + /** + * Initialize new submission based on given configuration properties. Any + * needed temporary values might be saved to context object and they will be + * promoted to all other part of the workflow automatically. + * + * @param context Initializer context object + * @param linkConfiguration link configuration object + * @param jobConfiguration job configuration object for the FROM and TO + * In case of the FROM initializer this will represent the FROM job configuration + * In case of the TO initializer this will represent the TO job configuration + */ + public abstract void initialize(InitializerContext context, LinkConfiguration linkConfiguration, + JobConfiguration jobConfiguration); + + /** + * Return list of all jars that this particular connector needs to operate on + * following job. This method will be called after running initialize method. + * @param context Initializer context object + * @param linkConfiguration link configuration object + * @param jobConfiguration job configuration object for the FROM and TO + * In case of the FROM initializer this will represent the FROM job configuration + * In case of the TO initializer this will represent the TO job configuration + * @return + */ + public Set<String> getJars(InitializerContext context, LinkConfiguration linkConfiguration, + JobConfiguration jobConfiguration) { + return new HashSet<String>(); + } + + /** + * Return schema associated with the connector for FROM and TO + * By default we assume a null schema. Override the method if there a custom schema to provide either for FROM or TO + * @param context Initializer context object + * @param linkConfiguration link configuration object + * @param jobConfiguration job configuration object for the FROM and TO + * In case of the FROM initializer this will represent the FROM job configuration + * In case of the TO initializer this will represent the TO job configuration + * @return + */ + + public Schema getSchema(InitializerContext context, LinkConfiguration linkConfiguration, + JobConfiguration jobConfiguration) { + return NullSchema.getInstance(); + } + +} http://git-wip-us.apache.org/repos/asf/sqoop/blob/c7ef89db/connector/connector-sdk/src/main/java/org/apache/sqoop/job/etl/Loader.java ---------------------------------------------------------------------- diff --git a/connector/connector-sdk/src/main/java/org/apache/sqoop/job/etl/Loader.java b/connector/connector-sdk/src/main/java/org/apache/sqoop/job/etl/Loader.java new file mode 100644 index 0000000..e47b244 --- /dev/null +++ b/connector/connector-sdk/src/main/java/org/apache/sqoop/job/etl/Loader.java @@ -0,0 +1,48 @@ +/** + * 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.job.etl; + +/** + * This allows connector to load data into a target system. + */ +public abstract class Loader<LinkConfiguration, ToJobConfiguration> { + + /** + * Load data to target. + * + * @param context Loader context object + * @param linkConfiguration link configuration object + * @param jobConfiguration TO job configuration object + * @throws Exception + */ + public abstract void load(LoaderContext context, LinkConfiguration linkConfiguration, + ToJobConfiguration jobConfiguration) throws Exception; + + /** + * Return the number of rows witten by the last call to + * {@linkplain Loader#load(org.apache.sqoop.job.etl.LoaderContext, java.lang.Object) } + * method. This method returns only the number of rows written in the last call, + * and not a cumulative total of the number of rows written by this Loader + * since its creation. + * + * @return the number of rows written by the last call to + * {@linkplain Loader#load(org.apache.sqoop.job.etl.LoaderContext, java.lang.Object) } + */ + public abstract long getRowsWritten(); + +} http://git-wip-us.apache.org/repos/asf/sqoop/blob/c7ef89db/connector/connector-sdk/src/main/java/org/apache/sqoop/job/etl/Partition.java ---------------------------------------------------------------------- diff --git a/connector/connector-sdk/src/main/java/org/apache/sqoop/job/etl/Partition.java b/connector/connector-sdk/src/main/java/org/apache/sqoop/job/etl/Partition.java new file mode 100644 index 0000000..db07844 --- /dev/null +++ b/connector/connector-sdk/src/main/java/org/apache/sqoop/job/etl/Partition.java @@ -0,0 +1,46 @@ +/** + * 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.job.etl; + +import java.io.DataInput; +import java.io.DataOutput; +import java.io.IOException; + +/** + * A part of the input data partitioned by the Partitioner. + */ +public abstract class Partition { + + /** + * Deserialize the fields of this partition from input. + */ + public abstract void readFields(DataInput in) throws IOException; + + /** + * Serialize the fields of this partition to output. + */ + public abstract void write(DataOutput out) throws IOException; + + /** + * Each partition must be easily serializable to human readable form so that + * it can be logged for debugging purpose. + * + * @return Human readable representation + */ + public abstract String toString(); +} http://git-wip-us.apache.org/repos/asf/sqoop/blob/c7ef89db/connector/connector-sdk/src/main/java/org/apache/sqoop/job/etl/Partitioner.java ---------------------------------------------------------------------- diff --git a/connector/connector-sdk/src/main/java/org/apache/sqoop/job/etl/Partitioner.java b/connector/connector-sdk/src/main/java/org/apache/sqoop/job/etl/Partitioner.java new file mode 100644 index 0000000..3636130 --- /dev/null +++ b/connector/connector-sdk/src/main/java/org/apache/sqoop/job/etl/Partitioner.java @@ -0,0 +1,40 @@ +/** + * 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.job.etl; + +import java.util.List; + +/** + * This allows connector to define how input data from the FROM source can be partitioned. + * The number of data partitions also determines the degree of parallelism. + */ +public abstract class Partitioner<LinkConfiguration, FromJobConfiguration> { + + /** + * Partition input data into partitions. + * + * Each partition will be then processed in separate extractor. + * + * @param context Partitioner context object + * @param linkConfiguration link configuration object + * @param jobConfiguration job configuration object + * @return + */ + public abstract List<Partition> getPartitions(PartitionerContext context, + LinkConfiguration linkConfiguration, FromJobConfiguration fromJobConfiguration); +} http://git-wip-us.apache.org/repos/asf/sqoop/blob/c7ef89db/connector/connector-sdk/src/main/java/org/apache/sqoop/job/etl/To.java ---------------------------------------------------------------------- diff --git a/connector/connector-sdk/src/main/java/org/apache/sqoop/job/etl/To.java b/connector/connector-sdk/src/main/java/org/apache/sqoop/job/etl/To.java new file mode 100644 index 0000000..64ba225 --- /dev/null +++ b/connector/connector-sdk/src/main/java/org/apache/sqoop/job/etl/To.java @@ -0,0 +1,51 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.sqoop.job.etl; + +/** + * This specifies classes that perform connector-defined steps + * within export execution: + * Initializer + * -> (Sqoop-defined steps) + * -> Loader + * -> Destroyer + */ +public class To extends Transferable { + + private Class<? extends Loader> loader; + + public To( + Class<? extends Initializer> initializer, + Class<? extends Loader> loader, + Class<? extends Destroyer> destroyer + ) { + super(initializer, destroyer); + this.loader = loader; + } + + public Class<? extends Loader> getLoader() { + return loader; + } + + @Override + public String toString() { + return "To {" + super.toString() + + ", loader=" + loader + + '}'; + } +} http://git-wip-us.apache.org/repos/asf/sqoop/blob/c7ef89db/connector/connector-sdk/src/main/java/org/apache/sqoop/job/etl/Transferable.java ---------------------------------------------------------------------- diff --git a/connector/connector-sdk/src/main/java/org/apache/sqoop/job/etl/Transferable.java b/connector/connector-sdk/src/main/java/org/apache/sqoop/job/etl/Transferable.java new file mode 100644 index 0000000..dfe1d5e --- /dev/null +++ b/connector/connector-sdk/src/main/java/org/apache/sqoop/job/etl/Transferable.java @@ -0,0 +1,51 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.sqoop.job.etl; + +/** + * This entity encapsulates the workflow for data transfer via the + * {@link SqoopConnector}.It basically acts as an adapter between the data-source + * imported from or exported to. + */ +public abstract class Transferable { + + private Class<? extends Initializer> initializer; + private Class<? extends Destroyer> destroyer; + + public Transferable( + Class<? extends Initializer> initializer, + Class<? extends Destroyer> destroyer + ) { + this.initializer = initializer; + this.destroyer = destroyer; + } + + public Class<? extends Destroyer> getDestroyer() { + return destroyer; + } + + public Class<? extends Initializer> getInitializer() { + return initializer; + } + + @Override + public String toString() { + return "initializer=" + initializer.getName() + + ", destroyer=" + destroyer.getName(); + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/sqoop/blob/c7ef89db/core/pom.xml ---------------------------------------------------------------------- diff --git a/core/pom.xml b/core/pom.xml index 2b6e436..b6e9557 100644 --- a/core/pom.xml +++ b/core/pom.xml @@ -40,11 +40,6 @@ limitations under the License. <dependency> <groupId>org.apache.sqoop</groupId> - <artifactId>sqoop-spi</artifactId> - </dependency> - - <dependency> - <groupId>org.apache.sqoop</groupId> <artifactId>sqoop-common</artifactId> </dependency> @@ -58,7 +53,10 @@ limitations under the License. <artifactId>junit</artifactId> <scope>test</scope> </dependency> - + <dependency> + <groupId>org.apache.sqoop</groupId> + <artifactId>connector-sdk</artifactId> + </dependency> </dependencies> <build> http://git-wip-us.apache.org/repos/asf/sqoop/blob/c7ef89db/pom.xml ---------------------------------------------------------------------- diff --git a/pom.xml b/pom.xml index fc65b9d..2381566 100644 --- a/pom.xml +++ b/pom.xml @@ -319,11 +319,6 @@ limitations under the License. <version>${project.version}</version> </dependency> <dependency> - <groupId>org.apache.sqoop</groupId> - <artifactId>sqoop-spi</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> <groupId>org.apache.sqoop.repository</groupId> <artifactId>sqoop-repository-common</artifactId> <version>${project.version}</version> @@ -604,7 +599,6 @@ limitations under the License. <modules> <module>common</module> <module>common-test</module> - <module>spi</module> <module>core</module> <module>repository</module> <module>server</module> http://git-wip-us.apache.org/repos/asf/sqoop/blob/c7ef89db/spi/src/main/java/org/apache/sqoop/configurable/ConfigurableError.java ---------------------------------------------------------------------- diff --git a/spi/src/main/java/org/apache/sqoop/configurable/ConfigurableError.java b/spi/src/main/java/org/apache/sqoop/configurable/ConfigurableError.java deleted file mode 100644 index 83ed4a5..0000000 --- a/spi/src/main/java/org/apache/sqoop/configurable/ConfigurableError.java +++ /dev/null @@ -1,43 +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.configurable; - -import org.apache.sqoop.common.ErrorCode; - -public enum ConfigurableError implements ErrorCode { - - /** An unknown error has occurred. */ - CONFIGURABLE_0001("Link object upgrade called, but no upgrade routine provided for LINK config"), - CONFIGURABLE_0002("Job object upgrade called, but no upgrade routine provided for FROM job config"), - CONFIGURABLE_0003("Job object upgrade called, but no upgrade routine provided for TO job config"), - ; - private final String message; - - private ConfigurableError(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/c7ef89db/spi/src/main/java/org/apache/sqoop/configurable/ConfigurableUpgradeUtil.java ---------------------------------------------------------------------- diff --git a/spi/src/main/java/org/apache/sqoop/configurable/ConfigurableUpgradeUtil.java b/spi/src/main/java/org/apache/sqoop/configurable/ConfigurableUpgradeUtil.java deleted file mode 100644 index 715a61c..0000000 --- a/spi/src/main/java/org/apache/sqoop/configurable/ConfigurableUpgradeUtil.java +++ /dev/null @@ -1,62 +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.configurable; - -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.apache.log4j.Logger; -import org.apache.sqoop.common.SqoopException; -import org.apache.sqoop.model.MConfig; -import org.apache.sqoop.model.MInput; - -public class ConfigurableUpgradeUtil { - - private static final Logger LOG = Logger.getLogger(ConfigurableUpgradeUtil.class); - /* - * For now, there is no real upgrade. So copy all data over, - * set the validation messages and error messages to be the same as for the - * inputs in the original one. - */ - @SuppressWarnings("unchecked") - public static void doUpgrade(List<MConfig> original, List<MConfig> target) { - Map<String, MConfig> configMap = new HashMap<String, MConfig>(); - for (MConfig config : original) { - configMap.put(config.getName(), config); - } - for (MConfig config : target) { - List<MInput<?>> inputs = config.getInputs(); - MConfig originalConfig = configMap.get(config.getName()); - if (originalConfig == null) { - LOG.warn("Config: '" + config.getName() + "' not present in old " + - "configurable. So it and its inputs will not be transferred by the upgrader."); - continue; - } - for (MInput input : inputs) { - try { - MInput originalInput = originalConfig.getInput(input.getName()); - input.setValue(originalInput.getValue()); - } catch (SqoopException ex) { - LOG.warn("Input: '" + input.getName() + "' not present in old " + - "configurable. So it will not be transferred by the upgrader."); - } - } - } - } -} http://git-wip-us.apache.org/repos/asf/sqoop/blob/c7ef89db/spi/src/main/java/org/apache/sqoop/connector/spi/ConnectorConfigurableUpgrader.java ---------------------------------------------------------------------- diff --git a/spi/src/main/java/org/apache/sqoop/connector/spi/ConnectorConfigurableUpgrader.java b/spi/src/main/java/org/apache/sqoop/connector/spi/ConnectorConfigurableUpgrader.java deleted file mode 100644 index b5e0c0d..0000000 --- a/spi/src/main/java/org/apache/sqoop/connector/spi/ConnectorConfigurableUpgrader.java +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.sqoop.connector.spi; - -import org.apache.sqoop.common.SqoopException; -import org.apache.sqoop.configurable.ConfigurableError; -import org.apache.sqoop.model.MFromConfig; -import org.apache.sqoop.model.MLinkConfig; -import org.apache.sqoop.model.MToConfig; - -/** - * Configurable represents an entity that can provide configurations for the - * support config types {@linkplain ConfigType} - * This api represents the interface that configurable such as the connector/driver - * will implement to upgrade both the config and its corresponding data across different - * versions - * - */ -public abstract class ConnectorConfigurableUpgrader { - - /** - * Upgrade the original link config for the given config type and fill into the upgradeTarget. Note - * that any data already in {@code upgradeTarget} maybe overwritten. - * @param original - original config as in the repository - * @param upgradeTarget - the instance that will be filled in with the - * upgraded config - */ - public void upgradeLinkConfig(MLinkConfig original, MLinkConfig upgradeTarget) { - // The reasoning for throwing an exception by default is as follows. - // Sqoop calls the upgrade apis for every connector if and only if the - // corresponding link object that the config is associated with exists in the sqoop - // repository. In unexpected scenarios, if a link object is created in the - // sqoop repository without a corresponding upgrade routine for - // the link config, then this exception will be thrown to indicate a - // unexpected code path. In normal circumstances this - // scenario of having a link object for a connector without link config is - // very unlikely to happen. A likely scenario is that a connector will not have a link config and hence - // no link object will be created and thus this method will not be invoked. - throw new SqoopException(ConfigurableError.CONFIGURABLE_0001); - - } - - /** - * Upgrade the original FROM job config for the given config type and fill into the upgradeTarget. Note - * that any data already in {@code upgradeTarget} maybe overwritten. - * @param original - original config as in the repository - * @param upgradeTarget - the instance that will be filled in with the - * upgraded config - */ - - public void upgradeFromJobConfig(MFromConfig original, MFromConfig upgradeTarget) { - // see above for the reasoning behind the exception - throw new SqoopException(ConfigurableError.CONFIGURABLE_0002); - } - /** - * Upgrade the original TO job config for the given config type and fill into the upgradeTarget. Note - * that any data already in {@code upgradeTarget} maybe overwritten. - * @param original - original config as in the repository - * @param upgradeTarget - the instance that will be filled in with the - * upgraded config - */ - public void upgradeToJobConfig(MToConfig original, MToConfig upgradeTarget) { - // see above for the reasoning behind the exception - throw new SqoopException(ConfigurableError.CONFIGURABLE_0003); - - } - -} http://git-wip-us.apache.org/repos/asf/sqoop/blob/c7ef89db/spi/src/main/java/org/apache/sqoop/connector/spi/SqoopConnector.java ---------------------------------------------------------------------- diff --git a/spi/src/main/java/org/apache/sqoop/connector/spi/SqoopConnector.java b/spi/src/main/java/org/apache/sqoop/connector/spi/SqoopConnector.java deleted file mode 100644 index ff6392e..0000000 --- a/spi/src/main/java/org/apache/sqoop/connector/spi/SqoopConnector.java +++ /dev/null @@ -1,98 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.sqoop.connector.spi; - -import java.util.Arrays; -import java.util.List; -import java.util.Locale; -import java.util.ResourceBundle; - -import org.apache.sqoop.common.Direction; -import org.apache.sqoop.connector.idf.CSVIntermediateDataFormat; -import org.apache.sqoop.connector.idf.IntermediateDataFormat; -import org.apache.sqoop.job.etl.From; -import org.apache.sqoop.job.etl.To; - -/** - * Service provider interface for Sqoop Connectors. - */ -public abstract class SqoopConnector { - - /** - * Retrieve connector version. - * - * @return Version encoded as a string - */ - public abstract String getVersion(); - - /** - * @param locale - * @return the resource bundle associated with the given locale. - */ - public abstract ResourceBundle getBundle(Locale locale); - - /** - * @return The supported directions - */ - public List<Direction> getSupportedDirections() { - return Arrays.asList(new Direction[]{ - Direction.FROM, - Direction.TO - }); - } - - /** - * @return Get link configuration group class - */ - @SuppressWarnings("rawtypes") - public abstract Class getLinkConfigurationClass(); - - /** - * @return Get job configuration group class per direction type or null if not supported - */ - @SuppressWarnings("rawtypes") - public abstract Class getJobConfigurationClass(Direction direction); - - /** - * @return an <tt>From</tt> that provides classes for performing import. - */ - public abstract From getFrom(); - - /** - * @return an <tt>To</tt> that provides classes for performing export.n - */ - public abstract To getTo(); - - /** - * Returns an {@linkplain ConnectorConfigurableUpgrader} object that can upgrade the - * configs related to the link and job - * @return RespositoryUpgrader object - */ - public abstract ConnectorConfigurableUpgrader getConfigurableUpgrader(); - - /** - * Returns the {@linkplain IntermediateDataFormat} this connector - * can return natively in. This will support retrieving the data as text - * and an array of objects. This should never return null. - * - * @return {@linkplain IntermediateDataFormat} object - */ - public Class<? extends IntermediateDataFormat<?>> getIntermediateDataFormat() { - return CSVIntermediateDataFormat.class; - } -} http://git-wip-us.apache.org/repos/asf/sqoop/blob/c7ef89db/spi/src/main/java/org/apache/sqoop/job/Constants.java ---------------------------------------------------------------------- diff --git a/spi/src/main/java/org/apache/sqoop/job/Constants.java b/spi/src/main/java/org/apache/sqoop/job/Constants.java deleted file mode 100644 index 90935cf..0000000 --- a/spi/src/main/java/org/apache/sqoop/job/Constants.java +++ /dev/null @@ -1,44 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.sqoop.job; - -public class Constants { - - /** - * All job related configuration is prefixed with this: - * <tt>org.apache.sqoop.job.</tt> - */ - public static final String PREFIX_CONFIG = "org.apache.sqoop.job."; - - public static final String JOB_ETL_NUMBER_PARTITIONS = PREFIX_CONFIG - + "etl.number.partitions"; - - public static final String JOB_ETL_FIELD_NAMES = PREFIX_CONFIG - + "etl.field.names"; - - public static final String JOB_ETL_OUTPUT_DIRECTORY = PREFIX_CONFIG - + "etl.output.directory"; - - public static final String JOB_ETL_INPUT_DIRECTORY = PREFIX_CONFIG - + "etl.input.directory"; - - protected Constants() { - // Disable explicit object creation - } - -} http://git-wip-us.apache.org/repos/asf/sqoop/blob/c7ef89db/spi/src/main/java/org/apache/sqoop/job/etl/Destroyer.java ---------------------------------------------------------------------- diff --git a/spi/src/main/java/org/apache/sqoop/job/etl/Destroyer.java b/spi/src/main/java/org/apache/sqoop/job/etl/Destroyer.java deleted file mode 100644 index 8486154..0000000 --- a/spi/src/main/java/org/apache/sqoop/job/etl/Destroyer.java +++ /dev/null @@ -1,39 +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.job.etl; - -/** - * This allows connector to define work to complete execution, for example, - * resource cleaning. - */ -public abstract class Destroyer<LinkConfiguration, JobConfiguration> { - - /** - * Callback to clean up after job execution - * - * @param context Destroyer context - * @param linkConfiguration link configuration object - * @param jobConfiguration job configuration object for the FROM and TO - * In case of the FROM destroyer this will represent the FROM job configuration - * In case of the TO destroyer this will represent the TO job configuration - */ - public abstract void destroy(DestroyerContext context, - LinkConfiguration linkConfiguration, - JobConfiguration jobConfiguration); - -} http://git-wip-us.apache.org/repos/asf/sqoop/blob/c7ef89db/spi/src/main/java/org/apache/sqoop/job/etl/Extractor.java ---------------------------------------------------------------------- diff --git a/spi/src/main/java/org/apache/sqoop/job/etl/Extractor.java b/spi/src/main/java/org/apache/sqoop/job/etl/Extractor.java deleted file mode 100644 index 85e91ef..0000000 --- a/spi/src/main/java/org/apache/sqoop/job/etl/Extractor.java +++ /dev/null @@ -1,52 +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.job.etl; - -/** - * This allows connector to extract data from a source system - * based on each partition. - */ -public abstract class Extractor<LinkConfiguration, FromJobConfiguration, SqoopPartition> { - - /** - * Extract data from source and pass them into the Sqoop. - * - * @param context Extractor context object - * @param linkConfiguration link configuration object - * @param jobConfiguration FROM job configuration object - * @param partition Partition that this extracter should work on - */ - public abstract void extract(ExtractorContext context, - LinkConfiguration linkConfiguration, - FromJobConfiguration jobConfiguration, - SqoopPartition partition); - - /** - * Return the number of rows read by the last call to - * {@linkplain Extractor#extract(org.apache.sqoop.job.etl.ExtractorContext, java.lang.Object, java.lang.Object, Partition) } - * method. This method returns only the number of rows read in the last call, - * and not a cumulative total of the number of rows read by this Extractor - * since its creation. If no calls were made to the run method, this method's - * behavior is undefined. - * - * @return the number of rows read by the last call to - * {@linkplain Extractor#extract(org.apache.sqoop.job.etl.ExtractorContext, java.lang.Object, java.lang.Object, Partition) } - */ - public abstract long getRowsRead(); - -} http://git-wip-us.apache.org/repos/asf/sqoop/blob/c7ef89db/spi/src/main/java/org/apache/sqoop/job/etl/From.java ---------------------------------------------------------------------- diff --git a/spi/src/main/java/org/apache/sqoop/job/etl/From.java b/spi/src/main/java/org/apache/sqoop/job/etl/From.java deleted file mode 100644 index 3dd8fb9..0000000 --- a/spi/src/main/java/org/apache/sqoop/job/etl/From.java +++ /dev/null @@ -1,58 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.sqoop.job.etl; - -/** - * This specifies classes that perform connector-defined steps - * within import execution: - * Initializer - * -> Partitioner - * -> Extractor - * -> (Sqoop-defined steps) - * -> Destroyer - */ -public class From extends Transferable { - - private Class<? extends Partitioner> partitioner; - private Class<? extends Extractor> extractor; - - public From(Class<? extends Initializer> initializer, - Class<? extends Partitioner> partitioner, - Class<? extends Extractor> extractor, - Class<? extends Destroyer> destroyer) { - super(initializer, destroyer); - this.partitioner = partitioner; - this.extractor = extractor; - } - - public Class<? extends Partitioner> getPartitioner() { - return partitioner; - } - - public Class<? extends Extractor> getExtractor() { - return extractor; - } - - @Override - public String toString() { - return "From{" + super.toString() + - ", partitioner=" + partitioner.getName() + - ", extractor=" + extractor.getName() + - '}'; - } -} http://git-wip-us.apache.org/repos/asf/sqoop/blob/c7ef89db/spi/src/main/java/org/apache/sqoop/job/etl/Initializer.java ---------------------------------------------------------------------- diff --git a/spi/src/main/java/org/apache/sqoop/job/etl/Initializer.java b/spi/src/main/java/org/apache/sqoop/job/etl/Initializer.java deleted file mode 100644 index 7dd156e..0000000 --- a/spi/src/main/java/org/apache/sqoop/job/etl/Initializer.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.job.etl; - -import java.util.HashSet; -import java.util.Set; - -import org.apache.sqoop.schema.NullSchema; -import org.apache.sqoop.schema.Schema; - -/** - * This allows connector to define initialization work for execution, - * for example, context configuration. - */ -public abstract class Initializer<LinkConfiguration, JobConfiguration> { - - /** - * Initialize new submission based on given configuration properties. Any - * needed temporary values might be saved to context object and they will be - * promoted to all other part of the workflow automatically. - * - * @param context Initializer context object - * @param linkConfiguration link configuration object - * @param jobConfiguration job configuration object for the FROM and TO - * In case of the FROM initializer this will represent the FROM job configuration - * In case of the TO initializer this will represent the TO job configuration - */ - public abstract void initialize(InitializerContext context, LinkConfiguration linkConfiguration, - JobConfiguration jobConfiguration); - - /** - * Return list of all jars that this particular connector needs to operate on - * following job. This method will be called after running initialize method. - * @param context Initializer context object - * @param linkConfiguration link configuration object - * @param jobConfiguration job configuration object for the FROM and TO - * In case of the FROM initializer this will represent the FROM job configuration - * In case of the TO initializer this will represent the TO job configuration - * @return - */ - public Set<String> getJars(InitializerContext context, LinkConfiguration linkConfiguration, - JobConfiguration jobConfiguration) { - return new HashSet<String>(); - } - - /** - * Return schema associated with the connector for FROM and TO - * By default we assume a null schema. Override the method if there a custom schema to provide either for FROM or TO - * @param context Initializer context object - * @param linkConfiguration link configuration object - * @param jobConfiguration job configuration object for the FROM and TO - * In case of the FROM initializer this will represent the FROM job configuration - * In case of the TO initializer this will represent the TO job configuration - * @return - */ - - public Schema getSchema(InitializerContext context, LinkConfiguration linkConfiguration, - JobConfiguration jobConfiguration) { - return NullSchema.getInstance(); - } - -} http://git-wip-us.apache.org/repos/asf/sqoop/blob/c7ef89db/spi/src/main/java/org/apache/sqoop/job/etl/Loader.java ---------------------------------------------------------------------- diff --git a/spi/src/main/java/org/apache/sqoop/job/etl/Loader.java b/spi/src/main/java/org/apache/sqoop/job/etl/Loader.java deleted file mode 100644 index e47b244..0000000 --- a/spi/src/main/java/org/apache/sqoop/job/etl/Loader.java +++ /dev/null @@ -1,48 +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.job.etl; - -/** - * This allows connector to load data into a target system. - */ -public abstract class Loader<LinkConfiguration, ToJobConfiguration> { - - /** - * Load data to target. - * - * @param context Loader context object - * @param linkConfiguration link configuration object - * @param jobConfiguration TO job configuration object - * @throws Exception - */ - public abstract void load(LoaderContext context, LinkConfiguration linkConfiguration, - ToJobConfiguration jobConfiguration) throws Exception; - - /** - * Return the number of rows witten by the last call to - * {@linkplain Loader#load(org.apache.sqoop.job.etl.LoaderContext, java.lang.Object) } - * method. This method returns only the number of rows written in the last call, - * and not a cumulative total of the number of rows written by this Loader - * since its creation. - * - * @return the number of rows written by the last call to - * {@linkplain Loader#load(org.apache.sqoop.job.etl.LoaderContext, java.lang.Object) } - */ - public abstract long getRowsWritten(); - -} http://git-wip-us.apache.org/repos/asf/sqoop/blob/c7ef89db/spi/src/main/java/org/apache/sqoop/job/etl/Partition.java ---------------------------------------------------------------------- diff --git a/spi/src/main/java/org/apache/sqoop/job/etl/Partition.java b/spi/src/main/java/org/apache/sqoop/job/etl/Partition.java deleted file mode 100644 index db07844..0000000 --- a/spi/src/main/java/org/apache/sqoop/job/etl/Partition.java +++ /dev/null @@ -1,46 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.sqoop.job.etl; - -import java.io.DataInput; -import java.io.DataOutput; -import java.io.IOException; - -/** - * A part of the input data partitioned by the Partitioner. - */ -public abstract class Partition { - - /** - * Deserialize the fields of this partition from input. - */ - public abstract void readFields(DataInput in) throws IOException; - - /** - * Serialize the fields of this partition to output. - */ - public abstract void write(DataOutput out) throws IOException; - - /** - * Each partition must be easily serializable to human readable form so that - * it can be logged for debugging purpose. - * - * @return Human readable representation - */ - public abstract String toString(); -} http://git-wip-us.apache.org/repos/asf/sqoop/blob/c7ef89db/spi/src/main/java/org/apache/sqoop/job/etl/Partitioner.java ---------------------------------------------------------------------- diff --git a/spi/src/main/java/org/apache/sqoop/job/etl/Partitioner.java b/spi/src/main/java/org/apache/sqoop/job/etl/Partitioner.java deleted file mode 100644 index 3636130..0000000 --- a/spi/src/main/java/org/apache/sqoop/job/etl/Partitioner.java +++ /dev/null @@ -1,40 +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.job.etl; - -import java.util.List; - -/** - * This allows connector to define how input data from the FROM source can be partitioned. - * The number of data partitions also determines the degree of parallelism. - */ -public abstract class Partitioner<LinkConfiguration, FromJobConfiguration> { - - /** - * Partition input data into partitions. - * - * Each partition will be then processed in separate extractor. - * - * @param context Partitioner context object - * @param linkConfiguration link configuration object - * @param jobConfiguration job configuration object - * @return - */ - public abstract List<Partition> getPartitions(PartitionerContext context, - LinkConfiguration linkConfiguration, FromJobConfiguration fromJobConfiguration); -} http://git-wip-us.apache.org/repos/asf/sqoop/blob/c7ef89db/spi/src/main/java/org/apache/sqoop/job/etl/To.java ---------------------------------------------------------------------- diff --git a/spi/src/main/java/org/apache/sqoop/job/etl/To.java b/spi/src/main/java/org/apache/sqoop/job/etl/To.java deleted file mode 100644 index 64ba225..0000000 --- a/spi/src/main/java/org/apache/sqoop/job/etl/To.java +++ /dev/null @@ -1,51 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.sqoop.job.etl; - -/** - * This specifies classes that perform connector-defined steps - * within export execution: - * Initializer - * -> (Sqoop-defined steps) - * -> Loader - * -> Destroyer - */ -public class To extends Transferable { - - private Class<? extends Loader> loader; - - public To( - Class<? extends Initializer> initializer, - Class<? extends Loader> loader, - Class<? extends Destroyer> destroyer - ) { - super(initializer, destroyer); - this.loader = loader; - } - - public Class<? extends Loader> getLoader() { - return loader; - } - - @Override - public String toString() { - return "To {" + super.toString() + - ", loader=" + loader + - '}'; - } -} http://git-wip-us.apache.org/repos/asf/sqoop/blob/c7ef89db/spi/src/main/java/org/apache/sqoop/job/etl/Transferable.java ---------------------------------------------------------------------- diff --git a/spi/src/main/java/org/apache/sqoop/job/etl/Transferable.java b/spi/src/main/java/org/apache/sqoop/job/etl/Transferable.java deleted file mode 100644 index dfe1d5e..0000000 --- a/spi/src/main/java/org/apache/sqoop/job/etl/Transferable.java +++ /dev/null @@ -1,51 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.sqoop.job.etl; - -/** - * This entity encapsulates the workflow for data transfer via the - * {@link SqoopConnector}.It basically acts as an adapter between the data-source - * imported from or exported to. - */ -public abstract class Transferable { - - private Class<? extends Initializer> initializer; - private Class<? extends Destroyer> destroyer; - - public Transferable( - Class<? extends Initializer> initializer, - Class<? extends Destroyer> destroyer - ) { - this.initializer = initializer; - this.destroyer = destroyer; - } - - public Class<? extends Destroyer> getDestroyer() { - return destroyer; - } - - public Class<? extends Initializer> getInitializer() { - return initializer; - } - - @Override - public String toString() { - return "initializer=" + initializer.getName() + - ", destroyer=" + destroyer.getName(); - } -} \ No newline at end of file
