mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-06-16 17:55:15 +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:
parent
14ef325e93
commit
751fcbb1fa
@ -509,6 +509,24 @@
|
||||
<property name="publicAction">
|
||||
<value>false</value>
|
||||
</property>
|
||||
<property name="defaultRemoteUsername">
|
||||
<value>admin</value>
|
||||
</property>
|
||||
<property name="defaultRemotePassword">
|
||||
<value>admin</value>
|
||||
</property>
|
||||
<property name="defaultAlfrescoRmiPort">
|
||||
<value>50500</value>
|
||||
</property>
|
||||
<property name="defaultReceiverRmiPort">
|
||||
<value>44100</value>
|
||||
</property>
|
||||
<property name="defaultTargetName">
|
||||
<value>default</value>
|
||||
</property>
|
||||
<property name="delay">
|
||||
<value>30</value>
|
||||
</property>
|
||||
</bean>
|
||||
|
||||
<bean id="count-children" class="org.alfresco.repo.action.executer.CountChildrenActionExecuter" parent="action-executer">
|
||||
|
@ -118,11 +118,9 @@ avm-undo-list.node-list.display-label=The string encoded list of nodes to revert
|
||||
avm-deploy-snapshot.title=Deploy a snapshot to a remote server.
|
||||
avm-deploy-snapshot.description=This deploys a website snapshot to a remote server.
|
||||
avm-deploy-snapshot.website.display-label=NodeRef of the website the deploy is occurring from.
|
||||
avm-deploy-snapshot.target-server.display-label=The name or IP address of the remote server to deploy to.
|
||||
avm-deploy-snapshot.default-rmi-port.display-label=The default RMI port to connect to if it is not supplied in target-server parameter.
|
||||
avm-deploy-snapshot.remote-username.display-label=The username to connect as.
|
||||
avm-deploy-snapshot.remote-password.display-label=The password for the remote-username.
|
||||
avm-deploy-snapshot.deploy-callback.display-label=The DeploymentCallback listener object.
|
||||
avm-deploy-snapshot.server.display-label=NodeRef of the deploymentserver to deploy to.
|
||||
avm-deploy-snapshot.attempt.display-label=NodeRef of the deploymentattempt this deployment is part of.
|
||||
avm-deploy-snapshot.callback.display-label=The DeploymentCallback listener object.
|
||||
avm-deploy-snapshot.delay.display-label=An optional delay to apply to the start of a deployment.
|
||||
|
||||
start-avm-workflow.title=Start a WCM Workflow
|
||||
|
@ -194,3 +194,9 @@ patch.tagRootCategory.description=Adds 'Tags' as new top-level category root.
|
||||
patch.projectsFolder.description=Adds 'Projects' folder to Company Home.
|
||||
|
||||
patch.projectTemplate.description=Adds the default Project template folder to the Space Templates folder.
|
||||
|
||||
patch.deploymentMigration.description=Migrates deployment data to the new model.
|
||||
patch.deploymentMigration.webProjectName=Migrating deployment data for web project ''{0}''
|
||||
patch.deploymentMigration.serverMigrated=Server ''{0}'' from web project ''{1}'' has been migrated
|
||||
patch.deploymentMigration.reportMigrated=Deployment report for ''{0}'' from web project ''{1}'' has been migrated
|
||||
patch.deploymentMigration.result=Deployment data has been migrated.
|
||||
|
@ -16,6 +16,25 @@
|
||||
<namespace uri="http://www.alfresco.org/model/wcmappmodel/1.0" prefix="wca"/>
|
||||
</namespaces>
|
||||
|
||||
<constraints>
|
||||
<constraint name="wca:deploytypes" type="LIST">
|
||||
<parameter name="allowedValues">
|
||||
<list>
|
||||
<value>alfresco</value>
|
||||
<value>file</value>
|
||||
</list>
|
||||
</parameter>
|
||||
</constraint>
|
||||
|
||||
<constraint name="wca:deployservertypes" type="LIST">
|
||||
<parameter name="allowedValues">
|
||||
<list>
|
||||
<value>live</value>
|
||||
<value>test</value>
|
||||
</list>
|
||||
</parameter>
|
||||
</constraint>
|
||||
</constraints>
|
||||
|
||||
<types>
|
||||
|
||||
@ -37,6 +56,7 @@
|
||||
<title>Default Webapp</title>
|
||||
<type>d:text</type>
|
||||
</property>
|
||||
<!-- the following properties are deprecated as of v2.2 -->
|
||||
<property name="wca:deployto">
|
||||
<title>Deploy To</title>
|
||||
<type>d:text</type>
|
||||
@ -51,6 +71,7 @@
|
||||
<title>Snapshot Version Selected For Deployment</title>
|
||||
<type>d:int</type>
|
||||
</property>
|
||||
<!-- end of deprecation -->
|
||||
<property name="wca:issource">
|
||||
<title>Used as a template website</title>
|
||||
<type>d:boolean</type>
|
||||
@ -90,6 +111,7 @@
|
||||
<many>true</many>
|
||||
</target>
|
||||
</child-association>
|
||||
<!-- the following association is deprecated as of v2.2 -->
|
||||
<child-association name="wca:deploymentreport">
|
||||
<source>
|
||||
<mandatory>false</mandatory>
|
||||
@ -101,6 +123,29 @@
|
||||
<many>true</many>
|
||||
</target>
|
||||
</child-association>
|
||||
<!-- end of deprecation -->
|
||||
<child-association name="wca:deploymentserver">
|
||||
<source>
|
||||
<mandatory>false</mandatory>
|
||||
<many>false</many>
|
||||
</source>
|
||||
<target>
|
||||
<class>wca:deploymentserver</class>
|
||||
<mandatory>false</mandatory>
|
||||
<many>true</many>
|
||||
</target>
|
||||
</child-association>
|
||||
<child-association name="wca:deploymentattempt">
|
||||
<source>
|
||||
<mandatory>false</mandatory>
|
||||
<many>false</many>
|
||||
</source>
|
||||
<target>
|
||||
<class>wca:deploymentattempt</class>
|
||||
<mandatory>false</mandatory>
|
||||
<many>true</many>
|
||||
</target>
|
||||
</child-association>
|
||||
</associations>
|
||||
</type>
|
||||
|
||||
@ -221,6 +266,138 @@
|
||||
<parent>cm:folder</parent>
|
||||
</type>
|
||||
|
||||
<type name="wca:deploymentserver">
|
||||
<title>Website Deployment Server</title>
|
||||
<parent>sys:base</parent>
|
||||
<properties>
|
||||
<property name="wca:deploytype">
|
||||
<title>Deployment Type</title>
|
||||
<type>d:text</type>
|
||||
<constraints>
|
||||
<constraint ref="wca:deploytypes" />
|
||||
</constraints>
|
||||
</property>
|
||||
<property name="wca:deployservertype">
|
||||
<title>Deployment Server Type</title>
|
||||
<type>d:text</type>
|
||||
<constraints>
|
||||
<constraint ref="wca:deployservertypes" />
|
||||
</constraints>
|
||||
</property>
|
||||
<property name="wca:deployserverhost">
|
||||
<title>Host</title>
|
||||
<type>d:text</type>
|
||||
<mandatory enforced="true">true</mandatory>
|
||||
<index enabled="true">
|
||||
<atomic>true</atomic>
|
||||
<stored>false</stored>
|
||||
<tokenised>false</tokenised>
|
||||
</index>
|
||||
</property>
|
||||
<property name="wca:deployserverport">
|
||||
<title>Port</title>
|
||||
<type>d:int</type>
|
||||
<mandatory enforced="true">true</mandatory>
|
||||
</property>
|
||||
<property name="wca:deployservername">
|
||||
<title>Display Name</title>
|
||||
<type>d:text</type>
|
||||
</property>
|
||||
<property name="wca:deployserverusername">
|
||||
<title>Username</title>
|
||||
<type>d:text</type>
|
||||
</property>
|
||||
<property name="wca:deployserverpassword">
|
||||
<title>Password</title>
|
||||
<type>d:text</type>
|
||||
</property>
|
||||
<property name="wca:deployserverurl">
|
||||
<title>Runtime URL</title>
|
||||
<type>d:text</type>
|
||||
</property>
|
||||
<property name="wca:deployservertarget">
|
||||
<title>Deploy Target</title>
|
||||
<type>d:text</type>
|
||||
</property>
|
||||
<property name="wca:deploysourcepath">
|
||||
<title>Source Path</title>
|
||||
<type>d:text</type>
|
||||
</property>
|
||||
<property name="wca:deployserverallocatedto">
|
||||
<title>Allocated To</title>
|
||||
<type>d:text</type>
|
||||
</property>
|
||||
<property name="wca:deployonapproval">
|
||||
<title>Deploy On Approval</title>
|
||||
<type>d:boolean</type>
|
||||
<default>false</default>
|
||||
</property>
|
||||
</properties>
|
||||
</type>
|
||||
|
||||
<type name="wca:deploymentattempt">
|
||||
<title>Website Deployment Attempt</title>
|
||||
<parent>sys:base</parent>
|
||||
<properties>
|
||||
<property name="wca:deployattemptid">
|
||||
<title>Deploy Attempt ID</title>
|
||||
<type>d:text</type>
|
||||
<mandatory enforced="true">true</mandatory>
|
||||
<index enabled="true">
|
||||
<atomic>true</atomic>
|
||||
<stored>false</stored>
|
||||
<tokenised>false</tokenised>
|
||||
</index>
|
||||
</property>
|
||||
<property name="wca:deployattempttype">
|
||||
<title>Attempt Type</title>
|
||||
<type>d:text</type>
|
||||
<constraints>
|
||||
<constraint ref="wca:deployservertypes" />
|
||||
</constraints>
|
||||
</property>
|
||||
<property name="wca:deployattemptstore">
|
||||
<title>Attempt Type</title>
|
||||
<type>d:text</type>
|
||||
<mandatory enforced="true">true</mandatory>
|
||||
<index enabled="true">
|
||||
<atomic>true</atomic>
|
||||
<stored>false</stored>
|
||||
<tokenised>false</tokenised>
|
||||
</index>
|
||||
</property>
|
||||
<property name="wca:deployattemptversion">
|
||||
<title>Snapshot Version Deployed</title>
|
||||
<type>d:int</type>
|
||||
<mandatory enforced="true">true</mandatory>
|
||||
</property>
|
||||
<property name="wca:deployattemptservers">
|
||||
<title>Servers Deployed To</title>
|
||||
<type>d:text</type>
|
||||
<mandatory enforced="true">true</mandatory>
|
||||
<multiple>true</multiple>
|
||||
</property>
|
||||
<property name="wca:deployattempttime">
|
||||
<title>Time Of Deploy Attempt</title>
|
||||
<type>d:datetime</type>
|
||||
<mandatory enforced="true">true</mandatory>
|
||||
</property>
|
||||
</properties>
|
||||
<associations>
|
||||
<child-association name="wca:deploymentreports">
|
||||
<source>
|
||||
<mandatory>false</mandatory>
|
||||
<many>false</many>
|
||||
</source>
|
||||
<target>
|
||||
<class>wca:deploymentreport</class>
|
||||
<mandatory>false</mandatory>
|
||||
<many>true</many>
|
||||
</target>
|
||||
</child-association>
|
||||
</associations>
|
||||
</type>
|
||||
|
||||
<type name="wca:deploymentreport">
|
||||
<title>Website Deployment Report</title>
|
||||
<parent>cm:content</parent>
|
||||
@ -254,6 +431,26 @@
|
||||
<title>Failure Reason</title>
|
||||
<type>d:text</type>
|
||||
</property>
|
||||
<property name="wca:deployservernameused">
|
||||
<title>Server Display Name</title>
|
||||
<type>d:text</type>
|
||||
</property>
|
||||
<property name="wca:deployserverusernameused">
|
||||
<title>Username Used</title>
|
||||
<type>d:text</type>
|
||||
</property>
|
||||
<property name="wca:deployservertargetused">
|
||||
<title>Target Used</title>
|
||||
<type>d:text</type>
|
||||
</property>
|
||||
<property name="wca:deploysourcepathused">
|
||||
<title>Source Path Used</title>
|
||||
<type>d:text</type>
|
||||
</property>
|
||||
<property name="wca:deployserverurlused">
|
||||
<title>Source Path Used</title>
|
||||
<type>d:text</type>
|
||||
</property>
|
||||
</properties>
|
||||
</type>
|
||||
</types>
|
||||
|
@ -1212,4 +1212,21 @@
|
||||
</property>
|
||||
</bean>
|
||||
|
||||
<bean id="patch.deploymentMigration" class="org.alfresco.repo.admin.patch.impl.DeploymentMigrationPatch" parent="basePatch" >
|
||||
<property name="id"><value>patch.deploymentMigration</value></property>
|
||||
<property name="description"><value>patch.deploymentMigration.description</value></property>
|
||||
<property name="fixesFromSchema"><value>0</value></property>
|
||||
<property name="fixesToSchema"><value>116</value></property>
|
||||
<property name="targetSchema"><value>117</value></property>
|
||||
<property name="importerBootstrap">
|
||||
<ref bean="spacesBootstrap" />
|
||||
</property>
|
||||
<property name="indexerAndSearcher">
|
||||
<ref bean="indexerAndSearcherFactory" />
|
||||
</property>
|
||||
<property name="avmService">
|
||||
<ref bean="avmService" />
|
||||
</property>
|
||||
</bean>
|
||||
|
||||
</beans>
|
@ -19,4 +19,4 @@ version.build=@build-number@
|
||||
|
||||
# Schema number
|
||||
|
||||
version.schema=116
|
||||
version.schema=117
|
||||
|
@ -43,6 +43,8 @@ public interface WCMAppModel
|
||||
static final QName ASSOC_WEBUSER = QName.createQName(NamespaceService.WCMAPP_MODEL_1_0_URI, "webuser");
|
||||
static final QName ASSOC_WEBFORM = QName.createQName(NamespaceService.WCMAPP_MODEL_1_0_URI, "webform");
|
||||
static final QName ASSOC_WEBWORKFLOWDEFAULTS = QName.createQName(NamespaceService.WCMAPP_MODEL_1_0_URI, "webworkflowdefaults");
|
||||
static final QName ASSOC_DEPLOYMENTSERVER = QName.createQName(NamespaceService.WCMAPP_MODEL_1_0_URI, "deploymentserver");
|
||||
static final QName ASSOC_DEPLOYMENTATTEMPT = QName.createQName(NamespaceService.WCMAPP_MODEL_1_0_URI, "deploymentattempt");
|
||||
static final QName ASSOC_DEPLOYMENTREPORT = QName.createQName(NamespaceService.WCMAPP_MODEL_1_0_URI, "deploymentreport");
|
||||
|
||||
// AVM web user reference
|
||||
@ -68,6 +70,35 @@ public interface WCMAppModel
|
||||
// AVM web workflow defaults
|
||||
static final QName TYPE_WEBWORKFLOWDEFAULTS = QName.createQName(NamespaceService.WCMAPP_MODEL_1_0_URI, "webworkflowdefaults");
|
||||
|
||||
// AVM website deployment server
|
||||
static final String CONSTRAINT_ALFDEPLOY = "alfresco";
|
||||
static final String CONSTRAINT_FILEDEPLOY = "file";
|
||||
static final String CONSTRAINT_LIVESERVER = "live";
|
||||
static final String CONSTRAINT_TESTSERVER = "test";
|
||||
static final QName TYPE_DEPLOYMENTSERVER = QName.createQName(NamespaceService.WCMAPP_MODEL_1_0_URI, "deploymentserver");
|
||||
static final QName PROP_DEPLOYTYPE = QName.createQName(NamespaceService.WCMAPP_MODEL_1_0_URI, "deploytype");
|
||||
static final QName PROP_DEPLOYSERVERTYPE = QName.createQName(NamespaceService.WCMAPP_MODEL_1_0_URI, "deployservertype");
|
||||
static final QName PROP_DEPLOYSERVERHOST = QName.createQName(NamespaceService.WCMAPP_MODEL_1_0_URI, "deployserverhost");
|
||||
static final QName PROP_DEPLOYSERVERPORT = QName.createQName(NamespaceService.WCMAPP_MODEL_1_0_URI, "deployserverport");
|
||||
static final QName PROP_DEPLOYSERVERNAME = QName.createQName(NamespaceService.WCMAPP_MODEL_1_0_URI, "deployservername");
|
||||
static final QName PROP_DEPLOYSERVERUSERNAME = QName.createQName(NamespaceService.WCMAPP_MODEL_1_0_URI, "deployserverusername");
|
||||
static final QName PROP_DEPLOYSERVERPASSWORD = QName.createQName(NamespaceService.WCMAPP_MODEL_1_0_URI, "deployserverpassword");
|
||||
static final QName PROP_DEPLOYSERVERURL = QName.createQName(NamespaceService.WCMAPP_MODEL_1_0_URI, "deployserverurl");
|
||||
static final QName PROP_DEPLOYSERVERTARGET = QName.createQName(NamespaceService.WCMAPP_MODEL_1_0_URI, "deployservertarget");
|
||||
static final QName PROP_DEPLOYSOURCEPATH = QName.createQName(NamespaceService.WCMAPP_MODEL_1_0_URI, "deploysourcepath");
|
||||
static final QName PROP_DEPLOYSERVERALLOCATEDTO = QName.createQName(NamespaceService.WCMAPP_MODEL_1_0_URI, "deployserverallocatedto");
|
||||
static final QName PROP_DEPLOYONAPPROVAL = QName.createQName(NamespaceService.WCMAPP_MODEL_1_0_URI, "deployonapproval");
|
||||
|
||||
// AVM website deployment attempt
|
||||
static final QName TYPE_DEPLOYMENTATTEMPT = QName.createQName(NamespaceService.WCMAPP_MODEL_1_0_URI, "deploymentattempt");
|
||||
static final QName PROP_DEPLOYATTEMPTID = QName.createQName(NamespaceService.WCMAPP_MODEL_1_0_URI, "deployattemptid");
|
||||
static final QName PROP_DEPLOYATTEMPTTYPE = QName.createQName(NamespaceService.WCMAPP_MODEL_1_0_URI, "deployattempttype");
|
||||
static final QName PROP_DEPLOYATTEMPTSTORE = QName.createQName(NamespaceService.WCMAPP_MODEL_1_0_URI, "deployattemptstore");
|
||||
static final QName PROP_DEPLOYATTEMPTVERSION = QName.createQName(NamespaceService.WCMAPP_MODEL_1_0_URI, "deployattemptversion");
|
||||
static final QName PROP_DEPLOYATTEMPTSERVERS = QName.createQName(NamespaceService.WCMAPP_MODEL_1_0_URI, "deployattemptservers");
|
||||
static final QName PROP_DEPLOYATTEMPTTIME = QName.createQName(NamespaceService.WCMAPP_MODEL_1_0_URI, "deployattempttime");
|
||||
static final QName ASSOC_DEPLOYMENTREPORTS = QName.createQName(NamespaceService.WCMAPP_MODEL_1_0_URI, "deploymentreports");
|
||||
|
||||
// AVM website deployment report
|
||||
static final QName TYPE_DEPLOYMENTREPORT = QName.createQName(NamespaceService.WCMAPP_MODEL_1_0_URI, "deploymentreport");
|
||||
static final QName PROP_DEPLOYSERVER = QName.createQName(NamespaceService.WCMAPP_MODEL_1_0_URI, "deployserver");
|
||||
@ -76,6 +107,11 @@ public interface WCMAppModel
|
||||
static final QName PROP_DEPLOYFAILEDREASON = QName.createQName(NamespaceService.WCMAPP_MODEL_1_0_URI, "deployfailedreason");
|
||||
static final QName PROP_DEPLOYSTARTTIME = QName.createQName(NamespaceService.WCMAPP_MODEL_1_0_URI, "deploystarttime");
|
||||
static final QName PROP_DEPLOYENDTIME = QName.createQName(NamespaceService.WCMAPP_MODEL_1_0_URI, "deployendtime");
|
||||
static final QName PROP_DEPLOYSERVERNAMEUSED = QName.createQName(NamespaceService.WCMAPP_MODEL_1_0_URI, "deployservernameused");
|
||||
static final QName PROP_DEPLOYSERVERUSERNAMEUSED = QName.createQName(NamespaceService.WCMAPP_MODEL_1_0_URI, "deployserverusernameused");
|
||||
static final QName PROP_DEPLOYSERVERTARGETUSED = QName.createQName(NamespaceService.WCMAPP_MODEL_1_0_URI, "deployservertargetused");
|
||||
static final QName PROP_DEPLOYSOURCEPATHUSED = QName.createQName(NamespaceService.WCMAPP_MODEL_1_0_URI, "deploysourcepathused");
|
||||
static final QName PROP_DEPLOYSERVERURLUSED = QName.createQName(NamespaceService.WCMAPP_MODEL_1_0_URI, "deployserverurlused");
|
||||
|
||||
// AVM webapp aspect
|
||||
static final QName ASPECT_WEBAPP = QName.createQName(NamespaceService.WCMAPP_MODEL_1_0_URI, "webapp");
|
||||
|
@ -0,0 +1,223 @@
|
||||
package org.alfresco.repo.admin.patch.impl;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.alfresco.i18n.I18NUtil;
|
||||
import org.alfresco.model.ContentModel;
|
||||
import org.alfresco.model.WCMAppModel;
|
||||
import org.alfresco.repo.admin.patch.AbstractPatch;
|
||||
import org.alfresco.repo.domain.PropertyValue;
|
||||
import org.alfresco.repo.importer.ImporterBootstrap;
|
||||
import org.alfresco.repo.search.IndexerAndSearcher;
|
||||
import org.alfresco.sandbox.SandboxConstants;
|
||||
import org.alfresco.service.cmr.avm.AVMService;
|
||||
import org.alfresco.service.cmr.dictionary.DataTypeDefinition;
|
||||
import org.alfresco.service.cmr.repository.ChildAssociationRef;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.alfresco.service.cmr.search.ResultSet;
|
||||
import org.alfresco.service.cmr.search.SearchService;
|
||||
import org.alfresco.service.namespace.QName;
|
||||
import org.alfresco.service.namespace.RegexQNamePattern;
|
||||
import org.alfresco.util.GUID;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
/**
|
||||
* Patch that migrates deployment data to the new deployment model.
|
||||
*
|
||||
* @author gavinc
|
||||
*/
|
||||
public class DeploymentMigrationPatch extends AbstractPatch
|
||||
{
|
||||
protected ImporterBootstrap importerBootstrap;
|
||||
protected IndexerAndSearcher indexerAndSearcher;
|
||||
protected AVMService avmService;
|
||||
|
||||
private static final String MSG_SUCCESS = "patch.deploymentMigration.result";
|
||||
private static final String MSG_WEBPROJECT = "patch.deploymentMigration.webProjectName";
|
||||
private static final String MSG_SERVER_MIGRATED = "patch.deploymentMigration.serverMigrated";
|
||||
private static final String MSG_REPORT_MIGRATED = "patch.deploymentMigration.reportMigrated";
|
||||
|
||||
private static final String FILE_SERVER_PREFIX = "\\\\";
|
||||
|
||||
private static final Log logger = LogFactory.getLog(DeploymentMigrationPatch.class);
|
||||
|
||||
public void setIndexerAndSearcher(IndexerAndSearcher indexerAndSearcher)
|
||||
{
|
||||
this.indexerAndSearcher = indexerAndSearcher;
|
||||
}
|
||||
|
||||
public void setImporterBootstrap(ImporterBootstrap importerBootstrap)
|
||||
{
|
||||
this.importerBootstrap = importerBootstrap;
|
||||
}
|
||||
|
||||
public void setAvmService(AVMService avmService)
|
||||
{
|
||||
this.avmService = avmService;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String applyInternal() throws Exception
|
||||
{
|
||||
String query = "TYPE:\"wca:webfolder\"";
|
||||
|
||||
ResultSet results = null;
|
||||
try
|
||||
{
|
||||
results = this.searchService.query(this.importerBootstrap.getStoreRef(),
|
||||
SearchService.LANGUAGE_LUCENE, query);
|
||||
|
||||
// iterate through the web projects and migrate the deployment data
|
||||
if (results.length() > 0)
|
||||
{
|
||||
for (NodeRef node : results.getNodeRefs())
|
||||
{
|
||||
if (this.nodeService.exists(node))
|
||||
{
|
||||
migrate(node);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (results != null)
|
||||
{
|
||||
results.close();
|
||||
}
|
||||
}
|
||||
|
||||
// return success message
|
||||
return I18NUtil.getMessage(MSG_SUCCESS);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
protected void migrate(NodeRef webProject)
|
||||
{
|
||||
// output name of web project currently being migrated
|
||||
String projectName = (String)this.nodeService.getProperty(webProject, ContentModel.PROP_NAME);
|
||||
logger.info(I18NUtil.getMessage(MSG_WEBPROJECT, projectName));
|
||||
|
||||
// see if the web project has any deployment servers configured
|
||||
List<String> deployTo = (List<String>)this.nodeService.getProperty(webProject, WCMAppModel.PROP_DEPLOYTO);
|
||||
if (deployTo != null && deployTo.size() > 0)
|
||||
{
|
||||
for (String server : deployTo)
|
||||
{
|
||||
if (server != null && server.length() > 0)
|
||||
{
|
||||
migrateServer(server.trim(), webProject, projectName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// migrate any deployment reports present
|
||||
List<ChildAssociationRef> deployReportRefs = nodeService.getChildAssocs(webProject,
|
||||
WCMAppModel.ASSOC_DEPLOYMENTREPORT, RegexQNamePattern.MATCH_ALL);
|
||||
if (deployReportRefs.size() > 0)
|
||||
{
|
||||
// gather data required for deploymentattempt node
|
||||
String attemptId = GUID.generate();
|
||||
String store = (String)this.nodeService.getProperty(webProject, WCMAppModel.PROP_AVMSTORE);
|
||||
List<String> servers = (List<String>)this.nodeService.getProperty(webProject,
|
||||
WCMAppModel.PROP_SELECTEDDEPLOYTO);
|
||||
if (servers == null)
|
||||
{
|
||||
servers = new ArrayList<String>();
|
||||
}
|
||||
Integer version = (Integer)this.nodeService.getProperty(webProject,
|
||||
WCMAppModel.PROP_SELECTEDDEPLOYVERSION);
|
||||
Date time = (Date)this.nodeService.getProperty(
|
||||
deployReportRefs.get(0).getChildRef(), WCMAppModel.PROP_DEPLOYSTARTTIME);
|
||||
|
||||
// create a deploymentattempt node for the reports to move to
|
||||
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, store);
|
||||
props.put(WCMAppModel.PROP_DEPLOYATTEMPTVERSION, version);
|
||||
props.put(WCMAppModel.PROP_DEPLOYATTEMPTSERVERS, (Serializable)servers);
|
||||
props.put(WCMAppModel.PROP_DEPLOYATTEMPTTIME, time);
|
||||
NodeRef attempt = this.nodeService.createNode(webProject,
|
||||
WCMAppModel.ASSOC_DEPLOYMENTATTEMPT, WCMAppModel.ASSOC_DEPLOYMENTATTEMPT,
|
||||
WCMAppModel.TYPE_DEPLOYMENTATTEMPT, props).getChildRef();
|
||||
|
||||
// set the attempt id on the staging store
|
||||
this.avmService.setStoreProperty(store, SandboxConstants.PROP_LAST_DEPLOYMENT_ID,
|
||||
new PropertyValue(DataTypeDefinition.TEXT, attemptId));
|
||||
|
||||
// migrate each report found
|
||||
for (ChildAssociationRef ref : deployReportRefs)
|
||||
{
|
||||
migrateReport(ref.getChildRef(), attempt, webProject, projectName);
|
||||
}
|
||||
}
|
||||
|
||||
// remove all the deprecated properties in the web project
|
||||
this.nodeService.removeProperty(webProject, WCMAppModel.PROP_DEPLOYTO);
|
||||
this.nodeService.removeProperty(webProject, WCMAppModel.PROP_SELECTEDDEPLOYTO);
|
||||
this.nodeService.removeProperty(webProject, WCMAppModel.PROP_SELECTEDDEPLOYVERSION);
|
||||
}
|
||||
|
||||
protected void migrateServer(String server, NodeRef webProject, String webProjectName)
|
||||
{
|
||||
// work out the host and port
|
||||
String host = server;
|
||||
int port = -1;
|
||||
int idx = server.indexOf(":");
|
||||
if (idx != -1)
|
||||
{
|
||||
host = server.substring(0, idx);
|
||||
String strPort = server.substring(idx+1);
|
||||
port = Integer.parseInt(strPort);
|
||||
}
|
||||
|
||||
Map<QName, Serializable> props = new HashMap<QName, Serializable>(4, 1.0f);
|
||||
if (server.startsWith(FILE_SERVER_PREFIX))
|
||||
{
|
||||
// server name starts with \\ so is therefore a file system deployment
|
||||
props.put(WCMAppModel.PROP_DEPLOYTYPE, WCMAppModel.CONSTRAINT_FILEDEPLOY);
|
||||
host = host.substring(FILE_SERVER_PREFIX.length());
|
||||
}
|
||||
else
|
||||
{
|
||||
// server name does not start with \\ so is therefore an Alfresco server deployment
|
||||
props.put(WCMAppModel.PROP_DEPLOYTYPE, WCMAppModel.CONSTRAINT_ALFDEPLOY);
|
||||
}
|
||||
|
||||
// set the properties
|
||||
props.put(WCMAppModel.PROP_DEPLOYSERVERTYPE, WCMAppModel.CONSTRAINT_LIVESERVER);
|
||||
props.put(WCMAppModel.PROP_DEPLOYSERVERHOST, host);
|
||||
if (port != -1)
|
||||
{
|
||||
props.put(WCMAppModel.PROP_DEPLOYSERVERPORT, new Integer(port));
|
||||
}
|
||||
|
||||
// create the deploymentserver node as a child of the webproject
|
||||
this.nodeService.createNode(webProject, WCMAppModel.ASSOC_DEPLOYMENTSERVER,
|
||||
WCMAppModel.ASSOC_DEPLOYMENTSERVER, WCMAppModel.TYPE_DEPLOYMENTSERVER,
|
||||
props).getChildRef();
|
||||
|
||||
// inform of migration
|
||||
logger.info(I18NUtil.getMessage(MSG_SERVER_MIGRATED, server, webProjectName));
|
||||
}
|
||||
|
||||
protected void migrateReport(NodeRef report, NodeRef attempt, NodeRef webProject,
|
||||
String webProjectName)
|
||||
{
|
||||
String server = (String)this.nodeService.getProperty(report, WCMAppModel.PROP_DEPLOYSERVER);
|
||||
|
||||
// make the deployment report node a child of the given deploymentattempt node
|
||||
this.nodeService.moveNode(report, attempt, WCMAppModel.ASSOC_DEPLOYMENTREPORTS,
|
||||
WCMAppModel.ASSOC_DEPLOYMENTREPORTS);
|
||||
|
||||
// inform of migration
|
||||
logger.info(I18NUtil.getMessage(MSG_REPORT_MIGRATED, server, webProjectName));
|
||||
}
|
||||
}
|
@ -67,14 +67,16 @@ public class AVMDeploySnapshotAction extends ActionExecuterAbstractBase
|
||||
public static final String NAME = "avm-deploy-snapshot";
|
||||
|
||||
public static final String PARAM_WEBSITE = "website";
|
||||
public static final String PARAM_TARGET_SERVER = "target-server";
|
||||
public static final String PARAM_DEFAULT_RMI_PORT = "default-rmi-port";
|
||||
public static final String PARAM_DEFAULT_RECEIVER_RMI_PORT = "default-receiver-rmi-port";
|
||||
public static final String PARAM_REMOTE_USERNAME = "remote-username";
|
||||
public static final String PARAM_REMOTE_PASSWORD = "remote-password";
|
||||
public static final String PARAM_CALLBACK = "deploy-callback";
|
||||
public static final String PARAM_DELAY = "delay";
|
||||
public static final String PARAM_SERVER = "server";
|
||||
public static final String PARAM_ATTEMPT = "attempt";
|
||||
public static final String PARAM_CALLBACK = "callback";
|
||||
|
||||
private int delay = -1;
|
||||
private int defaultAlfRmiPort = 50500;
|
||||
private int defaultReceiverRmiPort = 44100;
|
||||
private String defaultRemoteUsername = "admin";
|
||||
private String defaultRemotePassword = "admin";
|
||||
private String defaultTargetName = "default";
|
||||
private DeploymentService deployService;
|
||||
private ContentService contentService;
|
||||
private NodeService nodeService;
|
||||
@ -83,6 +85,96 @@ public class AVMDeploySnapshotAction extends ActionExecuterAbstractBase
|
||||
private static Log delayDeploymentLogger = LogFactory.getLog("alfresco.deployment.delay");
|
||||
private static final String FILE_SERVER_PREFIX = "\\\\";
|
||||
|
||||
/**
|
||||
* Calculate the URI representation of a server from the given set of properties
|
||||
*
|
||||
* @param props Set of properties to calculate URI from
|
||||
*/
|
||||
public static String calculateServerUri(Map<QName, Serializable> props)
|
||||
{
|
||||
StringBuilder uri = new StringBuilder();
|
||||
|
||||
// prefix the uri if necessary
|
||||
String type = (String)props.get(WCMAppModel.PROP_DEPLOYTYPE);
|
||||
if (WCMAppModel.CONSTRAINT_FILEDEPLOY.equals(type))
|
||||
{
|
||||
uri.append(FILE_SERVER_PREFIX);
|
||||
}
|
||||
|
||||
// append server name
|
||||
uri.append((String)props.get(WCMAppModel.PROP_DEPLOYSERVERHOST));
|
||||
|
||||
// append port (if present)
|
||||
Integer port = (Integer)props.get(WCMAppModel.PROP_DEPLOYSERVERPORT);
|
||||
if (port != null)
|
||||
{
|
||||
uri.append(":");
|
||||
uri.append(port.toString());
|
||||
}
|
||||
|
||||
return uri.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the delay to use before starting the deployment
|
||||
*
|
||||
* @param delay The delay in seconds
|
||||
*/
|
||||
public void setDelay(int delay)
|
||||
{
|
||||
this.delay = delay;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the default RMI port for Alfresco server deployments
|
||||
*
|
||||
* @param defaultAlfrescoRmiPort port number
|
||||
*/
|
||||
public void setDefaultAlfrescoRmiPort(int defaultAlfrescoRmiPort)
|
||||
{
|
||||
this.defaultAlfRmiPort = defaultAlfrescoRmiPort;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the default RMI port for File system deployments
|
||||
*
|
||||
* @param defaultReceiverRmiPort port number
|
||||
*/
|
||||
public void setDefaultReceiverRmiPort(int defaultReceiverRmiPort)
|
||||
{
|
||||
this.defaultReceiverRmiPort = defaultReceiverRmiPort;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the default remote username to use for deployments
|
||||
*
|
||||
* @param defaultRemoteUsername Default remote username
|
||||
*/
|
||||
public void setDefaultRemoteUsername(String defaultRemoteUsername)
|
||||
{
|
||||
this.defaultRemoteUsername = defaultRemoteUsername;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the default remote password to use for deployments
|
||||
*
|
||||
* @param defaultRemotePassword Default remote password
|
||||
*/
|
||||
public void setDefaultRemotePassword(String defaultRemotePassword)
|
||||
{
|
||||
this.defaultRemotePassword = defaultRemotePassword;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the default target name to use on file system receivers
|
||||
*
|
||||
* @param defaultTargetName Default target name
|
||||
*/
|
||||
public void setDefaultTargetName(String defaultTargetName)
|
||||
{
|
||||
this.defaultTargetName = defaultTargetName;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param service The NodeService instance
|
||||
*/
|
||||
@ -112,20 +204,12 @@ public class AVMDeploySnapshotAction extends ActionExecuterAbstractBase
|
||||
{
|
||||
paramList.add(new ParameterDefinitionImpl(PARAM_WEBSITE, DataTypeDefinition.NODE_REF, true,
|
||||
getParamDisplayLabel(PARAM_WEBSITE)));
|
||||
paramList.add(new ParameterDefinitionImpl(PARAM_TARGET_SERVER, DataTypeDefinition.TEXT, true,
|
||||
getParamDisplayLabel(PARAM_TARGET_SERVER)));
|
||||
paramList.add(new ParameterDefinitionImpl(PARAM_DEFAULT_RMI_PORT, DataTypeDefinition.INT, true,
|
||||
getParamDisplayLabel(PARAM_DEFAULT_RMI_PORT)));
|
||||
paramList.add(new ParameterDefinitionImpl(PARAM_DEFAULT_RECEIVER_RMI_PORT, DataTypeDefinition.INT, true,
|
||||
getParamDisplayLabel(PARAM_DEFAULT_RECEIVER_RMI_PORT)));
|
||||
paramList.add(new ParameterDefinitionImpl(PARAM_REMOTE_USERNAME, DataTypeDefinition.TEXT, true,
|
||||
getParamDisplayLabel(PARAM_REMOTE_USERNAME)));
|
||||
paramList.add(new ParameterDefinitionImpl(PARAM_REMOTE_PASSWORD, DataTypeDefinition.TEXT, true,
|
||||
getParamDisplayLabel(PARAM_REMOTE_PASSWORD)));
|
||||
paramList.add(new ParameterDefinitionImpl(PARAM_SERVER, DataTypeDefinition.NODE_REF, true,
|
||||
getParamDisplayLabel(PARAM_SERVER)));
|
||||
paramList.add(new ParameterDefinitionImpl(PARAM_ATTEMPT, DataTypeDefinition.NODE_REF, false,
|
||||
getParamDisplayLabel(PARAM_ATTEMPT)));
|
||||
paramList.add(new ParameterDefinitionImpl(PARAM_CALLBACK, DataTypeDefinition.ANY, false,
|
||||
getParamDisplayLabel(PARAM_CALLBACK)));
|
||||
paramList.add(new ParameterDefinitionImpl(PARAM_DELAY, DataTypeDefinition.INT, false,
|
||||
getParamDisplayLabel(PARAM_DELAY)));
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -151,40 +235,81 @@ public class AVMDeploySnapshotAction extends ActionExecuterAbstractBase
|
||||
") provided does not exist!");
|
||||
}
|
||||
|
||||
// get the NodeRef representing the server to deploy to
|
||||
NodeRef serverRef = (NodeRef)action.getParameterValue(PARAM_SERVER);
|
||||
if (this.nodeService.exists(serverRef) == false)
|
||||
{
|
||||
throw new IllegalStateException("The server NodeRef (" + serverRef +
|
||||
") provided does not exist!");
|
||||
}
|
||||
|
||||
// get the NodeRef representing the deployment attempt this one is part of
|
||||
NodeRef attemptRef = (NodeRef)action.getParameterValue(PARAM_ATTEMPT);
|
||||
|
||||
// TODO: if attempt reference is null create one now for this deployment, for now throw error
|
||||
if (this.nodeService.exists(attemptRef) == false)
|
||||
{
|
||||
throw new IllegalStateException("The attempt NodeRef (" + serverRef +
|
||||
") provided does not exist!");
|
||||
}
|
||||
|
||||
// get the callback object
|
||||
DeploymentCallback callback = (DeploymentCallback)action.getParameterValue(PARAM_CALLBACK);
|
||||
|
||||
// get the remote machine
|
||||
String targetServer = (String)action.getParameterValue(PARAM_TARGET_SERVER);
|
||||
String remoteUsername = (String)action.getParameterValue(PARAM_REMOTE_USERNAME);
|
||||
String remotePassword = (String)action.getParameterValue(PARAM_REMOTE_PASSWORD);
|
||||
int defaultAlfRmiPort = (Integer)action.getParameterValue(PARAM_DEFAULT_RMI_PORT);
|
||||
int defaultReceiverRmiPort = (Integer)action.getParameterValue(PARAM_DEFAULT_RECEIVER_RMI_PORT);
|
||||
int delay = -1;
|
||||
if (action.getParameterValue(PARAM_DELAY) != null)
|
||||
{
|
||||
delay = (Integer)action.getParameterValue(PARAM_DELAY);
|
||||
}
|
||||
// get the other data from the deploymentserver object
|
||||
Map<QName, Serializable> serverProps = nodeService.getProperties(serverRef);
|
||||
String serverUri = calculateServerUri(serverProps);
|
||||
String host = (String)serverProps.get(WCMAppModel.PROP_DEPLOYSERVERHOST);
|
||||
Integer port = (Integer)serverProps.get(WCMAppModel.PROP_DEPLOYSERVERPORT);
|
||||
String remoteUsername = (String)serverProps.get(WCMAppModel.PROP_DEPLOYSERVERUSERNAME);
|
||||
String remotePassword = (String)serverProps.get(WCMAppModel.PROP_DEPLOYSERVERPASSWORD);
|
||||
boolean fileServerDeployment = WCMAppModel.CONSTRAINT_FILEDEPLOY.equals(
|
||||
serverProps.get(WCMAppModel.PROP_DEPLOYTYPE));
|
||||
String sourcePath = (String)serverProps.get(WCMAppModel.PROP_DEPLOYSOURCEPATH);
|
||||
String targetName = (String)serverProps.get(WCMAppModel.PROP_DEPLOYSERVERTARGET);
|
||||
String targetPath = path;
|
||||
|
||||
// determine whether this is a file server or Alfresco server deployment
|
||||
boolean fileServerDeployment = false;
|
||||
if (targetServer.startsWith(FILE_SERVER_PREFIX))
|
||||
{
|
||||
fileServerDeployment = true;
|
||||
}
|
||||
// TODO: determine if we need to deploy a subfolder of the website
|
||||
|
||||
if (fileServerDeployment == false)
|
||||
{
|
||||
// if "localhost" is passed as the target server add "live" to the end of the
|
||||
// store name, this store will then get created automatically.
|
||||
String targetPath = null;
|
||||
if (targetServer.equalsIgnoreCase("localhost") || targetServer.equalsIgnoreCase("127.0.0.1"))
|
||||
|
||||
// TODO: Check that the actual host name of the machine hasn't been passed
|
||||
|
||||
if (port == null && (host.equalsIgnoreCase("localhost") || host.equalsIgnoreCase("127.0.0.1")))
|
||||
{
|
||||
targetPath = storePath[0] + "live:" + storePath[1];
|
||||
}
|
||||
}
|
||||
|
||||
// get defaults for data not provided in server node
|
||||
if (port == null)
|
||||
{
|
||||
if (fileServerDeployment)
|
||||
{
|
||||
port = this.defaultReceiverRmiPort;
|
||||
}
|
||||
else
|
||||
{
|
||||
// TODO: Check that the actual host name of the machine hasn't been passed
|
||||
port = this.defaultAlfRmiPort;
|
||||
}
|
||||
}
|
||||
|
||||
targetPath = path;
|
||||
if (remoteUsername == null || remoteUsername.length() == 0)
|
||||
{
|
||||
remoteUsername = this.defaultRemoteUsername;
|
||||
}
|
||||
|
||||
if (remotePassword == null || remotePassword.length() == 0)
|
||||
{
|
||||
remotePassword = this.defaultRemotePassword;
|
||||
}
|
||||
|
||||
if (targetName == null || targetName.length() == 0)
|
||||
{
|
||||
targetName = this.defaultTargetName;
|
||||
}
|
||||
|
||||
// take a note of the current date/time
|
||||
@ -192,7 +317,7 @@ public class AVMDeploySnapshotAction extends ActionExecuterAbstractBase
|
||||
|
||||
if (logger.isDebugEnabled())
|
||||
logger.debug("Starting deployment of " + actionedUponNodeRef.toString() +
|
||||
" to " + targetServer + " at " + startDate);
|
||||
" to " + serverUri + " at " + startDate);
|
||||
|
||||
if (delayDeploymentLogger.isDebugEnabled() && delay > 0)
|
||||
{
|
||||
@ -207,45 +332,23 @@ public class AVMDeploySnapshotAction extends ActionExecuterAbstractBase
|
||||
DeploymentReport report = null;
|
||||
try
|
||||
{
|
||||
String host = targetServer;
|
||||
int port = defaultAlfRmiPort;
|
||||
if (fileServerDeployment)
|
||||
{
|
||||
port = defaultReceiverRmiPort;
|
||||
}
|
||||
|
||||
// check whether there is a port number present, if so, use it
|
||||
int idx = targetServer.indexOf(":");
|
||||
if (idx != -1)
|
||||
{
|
||||
host = targetServer.substring(0, idx);
|
||||
String strPort = targetServer.substring(idx+1);
|
||||
port = Integer.parseInt(strPort);
|
||||
}
|
||||
|
||||
// TODO: we need to capture username/password for the remote server at some
|
||||
// point, for now we use the configured username/password for all servers
|
||||
|
||||
// call the appropriate method to deploy
|
||||
if (fileServerDeployment)
|
||||
{
|
||||
// remove the prefixed \\
|
||||
host = host.substring(FILE_SERVER_PREFIX.length());
|
||||
|
||||
if (logger.isDebugEnabled())
|
||||
logger.debug("Performing file server deployment to " + host + ":" + port);
|
||||
|
||||
// TODO Added new NameMatcher parameter to deploy methods. It acts as a filter.
|
||||
// TODO: Added new NameMatcher parameter to deploy methods. It acts as a filter.
|
||||
// Any matching path names are ignored for deployment purposes.
|
||||
report = this.deployService.deployDifferenceFS(version, path, host, port,
|
||||
remoteUsername, remotePassword, "default", null, true, false, false, callback);
|
||||
remoteUsername, remotePassword, targetName, null, true, false, false, callback);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (logger.isDebugEnabled())
|
||||
logger.debug("Performing Alfresco deployment to " + host + ":" + port);
|
||||
|
||||
// TODO Added new NameMatcher parameter to deploy methods. It acts as a filter.
|
||||
// TODO: Added new NameMatcher parameter to deploy methods. It acts as a filter.
|
||||
// Any matching path names are ignored for deployment purposes.
|
||||
report = this.deployService.deployDifference(version, path, host, port,
|
||||
remoteUsername, remotePassword, targetPath, null, true, false, false, callback);
|
||||
@ -279,16 +382,17 @@ public class AVMDeploySnapshotAction extends ActionExecuterAbstractBase
|
||||
if (report != null)
|
||||
{
|
||||
if (logger.isDebugEnabled())
|
||||
logger.debug("Differences successfully applied to " + targetServer);
|
||||
logger.debug("Differences successfully applied to " + serverUri);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (logger.isDebugEnabled())
|
||||
logger.debug("Failed to apply differences to " + targetServer);
|
||||
logger.debug("Failed to apply differences to " + serverUri);
|
||||
}
|
||||
|
||||
// create the deployment report node
|
||||
createDeploymentReportNode(report, targetServer, version, websiteRef, startDate, deployError);
|
||||
createDeploymentReportNode(report, attemptRef, serverProps, version,
|
||||
websiteRef, startDate, deployError);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -296,7 +400,8 @@ public class AVMDeploySnapshotAction extends ActionExecuterAbstractBase
|
||||
*
|
||||
* @param report The DeploymentReport result from the deploy,
|
||||
* will be null if the deploy failed
|
||||
* @param targetServer The server the deploy was going to
|
||||
* @param attempt NodeRef of the attempt the deploy was part of
|
||||
* @param serverProps The properties of the server the deploy was going to
|
||||
* @param version The version of the site bebing deployed (the snapshot)
|
||||
* @param websiteRef The NodeRef of the folder representing the website
|
||||
* @param startDate The date/time the deployment started
|
||||
@ -304,30 +409,38 @@ public class AVMDeploySnapshotAction extends ActionExecuterAbstractBase
|
||||
* deployment was successful
|
||||
* @return The created deployment report NodeRef
|
||||
*/
|
||||
private NodeRef createDeploymentReportNode(DeploymentReport report, String targetServer,
|
||||
int version, NodeRef websiteRef, Date startDate, Throwable error)
|
||||
private NodeRef createDeploymentReportNode(DeploymentReport report, NodeRef attempt,
|
||||
Map<QName, Serializable> serverProps, int version, NodeRef websiteRef,
|
||||
Date startDate, Throwable error)
|
||||
{
|
||||
NodeRef reportRef = null;
|
||||
|
||||
// remove illegal chars from the target server name to create the report name
|
||||
String reportName = targetServer.replace(':', '_').replace('\\', '_') +
|
||||
" deployment report.txt";
|
||||
String serverUri = calculateServerUri(serverProps);
|
||||
Map<QName, Serializable> reportProps = new HashMap<QName, Serializable>(4, 1.0f);
|
||||
reportProps.put(WCMAppModel.PROP_DEPLOYSERVER, serverUri);
|
||||
reportProps.put(WCMAppModel.PROP_DEPLOYVERSION, version);
|
||||
reportProps.put(WCMAppModel.PROP_DEPLOYSTARTTIME, startDate);
|
||||
reportProps.put(WCMAppModel.PROP_DEPLOYENDTIME, new Date());
|
||||
reportProps.put(WCMAppModel.PROP_DEPLOYSERVERNAMEUSED,
|
||||
serverProps.get(WCMAppModel.PROP_DEPLOYSERVERNAME));
|
||||
reportProps.put(WCMAppModel.PROP_DEPLOYSERVERUSERNAMEUSED,
|
||||
serverProps.get(WCMAppModel.PROP_DEPLOYSERVERUSERNAME));
|
||||
reportProps.put(WCMAppModel.PROP_DEPLOYSERVERTARGETUSED,
|
||||
serverProps.get(WCMAppModel.PROP_DEPLOYSERVERTARGET));
|
||||
reportProps.put(WCMAppModel.PROP_DEPLOYSOURCEPATHUSED,
|
||||
serverProps.get(WCMAppModel.PROP_DEPLOYSOURCEPATH));
|
||||
reportProps.put(WCMAppModel.PROP_DEPLOYSERVERURLUSED,
|
||||
serverProps.get(WCMAppModel.PROP_DEPLOYSERVERURL));
|
||||
|
||||
Map<QName, Serializable> props = new HashMap<QName, Serializable>(4, 1.0f);
|
||||
props.put(ContentModel.PROP_NAME, reportName);
|
||||
props.put(WCMAppModel.PROP_DEPLOYSERVER, targetServer);
|
||||
props.put(WCMAppModel.PROP_DEPLOYVERSION, version);
|
||||
props.put(WCMAppModel.PROP_DEPLOYSTARTTIME, startDate);
|
||||
props.put(WCMAppModel.PROP_DEPLOYENDTIME, new Date());
|
||||
props.put(WCMAppModel.PROP_DEPLOYSUCCESSFUL, (report != null));
|
||||
reportProps.put(WCMAppModel.PROP_DEPLOYSUCCESSFUL, (report != null));
|
||||
if (report == null && error != null)
|
||||
{
|
||||
// add error message as fail reason if appropriate
|
||||
props.put(WCMAppModel.PROP_DEPLOYFAILEDREASON, error.getMessage());
|
||||
reportProps.put(WCMAppModel.PROP_DEPLOYFAILEDREASON, error.getMessage());
|
||||
}
|
||||
reportRef = this.nodeService.createNode(websiteRef,
|
||||
WCMAppModel.ASSOC_DEPLOYMENTREPORT, WCMAppModel.ASSOC_DEPLOYMENTREPORT,
|
||||
WCMAppModel.TYPE_DEPLOYMENTREPORT, props).getChildRef();
|
||||
reportRef = this.nodeService.createNode(attempt,
|
||||
WCMAppModel.ASSOC_DEPLOYMENTREPORTS, WCMAppModel.ASSOC_DEPLOYMENTREPORT,
|
||||
WCMAppModel.TYPE_DEPLOYMENTREPORT, reportProps).getChildRef();
|
||||
ContentWriter writer = contentService.getWriter(reportRef, ContentModel.PROP_CONTENT, true);
|
||||
writer.setMimetype(MimetypeMap.MIMETYPE_TEXT_PLAIN);
|
||||
writer.setEncoding("UTF-8");
|
||||
@ -363,8 +476,8 @@ public class AVMDeploySnapshotAction extends ActionExecuterAbstractBase
|
||||
}
|
||||
|
||||
if (logger.isDebugEnabled())
|
||||
logger.debug("Created deplyoment report node (" + reportRef + ") for targetServer " +
|
||||
targetServer);
|
||||
logger.debug("Created deplyoment report node (" + reportRef + ") for server " +
|
||||
serverUri);
|
||||
|
||||
return reportRef;
|
||||
}
|
||||
|
@ -51,4 +51,5 @@ public class SandboxConstants
|
||||
public final static QName PROP_AUTHOR_NAME = QName.createQName(null, ".author.name");
|
||||
public final static QName PROP_WEB_PROJECT_NODE_REF = QName.createQName(null, ".web_project.noderef");
|
||||
public final static QName PROP_LINK_VALIDATION_REPORT = QName.createQName(null, ".link.validation.report");
|
||||
public final static QName PROP_LAST_DEPLOYMENT_ID = QName.createQName(null, ".deployment.id");
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user