Can't get P2 to load remote repository [message #895326] |
Thu, 12 July 2012 09:00  |
Eclipse User |
|
|
|
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 09:09] by Moderator
|
|
|
|
Re: Can't get P2 to load remote repository [message #895413 is a reply to message #895399] |
Thu, 12 July 2012 14:46  |
Eclipse User |
|
|
|
Hmm, I figured out out. When I added that package above to my feature I realized that my p2 feature group wasn't added to my runtime (even though it was added to my product configuration).
On another note, I can add the package you mentioned, but I can't seem to find it on the indigo api documentation site. Be nice to know what it's for, but I can't see anything about it.
|
|
|
Powered by
FUDForum. Page generated in 0.20009 seconds