. Fix to a couple of issues with virtualisation server URL and Port retrieval

. Fix to issue with current sandbox context AVMBrowseBean (when editing non-form content directly from modified files list)

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@4605 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Kevin Roast
2006-12-14 13:34:35 +00:00
parent fae996c4b7
commit e8faec44c8
4 changed files with 71 additions and 33 deletions

View File

@@ -79,7 +79,7 @@
</permissions>
<label-id>submit</label-id>
<image>/images/icons/submit.gif</image>
<action-listener>#{AVMBrowseBean.setupSubmitNodeAction}</action-listener>
<action-listener>#{AVMBrowseBean.setupContentAction}</action-listener>
<action>dialog:submitSandboxItems</action>
<params>
<param name="id">#{actionContext.path}</param>

View File

@@ -405,7 +405,7 @@ public class AVMBrowseBean implements IContextListener
}
/**
* @return Returns the sandbox.
* @return Returns the current sandbox context.
*/
public String getSandbox()
{
@@ -421,7 +421,7 @@ public class AVMBrowseBean implements IContextListener
}
/**
* @return Returns the username.
* @return Returns the current username context.
*/
public String getUsername()
{
@@ -792,7 +792,7 @@ public class AVMBrowseBean implements IContextListener
String store = params.get("store");
String username = params.get("username");
setupSandboxActionImpl(store, username);
setupSandboxActionImpl(store, username, true);
}
/**
@@ -800,8 +800,9 @@ public class AVMBrowseBean implements IContextListener
*
* @param store The store name for the action
* @param username The authority pertinent to the action (null for staging store actions)
* @param reset True to reset the current path and AVM action node context
*/
private void setupSandboxActionImpl(String store, String username)
private void setupSandboxActionImpl(String store, String username, boolean reset)
{
// can be null if it's the staging store - i.e. not a user specific store
setUsername(username);
@@ -818,15 +819,16 @@ public class AVMBrowseBean implements IContextListener
(String)getWebsite().getProperties().get(WCMAppModel.PROP_AVMSTORE)));
}
this.sandboxTitle = null;
// update UI state ready for return to the previous screen
if (reset == true)
{
this.sandboxTitle = null;
this.location = null;
setCurrentPath(null);
setAvmActionNode(null);
this.submitAll = false;
}
}
/**
* Action event called by all actions that need to setup a Content node context on the
@@ -849,6 +851,14 @@ public class AVMBrowseBean implements IContextListener
{
if (logger.isDebugEnabled())
logger.debug("Setup content action for path: " + path);
// calculate username and store name from specified path
String[] parts = path.split("[-:]");
String storename = parts[0];
String username = parts[1];
setupSandboxActionImpl(AVMConstants.buildAVMUserMainStoreName(storename, username), username, false);
// setup the action node
AVMNodeDescriptor node = avmService.lookup(-1, path, true);
setAVMActionNodeDescriptor(node);
}
@@ -864,20 +874,6 @@ public class AVMBrowseBean implements IContextListener
}
}
/**
* Submit a node from a user sandbox into the staging area sandbox via worklfow
*/
public void setupSubmitNodeAction(ActionEvent event)
{
// extract store and username from the path to this node
String path = getPathFromEventArgs(event);
String[] parts = path.split("[-:]");
String storename = parts[0];
String username = parts[1];
setupSandboxActionImpl(AVMConstants.buildAVMUserMainStoreName(storename, username), username);
setupContentAction(path, true);
}
/**
* Submit all nodes from user sandbox into the staging area sandbox via workflow
*/

View File

@@ -23,6 +23,7 @@ import java.util.regex.Pattern;
import javax.faces.context.FacesContext;
import org.alfresco.mbeans.VirtServerRegistry;
import org.alfresco.repo.domain.PropertyValue;
import org.alfresco.service.cmr.avm.AVMService;
import org.alfresco.service.namespace.QName;
@@ -30,6 +31,7 @@ import org.alfresco.util.ParameterCheck;
import org.alfresco.web.app.Application;
import org.alfresco.web.bean.repository.Repository;
import org.alfresco.web.config.ClientConfigElement;
import org.springframework.web.jsf.FacesContextUtils;
/**
* @author Kevin Roast
@@ -260,6 +262,33 @@ public final class AVMConstants
return m.matches() && m.group(1).length() != 0 ? m.group(1) : "/";
}
/**
* @param path Path to match against
*
* @return true if the path should require a virtualisation server reload, false otherwise
*/
public static boolean requiresServerReload(String path)
{
if (path == null || path.length() == 0)
{
throw new IllegalArgumentException("Path value is mandatory.");
}
return webinfPathPattern.matcher(path).matches();
}
public static void reloadServerOnPath(String path, boolean force)
{
if (force || requiresServerReload(path))
{
VirtServerRegistry vServerRegistry = (VirtServerRegistry)FacesContextUtils.getRequiredWebApplicationContext(
FacesContext.getCurrentInstance()).getBean(BEAN_VIRT_SERVER_REGISTRY);
int webappindex = path.indexOf('/', path.indexOf(DIR_WEBAPPS) + DIR_WEBAPPS.length() + 1);
vServerRegistry.webappUpdated(-1, path.substring(0, webappindex));
}
}
// names of the stores representing the layers for an AVM website
public final static String STORE_STAGING = "-staging";
public final static String STORE_MAIN = "-main";
@@ -283,14 +312,26 @@ public final class AVMConstants
public final static String PROP_SANDBOX_STORE_PREFIX = ".sandbox.store.";
public final static String SPACE_ICON_WEBSITE = "space-icon-website";
// virtualisation server MBean registry
private static final String BEAN_VIRT_SERVER_REGISTRY = "VirtServerRegistry";
// URLs for preview of sandboxes and assets
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
// pattern for absolute AVM Path
private final static Pattern absoluteAVMPath = Pattern.compile(
"([^:]+:/" + AVMConstants.DIR_APPBASE + "/[^/]+/[^/]+).*");
private final static Pattern webappRelativePath = Pattern.compile(
"[^:]+:/" + AVMConstants.DIR_APPBASE +
"/" + AVMConstants.DIR_WEBAPPS + "/[^/]+(.*)");
// patterns for WEB-INF files that require virtualisation server reload
private final static Pattern webinfPathPattern = Pattern.compile(
".*:/" + AVMConstants.DIR_APPBASE + "/" + AVMConstants.DIR_WEBAPPS + "/.*/WEB-INF/(classes/.*)|(lib/.*)|(web.xml)",
Pattern.CASE_INSENSITIVE);
//private final static Pattern webinfLibPattern = Pattern.compile(
// ".*:/" + AVMConstants.DIR_APPBASE + "/" + AVMConstants.DIR_WEBAPPS + "/.*/WEB-INF/lib/.*");
//private final static Pattern webinfWebXmlPattern = Pattern.compile(
// ".*:/" + AVMConstants.DIR_APPBASE + "/" + AVMConstants.DIR_WEBAPPS + "/.*/WEB-INF/web.xml");
}

View File

@@ -456,9 +456,10 @@ public class ClientConfigElement extends ConfigElementAdapter
if (iValue == null)
{
iValue = DEFAULT_VSERVER_PORT;
logger.warn("Virtualisation Server not started - reverting to default port: " + value);
logger.warn("Virtualisation Server not started - reverting to default port: " + iValue);
}
this.wcmPort.put(iValue.toString());
value = iValue.toString();
this.wcmPort.put(value);
}
return value;
}