Hi,
Warmly thanks for your reply.
I want to know value of parameter that is passed to method
Bundle.getEntry(String) and Bundle.getEntryPath(String). Assumed that I
installed a bundle by invoking and passing parameter like that
Bundle.Install("Install//BundleA", inputStream), then I should call
BUndle.getEntry("Install/BundleA") and Bundle.getEntryPath("Install/BundleA")?
It is very nice if you can give me any code snippet that does the same thing
as what I want to have or give me hints a bit more in detail what I have to
do.
Regards,
Lam.
Thomas Watson <[EMAIL PROTECTED]> wrote:
The only framework independent way I can think of doing this is to create your
own JarOutputStream. Then read all the entries from the bundle using
Bundle.getEntryPaths and Bundle.getEntry and populate the JarOutputStream with
each entry from the bundle. Note that you should ensure all the files under
META-INF are included first in the JarOutputStream. In particular
META-INF/MANIFEST.MF should be the very first entry. You cannot use
Bundle.findEntries because that searches attached fragment bundles which you
do not want to do.
The problem with this approach is the content will likely not be byte for byte
identical to the one you used to install the bundle with. You will likely use
a different compression ratio and you may not use the same entry order from
the original content. But this approach should preserve the signers if the
bundle was signed.
Tom
Duc Lam Vu <[EMAIL PROTECTED]>
Sent by: [EMAIL PROTECTED] 05/15/2007 12:52 PM Please respond to
OSGi Developer Mail List <[email protected]>
To
OSGi Developer Mail List <[email protected]> cc
Subject
Re: [osgi-dev] Install an OSGi Bundle from a Jar file
Thanks for your nice answer.
If I can not get a raw file path of a specific installed bundle but my
purpose is to read a binary content of a specific bundle and store it in a
stream or an array of byte. My question now is that how I can get a binary
content of a specified installed bundle? For instance, I know its BundleID,
SymbolicName. Can getEntry, findEntries methods help me?
Many thanks in advance.
Lam.
Thomas Watson <[EMAIL PROTECTED]> wrote:
The Framework implementation stores the bundle content from an InputStream
in an implementation specific way. The OSGi specification does not specify
that the bundle content must be stored in a File format. For example, the
bundle content could be stored in flash memory or a database or it could be
transformed into a VM specific format for optimization. There is no OSGi API
to get to the raw File path of the bundle content installed.
There are various methods on the Bundle interface for getting bundle content
entries (see getEntry, findEntries, getEntryPaths and getResources).
Tom
Duc Lam Vu <[EMAIL PROTECTED]>
Sent by: [EMAIL PROTECTED]
05/13/2007 08:40 AM
Please respond to
OSGi Developer Mail List <[email protected]>
To
OSGi Developer Mail List <[email protected]> cc
Subject
[osgi-dev] Install an OSGi Bundle from a Jar file
Hi all,
I have got a content of a Jar file representing an OSGi bundle in a form of
an InputStream object via Network communication. I want to install this Jar
file by
invoking BundleContext.Install(param1, InputStream stream. If I assign
Param1 with a value of an arbitrary string then later on, when I try to get a
File path of the installed bundle by executing
ServiceReference.getBundle.getLocation, it returns me a value of the passed
string. In fact, I want to get the string that represents a real File path of
the installed OSGi bundle. What should I assign for the Param1 of the method
BundleContext.Install.
Any suggestion?
Best Regards,
Lam.
---------------------------------
Don't get soaked. Take a quick peak at the forecast
with theYahoo! Search weather
shortcut._______________________________________________
OSGi Developer Mail List
[email protected]
http://www2.osgi.org/mailman/listinfo/osgi-dev
_______________________________________________
OSGi Developer Mail List
[email protected]
http://www2.osgi.org/mailman/listinfo/osgi-dev
---------------------------------
Sucker-punch spam with award-winning protection.
Try the free Yahoo! Mail Beta._______________________________________________
OSGi Developer Mail List
[email protected]
http://www2.osgi.org/mailman/listinfo/osgi-dev
_______________________________________________
OSGi Developer Mail List
[email protected]
http://www2.osgi.org/mailman/listinfo/osgi-dev
---------------------------------
Moody friends. Drama queens. Your life? Nope! - their life, your story.
Play Sims Stories at Yahoo! Games. _______________________________________________
OSGi Developer Mail List
[email protected]
http://www2.osgi.org/mailman/listinfo/osgi-dev