|
Lines 10-32
Link Here
|
| 10 |
|
10 |
|
| 11 |
import java.io.*; |
11 |
import java.io.*; |
| 12 |
import java.lang.ref.SoftReference; |
12 |
import java.lang.ref.SoftReference; |
| 13 |
import java.net.*; |
13 |
import java.net.MalformedURLException; |
|
|
14 |
import java.net.URL; |
| 14 |
import java.util.*; |
15 |
import java.util.*; |
| 15 |
import java.util.Map.Entry; |
16 |
import java.util.Map.Entry; |
| 16 |
import javax.xml.parsers.ParserConfigurationException; |
17 |
import javax.xml.parsers.ParserConfigurationException; |
| 17 |
import org.eclipse.core.runtime.IStatus; |
18 |
import org.eclipse.core.runtime.IStatus; |
| 18 |
import org.eclipse.core.runtime.Status; |
19 |
import org.eclipse.core.runtime.Status; |
| 19 |
import org.eclipse.equinox.internal.p2.core.helpers.*; |
20 |
import org.eclipse.equinox.internal.p2.core.helpers.*; |
| 20 |
import org.eclipse.equinox.internal.provisional.p2.artifact.repository.IArtifactRepositoryManager; |
|
|
| 21 |
import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException; |
21 |
import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException; |
| 22 |
import org.eclipse.equinox.internal.provisional.p2.core.Version; |
22 |
import org.eclipse.equinox.internal.provisional.p2.core.Version; |
| 23 |
import org.eclipse.equinox.internal.provisional.p2.core.eventbus.IProvisioningEventBus; |
23 |
import org.eclipse.equinox.internal.provisional.p2.core.eventbus.IProvisioningEventBus; |
| 24 |
import org.eclipse.equinox.internal.provisional.p2.core.location.AgentLocation; |
24 |
import org.eclipse.equinox.internal.provisional.p2.core.location.AgentLocation; |
| 25 |
import org.eclipse.equinox.internal.provisional.p2.core.repository.IRepositoryManager; |
|
|
| 26 |
import org.eclipse.equinox.internal.provisional.p2.engine.*; |
25 |
import org.eclipse.equinox.internal.provisional.p2.engine.*; |
| 27 |
import org.eclipse.equinox.internal.provisional.p2.metadata.IInstallableUnit; |
26 |
import org.eclipse.equinox.internal.provisional.p2.metadata.IInstallableUnit; |
| 28 |
import org.eclipse.equinox.internal.provisional.p2.metadata.query.InstallableUnitQuery; |
27 |
import org.eclipse.equinox.internal.provisional.p2.metadata.query.InstallableUnitQuery; |
| 29 |
import org.eclipse.equinox.internal.provisional.p2.metadata.repository.IMetadataRepositoryManager; |
|
|
| 30 |
import org.eclipse.equinox.internal.provisional.p2.query.Collector; |
28 |
import org.eclipse.equinox.internal.provisional.p2.query.Collector; |
| 31 |
import org.eclipse.osgi.service.datalocation.Location; |
29 |
import org.eclipse.osgi.service.datalocation.Location; |
| 32 |
import org.eclipse.osgi.util.NLS; |
30 |
import org.eclipse.osgi.util.NLS; |
|
Lines 236-286
Link Here
|
| 236 |
//update self profile on first load |
234 |
//update self profile on first load |
| 237 |
updateSelfProfile(result); |
235 |
updateSelfProfile(result); |
| 238 |
} |
236 |
} |
| 239 |
publishRepositoryReferences(result); |
|
|
| 240 |
return result; |
237 |
return result; |
| 241 |
} |
238 |
} |
| 242 |
|
239 |
|
| 243 |
/** |
|
|
| 244 |
* Publishes any repository references for the currently running profile in this registry. |
| 245 |
*/ |
| 246 |
private void publishRepositoryReferences(Map profileMap) { |
| 247 |
Profile profile = (Profile) profileMap.get(self); |
| 248 |
if (profile == null) |
| 249 |
return; |
| 250 |
String repos = profile.getProperty(IProfile.PROP_METADATA_REPOSITORIES); |
| 251 |
if (repos != null) { |
| 252 |
IRepositoryManager manager = (IRepositoryManager) ServiceHelper.getService(EngineActivator.getContext(), IMetadataRepositoryManager.SERVICE_NAME); |
| 253 |
doPublishRepositories(manager, repos); |
| 254 |
} |
| 255 |
repos = profile.getProperty(IProfile.PROP_ARTIFACT_REPOSITORIES); |
| 256 |
if (repos != null) { |
| 257 |
IRepositoryManager manager = (IRepositoryManager) ServiceHelper.getService(EngineActivator.getContext(), IArtifactRepositoryManager.SERVICE_NAME); |
| 258 |
doPublishRepositories(manager, repos); |
| 259 |
} |
| 260 |
} |
| 261 |
|
| 262 |
/** |
| 263 |
* Adds the given list of repositories to the given repository manager. |
| 264 |
*/ |
| 265 |
private void doPublishRepositories(IRepositoryManager manager, String repos) { |
| 266 |
StringTokenizer tokens = new StringTokenizer(repos, ","); //$NON-NLS-1$ |
| 267 |
while (tokens.hasMoreTokens()) |
| 268 |
manager.addRepository(decodeURI(tokens.nextToken())); |
| 269 |
} |
| 270 |
|
| 271 |
/** |
| 272 |
* Decodes a URI that has had literal comma characters encoded. |
| 273 |
*/ |
| 274 |
private URI decodeURI(String locationString) { |
| 275 |
//convert escaped commas back to literal commas |
| 276 |
int nextComma = locationString.indexOf("${#44}"); //$NON-NLS-1$ |
| 277 |
while (nextComma > 0) { |
| 278 |
locationString = locationString.substring(0, nextComma) + ',' + locationString.substring(nextComma + 6); |
| 279 |
nextComma = locationString.indexOf("${#44}");//$NON-NLS-1$ |
| 280 |
} |
| 281 |
return URI.create(locationString); |
| 282 |
} |
| 283 |
|
| 284 |
public synchronized void updateProfile(Profile profile) { |
240 |
public synchronized void updateProfile(Profile profile) { |
| 285 |
String id = profile.getProfileId(); |
241 |
String id = profile.getProfileId(); |
| 286 |
Profile current = internalGetProfile(id); |
242 |
Profile current = internalGetProfile(id); |