. 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

@@ -69,10 +69,6 @@
<!-- the from address to use when sending emails from the client -->
<from-email-address>alfresco@alfresco.org</from-email-address>
<!-- WCM domain and port for virtualisation server -->
<wcm-domain>127-0-0-1.ip.alfrescodemo.net</wcm-domain>
<wcm-port>8180</wcm-port>
</client>
</config>

View File

@@ -52,6 +52,7 @@ import org.alfresco.service.cmr.workflow.WorkflowService;
import org.alfresco.service.namespace.NamespaceService;
import org.alfresco.service.namespace.QName;
import org.alfresco.service.namespace.RegexQNamePattern;
import org.alfresco.util.NameMatcher;
import org.alfresco.util.Pair;
import org.alfresco.web.app.Application;
import org.alfresco.web.app.context.IContextListener;
@@ -141,9 +142,6 @@ public class AVMBrowseBean implements IContextListener
/** Current AVM Node action context */
private AVMNode avmNode = null;
private String wcmDomain;
private String wcmPort;
/** breadcrumb location */
private List<IBreadcrumbHandler> location = null;
@@ -177,6 +175,9 @@ public class AVMBrowseBean implements IContextListener
/** Action service bean reference */
protected ActionService actionService;
/** Global exclude name matcher */
protected NameMatcher nameMatcher;
/**
* Default Constructor
@@ -184,10 +185,6 @@ public class AVMBrowseBean implements IContextListener
public AVMBrowseBean()
{
UIContextService.getInstance(FacesContext.getCurrentInstance()).registerBean(this);
ClientConfigElement config = Application.getClientConfig(FacesContext.getCurrentInstance());
this.wcmDomain = config.getWCMDomain();
this.wcmPort = config.getWCMPort();
}
@@ -287,6 +284,14 @@ public class AVMBrowseBean implements IContextListener
this.actionService = actionService;
}
/**
* @param nameMatcher The nameMatcher to set.
*/
public void setNameMatcher(NameMatcher nameMatcher)
{
this.nameMatcher = nameMatcher;
}
/**
* Summary text for the staging store:
* Created On: xx/yy/zz
@@ -691,6 +696,9 @@ public class AVMBrowseBean implements IContextListener
Map<String, AVMNodeDescriptor> nodes = this.avmService.getDirectoryListing(-1, getCurrentPath());
this.files = new ArrayList<Map>(nodes.size());
this.folders = new ArrayList<Map>(nodes.size());
ClientConfigElement config = Application.getClientConfig(context);
String wcmDomain = config.getWCMDomain();
String wcmPort = config.getWCMPort();
for (String name : nodes.keySet())
{
AVMNodeDescriptor avmRef = nodes.get(name);
@@ -715,7 +723,7 @@ public class AVMBrowseBean implements IContextListener
// common properties
String assetPath = path.substring(rootPathIndex);
String previewUrl = AVMConstants.buildAVMAssetUrl(assetPath, this.wcmDomain, this.wcmPort, dns);
String previewUrl = AVMConstants.buildAVMAssetUrl(assetPath, wcmDomain, wcmPort, dns);
node.getProperties().put("previewUrl", previewUrl);
}
@@ -939,8 +947,8 @@ public class AVMBrowseBean implements IContextListener
tx.begin();
// calcluate the list of differences between the user store and the staging area
// TODO Need to pass the global exclude NameMatcher to the compare call.
List<AVMDifference> diffs = this.avmSyncService.compare(-1, store + ":/", -1, getStagingStore() + ":/", null);
List<AVMDifference> diffs = this.avmSyncService.compare(
-1, store + ":/", -1, getStagingStore() + ":/", this.nameMatcher);
List<Pair<Integer, String>> versionPaths = new ArrayList<Pair<Integer, String>>();
for (AVMDifference diff : diffs)
{

View File

@@ -284,8 +284,8 @@ public final class AVMConstants
public final static String SPACE_ICON_WEBSITE = "space-icon-website";
// URLs for preview of sandboxes and assets
private final static String PREVIEW_SANDBOX_URL = "http://www-{0}.avm.{1}:{2}";
private final static String PREVIEW_ASSET_URL = "http://www-{0}.avm.{1}:{2}{3}";
private final static String PREVIEW_SANDBOX_URL = "http://www-{0}.{1}:{2}";
private final static String PREVIEW_ASSET_URL = "http://www-{0}.{1}:{2}{3}";
// patter for absolute AVM Path
private final static Pattern absoluteAVMPath = Pattern.compile(

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;
}
/**
* @param wcmDomain The WCM Domain to set.
*/
/*package*/ void setWCMDomain(String wcmDomain)
String value = this.wcmDomain.get();
if (value == null)
{
this.wcmDomain = wcmDomain;
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;
}
/**
* @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)
String value = this.wcmPort.get();
if (value == null)
{
this.wcmPort = wcmPort;
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;
}
}

View File

@@ -42,8 +42,6 @@ public class ClientElementReader implements ConfigElementReader
public static final String ELEMENT_SHELFVISIBLE = "shelf-visible";
public static final String ELEMENT_AJAX_ENABLED = "ajax-enabled";
public static final String ELEMENT_INITIALLOCATION = "initial-location";
public static final String ELEMENT_WCM_DOMAIN = "wcm-domain";
public static final String ELEMENT_WCM_PORT = "wcm-port";
/**
* @see org.alfresco.config.xml.elementreader.ConfigElementReader#parse(org.dom4j.Element)
@@ -163,18 +161,6 @@ public class ClientElementReader implements ConfigElementReader
{
configElement.setInitialLocation(initialLocation.getTextTrim());
}
// get the WCM domain and port
Element wcmDomain = element.element(ELEMENT_WCM_DOMAIN);
if (wcmDomain != null)
{
configElement.setWCMDomain(wcmDomain.getTextTrim());
}
Element wcmPort = element.element(ELEMENT_WCM_PORT);
if (wcmPort != null)
{
configElement.setWCMPort(wcmPort.getTextTrim());
}
}
return configElement;

View File

@@ -2317,6 +2317,10 @@
<property-name>workflowService</property-name>
<value>#{WorkflowService}</value>
</managed-property>
<managed-property>
<property-name>nameMatcher</property-name>
<value>#{globalPathExcluder}</value>
</managed-property>
</managed-bean>
<managed-bean>