diff options
author | Susan McCourt | 2014-06-29 17:44:18 +0000 |
---|---|---|
committer | Susan McCourt | 2014-06-29 17:44:18 +0000 |
commit | 95022ae5fc1eafd61ba22c9ec879c2f5cd6f9246 (patch) | |
tree | 037868b3d068c17182d668431e8cc0b4b7d77405 | |
parent | 9ea8e4cc9aa6ec8ff70a4e0a811401f5c941ad68 (diff) | |
download | rt.equinox.p2-95022ae5fc1eafd61ba22c9ec879c2f5cd6f9246.tar.gz rt.equinox.p2-95022ae5fc1eafd61ba22c9ec879c2f5cd6f9246.tar.xz rt.equinox.p2-95022ae5fc1eafd61ba22c9ec879c2f5cd6f9246.zip |
Bug 436872 - [category] Specify download stats URL and type of artifactsI20140903-1100I20140902-1330I20140902-0800I20140826-0800I20140819-2200I20140819-1800I20140819-1200I20140819-0800I20140812-0800I20140806-2000I20140806-0800I20140805-2000I20140805-0800I20140804-2000I20140804-0800I20140803-2000I20140729-0800I20140722-0800I20140715-0800I20140708-0800I20140701-0800
to monitor in category.xml
Ensure that stats marking fails gracefully when artifact repository is
not specified.
Change-Id: I25b2882417d638ada39525e41e31b9523d6c2df7
-rw-r--r-- | bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/SiteXMLAction.java | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/SiteXMLAction.java b/bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/SiteXMLAction.java index 965110269..56e9e8d4b 100644 --- a/bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/SiteXMLAction.java +++ b/bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/SiteXMLAction.java @@ -31,6 +31,7 @@ import org.eclipse.equinox.p2.query.*; import org.eclipse.equinox.p2.repository.IRepository; import org.eclipse.equinox.p2.repository.IRepositoryReference; import org.eclipse.equinox.p2.repository.artifact.IArtifactDescriptor; +import org.eclipse.equinox.p2.repository.artifact.IArtifactRepository; import org.eclipse.equinox.p2.repository.artifact.spi.ArtifactDescriptor; import org.eclipse.equinox.p2.repository.spi.RepositoryReference; import org.eclipse.equinox.spi.p2.publisher.LocalizationHelper; @@ -111,10 +112,11 @@ public class SiteXMLAction extends AbstractPublisherAction { } private IStatus markStatsArtifacts(IPublisherInfo publisherInfo, IPublisherResult results, IProgressMonitor monitor) { + IArtifactRepository artifactRepo = publisherInfo.getArtifactRepository(); SiteModel site = updateSite.getSite(); // process all features listed and mark artifacts SiteFeature[] features = site.getStatsFeatures(); - if (features != null) { + if (features != null && artifactRepo != null) { for (SiteFeature feature : features) { if (monitor.isCanceled()) return Status.CANCEL_STATUS; @@ -122,7 +124,7 @@ public class SiteXMLAction extends AbstractPublisherAction { if (ius != null) { for (IInstallableUnit iu : ius) { IArtifactKey key = FeaturesAction.createFeatureArtifactKey(feature.getFeatureIdentifier(), iu.getVersion().toString()); - IArtifactDescriptor[] descriptors = publisherInfo.getArtifactRepository().getArtifactDescriptors(key); + IArtifactDescriptor[] descriptors = artifactRepo.getArtifactDescriptors(key); if (descriptors.length > 0 && descriptors[0] instanceof ArtifactDescriptor) { HashMap<String, String> map = new HashMap<String, String>(); map.put(P_STATS_MARKER, feature.getFeatureIdentifier()); @@ -132,8 +134,9 @@ public class SiteXMLAction extends AbstractPublisherAction { } } } + // process all bundles listed and mark artifacts SiteBundle[] bundles = site.getStatsBundles(); - if (bundles != null) { + if (bundles != null && artifactRepo != null) { for (SiteBundle bundle : bundles) { if (monitor.isCanceled()) return Status.CANCEL_STATUS; @@ -141,7 +144,7 @@ public class SiteXMLAction extends AbstractPublisherAction { if (ius != null) { for (IInstallableUnit iu : ius) { IArtifactKey key = BundlesAction.createBundleArtifactKey(iu.getId(), iu.getVersion().toString()); - IArtifactDescriptor[] descriptors = publisherInfo.getArtifactRepository().getArtifactDescriptors(key); + IArtifactDescriptor[] descriptors = artifactRepo.getArtifactDescriptors(key); if (descriptors.length > 0 && descriptors[0] instanceof ArtifactDescriptor) { HashMap<String, String> map = new HashMap<String, String>(); map.put(P_STATS_MARKER, iu.getId()); @@ -151,7 +154,12 @@ public class SiteXMLAction extends AbstractPublisherAction { } } } - // Process all ius that should be marked for download stat tracking + // If there was no artifact repository available and stats were to be tracked, issue + // a warning. + boolean markingBundles = bundles != null && bundles.length > 0; + boolean markingFeatures = features != null && features.length > 0; + if (artifactRepo == null && (markingBundles || markingFeatures)) + return new Status(IStatus.WARNING, Activator.ID, "Artifact repository was not specified so stats properties could not be published."); //$NON-NLS-1$ return Status.OK_STATUS; } |