}
// get local and remote components
monitorCheckSubTask(monitor, "Gathering project contents");
List<String> componentTypes = upgradeableComponentList.getComponentTypes();
ProjectPackageList localProjectPackageList = ContainerDelegate.getInstance().getServiceLocator().getProjectService().getComponentsForComponentTypes(
project, componentTypes.toArray(new String[componentTypes.size()]));
monitorWork(monitor);
if (Utils.isEmpty(localProjectPackageList.getAllComponents(false))) {
if (logger.isInfoEnabled()) {
logger.info("Project is empty - nothing to upgrade");
}
return;
}
monitorCheckSubTask(monitor, "Retrieving remote content for upgrade analysis");
ProjectPackageList remoteProjectPackageList = getRemoteProjectPackageList(localProjectPackageList,
new SubProgressMonitor(monitor, IProgressMonitor.UNKNOWN));
monitorWork(monitor);
if (Utils.isEmpty(localProjectPackageList)) {
if (logger.isInfoEnabled()) {
logger.info("Remote content empty - nothing to upgrade");
}
return;
}
// store to-be-upgrade components
Map<String, List<UpgradeConflict>> upgradeConflicts = new HashMap<String, List<UpgradeConflict>>();
monitorCheckSubTask(monitor, "Inspecting project contents for upgradeability");
SubProgressMonitor subMonitor = new SubProgressMonitor(monitor, IProgressMonitor.UNKNOWN);
// upgrade inspection
// upgradeability is determine by a straight diff of local vs. remote
ComponentList localComponentList = localProjectPackageList.getAllComponents();
for (Component localComponent : localComponentList) {
if (!isIncludedComponent(localComponent) || isExcludedFileExtension(localComponent)
|| localComponent.isPackageManifest()) {
if (logger.isDebugEnabled()) {
logger.debug("Excluding " + localComponent.getFullDisplayName() + " from upgrade consideration");
}
continue;
}
// upgrade analysis is a two phase process. if the first phase check, a xml validation against
// current schema, passes, the second phase checks the local and remote checksum to determine difference.
// if exist and has changed, store to be exposed in ui and later saved to project
Component remoteComponent = remoteProjectPackageList.getComponentByFilePath(localComponent
.getMetadataFilePath());
// phase 1 - validate xml against current schema
MetadataValidationEventCollector metadataValidationEventCollector = new MetadataValidationEventCollector();
MetadataExt metadataExt = null;