Wednesday, December 30, 2009

How p2 UI handles with license agreements

P2 install wizard firstly query the repository to find out the root installable unit(as well as top installable). Then p2 recalculate the dependency and try to search the requirements in all available repositories after user submits their installation request. Go to the license agreement page if all the dependencies are satisfied.

P2 agreement page obtains all the units to be installed from the operands of provision plan. The number always is much greater than the number submitted by user. Because the submitted IUs only are the root IUs.

P2 UI would check the unaccepted licenses comparing to before records. The policy class of p2 UI provides the license manager to record the even accepted license. It traverses all the installable units, querying its license whether it has already been accepted if it has. If the license agreement has been accepted, it would be ignored, won't be shown in the agreement page. Otherwise, new record is created to mark it as accepted by the license manager and display it in the agreement wizard page.

The default implementation of license manager would persist the accepted information in the file -- <workspace>/.metadata/.plugins/org.eclipse.equinox.p2.ui.sdk/license.xml.

Tuesday, December 29, 2009

[tip]ssh key

Setup SSH without password.
a) execute "ssh-keygen -t rsa" under your linux/unix login to get the RSA keys.
(press Enter for all)
You will get 2 files uner ~/.ssh/, id_rsa and id_rsa.pub
b) Put the public key id_rsa.pub to your remote host: ~/.ssh/authorized_keys If the remote host share the same nfs, just try " cat id_rsa.pub >> ~/.ssh/authorized_keys"
* Remember to modify hostname or ip info in ~/.ssh/authorized_keys to "*", so that you can login from any host without password in your NIS domain.
For example:
ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA4Ri5J0s1BL/+mR7RfAuDW6FY2P6ILc61Zvw1BdDkvHMFrTzaC/AUMw33H7biAMCXuCleakCuSoV8ZDiGHYs4wOVvet5sDmphkwdiC4xTekdl3dRNvGjMVbvFUta/Y5CiayL6YIu47Ro6Vvu4Mutsrv/13pTlifrEz+NTR/+bzMb9nTniCwiryMyYod3E46b8WvS8yE3WK+tH4BZE8bjiCwdvAzSdPyk/OFNrlBNuF1yewwnxv1roRD3UalT2+7O4kfEG9sMvvBHjuX2l7xlUe3stBftYpigBbwGmmadxjRpNIlk88t5xKcQX6nSu7V8HI3GWPHI0D+ISIlbfU5Sunw== kzhu0@*

Friday, December 25, 2009

[Eclipse][P2]P2 replication plug-in

I wrote a plug-in to simplify the process to install the same plug-ins in different platform or different workstation.
Anyone is interested in it, pls follow below guide to freely use it.
http://code.google.com/p/kane-toolkit/wiki/P2Replication

Enjoy it.

Wednesday, December 2, 2009

[eclipse]How Equinox load bundles

How Equinox load bundles


Equinox launcher is responsible to start OSGi framework. The system bundle would be created and marked as installed when initializing the framework. Equinox also tries to install the installed bundles if finding them in persistence data during the initializing period. Of course there is no extra bundles would be installed when launching Equinox first time.


Then Equinox launcher would install the bundles specified by vm's system property 'osgi.bundles'. And start the initial bundles that are marked as early start. For example, let's have a look at the configuration/config.ini of Eclipse, you would find a line similar as below,
osgi.bundles=reference\:file\:org.eclipse.equinox.simpleconfigurator_1.0.200.v20090831.jar@1\:start
It means the start level of bundle 'org.eclipse.equinox.simpleconfigurator_1.0.200.v20090831.jar' is 1, and it would be started after installing it.

Here you would ask there are only two bundles are installed(one is system bundle 'org.eclipse.osgi', the other is 'org.eclipse.equinox.simpleconfigurator') when launching Equinox, how the other bundles are installed? It's done by the activate method of 'simpleconfigurator' bundle. The available bundles are recorded in plain text file configuration/org.eclipse.equinox.simpleconfigurator/bundles.info, simpleconfigurator read the file then install those bundles.

It's a new bundle management introduced by p2. P2 also supports the traditional way to install extensions, such as link file, .eclipseproduct file and directly copying features/plugins.
Below table lists the p2 bundles to implement the
compatibility installation feature,


Bundle
Usage
org.eclipse.equinox.p2.directorywatcher
the definition and implementation of directory watcher API
org.eclipse.equinox.p2.updatesite
the implementation of updatesite repository
org.eclipse.equinox.p2.extensionlocation
the implementation of extension repository
org.eclipse.equinox.p2.reconciler.dropins
scan dropin folder and link files; watch the traditional configuration file used by update manager

P2 reconciler would scan the dropin, link folder and legacy configuration file in every Equinox launching. You can disable the capability by marking it not be early start.
org.eclipse.equinox.p2.reconciler.dropins,1.0.100.v20091010,plugins/org.eclipse.equinox.p2.reconciler.dropins_1.0.100.v20091010.jar,4,false

If finding some new bundles in dorpin folder, the reconciler would add the new bundles into a local metadata repository that is stored as OSGi data of Equinox. Then synchronize the bundles into the current p2 profile, then add the new bundles into bundles.info file.