001/**
002 * Copyright (C) 2006-2024 Talend Inc. - www.talend.com
003 *
004 * Licensed under the Apache License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 * http://www.apache.org/licenses/LICENSE-2.0
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016package org.talend.sdk.component.api.component;
017
018import java.util.Map;
019
020/**
021 * Migrate a tcomp data instance from one version to another one.
022 *
023 * This uses a flat format to make any conversion very easy and an "untyped" structure to avoid
024 * <ul>
025 * <li>to require the type to be passed through the layers</li>
026 * <li>to require to instantiate unknown objects</li>
027 * </ul>
028 *
029 * This is linked to a component through {@link Version} to ensure cross inputs can be handled.
030 */
031public interface MigrationHandler {
032
033    /**
034     * @param incomingVersion the version of associatedData values.
035     * @param incomingData the data sent from the caller. Keys are using the path of the property as in component
036     * metadata.
037     * @return the set of properties for the current version.
038     */
039    Map<String, String> migrate(int incomingVersion, Map<String, String> incomingData);
040}