text
, replaces all occurrences of placeholders having
- * the form ${property.name} with the value of the property having the key "property.name". The
- * properties are supplied using {@link #setProperties(Properties)}.
- *
- * @param text The String to apply property substitutions to.
- * @return String after substitutions have been applied.
- */
- private String substituteProperties(String text)
- {
- for (String propName : properties.stringPropertyNames())
- {
- String propValue = properties.getProperty(propName);
- String quotedPropName = Pattern.quote(PLACEHOLDER_START + propName + PLACEHOLDER_END);
- text = text.replaceAll(quotedPropName, propValue);
- }
-
- return text;
- }
-
- /**
- * Opens the configFile {@link Resource} and reads the contents into a String.
- *
- * @return the contents of the configFile resource.
- */
- private String getConfigFileContents()
- {
- StringWriter writer = new StringWriter();
- InputStream inputStream = null;
- try
- {
- inputStream = configFile.getInputStream();
- IOUtils.copy(inputStream, writer, "UTF-8");
- return writer.toString();
- }
- catch (IOException e)
- {
- throw new RuntimeException("Couldn't read configuration: " + configFile, e);
- }
- finally
- {
- try
- {
- if (inputStream != null)
- {
- inputStream.close();
- }
- }
- catch (IOException e)
- {
- throw new RuntimeException("Couldn't close stream", e);
- }
- }
- }
-
- /**
- * FactoryBean's factory method. Returns the config with the property key/value
- * substitutions in place.
- */
- @Override
- public Config getObject() throws Exception
- {
- return config;
- }
-
- @Override
- public Class> getObjectType()
- {
- return Config.class;
- }
-
- @Override
- public boolean isSingleton()
- {
- return true;
- }
-}
diff --git a/source/java/org/alfresco/repo/cluster/HazelcastConfigFactoryBeanTest.java b/source/java/org/alfresco/repo/cluster/HazelcastConfigFactoryBeanTest.java
index 5a897852cf..e69de29bb2 100644
--- a/source/java/org/alfresco/repo/cluster/HazelcastConfigFactoryBeanTest.java
+++ b/source/java/org/alfresco/repo/cluster/HazelcastConfigFactoryBeanTest.java
@@ -1,69 +0,0 @@
-/*
- * Copyright (C) 2005-2012 Alfresco Software Limited.
- *
- * This file is part of Alfresco
- *
- * Alfresco is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * Alfresco is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with Alfresco. If not, see - * An intermediary class such as this is required in order to avoid starting - * Hazelcast instances when clustering is not configured/required. Otherwise - * simply by defining a HazelcastInstance bean clustering would spring into life. - *
- * Please note this class provides non-static access deliberately, and should be
- * injected into any clients that require its services.
- *
- * @author Matt Ward
- */
-public class HazelcastInstanceFactory
-{
- private Config config;
- private HazelcastInstance hazelcastInstance;
- /** Guards {@link #config} and {@link #hazelcastInstance} */
- private ReentrantReadWriteLock rwLock = new ReentrantReadWriteLock();
-
- public HazelcastInstance getInstance()
- {
- rwLock.readLock().lock();
- try
- {
- if (hazelcastInstance != null)
- {
- return hazelcastInstance;
- }
- }
- finally
- {
- rwLock.readLock().unlock();
- }
-
- // hazelcastInstance is null, so create it.
- rwLock.writeLock().lock();
- try
- {
- // Double check condition hasn't changed in between locks.
- if (hazelcastInstance == null)
- {
- hazelcastInstance = Hazelcast.newHazelcastInstance(config);
- }
- return hazelcastInstance;
- }
- finally
- {
- rwLock.writeLock().unlock();
- }
- }
-
- /**
- * Checks whether hazelcast has been given a valid cluster name. If so,
- * then clustering is considered enabled. This condition should be checked
- * before calling {@link #getInstance()}.
- *
- * @return true if clustering is enabled, false otherwise.
- */
- public boolean isClusteringEnabled()
- {
- rwLock.readLock().lock();
- try
- {
- String clusterName = config.getGroupConfig().getName();
- return (PropertyCheck.isValidPropertyString(clusterName));
- }
- finally
- {
- rwLock.readLock().unlock();
- }
- }
-
- /**
- * Retrieve the name of the cluster for the configuration used by this factory.
- *
- * @return String - the cluster name.
- */
- public String getClusterName()
- {
- rwLock.readLock().lock();
- try
- {
- String clusterName = config.getGroupConfig().getName();
- return clusterName;
- }
- finally
- {
- rwLock.readLock().unlock();
- }
- }
-
- /**
- * Sets the Hazelcast configuration that will be used by this factory when
- * creating the HazelcastInstance.
- *
- * @param config Hazelcast configuration
- */
- public void setConfig(Config config)
- {
- rwLock.writeLock().lock();
- try
- {
- this.config = config;
- }
- finally
- {
- rwLock.writeLock().unlock();
- }
- }
-}
diff --git a/source/java/org/alfresco/repo/webdav/LockStoreFactoryImpl.java b/source/java/org/alfresco/repo/webdav/LockStoreFactoryImpl.java
index 351e406b7c..e69de29bb2 100644
--- a/source/java/org/alfresco/repo/webdav/LockStoreFactoryImpl.java
+++ b/source/java/org/alfresco/repo/webdav/LockStoreFactoryImpl.java
@@ -1,79 +0,0 @@
-/*
- * Copyright (C) 2005-2013 Alfresco Software Limited.
- *
- * This file is part of Alfresco
- *
- * Alfresco is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * Alfresco is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with Alfresco. If not, see