mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Merged V2.2 to HEAD
7307: Re-enabled ability to perform deployments against new model 7278: Added friendly server name property to model and refactored view deployment report dialog 7272: Patch for new deployment features git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@8245 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -843,27 +843,27 @@ public class AVMBrowseBean implements IContextListener
|
||||
// expression in a 'rendered' attribute, we therefore cache the result
|
||||
// on a per request basis
|
||||
|
||||
List<ChildAssociationRef> deployReportRefs = null;
|
||||
List<ChildAssociationRef> deployAttempts = null;
|
||||
|
||||
FacesContext context = FacesContext.getCurrentInstance();
|
||||
Map request = context.getExternalContext().getRequestMap();
|
||||
if (request.get(REQUEST_BEEN_DEPLOYED_KEY) == null)
|
||||
{
|
||||
// see if there are any deployment reports for the site
|
||||
// see if there are any deployment attempts for the site
|
||||
NodeRef webProjectRef = this.getWebsite().getNodeRef();
|
||||
deployReportRefs = this.nodeService.getChildAssocs(webProjectRef,
|
||||
WCMAppModel.ASSOC_DEPLOYMENTREPORT, RegexQNamePattern.MATCH_ALL);
|
||||
deployAttempts = this.nodeService.getChildAssocs(webProjectRef,
|
||||
WCMAppModel.ASSOC_DEPLOYMENTATTEMPT, RegexQNamePattern.MATCH_ALL);
|
||||
|
||||
// add a placeholder object in the request so we don't evaluate this again for this request
|
||||
request.put(REQUEST_BEEN_DEPLOYED_KEY, Boolean.TRUE);
|
||||
request.put(REQUEST_BEEN_DEPLOYED_RESULT, deployReportRefs);
|
||||
request.put(REQUEST_BEEN_DEPLOYED_RESULT, deployAttempts);
|
||||
}
|
||||
else
|
||||
{
|
||||
deployReportRefs = (List<ChildAssociationRef>)request.get(REQUEST_BEEN_DEPLOYED_RESULT);
|
||||
deployAttempts = (List<ChildAssociationRef>)request.get(REQUEST_BEEN_DEPLOYED_RESULT);
|
||||
}
|
||||
|
||||
return (deployReportRefs != null && deployReportRefs.size() > 0);
|
||||
return (deployAttempts != null && deployAttempts.size() > 0);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -289,58 +289,6 @@ public final class AVMUtil
|
||||
return (otherStore + ':' + AVMUtil.getStoreRelativePath(avmPath));
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the username to connect as on the remote machine being deployed to
|
||||
* <p>
|
||||
* This value is read from the <wcm> config section in
|
||||
* web-client-config-wcm.xml
|
||||
* </p>
|
||||
*
|
||||
* @return Username for remote machine
|
||||
*/
|
||||
public static String getRemoteDeploymentUsername()
|
||||
{
|
||||
String username = "admin";
|
||||
|
||||
ConfigElement deploymentConfig = getDeploymentConfig();
|
||||
if (deploymentConfig != null)
|
||||
{
|
||||
ConfigElement elem = deploymentConfig.getChild("remote-username");
|
||||
if (elem != null)
|
||||
{
|
||||
username = elem.getValue();
|
||||
}
|
||||
}
|
||||
|
||||
return username;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the password to use on the remote machine being deployed to
|
||||
* <p>
|
||||
* This value is read from the <wcm> config section in
|
||||
* web-client-config-wcm.xml
|
||||
* </p>
|
||||
*
|
||||
* @return Password for remote machine
|
||||
*/
|
||||
public static String getRemoteDeploymentPassword()
|
||||
{
|
||||
String password = "admin";
|
||||
|
||||
ConfigElement deploymentConfig = getDeploymentConfig();
|
||||
if (deploymentConfig != null)
|
||||
{
|
||||
ConfigElement elem = deploymentConfig.getChild("remote-password");
|
||||
if (elem != null)
|
||||
{
|
||||
password = elem.getValue();
|
||||
}
|
||||
}
|
||||
|
||||
return password;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the number of seconds between each call back to the server to
|
||||
* obtain the latest status of an in progress deployment.
|
||||
@@ -380,123 +328,6 @@ public final class AVMUtil
|
||||
return pollFreq;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the default RMI registry port to use when one is not supplied
|
||||
* for target Alfresco deployment servers.
|
||||
* <p>
|
||||
* This value is read from the <wcm> config section in
|
||||
* web-client-config-wcm.xml
|
||||
* </p>
|
||||
*
|
||||
* @return The remote RMI registry port to use for deployments.
|
||||
* The default is 50500.
|
||||
*/
|
||||
public static int getRemoteRMIRegistryPort()
|
||||
{
|
||||
int rmiPort = 50500;
|
||||
|
||||
ConfigElement deploymentConfig = getDeploymentConfig();
|
||||
if (deploymentConfig != null)
|
||||
{
|
||||
ConfigElement elem = deploymentConfig.getChild("remote-rmi-port");
|
||||
if (elem != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
int value = Integer.parseInt(elem.getValue());
|
||||
if (value > 0)
|
||||
{
|
||||
rmiPort = value;
|
||||
}
|
||||
}
|
||||
catch (NumberFormatException nfe)
|
||||
{
|
||||
// do nothing, just use the default
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return rmiPort;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the default RMI port to use when one is not supplied
|
||||
* for target deployment receivers.
|
||||
* <p>
|
||||
* This value is read from the <wcm> config section in
|
||||
* web-client-config-wcm.xml
|
||||
* </p>
|
||||
*
|
||||
* @return The deployment receiver RMI port to use for deployments.
|
||||
* The default is 44100.
|
||||
*/
|
||||
public static int getRemoteReceiverRMIPort()
|
||||
{
|
||||
int rmiPort = 44100;
|
||||
|
||||
ConfigElement deploymentConfig = getDeploymentConfig();
|
||||
if (deploymentConfig != null)
|
||||
{
|
||||
ConfigElement elem = deploymentConfig.getChild("receiver-rmi-port");
|
||||
if (elem != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
int value = Integer.parseInt(elem.getValue());
|
||||
if (value > 0)
|
||||
{
|
||||
rmiPort = value;
|
||||
}
|
||||
}
|
||||
catch (NumberFormatException nfe)
|
||||
{
|
||||
// do nothing, just use the default
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return rmiPort;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the delay (in seconds) to apply to the start of a deployment
|
||||
* operation (mainly for demo and testing purposes).
|
||||
* <p>
|
||||
* This value is read from the <wcm> config section in
|
||||
* web-client-config-wcm.xml
|
||||
* </p>
|
||||
*
|
||||
* @return The delay to use at the start of a deployment.
|
||||
* The default is 30.
|
||||
*/
|
||||
public static int getRemoteDeploymentDelay()
|
||||
{
|
||||
int delay = 30;
|
||||
|
||||
ConfigElement deploymentConfig = getDeploymentConfig();
|
||||
if (deploymentConfig != null)
|
||||
{
|
||||
ConfigElement elem = deploymentConfig.getChild("delay");
|
||||
if (elem != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
int value = Integer.parseInt(elem.getValue());
|
||||
if (value > 0)
|
||||
{
|
||||
delay = value;
|
||||
}
|
||||
}
|
||||
catch (NumberFormatException nfe)
|
||||
{
|
||||
// do nothing, just use the default
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return delay;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the number of seconds between each call back to the server to
|
||||
* obtain the latest status of a link validation check.
|
||||
@@ -978,6 +809,44 @@ public final class AVMUtil
|
||||
|
||||
return webProjectNode;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the NodeRef of the deploymentattempt node with the given id
|
||||
*
|
||||
* @param attemptId The deployattemptid of the node to be found
|
||||
* @return The NodeRef of the deploymentattempt node or null if not found
|
||||
*/
|
||||
public static NodeRef findDeploymentAttempt(String attemptId)
|
||||
{
|
||||
FacesContext fc = FacesContext.getCurrentInstance();
|
||||
SearchService searchService = Repository.getServiceRegistry(fc).getSearchService();
|
||||
|
||||
// construct the query
|
||||
String query = "@wca\\:deployattemptid:\"" + attemptId + "\"";
|
||||
|
||||
NodeRef attempt = null;
|
||||
ResultSet results = null;
|
||||
try
|
||||
{
|
||||
// execute the query
|
||||
results = searchService.query(Repository.getStoreRef(),
|
||||
SearchService.LANGUAGE_LUCENE, query);
|
||||
|
||||
if (results.length() == 1)
|
||||
{
|
||||
attempt = results.getNodeRef(0);
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (results != null)
|
||||
{
|
||||
results.close();
|
||||
}
|
||||
}
|
||||
|
||||
return attempt;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates all directories for a path if they do not already exist.
|
||||
|
@@ -25,7 +25,6 @@
|
||||
package org.alfresco.web.bean.wcm;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.text.MessageFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
@@ -85,7 +84,6 @@ import org.apache.commons.logging.LogFactory;
|
||||
*/
|
||||
public class CreateWebsiteWizard extends BaseWizardBean
|
||||
{
|
||||
private static final String MSG_DEPLOY_TO_HELP = "deploy_to_help";
|
||||
private static final String MSG_USERROLES = "create_website_summary_users";
|
||||
|
||||
private static final String COMPONENT_FORMLIST = "form-list";
|
||||
@@ -112,7 +110,6 @@ public class CreateWebsiteWizard extends BaseWizardBean
|
||||
protected String name;
|
||||
protected String description;
|
||||
protected String webapp = WEBAPP_DEFAULT;
|
||||
protected List<String> deployTo;
|
||||
protected String createFrom = null;
|
||||
protected String[] sourceWebProject = null;
|
||||
protected ExpiringValueCache<List<UIListItem>> webProjectsList;
|
||||
@@ -171,7 +168,6 @@ public class CreateWebsiteWizard extends BaseWizardBean
|
||||
this.dnsName = null;
|
||||
this.title = null;
|
||||
this.description = null;
|
||||
this.deployTo = null;
|
||||
this.isSource = false;
|
||||
clearFormsWorkflowsAndUsers();
|
||||
this.createFrom = CREATE_EMPTY;
|
||||
@@ -232,9 +228,6 @@ public class CreateWebsiteWizard extends BaseWizardBean
|
||||
String webapp = (this.webapp != null && this.webapp.length() != 0) ? this.webapp : WEBAPP_DEFAULT;
|
||||
this.nodeService.setProperty(nodeRef, WCMAppModel.PROP_DEFAULTWEBAPP, webapp);
|
||||
|
||||
// set the list of servers to deploy to
|
||||
this.nodeService.setProperty(nodeRef, WCMAppModel.PROP_DEPLOYTO, (Serializable)this.deployTo);
|
||||
|
||||
// call a delegate wizard bean to provide invite user functionality
|
||||
InviteWebsiteUsersWizard wiz = getInviteUsersWizard();
|
||||
wiz.reset();
|
||||
@@ -425,6 +418,7 @@ public class CreateWebsiteWizard extends BaseWizardBean
|
||||
* @param loadProperties Load the basic properties such as name, title, DNS.
|
||||
* @param loadUsers Load the user details.
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
protected void loadWebProjectModel(NodeRef nodeRef, boolean loadProperties, boolean loadUsers)
|
||||
{
|
||||
// simple properties are optionally loaded
|
||||
@@ -436,7 +430,6 @@ public class CreateWebsiteWizard extends BaseWizardBean
|
||||
this.description = (String)props.get(ContentModel.PROP_DESCRIPTION);
|
||||
this.dnsName = (String)props.get(WCMAppModel.PROP_AVMSTORE);
|
||||
this.webapp = (String)props.get(WCMAppModel.PROP_DEFAULTWEBAPP);
|
||||
this.deployTo = (List<String>)props.get(WCMAppModel.PROP_DEPLOYTO);
|
||||
Boolean isSource = (Boolean)props.get(WCMAppModel.PROP_ISSOURCE);
|
||||
if (isSource != null)
|
||||
{
|
||||
@@ -692,22 +685,6 @@ public class CreateWebsiteWizard extends BaseWizardBean
|
||||
this.webapp = webapp;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return The comma separated list of servers to deploy to
|
||||
*/
|
||||
public List<String> getDeployTo()
|
||||
{
|
||||
return this.deployTo;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param deployTo The comma separated list of servers to deploy to
|
||||
*/
|
||||
public void setDeployTo(List<String> deployTo)
|
||||
{
|
||||
this.deployTo = deployTo;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the create from selection value
|
||||
*/
|
||||
@@ -862,19 +839,6 @@ public class CreateWebsiteWizard extends BaseWizardBean
|
||||
{
|
||||
return this.showAllSourceProjects;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the deploy to help text that gets displayed if the user
|
||||
* clicks the Help icon
|
||||
*/
|
||||
public String getDeployToHelp()
|
||||
{
|
||||
String pattern = Application.getMessage(FacesContext.getCurrentInstance(),
|
||||
MSG_DEPLOY_TO_HELP);
|
||||
String defaultAlfPort = Integer.toString(AVMUtil.getRemoteRMIRegistryPort());
|
||||
String defaultReceiverPort = Integer.toString(AVMUtil.getRemoteReceiverRMIPort());
|
||||
return MessageFormat.format(pattern, new Object[] {defaultReceiverPort, defaultAlfPort});
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.alfresco.web.bean.wizard.BaseWizardBean#next()
|
||||
|
@@ -26,6 +26,7 @@ package org.alfresco.web.bean.wcm;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -35,11 +36,15 @@ import javax.faces.context.FacesContext;
|
||||
import org.alfresco.model.WCMAppModel;
|
||||
import org.alfresco.repo.avm.AVMNodeConverter;
|
||||
import org.alfresco.repo.avm.actions.AVMDeploySnapshotAction;
|
||||
import org.alfresco.repo.domain.PropertyValue;
|
||||
import org.alfresco.sandbox.SandboxConstants;
|
||||
import org.alfresco.service.cmr.action.Action;
|
||||
import org.alfresco.service.cmr.action.ActionService;
|
||||
import org.alfresco.service.cmr.repository.ChildAssociationRef;
|
||||
import org.alfresco.service.cmr.avm.AVMService;
|
||||
import org.alfresco.service.cmr.dictionary.DataTypeDefinition;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.alfresco.service.namespace.RegexQNamePattern;
|
||||
import org.alfresco.service.namespace.QName;
|
||||
import org.alfresco.util.GUID;
|
||||
import org.alfresco.web.bean.dialog.BaseDialogBean;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
@@ -53,10 +58,12 @@ public class DeploySnapshotDialog extends BaseDialogBean
|
||||
{
|
||||
protected int versionToDeploy;
|
||||
protected String[] deployTo;
|
||||
protected String stagingStore;
|
||||
protected NodeRef websiteRef;
|
||||
protected NodeRef webProjectRef;
|
||||
|
||||
protected AVMBrowseBean avmBrowseBean;
|
||||
protected AVMService avmService;
|
||||
protected ActionService actionService;
|
||||
|
||||
private static final Log logger = LogFactory.getLog(DeploySnapshotDialog.class);
|
||||
@@ -74,8 +81,9 @@ public class DeploySnapshotDialog extends BaseDialogBean
|
||||
this.versionToDeploy = Integer.parseInt(parameters.get("version"));
|
||||
this.avmBrowseBean.getDeploymentMonitorIds().clear();
|
||||
this.webProjectRef = this.avmBrowseBean.getWebsite().getNodeRef();
|
||||
String stagingStore = AVMUtil.buildSandboxRootPath(this.avmBrowseBean.getStagingStore());
|
||||
this.websiteRef = AVMNodeConverter.ToNodeRef(this.versionToDeploy, stagingStore);
|
||||
this.stagingStore = this.avmBrowseBean.getStagingStore();
|
||||
String storeRoot = AVMUtil.buildSandboxRootPath(this.stagingStore);
|
||||
this.websiteRef = AVMNodeConverter.ToNodeRef(this.versionToDeploy, storeRoot);
|
||||
|
||||
if (logger.isDebugEnabled())
|
||||
logger.debug("Initialising dialog to deploy version " + this.versionToDeploy +
|
||||
@@ -86,94 +94,82 @@ public class DeploySnapshotDialog extends BaseDialogBean
|
||||
@Override
|
||||
protected String finishImpl(FacesContext context, String outcome) throws Exception
|
||||
{
|
||||
// put all the selected servers to deploy to into a list
|
||||
List<String> selectedDeployTo = new ArrayList<String>();
|
||||
if (this.deployTo != null)
|
||||
{
|
||||
for (int x = 0; x < this.deployTo.length; x++)
|
||||
{
|
||||
selectedDeployTo.add(this.deployTo[x].trim());
|
||||
}
|
||||
}
|
||||
|
||||
if (logger.isDebugEnabled())
|
||||
logger.debug("Executing deployment of " + this.websiteRef.toString() +
|
||||
" to servers: " + selectedDeployTo);
|
||||
logger.debug("Requesting deployment of: " + this.websiteRef.toString());
|
||||
|
||||
if (selectedDeployTo.size() > 0)
|
||||
if (this.deployTo != null && this.deployTo.length > 0)
|
||||
{
|
||||
// TODO: move any existing deployment reports to a node representing the
|
||||
// snapshot, we can then keep a history of deployment attempts on a
|
||||
// per snapshot basis.
|
||||
|
||||
NodeRef webProjectRef = this.avmBrowseBean.getWebsite().getNodeRef();
|
||||
List<String> allDeployToServers = (List<String>)nodeService.getProperty(webProjectRef,
|
||||
WCMAppModel.PROP_DEPLOYTO);
|
||||
List<ChildAssociationRef> deployReportRefs = nodeService.getChildAssocs(
|
||||
webProjectRef, WCMAppModel.ASSOC_DEPLOYMENTREPORT, RegexQNamePattern.MATCH_ALL);
|
||||
for (ChildAssociationRef ref : deployReportRefs)
|
||||
{
|
||||
NodeRef report = ref.getChildRef();
|
||||
|
||||
String server = (String)this.nodeService.getProperty(report, WCMAppModel.PROP_DEPLOYSERVER);
|
||||
|
||||
int version = -1;
|
||||
Serializable snapshotObj = nodeService.getProperty(report, WCMAppModel.PROP_DEPLOYVERSION);
|
||||
if (snapshotObj != null && snapshotObj instanceof Integer)
|
||||
{
|
||||
version = (Integer)snapshotObj;
|
||||
}
|
||||
|
||||
if ((version == this.versionToDeploy && selectedDeployTo.contains(server)) ||
|
||||
(version != this.versionToDeploy) || (allDeployToServers.contains(server) == false))
|
||||
{
|
||||
// cascade delete will take care of child-child relationships
|
||||
this.nodeService.removeChild(webProjectRef, report);
|
||||
|
||||
if (logger.isDebugEnabled())
|
||||
logger.debug("Removed exisiting deployment report for server: " + server);
|
||||
}
|
||||
}
|
||||
List<String> selectedDeployToNames = new ArrayList<String>();
|
||||
|
||||
// update the selecteddeployto property with list of servers selected
|
||||
this.nodeService.setProperty(webProjectRef, WCMAppModel.PROP_SELECTEDDEPLOYTO,
|
||||
(Serializable)selectedDeployTo);
|
||||
// update the selecteddeployversion property with the selected snapshot version
|
||||
this.nodeService.setProperty(webProjectRef, WCMAppModel.PROP_SELECTEDDEPLOYVERSION,
|
||||
this.versionToDeploy);
|
||||
// create a deploymentattempt node to represent this deployment
|
||||
String attemptId = GUID.generate();
|
||||
Map<QName, Serializable> props = new HashMap<QName, Serializable>(8, 1.0f);
|
||||
props.put(WCMAppModel.PROP_DEPLOYATTEMPTID, attemptId);
|
||||
props.put(WCMAppModel.PROP_DEPLOYATTEMPTTYPE, WCMAppModel.CONSTRAINT_LIVESERVER);
|
||||
props.put(WCMAppModel.PROP_DEPLOYATTEMPTSTORE, this.stagingStore);
|
||||
props.put(WCMAppModel.PROP_DEPLOYATTEMPTVERSION, this.versionToDeploy);
|
||||
props.put(WCMAppModel.PROP_DEPLOYATTEMPTTIME, new Date());
|
||||
NodeRef attempt = this.nodeService.createNode(webProjectRef,
|
||||
WCMAppModel.ASSOC_DEPLOYMENTATTEMPT, WCMAppModel.ASSOC_DEPLOYMENTATTEMPT,
|
||||
WCMAppModel.TYPE_DEPLOYMENTATTEMPT, props).getChildRef();
|
||||
|
||||
// execute a deploy action for each of the selected remote servers asynchronously
|
||||
for (String targetServer : selectedDeployTo)
|
||||
for (String targetServer : this.deployTo)
|
||||
{
|
||||
if (targetServer.length() > 0)
|
||||
{
|
||||
// create a deployment monitor object, store in the session,
|
||||
// add to avm browse bean and pass to action
|
||||
DeploymentMonitor monitor = new DeploymentMonitor(
|
||||
this.websiteRef, targetServer, versionToDeploy);
|
||||
context.getExternalContext().getSessionMap().put(monitor.getId(), monitor);
|
||||
this.avmBrowseBean.getDeploymentMonitorIds().add(monitor.getId());
|
||||
|
||||
// create the action
|
||||
Map<String, Serializable> args = new HashMap<String, Serializable>(1, 1.0f);
|
||||
args.put(AVMDeploySnapshotAction.PARAM_WEBSITE, webProjectRef);
|
||||
args.put(AVMDeploySnapshotAction.PARAM_TARGET_SERVER, targetServer);
|
||||
args.put(AVMDeploySnapshotAction.PARAM_DEFAULT_RMI_PORT,
|
||||
AVMUtil.getRemoteRMIRegistryPort());
|
||||
args.put(AVMDeploySnapshotAction.PARAM_DEFAULT_RECEIVER_RMI_PORT,
|
||||
AVMUtil.getRemoteReceiverRMIPort());
|
||||
args.put(AVMDeploySnapshotAction.PARAM_REMOTE_USERNAME,
|
||||
AVMUtil.getRemoteDeploymentUsername());
|
||||
args.put(AVMDeploySnapshotAction.PARAM_REMOTE_PASSWORD,
|
||||
AVMUtil.getRemoteDeploymentPassword());
|
||||
args.put(AVMDeploySnapshotAction.PARAM_CALLBACK, monitor);
|
||||
args.put(AVMDeploySnapshotAction.PARAM_DELAY,
|
||||
AVMUtil.getRemoteDeploymentDelay());
|
||||
Action action = this.actionService.createAction(AVMDeploySnapshotAction.NAME, args);
|
||||
this.actionService.executeAction(action, this.websiteRef, false, true);
|
||||
NodeRef serverRef = new NodeRef(targetServer);
|
||||
if (nodeService.exists(serverRef))
|
||||
{
|
||||
// get all properties of the target server
|
||||
Map<QName, Serializable> serverProps = nodeService.getProperties(serverRef);
|
||||
|
||||
String serverUri = AVMDeploySnapshotAction.calculateServerUri(serverProps);
|
||||
String serverName = (String)serverProps.get(WCMAppModel.PROP_DEPLOYSERVERNAME);
|
||||
if (serverName == null || serverName.length() == 0)
|
||||
{
|
||||
serverName = serverUri;
|
||||
}
|
||||
|
||||
if (logger.isDebugEnabled())
|
||||
logger.debug("Issuing deployment request for: " + serverName);
|
||||
|
||||
// remember the servers deployed to
|
||||
selectedDeployToNames.add(serverName);
|
||||
|
||||
// create a deployment monitor object, store in the session,
|
||||
// add to avm browse bean and pass to action
|
||||
DeploymentMonitor monitor = new DeploymentMonitor(
|
||||
this.websiteRef, serverRef, versionToDeploy, serverName, attemptId);
|
||||
context.getExternalContext().getSessionMap().put(monitor.getId(), monitor);
|
||||
this.avmBrowseBean.getDeploymentMonitorIds().add(monitor.getId());
|
||||
|
||||
// create and execute the action asynchronously
|
||||
Map<String, Serializable> args = new HashMap<String, Serializable>(1, 1.0f);
|
||||
args.put(AVMDeploySnapshotAction.PARAM_WEBSITE, webProjectRef);
|
||||
args.put(AVMDeploySnapshotAction.PARAM_SERVER, serverRef);
|
||||
args.put(AVMDeploySnapshotAction.PARAM_ATTEMPT, attempt);
|
||||
args.put(AVMDeploySnapshotAction.PARAM_CALLBACK, monitor);
|
||||
Action action = this.actionService.createAction(AVMDeploySnapshotAction.NAME, args);
|
||||
this.actionService.executeAction(action, this.websiteRef, false, true);
|
||||
}
|
||||
else if (logger.isWarnEnabled())
|
||||
{
|
||||
logger.warn("target server '" + targetServer + "' was ignored as it no longer exists!");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// now we know the list of selected servers set the property on the attempt node
|
||||
this.nodeService.setProperty(attempt, WCMAppModel.PROP_DEPLOYATTEMPTSERVERS,
|
||||
(Serializable)selectedDeployToNames);
|
||||
|
||||
// set the deploymentattempid property on the store this deployment was for
|
||||
this.avmService.deleteStoreProperty(this.stagingStore, SandboxConstants.PROP_LAST_DEPLOYMENT_ID);
|
||||
this.avmService.setStoreProperty(this.stagingStore, SandboxConstants.PROP_LAST_DEPLOYMENT_ID,
|
||||
new PropertyValue(DataTypeDefinition.TEXT, attemptId));
|
||||
|
||||
// close this dialog and immediately open the monitorDeployment dialog
|
||||
return "dialog:monitorDeployment";
|
||||
}
|
||||
@@ -199,13 +195,21 @@ public class DeploySnapshotDialog extends BaseDialogBean
|
||||
// Bean getters and setters
|
||||
|
||||
/**
|
||||
* @param avmBrowseBean The AVM BrowseBean to set
|
||||
* @param avmBrowseBean The AVM BrowseBean to set
|
||||
*/
|
||||
public void setAvmBrowseBean(AVMBrowseBean avmBrowseBean)
|
||||
{
|
||||
this.avmBrowseBean = avmBrowseBean;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param avmService The AVMService to set.
|
||||
*/
|
||||
public void setAvmService(AVMService avmService)
|
||||
{
|
||||
this.avmService = avmService;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param actionService The actionService to set.
|
||||
*/
|
||||
|
@@ -46,7 +46,9 @@ public class DeploymentMonitor implements DeploymentCallback, Serializable
|
||||
{
|
||||
private String id;
|
||||
private NodeRef website;
|
||||
private String targetServer;
|
||||
private NodeRef targetServer;
|
||||
private String targetServerName;
|
||||
private String deployAttemptId;
|
||||
private int snapshotVersion;
|
||||
private boolean started = false;
|
||||
private boolean finished = false;
|
||||
@@ -58,12 +60,15 @@ public class DeploymentMonitor implements DeploymentCallback, Serializable
|
||||
/**
|
||||
* Default constructor
|
||||
*/
|
||||
public DeploymentMonitor(NodeRef website, String targetServer, int snapshotVersion)
|
||||
public DeploymentMonitor(NodeRef website, NodeRef server, int snapshotVersion,
|
||||
String serverName, String deployAttemptId)
|
||||
{
|
||||
this.id = ID_PREFIX + Long.toString(System.currentTimeMillis()) + this.hashCode();
|
||||
this.website = website;
|
||||
this.targetServer = targetServer;
|
||||
this.targetServer = server;
|
||||
this.snapshotVersion = snapshotVersion;
|
||||
this.targetServerName = serverName;
|
||||
this.deployAttemptId = deployAttemptId;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------
|
||||
@@ -86,7 +91,7 @@ public class DeploymentMonitor implements DeploymentCallback, Serializable
|
||||
}
|
||||
|
||||
if (logger.isDebugEnabled())
|
||||
logger.debug(this.targetServer + ": " + event.getType() +
|
||||
logger.debug(this.targetServerName + ": " + event.getType() +
|
||||
" " + event.getDestination());
|
||||
}
|
||||
|
||||
@@ -98,7 +103,7 @@ public class DeploymentMonitor implements DeploymentCallback, Serializable
|
||||
public void errorOccurred(Throwable err)
|
||||
{
|
||||
if (logger.isDebugEnabled())
|
||||
logger.debug(this.targetServer + ": ERROR: " + err.getMessage());
|
||||
logger.debug(this.targetServerName + ": ERROR: " + err.getMessage());
|
||||
|
||||
this.successful = false;
|
||||
this.finished = true;
|
||||
@@ -111,7 +116,9 @@ public class DeploymentMonitor implements DeploymentCallback, Serializable
|
||||
buffer.append(" (id=").append(this.id);
|
||||
buffer.append(" website=").append(this.website);
|
||||
buffer.append(" targetServer=").append(this.targetServer);
|
||||
buffer.append(" targetServerName=").append(this.targetServerName);
|
||||
buffer.append(" snapshotVersion=").append(this.snapshotVersion);
|
||||
buffer.append(" deployAttemptId=").append(this.deployAttemptId);
|
||||
buffer.append(" started=").append(this.started);
|
||||
buffer.append(" finished=").append(this.finished);
|
||||
buffer.append(" successful=").append(this.successful).append(")");
|
||||
@@ -123,7 +130,11 @@ public class DeploymentMonitor implements DeploymentCallback, Serializable
|
||||
StringBuilder buffer = new StringBuilder("<target-server id=\"");
|
||||
buffer.append(this.getId());
|
||||
buffer.append("\" name=\"");
|
||||
buffer.append(this.targetServerName);
|
||||
buffer.append("\" server=\"");
|
||||
buffer.append(this.targetServer);
|
||||
buffer.append("\" attempt=\"");
|
||||
buffer.append(this.deployAttemptId);
|
||||
buffer.append("\" finished=\"");
|
||||
buffer.append(this.finished);
|
||||
buffer.append("\"");
|
||||
@@ -159,10 +170,18 @@ public class DeploymentMonitor implements DeploymentCallback, Serializable
|
||||
/**
|
||||
* @return The target server for this deployment
|
||||
*/
|
||||
public String getTargetServer()
|
||||
public NodeRef getTargetServer()
|
||||
{
|
||||
return this.targetServer;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return The target server display name for this deployment
|
||||
*/
|
||||
public String getTargetServerName()
|
||||
{
|
||||
return this.targetServerName;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return The snapshot version being deployed
|
||||
@@ -171,6 +190,14 @@ public class DeploymentMonitor implements DeploymentCallback, Serializable
|
||||
{
|
||||
return this.snapshotVersion;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return The deploy attempt id for this deployment
|
||||
*/
|
||||
public String getDeployAttemptId()
|
||||
{
|
||||
return this.deployAttemptId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return true if the deployment has started
|
||||
|
@@ -24,7 +24,6 @@
|
||||
*/
|
||||
package org.alfresco.web.bean.wcm;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@@ -85,7 +84,6 @@ public class EditWebsiteWizard extends CreateWebsiteWizard
|
||||
this.nodeService.setProperty(nodeRef, ContentModel.PROP_NAME, this.name);
|
||||
this.nodeService.setProperty(nodeRef, ContentModel.PROP_TITLE, this.title);
|
||||
this.nodeService.setProperty(nodeRef, ContentModel.PROP_DESCRIPTION, this.description);
|
||||
this.nodeService.setProperty(nodeRef, WCMAppModel.PROP_DEPLOYTO, (Serializable)this.deployTo);
|
||||
this.nodeService.setProperty(nodeRef, WCMAppModel.PROP_ISSOURCE, this.isSource);
|
||||
|
||||
// clear the existing settings for forms, template and workflows - then the existing methods
|
||||
|
Reference in New Issue
Block a user