Autostart bundle when launching pelix.shell

13 views
Skip to first unread message

Freemon Johnson

unread,
Jun 2, 2016, 10:56:51 AM6/2/16
to ipopo-dev
Hi Thomas,

Can you tell me is there a way to have a bundle automatically load at runtime when pelix.shell is launched. I am trying to avoid using the command install <bundle-name>. If there is a path I can place the bundles in to have them automatically load that would be fine as well. 

As an example when launching pelix.shell pelix the following automatically load without user interaction. I know these bundles are necessary for ipopo to run but I was hoping I can do the same with own bundles.

+----+-----------------------------------+--------+---------+
| ID |               Name                | State  | Version |
+====+===================================+========+=========+
| 0  | pelix.framework                   | ACTIVE | 0.6.4   |
+----+-----------------------------------+--------+---------+
| 1  | pelix.ipopo.core                  | ACTIVE | 0.6.4   |
+----+-----------------------------------+--------+---------+
| 2  | pelix.shell.core                  | ACTIVE | 0.6.4   |
+----+-----------------------------------+--------+---------+
| 3  | pelix.shell.console               | ACTIVE | 0.6.4   |
+----+-----------------------------------+--------+---------+
| 4  | pelix.shell.ipopo                 | ACTIVE | 0.6.4   |
+----+-----------------------------------+--------+---------+
| 5  | pelix.ipopo.handlers.properties   | ACTIVE | 0.6.4   |
+----+-----------------------------------+--------+---------+
| 6  | pelix.ipopo.handlers.provides     | ACTIVE | 0.6.4   |
+----+-----------------------------------+--------+---------+
| 7  | pelix.ipopo.handlers.requires     | ACTIVE | 0.6.4   |
+----+-----------------------------------+--------+---------+
| 8  | pelix.ipopo.handlers.requiresbest | ACTIVE | 0.6.4   |
+----+-----------------------------------+--------+---------+
| 9  | pelix.ipopo.handlers.requiresmap  | ACTIVE | 0.6.4   |
+----+-----------------------------------+--------+---------+
| 10 | pelix.ipopo.handlers.temporal     | ACTIVE | 0.6.4


Cheers,
Freemon

Thomas Calmant

unread,
Jun 3, 2016, 4:02:39 AM6/3/16
to ipop...@googlegroups.com
Hi Freemon,


Can you tell me is there a way to have a bundle automatically load at runtime when pelix.shell is launched. I am trying to avoid using the command install <bundle-name>. If there is a path I can place the bundles in to have them automatically load that would be fine as well. 

Currently, there is no "autoload" folder behaviour.

If you use the pelix shell, you can use its "--init <file>" argument, which will read a file containing shell commands.
It is executed by the same parser as the console, so you can set variables, install and start bundles...

This is an example of such a file:

# Start some bundles
install my.bundle

# $? keeps the results of the last command which returned a value
start $?

install my.other.bundle
start $?

set foo=bar
echo $bar
 

As an example when launching pelix.shell pelix the following automatically load without user interaction. I know these bundles are necessary for ipopo to run but I was hoping I can do the same with own bundles.

In fact, this is the main() method of the pelix.shell.console module which starts the framework and pre-installs iPOPO, as it depends on it.
iPOPO itself installs a constant list of bundles to activate the core handlers.

You could, for example, write a simple bundle with an activator: when started, it could install and start all the bundles you need.

Cheers,
Thomas

Reply all
Reply to author
Forward
0 new messages