diff --git a/installation/resource/installer/bin/delete-eln-master-data-script.sh b/installation/resource/installer/bin/delete-eln-master-data-script.sh new file mode 100644 index 0000000000000000000000000000000000000000..fdfcf5618cda23e5236e499184f9a4692a00095b --- /dev/null +++ b/installation/resource/installer/bin/delete-eln-master-data-script.sh @@ -0,0 +1,8 @@ +#!/bin/bash +BASE=`dirname "$0"` +if [ ${BASE#/} == ${BASE} ]; then + BASE="`pwd`/${BASE}" +fi + +echo "Removing ELN master data script" +rm $BASE/../servers/core-plugins/eln-lims/1/as/initialize-master-data.py diff --git a/installation/resource/installer/install.xml b/installation/resource/installer/install.xml index 3d1865b54e78fe8be8f09fd694327abf38e56e2e..f15794e6af504b562c838669cc6eb97a7c0c6aae 100644 --- a/installation/resource/installer/install.xml +++ b/installation/resource/installer/install.xml @@ -47,6 +47,8 @@ <variable name="INSTALL_OPENBIS_TMPEXTRACT" value="$INSTALL_TMPEXTRACT/openBIS-server" /> <!-- temporary extract folder the "data" contents --> <variable name="DATA_TMPEXTRACT" value="$INSTALL_PATH/data-tmp-extract" /> + <variable name="ELN_MASTER_DATA_PANEL" value="true" condition="isInstallELN+isElnMasterDataNotInstalled" /> + <variable name="ELN_MASTER_DATA_PANEL" value="false" condition="!isInstallELN|!isElnMasterDataNotInstalled" /> </dynamicvariables> <conditions> @@ -96,6 +98,21 @@ <name>INSTALL_BEEWM</name> <value>true</value> </condition> + <condition type="variable" id="isInstallELN"> + <name>ELN-LIMS</name> + <value>true</value> + </condition> + <condition type="java" id="isElnMasterDataNotInstalled"> + <java> + <class>ch.systemsx.cisd.openbis.installer.izpack.GlobalInstallationContext</class> + <field>isElnMasterDataNotInstalled</field> + </java> + <returnvalue type="boolean">true</returnvalue> + </condition> + <condition type="variable" id="shouldShowElnMasterDataPanel"> + <name>ELN_MASTER_DATA_PANEL</name> + <value>true</value> + </condition> </conditions> <!-- The panels section. We indicate here which panels we want to use. The order will be respected. --> @@ -137,6 +154,9 @@ </actions> </panel> + <panel classname="com.izforge.izpack.panels.userinput.UserInputPanel" id="UserInputPanel.ELN_MASTER_DATA" condition="shouldShowElnMasterDataPanel"> + </panel> + <panel classname="com.izforge.izpack.panels.userinput.UserInputPanel" id="UserInputPanel.BEEWM"> </panel> @@ -165,6 +185,7 @@ <actions> <action stage="postvalidate" classname="ch.systemsx.cisd.openbis.installer.izpack.ExecuteSetupScriptsAction" /> <action stage="postvalidate" classname="ch.systemsx.cisd.openbis.installer.izpack.OpenGettingStartedPageAction" /> + <action stage="postvalidate" classname="ch.systemsx.cisd.openbis.installer.izpack.ELNMasterDataAction" /> </actions> </panel> @@ -227,7 +248,6 @@ <arg value="$JAVA_PATH"/> </args> </executable> - </pack> </packs> diff --git a/installation/resource/installer/userInputSpec.xml b/installation/resource/installer/userInputSpec.xml index 36f3e71868768c140ed393d413c18a23a6e84ea2..e9b9e53077400981ac925a207575d9f7c1bdc402 100644 --- a/installation/resource/installer/userInputSpec.xml +++ b/installation/resource/installer/userInputSpec.xml @@ -73,7 +73,19 @@ <spec txt="Fast data set file browsing" true="true" false="false"/> </field> </panel> + + <panel id="UserInputPanel.ELN_MASTER_DATA"> + <field type="title" txt="ELN/LIMS master data" bold="true" size="2" /> + <field type="radio" variable="ELN-LIMS-MASTER-DATA"> + <description align="left" txt="Should ELN/LIMS master data be installed?" /> + <spec> + <choice txt="Yes" value="true"/> + <choice txt="No" value="false" set="true"/> + </spec> + </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/resource/tarball/console.properties b/installation/resource/tarball/console.properties index bafc639ab1e4cdbc10d7acc7068a146ab0506d80..16d9de72ebbcb973029700811ed131557fe5c1a0 100644 --- a/installation/resource/tarball/console.properties +++ b/installation/resource/tarball/console.properties @@ -47,6 +47,9 @@ KEY_PASSWORD = changeit # Standard technology ELN-LIMS is disabled by default #ELN-LIMS = true +#ELN/LIMS master data is disabled by default. This setting is meaningful only if ELN-LIMS is enabled +#ELN-LIMS-MASTER-DATA = true + # Fast data set file browsing improves the performance of browsing of data sets with a large number of files. # We recommend leaving it on for all instances, and especially screening instances. # Default value is true. diff --git a/installation/source/java/ch/systemsx/cisd/openbis/installer/izpack/ELNMasterDataAction.java b/installation/source/java/ch/systemsx/cisd/openbis/installer/izpack/ELNMasterDataAction.java new file mode 100644 index 0000000000000000000000000000000000000000..cd024d181c23d3c1faf7a23b259ee69d67b996fa --- /dev/null +++ b/installation/source/java/ch/systemsx/cisd/openbis/installer/izpack/ELNMasterDataAction.java @@ -0,0 +1,59 @@ +/* + * Copyright 2011 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 static ch.systemsx.cisd.openbis.installer.izpack.GlobalInstallationContext.TECHNOLOGY_ELN_LIMS; + +import java.util.HashMap; + +import com.izforge.izpack.api.data.AutomatedInstallData; +import com.izforge.izpack.api.data.PanelActionConfiguration; + +/** + * Executes a script that removes eln master data python script, if required. + */ +public class ELNMasterDataAction extends AbstractScriptExecutor +{ + /** + * a script that creates a installation backup. + */ + private static final String CREATE_BACKUP_SCRIPT = "delete-eln-master-data-script.sh"; + + @Override + public synchronized void executeAction(AutomatedInstallData data) + { + String script = getAdminScript(data, CREATE_BACKUP_SCRIPT); + + String elnEnabled = data.getVariable(TECHNOLOGY_ELN_LIMS); + String elnMasterDataEnabled = data.getVariable("ELN-LIMS-MASTER-DATA"); + if (elnMasterDataEnabled == null) + { + elnMasterDataEnabled = "true"; + } + + if ("true".equals(elnEnabled) && "false".equals(elnMasterDataEnabled)) + { + executeAdminScript(new HashMap<String, String>(), script); + } + } + + @Override + public void initialize(PanelActionConfiguration arg0) + { + } + +} 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 9d31a51371a1c57c01628203c143dbeeb11e08b3..965cc8436de9abccc1b8ff9aa959ab9dded44711 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 @@ -55,7 +55,7 @@ public class GlobalInstallationContext public static final String PATHINFO_DB_ENABLED = "PATHINFO_DB_ENABLED"; public static final String[] TECHNOLOGIES = - { TECHNOLOGY_PROTEOMICS, TECHNOLOGY_SCREENING, TECHNOLOGY_ILLUMINA_NGS, TECHNOLOGY_ELN_LIMS }; + { TECHNOLOGY_PROTEOMICS, TECHNOLOGY_SCREENING, TECHNOLOGY_ILLUMINA_NGS, TECHNOLOGY_ELN_LIMS }; /** * set to true if the installation process is trying to update an existing openBIS installation. @@ -83,6 +83,8 @@ public class GlobalInstallationContext public static File installDir; + public static boolean isElnMasterDataNotInstalled = false; + public static void initialize(AutomatedInstallData data) { String installPath = data.getInstallPath(); @@ -116,6 +118,10 @@ public class GlobalInstallationContext { populateFirstTimeInstallVariables(data); } + + isElnMasterDataNotInstalled = (isFirstTimeInstallation == true) || + (new File(installDir, "servers/core-plugins/eln-lims/1/as/initialize-master-data.py").exists() == false) || + (new SetTechnologyCheckBoxesAction().isTechnologyEnabled(installDir, TECHNOLOGY_ELN_LIMS) == false); } private static boolean installationExists()