diff --git a/common/source/java/ch/systemsx/cisd/common/io/PropertyIOUtils.java b/common/source/java/ch/systemsx/cisd/common/io/PropertyIOUtils.java new file mode 100644 index 0000000000000000000000000000000000000000..f32ec777ba534b7a810f1970e8e3c2f2c105cd5d --- /dev/null +++ b/common/source/java/ch/systemsx/cisd/common/io/PropertyIOUtils.java @@ -0,0 +1,153 @@ +/* + * 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.common.io; + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.InputStream; +import java.util.List; +import java.util.Map.Entry; +import java.util.Properties; + +import org.apache.commons.io.IOUtils; + +import ch.systemsx.cisd.common.exception.ConfigurationFailureException; +import ch.systemsx.cisd.common.exception.UserFailureException; +import ch.systemsx.cisd.common.filesystem.FileUtilities; +import ch.systemsx.cisd.common.properties.PropertyUtils; + +/** + * A static helper class to help with loading and saving {@link Properties}. + * + * @author Bernd Rinn + */ +public class PropertyIOUtils +{ + + /** + * Loads properties from the specified file and adds them to the specified properties. + * <ul> + * <li>Empty lines and lines starting with a hash symbol '#' are ignored. + * <li>All other lines should have a equals symbol '='. The trimmed part before/after '=' + * specify property key and value , respectively. + * </ul> + */ + public static void loadAndAppendProperties(Properties properties, File propertiesFile) + { + List<String> lines = FileUtilities.loadToStringList(propertiesFile); + for (int i = 0; i < lines.size(); i++) + { + String line = lines.get(i); + if (line.length() == 0 || line.startsWith("#")) + { + continue; + } + int indexOfEqualSymbol = line.indexOf('='); + if (indexOfEqualSymbol < 0) + { + throw new UserFailureException("Missing '=' in line " + (i + 1) + + " of properties file '" + propertiesFile + "': " + line); + } + String key = line.substring(0, indexOfEqualSymbol).trim(); + String value = line.substring(indexOfEqualSymbol + 1).trim(); + properties.setProperty(key, value); + } + } + + /** + * Loads properties from the specified file. This is a simpler version of + * {@link PropertyIOUtils#loadProperties(String)} which does not use {@link Properties#load(InputStream)}: + * <ul> + * <li>Empty lines and lines starting with a hash symbol '#' are ignored. + * <li>All other lines should have a equals symbol '='. The trimmed part before/after '=' + * specify property key and value , respectively. + * </ul> + * There is no character escaping as in {@link Properties#load(InputStream)} because this can + * lead to problems if this syntax isn't known by the creator of a properties file. + */ + public static Properties loadProperties(File propertiesFile) + { + Properties properties = new Properties(); + loadAndAppendProperties(properties, propertiesFile); + return properties; + } + + /** + * Loads and returns {@link Properties} found in given <var>propertiesFilePath</var>. + * + * @throws ConfigurationFailureException If an exception occurs when loading the properties. + * @return never <code>null</code> but could return empty properties. + */ + public final static Properties loadProperties(final InputStream is, final String resourceName) + { + assert is != null : "No input stream specified"; + final Properties properties = new Properties(); + try + { + properties.load(is); + PropertyUtils.trimProperties(properties); + return properties; + } catch (final Exception ex) + { + final String msg = + String.format("Could not load the properties from given resource '%s'.", + resourceName); + throw new ConfigurationFailureException(msg, ex); + } finally + { + IOUtils.closeQuietly(is); + } + } + + /** + * Loads and returns {@link Properties} found in given <var>propertiesFilePath</var>. + * + * @throws ConfigurationFailureException If an exception occurs when loading the properties. + * @return never <code>null</code> but could return empty properties. + */ + public final static Properties loadProperties(final String propertiesFilePath) + { + try + { + return loadProperties(new FileInputStream(propertiesFilePath), propertiesFilePath); + } catch (FileNotFoundException ex) + { + final String msg = String.format("Properties file '%s' not found.", propertiesFilePath); + throw new ConfigurationFailureException(msg, ex); + } + } + + /** + * Saves the given <var>properties</var> to the given <var>propertiesFile</var>. + */ + public static void saveProperties(File propertiesFile, Properties properties) + { + final StringBuilder builder = new StringBuilder(); + for (Entry<Object, Object> entry : properties.entrySet()) + { + final String key = entry.getKey().toString(); + final String value = entry.getValue().toString(); + builder.append(key); + builder.append(" = "); + builder.append(value); + builder.append('\n'); + } + FileUtilities.writeToFile(propertiesFile, builder.toString()); + } + +} diff --git a/common/source/java/ch/systemsx/cisd/common/properties/PropertyUtils.java b/common/source/java/ch/systemsx/cisd/common/properties/PropertyUtils.java index bedb580e75cde3577c94bfa95de46ae2b1644732..0e493407ae606b62ce25d4b15c2f23f6f4ff1f22 100644 --- a/common/source/java/ch/systemsx/cisd/common/properties/PropertyUtils.java +++ b/common/source/java/ch/systemsx/cisd/common/properties/PropertyUtils.java @@ -16,25 +16,17 @@ package ch.systemsx.cisd.common.properties; -import java.io.File; -import java.io.FileInputStream; -import java.io.FileNotFoundException; -import java.io.InputStream; import java.util.Arrays; import java.util.Collections; import java.util.Enumeration; import java.util.List; import java.util.Properties; -import java.util.Map.Entry; -import org.apache.commons.io.IOUtils; import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.math.NumberUtils; import ch.systemsx.cisd.common.collection.CollectionUtils; import ch.systemsx.cisd.common.exception.ConfigurationFailureException; -import ch.systemsx.cisd.common.exception.UserFailureException; -import ch.systemsx.cisd.common.filesystem.FileUtilities; import ch.systemsx.cisd.common.logging.ISimpleLogger; import ch.systemsx.cisd.common.logging.LogLevel; @@ -556,115 +548,4 @@ public final class PropertyUtils } } - /** - * Loads and returns {@link Properties} found in given <var>propertiesFilePath</var>. - * - * @throws ConfigurationFailureException If an exception occurs when loading the properties. - * @return never <code>null</code> but could return empty properties. - */ - public final static Properties loadProperties(final String propertiesFilePath) - { - try - { - return loadProperties(new FileInputStream(propertiesFilePath), propertiesFilePath); - } catch (FileNotFoundException ex) - { - final String msg = String.format("Properties file '%s' not found.", propertiesFilePath); - throw new ConfigurationFailureException(msg, ex); - } - } - - /** - * Loads and returns {@link Properties} found in given <var>propertiesFilePath</var>. - * - * @throws ConfigurationFailureException If an exception occurs when loading the properties. - * @return never <code>null</code> but could return empty properties. - */ - public final static Properties loadProperties(final InputStream is, final String resourceName) - { - assert is != null : "No input stream specified"; - final Properties properties = new Properties(); - try - { - properties.load(is); - trimProperties(properties); - return properties; - } catch (final Exception ex) - { - final String msg = - String.format("Could not load the properties from given resource '%s'.", - resourceName); - throw new ConfigurationFailureException(msg, ex); - } finally - { - IOUtils.closeQuietly(is); - } - } - - /** - * Loads properties from the specified file. This is a simpler version of - * {@link #loadProperties(String)} which does not use {@link Properties#load(InputStream)}: - * <ul> - * <li>Empty lines and lines starting with a hash symbol '#' are ignored. - * <li>All other lines should have a equals symbol '='. The trimmed part before/after '=' - * specify property key and value , respectively. - * </ul> - * There is no character escaping as in {@link Properties#load(InputStream)} because this can - * lead to problems if this syntax isn't known by the creator of a properties file. - */ - public static Properties loadProperties(File propertiesFile) - { - Properties properties = new Properties(); - loadAndAppendProperties(properties, propertiesFile); - return properties; - } - - /** - * Loads properties from the specified file and adds them to the specified properties. - * <ul> - * <li>Empty lines and lines starting with a hash symbol '#' are ignored. - * <li>All other lines should have a equals symbol '='. The trimmed part before/after '=' - * specify property key and value , respectively. - * </ul> - */ - public static void loadAndAppendProperties(Properties properties, File propertiesFile) - { - List<String> lines = FileUtilities.loadToStringList(propertiesFile); - for (int i = 0; i < lines.size(); i++) - { - String line = lines.get(i); - if (line.length() == 0 || line.startsWith("#")) - { - continue; - } - int indexOfEqualSymbol = line.indexOf('='); - if (indexOfEqualSymbol < 0) - { - throw new UserFailureException("Missing '=' in line " + (i + 1) - + " of properties file '" + propertiesFile + "': " + line); - } - String key = line.substring(0, indexOfEqualSymbol).trim(); - String value = line.substring(indexOfEqualSymbol + 1).trim(); - properties.setProperty(key, value); - } - } - - /** - * Saves the given <var>properties</var> to the given <var>propertiesFile</var>. - */ - public static void saveProperties(File propertiesFile, Properties properties) - { - final StringBuilder builder = new StringBuilder(); - for (Entry<Object, Object> entry : properties.entrySet()) - { - final String key = entry.getKey().toString(); - final String value = entry.getValue().toString(); - builder.append(key); - builder.append(" = "); - builder.append(value); - builder.append('\n'); - } - FileUtilities.writeToFile(propertiesFile, builder.toString()); - } - } diff --git a/common/sourceTest/java/ch/systemsx/cisd/common/io/PropertyIOUtilsTest.java b/common/sourceTest/java/ch/systemsx/cisd/common/io/PropertyIOUtilsTest.java new file mode 100644 index 0000000000000000000000000000000000000000..802499bdbc4b2ef2eaaac79ae32d01853e96a2b9 --- /dev/null +++ b/common/sourceTest/java/ch/systemsx/cisd/common/io/PropertyIOUtilsTest.java @@ -0,0 +1,64 @@ +/* + * 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.common.io; + +import java.io.File; +import java.util.Properties; + +import org.testng.annotations.Test; + +import ch.systemsx.cisd.base.tests.AbstractFileSystemTestCase; +import ch.systemsx.cisd.common.exception.UserFailureException; +import ch.systemsx.cisd.common.filesystem.FileUtilities; + +/** + * Test cases for {@link PropertyIOUtils} class. + * + * @author Bernd Rinn + */ +public class PropertyIOUtilsTest extends AbstractFileSystemTestCase +{ + + @Test + public void testLoadProperties() + { + File propertiesFile = new File(workingDirectory, "p.properties"); + FileUtilities.writeToFile(propertiesFile, "answer = 42\n\n# comment\n key=4711 "); + Properties properties = PropertyIOUtils.loadProperties(propertiesFile); + + assertEquals("42", properties.getProperty("answer")); + assertEquals("4711", properties.getProperty("key")); + } + + @Test + public void testLoadInvalidProperties() + { + File propertiesFile = new File(workingDirectory, "p.properties"); + FileUtilities.writeToFile(propertiesFile, "answer=42\nquestion"); + + try + { + PropertyIOUtils.loadProperties(propertiesFile); + fail("UserFailureException expected"); + } catch (UserFailureException ex) + { + assertEquals("Missing '=' in line 2 of properties file '" + propertiesFile + + "': question", ex.getMessage()); + } + } + +} diff --git a/common/sourceTest/java/ch/systemsx/cisd/common/properties/PropertyUtilsTest.java b/common/sourceTest/java/ch/systemsx/cisd/common/properties/PropertyUtilsTest.java index d3356bc7dd09f8ba0d094e304eff51f62f7a0854..7d407291ab91c774d188bdce2f67f2a7e3ca8c0a 100644 --- a/common/sourceTest/java/ch/systemsx/cisd/common/properties/PropertyUtilsTest.java +++ b/common/sourceTest/java/ch/systemsx/cisd/common/properties/PropertyUtilsTest.java @@ -16,7 +16,6 @@ package ch.systemsx.cisd.common.properties; -import java.io.File; import java.util.Properties; import org.apache.commons.lang.math.NumberUtils; @@ -26,15 +25,12 @@ import org.testng.annotations.Test; import ch.systemsx.cisd.base.tests.AbstractFileSystemTestCase; import ch.systemsx.cisd.common.exception.ConfigurationFailureException; -import ch.systemsx.cisd.common.exception.UserFailureException; -import ch.systemsx.cisd.common.filesystem.FileUtilities; import ch.systemsx.cisd.common.logging.BufferedAppender; import ch.systemsx.cisd.common.logging.ISimpleLogger; import ch.systemsx.cisd.common.logging.Log4jSimpleLogger; -import ch.systemsx.cisd.common.properties.PropertyUtils; /** - * Test cases for corresponding {@link PropertyUtils} class. + * Test cases for {@link PropertyUtils} class. * * @author Christian Ribeaud */ @@ -50,34 +46,6 @@ public final class PropertyUtilsTest extends AbstractFileSystemTestCase appender.resetLogContent(); } - @Test - public void testLoadProperties() - { - File propertiesFile = new File(workingDirectory, "p.properties"); - FileUtilities.writeToFile(propertiesFile, "answer = 42\n\n# comment\n key=4711 "); - Properties properties = PropertyUtils.loadProperties(propertiesFile); - - assertEquals("42", properties.getProperty("answer")); - assertEquals("4711", properties.getProperty("key")); - } - - @Test - public void testLoadInvalidProperties() - { - File propertiesFile = new File(workingDirectory, "p.properties"); - FileUtilities.writeToFile(propertiesFile, "answer=42\nquestion"); - - try - { - PropertyUtils.loadProperties(propertiesFile); - fail("UserFailureException expected"); - } catch (UserFailureException ex) - { - assertEquals("Missing '=' in line 2 of properties file '" + propertiesFile - + "': question", ex.getMessage()); - } - } - @Test public final void testTrim() { diff --git a/datamover/source/java/ch/systemsx/cisd/datamover/Parameters.java b/datamover/source/java/ch/systemsx/cisd/datamover/Parameters.java index c64d0be81ed5b50ea48e979cb0a1ff2cdc57be04..bd29c4a675f98aa1592688b5d31fbb9bd557eb67 100644 --- a/datamover/source/java/ch/systemsx/cisd/datamover/Parameters.java +++ b/datamover/source/java/ch/systemsx/cisd/datamover/Parameters.java @@ -42,6 +42,7 @@ import ch.systemsx.cisd.base.utilities.OSUtilities; import ch.systemsx.cisd.common.exception.ConfigurationFailureException; import ch.systemsx.cisd.common.filesystem.HostAwareFile; import ch.systemsx.cisd.common.filesystem.highwatermark.HostAwareFileWithHighwaterMark; +import ch.systemsx.cisd.common.io.PropertyIOUtils; import ch.systemsx.cisd.common.logging.LogCategory; import ch.systemsx.cisd.common.logging.LogFactory; import ch.systemsx.cisd.common.properties.ExtendedProperties; @@ -463,7 +464,7 @@ public final class Parameters implements ITimingParameters, IFileSysParameters private final void initParametersFromProperties() { final Properties serviceProperties = - PropertyUtils.loadProperties(DatamoverConstants.SERVICE_PROPERTIES_FILE); + PropertyIOUtils.loadProperties(DatamoverConstants.SERVICE_PROPERTIES_FILE); dataCompletedScript = tryCreateFile(serviceProperties, PropertyNames.DATA_COMPLETED_SCRIPT, dataCompletedScript); diff --git a/datastore_server/source/java/ch/systemsx/cisd/etlserver/cifex/CifexExtractorHelper.java b/datastore_server/source/java/ch/systemsx/cisd/etlserver/cifex/CifexExtractorHelper.java index 17fab5258aa5d1d28ef6318fdb1467142506f25b..deca8faf54ce4f10eb1f25a79222be0762384a3c 100644 --- a/datastore_server/source/java/ch/systemsx/cisd/etlserver/cifex/CifexExtractorHelper.java +++ b/datastore_server/source/java/ch/systemsx/cisd/etlserver/cifex/CifexExtractorHelper.java @@ -20,7 +20,7 @@ import java.io.File; import java.util.Properties; import ch.systemsx.cisd.common.exception.UserFailureException; -import ch.systemsx.cisd.common.properties.PropertyUtils; +import ch.systemsx.cisd.common.io.PropertyIOUtils; import ch.systemsx.cisd.openbis.generic.shared.basic.DataSetUploadInfo; import ch.systemsx.cisd.openbis.generic.shared.basic.DataSetUploadInfo.DataSetUploadInfoHelper; @@ -54,7 +54,7 @@ public class CifexExtractorHelper File propertiesFile = new File(incomingDataSetPath, fileName); if (propertiesFile.isFile()) { - return PropertyUtils.loadProperties(propertiesFile.getPath()); + return PropertyIOUtils.loadProperties(propertiesFile.getPath()); } else { throw new UserFailureException("Request properties file '" + propertiesFile diff --git a/datastore_server/source/java/ch/systemsx/cisd/openbis/dss/generic/server/dbbackup/BackupDatabaseDescriptionGenerator.java b/datastore_server/source/java/ch/systemsx/cisd/openbis/dss/generic/server/dbbackup/BackupDatabaseDescriptionGenerator.java index 84e37622f2b0257985a8044f8f66299212e42554..a924110075874b9a56bd829e07533f8a400d9b76 100644 --- a/datastore_server/source/java/ch/systemsx/cisd/openbis/dss/generic/server/dbbackup/BackupDatabaseDescriptionGenerator.java +++ b/datastore_server/source/java/ch/systemsx/cisd/openbis/dss/generic/server/dbbackup/BackupDatabaseDescriptionGenerator.java @@ -25,8 +25,8 @@ import java.util.TreeSet; import org.apache.commons.lang.StringUtils; import ch.systemsx.cisd.base.exceptions.IOExceptionUnchecked; +import ch.systemsx.cisd.common.io.PropertyIOUtils; import ch.systemsx.cisd.common.properties.ExtendedProperties; -import ch.systemsx.cisd.common.properties.PropertyUtils; import ch.systemsx.cisd.openbis.dss.generic.shared.utils.DssPluginType; import ch.systemsx.cisd.openbis.generic.shared.coreplugin.CorePluginScanner.ScannerType; import ch.systemsx.cisd.openbis.generic.shared.coreplugin.CorePluginsInjector; @@ -92,7 +92,7 @@ public class BackupDatabaseDescriptionGenerator private Properties readPropertiesAndInjectCorePluginsIfDSS(File propertiesFile) { - Properties properties = PropertyUtils.loadProperties(propertiesFile); + Properties properties = PropertyIOUtils.loadProperties(propertiesFile); if (isDSSPropertiesFile(propertiesFile)) { String corePluginsFolderRelativePath = @@ -100,7 +100,7 @@ public class BackupDatabaseDescriptionGenerator File workingDirectory = propertiesFile.getParentFile().getParentFile(); File corePluginsFolder = new File(workingDirectory, corePluginsFolderRelativePath); File file = new File(corePluginsFolder, CorePluginsUtils.CORE_PLUGINS_PROPERTIES_FILE); - PropertyUtils.loadAndAppendProperties(properties, file); + PropertyIOUtils.loadAndAppendProperties(properties, file); CorePluginsInjector injector = new CorePluginsInjector(ScannerType.DSS, DssPluginType.values()); injector.injectCorePlugins(properties, corePluginsFolder.getAbsolutePath()); diff --git a/datastore_server/source/java/ch/systemsx/cisd/openbis/dss/generic/shared/utils/DssPropertyParametersUtil.java b/datastore_server/source/java/ch/systemsx/cisd/openbis/dss/generic/shared/utils/DssPropertyParametersUtil.java index 96e1ed1edef0324ffe1043e6439f88dca19abe1e..4a20a959a63c11e42d3f05b6bbea181a37016213 100644 --- a/datastore_server/source/java/ch/systemsx/cisd/openbis/dss/generic/shared/utils/DssPropertyParametersUtil.java +++ b/datastore_server/source/java/ch/systemsx/cisd/openbis/dss/generic/shared/utils/DssPropertyParametersUtil.java @@ -26,6 +26,7 @@ import ch.systemsx.cisd.common.exception.ConfigurationFailureException; import ch.systemsx.cisd.common.filesystem.FileOperations; import ch.systemsx.cisd.common.filesystem.FileUtilities; import ch.systemsx.cisd.common.filesystem.IFileOperations; +import ch.systemsx.cisd.common.io.PropertyIOUtils; import ch.systemsx.cisd.common.properties.ExtendedProperties; import ch.systemsx.cisd.common.properties.PropertyUtils; import ch.systemsx.cisd.common.string.Template; @@ -102,7 +103,7 @@ public class DssPropertyParametersUtil public static ExtendedProperties loadProperties(String filePath) { - return extendProperties(PropertyUtils.loadProperties(filePath)); + return extendProperties(PropertyIOUtils.loadProperties(filePath)); } private static ExtendedProperties extendProperties(Properties properties) diff --git a/deep_sequencing_unit/source/java/ch/ethz/bsse/cisd/dsu/tracking/main/TrackingClient.java b/deep_sequencing_unit/source/java/ch/ethz/bsse/cisd/dsu/tracking/main/TrackingClient.java index 2bd37f3b3556c7ef9b98a05b2d7215ea979def97..782600c502f94d0adec60b95c667fcffc1781b3f 100644 --- a/deep_sequencing_unit/source/java/ch/ethz/bsse/cisd/dsu/tracking/main/TrackingClient.java +++ b/deep_sequencing_unit/source/java/ch/ethz/bsse/cisd/dsu/tracking/main/TrackingClient.java @@ -31,10 +31,10 @@ import ch.ethz.bsse.cisd.dsu.tracking.email.EntityTrackingEmailGenerator; import ch.ethz.bsse.cisd.dsu.tracking.email.IEntityTrackingEmailGenerator; import ch.ethz.bsse.cisd.dsu.tracking.utils.LogUtils; import ch.systemsx.cisd.common.exception.EnvironmentFailureException; +import ch.systemsx.cisd.common.io.PropertyIOUtils; import ch.systemsx.cisd.common.logging.LogInitializer; import ch.systemsx.cisd.common.mail.EMailAddress; import ch.systemsx.cisd.common.mail.IMailClient; -import ch.systemsx.cisd.common.properties.PropertyUtils; import ch.systemsx.cisd.common.shared.basic.string.StringUtils; import ch.systemsx.cisd.common.spring.HttpInvokerUtils; import ch.systemsx.cisd.openbis.generic.shared.ITrackingServer; @@ -70,7 +70,7 @@ public class TrackingClient private static void track() { LogInitializer.init(); - Properties props = PropertyUtils.loadProperties(SERVICE_PROPERTIES_FILE); + Properties props = PropertyIOUtils.loadProperties(SERVICE_PROPERTIES_FILE); Parameters params = new Parameters(props); ITrackingServer trackingServer = createOpenBISTrackingServer(params); diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/server/WebClientConfigurationProvider.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/server/WebClientConfigurationProvider.java index e417e6eac34e3333eebad1ddbe9a505be9974a98..96bd16d71867b3b1dc62dfc831875e81489cb3da 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/server/WebClientConfigurationProvider.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/server/WebClientConfigurationProvider.java @@ -25,6 +25,7 @@ import java.util.Map.Entry; import java.util.Properties; import java.util.Set; +import ch.systemsx.cisd.common.io.PropertyIOUtils; import ch.systemsx.cisd.common.properties.PropertyParametersUtil; import ch.systemsx.cisd.common.properties.PropertyUtils; import ch.systemsx.cisd.common.properties.PropertyParametersUtil.SectionProperties; @@ -102,7 +103,7 @@ public class WebClientConfigurationProvider initDefaultValues(); return; } - Properties properties = PropertyUtils.loadProperties(configurationFile); + Properties properties = PropertyIOUtils.loadProperties(configurationFile); init(properties); } diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/coreplugin/CorePluginsUtils.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/coreplugin/CorePluginsUtils.java index 21abfed9f7e15ff086c89ac2fcdacffee29db91f..58b68e577f61d1184ee6ae0f70dfc5292b990909 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/coreplugin/CorePluginsUtils.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/coreplugin/CorePluginsUtils.java @@ -19,7 +19,7 @@ package ch.systemsx.cisd.openbis.generic.shared.coreplugin; import java.io.File; import java.util.Properties; -import ch.systemsx.cisd.common.properties.PropertyUtils; +import ch.systemsx.cisd.common.io.PropertyIOUtils; import ch.systemsx.cisd.openbis.generic.shared.coreplugin.CorePluginScanner.ScannerType; /** @@ -48,7 +48,7 @@ public class CorePluginsUtils { String corePluginsFolder = getCorePluginsFolder(properties, scannerType); File file = new File(corePluginsFolder, CORE_PLUGINS_PROPERTIES_FILE); - PropertyUtils.loadAndAppendProperties(properties, file); + PropertyIOUtils.loadAndAppendProperties(properties, file); } /** diff --git a/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/etlserver/proteomics/DataSetInfoExtractorForProteinResults.java b/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/etlserver/proteomics/DataSetInfoExtractorForProteinResults.java index 18c4d4464005aeec5cde3d0874c5d244c2fa9b6b..218b70c7b779a7c30517924ab42f10c7a32c73cf 100644 --- a/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/etlserver/proteomics/DataSetInfoExtractorForProteinResults.java +++ b/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/etlserver/proteomics/DataSetInfoExtractorForProteinResults.java @@ -26,7 +26,7 @@ import org.apache.commons.lang.StringUtils; import ch.rinn.restrictions.Private; import ch.systemsx.cisd.common.exception.EnvironmentFailureException; import ch.systemsx.cisd.common.exception.UserFailureException; -import ch.systemsx.cisd.common.properties.PropertyUtils; +import ch.systemsx.cisd.common.io.PropertyIOUtils; import ch.systemsx.cisd.openbis.dss.generic.shared.IEncapsulatedOpenBISService; import ch.systemsx.cisd.openbis.dss.generic.shared.ServiceProvider; import ch.systemsx.cisd.openbis.dss.generic.shared.dto.DataSetInformation; @@ -193,7 +193,7 @@ public class DataSetInfoExtractorForProteinResults extends AbstractDataSetInfoEx properties = new Properties(); } else { - properties = PropertyUtils.loadProperties(propertiesFile); + properties = PropertyIOUtils.loadProperties(propertiesFile); } return properties; } diff --git a/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/etlserver/proteomics/Util.java b/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/etlserver/proteomics/Util.java index ec3006d0f9381be90b0b1d04313498a23df307ea..6c80df8cb8af5c909ef670d87ed72cdbb32fb3ea 100644 --- a/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/etlserver/proteomics/Util.java +++ b/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/etlserver/proteomics/Util.java @@ -22,7 +22,7 @@ import java.util.List; import java.util.Properties; import ch.systemsx.cisd.common.exception.UserFailureException; -import ch.systemsx.cisd.common.properties.PropertyUtils; +import ch.systemsx.cisd.common.io.PropertyIOUtils; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.EntityProperty; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.EntityType; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.EntityTypePropertyType; @@ -104,6 +104,6 @@ class Util throw new UserFailureException("Properties file '" + propertiesFileName + "' is a folder."); } - return PropertyUtils.loadProperties(propertiesFile); + return PropertyIOUtils.loadProperties(propertiesFile); } }