001/* 002 * Copyright 2020 Anyware Services 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.ametys.core.migration.action; 017 018import org.apache.avalon.framework.configuration.Configuration; 019import org.apache.avalon.framework.configuration.ConfigurationException; 020 021import org.ametys.core.migration.MigrationException; 022import org.ametys.core.migration.action.data.ActionData; 023import org.ametys.core.migration.version.Version; 024 025/** 026 * Interface for actions components 027 */ 028public interface Action 029{ 030 /** 031 * Run the action with the provided data 032 * @param actionData data needed to do the action (contains the version) 033 * @throws MigrationException Something went wrong 034 */ 035 public void doAction(ActionData actionData) throws MigrationException; 036 037 /** 038 * Generate an {@link ActionData} linked to this kind of action 039 * @param id id of the action 040 * @param version original version 041 * @param comment Comment about this action 042 * @param from if this actions is the equivalent of multiple actions, this is the version id just before the 1st action impacted by this action 043 * @param type type of action 044 * @param pluginName name of the plugin 045 * @param configuration configuration of the action 046 * @param restartRequired true if a restart is required after the action 047 * @return a {@link ActionData} for this type of action 048 * @throws MigrationException Something went wrong 049 * @throws ConfigurationException Configuration malformed 050 */ 051 public ActionData generateActionData(String id, Version version, String comment, String from, String type, String pluginName, Configuration configuration, boolean restartRequired) throws MigrationException, ConfigurationException; 052}