Alin Dreghiciu wrote:
I wanted to say something like you explained that you don't do: I
expected that Felix will do something like this:
If I have a bundle A that is exporting a package P that is used by
bundle B, when I uninstall the bundle A, package P will still be
available. But when I uninstall bundle B the package P will no longer
be available (usage count becomes 0).
I also tried the following: In the context of the example above:
uninstall first bundle B, refresh bundle A, uninstall bundle A,
install again bundle B. But still bundle B gets resolved. Is that
expected?
Yes, that is expected, because you haven't refreshed bundle A after
uninstalling it. If you did this: uninstall B, refresh B, uninstall A,
then install B. I wouldn't expect B to resolve in that case, I don't think.
It seems to me that you are confused about how refresh works in Felix.
In Felix refreshPackages() only refreshes a bundle that is pending
removal either because of an update or an uninstall. Thus in your
scenario above, you call refresh on A, but it is not pending removal (B
was pending removal), so nothing happens.
The target of refreshPackages() has to be bundles that are pending
removal, otherwise it is a no-op.
-> richard
-> ps
START LEVEL 6
ID State Level Name
[ 0] [Active ] [ 0] System Bundle (1.0.4)
[ 1] [Active ] [ 5] Apache Felix Bundle Repository (1.1.0.SNAPSHOT)
[ 2] [Active ] [ 1] osgi.compendium (4.0.1)
[ 3] [Active ] [ 1] OPS4J Pax Url - classpath: (0.3.2.SNAPSHOT)
[ 4] [Active ] [ 1] OPS4J Pax Url - mvn: (0.3.2.SNAPSHOT)
[ 5] [Active ] [ 1] OPS4J Pax Url - war:, war-i: (0.3.2.SNAPSHOT)
[ 6] [Active ] [ 1] OPS4J Pax Url - wrap: (0.3.2.SNAPSHOT)
[ 7] [Active ] [ 1] Apache Felix Shell Service (1.0.1)
[ 8] [Active ] [ 1] Apache Felix Shell TUI (1.0.1)
-> uninstall 1
-> ps
START LEVEL 6
ID State Level Name
[ 0] [Active ] [ 0] System Bundle (1.0.4)
[ 2] [Active ] [ 1] osgi.compendium (4.0.1)
[ 3] [Active ] [ 1] OPS4J Pax Url - classpath: (0.3.2.SNAPSHOT)
[ 4] [Active ] [ 1] OPS4J Pax Url - mvn: (0.3.2.SNAPSHOT)
[ 5] [Active ] [ 1] OPS4J Pax Url - war:, war-i: (0.3.2.SNAPSHOT)
[ 6] [Active ] [ 1] OPS4J Pax Url - wrap: (0.3.2.SNAPSHOT)
[ 7] [Active ] [ 1] Apache Felix Shell Service (1.0.1)
[ 8] [Active ] [ 1] Apache Felix Shell TUI (1.0.1)
-> refresh 2
-> ps
START LEVEL 6
ID State Level Name
[ 0] [Active ] [ 0] System Bundle (1.0.4)
[ 2] [Active ] [ 1] osgi.compendium (4.0.1)
[ 3] [Active ] [ 1] OPS4J Pax Url - classpath: (0.3.2.SNAPSHOT)
[ 4] [Active ] [ 1] OPS4J Pax Url - mvn: (0.3.2.SNAPSHOT)
[ 5] [Active ] [ 1] OPS4J Pax Url - war:, war-i: (0.3.2.SNAPSHOT)
[ 6] [Active ] [ 1] OPS4J Pax Url - wrap: (0.3.2.SNAPSHOT)
[ 7] [Active ] [ 1] Apache Felix Shell Service (1.0.1)
[ 8] [Active ] [ 1] Apache Felix Shell TUI (1.0.1)
-> uninstall 2
-> ps
START LEVEL 6
ID State Level Name
[ 0] [Active ] [ 0] System Bundle (1.0.4)
[ 3] [Active ] [ 1] OPS4J Pax Url - classpath: (0.3.2.SNAPSHOT)
[ 4] [Active ] [ 1] OPS4J Pax Url - mvn: (0.3.2.SNAPSHOT)
[ 5] [Active ] [ 1] OPS4J Pax Url - war:, war-i: (0.3.2.SNAPSHOT)
[ 6] [Active ] [ 1] OPS4J Pax Url - wrap: (0.3.2.SNAPSHOT)
[ 7] [Active ] [ 1] Apache Felix Shell Service (1.0.1)
[ 8] [Active ] [ 1] Apache Felix Shell TUI (1.0.1)
-> install mvn:org.apache.felix/org.apache.felix.bundlerepository/1.1.0-SNAPSHOT
Bundle ID: 9
-> ps
START LEVEL 6
ID State Level Name
[ 0] [Active ] [ 0] System Bundle (1.0.4)
[ 3] [Active ] [ 1] OPS4J Pax Url - classpath: (0.3.2.SNAPSHOT)
[ 4] [Active ] [ 1] OPS4J Pax Url - mvn: (0.3.2.SNAPSHOT)
[ 5] [Active ] [ 1] OPS4J Pax Url - war:, war-i: (0.3.2.SNAPSHOT)
[ 6] [Active ] [ 1] OPS4J Pax Url - wrap: (0.3.2.SNAPSHOT)
[ 7] [Active ] [ 1] Apache Felix Shell Service (1.0.1)
[ 8] [Active ] [ 1] Apache Felix Shell TUI (1.0.1)
[ 9] [Installed ] [ 5] Apache Felix Bundle Repository (1.1.0.SNAPSHOT)
-> start 9
-> ps
START LEVEL 6
ID State Level Name
[ 0] [Active ] [ 0] System Bundle (1.0.4)
[ 3] [Active ] [ 1] OPS4J Pax Url - classpath: (0.3.2.SNAPSHOT)
[ 4] [Active ] [ 1] OPS4J Pax Url - mvn: (0.3.2.SNAPSHOT)
[ 5] [Active ] [ 1] OPS4J Pax Url - war:, war-i: (0.3.2.SNAPSHOT)
[ 6] [Active ] [ 1] OPS4J Pax Url - wrap: (0.3.2.SNAPSHOT)
[ 7] [Active ] [ 1] Apache Felix Shell Service (1.0.1)
[ 8] [Active ] [ 1] Apache Felix Shell TUI (1.0.1)
[ 9] [Active ] [ 5] Apache Felix Bundle Repository (1.1.0.SNAPSHOT)
On Mon, Jul 28, 2008 at 9:50 PM, Richard S. Hall <[EMAIL PROTECTED]> wrote:
Alin Dreghiciu wrote:
You are right. The citation was from 4.0.1. I looked into 4.1.0 and
there this statement is gone and has been replaced by "If none of the
old exports are used, then the old exports must be removed. Otherwise,
all old exports must remain available for existing bundles and future
resolves until the refreshPackages method is called or the Framework
is restarted."
But even in this situation when I uninstall the obr bundle I would say
that we are in the first situation "If none of the old exports are
used, then the old exports must be removed.", And I do not think that
ths should be related to the order I uninstall the bundles. It sounds
like if the usage count for an exported package of an uninstalled
bundle reaches 0 the exported package must be removed. Do you think is
something more about the subject on 4.2?
I don't think there is more on the subject, but I don't totally understand
what you are saying.
We only check the usage count once when we uninstall the bundle. If it is
used, then we don't automatically refresh the uninstalled bundle. We don't
then monitor subsequent refreshes of other bundles and how they impact the
usage count of already uninstalled so that we can automatically refresh the
previously uninstalled bundles when their usage count dynamically goes to
zero. The spec doesn't mandates such behavior, although I think it would be
allowable.
-> richard
On Mon, Jul 28, 2008 at 9:23 PM, Richard S. Hall <[EMAIL PROTECTED]>
wrote:
From my interpretation of the spec, a bundle is only refreshed if it is
pending removal. In this case OBR, is not pending removal.
For your example 2, I am pretty sure that this has been changed and that
you
are free to use uninstalled packages to resolve new dependencies. I am
not
sure if this was added in 4.1 or will be added in 4.2, but I am fairly
certain it was changed.
-> richard
Alin Dreghiciu wrote:
Indeed the complete refresh worked as can be seen bellow on <Example
1>. But that still does not comply to the specs in my view as on doing
refresh on a bundle the framework should re-resolve the bundle. At
least that is what I got from the specs, but the specs are not very
clear about this. Maybe I should post a clarification issue with OSGi
Alliance. And equinox/kf does that but they may be wrong interpreting
the specs.
In <Example 2> you can find a different case with even uninstalling
the obr bundle and then install it again. The obr bundle still gets
resolved. And about this the specs are clear (section 4.3.8):
"Packages of uninstalled bundles must not be used by newly installed
bundles..."
<Example 1>
-------------------
-> ps
START LEVEL 6
ID State Level Name
[ 0] [Active ] [ 0] System Bundle (1.0.4)
[ 1] [Active ] [ 5] Apache Felix Bundle Repository
(1.1.0.SNAPSHOT)
[ 2] [Active ] [ 1] osgi.compendium (4.0.1)
[ 3] [Active ] [ 1] Apache Felix Shell Service (1.0.1)
[ 4] [Active ] [ 1] Apache Felix Shell TUI (1.0.1)
-> headers 1
Apache Felix Bundle Repository (1)
----------------------------------
Tool = Bnd-0.0.238
Bundle-Activator = org.apache.felix.bundlerepository.Activator
Created-By = Apache Maven Bundle Plugin
Bnd-LastModified = 1217270914325
Export-Service = org.osgi.service.obr.RepositoryAdmin
Built-By = alindreghiciu
Private-Package =
org.apache.felix.bundlerepository,org.apache.felix.bundlerepository.metadataparser,org.apache.felix.bundlerepository.metadataparser.kxmlsax,org.kxml2.io,org.kxml2.kdom,org.kxml2.wap,org.kxml2.wap.syncml,org.kxml2.wap.wml,org.kxml2.wap.wv,org.xmlpull.v1
Export-Package =
org.osgi.service.obr;uses:="org.osgi.framework";version="1.0"
Bundle-Version = 1.1.0.SNAPSHOT
Bundle-License = http://www.apache.org/licenses/LICENSE-2.0.txt
Build-Jdk = 1.5.0_13
Bundle-Source =
http://oscar-osgi.sf.net/obr2/org.apache.felix.bundlerepository/org.apache.felix.bundlerepository-1.1.0-SNAPSHOT-src.jar
Manifest-Version = 1.0
Bundle-Vendor = The Apache Software Foundation
Bundle-ManifestVersion = 2
Bundle-Url =
http://oscar-osgi.sf.net/obr2/org.apache.felix.bundlerepository/org.apache.felix.bundlerepository-1.1.0-SNAPSHOT.jar
DynamicImport-Package = org.apache.felix.shell
Bundle-DocURL =
http://oscar-osgi.sf.net/obr2/org.apache.felix.bundlerepository/
Import-Package =
org.osgi.framework;version="1.3",org.osgi.service.log;version="1.3.0",org.osgi.service.obr;version="1.0"
Bundle-Name = Apache Felix Bundle Repository
Ignore-Package = org.xml.sax,javax.xml.parsers
Bundle-Description = Bundle repository service.
Bundle-SymbolicName = org.apache.felix.bundlerepository
-> uninstall 2
-> ps
START LEVEL 6
ID State Level Name
[ 0] [Active ] [ 0] System Bundle (1.0.4)
[ 1] [Active ] [ 5] Apache Felix Bundle Repository
(1.1.0.SNAPSHOT)
[ 3] [Active ] [ 1] Apache Felix Shell Service (1.0.1)
[ 4] [Active ] [ 1] Apache Felix Shell TUI (1.0.1)
-> refresh 1
-> ps
START LEVEL 6
ID State Level Name
[ 0] [Active ] [ 0] System Bundle (1.0.4)
[ 1] [Active ] [ 5] Apache Felix Bundle Repository
(1.1.0.SNAPSHOT)
[ 3] [Active ] [ 1] Apache Felix Shell Service (1.0.1)
[ 4] [Active ] [ 1] Apache Felix Shell TUI (1.0.1)
-> refresh
-> ps
START LEVEL 6
ID State Level Name
[ 0] [Active ] [ 0] System Bundle (1.0.4)
[ 1] [Installed ] [ 5] Apache Felix Bundle Repository
(1.1.0.SNAPSHOT)
[ 3] [Active ] [ 1] Apache Felix Shell Service (1.0.1)
[ 4] [Active ] [ 1] Apache Felix Shell TUI (1.0.1)
-> start 1
org.osgi.framework.BundleException: Unresolved package in bundle 1:
package; (&(package=org.osgi.service.log)(version>=1.3.0))->
<Example 2>
-------------------
-> ps
START LEVEL 6
ID State Level Name
[ 0] [Active ] [ 0] System Bundle (1.0.4)
[ 1] [Active ] [ 5] Apache Felix Bundle Repository
(1.1.0.SNAPSHOT)
[ 2] [Active ] [ 1] osgi.compendium (4.0.1)
[ 3] [Active ] [ 1] OPS4J Pax Url - classpath: (0.3.2.SNAPSHOT)
[ 4] [Active ] [ 1] OPS4J Pax Url - mvn: (0.3.2.SNAPSHOT)
[ 5] [Active ] [ 1] OPS4J Pax Url - war:, war-i:
(0.3.2.SNAPSHOT)
[ 6] [Active ] [ 1] OPS4J Pax Url - wrap: (0.3.2.SNAPSHOT)
[ 7] [Active ] [ 1] Apache Felix Shell Service (1.0.1)
[ 8] [Active ] [ 1] Apache Felix Shell TUI (1.0.1)
-> uninstall 2
-> uninstall 1
-> ps
START LEVEL 6
ID State Level Name
[ 0] [Active ] [ 0] System Bundle (1.0.4)
[ 3] [Active ] [ 1] OPS4J Pax Url - classpath: (0.3.2.SNAPSHOT)
[ 4] [Active ] [ 1] OPS4J Pax Url - mvn: (0.3.2.SNAPSHOT)
[ 5] [Active ] [ 1] OPS4J Pax Url - war:, war-i:
(0.3.2.SNAPSHOT)
[ 6] [Active ] [ 1] OPS4J Pax Url - wrap: (0.3.2.SNAPSHOT)
[ 7] [Active ] [ 1] Apache Felix Shell Service (1.0.1)
[ 8] [Active ] [ 1] Apache Felix Shell TUI (1.0.1)
-> install
mvn:org.apache.felix/org.apache.felix.bundlerepository/1.1.0-SNAPSHOT
Bundle ID: 9
-> ps
START LEVEL 6
ID State Level Name
[ 0] [Active ] [ 0] System Bundle (1.0.4)
[ 3] [Active ] [ 1] OPS4J Pax Url - classpath: (0.3.2.SNAPSHOT)
[ 4] [Active ] [ 1] OPS4J Pax Url - mvn: (0.3.2.SNAPSHOT)
[ 5] [Active ] [ 1] OPS4J Pax Url - war:, war-i:
(0.3.2.SNAPSHOT)
[ 6] [Active ] [ 1] OPS4J Pax Url - wrap: (0.3.2.SNAPSHOT)
[ 7] [Active ] [ 1] Apache Felix Shell Service (1.0.1)
[ 8] [Active ] [ 1] Apache Felix Shell TUI (1.0.1)
[ 9] [Installed ] [ 5] Apache Felix Bundle Repository
(1.1.0.SNAPSHOT)
-> start 9
-> ps
START LEVEL 6
ID State Level Name
[ 0] [Active ] [ 0] System Bundle (1.0.4)
[ 3] [Active ] [ 1] OPS4J Pax Url - classpath: (0.3.2.SNAPSHOT)
[ 4] [Active ] [ 1] OPS4J Pax Url - mvn: (0.3.2.SNAPSHOT)
[ 5] [Active ] [ 1] OPS4J Pax Url - war:, war-i:
(0.3.2.SNAPSHOT)
[ 6] [Active ] [ 1] OPS4J Pax Url - wrap: (0.3.2.SNAPSHOT)
[ 7] [Active ] [ 1] Apache Felix Shell Service (1.0.1)
[ 8] [Active ] [ 1] Apache Felix Shell TUI (1.0.1)
[ 9] [Active ] [ 5] Apache Felix Bundle Repository
(1.1.0.SNAPSHOT)
->
On Mon, Jul 28, 2008 at 7:43 PM, Karl Pauls <[EMAIL PROTECTED]> wrote:
I think the issue is that you did only refresh the obr bundle. The
other
bundle is still around and can be used until the framework is
refreshed.
Can
you try whether doing a complete refresh makes a difference?
regards,
Karl
Von meinem iPhone gesendet
Am 28.07.2008 um 18:58 schrieb "Alin Dreghiciu" <[EMAIL PROTECTED]>:
Hi guys,
While working on FELIX-482 I had the following (interesting)
situation:
1. I had obr bundle importing org.osgi.service.log package (not
optional
import)
2. On a new felix instance I installed the the osgi compendium bundle
that exports the log package
3. Installed obr bundle. The obr bundle gets resolved and could be
started (as expected till now)
4. Uninstalled the cosgi compendium bundle
5. Refreshed packages for obr bundle. But the obr bundle was still
resolved and could be started. This is the part I did not expect.
Is this a known bug? Out of curiosity I did the same on equinox/kf and
as expected on step 5 the obr bundle could not be resolved.
--
Alin Dreghiciu
http://www.ops4j.org - New Energy for OSS Communities - Open
Participation Software.
http://www.qi4j.org - New Energy for Java - Domain Driven Development.
http://malaysia.jayway.net - New Energy for Projects - Great People
working on Great Projects at Great Places