Merged V3.1 to HEAD

13158: Added PropertyCheck.isValidPropertyString and fixed related checks
   13159: Missed file for rev 13158: PropertyCheck.isValidPropertyString
   13160: Fixed ETHREEOH-1281: JGroups default protocol mapping must be switchable
   13163: Complete fix for ETHREEOH-1277 - add new custom JSP tag
   ___________________________________________________________________
   Modified: svn:mergeinfo
      Merged /alfresco/BRANCHES/V3.1:r13158-13160,13163


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@13604 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Derek Hulley
2009-03-12 14:50:03 +00:00
parent be54a05c8e
commit 8ff478a98b
5 changed files with 45 additions and 108 deletions

View File

@@ -103,6 +103,16 @@
<property name="clusterName"> <property name="clusterName">
<value>${alfresco.cluster.name}</value> <value>${alfresco.cluster.name}</value>
</property> </property>
<property name="protocolStackMapping">
<map>
<entry key="DEFAULT">
<value>${alfresco.jgroups.defaultProtocol}</value>
</entry>
</map>
</property>
<property name="jgroupsConfigurationUrl">
<value>${alfresco.jgroups.configLocation}</value>
</property>
</bean> </bean>
<!-- Bootstrap the AVM --> <!-- Bootstrap the AVM -->

View File

@@ -64,6 +64,15 @@ system.bootstrap.config_check.strict=true
# Leave this empty to disable cluster entry # Leave this empty to disable cluster entry
alfresco.cluster.name= 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 # How long should shutdown wait to complete normally before
# taking stronger action and calling System.exit() # taking stronger action and calling System.exit()

View File

@@ -35,6 +35,7 @@ import org.alfresco.linkvalidation.LinkValidationService;
import org.alfresco.repo.security.authentication.AbstractAuthenticationService; import org.alfresco.repo.security.authentication.AbstractAuthenticationService;
import org.alfresco.repo.transaction.TransactionServiceImpl; import org.alfresco.repo.transaction.TransactionServiceImpl;
import org.alfresco.service.license.LicenseService; import org.alfresco.service.license.LicenseService;
import org.alfresco.util.PropertyCheck;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.InitializingBean; import org.springframework.beans.factory.InitializingBean;
@@ -56,10 +57,6 @@ public class RepoServerMgmt implements RepoServerMgmtMBean, ApplicationContextAw
private boolean initialised = false; 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) public void setTransactionService(TransactionServiceImpl transactionService)
{ {
this.transactionService = transactionService; this.transactionService = transactionService;
@@ -81,11 +78,6 @@ public class RepoServerMgmt implements RepoServerMgmtMBean, ApplicationContextAw
this.ctx = ctx; this.ctx = ctx;
} }
/*
* (non-Javadoc)
*
* @see org.alfresco.repo.admin.RepoServerMgmtMBean#setReadOnly(boolean)
*/
public void setReadOnly(boolean readOnly) public void setReadOnly(boolean readOnly)
{ {
if (readOnly && isReadOnly()) 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() public boolean isReadOnly()
{ {
return transactionService.isReadOnly(); return transactionService.isReadOnly();
@@ -138,41 +125,21 @@ public class RepoServerMgmt implements RepoServerMgmtMBean, ApplicationContextAw
// Note: implementing counts as managed attributes (without params) means that // Note: implementing counts as managed attributes (without params) means that
// certain JMX consoles can monitor // certain JMX consoles can monitor
/*
* (non-Javadoc)
*
* @see org.alfresco.mbeans.RepoServerMgmtMBean#getTicketCountNonExpired()
*/
public int getTicketCountNonExpired() public int getTicketCountNonExpired()
{ {
return authenticationService.countTickets(true); return authenticationService.countTickets(true);
} }
/*
* (non-Javadoc)
*
* @see org.alfresco.mbeans.RepoServerMgmtMBean#getTicketCountAll()
*/
public int getTicketCountAll() public int getTicketCountAll()
{ {
return authenticationService.countTickets(false); return authenticationService.countTickets(false);
} }
/*
* (non-Javadoc)
*
* @see org.alfresco.mbeans.RepoServerMgmtMBean#getUserCountNonExpired()
*/
public int getUserCountNonExpired() public int getUserCountNonExpired()
{ {
return authenticationService.getUsersWithTickets(true).size(); return authenticationService.getUsersWithTickets(true).size();
} }
/*
* (non-Javadoc)
*
* @see org.alfresco.mbeans.RepoServerMgmtMBean#getUserCountAll()
*/
public int getUserCountAll() public int getUserCountAll()
{ {
return authenticationService.getUsersWithTickets(false).size(); 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 // Note: implement operations without boolean/Boolean parameter, due to problem with some JMX consoles (e.g. MC4J
// 1.9 Beta) // 1.9 Beta)
/*
* (non-Javadoc)
*
* @see org.alfresco.repo.admin.RepoServerMgmtMBean#listUserNamesNonExpired()
*/
public String[] listUserNamesNonExpired() public String[] listUserNamesNonExpired()
{ {
Set<String> userSet = authenticationService.getUsersWithTickets(true); Set<String> userSet = authenticationService.getUsersWithTickets(true);
@@ -193,11 +155,6 @@ public class RepoServerMgmt implements RepoServerMgmtMBean, ApplicationContextAw
return sorted.toArray(new String[0]); return sorted.toArray(new String[0]);
} }
/*
* (non-Javadoc)
*
* @see org.alfresco.repo.admin.RepoServerMgmtMBean#listUserNamesAll()
*/
public String[] listUserNamesAll() public String[] listUserNamesAll()
{ {
Set<String> userSet = authenticationService.getUsersWithTickets(false); Set<String> userSet = authenticationService.getUsersWithTickets(false);
@@ -205,11 +162,6 @@ public class RepoServerMgmt implements RepoServerMgmtMBean, ApplicationContextAw
return sorted.toArray(new String[0]); return sorted.toArray(new String[0]);
} }
/*
* (non-Javadoc)
*
* @see org.alfresco.mbeans.RepoServerMgmtMBean#invalidateTicketsExpired()
*/
public int invalidateTicketsExpired() public int invalidateTicketsExpired()
{ {
int count = authenticationService.invalidateTickets(true); int count = authenticationService.invalidateTickets(true);
@@ -217,11 +169,6 @@ public class RepoServerMgmt implements RepoServerMgmtMBean, ApplicationContextAw
return count; return count;
} }
/*
* (non-Javadoc)
*
* @see org.alfresco.mbeans.RepoServerMgmtMBean#invalidateTicketsAll()
*/
public int invalidateTicketsAll() public int invalidateTicketsAll()
{ {
int count = authenticationService.invalidateTickets(false); int count = authenticationService.invalidateTickets(false);
@@ -229,46 +176,33 @@ public class RepoServerMgmt implements RepoServerMgmtMBean, ApplicationContextAw
return count; return count;
} }
/*
* (non-Javadoc)
*
* @see org.alfresco.repo.admin.RepoServerMgmtMBean#invalidateUser(java.lang.String)
*/
public void invalidateUser(String username) public void invalidateUser(String username)
{ {
authenticationService.invalidateUserSession(username); authenticationService.invalidateUserSession(username);
log.info("User invalidated: " + username); log.info("User invalidated: " + username);
} }
/*
* (non-Javadoc)
*
* @see org.alfresco.repo.admin.RepoServerMgmtMBean#setSingleUserOnly(java.lang.String)
*/
public void setSingleUserOnly(String allowedUsername) public void setSingleUserOnly(String allowedUsername)
{ {
List<String> allowedUsers = null; List<String> allowedUsers = null;
if ((allowedUsername != null) && (!allowedUsername.equals(""))) if (PropertyCheck.isValidPropertyString(allowedUsername))
{ {
if (!allowedUsername.equals(PROPERTY_KEY_SINGLE_USER_ONLY)) allowedUsers = new ArrayList<String>(0);
allowedUsers.add(allowedUsername);
if (initialised)
{ {
allowedUsers = new ArrayList<String>(0); int maxUsers = getMaxUsers();
allowedUsers.add(allowedUsername); invalidateTicketsAll();
if (initialised) if (maxUsers != 0)
{ {
int maxUsers = getMaxUsers(); log.warn("Alfresco set to allow single-user (" + allowedUsername + ") logins only");
invalidateTicketsAll(); }
else
if (maxUsers != 0) {
{ 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); authenticationService.setAllowedUsers(allowedUsers);
} }
/*
* (non-Javadoc)
*
* @see org.alfresco.repo.admin.RepoServerMgmtMBean#getSingleUserOnly()
*/
public String getSingleUserOnly() public String getSingleUserOnly()
{ {
List<String> allowedUsers = authenticationService.getAllowedUsers(); List<String> allowedUsers = authenticationService.getAllowedUsers();
@@ -317,11 +246,6 @@ public class RepoServerMgmt implements RepoServerMgmtMBean, ApplicationContextAw
return null; return null;
} }
/*
* (non-Javadoc)
*
* @see org.alfresco.repo.admin.RepoServerMgmtMBean#setMaxUsers(int)
*/
public void setMaxUsers(int maxUsers) public void setMaxUsers(int maxUsers)
{ {
authenticationService.setMaxUsers(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() public int getMaxUsers()
{ {
return authenticationService.getMaxUsers(); return authenticationService.getMaxUsers();
} }
/*
* (non-Javadoc)
*
* @see org.alfresco.repo.admin.RepoServerMgmtMBean#setLinkValidationDisabled(boolean)
*/
public void setLinkValidationDisabled(boolean disable) public void setLinkValidationDisabled(boolean disable)
{ {
if (linkValidationService == null) 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() public boolean isLinkValidationDisabled()
{ {
if (linkValidationService == null) if (linkValidationService == null)

View File

@@ -39,6 +39,7 @@ import java.util.concurrent.locks.ReentrantReadWriteLock.WriteLock;
import org.alfresco.error.AlfrescoRuntimeException; import org.alfresco.error.AlfrescoRuntimeException;
import org.alfresco.util.AbstractLifecycleBean; import org.alfresco.util.AbstractLifecycleBean;
import org.alfresco.util.PropertyCheck;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.LogFactory;
import org.jgroups.Address; import org.jgroups.Address;
@@ -269,7 +270,7 @@ public class AlfrescoJGroupsChannelFactory extends AbstractLifecycleBean
JChannelFactory channelFactory = getChannelFactory(); JChannelFactory channelFactory = getChannelFactory();
// Get the protocol stack to use // Get the protocol stack to use
String stack = stacksByAppRegion.get(appRegion); String stack = stacksByAppRegion.get(appRegion);
if (stack == null) if (!PropertyCheck.isValidPropertyString(stack))
{ {
stack = stacksByAppRegion.get(AlfrescoJGroupsChannelFactory.APP_REGION_DEFAULT); stack = stacksByAppRegion.get(AlfrescoJGroupsChannelFactory.APP_REGION_DEFAULT);
} }
@@ -449,7 +450,7 @@ public class AlfrescoJGroupsChannelFactory extends AbstractLifecycleBean
writeLock.lock(); writeLock.lock();
try try
{ {
if (clusterNamePrefix == null || clusterNamePrefix.trim().length() == 0 || clusterNamePrefix.startsWith("${")) if (!PropertyCheck.isValidPropertyString(clusterNamePrefix))
{ {
// Clear everything out // Clear everything out
AlfrescoJGroupsChannelFactory.clusterNamePrefix = null; AlfrescoJGroupsChannelFactory.clusterNamePrefix = null;
@@ -498,6 +499,13 @@ public class AlfrescoJGroupsChannelFactory extends AbstractLifecycleBean
public static void changeJgroupsConfigurationUrl(String configUrl) public static void changeJgroupsConfigurationUrl(String configUrl)
{ {
writeLock.lock(); 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 try
{ {
AlfrescoJGroupsChannelFactory.configUrl = ResourceUtils.getURL(configUrl); AlfrescoJGroupsChannelFactory.configUrl = ResourceUtils.getURL(configUrl);

View File

@@ -1,5 +1,6 @@
package org.alfresco.repo.node.index; package org.alfresco.repo.node.index;
import org.alfresco.util.PropertyCheck;
import org.quartz.Job; import org.quartz.Job;
import org.quartz.JobDataMap; import org.quartz.JobDataMap;
import org.quartz.JobExecutionContext; import org.quartz.JobExecutionContext;
@@ -31,7 +32,7 @@ public class IndexRecoveryJob implements Job
throw new JobExecutionException("Missing job data: " + KEY_INDEX_RECOVERY_COMPONENT); throw new JobExecutionException("Missing job data: " + KEY_INDEX_RECOVERY_COMPONENT);
} }
String clusterName = (String) map.get(KEY_CLUSTER_NAME); String clusterName = (String) map.get(KEY_CLUSTER_NAME);
if (clusterName == null || clusterName.trim().length() == 0 || clusterName.startsWith("${")) if (!PropertyCheck.isValidPropertyString(clusterName))
{ {
// No cluster name // No cluster name
return; return;