You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@felix.apache.org by Max Bridgewater <ma...@gmail.com> on 2010/07/03 17:51:36 UTC

Passing information from the launcher to the bundles

Hi,

I'm desperately trying to pass some information to my bundles. My last
hope was to use the JVM -D arguments. Unfortunately these are not made
available to the bundles. I was hoping to find them through
System.getProperty(). Am I doing something wrong here or this is a
well know feature? Is there a workaround that would allow me to pass
information from my custom launcher to my bundles?

Thanks,
Max.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Re: Passing information from the launcher to the bundles

Posted by "Richard S. Hall" <he...@ungoverned.org>.
On 7/3/10 11:51, Max Bridgewater wrote:
> Hi,
>
> I'm desperately trying to pass some information to my bundles. My last
> hope was to use the JVM -D arguments. Unfortunately these are not made
> available to the bundles. I was hoping to find them through
> System.getProperty(). Am I doing something wrong here or this is a
> well know feature? Is there a workaround that would allow me to pass
> information from my custom launcher to my bundles?
>    

System properties are visible to bundles, so you must be experiencing 
some other issue.

-> richard

> Thanks,
> Max.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
>
>    

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Re: Passing information from the launcher to the bundles

Posted by Will Budic <vi...@gmail.com>.
>> I'm desperately trying to pass some information to my bundles. My last
I think what you want is to get access to other bundles and pass to their
context something?
Have you checked:
(BundleContext) context.getBundles()

This is usually dealt with when setting up your activator or service(s).
A system property is something accessible globally and neither a desirable
or appropriate way to deal with, as it doesn't
guarantee  that the obtained value finally is the expected or desirable
value and not something been modified.


On 5 July 2010 05:11, Richard S. Hall <he...@ungoverned.org> wrote:

> Sounds pretty weird to me. In your launcher, make sure you can read the
> system properties in both cases.
>
> -> richard
>
>
> On 7/3/10 21:48, Max Bridgewater wrote:
>
>> I've been making some progress with this issue. I've got one scenario
>> where the system property is disappearing and the other where it is
>> available to the bundles.
>>
>> The settings: I have a jar that contains all my jars (including
>> bundles). My loader reads this ueberjar, starts Felix, and initiates
>> the loading of bundles. The difference between the two approaches is
>> in how the InputStream passed to installBundle() is obtained. In the
>> working case, the input stream is obtained from the  the ueberjar by
>> doing: this.getClass().getResourceAsStream("/" + jarEntry.getName().
>> In the second case where the system properties disappear, I read the
>> binaries from the ueberjar, construct a ByteArrayInputStream() and
>> pass it to BundleContext.installBundle().
>>
>> This is very weird. I can't explain why this should make any difference.
>>
>> I appreciate your input.
>> Max.
>>
>>
>> On Sat, Jul 3, 2010 at 3:38 PM, Angelo van der Sijpt
>> <an...@luminis.eu>  wrote:
>>
>>
>>> Hi Max,
>>>
>>> It depends on what you are trying to accomplish, and what your system
>>> looks
>>> like. Using system properties by -D should work fine if you use the
>>> default
>>> launcher, but if you have something 'special', this could break down.
>>>
>>> If you need to pass information to you bundles because you want to
>>> configure
>>> them for some environment or composition, you could have a look at the
>>> Configuration Admin (part of the compendium spec).
>>>
>>> Do you have a little more information about you situation and goals?
>>>
>>> Angelo
>>>
>>> On Sat, Jul 3, 2010 at 5:51 PM, Max Bridgewater
>>> <ma...@gmail.com>wrote:
>>>
>>>
>>>
>>>> Hi,
>>>>
>>>> I'm desperately trying to pass some information to my bundles. My last
>>>> hope was to use the JVM -D arguments. Unfortunately these are not made
>>>> available to the bundles. I was hoping to find them through
>>>> System.getProperty(). Am I doing something wrong here or this is a
>>>> well know feature? Is there a workaround that would allow me to pass
>>>> information from my custom launcher to my bundles?
>>>>
>>>> Thanks,
>>>> Max.
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
>>>> For additional commands, e-mail: users-help@felix.apache.org
>>>>
>>>>
>>>>
>>>>
>>>
>>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
>> For additional commands, e-mail: users-help@felix.apache.org
>>
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
>
>

Re: Passing information from the launcher to the bundles

Posted by "Richard S. Hall" <he...@ungoverned.org>.
Sounds pretty weird to me. In your launcher, make sure you can read the 
system properties in both cases.

-> richard

On 7/3/10 21:48, Max Bridgewater wrote:
> I've been making some progress with this issue. I've got one scenario
> where the system property is disappearing and the other where it is
> available to the bundles.
>
> The settings: I have a jar that contains all my jars (including
> bundles). My loader reads this ueberjar, starts Felix, and initiates
> the loading of bundles. The difference between the two approaches is
> in how the InputStream passed to installBundle() is obtained. In the
> working case, the input stream is obtained from the  the ueberjar by
> doing: this.getClass().getResourceAsStream("/" + jarEntry.getName().
> In the second case where the system properties disappear, I read the
> binaries from the ueberjar, construct a ByteArrayInputStream() and
> pass it to BundleContext.installBundle().
>
> This is very weird. I can't explain why this should make any difference.
>
> I appreciate your input.
> Max.
>
>
> On Sat, Jul 3, 2010 at 3:38 PM, Angelo van der Sijpt
> <an...@luminis.eu>  wrote:
>    
>> Hi Max,
>>
>> It depends on what you are trying to accomplish, and what your system looks
>> like. Using system properties by -D should work fine if you use the default
>> launcher, but if you have something 'special', this could break down.
>>
>> If you need to pass information to you bundles because you want to configure
>> them for some environment or composition, you could have a look at the
>> Configuration Admin (part of the compendium spec).
>>
>> Do you have a little more information about you situation and goals?
>>
>> Angelo
>>
>> On Sat, Jul 3, 2010 at 5:51 PM, Max Bridgewater
>> <ma...@gmail.com>wrote:
>>
>>      
>>> Hi,
>>>
>>> I'm desperately trying to pass some information to my bundles. My last
>>> hope was to use the JVM -D arguments. Unfortunately these are not made
>>> available to the bundles. I was hoping to find them through
>>> System.getProperty(). Am I doing something wrong here or this is a
>>> well know feature? Is there a workaround that would allow me to pass
>>> information from my custom launcher to my bundles?
>>>
>>> Thanks,
>>> Max.
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
>>> For additional commands, e-mail: users-help@felix.apache.org
>>>
>>>
>>>        
>>      
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
>
>    

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Re: Passing information from the launcher to the bundles

Posted by Max Bridgewater <ma...@gmail.com>.
I've been making some progress with this issue. I've got one scenario
where the system property is disappearing and the other where it is
available to the bundles.

The settings: I have a jar that contains all my jars (including
bundles). My loader reads this ueberjar, starts Felix, and initiates
the loading of bundles. The difference between the two approaches is
in how the InputStream passed to installBundle() is obtained. In the
working case, the input stream is obtained from the  the ueberjar by
doing: this.getClass().getResourceAsStream("/" + jarEntry.getName().
In the second case where the system properties disappear, I read the
binaries from the ueberjar, construct a ByteArrayInputStream() and
pass it to BundleContext.installBundle().

This is very weird. I can't explain why this should make any difference.

I appreciate your input.
Max.


On Sat, Jul 3, 2010 at 3:38 PM, Angelo van der Sijpt
<an...@luminis.eu> wrote:
> Hi Max,
>
> It depends on what you are trying to accomplish, and what your system looks
> like. Using system properties by -D should work fine if you use the default
> launcher, but if you have something 'special', this could break down.
>
> If you need to pass information to you bundles because you want to configure
> them for some environment or composition, you could have a look at the
> Configuration Admin (part of the compendium spec).
>
> Do you have a little more information about you situation and goals?
>
> Angelo
>
> On Sat, Jul 3, 2010 at 5:51 PM, Max Bridgewater
> <ma...@gmail.com>wrote:
>
>> Hi,
>>
>> I'm desperately trying to pass some information to my bundles. My last
>> hope was to use the JVM -D arguments. Unfortunately these are not made
>> available to the bundles. I was hoping to find them through
>> System.getProperty(). Am I doing something wrong here or this is a
>> well know feature? Is there a workaround that would allow me to pass
>> information from my custom launcher to my bundles?
>>
>> Thanks,
>> Max.
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
>> For additional commands, e-mail: users-help@felix.apache.org
>>
>>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Re: Passing information from the launcher to the bundles

Posted by Angelo van der Sijpt <an...@luminis.eu>.
Hi Max,

It depends on what you are trying to accomplish, and what your system looks
like. Using system properties by -D should work fine if you use the default
launcher, but if you have something 'special', this could break down.

If you need to pass information to you bundles because you want to configure
them for some environment or composition, you could have a look at the
Configuration Admin (part of the compendium spec).

Do you have a little more information about you situation and goals?

Angelo

On Sat, Jul 3, 2010 at 5:51 PM, Max Bridgewater
<ma...@gmail.com>wrote:

> Hi,
>
> I'm desperately trying to pass some information to my bundles. My last
> hope was to use the JVM -D arguments. Unfortunately these are not made
> available to the bundles. I was hoping to find them through
> System.getProperty(). Am I doing something wrong here or this is a
> well know feature? Is there a workaround that would allow me to pass
> information from my custom launcher to my bundles?
>
> Thanks,
> Max.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
>
>