Eclipse Community Forums - RDF feed
https://www.eclipse.org/forums/
Eclipse Community ForumsCreating an installer job in p2
https://www.eclipse.org/forums/index.php/mv/msg/218135/692606/#msg_692606
I am new to Eclipse development and facing some problems in writing my plug-ins. I need to create an installer job which installs specific IUs like languages into an IDE. I am using the following source code obtained on eclipse documentation
Job job = null;
// get the agent
ServiceReference sr = Activator.context
.getServiceReference(IProvisioningAgentProvider.SERVICE_NAME);
IProvisioningAgentProvider agentProvider = null;
if (sr == null)
// Load and query the metadata
IMetadataRepository metadataRepo = null;
try {
metadataRepo = manager.loadRepository(new URI(
"file:/Users/Pascal/tmp/demo/"), new NullProgressMonitor());
} catch (ProvisionException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (OperationCanceledException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (URISyntaxException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
Collection toInstall = metadataRepo
.query(QueryUtil
.createIUQuery("org.eclipse.equinox.p2.demo.feature.group"),
new NullProgressMonitor()).toUnmodifiableSet();
// Creating an operation
InstallOperation installOperation = new InstallOperation(
new ProvisioningSession(agent), toInstall);
if (installOperation.resolveModal(new NullProgressMonitor()).isOK()) {
job = installOperation
.getProvisioningJob(new NullProgressMonitor());
job.addJobChangeListener(new JobChangeAdapter() {
public void done(IJobChangeEvent event) {
agent.stop();
}
});
}
job.schedule();
return null;
}
The paths are defined here. If I want to export this into an application and make others use it. How should this be done?? Is there any method in which we can know the above defined paths??
Thanks,
Rajendra Kolli]]>Rajendra Kolli2011-07-04T20:36:03-00:00Re: Creating an installer job in p2
https://www.eclipse.org/forums/index.php/mv/msg/218135/692608/#msg_692608
I've noticed you're using the IProvisioningAgentProvider to then create an agent...
Why don't you directly consume the IProvisioningAgent, which is registered as an osgi service as org.eclipse.equinox.p2.core.IProvisioningAgent (you could use a service tracker or DS component.xml) ?
It would give you access to the default agent, then you would not have to specify a path where to save your p2 runtime artifacts...
the repo URI, file:/Users/Pascal/tmp/demo/, I think you should find a way to specify it through an argument (vm or system) or provide a user interface to deal with it
Hope that helps, if not, try the p2 dev mailing list : p2-dev@eclipse.org
]]>Anthony Dahanne2011-07-04T20:44:52-00:00Re: Creating an installer job in p2
https://www.eclipse.org/forums/index.php/mv/msg/218135/692752/#msg_692752
Thanks for such a prompt reply. I was able to solve for the second point you have mentioned. I provided an UI which deals with a list of repos. The users selects one and the procedure is continued.
But the first point you have made, I couldnot get that. I have contacted the Eclipse Documentation, but I could only find that IProvisioningAgentProvider is the only way to create instances of agent. Please help me out in this.
]]>Rajendra Kolli2011-07-05T07:17:40-00:00Re: Creating an installer job in p2
https://www.eclipse.org/forums/index.php/mv/msg/218135/692766/#msg_692766
Found some documentation in Eclipse help. I really think this should suffice with me. Thanks for your help
It is present in wiki eclipse under Equinox/p2/MultipleAgents