Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 158483 Details for
Bug 302160
Simple download statistics
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
Download statistics implementation
patch.txt (text/plain), 3.19 KB, created by
John Arthorne
on 2010-02-08 11:28:27 EST
(
hide
)
Description:
Download statistics implementation
Filename:
MIME Type:
Creator:
John Arthorne
Created:
2010-02-08 11:28:27 EST
Size:
3.19 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.equinox.p2.artifact.repository >Index: src/org/eclipse/equinox/internal/p2/artifact/repository/MirrorRequest.java >=================================================================== >RCS file: /cvsroot/rt/org.eclipse.equinox/p2/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/MirrorRequest.java,v >retrieving revision 1.34 >diff -u -r1.34 MirrorRequest.java >--- src/org/eclipse/equinox/internal/p2/artifact/repository/MirrorRequest.java 13 Jan 2010 17:20:47 -0000 1.34 >+++ src/org/eclipse/equinox/internal/p2/artifact/repository/MirrorRequest.java 8 Feb 2010 16:28:09 -0000 >@@ -12,15 +12,18 @@ > *******************************************************************************/ > package org.eclipse.equinox.internal.p2.artifact.repository; > >-import org.eclipse.equinox.p2.core.ProvisionException; >- > import java.io.*; >+import java.net.URI; >+import java.net.URISyntaxException; > import java.util.HashMap; > import java.util.Map; > import org.eclipse.core.runtime.*; > import org.eclipse.equinox.internal.p2.artifact.repository.simple.SimpleArtifactDescriptor; >+import org.eclipse.equinox.internal.p2.core.helpers.LogHelper; >+import org.eclipse.equinox.internal.p2.repository.RepositoryTransport; > import org.eclipse.equinox.internal.provisional.p2.artifact.repository.processing.ProcessingStepHandler; > import org.eclipse.equinox.internal.provisional.p2.repository.IStateful; >+import org.eclipse.equinox.p2.core.ProvisionException; > import org.eclipse.equinox.p2.metadata.IArtifactKey; > import org.eclipse.equinox.p2.repository.artifact.IArtifactDescriptor; > import org.eclipse.equinox.p2.repository.artifact.IArtifactRepository; >@@ -160,9 +163,35 @@ > do { > status = transferSingle(destinationDescriptor, sourceDescriptor, monitor); > } while (status.getSeverity() == IStatus.ERROR && status.getCode() == IArtifactRepository.CODE_RETRY); >+ if (status.isOK()) >+ collectStats(sourceDescriptor, monitor); > return status; > } > >+ /** >+ * Collect download statistics, if specified by the descriptor and the source repository >+ */ >+ private void collectStats(IArtifactDescriptor descriptor, IProgressMonitor monitor) { >+ final String statsProperty = descriptor.getProperty("download.stats"); >+ if (statsProperty == null) >+ return; >+ String statsRoot = descriptor.getRepository().getProperties().get("stats.url"); >+ if (statsRoot == null) >+ return; >+ URI statsURI; >+ try { >+ statsURI = URIUtil.append(new URI(statsRoot), statsProperty); >+ } catch (URISyntaxException e) { >+ LogHelper.log(new Status(IStatus.WARNING, Activator.ID, "Unable to report download statistics due to invalid URL: " + statsRoot + " suffix: " + statsProperty)); >+ return; >+ } >+ try { >+ RepositoryTransport.getInstance().getLastModified(statsURI, monitor); >+ } catch (Exception e) { >+ LogHelper.log(new Status(IStatus.WARNING, Activator.ID, "Failure reporting download statistics to URL: " + statsURI, e)); >+ } >+ } >+ > private IStatus transferSingle(IArtifactDescriptor destinationDescriptor, IArtifactDescriptor sourceDescriptor, IProgressMonitor monitor) { > OutputStream destination; > try {
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 302160
: 158483