Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » P2 » IProvisioningAgent returns no services(IProvisioningAgent returns no services)
IProvisioningAgent returns no services [message #643069] Fri, 03 December 2010 21:31 Go to next message
Jeffrey Ricker is currently offline Jeffrey Ricker
Messages: 18
Registered: July 2009
Junior Member
The provisioning agent is returning null for the services.

I followed the steps shown in http://help.eclipse.org/helios/index.jsp?topic=/org.eclipse. platform.doc.isv/guide/p2_director.html and http://www.slideshare.net/PascalRapicault/discovering-the-p2 -api .

The agent always returns null for the IMetadataRepositoryManager. What am I missing?

@Override
public void start(BundleContext bundleContext) throws Exception {
  this.context = bundleContext;
  ServiceTracker tracker = new ServiceTracker(context, IProvisioningAgentProvider.SERVICE_NAME, this);
  tracker.open();
}

@Override
public Object addingService(ServiceReference reference) {
  Object service = context.getService(reference);
  if (service instanceof IProvisioningAgentProvider) {
    loadAgent((IProvisioningAgentProvider) service);
    return service;
  }
  return null;
}

private void loadAgent(IProvisioningAgentProvider agentProvider) {
  try {
    IProvisioningAgent agent = agentProvider.createAgent(new URI(
      "file://C:/workspaces/workspace-infrastructure2/build-runtime/p2"));
    IMetadataRepositoryManager manager = (IMetadataRepositoryManager) agent
				.getService(IMetadataRepositoryManager.SERVICE_NAME);
    if (manager != null) {
      loadRepository(manager);
    } else {
      System.out.println("Manager is null");
    }
  } catch (Exception e) {
    e.printStackTrace();
  }
}


Re: IProvisioningAgent returns no services [message #643071 is a reply to message #643069] Fri, 03 December 2010 21:58 Go to previous message
Jeffrey Ricker is currently offline Jeffrey Ricker
Messages: 18
Registered: July 2009
Junior Member
It had nothing to do with the API.

The URI
"file://C:/workspaces/workspace-infrastructure2/build-runtime/p2"
causes a failure because it has an "authority component." Note the double slashes.

By changing the URI to
"file:/C:/workspaces/workspace-infrastructure2/build-runtime/p2"
everything worked fine.
Previous Topic:p2 director: Any success/failure tests?
Next Topic:-p2 directory call with -uninstallIU
Goto Forum:
  


Current Time: Wed Oct 22 01:39:48 GMT 2014

Powered by FUDForum. Page generated in 0.01694 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software