On 17/05/07, Duc Lam Vu <[EMAIL PROTECTED]> wrote:
Hi,

Your answer helps me a bit to understand the problem. However, I am still
confused. GetEntryPaths("/") only return all  paths to entries that are
direct sub-folders of the root one. If I understand correctly then I have to
traverse recursively through these sub-folders to get an InputStream via
URL.openStream() to any specific file because I can not read content of one

that's right - GetEntryPaths will only return children of the given path,
not grandchildren, so you'll need to call GetEntryPaths repeatedly for
any directory entries in the enumeration (they should end in '/') to get
all the file entries - of course for file entries you can just get the URL
and from that, an inputstream.

( think of GetEntryPaths like a single call to 'ls' on unix/linux )

directory. Later on, from the acquired InputStream, I can read content of
the file to a buffer and pass it to JarOutputstream. Can you correct my
solution if it is wrong?

again, correct - for each entry found using GetEntryPaths you'll need
to create a corresponding entry in your JarOutputStream, using the
URL inputstreams to provide the data.

it's a pain, but this is the closest framework independent way to get
the contents of a bundle installed from any random stream location.


Thank you in advance,

Best regards,
Lam.

Stuart McCulloch <[EMAIL PROTECTED]> wrote:
 On 16/05/07, Duc Lam Vu wrote:
> Hi,

>
> Stuart McCulloch wrote:
>
> you would normally install a bundle from an existing bundle context, ie:
>
> Bundle newBundle = bundleContext.installBundle(location, input);
>
> What should I assign for the "location" parameter? Any arbitrary value?

think of the "location" parameter as a unique key identifying the bundle
- as the javadoc for the installBundle method says:

 "If a bundle containing the same location string is already installed,
 the Bundle object for that bundle is returned"

this is true for both variants of the installBundle method (file and stream)

> Does the assigned value of this input parameter affect to value of an
> input parameter if the methods getEntryPaths or getEntry are invoked
> later on?

no - getEntryPaths() and getEntry() work relative to the bundle root "/"
regardless of the location string or where the bundle is actually located.

They also don't modify the contents, they just make the data accessible.

>
> Kind Regards,
> Lam.
>
>
> ________________________________
> Park yourself in front of a world of choices in alternative vehicles.
> Visit the Yahoo! Auto Green Center.
>
>
> _______________________________________________
> OSGi Developer Mail List
> [email protected]
> http://www2.osgi.org/mailman/listinfo/osgi-dev
>


--
Cheers, Stuart
_______________________________________________
OSGi Developer Mail List
[email protected]
http://www2.osgi.org/mailman/listinfo/osgi-dev



 ________________________________
Sick sense of humor? Visit Yahoo! TV's Comedy with an Edge to see what's on,
when.


_______________________________________________
OSGi Developer Mail List
[email protected]
http://www2.osgi.org/mailman/listinfo/osgi-dev



--
Cheers, Stuart
_______________________________________________
OSGi Developer Mail List
[email protected]
http://www2.osgi.org/mailman/listinfo/osgi-dev

Reply via email to