|
18 | 18 | import org.eclipse.equinox.p2.core.IProvisioningAgent; |
19 | 19 | import org.eclipse.equinox.p2.core.IProvisioningAgentProvider; |
20 | 20 | import org.eclipse.equinox.p2.core.ProvisionException; |
| 21 | +import org.eclipse.equinox.p2.core.spi.IAgentServiceFactory; |
21 | 22 | import org.eclipse.equinox.p2.engine.IProfile; |
22 | 23 | import org.eclipse.equinox.p2.engine.IProfileRegistry; |
23 | 24 | import org.eclipse.equinox.p2.metadata.IInstallableUnit; |
@@ -70,6 +71,11 @@ protected void setAgentProvider(IProvisioningAgentProvider agentProvider) { |
70 | 71 | this.agentProvider = agentProvider; |
71 | 72 | } |
72 | 73 |
|
| 74 | + @Reference(target = "(p2.agent.servicename=org.eclipse.equinox.p2.repository.metadata.IMetadataRepositoryManager)") |
| 75 | + protected void setMetadataRepositoryManager(IAgentServiceFactory serviceFactory) { |
| 76 | + // is necessary to have the service loaded on startup |
| 77 | + } |
| 78 | + |
73 | 79 | protected void unsetAgentProvider(IProvisioningAgentProvider agentProvider) { |
74 | 80 | this.agentProvider = null; |
75 | 81 | } |
@@ -225,16 +231,16 @@ public Collection<IInstallableUnit> getInstalledFeatures() { |
225 | 231 |
|
226 | 232 | @Override |
227 | 233 | public Collection<IInstallableUnit> getAllAvailableFeatures(IProgressMonitor monitor) { |
228 | | - if(monitor == null) { |
| 234 | + if (monitor == null) { |
229 | 235 | monitor = new NullProgressMonitor(); |
230 | 236 | } |
231 | | - IQueryResult<IInstallableUnit> result = |
232 | | - metadataRepositoryManager.query(QueryUtil.createIUGroupQuery(), monitor); |
| 237 | + IQueryResult<IInstallableUnit> result = metadataRepositoryManager.query(QueryUtil.createIUGroupQuery(), |
| 238 | + monitor); |
233 | 239 | return result.toSet(); |
234 | 240 | } |
235 | 241 |
|
236 | 242 | @Override |
237 | | - public IInstallableUnit getFeatureInAllAvailableFeatures(IProgressMonitor monitor, String id){ |
| 243 | + public IInstallableUnit getFeatureInAllAvailableFeatures(IProgressMonitor monitor, String id) { |
238 | 244 | Collection<IInstallableUnit> allAvailableFeatures = getAllAvailableFeatures(monitor); |
239 | 245 | for (IInstallableUnit iu : allAvailableFeatures) { |
240 | 246 | if (iu.getId().equalsIgnoreCase(id)) |
@@ -286,9 +292,9 @@ public void addRepository(URI location, String username, String password) { |
286 | 292 |
|
287 | 293 | registerHttpAuthentication(location, username, password); |
288 | 294 | } |
289 | | - |
| 295 | + |
290 | 296 | @Override |
291 | | - public IStatus loadRepository(IProgressMonitor monitor, URI location){ |
| 297 | + public IStatus loadRepository(IProgressMonitor monitor, URI location) { |
292 | 298 | try { |
293 | 299 | metadataRepositoryManager.loadRepository(location, monitor); |
294 | 300 | return Status.OK_STATUS; |
|
0 commit comments