8.4 Using the p2 for extending your Virgo installation

Extending with the p2 director

You can provision new features on top of your Virgo installation using the p2 director. It can be used both for initial provisioning and extending an existing installtion.

For extending an existing installation you can use these director arguments:

-repository http://download.eclipse.org/rt/ecf/3.5.3/site.p2
-installIU org.eclipse.ecf.remoteservice.feature.feature.group
-destination <your Virgo installation folder>

This installs the latest version of the specified p2 feature in your Virgo installation's p2 profile.

Extending via the p2 shell commands

Another way to achieve the same results is to use the p2 commands. The commands are available only in VN as it includes p2 by default.

[Note]Note
For the other distributions only the director is supported and the operation only extends their kernel region.

Here's a list of the most commonly used p2 commands:

Table 8.8. p2 Common Shell Commands

CommandHelp
provaddrepo <repository URI> Add specified URI as metadata and artifact repository. Note that if you pass a wrong URL you'll get an error saying: Repository not modifiable: http://wrongURL. The default behavior of this command is to create an empty repository at the specified location if there isn't any. That won't work for remote locations so keep in mind that if you see this you probably passed a wrong URL.
provdelrepo <repository URI> Remove specified metadata and artifact repository.
provinstall <InstallableUnit> <version> <profileid> Install an IU to the profileid. If no profileid is given, installs into default profile.
provremove <InstallableUnit> <version> <profileid> Uninstall an IU from the profileid. If no profileid is given, uninstalls form default profile.
provlg [<repository URI> <iu id | *> <version range | *>] Lists all IUs with group capabilities in the given repo or in all repos if URI is omitted.
provliu [<repository URI | *> <iu id | *> <version range | *>] Lists the IUs that match the pattern in the given repo. * matches all.
confapply This is a Simple Configurator command, not a p2 one. However it is relevant because it applies dynamically, at runtime, the installed p2 features. What the command does is to apply to the running OSGi framework the current content in the bundles.info file. When using the provinstall command it takes care of updateing the bundles.info file.

Here's an example showing how to install the ECF remote services but with the p2 commands this time:

osgi> provaddrepo http://download.eclipse.org/rt/ecf/3.5.3/site.p2

osgi> provlg

org.eclipse.ecf.core.feature.group 3.5.3.v20111109-2142
org.eclipse.ecf.core.featurepatch.feature.group 3.5.3.v20111109-2142
org.eclipse.ecf.core.featurepatch.source.feature.group 3.5.3.v20111109-2142
org.eclipse.ecf.core.source.feature.group 3.5.3.v20111109-2142
org.eclipse.ecf.datashare.feature.feature.group 1.0.0.v20111109-2142
org.eclipse.ecf.datashare.source.feature.feature.group 1.0.0.v20111109-2142
org.eclipse.ecf.discovery.dnssd.feature.feature.group 1.0.0.v20111109-2142
org.eclipse.ecf.discovery.dnssd.source.feature.feature.group 1.0.0.v20111109-2142
org.eclipse.ecf.discovery.feature.feature.group 1.0.0.v20111109-2142
org.eclipse.ecf.discovery.jmdns.feature.feature.group 1.0.0.v20111109-2142
org.eclipse.ecf.discovery.jmdns.source.feature.feature.group 1.0.0.v20111109-2142
org.eclipse.ecf.discovery.slp.feature.feature.group 1.0.0.v20111109-2142
org.eclipse.ecf.discovery.slp.source.feature.feature.group 1.0.0.v20111109-2142
org.eclipse.ecf.discovery.source.feature.feature.group 1.0.0.v20111109-2142
org.eclipse.ecf.discovery.zookeeper.feature.feature.group 1.0.0.v20111109-2142
org.eclipse.ecf.discovery.zookeeper.source.feature.feature.group 1.0.0.v20111109-2142
org.eclipse.ecf.eventadmin.examples.feature.feature.group 1.0.0.v20111109-2142
org.eclipse.ecf.eventadmin.examples.source.feature.feature.group 1.0.0.v20111109-2142
org.eclipse.ecf.eventadmin.feature.feature.group 2.0.0.v20111109-2142
org.eclipse.ecf.eventadmin.source.feature.feature.group 2.0.0.v20111109-2142
org.eclipse.ecf.osgi.services.feature.feature.group 2.0.1.v20111109-2142
org.eclipse.ecf.osgi.services.source.feature.feature.group 2.0.1.v20111109-2142
org.eclipse.ecf.remoteservice.examples.feature.feature.group 1.1.0.v20111109-2142
org.eclipse.ecf.remoteservice.examples.source.feature.feature.group 1.1.0.v20111109-2142
org.eclipse.ecf.remoteservice.feature.feature.group 1.0.0.v20111109-2142
org.eclipse.ecf.remoteservice.rest.feature.feature.group 1.0.0.v20111109-2142
org.eclipse.ecf.remoteservice.rest.source.feature.feature.group 1.0.0.v20111109-2142
org.eclipse.ecf.remoteservice.rosgi.feature.feature.group 1.0.0.v20111109-2142
org.eclipse.ecf.remoteservice.rosgi.source.feature.feature.group 1.0.0.v20111109-2142
org.eclipse.ecf.remoteservice.sdk.feature.feature.group 3.5.3.v20111109-2142
org.eclipse.ecf.remoteservice.sdk.source.feature.feature.group 3.5.3.v20111109-2142
org.eclipse.ecf.remoteservice.soap.feature.feature.group 1.0.0.v20111109-2142
org.eclipse.ecf.remoteservice.soap.source.feature.feature.group 1.0.0.v20111109-2142
org.eclipse.ecf.remoteservice.source.feature.feature.group 1.0.0.v20111109-2142
org.eclipse.ecf.server.generic.feature.feature.group 1.0.0.v20111109-2142
org.eclipse.ecf.server.generic.source.feature.feature.group 1.0.0.v20111109-2142
org.eclipse.ecf.xmpp.feature.feature.group 1.0.0.v20111109-2142
org.eclipse.ecf.xmpp.source.feature.feature.group 1.0.0.v20111109-2142

osgi> provinstall org.eclipse.ecf.remoteservice.feature.feature.group 1.0.0.v20111109-2142
Installation complete for org.eclipse.ecf.remoteservice.feature.feature.group 1.0.0.v20111109-2142

osgi> confapply

osgi> ss

"Framework is launched."


id	State       Bundle
0	ACTIVE      org.eclipse.osgi_3.7.1.R37x_v20110808-1106
....
92	RESOLVED    org.springframework.osgi.io_1.2.1
93	RESOLVED    org.eclipse.ecf.console_1.0.0.v20111109-2142
94	RESOLVED    org.eclipse.ecf.discovery_4.0.0.v20111109-2142
95	RESOLVED    org.eclipse.ecf.provider_4.2.100.v20111109-2142
96	RESOLVED    org.eclipse.ecf.provider.discovery_2.1.200.v20111109-2142
97	RESOLVED    org.eclipse.ecf.provider.remoteservice_4.0.0.v20111109-2142
98	RESOLVED    org.eclipse.ecf.remoteservice_6.0.200.v20111109-2142
99	RESOLVED    org.eclipse.ecf.sharedobject_2.2.100.v20111109-2142
100	RESOLVED    org.eclipse.equinox.concurrent_1.0.200.v20110502

You can see that after applying the changes with confapply the remote services bundles and their dependencies are installed in VN.