Can't get P2 to load remote repository [message #895326] |
Thu, 12 July 2012 13:00 |
abadamcd1 abadamcd1 Messages: 40 Registered: December 2011 |
Member |
|
|
So I can load a locally generated repository just fine with the code below. However, using an http uri, it will always fail whenever I try the manager.loadRepository method. Why is this? Note, I've also tried loading eclipse repos and get the same sorts of errors.
//updateURI = new URI("http://localhost/wupdate/");
updateURI = new URI("file:/var/www/wupdate/");
ServiceReference<?> sr = Activator.getContext().getServiceReference(IProvisioningAgentProvider.SERVICE_NAME);
IProvisioningAgentProvider agentProvider = null;
if (sr == null)
return;
agentProvider = (IProvisioningAgentProvider) Activator.getContext().getService(sr);
final IProvisioningAgent agent = agentProvider.createAgent(new URI("file:/home/adam/Desktop/wunderNet444/Wunderkind/p2/"));
//get the repository managers and define our repositories
IMetadataRepositoryManager manager = (IMetadataRepositoryManager) agent.getService(IMetadataRepositoryManager.SERVICE_NAME);
IArtifactRepositoryManager artifactManager = (IArtifactRepositoryManager) agent.getService(IArtifactRepositoryManager.SERVICE_NAME);
manager.addRepository(updateURI);
artifactManager.addRepository(updateURI);
//Load and query the metadata
IMetadataRepository metadataRepo = manager.loadRepository(updateURI, new NullProgressMonitor());
System.out.println("IU LIST");
Collection<IInstallableUnit> toInstall = metadataRepo .query(QueryUtil.createIUAnyQuery(),
new NullProgressMonitor()).toUnmodifiableSet();
java.util.List<IInstallableUnit> list = new ArrayList<IInstallableUnit>(toInstall);
Collections.sort(list);
for(IInstallableUnit iu : list){
if(true /*iu.toString().contains("com.mnet")*/){
System.out.println(iu.getId());
}
}
First part of the error I get
Caused by: java.lang.NullPointerException
at org.eclipse.equinox.internal.p2.repository.helpers.AbstractRepositoryManager.loadIndexFile(AbstractRepositoryManager.java:721)
at org.eclipse.equinox.internal.p2.repository.helpers.AbstractRepositoryManager.loadRepository(AbstractRepositoryManager.java:640)
at org.eclipse.equinox.internal.p2.metadata.repository.MetadataRepositoryManager.loadRepository(MetadataRepositoryManager.java:96)
at org.eclipse.equinox.internal.p2.metadata.repository.MetadataRepositoryManager.loadRepository(MetadataRepositoryManager.java:92)
at com.mnet.wunderkind.updatemanager.UpdateManager.update(UpdateManager.java:54)
[Updated on: Thu, 12 July 2012 13:09] Report message to a moderator
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03416 seconds