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:
@@ -1213,7 +1213,6 @@ deploy_status_failed=FAILED
|
||||
deploy_status_partial=PARTIAL FAILURE
|
||||
reason=Reason
|
||||
snapshot=Snapshot
|
||||
deploy_to_help=A comma separated list of servers to deploy the website to. Each entry either represents the location of a Deployment Receiver or an Alfresco Repository.<br><br>A file server entry must be prefixed with '\\\\'. Each server can be represented by a host name or an IP address and may also contain an RMI port number. If an RMI port number is not specified for a Deployment Receiver the default of {0} will be used. If an RMI port number is not specified for an Alfresco Repository the default of {1} will be used.<br><br>Example: \\\\liveserver1, \\\\liveserver2:44200, liverserver3, liverserver4:50900
|
||||
content_launch=Content Launch
|
||||
launch_date=Launch Date
|
||||
expiration_date_header=Content Expiration
|
||||
|
@@ -276,6 +276,7 @@
|
||||
|
||||
<dialog name="viewDeploymentReport" page="/jsp/wcm/deployment-report.jsp"
|
||||
managed-bean="ViewDeploymentReportDialog"
|
||||
title-id="deployment_report_title"
|
||||
icon="/images/icons/deployment_report_large.gif"
|
||||
description-id="deployment_report_desc" show-ok-button="false" />
|
||||
|
||||
|
@@ -637,7 +637,6 @@
|
||||
<property-sheet>
|
||||
<show-property name="wca:avmstore" read-only="true" />
|
||||
<show-property name="wca:defaultwebapp" read-only="true" />
|
||||
<show-property name="wca:deployto" converter="org.alfresco.faces.MultiValueConverter" read-only="true" />
|
||||
<show-property name="app:icon" show-in-view-mode="false" show-in-edit-mode="false" />
|
||||
</property-sheet>
|
||||
</config>
|
||||
|
@@ -17,20 +17,9 @@
|
||||
<browse-page-size>25</browse-page-size>
|
||||
</views>
|
||||
|
||||
<!-- default values for website deployment -->
|
||||
<deployment>
|
||||
<!-- username to login as on the remote machine -->
|
||||
<remote-username>admin</remote-username>
|
||||
<!-- password to use on remote machine -->
|
||||
<remote-password>admin</remote-password>
|
||||
<!-- default RMI port to connect to Alfresco server on remote machine -->
|
||||
<remote-rmi-port>50500</remote-rmi-port>
|
||||
<!-- default RMI port to connect to Deployment Receiver on remote machine -->
|
||||
<receiver-rmi-port>44100</receiver-rmi-port>
|
||||
<!-- frequency (in seconds) of polling checks to get latest status of a deployment -->
|
||||
<progress-polling-frequency>2</progress-polling-frequency>
|
||||
<!-- the delay (in seconds) to apply to a deployment (for testing and demo purposes) -->
|
||||
<delay>30</delay>
|
||||
</deployment>
|
||||
|
||||
<links-management>
|
||||
|
@@ -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.
|
||||
@@ -979,6 +810,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
|
||||
*/
|
||||
@@ -863,19 +840,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,93 +94,81 @@ 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();
|
||||
List<String> selectedDeployToNames = new ArrayList<String>();
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
// 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)
|
||||
{
|
||||
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, targetServer, versionToDeploy);
|
||||
this.websiteRef, serverRef, versionToDeploy, serverName, attemptId);
|
||||
context.getExternalContext().getSessionMap().put(monitor.getId(), monitor);
|
||||
this.avmBrowseBean.getDeploymentMonitorIds().add(monitor.getId());
|
||||
|
||||
// create the action
|
||||
// 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_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_SERVER, serverRef);
|
||||
args.put(AVMDeploySnapshotAction.PARAM_ATTEMPT, attempt);
|
||||
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);
|
||||
}
|
||||
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";
|
||||
@@ -206,6 +202,14 @@ public class DeploySnapshotDialog extends BaseDialogBean
|
||||
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,11 +170,19 @@ 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
|
||||
*/
|
||||
@@ -172,6 +191,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
|
||||
|
@@ -26,7 +26,6 @@ package org.alfresco.web.ui.wcm.component;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@@ -37,9 +36,11 @@ import javax.faces.el.ValueBinding;
|
||||
import javax.transaction.UserTransaction;
|
||||
|
||||
import org.alfresco.model.WCMAppModel;
|
||||
import org.alfresco.repo.avm.actions.AVMDeploySnapshotAction;
|
||||
import org.alfresco.service.cmr.repository.ChildAssociationRef;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.alfresco.service.cmr.repository.NodeService;
|
||||
import org.alfresco.service.namespace.QName;
|
||||
import org.alfresco.service.namespace.RegexQNamePattern;
|
||||
import org.alfresco.web.app.Application;
|
||||
import org.alfresco.web.bean.repository.Repository;
|
||||
@@ -140,6 +141,8 @@ public class UIDeployWebsite extends UIInput
|
||||
throw new IllegalArgumentException("The web project must be specified.");
|
||||
}
|
||||
|
||||
NodeService nodeService = Repository.getServiceRegistry(context).getNodeService();
|
||||
|
||||
// add some before the panels
|
||||
out.write("\n<div style='padding-top:4px;'></div>\n");
|
||||
|
||||
@@ -172,13 +175,14 @@ public class UIDeployWebsite extends UIInput
|
||||
if (logger.isDebugEnabled())
|
||||
logger.debug("Found deployment monitor: " + monitor);
|
||||
|
||||
renderServer(context, out, monitor.getTargetServer(), false, true, id);
|
||||
renderServer(context, out, nodeService, monitor.getTargetServer(), false, true, id);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// get a list of the servers that have been successfully deployed to
|
||||
/*
|
||||
NodeService nodeService = Repository.getServiceRegistry(context).getNodeService();
|
||||
int deployingVersion = this.getSnapshotVersion();
|
||||
List<String> serversAlreadyDeployed = new ArrayList<String>();
|
||||
@@ -207,21 +211,18 @@ public class UIDeployWebsite extends UIInput
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
// get the list of servers for the user to select from
|
||||
List<String> servers = (List<String>)nodeService.getProperty(webProject,
|
||||
WCMAppModel.PROP_DEPLOYTO);
|
||||
|
||||
if (logger.isDebugEnabled())
|
||||
logger.debug("Servers available: " + servers + ", servers already deployed: " +
|
||||
serversAlreadyDeployed);
|
||||
|
||||
// render the list of servers, only pre-select those that have not been
|
||||
// deployed successfully
|
||||
for (String server : servers)
|
||||
// get the servers available to deploy to
|
||||
List<ChildAssociationRef> deployServerRefs = nodeService.getChildAssocs(
|
||||
webProjectRef, WCMAppModel.ASSOC_DEPLOYMENTSERVER, RegexQNamePattern.MATCH_ALL);
|
||||
for (ChildAssociationRef ref : deployServerRefs)
|
||||
{
|
||||
boolean preSelected = !serversAlreadyDeployed.contains(server);
|
||||
renderServer(context, out, server, preSelected, false, null);
|
||||
NodeRef server = ref.getChildRef();
|
||||
|
||||
// TODO: determine if the server has already been successfully deployed to
|
||||
|
||||
renderServer(context, out, nodeService, server, true, false, null);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -428,11 +429,19 @@ public class UIDeployWebsite extends UIInput
|
||||
out.write("</script>\n");
|
||||
}
|
||||
|
||||
private void renderServer(FacesContext context, ResponseWriter out, String server,
|
||||
boolean selected, boolean monitoring, String monitorId) throws IOException
|
||||
private void renderServer(FacesContext context, ResponseWriter out, NodeService nodeService,
|
||||
NodeRef server, boolean selected, boolean monitoring, String monitorId)
|
||||
throws IOException
|
||||
{
|
||||
String contextPath = context.getExternalContext().getRequestContextPath();
|
||||
|
||||
Map<QName, Serializable> props = nodeService.getProperties(server);
|
||||
String serverName = (String)props.get(WCMAppModel.PROP_DEPLOYSERVERNAME);
|
||||
if (serverName == null || serverName.length() == 0)
|
||||
{
|
||||
serverName = AVMDeploySnapshotAction.calculateServerUri(props);
|
||||
}
|
||||
|
||||
out.write("<table cellspacing='0' cellpadding='0' border='0' width='100%'>");
|
||||
out.write("<tr><td width='10'><img src='");
|
||||
out.write(contextPath);
|
||||
@@ -455,7 +464,7 @@ public class UIDeployWebsite extends UIInput
|
||||
out.write("<input type='checkbox' name='");
|
||||
out.write(this.getClientId(context));
|
||||
out.write("' value='");
|
||||
out.write(server);
|
||||
out.write(server.toString());
|
||||
out.write("'");
|
||||
if (selected)
|
||||
{
|
||||
@@ -477,7 +486,7 @@ public class UIDeployWebsite extends UIInput
|
||||
out.write(contextPath);
|
||||
out.write("/images/parts/deploy_panel_bg.gif); background-repeat: repeat-x; width: 100%;'>");
|
||||
out.write("<div class='deployPanelServerName'>");
|
||||
out.write(server);
|
||||
out.write(serverName);
|
||||
out.write("</div>");
|
||||
if (monitoring)
|
||||
{
|
||||
|
@@ -36,6 +36,9 @@ import javax.transaction.UserTransaction;
|
||||
|
||||
import org.alfresco.model.ContentModel;
|
||||
import org.alfresco.model.WCMAppModel;
|
||||
import org.alfresco.repo.domain.PropertyValue;
|
||||
import org.alfresco.sandbox.SandboxConstants;
|
||||
import org.alfresco.service.cmr.avm.AVMService;
|
||||
import org.alfresco.service.cmr.repository.ChildAssociationRef;
|
||||
import org.alfresco.service.cmr.repository.ContentReader;
|
||||
import org.alfresco.service.cmr.repository.ContentService;
|
||||
@@ -44,6 +47,7 @@ import org.alfresco.service.cmr.repository.NodeService;
|
||||
import org.alfresco.service.namespace.RegexQNamePattern;
|
||||
import org.alfresco.web.app.Application;
|
||||
import org.alfresco.web.bean.repository.Repository;
|
||||
import org.alfresco.web.bean.wcm.AVMUtil;
|
||||
import org.alfresco.web.ui.common.PanelGenerator;
|
||||
import org.alfresco.web.ui.common.Utils;
|
||||
import org.alfresco.web.ui.common.component.SelfRenderingComponent;
|
||||
@@ -117,14 +121,38 @@ public class UIDeploymentReports extends SelfRenderingComponent
|
||||
if (logger.isDebugEnabled())
|
||||
logger.debug("Rendering deployment reports for: " + webProject.toString());
|
||||
|
||||
NodeService nodeService = Repository.getServiceRegistry(context).getNodeService();
|
||||
ContentService contentService = Repository.getServiceRegistry(context).getContentService();
|
||||
AVMService avmService = Repository.getServiceRegistry(context).getAVMService();
|
||||
|
||||
String store = (String)nodeService.getProperty(webProject, WCMAppModel.PROP_AVMSTORE);
|
||||
PropertyValue val = avmService.getStoreProperty(store, SandboxConstants.PROP_LAST_DEPLOYMENT_ID);
|
||||
String attemptId = null;
|
||||
|
||||
if (val != null)
|
||||
{
|
||||
attemptId = val.getStringValue();
|
||||
}
|
||||
|
||||
if (attemptId == null || attemptId.length() == 0)
|
||||
{
|
||||
throw new IllegalStateException("Failed to retrieve deployment attempt id");
|
||||
}
|
||||
|
||||
if (logger.isDebugEnabled())
|
||||
logger.debug("Retrieving deployment reports for attempt id: " + attemptId);
|
||||
|
||||
// get the deploymentattempt object
|
||||
NodeRef attempt = AVMUtil.findDeploymentAttempt(attemptId);
|
||||
|
||||
if (attempt != null)
|
||||
{
|
||||
// render the supporting JavaScript
|
||||
renderScript(context, out);
|
||||
|
||||
// iterate through each deployment report
|
||||
NodeService nodeService = Repository.getServiceRegistry(context).getNodeService();
|
||||
ContentService contentService = Repository.getServiceRegistry(context).getContentService();
|
||||
List<ChildAssociationRef> deployReportRefs = nodeService.getChildAssocs(
|
||||
this.webProjectRef, WCMAppModel.ASSOC_DEPLOYMENTREPORT, RegexQNamePattern.MATCH_ALL);
|
||||
attempt, WCMAppModel.ASSOC_DEPLOYMENTREPORTS, RegexQNamePattern.MATCH_ALL);
|
||||
for (ChildAssociationRef ref : deployReportRefs)
|
||||
{
|
||||
// render each report
|
||||
@@ -133,6 +161,7 @@ public class UIDeploymentReports extends SelfRenderingComponent
|
||||
|
||||
// add some padding after the panels
|
||||
out.write("\n<div style='padding-top:8px;'></div>\n");
|
||||
}
|
||||
|
||||
tx.commit();
|
||||
}
|
||||
|
@@ -42,6 +42,8 @@ import javax.faces.el.ValueBinding;
|
||||
import javax.transaction.UserTransaction;
|
||||
|
||||
import org.alfresco.model.WCMAppModel;
|
||||
import org.alfresco.repo.domain.PropertyValue;
|
||||
import org.alfresco.sandbox.SandboxConstants;
|
||||
import org.alfresco.service.cmr.avm.AVMService;
|
||||
import org.alfresco.service.cmr.avm.VersionDescriptor;
|
||||
import org.alfresco.service.cmr.repository.ChildAssociationRef;
|
||||
@@ -205,7 +207,7 @@ public class UISandboxSnapshots extends SelfRenderingComponent
|
||||
{
|
||||
final Calendar c = Calendar.getInstance();
|
||||
c.setTime(toDate);
|
||||
c.set(Calendar.HOUR, 0);
|
||||
c.set(Calendar.HOUR_OF_DAY, 0);
|
||||
c.set(Calendar.MINUTE, 0);
|
||||
c.set(Calendar.SECOND, 0);
|
||||
fromDate = c.getTime();
|
||||
@@ -229,15 +231,15 @@ public class UISandboxSnapshots extends SelfRenderingComponent
|
||||
boolean showDeployAction = false;
|
||||
NodeRef webProjectRef = AVMUtil.getWebProjectNodeFromStore(sandbox);
|
||||
NodeService nodeService = Repository.getServiceRegistry(context).getNodeService();
|
||||
List<String> deployToServers = (List<String>)nodeService.getProperty(webProjectRef,
|
||||
WCMAppModel.PROP_DEPLOYTO);
|
||||
List<ChildAssociationRef> deployToServers = nodeService.getChildAssocs(
|
||||
webProjectRef, WCMAppModel.ASSOC_DEPLOYMENTSERVER, RegexQNamePattern.MATCH_ALL);
|
||||
if (deployToServers != null && deployToServers.size() > 0)
|
||||
{
|
||||
showDeployAction = true;
|
||||
}
|
||||
|
||||
// determine the deployment status for the website
|
||||
determineDeploymentStatus(context, webProjectRef, sandbox, nodeService);
|
||||
determineDeploymentStatus(context, webProjectRef, sandbox, nodeService, avmService);
|
||||
|
||||
Map requestMap = context.getExternalContext().getRequestMap();
|
||||
for (int i=versions.size() - 1; i >= 0; i--) // reverse order
|
||||
@@ -378,6 +380,7 @@ public class UISandboxSnapshots extends SelfRenderingComponent
|
||||
*
|
||||
* @return UIActionLink component if found, else null if not created yet
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
private UIActionLink findAction(String name, String sandbox)
|
||||
{
|
||||
UIActionLink action = null;
|
||||
@@ -411,6 +414,7 @@ public class UISandboxSnapshots extends SelfRenderingComponent
|
||||
*
|
||||
* @return UIActionLink child component
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
private UIActionLink createAction(FacesContext fc, String sandbox, String name, String icon,
|
||||
String actionListener, String outcome, String url, Map<String, String> params)
|
||||
{
|
||||
@@ -478,40 +482,55 @@ public class UISandboxSnapshots extends SelfRenderingComponent
|
||||
return control;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private void determineDeploymentStatus(FacesContext context, NodeRef webProjectRef,
|
||||
String sandbox, NodeService nodeService)
|
||||
String sandbox, NodeService nodeService, AVMService avmService)
|
||||
{
|
||||
// work out what status to show against which snapshot
|
||||
List<String> selectedServers = (List<String>)nodeService.getProperty(webProjectRef,
|
||||
WCMAppModel.PROP_SELECTEDDEPLOYTO);
|
||||
Integer ver = (Integer)nodeService.getProperty(webProjectRef,
|
||||
WCMAppModel.PROP_SELECTEDDEPLOYVERSION);
|
||||
// if the store property holding the last deployment id is non null a
|
||||
// deployment has been attempted
|
||||
PropertyValue val = avmService.getStoreProperty(sandbox, SandboxConstants.PROP_LAST_DEPLOYMENT_ID);
|
||||
String attemptId = null;
|
||||
|
||||
if (val != null)
|
||||
{
|
||||
attemptId = val.getStringValue();
|
||||
|
||||
// get the latest deployment attempt
|
||||
NodeRef attempt = AVMUtil.findDeploymentAttempt(attemptId);
|
||||
if (attempt != null)
|
||||
{
|
||||
// retrieve the snapshot deployed
|
||||
Integer ver = (Integer)nodeService.getProperty(attempt,
|
||||
WCMAppModel.PROP_DEPLOYATTEMPTVERSION);
|
||||
if (ver != null)
|
||||
{
|
||||
this.deployAttemptVersion = ver.intValue();
|
||||
}
|
||||
|
||||
if (selectedServers != null && selectedServers.size() > 0)
|
||||
// determine if all required reports are present
|
||||
List<String> selectedServers = (List<String>)nodeService.getProperty(
|
||||
attempt, WCMAppModel.PROP_DEPLOYATTEMPTSERVERS);
|
||||
int numServersSelected = 0;
|
||||
if (selectedServers != null)
|
||||
{
|
||||
// if the 'selecteddeployto' property is set a deployment has been attempted
|
||||
numServersSelected = selectedServers.size();
|
||||
|
||||
List<ChildAssociationRef> deployReportRefs = nodeService.getChildAssocs(
|
||||
webProjectRef, WCMAppModel.ASSOC_DEPLOYMENTREPORT, RegexQNamePattern.MATCH_ALL);
|
||||
|
||||
List<String> deployedServers = new ArrayList<String>();
|
||||
attempt, WCMAppModel.ASSOC_DEPLOYMENTREPORTS, RegexQNamePattern.MATCH_ALL);
|
||||
|
||||
if (deployReportRefs.size() >= numServersSelected)
|
||||
{
|
||||
// the number of expected reports are present, determine the status
|
||||
boolean oneOrMoreFailed = false;
|
||||
boolean allFailed = true;
|
||||
for (ChildAssociationRef ref : deployReportRefs)
|
||||
{
|
||||
NodeRef report = ref.getChildRef();
|
||||
|
||||
// get the name of the server and the deploy outcome
|
||||
String serverName = (String)nodeService.getProperty(report,
|
||||
WCMAppModel.PROP_DEPLOYSERVER);
|
||||
// get the deploy outcome
|
||||
Boolean successful = (Boolean)nodeService.getProperty(report,
|
||||
WCMAppModel.PROP_DEPLOYSUCCESSFUL);
|
||||
|
||||
deployedServers.add(serverName);
|
||||
if (successful != null)
|
||||
{
|
||||
if (successful.booleanValue())
|
||||
@@ -525,22 +544,6 @@ public class UISandboxSnapshots extends SelfRenderingComponent
|
||||
}
|
||||
}
|
||||
|
||||
// now we have a list of servers that were deployed see if all
|
||||
// the selected servers have a report, if not it means a deployment
|
||||
// is in progress. If all servers reports are present then
|
||||
// determine the status by the outcomes of from all the reports.
|
||||
boolean allPresent = true;
|
||||
for (String selectedServer : selectedServers)
|
||||
{
|
||||
if (deployedServers.contains(selectedServer) == false)
|
||||
{
|
||||
allPresent = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (allPresent)
|
||||
{
|
||||
// get the right status string
|
||||
if (allFailed)
|
||||
{
|
||||
@@ -557,10 +560,13 @@ public class UISandboxSnapshots extends SelfRenderingComponent
|
||||
}
|
||||
else
|
||||
{
|
||||
// not all expected reports are present yet, still in progress
|
||||
this.deployStatus = Application.getMessage(context, "deploy_status_in_progress");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private AVMService getAVMService(FacesContext fc)
|
||||
{
|
||||
|
@@ -4044,6 +4044,10 @@
|
||||
<property-name>avmBrowseBean</property-name>
|
||||
<value>#{AVMBrowseBean}</value>
|
||||
</managed-property>
|
||||
<managed-property>
|
||||
<property-name>avmService</property-name>
|
||||
<value>#{AVMLockingAwareService}</value>
|
||||
</managed-property>
|
||||
<managed-property>
|
||||
<property-name>actionService</property-name>
|
||||
<value>#{ActionService}</value>
|
||||
|
@@ -144,29 +144,6 @@
|
||||
<f:verbatim>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td valign="top">
|
||||
</f:verbatim>
|
||||
<h:outputText value="#{msg.website_deployto}:"/>
|
||||
<f:verbatim>
|
||||
</td>
|
||||
<td>
|
||||
</f:verbatim>
|
||||
<h:inputText id="server" value="#{WizardManager.bean.deployTo}" size="45" maxlength="256">
|
||||
<a:convertMultiValue />
|
||||
</h:inputText>
|
||||
<h:graphicImage id="deploy-to-help-img"
|
||||
value="/images/icons/Help_icon.gif" style="cursor:help; padding-left: 4px; vertical-align: -4px;"
|
||||
onclick="javascript:toggleDeployToHelp()" />
|
||||
<f:verbatim>
|
||||
<div id="deploy-to-help" class="summary infoText statusInfoText" style="display:none; padding:5px;">
|
||||
</f:verbatim>
|
||||
<h:outputText id="deploy-top-help-text" value="#{WizardManager.bean.deployToHelp}" escape="false" />
|
||||
<f:verbatim>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td>
|
||||
|
Reference in New Issue
Block a user