You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@felix.apache.org by Matt Tennant <mt...@4home.com> on 2009/10/12 22:14:49 UTC

restarting bundles from outside framework

Hi all,

It seems like there should be a simple solution to my problem.  Occasionally the device with our software (deployed within Felix framework) is shut off when it is in the middle of restarting a bundle.  If this happens, then when everything is restarted that bundle my be in an "installed", rather than "active", state.

We don't have any bundles installed that we don't want started whenever the framework starts.  But we do need to use the bundle cache, so we can't wipe it out and start from scratch each time.  So, is there any way of telling Felix at startup that all installed bundles should be started, even if they weren't running before?  I didn't see anything obvious at:  http://felix.apache.org/site/apache-felix-framework-usage-documentation.html#ApacheFelixFrameworkUsageDocumentation-configuringframework

On a related note, especially if there is no solution to the above, has anybody figured out a good way to issue framework commands from outside the framework?  For instance, if I have the external telnet port set up (where framework prompt is available via telnet), then I can issue framework commands via a script that connects over telnet.  But telnet isn't installed on the host device, so this only works from a computer on the network.  I'd be very interested in another way of doing this that doesn't require a telnet program.  If I have to, I'll try writing a c program to communicate over tcp/ip to the telnet port, but I'm hoping for a cleaner solution.

So, problem 1) start Felix and force all installed bundles to start, no matter where they left off.  Problem 2) issue framework command to a running Felix framework from the same host device.

Thanks for any advice!
Matt

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


Re: restarting bundles from outside framework

Posted by "Richard S. Hall" <he...@ungoverned.org>.
If you are using the default Felix launcher, then you can just list all 
of the bundles on the felix.auto.start.<n> property and they will be 
[installed if needed] and started every time the framework is launched. 
If you have your own launcher, then it should be trivial to add this 
capability to it as well.

-> richard

On 10/12/09 22:14, Matt Tennant wrote:
> Hi all,
>
> It seems like there should be a simple solution to my problem.  Occasionally the device with our software (deployed within Felix framework) is shut off when it is in the middle of restarting a bundle.  If this happens, then when everything is restarted that bundle my be in an "installed", rather than "active", state.
>
> We don't have any bundles installed that we don't want started whenever the framework starts.  But we do need to use the bundle cache, so we can't wipe it out and start from scratch each time.  So, is there any way of telling Felix at startup that all installed bundles should be started, even if they weren't running before?  I didn't see anything obvious at:  http://felix.apache.org/site/apache-felix-framework-usage-documentation.html#ApacheFelixFrameworkUsageDocumentation-configuringframework
>
> On a related note, especially if there is no solution to the above, has anybody figured out a good way to issue framework commands from outside the framework?  For instance, if I have the external telnet port set up (where framework prompt is available via telnet), then I can issue framework commands via a script that connects over telnet.  But telnet isn't installed on the host device, so this only works from a computer on the network.  I'd be very interested in another way of doing this that doesn't require a telnet program.  If I have to, I'll try writing a c program to communicate over tcp/ip to the telnet port, but I'm hoping for a cleaner solution.
>
> So, problem 1) start Felix and force all installed bundles to start, no matter where they left off.  Problem 2) issue framework command to a running Felix framework from the same host device.
>
> Thanks for any advice!
> Matt
>
> ---------------------------------------------------------------------
> 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: restarting bundles from outside framework

Posted by Karl Pauls <ka...@gmail.com>.
Have a look at startlevels. I think that should give you what you are
looking for. Furthermore, as you are on the outside, you could write a
launcher which just loops through all bundles and makes sure they are
started after the framework has been started.

Regarding the issue commands question: Have a look at shell.tui. All
it does is to read from stdin and give the line to the shell service
which will parse it and execute the command in question. You can write
your own bundle which does the same but gets the input from somewhere
else (whatever is more convenient to you).

Hope that helps.

regards,

Karl

On Mon, Oct 12, 2009 at 10:14 PM, Matt Tennant <mt...@4home.com> wrote:
> Hi all,
>
> It seems like there should be a simple solution to my problem.  Occasionally the device with our software (deployed within Felix framework) is shut off when it is in the middle of restarting a bundle.  If this happens, then when everything is restarted that bundle my be in an "installed", rather than "active", state.
>
> We don't have any bundles installed that we don't want started whenever the framework starts.  But we do need to use the bundle cache, so we can't wipe it out and start from scratch each time.  So, is there any way of telling Felix at startup that all installed bundles should be started, even if they weren't running before?  I didn't see anything obvious at:  http://felix.apache.org/site/apache-felix-framework-usage-documentation.html#ApacheFelixFrameworkUsageDocumentation-configuringframework
>
> On a related note, especially if there is no solution to the above, has anybody figured out a good way to issue framework commands from outside the framework?  For instance, if I have the external telnet port set up (where framework prompt is available via telnet), then I can issue framework commands via a script that connects over telnet.  But telnet isn't installed on the host device, so this only works from a computer on the network.  I'd be very interested in another way of doing this that doesn't require a telnet program.  If I have to, I'll try writing a c program to communicate over tcp/ip to the telnet port, but I'm hoping for a cleaner solution.
>
> So, problem 1) start Felix and force all installed bundles to start, no matter where they left off.  Problem 2) issue framework command to a running Felix framework from the same host device.
>
> Thanks for any advice!
> Matt
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
>
>



-- 
Karl Pauls
karlpauls@gmail.com

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


Re: Need help finding Bundle

Posted by "Richard S. Hall" <he...@ungoverned.org>.
On 10/13/09 21:21, Pruitt, Byron S wrote:
> 1)  Sorry, you are right.  I have some components that do not have interfaces.  They are activated and they perform some actions and then set in the dark I guess.  Its these that do not show up.
>
> 2)  Ah, misunderstanding on my part.  I was looking for scr:reference values.  Then I should be able to discover what I need via the Bundles.
>    

Ok, that was the confusing part. You didn't mention in your last message 
that you were talking about Declarative Services. DS != OSGi. It is a 
layer on top of the OSGi framework to simplify working with services.

In that case, there may or may not be ways to get the information you 
want from SCR, since it does have some reflective capabilities, but I am 
not personally familiar with them, but other people on the list are, so 
maybe they can respond with more details.

-> richard

> Thanks.
>
> -S
>
> -----Original Message-----
> From: Richard S. Hall [mailto:heavy@ungoverned.org]
> Sent: Tuesday, October 13, 2009 2:38 PM
> To: users@felix.apache.org
> Subject: Re: Need help finding Bundle
>
> On 10/13/09 18:41, Pruitt, Byron S wrote:
>    
>> I am developing a stand-alone bundle that produces various configuration reports on bundles contained in my application.  Going through the Bundle and BundleContext api I get most of what I want.  There are two things I can't find a way to access.
>>
>> 1) The Bundle components that are not a service.  There is no ServiceReference for them.
>>
>>      
> It is not clear what you mean here. There is no such thing as bundle
> components that are not services. Only services registered by bundles
> are tracked by OSGi and can be accessed by other bundles. There is no
> other "component" concept in OSGi, other than the Bundle object itself.
>
> This is different if you are using something like iPOJO, which has a
> component concept.
>
>    
>> 2), For a given ServiceReference, I can't list any services it references.
>>
>>      
> In OSGi services do not really use services, bundles do. So, you can
> only find out which services a bundle uses.
>
> As another counterpoint, in iPOJO there is a concept of service
> contract-level dependencies, which specify which services a service uses.
>
> ->  richard
>
>    
>> Does anyone know an easy to get to these things?  It's not obvious to me.
>>
>> Thanks in advance,
>>
>> -Steve
>>
>>      
> ---------------------------------------------------------------------
> 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: Need help finding Bundle

Posted by "Pruitt, Byron S" <st...@hp.com>.
1)  Sorry, you are right.  I have some components that do not have interfaces.  They are activated and they perform some actions and then set in the dark I guess.  Its these that do not show up.

2)  Ah, misunderstanding on my part.  I was looking for scr:reference values.  Then I should be able to discover what I need via the Bundles.

Thanks.

-S

-----Original Message-----
From: Richard S. Hall [mailto:heavy@ungoverned.org] 
Sent: Tuesday, October 13, 2009 2:38 PM
To: users@felix.apache.org
Subject: Re: Need help finding Bundle

On 10/13/09 18:41, Pruitt, Byron S wrote:
> I am developing a stand-alone bundle that produces various configuration reports on bundles contained in my application.  Going through the Bundle and BundleContext api I get most of what I want.  There are two things I can't find a way to access.
>
> 1) The Bundle components that are not a service.  There is no ServiceReference for them.
>    

It is not clear what you mean here. There is no such thing as bundle 
components that are not services. Only services registered by bundles 
are tracked by OSGi and can be accessed by other bundles. There is no 
other "component" concept in OSGi, other than the Bundle object itself.

This is different if you are using something like iPOJO, which has a 
component concept.

> 2), For a given ServiceReference, I can't list any services it references.
>    

In OSGi services do not really use services, bundles do. So, you can 
only find out which services a bundle uses.

As another counterpoint, in iPOJO there is a concept of service 
contract-level dependencies, which specify which services a service uses.

-> richard

> Does anyone know an easy to get to these things?  It's not obvious to me.
>
> Thanks in advance,
>
> -Steve
>    

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


Re: Need help finding Bundle

Posted by "Richard S. Hall" <he...@ungoverned.org>.
On 10/13/09 18:41, Pruitt, Byron S wrote:
> I am developing a stand-alone bundle that produces various configuration reports on bundles contained in my application.  Going through the Bundle and BundleContext api I get most of what I want.  There are two things I can't find a way to access.
>
> 1) The Bundle components that are not a service.  There is no ServiceReference for them.
>    

It is not clear what you mean here. There is no such thing as bundle 
components that are not services. Only services registered by bundles 
are tracked by OSGi and can be accessed by other bundles. There is no 
other "component" concept in OSGi, other than the Bundle object itself.

This is different if you are using something like iPOJO, which has a 
component concept.

> 2), For a given ServiceReference, I can't list any services it references.
>    

In OSGi services do not really use services, bundles do. So, you can 
only find out which services a bundle uses.

As another counterpoint, in iPOJO there is a concept of service 
contract-level dependencies, which specify which services a service uses.

-> richard

> Does anyone know an easy to get to these things?  It's not obvious to me.
>
> Thanks in advance,
>
> -Steve
>    

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


Need help finding Bundle

Posted by "Pruitt, Byron S" <st...@hp.com>.
I am developing a stand-alone bundle that produces various configuration reports on bundles contained in my application.  Going through the Bundle and BundleContext api I get most of what I want.  There are two things I can't find a way to access.

1) The Bundle components that are not a service.  There is no ServiceReference for them.
2), For a given ServiceReference, I can't list any services it references.

Does anyone know an easy to get to these things?  It's not obvious to me.

Thanks in advance,

-Steve

Re: restarting bundles from outside framework

Posted by Matt Tennant <mt...@4home.com>.
Hi Marcel and other responders,

Thanks for the response, even the shameless plug. I plan to look into those projects for my company. 

Yes, I do have a management agent. Unfortunately, it is not in its own bundle, but is instead included in the bundle that is often found stopped. I now believe that might be what I have to change (separate it out).

I'll do that. Hopefully the separated bundle will rarely need to change. 

Thanks,
Matt

----- Original Message -----
From: Marcel Offermans <ma...@luminis.nl>
To: users@felix.apache.org
Sent: Mon, 12 Oct 2009 15:32:02 -0500 (CDT)
Subject: Re: restarting bundles from outside framework

Hello Matt,

On Oct 12, 2009, at 22:14 , Matt Tennant wrote:

> It seems like there should be a simple solution to my problem.   
> Occasionally the device with our software (deployed within Felix  
> framework) is shut off when it is in the middle of restarting a  
> bundle.  If this happens, then when everything is restarted that  
> bundle my be in an "installed", rather than "active", state.

I'm assuming you have a bundle that is responsible for updating other  
bundles? That's what we usually call the "management agent".

>
> We don't have any bundles installed that we don't want started  
> whenever the framework starts.  But we do need to use the bundle  
> cache, so we can't wipe it out and start from scratch each time.   
> So, is there any way of telling Felix at startup that all installed  
> bundles should be started, even if they weren't running before?  I  
> didn't see anything obvious at:  http://felix.apache.org/site/apache-felix-framework-usage-documentation.html#ApacheFelixFrameworkUsageDocumentation-configuringframework

What about having this "management agent" bundle I mentioned above go  
over bundles and start them if they were not started? If this bundle  
already has knowledge about what to update and when, then it is  
probably also the best place to make sure everything stays "active".

> On a related note, especially if there is no solution to the above,  
> has anybody figured out a good way to issue framework commands from  
> outside the framework?  For instance, if I have the external telnet  
> port set up (where framework prompt is available via telnet), then I  
> can issue framework commands via a script that connects over  
> telnet.  But telnet isn't installed on the host device, so this only  
> works from a computer on the network.  I'd be very interested in  
> another way of doing this that doesn't require a telnet program.  If  
> I have to, I'll try writing a c program to communicate over tcp/ip  
> to the telnet port, but I'm hoping for a cleaner solution.

We have a bundle that allows you to telnet into a remote shell.
We also have a web console that you can use to remotely "manage" the  
framework.
There also is a JMX based interface to (again remotely) connect and  
manage bundles.
...and I might be forgetting one or two... ;)

> So, problem 1) start Felix and force all installed bundles to start,  
> no matter where they left off.  Problem 2) issue framework command  
> to a running Felix framework from the same host device.

<shameless-plug>
You might also want to take a look at Apache ACE, in incubation  
currently, that is a system for remotely managing and updating OSGi  
bundles and configuration data.
</shameless-plug>

Of course, there are other alternatives for that too, such as the  
Apache Felix File Installer and Apache Felix Karaf subprojects found  
here.

Greetings, Marcel


---------------------------------------------------------------------
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: restarting bundles from outside framework

Posted by Marcel Offermans <ma...@luminis.nl>.
Hello Matt,

On Oct 12, 2009, at 22:14 , Matt Tennant wrote:

> It seems like there should be a simple solution to my problem.   
> Occasionally the device with our software (deployed within Felix  
> framework) is shut off when it is in the middle of restarting a  
> bundle.  If this happens, then when everything is restarted that  
> bundle my be in an "installed", rather than "active", state.

I'm assuming you have a bundle that is responsible for updating other  
bundles? That's what we usually call the "management agent".

>
> We don't have any bundles installed that we don't want started  
> whenever the framework starts.  But we do need to use the bundle  
> cache, so we can't wipe it out and start from scratch each time.   
> So, is there any way of telling Felix at startup that all installed  
> bundles should be started, even if they weren't running before?  I  
> didn't see anything obvious at:  http://felix.apache.org/site/apache-felix-framework-usage-documentation.html#ApacheFelixFrameworkUsageDocumentation-configuringframework

What about having this "management agent" bundle I mentioned above go  
over bundles and start them if they were not started? If this bundle  
already has knowledge about what to update and when, then it is  
probably also the best place to make sure everything stays "active".

> On a related note, especially if there is no solution to the above,  
> has anybody figured out a good way to issue framework commands from  
> outside the framework?  For instance, if I have the external telnet  
> port set up (where framework prompt is available via telnet), then I  
> can issue framework commands via a script that connects over  
> telnet.  But telnet isn't installed on the host device, so this only  
> works from a computer on the network.  I'd be very interested in  
> another way of doing this that doesn't require a telnet program.  If  
> I have to, I'll try writing a c program to communicate over tcp/ip  
> to the telnet port, but I'm hoping for a cleaner solution.

We have a bundle that allows you to telnet into a remote shell.
We also have a web console that you can use to remotely "manage" the  
framework.
There also is a JMX based interface to (again remotely) connect and  
manage bundles.
...and I might be forgetting one or two... ;)

> So, problem 1) start Felix and force all installed bundles to start,  
> no matter where they left off.  Problem 2) issue framework command  
> to a running Felix framework from the same host device.

<shameless-plug>
You might also want to take a look at Apache ACE, in incubation  
currently, that is a system for remotely managing and updating OSGi  
bundles and configuration data.
</shameless-plug>

Of course, there are other alternatives for that too, such as the  
Apache Felix File Installer and Apache Felix Karaf subprojects found  
here.

Greetings, Marcel


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