diff --git a/config/alfresco/bootstrap-context.xml b/config/alfresco/bootstrap-context.xml
index d0aeb3d05c..8aab2ec0b0 100644
--- a/config/alfresco/bootstrap-context.xml
+++ b/config/alfresco/bootstrap-context.xml
@@ -103,6 +103,16 @@
${alfresco.cluster.name}
+
+
+
+
+ ${alfresco.jgroups.configLocation}
+
diff --git a/config/alfresco/repository.properties b/config/alfresco/repository.properties
index 7c0af4d308..792b0eb0c8 100644
--- a/config/alfresco/repository.properties
+++ b/config/alfresco/repository.properties
@@ -64,6 +64,15 @@ system.bootstrap.config_check.strict=true
# Leave this empty to disable cluster entry
alfresco.cluster.name=
+# JGroups configuration (http://www.jgroups.org)
+# The location of the JGroups configuration file
+# It is also possible to override this by just dropping a file in classpath:alfresco/extension/jgroups-custom.xml
+alfresco.jgroups.configLocation=classpath:alfresco/jgroups-default.xml
+# The protocol stack to use from the JGroups configuration file
+# The JGroups configuration files are divided into protocol stacks.
+# Use this property to select which communication method should be used.
+alfresco.jgroups.defaultProtocol=UDP
+
#
# How long should shutdown wait to complete normally before
# taking stronger action and calling System.exit()
diff --git a/source/java/org/alfresco/repo/admin/RepoServerMgmt.java b/source/java/org/alfresco/repo/admin/RepoServerMgmt.java
index b4f75271b0..3e8aee2a94 100644
--- a/source/java/org/alfresco/repo/admin/RepoServerMgmt.java
+++ b/source/java/org/alfresco/repo/admin/RepoServerMgmt.java
@@ -35,6 +35,7 @@ import org.alfresco.linkvalidation.LinkValidationService;
import org.alfresco.repo.security.authentication.AbstractAuthenticationService;
import org.alfresco.repo.transaction.TransactionServiceImpl;
import org.alfresco.service.license.LicenseService;
+import org.alfresco.util.PropertyCheck;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.InitializingBean;
@@ -56,10 +57,6 @@ public class RepoServerMgmt implements RepoServerMgmtMBean, ApplicationContextAw
private boolean initialised = false;
- // property key should be the same as the one in core-services-context.xml (to allow repo to start in multi-user
- // mode even if the property is not set)
- private final static String PROPERTY_KEY_SINGLE_USER_ONLY = "${server.singleuseronly.name}";
-
public void setTransactionService(TransactionServiceImpl transactionService)
{
this.transactionService = transactionService;
@@ -81,11 +78,6 @@ public class RepoServerMgmt implements RepoServerMgmtMBean, ApplicationContextAw
this.ctx = ctx;
}
- /*
- * (non-Javadoc)
- *
- * @see org.alfresco.repo.admin.RepoServerMgmtMBean#setReadOnly(boolean)
- */
public void setReadOnly(boolean readOnly)
{
if (readOnly && isReadOnly())
@@ -125,11 +117,6 @@ public class RepoServerMgmt implements RepoServerMgmtMBean, ApplicationContextAw
}
}
- /*
- * (non-Javadoc)
- *
- * @see org.alfresco.mbeans.RepoServerMgmtMBean#isReadOnly(java.lang.Boolean)
- */
public boolean isReadOnly()
{
return transactionService.isReadOnly();
@@ -138,41 +125,21 @@ public class RepoServerMgmt implements RepoServerMgmtMBean, ApplicationContextAw
// Note: implementing counts as managed attributes (without params) means that
// certain JMX consoles can monitor
- /*
- * (non-Javadoc)
- *
- * @see org.alfresco.mbeans.RepoServerMgmtMBean#getTicketCountNonExpired()
- */
public int getTicketCountNonExpired()
{
return authenticationService.countTickets(true);
}
- /*
- * (non-Javadoc)
- *
- * @see org.alfresco.mbeans.RepoServerMgmtMBean#getTicketCountAll()
- */
public int getTicketCountAll()
{
return authenticationService.countTickets(false);
}
- /*
- * (non-Javadoc)
- *
- * @see org.alfresco.mbeans.RepoServerMgmtMBean#getUserCountNonExpired()
- */
public int getUserCountNonExpired()
{
return authenticationService.getUsersWithTickets(true).size();
}
- /*
- * (non-Javadoc)
- *
- * @see org.alfresco.mbeans.RepoServerMgmtMBean#getUserCountAll()
- */
public int getUserCountAll()
{
return authenticationService.getUsersWithTickets(false).size();
@@ -181,11 +148,6 @@ public class RepoServerMgmt implements RepoServerMgmtMBean, ApplicationContextAw
// Note: implement operations without boolean/Boolean parameter, due to problem with some JMX consoles (e.g. MC4J
// 1.9 Beta)
- /*
- * (non-Javadoc)
- *
- * @see org.alfresco.repo.admin.RepoServerMgmtMBean#listUserNamesNonExpired()
- */
public String[] listUserNamesNonExpired()
{
Set userSet = authenticationService.getUsersWithTickets(true);
@@ -193,11 +155,6 @@ public class RepoServerMgmt implements RepoServerMgmtMBean, ApplicationContextAw
return sorted.toArray(new String[0]);
}
- /*
- * (non-Javadoc)
- *
- * @see org.alfresco.repo.admin.RepoServerMgmtMBean#listUserNamesAll()
- */
public String[] listUserNamesAll()
{
Set userSet = authenticationService.getUsersWithTickets(false);
@@ -205,11 +162,6 @@ public class RepoServerMgmt implements RepoServerMgmtMBean, ApplicationContextAw
return sorted.toArray(new String[0]);
}
- /*
- * (non-Javadoc)
- *
- * @see org.alfresco.mbeans.RepoServerMgmtMBean#invalidateTicketsExpired()
- */
public int invalidateTicketsExpired()
{
int count = authenticationService.invalidateTickets(true);
@@ -217,11 +169,6 @@ public class RepoServerMgmt implements RepoServerMgmtMBean, ApplicationContextAw
return count;
}
- /*
- * (non-Javadoc)
- *
- * @see org.alfresco.mbeans.RepoServerMgmtMBean#invalidateTicketsAll()
- */
public int invalidateTicketsAll()
{
int count = authenticationService.invalidateTickets(false);
@@ -229,46 +176,33 @@ public class RepoServerMgmt implements RepoServerMgmtMBean, ApplicationContextAw
return count;
}
- /*
- * (non-Javadoc)
- *
- * @see org.alfresco.repo.admin.RepoServerMgmtMBean#invalidateUser(java.lang.String)
- */
public void invalidateUser(String username)
{
authenticationService.invalidateUserSession(username);
log.info("User invalidated: " + username);
}
- /*
- * (non-Javadoc)
- *
- * @see org.alfresco.repo.admin.RepoServerMgmtMBean#setSingleUserOnly(java.lang.String)
- */
public void setSingleUserOnly(String allowedUsername)
{
List allowedUsers = null;
- if ((allowedUsername != null) && (!allowedUsername.equals("")))
+ if (PropertyCheck.isValidPropertyString(allowedUsername))
{
- if (!allowedUsername.equals(PROPERTY_KEY_SINGLE_USER_ONLY))
+ allowedUsers = new ArrayList(0);
+ allowedUsers.add(allowedUsername);
+
+ if (initialised)
{
- allowedUsers = new ArrayList(0);
- allowedUsers.add(allowedUsername);
+ int maxUsers = getMaxUsers();
+ invalidateTicketsAll();
- if (initialised)
+ if (maxUsers != 0)
{
- int maxUsers = getMaxUsers();
- invalidateTicketsAll();
-
- if (maxUsers != 0)
- {
- log.warn("Alfresco set to allow single-user (" + allowedUsername + ") logins only");
- }
- else
- {
- log.warn("Alfresco set to allow single-user (" + allowedUsername + ") logins - although further logins are currently prevented (limit = 0)");
- }
+ log.warn("Alfresco set to allow single-user (" + allowedUsername + ") logins only");
+ }
+ else
+ {
+ log.warn("Alfresco set to allow single-user (" + allowedUsername + ") logins - although further logins are currently prevented (limit = 0)");
}
}
}
@@ -295,11 +229,6 @@ public class RepoServerMgmt implements RepoServerMgmtMBean, ApplicationContextAw
authenticationService.setAllowedUsers(allowedUsers);
}
- /*
- * (non-Javadoc)
- *
- * @see org.alfresco.repo.admin.RepoServerMgmtMBean#getSingleUserOnly()
- */
public String getSingleUserOnly()
{
List allowedUsers = authenticationService.getAllowedUsers();
@@ -317,11 +246,6 @@ public class RepoServerMgmt implements RepoServerMgmtMBean, ApplicationContextAw
return null;
}
- /*
- * (non-Javadoc)
- *
- * @see org.alfresco.repo.admin.RepoServerMgmtMBean#setMaxUsers(int)
- */
public void setMaxUsers(int maxUsers)
{
authenticationService.setMaxUsers(maxUsers);
@@ -358,21 +282,11 @@ public class RepoServerMgmt implements RepoServerMgmtMBean, ApplicationContextAw
}
}
- /*
- * (non-Javadoc)
- *
- * @see org.alfresco.repo.admin.RepoServerMgmtMBean#getMaxUsers()
- */
public int getMaxUsers()
{
return authenticationService.getMaxUsers();
}
- /*
- * (non-Javadoc)
- *
- * @see org.alfresco.repo.admin.RepoServerMgmtMBean#setLinkValidationDisabled(boolean)
- */
public void setLinkValidationDisabled(boolean disable)
{
if (linkValidationService == null)
@@ -392,11 +306,6 @@ public class RepoServerMgmt implements RepoServerMgmtMBean, ApplicationContextAw
}
}
- /*
- * (non-Javadoc)
- *
- * @see org.alfresco.repo.admin.RepoServerMgmtMBean#isLinkValidationDisabled()
- */
public boolean isLinkValidationDisabled()
{
if (linkValidationService == null)
diff --git a/source/java/org/alfresco/repo/jgroups/AlfrescoJGroupsChannelFactory.java b/source/java/org/alfresco/repo/jgroups/AlfrescoJGroupsChannelFactory.java
index cef949c17c..2a10d7bc4a 100644
--- a/source/java/org/alfresco/repo/jgroups/AlfrescoJGroupsChannelFactory.java
+++ b/source/java/org/alfresco/repo/jgroups/AlfrescoJGroupsChannelFactory.java
@@ -39,6 +39,7 @@ import java.util.concurrent.locks.ReentrantReadWriteLock.WriteLock;
import org.alfresco.error.AlfrescoRuntimeException;
import org.alfresco.util.AbstractLifecycleBean;
+import org.alfresco.util.PropertyCheck;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.jgroups.Address;
@@ -269,7 +270,7 @@ public class AlfrescoJGroupsChannelFactory extends AbstractLifecycleBean
JChannelFactory channelFactory = getChannelFactory();
// Get the protocol stack to use
String stack = stacksByAppRegion.get(appRegion);
- if (stack == null)
+ if (!PropertyCheck.isValidPropertyString(stack))
{
stack = stacksByAppRegion.get(AlfrescoJGroupsChannelFactory.APP_REGION_DEFAULT);
}
@@ -449,7 +450,7 @@ public class AlfrescoJGroupsChannelFactory extends AbstractLifecycleBean
writeLock.lock();
try
{
- if (clusterNamePrefix == null || clusterNamePrefix.trim().length() == 0 || clusterNamePrefix.startsWith("${"))
+ if (!PropertyCheck.isValidPropertyString(clusterNamePrefix))
{
// Clear everything out
AlfrescoJGroupsChannelFactory.clusterNamePrefix = null;
@@ -498,6 +499,13 @@ public class AlfrescoJGroupsChannelFactory extends AbstractLifecycleBean
public static void changeJgroupsConfigurationUrl(String configUrl)
{
writeLock.lock();
+ if (!PropertyCheck.isValidPropertyString(configUrl))
+ {
+ // It's not really being set
+ AlfrescoJGroupsChannelFactory.configUrl = null;
+ return;
+ }
+ // It's a real attempt to set it
try
{
AlfrescoJGroupsChannelFactory.configUrl = ResourceUtils.getURL(configUrl);
diff --git a/source/java/org/alfresco/repo/node/index/IndexRecoveryJob.java b/source/java/org/alfresco/repo/node/index/IndexRecoveryJob.java
index a2dbb3fa84..e105205295 100644
--- a/source/java/org/alfresco/repo/node/index/IndexRecoveryJob.java
+++ b/source/java/org/alfresco/repo/node/index/IndexRecoveryJob.java
@@ -1,5 +1,6 @@
package org.alfresco.repo.node.index;
+import org.alfresco.util.PropertyCheck;
import org.quartz.Job;
import org.quartz.JobDataMap;
import org.quartz.JobExecutionContext;
@@ -31,7 +32,7 @@ public class IndexRecoveryJob implements Job
throw new JobExecutionException("Missing job data: " + KEY_INDEX_RECOVERY_COMPONENT);
}
String clusterName = (String) map.get(KEY_CLUSTER_NAME);
- if (clusterName == null || clusterName.trim().length() == 0 || clusterName.startsWith("${"))
+ if (!PropertyCheck.isValidPropertyString(clusterName))
{
// No cluster name
return;