Permalink
Browse files

Added support for PanelActions in ConsoleInstaller

  • Loading branch information...
1 parent 720d091 commit a66e5fe6ead177b0a3f6d4636addfbff2c12398b @shyrkov shyrkov committed May 10, 2012
Showing with 81 additions and 2 deletions.
  1. +1 −1 pom.xml
  2. +80 −1 src/lib/com/izforge/izpack/installer/ConsoleInstaller.java
View
@@ -9,7 +9,7 @@
<modelVersion>4.0.0</modelVersion>
<artifactId>izpack-standalone-compiler</artifactId>
- <version>4.3.5-jahia-beta2</version>
+ <version>4.3.5-jahia-beta3</version>
<name>IzPack Standalone Compiler</name>
@@ -23,7 +23,9 @@
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.FileInputStream;
+import java.util.ArrayList;
import java.util.Iterator;
+import java.util.List;
import java.util.Properties;
import com.izforge.izpack.LocaleDatabase;
@@ -123,6 +125,9 @@ protected void iterateAndPerformAction(String strAction) throws Exception
Debug.log("ClassNotFoundException-skip :" + consoleHelperClassName);
continue;
}
+
+ executePreConstructActions(p);
+
PanelConsole consoleHelperInstance = null;
if (consoleHelperClass != null)
{
@@ -155,13 +160,19 @@ protected void iterateAndPerformAction(String strAction) throws Exception
strCondition);
}
+ executePreActivateActions(p);
+
if (strAction.equals("doInstall") && bIsConditionFulfilled)
{
+ boolean valid = true;
do
{
bActionResult = consoleHelperInstance.runConsole(this.installdata);
+ executePreValidateActions(p);
+ valid = validatePanel(p);
+ executePostValidateActions(p);
}
- while (!validatePanel(p));
+ while (!valid);
}
else if (strAction.equals("doGeneratePropertiesFile"))
{
@@ -321,4 +332,72 @@ public void run(int type, String path) throws Exception
doInstall();
}
}
+
+ private List<PanelAction> createPanelActionsFromStringList(Panel panel, List<String> actions)
+ {
+ List<PanelAction> actionList = null;
+ if (actions != null)
+ {
+ actionList = new ArrayList<PanelAction>();
+ for (String actionClassName : actions)
+ {
+ PanelAction action = PanelActionFactory.createPanelAction(actionClassName);
+ action.initialize(panel.getPanelActionConfiguration(actionClassName));
+ actionList.add(action);
+ }
+ }
+ return actionList;
+ }
+
+ private void executePreConstructActions(Panel panel)
+ {
+ List<PanelAction> preConstructActions = createPanelActionsFromStringList(panel, panel
+ .getPreConstructionActions());
+ if (preConstructActions != null)
+ {
+ for (PanelAction preConstructAction : preConstructActions)
+ {
+ preConstructAction.executeAction(installdata, null);
+ }
+ }
+ }
+
+ private void executePreActivateActions(Panel panel)
+ {
+ List<PanelAction> preActivateActions = createPanelActionsFromStringList(panel, panel
+ .getPreActivationActions());
+ if (preActivateActions != null)
+ {
+ for (PanelAction preActivateAction : preActivateActions)
+ {
+ preActivateAction.executeAction(installdata, null);
+ }
+ }
+ }
+
+ private void executePreValidateActions(Panel panel)
+ {
+ List<PanelAction> preValidateActions = createPanelActionsFromStringList(panel, panel
+ .getPreValidationActions());
+ if (preValidateActions != null)
+ {
+ for (PanelAction preValidateAction : preValidateActions)
+ {
+ preValidateAction.executeAction(installdata, null);
+ }
+ }
+ }
+
+ private void executePostValidateActions(Panel panel)
+ {
+ List<PanelAction> postValidateActions = createPanelActionsFromStringList(panel, panel
+ .getPostValidationActions());
+ if (postValidateActions != null)
+ {
+ for (PanelAction postValidateAction : postValidateActions)
+ {
+ postValidateAction.executeAction(installdata, null);
+ }
+ }
+ }
}

0 comments on commit a66e5fe

Please sign in to comment.