diff --git a/installation/build/build.xml b/installation/build/build.xml index f3342c73c70e9ba59da2bed840fe88a02a7fa27c..63eb2f48f54e155f01b4bedbbe120e441f2d24e3 100644 --- a/installation/build/build.xml +++ b/installation/build/build.xml @@ -49,6 +49,7 @@ <param name="variant" value="" /> <param name="database.kind" value="productive" /> <param name="installation.customize.folder" value="../openbis/dist/installer" /> + <param name="is-standard-technologies" value="false" /> </antcall> </target> @@ -61,6 +62,7 @@ <param name="variant" value="-standard-technologies" /> <param name="database.kind" value="standard-technologies" /> <param name="installation.customize.folder" value="../openbis_standard_technologies/dist/tarball/installer" /> + <param name="is-standard-technologies" value="true" /> </antcall> </target> @@ -73,6 +75,7 @@ <param name="variant" value="-screening" /> <param name="database.kind" value="screening" /> <param name="installation.customize.folder" value="../screening/dist/tarball/installer" /> + <param name="is-standard-technologies" value="false" /> </antcall> </target> @@ -95,6 +98,7 @@ <param name="variant" value="-proteomics" /> <param name="database.kind" value="proteomics" /> <param name="installation.customize.folder" value="../rtd_phosphonetx/dist/tarball/installer" /> + <param name="is-standard-technologies" value="false" /> </antcall> </target> @@ -132,6 +136,8 @@ 5) installation.customize.folder declares a local folder for (e.g. screening/dist/installer), where the different installation can define customizations for their installers. + 6) is-standard-technologies + if true wizard page for selecting/deselecting technologies will be shown --> <target name="create-installer"> @@ -170,8 +176,9 @@ <!-- this suffix will be used by the installer to check if there are database connections --> <property name="installer.database.kind" value="${database.kind}" /> + <replace file="${installer.dist.dir}/install.xml" token="is-standard-technologies-value-created-by-ant-script" value="${is-standard-technologies}"/> - <izpack input="${installer.dist.dir}/install.xml" + <izpack input="${installer.dist.dir}/install.xml" output="${installer.jar.file}" inheritAll="true" installerType="standard" diff --git a/installation/resource/installer/install.xml b/installation/resource/installer/install.xml index 8fa7b96487a59fcb95281e269b2acab24215ff65..240141acd1f85b952f38bb8f50d896219ee37810 100644 --- a/installation/resource/installer/install.xml +++ b/installation/resource/installer/install.xml @@ -37,6 +37,7 @@ <variable name="ShowCreateDirectoryMessage" value="false" /> <variable name="data.validation.error.title" value="Error" /> <variable name="VERSION_NUMBER" value="@{version.number}" /> + <variable name="IS_STANDARD_TECHNOLOGIES" value="is-standard-technologies-value-created-by-ant-script" /> </variables> <dynamicvariables> @@ -72,6 +73,10 @@ </java> <returnvalue type="boolean">true</returnvalue> </condition> + <condition type="variable" id="isStandardTechnologies"> + <name>IS_STANDARD_TECHNOLOGIES</name> + <value>true</value> + </condition> </conditions> <!-- The panels section. We indicate here which panels we want to use. The order will be respected. --> @@ -90,6 +95,13 @@ <panel classname="com.izforge.izpack.panels.userinput.UserInputPanel" id="UserInputPanel.PSQL_PATH" condition="noPsqlToolsOnPath"> <validator classname="ch.systemsx.cisd.openbis.installer.izpack.PostgresToolsPathValidator"/> </panel> + + <panel classname="com.izforge.izpack.panels.userinput.UserInputPanel" id="UserInputPanel.TECHNOLOGIES" condition="isStandardTechnologies"> + <actions> + <action stage="preactivate" classname="ch.systemsx.cisd.openbis.installer.izpack.SetTechnologyCheckBoxesAction" /> + <action stage="postvalidate" classname="ch.systemsx.cisd.openbis.installer.izpack.SetDisableTechnologiesVariableAction" /> + </actions> + </panel> <panel classname="com.izforge.izpack.panels.userinput.UserInputPanel" id="UserInputPanel.MISC" condition="isFirstTimeInstallation"> <actions> diff --git a/installation/resource/installer/userInputSpec.xml b/installation/resource/installer/userInputSpec.xml index 537b3c1d61e621271ff254efad5925b6b583848e..c0a926d789ba4b5eee61e12c3c14e37b53483402 100644 --- a/installation/resource/installer/userInputSpec.xml +++ b/installation/resource/installer/userInputSpec.xml @@ -8,6 +8,18 @@ </field> </panel> + <panel id="UserInputPanel.TECHNOLOGIES"> + <field type="title" txt="Technologies" bold="true" size="2" /> + <field type="staticText" align="left" + txt="Please, deselect those technologies which are not needed. Later, at the next upgrade, the selection can be changed:" /> + <field type="check" variable="PROTEOMICS"> + <spec txt="Proteomics" true="true" false="false"/> + </field> + <field type="check" variable="SCREENING"> + <spec txt="Screening" true="true" false="false"/> + </field> + </panel> + <panel id="UserInputPanel.MISC"> <field type="title" txt="Misc" bold="true" size="2" /> <field type="password" align="left" variable="ADMIN_PASSWORD"> diff --git a/installation/source/java/ch/systemsx/cisd/openbis/installer/izpack/GlobalInstallationContext.java b/installation/source/java/ch/systemsx/cisd/openbis/installer/izpack/GlobalInstallationContext.java index b88c4db457b1bf3df8fad4efc5373ea51c9d94eb..76f0ab39b2695b63e00c09b35419013b8495902c 100644 --- a/installation/source/java/ch/systemsx/cisd/openbis/installer/izpack/GlobalInstallationContext.java +++ b/installation/source/java/ch/systemsx/cisd/openbis/installer/izpack/GlobalInstallationContext.java @@ -36,6 +36,8 @@ public class GlobalInstallationContext public static final String DATA_DIR_VARNAME = "DSS_ROOT_DIR"; public static final String BACKUP_FOLDER_VARNAME = "BACKUP_FOLDER"; + + public static final String[] TECHNOLOGIES = {"PROTEOMICS", "SCREENING"}; /** * set to true if the installation process is trying to update an existing openBIS installation. diff --git a/installation/source/java/ch/systemsx/cisd/openbis/installer/izpack/SetDisableTechnologiesVariableAction.java b/installation/source/java/ch/systemsx/cisd/openbis/installer/izpack/SetDisableTechnologiesVariableAction.java new file mode 100644 index 0000000000000000000000000000000000000000..468c018d665023eb7a903e1fae5663632333f3aa --- /dev/null +++ b/installation/source/java/ch/systemsx/cisd/openbis/installer/izpack/SetDisableTechnologiesVariableAction.java @@ -0,0 +1,55 @@ +/* + * Copyright 2012 ETH Zuerich, CISD + * + * Licensed 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 ch.systemsx.cisd.openbis.installer.izpack; + +import com.izforge.izpack.api.data.AutomatedInstallData; +import com.izforge.izpack.api.data.PanelActionConfiguration; +import com.izforge.izpack.api.handler.AbstractUIHandler; +import com.izforge.izpack.data.PanelAction; + +/** + * Action which sets the variable <code>DISABLED_TECHNOLOGIES_VARNAME</code>. + * + * @author Franz-Josef Elmer + */ +public class SetDisableTechnologiesVariableAction implements PanelAction +{ + private static final String DISABLED_TECHNOLOGIES_VARNAME = "DISABLED_TECHNOLOGIES"; + + public void executeAction(AutomatedInstallData data, AbstractUIHandler handler) + { + StringBuilder builder = new StringBuilder(); + for (String technology : GlobalInstallationContext.TECHNOLOGIES) + { + String technologyFlag = data.getVariable(technology); + if (Boolean.FALSE.toString().equalsIgnoreCase(technologyFlag)) + { + if (builder.length() > 0) + { + builder.append(", "); + } + builder.append(technology.toLowerCase()); + } + } + data.setVariable(DISABLED_TECHNOLOGIES_VARNAME, builder.toString()); + } + + public void initialize(PanelActionConfiguration configuration) + { + } + +} diff --git a/installation/source/java/ch/systemsx/cisd/openbis/installer/izpack/SetTechnologyCheckBoxesAction.java b/installation/source/java/ch/systemsx/cisd/openbis/installer/izpack/SetTechnologyCheckBoxesAction.java new file mode 100644 index 0000000000000000000000000000000000000000..6279bfa0de3a0567ec108d2402de68f4ac5bd0a3 --- /dev/null +++ b/installation/source/java/ch/systemsx/cisd/openbis/installer/izpack/SetTechnologyCheckBoxesAction.java @@ -0,0 +1,48 @@ +/* + * Copyright 2012 ETH Zuerich, CISD + * + * Licensed 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 ch.systemsx.cisd.openbis.installer.izpack; + +import com.izforge.izpack.api.data.AutomatedInstallData; +import com.izforge.izpack.api.data.PanelActionConfiguration; +import com.izforge.izpack.api.handler.AbstractUIHandler; +import com.izforge.izpack.data.PanelAction; + +/** + * Action which sets the check boxes on the technology page. + * + * @author Franz-Josef Elmer + */ +public class SetTechnologyCheckBoxesAction implements PanelAction +{ + + public void executeAction(AutomatedInstallData data, AbstractUIHandler handler) + { + for (String technology : GlobalInstallationContext.TECHNOLOGIES) + { + String variable = data.getVariable(technology); + if (variable == null) + { + data.setVariable(technology, "true"); + } + } + } + + public void initialize(PanelActionConfiguration configuration) + { + } + +}