. Website virtualisation server URL and Port are no longer managed by the web-client-config.xml - instead the values are retrieved dynamically from the VirtServerRegistryMBean.

- Fall back values are used if no virtualisation server is running (with a warning output to the log)
 - Values are retrieved and cached for 10 seconds - so if the virtualisation server is started after the main Alfresco server then it will take up to 10 seconds for those values to be updated
. Adding missing NameMatcher impl to compare() call in AVMBrowseBean

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@4602 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Kevin Roast
2006-12-14 11:19:34 +00:00
parent 844eb9f668
commit 2ebb1a5e08
6 changed files with 72 additions and 72 deletions

View File

@@ -16,8 +16,15 @@
*/
package org.alfresco.web.config;
import javax.faces.context.FacesContext;
import org.alfresco.config.ConfigElement;
import org.alfresco.config.element.ConfigElementAdapter;
import org.alfresco.mbeans.VirtServerRegistry;
import org.alfresco.repo.cache.ExpiringValueCache;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.web.jsf.FacesContextUtils;
/**
* Custom config element that represents config values for the client
@@ -26,9 +33,16 @@ import org.alfresco.config.element.ConfigElementAdapter;
*/
public class ClientConfigElement extends ConfigElementAdapter
{
private static Log logger = LogFactory.getLog(ClientConfigElement.class);
public static final String CONFIG_ELEMENT_ID = "client";
private String fromEmailAddress = "alfresco@alfresco.org";
private static final String BEAN_VIRT_SERVER_REGISTRY = "VirtServerRegistry";
private static final String DEFAULT_VSERVER_IP = "avm.127-0-0-1.ip.alfrescodemo.net";
private static final int DEFAULT_VSERVER_PORT = 8180;
private static final String DEFAULT_FROM_ADDRESS = "alfresco@alfresco.org";
private String fromEmailAddress = DEFAULT_FROM_ADDRESS;
private String errorPage = null;
private String loginPage = null;
private int recentSpacesItems = 6;
@@ -42,8 +56,8 @@ public class ClientConfigElement extends ConfigElementAdapter
private String homeSpacePermission = null;
private boolean ajaxEnabled = false;
private String initialLocation = "myalfresco";
private String wcmDomain = null;
private String wcmPort = null;
private ExpiringValueCache<String> wcmDomain = new ExpiringValueCache(1000*10L);
private ExpiringValueCache<String> wcmPort = new ExpiringValueCache(1000*10L);
/**
* Default Constructor
@@ -165,24 +179,6 @@ public class ClientConfigElement extends ConfigElementAdapter
combinedElement.setInitialLocation(newElement.getInitialLocation());
}
if (newElement.getWCMDomain() == null)
{
combinedElement.setWCMDomain(this.wcmDomain);
}
else
{
combinedElement.setWCMDomain(newElement.wcmDomain);
}
if (newElement.getWCMPort() == null)
{
combinedElement.setWCMPort(this.wcmPort);
}
else
{
combinedElement.setWCMPort(newElement.wcmPort);
}
return combinedElement;
}
@@ -426,34 +422,44 @@ public class ClientConfigElement extends ConfigElementAdapter
}
/**
* @return Returns the WCM Domain.
* @return Returns the WCM Domain obtained from the Virtualisation Server registry.
*/
public String getWCMDomain()
{
return this.wcmDomain;
String value = this.wcmDomain.get();
if (value == null)
{
VirtServerRegistry vServerRegistry = (VirtServerRegistry)FacesContextUtils.getRequiredWebApplicationContext(
FacesContext.getCurrentInstance()).getBean(BEAN_VIRT_SERVER_REGISTRY);
value = vServerRegistry.getVirtServerFQDN();
if (value == null)
{
value = DEFAULT_VSERVER_IP;
logger.warn("Virtualisation Server not started - reverting to default IP: " + value);
}
this.wcmDomain.put(value);
}
return value;
}
/**
* @param wcmDomain The WCM Domain to set.
*/
/*package*/ void setWCMDomain(String wcmDomain)
{
this.wcmDomain = wcmDomain;
}
/**
* @return Returns the WCM Port.
* @return Returns the WCM Port obtained from the Virtualisation Server registry.
*/
public String getWCMPort()
{
return this.wcmPort;
}
/**
* @param wcmPort The WCM Port to set.
*/
/*package*/ void setWCMPort(String wcmPort)
{
this.wcmPort = wcmPort;
String value = this.wcmPort.get();
if (value == null)
{
VirtServerRegistry vServerRegistry = (VirtServerRegistry)FacesContextUtils.getRequiredWebApplicationContext(
FacesContext.getCurrentInstance()).getBean(BEAN_VIRT_SERVER_REGISTRY);
Integer iValue = vServerRegistry.getVirtServerHttpPort();
if (iValue == null)
{
iValue = DEFAULT_VSERVER_PORT;
logger.warn("Virtualisation Server not started - reverting to default port: " + value);
}
this.wcmPort.put(iValue.toString());
}
return value;
}
}