mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Point checkin.
Support for notification to virt server on dialog-driven revert operations. No support yet for workflow-diriven revert notification (coming soon). Details ------- root/projects/catalina-virtual/source/java/org/alfresco/catalina/host/AVMHostConfig.java Minor logging cleanup root/projects/core/source/java/org/alfresco/util/VirtServerUtils.java Trigger notification on submits of entire dirs: WEB-INF, WEB-INF/classes, WEB-INF/lib (not just files within them) root/projects/web-client/source/java/org/alfresco/web/bean/wcm/AVMBrowseBean.java notify virt server on revert root/projects/web-client/source/java/org/alfresco/web/bean/wcm/RevertAllDialog.java notify virt server on revert all root/projects/web-client/source/java/org/alfresco/web/bean/wcm/RevertSelectedDialog.java notify virt server on revert selected root/projects/web-client/source/java/org/alfresco/web/bean/wcm/SubmitDialog.java minor cleanup root/projects/web-client/source/web/WEB-INF/faces-config-beans.xml Injecting AVMSyncService into AVMBrowseBean to allow virt server notification to occur only when a comparison between reverted versions shows it's absolutely necessary git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@5030 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -41,6 +41,8 @@ import org.alfresco.service.cmr.action.Action;
|
|||||||
import org.alfresco.service.cmr.action.ActionService;
|
import org.alfresco.service.cmr.action.ActionService;
|
||||||
import org.alfresco.service.cmr.avm.AVMNodeDescriptor;
|
import org.alfresco.service.cmr.avm.AVMNodeDescriptor;
|
||||||
import org.alfresco.service.cmr.avm.AVMService;
|
import org.alfresco.service.cmr.avm.AVMService;
|
||||||
|
import org.alfresco.service.cmr.avmsync.AVMDifference;
|
||||||
|
import org.alfresco.service.cmr.avmsync.AVMSyncService;
|
||||||
import org.alfresco.service.cmr.avm.AVMStoreDescriptor;
|
import org.alfresco.service.cmr.avm.AVMStoreDescriptor;
|
||||||
import org.alfresco.service.cmr.repository.NodeService;
|
import org.alfresco.service.cmr.repository.NodeService;
|
||||||
import org.alfresco.service.cmr.workflow.WorkflowService;
|
import org.alfresco.service.cmr.workflow.WorkflowService;
|
||||||
@@ -70,6 +72,8 @@ import org.alfresco.web.ui.wcm.component.UIUserSandboxes;
|
|||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
import org.apache.commons.logging.LogFactory;
|
import org.apache.commons.logging.LogFactory;
|
||||||
|
|
||||||
|
import org.alfresco.util.VirtServerUtils;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Bean backing up the AVM specific browse screens
|
* Bean backing up the AVM specific browse screens
|
||||||
*
|
*
|
||||||
@@ -156,6 +160,9 @@ public class AVMBrowseBean implements IContextListener
|
|||||||
/** AVM service bean reference */
|
/** AVM service bean reference */
|
||||||
protected AVMService avmService;
|
protected AVMService avmService;
|
||||||
|
|
||||||
|
/** AVM sync service bean reference */
|
||||||
|
protected AVMSyncService avmSyncService;
|
||||||
|
|
||||||
/** Action service bean reference */
|
/** Action service bean reference */
|
||||||
protected ActionService actionService;
|
protected ActionService actionService;
|
||||||
|
|
||||||
@@ -179,6 +186,14 @@ public class AVMBrowseBean implements IContextListener
|
|||||||
this.avmService = avmService;
|
this.avmService = avmService;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param avmSyncService The AVMSyncService to set.
|
||||||
|
*/
|
||||||
|
public void setAvmSyncService(AVMSyncService avmSyncService)
|
||||||
|
{
|
||||||
|
this.avmSyncService = avmSyncService;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param nodeService The NodeService to set.
|
* @param nodeService The NodeService to set.
|
||||||
*/
|
*/
|
||||||
@@ -874,6 +889,14 @@ public class AVMBrowseBean implements IContextListener
|
|||||||
// commit the transaction
|
// commit the transaction
|
||||||
tx.commit();
|
tx.commit();
|
||||||
|
|
||||||
|
// possibly update webapp after commit
|
||||||
|
|
||||||
|
if ( VirtServerUtils.requiresUpdateNotification( path ) )
|
||||||
|
{
|
||||||
|
AVMConstants.updateVServerWebapp(path, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// if we get here, all was well - output friendly status message to the user
|
// if we get here, all was well - output friendly status message to the user
|
||||||
String msg = MessageFormat.format(Application.getMessage(
|
String msg = MessageFormat.format(Application.getMessage(
|
||||||
context, MSG_REVERT_SUCCESS), node.getName());
|
context, MSG_REVERT_SUCCESS), node.getName());
|
||||||
@@ -906,6 +929,12 @@ public class AVMBrowseBean implements IContextListener
|
|||||||
tx = Repository.getUserTransaction(context, false);
|
tx = Repository.getUserTransaction(context, false);
|
||||||
tx.begin();
|
tx.begin();
|
||||||
|
|
||||||
|
String sandboxPath = AVMConstants.buildSandboxRootPath( sandbox );
|
||||||
|
|
||||||
|
List<AVMDifference> diffs =
|
||||||
|
this.avmSyncService.compare(
|
||||||
|
-1,sandboxPath,Integer.valueOf(strVersion),sandboxPath,null);
|
||||||
|
|
||||||
Map<String, Serializable> args = new HashMap<String, Serializable>(1, 1.0f);
|
Map<String, Serializable> args = new HashMap<String, Serializable>(1, 1.0f);
|
||||||
args.put(AVMRevertStoreAction.PARAM_VERSION, Integer.valueOf(strVersion));
|
args.put(AVMRevertStoreAction.PARAM_VERSION, Integer.valueOf(strVersion));
|
||||||
Action action = this.actionService.createAction(AVMRevertStoreAction.NAME, args);
|
Action action = this.actionService.createAction(AVMRevertStoreAction.NAME, args);
|
||||||
@@ -914,6 +943,18 @@ public class AVMBrowseBean implements IContextListener
|
|||||||
// commit the transaction
|
// commit the transaction
|
||||||
tx.commit();
|
tx.commit();
|
||||||
|
|
||||||
|
// See if any of the files being reverted require
|
||||||
|
// notification of the virt server.
|
||||||
|
|
||||||
|
for (AVMDifference diff : diffs)
|
||||||
|
{
|
||||||
|
if ( VirtServerUtils.requiresUpdateNotification( diff.getSourcePath()) )
|
||||||
|
{
|
||||||
|
AVMConstants.updateVServerWebapp(diff.getSourcePath() , true);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// if we get here, all was well - output friendly status message to the user
|
// if we get here, all was well - output friendly status message to the user
|
||||||
String msg = MessageFormat.format(Application.getMessage(
|
String msg = MessageFormat.format(Application.getMessage(
|
||||||
context, MSG_REVERT_SANDBOX), sandbox, strVersion);
|
context, MSG_REVERT_SANDBOX), sandbox, strVersion);
|
||||||
|
@@ -26,8 +26,8 @@ import java.util.Map;
|
|||||||
import javax.faces.application.FacesMessage;
|
import javax.faces.application.FacesMessage;
|
||||||
import javax.faces.context.FacesContext;
|
import javax.faces.context.FacesContext;
|
||||||
|
|
||||||
import org.alfresco.repo.avm.AVMNodeConverter;
|
|
||||||
import org.alfresco.repo.avm.actions.AVMUndoSandboxListAction;
|
import org.alfresco.repo.avm.actions.AVMUndoSandboxListAction;
|
||||||
|
import org.alfresco.repo.avm.AVMNodeConverter;
|
||||||
import org.alfresco.service.cmr.action.Action;
|
import org.alfresco.service.cmr.action.Action;
|
||||||
import org.alfresco.service.cmr.action.ActionService;
|
import org.alfresco.service.cmr.action.ActionService;
|
||||||
import org.alfresco.service.cmr.avm.AVMNodeDescriptor;
|
import org.alfresco.service.cmr.avm.AVMNodeDescriptor;
|
||||||
@@ -36,6 +36,7 @@ import org.alfresco.service.cmr.avmsync.AVMDifference;
|
|||||||
import org.alfresco.service.cmr.avmsync.AVMSyncService;
|
import org.alfresco.service.cmr.avmsync.AVMSyncService;
|
||||||
import org.alfresco.util.NameMatcher;
|
import org.alfresco.util.NameMatcher;
|
||||||
import org.alfresco.util.Pair;
|
import org.alfresco.util.Pair;
|
||||||
|
import org.alfresco.util.VirtServerUtils;
|
||||||
import org.alfresco.web.app.Application;
|
import org.alfresco.web.app.Application;
|
||||||
import org.alfresco.web.bean.dialog.BaseDialogBean;
|
import org.alfresco.web.bean.dialog.BaseDialogBean;
|
||||||
|
|
||||||
@@ -53,6 +54,13 @@ public class RevertAllDialog extends BaseDialogBean
|
|||||||
protected ActionService actionService;
|
protected ActionService actionService;
|
||||||
protected NameMatcher nameMatcher;
|
protected NameMatcher nameMatcher;
|
||||||
|
|
||||||
|
// The virtualization server might need to be notified
|
||||||
|
// because one or more of the files reverted could alter
|
||||||
|
// the behavior the virtual webapp in the target of the submit.
|
||||||
|
|
||||||
|
private String virtUpdatePath;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param avmBrowseBean The AVM BrowseBean to set
|
* @param avmBrowseBean The AVM BrowseBean to set
|
||||||
*/
|
*/
|
||||||
@@ -99,11 +107,22 @@ public class RevertAllDialog extends BaseDialogBean
|
|||||||
// calcluate the list of differences between the user store and the staging area
|
// calcluate the list of differences between the user store and the staging area
|
||||||
List<AVMDifference> diffs = this.avmSyncService.compare(
|
List<AVMDifference> diffs = this.avmSyncService.compare(
|
||||||
-1, userStore, -1, stagingStore, this.nameMatcher);
|
-1, userStore, -1, stagingStore, this.nameMatcher);
|
||||||
|
|
||||||
List<Pair<Integer, String>> versionPaths = new ArrayList<Pair<Integer, String>>();
|
List<Pair<Integer, String>> versionPaths = new ArrayList<Pair<Integer, String>>();
|
||||||
|
|
||||||
for (AVMDifference diff : diffs)
|
for (AVMDifference diff : diffs)
|
||||||
{
|
{
|
||||||
versionPaths.add(new Pair<Integer, String>(-1, diff.getSourcePath()));
|
String revertPath = diff.getSourcePath();
|
||||||
|
versionPaths.add(new Pair<Integer, String>(-1, revertPath) );
|
||||||
|
|
||||||
|
if ( (this.virtUpdatePath == null) &&
|
||||||
|
VirtServerUtils.requiresUpdateNotification(revertPath)
|
||||||
|
)
|
||||||
|
{
|
||||||
|
this.virtUpdatePath = revertPath;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Map<String, Serializable> args = new HashMap<String, Serializable>(1, 1.0f);
|
Map<String, Serializable> args = new HashMap<String, Serializable>(1, 1.0f);
|
||||||
args.put(AVMUndoSandboxListAction.PARAM_NODE_LIST, (Serializable)versionPaths);
|
args.put(AVMUndoSandboxListAction.PARAM_NODE_LIST, (Serializable)versionPaths);
|
||||||
Action action = this.actionService.createAction(AVMUndoSandboxListAction.NAME, args);
|
Action action = this.actionService.createAction(AVMUndoSandboxListAction.NAME, args);
|
||||||
@@ -117,6 +136,22 @@ public class RevertAllDialog extends BaseDialogBean
|
|||||||
return outcome;
|
return outcome;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handle notification to the virtualization server
|
||||||
|
* (this needs to occur after the sandbox is updated).
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
protected String doPostCommitProcessing(FacesContext context, String outcome)
|
||||||
|
{
|
||||||
|
// Force the update because we've already determined
|
||||||
|
// that update_path requires virt server notification.
|
||||||
|
if (this.virtUpdatePath != null)
|
||||||
|
{
|
||||||
|
AVMConstants.updateVServerWebapp(this.virtUpdatePath, true);
|
||||||
|
}
|
||||||
|
return outcome;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the confirmation to display to the user
|
* @return the confirmation to display to the user
|
||||||
*/
|
*/
|
||||||
|
@@ -35,6 +35,7 @@ import org.alfresco.service.cmr.avm.AVMService;
|
|||||||
import org.alfresco.util.Pair;
|
import org.alfresco.util.Pair;
|
||||||
import org.alfresco.web.app.Application;
|
import org.alfresco.web.app.Application;
|
||||||
import org.alfresco.web.bean.dialog.BaseDialogBean;
|
import org.alfresco.web.bean.dialog.BaseDialogBean;
|
||||||
|
import org.alfresco.util.VirtServerUtils;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Revert (undo) the selected files in the current user sandbox.
|
* Revert (undo) the selected files in the current user sandbox.
|
||||||
@@ -48,6 +49,14 @@ public class RevertSelectedDialog extends BaseDialogBean
|
|||||||
protected AVMBrowseBean avmBrowseBean;
|
protected AVMBrowseBean avmBrowseBean;
|
||||||
protected ActionService actionService;
|
protected ActionService actionService;
|
||||||
|
|
||||||
|
// The virtualization server might need to be notified
|
||||||
|
// because one or more of the files reverted could alter
|
||||||
|
// the behavior the virtual webapp in the target of the submit.
|
||||||
|
|
||||||
|
private String virtUpdatePath;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param avmBrowseBean The AVM BrowseBean to set
|
* @param avmBrowseBean The AVM BrowseBean to set
|
||||||
*/
|
*/
|
||||||
@@ -73,10 +82,21 @@ public class RevertSelectedDialog extends BaseDialogBean
|
|||||||
{
|
{
|
||||||
List<AVMNodeDescriptor> selected = this.avmBrowseBean.getSelectedSandboxItems();
|
List<AVMNodeDescriptor> selected = this.avmBrowseBean.getSelectedSandboxItems();
|
||||||
List<Pair<Integer, String>> versionPaths = new ArrayList<Pair<Integer, String>>();
|
List<Pair<Integer, String>> versionPaths = new ArrayList<Pair<Integer, String>>();
|
||||||
|
|
||||||
|
|
||||||
for (AVMNodeDescriptor node : selected)
|
for (AVMNodeDescriptor node : selected)
|
||||||
{
|
{
|
||||||
versionPaths.add(new Pair<Integer, String>(-1, node.getPath()));
|
String revertPath = node.getPath();
|
||||||
|
versionPaths.add(new Pair<Integer, String>(-1, revertPath ));
|
||||||
|
|
||||||
|
if ( (this.virtUpdatePath == null) &&
|
||||||
|
VirtServerUtils.requiresUpdateNotification(revertPath)
|
||||||
|
)
|
||||||
|
{
|
||||||
|
this.virtUpdatePath = revertPath;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Map<String, Serializable> args = new HashMap<String, Serializable>(1, 1.0f);
|
Map<String, Serializable> args = new HashMap<String, Serializable>(1, 1.0f);
|
||||||
args.put(AVMUndoSandboxListAction.PARAM_NODE_LIST, (Serializable)versionPaths);
|
args.put(AVMUndoSandboxListAction.PARAM_NODE_LIST, (Serializable)versionPaths);
|
||||||
for (AVMNodeDescriptor node : selected)
|
for (AVMNodeDescriptor node : selected)
|
||||||
@@ -93,6 +113,24 @@ public class RevertSelectedDialog extends BaseDialogBean
|
|||||||
return outcome;
|
return outcome;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handle notification to the virtualization server
|
||||||
|
* (this needs to occur after the sandbox is updated).
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
protected String doPostCommitProcessing(FacesContext context, String outcome)
|
||||||
|
{
|
||||||
|
// Force the update because we've already determined
|
||||||
|
// that update_path requires virt server notification.
|
||||||
|
if (this.virtUpdatePath != null)
|
||||||
|
{
|
||||||
|
AVMConstants.updateVServerWebapp(this.virtUpdatePath, true);
|
||||||
|
}
|
||||||
|
return outcome;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the confirmation to display to the user
|
* @return the confirmation to display to the user
|
||||||
*/
|
*/
|
||||||
|
@@ -326,9 +326,6 @@ public class SubmitDialog extends BaseDialogBean
|
|||||||
String stagingPath = AVMConstants.buildSandboxRootPath(this.avmBrowseBean.getStagingStore());
|
String stagingPath = AVMConstants.buildSandboxRootPath(this.avmBrowseBean.getStagingStore());
|
||||||
List<AVMDifference> diffs = new ArrayList<AVMDifference>(items.size());
|
List<AVMDifference> diffs = new ArrayList<AVMDifference>(items.size());
|
||||||
|
|
||||||
// flag indicating if virt server update is already implied
|
|
||||||
boolean updateVserver = false;
|
|
||||||
|
|
||||||
for (ItemWrapper wrapper : items)
|
for (ItemWrapper wrapper : items)
|
||||||
{
|
{
|
||||||
String srcPath = sandboxPath + wrapper.getPath();
|
String srcPath = sandboxPath + wrapper.getPath();
|
||||||
@@ -339,19 +336,14 @@ public class SubmitDialog extends BaseDialogBean
|
|||||||
// If nothing has required notifying the virtualization server
|
// If nothing has required notifying the virtualization server
|
||||||
// so far, check to see if destPath forces a notification
|
// so far, check to see if destPath forces a notification
|
||||||
// (e.g.: it might be a path to a jar file within WEB-INF/lib).
|
// (e.g.: it might be a path to a jar file within WEB-INF/lib).
|
||||||
if (!updateVserver)
|
|
||||||
{
|
if ( (this.virtUpdatePath == null) &&
|
||||||
// Examples of destPath that require virt server notification:
|
VirtServerUtils.requiresUpdateNotification( destPath )
|
||||||
//
|
)
|
||||||
// mysite:/www/avm_webapps/ROOT/WEB-INF/web.xml
|
|
||||||
// mysite:/www/avm_webapps/ROOT/WEB-INF/lib/moo.jar
|
|
||||||
updateVserver = VirtServerUtils.requiresUpdateNotification( destPath );
|
|
||||||
if (updateVserver)
|
|
||||||
{
|
{
|
||||||
this.virtUpdatePath = destPath;
|
this.virtUpdatePath = destPath;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// write changes to layer so files are marked as modified
|
// write changes to layer so files are marked as modified
|
||||||
this.avmSyncService.update(diffs, null, true, true, false, false, this.label, this.comment);
|
this.avmSyncService.update(diffs, null, true, true, false, false, this.label, this.comment);
|
||||||
|
@@ -2350,6 +2350,10 @@
|
|||||||
<property-name>avmService</property-name>
|
<property-name>avmService</property-name>
|
||||||
<value>#{AVMService}</value>
|
<value>#{AVMService}</value>
|
||||||
</managed-property>
|
</managed-property>
|
||||||
|
<managed-property>
|
||||||
|
<property-name>avmSyncService</property-name>
|
||||||
|
<value>#{AVMSyncService}</value>
|
||||||
|
</managed-property>
|
||||||
<managed-property>
|
<managed-property>
|
||||||
<property-name>navigationBean</property-name>
|
<property-name>navigationBean</property-name>
|
||||||
<value>#{NavigationBean}</value>
|
<value>#{NavigationBean}</value>
|
||||||
|
Reference in New Issue
Block a user