ProjectPackageList remoteProjectPackageList, List<String> remoteEnabledComponentTypes,
IProgressMonitor monitor) throws InterruptedException {
DeploymentComponentSet deploymentComponentSet = new DeploymentComponentSet();
// local package does not exist remotely, assume all local components are new
ProjectPackage remoteProjectPackage =
remoteProjectPackageList.getProjectPackage(localProjectPackage.getName(), false);
ComponentList localComponentList = localProjectPackage.getComponentList();
// no corresponding package found in destination org
if (remoteProjectPackage == null) {
if (logger.isInfoEnabled()) {
logger.info("Remote package '" + localProjectPackage.getName()
+ "' not found. Assuming all local components [" + localComponentList.size()
+ "] in package '" + localProjectPackage.getName() + "' are new.");
}
// create deployment candidate for each local component
for (Component localComponent : localComponentList) {
DeploymentComponent deploymentComponent =
createNewDeploymentComponent(localComponent, remoteEnabledComponentTypes);
deploymentComponent.setRemoteFound(false);
// if packaged content, check against retrieved non-package stuff to determine if the component
// exists in the destination, but is not packaged.
if (!localComponent.isPackageManifest() && Utils.isNotEmpty(localProjectPackage.getName())
&& !Constants.DEFAULT_PACKAGED_NAME.equals(localProjectPackage.getName())) {
Component remoteComponent =
remoteProjectPackageList.getComponentByFilePath(localComponent.getMetadataFilePath());
if (remoteComponent != null) {
initDeploymentComponent(deploymentComponent, localComponent, remoteComponent, monitor);
deploymentComponent.setRemoteFound(true);
}
}
boolean added = deploymentComponentSet.add(deploymentComponent, false);
if (added) {
if (logger.isDebugEnabled()) {
logger.debug("Added " + deploymentComponent.getFullDisplayName() + " to deployment set");
}
} else {
if (logger.isDebugEnabled()) {
logger.debug(deploymentComponent.getDisplayName() + " already exists in deployment set");
}
}
}
if (logger.isDebugEnabled()) {
logger.debug("Added [" + deploymentComponentSet.size() + "] deployment components to set");
}
} else {
// found package in destination org
// deep equal check on same-named project package
remoteComponentList = localProjectPackage.getComponentListInstance();
remoteComponentList.addAll(remoteProjectPackage.getComponentList());
if (logger.isDebugEnabled()) {
logger.debug("Comparing all components in local [" + localComponentList.size() + "] and remote ["
+ remoteComponentList.size() + "] package '" + localProjectPackage.getName() + "'");
}