blob: 46c915bf3de2f23b8daafe231fd5d934122ed02b [file] [log] [blame]
Richard S. Hall2cd5bed2007-07-16 20:32:41 +00001<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
Karl Paulsf7d389c2008-11-06 16:22:54 +00002<html><head>
Richard S. Hall2cd5bed2007-07-16 20:32:41 +00003
4
5
Karl Paulsf7d389c2008-11-06 16:22:54 +00006 <title>Apache Felix - Apache Felix Usage Documentation</title>
Karl Pauls44987e52007-09-16 20:54:55 +00007 <link rel="stylesheet" href="apache-felix-usage-documentation_files/site.css" type="text/css" media="all">
Karl Paulsf7d389c2008-11-06 16:22:54 +00008 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
9 </head><body>
10 <div class="title"><div class="logo"><a href="http://felix.apache.org/site/index.html"><img alt="Apache Felix" src="apache-felix-usage-documentation_files/logo.png" border="0"></a></div><div class="header"><a href="http://www.apache.org/"><img alt="Apache" src="apache-felix-usage-documentation-Dateien/apache.png" border="0"></a></div></div>
Richard S. Hall2cd5bed2007-07-16 20:32:41 +000011 <div class="menu">
Karl Paulsf7d389c2008-11-06 16:22:54 +000012
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267 &gt;
Karl Pauls44987e52007-09-16 20:54:55 +0000268 <li><a href="http://felix.apache.org/site/news.html" title="news">news</a></li>
Karl Pauls44987e52007-09-16 20:54:55 +0000269 <li><a href="http://felix.apache.org/site/license.html" title="license">license</a></li>
270 <li><span class="nobr"><a href="http://felix.apache.org/site/downloads.cgi" title="Visit page outside Confluence" rel="nofollow">downloads<sup><img class="rendericon" src="apache-felix-usage-documentation_files/linkext7.gif" alt="" align="absmiddle" border="0" height="7" width="7"></sup></a></span></li>
271 <li><a href="http://felix.apache.org/site/documentation.html" title="documentation">documentation</a></li>
272 <li><a href="http://felix.apache.org/site/mailinglists.html" title="mailinglists">mailing lists</a></li>
Karl Paulsf7d389c2008-11-06 16:22:54 +0000273 <li><a href="http://felix.apache.org/site/contributing.html" title="Contributing">contributing</a></li>
274 <li><span class="nobr"><a href="http://www.apache.org/" title="Visit page outside Confluence" rel="nofollow">asf<sup><img class="rendericon" src="apache-felix-usage-documentation_files/linkext7.gif" alt="" align="absmiddle" border="0" height="7" width="7"></sup></a></span></li>
275 <li><span class="nobr"><a href="http://www.apache.org/foundation/sponsorship.html" title="Visit page outside Confluence" rel="nofollow">sponsorship<sup><img class="rendericon" src="apache-felix-usage-documentation_files/linkext7.gif" alt="" align="absmiddle" border="0" height="7" width="7"></sup></a></span></li>
276 <li><span class="nobr"><a href="http://www.apache.org/foundation/thanks.html" title="Visit page outside Confluence" rel="nofollow">sponsors<sup><img class="rendericon" src="apache-felix-usage-documentation_files/linkext7.gif" alt="" align="absmiddle" border="0" height="7" width="7"></sup></a></span>
277<!-- ApacheCon Ad -->
278<iframe src="apache-felix-usage-documentation_files/button.html" style="border-width: 0pt; float: left;" frameborder="0" height="135" scrolling="no" width="135"></iframe>
279<p style="height: 100px;">
280<!-- ApacheCon Ad -->
281&lt;
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445 </p></li></div>
Richard S. Hall2cd5bed2007-07-16 20:32:41 +0000446 <div class="main">
447<h1><a name="ApacheFelixUsageDocumentation-ApacheFelixUsageDocumentation"></a>Apache Felix Usage Documentation</h1>
448
449<ul>
450 <li><a href="#ApacheFelixUsageDocumentation-startingfelix" title="starting-felix on Apache Felix Usage Documentation">Starting Felix</a></li>
451 <li><a href="#ApacheFelixUsageDocumentation-felixshell" title="felix-shell on Apache Felix Usage Documentation">Felix Shell</a>
452 <ul>
453 <li><a href="#ApacheFelixUsageDocumentation-installingbundles" title="installing-bundles on Apache Felix Usage Documentation">Installing Bundles</a></li>
454 <li><a href="#ApacheFelixUsageDocumentation-installingbundlesproxies" title="installing-bundles-proxies on Apache Felix Usage Documentation">Web Proxy Issues when Installing Bundles</a></li>
455 </ul>
456 </li>
457 <li><a href="#ApacheFelixUsageDocumentation-configuringfelix" title="configuring-felix on Apache Felix Usage Documentation">Configuring Felix</a>
458 <ul>
Karl Paulsf7d389c2008-11-06 16:22:54 +0000459 <li><a href="#ApacheFelixUsageDocumentation-migrating" title="migrating on Apache Felix Usage Documentation">Migrating from Earlier Versions</a></li>
Richard S. Hall2cd5bed2007-07-16 20:32:41 +0000460 <li><a href="#ApacheFelixUsageDocumentation-propertysubstitution" title="property-substitution on Apache Felix Usage Documentation">System Property Substitution</a></li>
461 <li><a href="#ApacheFelixUsageDocumentation-defaultshell" title="default-shell on Apache Felix Usage Documentation">Changing the Command Shell User Interface</a></li>
462 </ul>
463 </li>
464 <li><a href="#ApacheFelixUsageDocumentation-configuringbundles" title="configuring-bundles on Apache Felix Usage Documentation">Configuring Bundles</a></li>
465 <li><a href="#ApacheFelixUsageDocumentation-feedback" title="feedback on Apache Felix Usage Documentation">Feedback</a></li>
466</ul>
467
468
469<p><a name="ApacheFelixUsageDocumentation-startingfelix"></a></p>
470
471<h2><a name="ApacheFelixUsageDocumentation-StartingFelix"></a>Starting Felix</h2>
Karl Paulsf7d389c2008-11-06 16:22:54 +0000472
Richard S. Hall2cd5bed2007-07-16 20:32:41 +0000473<p>Start Felix from the installation directory by typing:</p>
Karl Paulsf7d389c2008-11-06 16:22:54 +0000474
Richard S. Hall2cd5bed2007-07-16 20:32:41 +0000475<div class="preformatted"><div class="preformattedContent">
476<pre>java -jar bin/felix.jar
477</pre>
478</div></div>
Karl Paulsf7d389c2008-11-06 16:22:54 +0000479
480<p>After Felix starts, the text-based shell interface is started. It is possible to <a href="#ApacheFelixUsageDocumentation-defaultshell" title="default-shell on Apache Felix Usage Documentation">change your default shell user interface</a>. Felix stores all installed bundles into a bundle cache directory. By default, Felix creates a cache directory, called <tt>felix-cache</tt>, in your current working directory; this behavior is configurable, see the <a href="http://felix.apache.org/site/apache-felix-bundle-cache.html" title="Apache Felix Bundle Cache">Apache Felix Bundle Cache</a> document for more details.</p>
481
482<p>If you want to start Felix using a different bundle cache directory, you can start Felix like this:</p>
483
484<div class="preformatted"><div class="preformattedContent">
485<pre>java -jar bin/felix.jar &lt;cache-path&gt;
486</pre>
487</div></div>
488
489<p>Where <tt>&lt;cache-path&gt;</tt> is the path you want to use as the
490bundle cache. If you specify a relative cache path, then it will be
491treated as relative to the current working directory.</p>
492
493<table class="infoMacro" align="center" border="0" cellpadding="5" cellspacing="8" width="85%"><colgroup><col width="24"><col></colgroup><tbody><tr><td valign="top"><img src="apache-felix-usage-documentation_files/information.gif" alt="" align="absmiddle" border="0" height="16" width="16"></td><td><b class="strong">Useful Information</b><br>
494<p>Previous versions of Felix prompted for a profile name when executed. The profile name was used to create a directory inside <tt>.felix/</tt>
495in the users home directory. This approach allowed user's to have
496different sets of bundles for different purposes, e.g., testing,
497production, etc. If this behavior is still desired, it is very easy to
498mimic. Modify <tt>conf/config.properties</tt> to include "<tt>felix.cache.rootdir=${user.home}/.felix</tt>". Now, if you start Felix with something like "<tt>java -jar bin/felix.jar foo</tt>", it will use "<tt>${user.home}/.felix/foo/</tt>"
499as the bundle cache directory, where "${user.home}" is automatically
500substituted with the appropriate system property by the launcher.</p></td></tr></tbody></table>
Richard S. Hall2cd5bed2007-07-16 20:32:41 +0000501
502<p><a name="ApacheFelixUsageDocumentation-felixshell"></a></p>
503
504<h2><a name="ApacheFelixUsageDocumentation-FelixShell"></a>Felix Shell</h2>
Karl Paulsf7d389c2008-11-06 16:22:54 +0000505
Richard S. Hall2cd5bed2007-07-16 20:32:41 +0000506<p>The main way to interact with Felix is via its shell service. Felix'
507shell service is implemented as an OSGi service that, be default, uses
508a simple text-based user interface. After starting Felix, type <tt>help</tt> into the shell to see the list of the available commands; these are the default commands:</p>
Karl Paulsf7d389c2008-11-06 16:22:54 +0000509
Richard S. Hall2cd5bed2007-07-16 20:32:41 +0000510<div class="preformatted"><div class="preformattedContent">
511<pre>bundlelevel &lt;level&gt; &lt;id&gt; ... | &lt;id&gt; - set or get bundle start level.
512cd [&lt;base-URL&gt;] - change or display base URL.
513headers [&lt;id&gt; ...] - display bundle header properties.
514help - display shell commands.
515install &lt;URL&gt; [&lt;URL&gt; ...] - install bundle(s).
516obr help - OSGi bundle repository.
517packages [&lt;id&gt; ...] - list exported packages.
518ps [-l | -u] - list installed bundles.
519refresh - refresh packages.
520services [-u] [-a] [&lt;id&gt; ...] - list registered or used services.
521shutdown - shutdown Felix.
522start &lt;id&gt; [&lt;id&gt; &lt;URL&gt; ...] - start bundle(s).
523startlevel [&lt;level&gt;] - get or set framework start level.
524stop &lt;id&gt; [&lt;id&gt; ...] - stop bundle(s).
525uninstall &lt;id&gt; [&lt;id&gt; ...] - uninstall bundle(s).
526update &lt;id&gt; [&lt;URL&gt;] - update bundle.
527version - display version of framework.
528</pre>
529</div></div>
Karl Paulsf7d389c2008-11-06 16:22:54 +0000530
Richard S. Hall2cd5bed2007-07-16 20:32:41 +0000531<p>For a detailed description of how to install bundles into Felix refer to the next <a href="#ApacheFelixUsageDocumentation-installingbundles" title="installing-bundles on Apache Felix Usage Documentation">sub-section</a>; the remainder of this section briefly describes shell behavior.</p>
532
533<p>Despite the fact that the Felix shell tries to mimic a typical Unix-like shell, it is actually quite limited. The notion of <tt>cd</tt>,
534for example, is only used to specify a default base URL in order to
535save typing. To illustrate, assume that you want to install several
536bundles from a directory on your disk, you could type:</p>
Karl Paulsf7d389c2008-11-06 16:22:54 +0000537
Richard S. Hall2cd5bed2007-07-16 20:32:41 +0000538<div class="preformatted"><div class="preformattedContent">
539<pre>cd file:/c:/projects/felix/bundle/
540</pre>
541</div></div>
Karl Paulsf7d389c2008-11-06 16:22:54 +0000542
Richard S. Hall2cd5bed2007-07-16 20:32:41 +0000543<p>After issuing this <tt>cd</tt> command, you no longer need to type
544the complete URL for bundles located in the above directory, only the
545name of the bundle JAR file is necessary. It is not possible to perform
546an equivalent <tt>ls</tt> command to list the contents of the current
547base URL, since this operation is not possible with URLs. To view all
548currently installed bundles, use the <tt>ps</tt> command.</p>
549
Karl Paulsf7d389c2008-11-06 16:22:54 +0000550<p>To exit the Felix shell, simply type <tt>stop 0</tt> to stop the
551System Bundle; any installed bundles will automatically be reloaded the
552next time you start the associated profile. Additionally, any active
553bundles will be reactivated the next time you restart the framework
554with the same bundle cache.</p>
Richard S. Hall2cd5bed2007-07-16 20:32:41 +0000555
556<p><a name="ApacheFelixUsageDocumentation-installingbundles"></a></p>
557
558<h3><a name="ApacheFelixUsageDocumentation-InstallingBundles"></a>Installing Bundles</h3>
Karl Paulsf7d389c2008-11-06 16:22:54 +0000559
Richard S. Hall2cd5bed2007-07-16 20:32:41 +0000560<p>A bundle is the OSGi term for a component for the OSGi framework. A
561bundle is simply a JAR file containing a manifest and some combination
562of Java classes, embedded JAR files, native code, and resources. A
563bundle may provide some specific functionality for the user or it may
564implement a service that other bundles can use; bundles can only use
565functionality from other bundles through shared services and packages.</p>
566
567<p>Felix is packaged with four bundles, which are located in the <tt>bundle/</tt>
568directory of the Felix installation directory. There are bundles for
569the Felix shell service, a text-based shell service user interface, a
570bundle repository service, and a simple example bundle. In addition to
571these bundles, the bundle repository services provides access to many
572other bundles for easy installation. The bundle repository service
Karl Paulsf7d389c2008-11-06 16:22:54 +0000573provides a shell command, named <tt>obr</tt>, to access available bundles; refer to the <a href="http://felix.apache.org/site/apache-felix-osgi-bundle-repository.html" title="Apache Felix OSGi Bundle Repository">Apache Felix OSGi Bundle Repository</a> for more information.</p>
Richard S. Hall2cd5bed2007-07-16 20:32:41 +0000574
575<p>Before installing any bundles, it is important to understand how
576bundles are manually deployed into the framework. Bundles are deployed
577in two stages; first they are installed, then they are started. To
578install a bundle use the <tt>install</tt> shell command followed by a bundle URL. For example, to install the <tt>simple.jar</tt> bundle included with Felix you type (assuming you have started Felix from its installation directory):</p>
Karl Paulsf7d389c2008-11-06 16:22:54 +0000579
Richard S. Hall2cd5bed2007-07-16 20:32:41 +0000580<div class="preformatted"><div class="preformattedContent">
581<pre>install file:bundle/simple.jar
582</pre>
583</div></div>
Karl Paulsf7d389c2008-11-06 16:22:54 +0000584
Richard S. Hall2cd5bed2007-07-16 20:32:41 +0000585<p>Once a bundle is installed, it can then be started by using the <tt>start</tt> command and the bundle identifier of the desired bundle. The <tt>ps</tt>
586shell command is used to list all installed bundles and to obtain the
Karl Paulsf7d389c2008-11-06 16:22:54 +0000587bundle's identifier. The following Felix shell session capture
Richard S. Hall2cd5bed2007-07-16 20:32:41 +0000588illustrates how to start the <tt>simple.jar</tt> bundle:</p>
Karl Paulsf7d389c2008-11-06 16:22:54 +0000589
Richard S. Hall2cd5bed2007-07-16 20:32:41 +0000590<div class="preformatted"><div class="preformattedContent">
591<pre>-&gt; install [file:bundle/simple]
592-&gt; ps
593START LEVEL 1
594 ID State Level Name
595[ 0] [Active ] [ 0] System Bundle (0.8.0)
596[ 1] [Active ] [ 1] Shell Service (0.8.0)
597[ 2] [Active ] [ 1] Shell TUI (0.8.0)
598[ 3] [Active ] [ 1] Bundle Repository (0.8.0)
599[ 4] [Installed ] [ 1] Simple (0.8.0)
600-&gt; start 4
601Simple bundle 4 has started.
602From native: Hello!
603From embedded JAR: Hello!
604Entry: META-INF/
605Entry: org/
606Entry: libfoo.so
607The 'javax.servlet.http' package is not available.
608The 'javax.servlet' package is not available.
609-&gt;
610</pre>
611</div></div>
Karl Paulsf7d389c2008-11-06 16:22:54 +0000612
613<p>The <tt>stop</tt> command is used to stop a bundle and the <tt>uninstall</tt> command is used to remove a bundle from the bundle cache. As an alternative to using the <tt>install</tt> and <tt>start</tt> commands explicitly, it is also possible to install and start a bundle in one step by using the <tt>start</tt> command with a bundle URL.</p>
Richard S. Hall2cd5bed2007-07-16 20:32:41 +0000614
615<p>Bundles can be updated using the <tt>update</tt> command. The update
616command allows you to specify an URL from which to retrieve the updated
617bundle, but if one is not specified it will try to update the bundle
618from the bundle's <tt>Bundle-UpdateLocation</tt> manifest attribute, if present, or the bundle's original location URL.</p>
619
620<p><b>Important:</b> When you <tt>update</tt> or <tt>uninstall</tt> a
621bundle, the changes appear to take effect immediately, but in reality
622the changes are only partially enacted. If a bundle is updated or
623uninstalled and it was exporting packages, these packages are not
624removed until the framework is refreshed using the <tt>PackageAdmin</tt> service. The Felix shell offers a convenient <tt>refresh</tt> command for this purpose.</p>
625
626<p>For an introduction to writing bundles and services, refer to the Felix bundle tutorial.</p>
627
628<p><a name="ApacheFelixUsageDocumentation-installingbundlesproxies"></a></p>
629
630<h3><a name="ApacheFelixUsageDocumentation-WebProxyIssueswhenInstallingBundles"></a>Web Proxy Issues when Installing Bundles</h3>
Karl Paulsf7d389c2008-11-06 16:22:54 +0000631
Richard S. Hall2cd5bed2007-07-16 20:32:41 +0000632<p>If you use a proxy for Web access, then you may run into difficulty
633using the Felix shell to install bundles from a remote URL. To remedy
634this situation, certain system properties must be set to make Felix
635work with your proxy. These properties are:</p>
Karl Paulsf7d389c2008-11-06 16:22:54 +0000636
Richard S. Hall2cd5bed2007-07-16 20:32:41 +0000637<ul>
638 <li><tt>http.proxyHost</tt> - the name of the proxy host.</li>
639 <li><tt>http.proxyPort</tt> - the port of the proxy host.</li>
640 <li><tt>http.proxyAuth</tt>
641- the user name and password to use when connecting to the proxy; this
642string should be the user name and password separated by a colon (e.g.,
643<tt>rickhall:mypassword</tt>).</li>
644</ul>
645
646
647<p>These system properties can be set directly on the command line when starting the JVM using the standard "<tt>-D&lt;prop&gt;=&lt;value&gt;</tt>" syntax or you can put them in the <tt>lib/system.properties</tt> file of your Felix installation; see the next section on <a href="#ApacheFelixUsageDocumentation-configuringfelix" title="configuring-felix on Apache Felix Usage Documentation">configuring Felix</a> for more information.</p>
648
649<p><a name="ApacheFelixUsageDocumentation-configuringfelix"></a></p>
650
651<h2><a name="ApacheFelixUsageDocumentation-ConfiguringFelix"></a>Configuring Felix</h2>
Karl Paulsf7d389c2008-11-06 16:22:54 +0000652
653<p>Felix uses properties to configure certain aspects of its behavior. The Felix launcher (i.e., <tt>java -jar bin/felix.jar</tt>) reads configuration properties from two different locations in the installation directory: <tt>conf/system.properties</tt> and <tt>conf/config.properties</tt>. Both files use standard Java property file syntax.</p>
Richard S. Hall2cd5bed2007-07-16 20:32:41 +0000654
655<p>The <tt>conf/system.properties</tt> file provides a convenient
656mechanism for defining Java system properties, but it is largely
Karl Paulsf7d389c2008-11-06 16:22:54 +0000657ignored by Felix, since Felix does not typically use system properties
658for configuration purposes. Any properties placed in the <tt>conf/system.properties</tt> file are available at run time via <tt>System.getProperty()</tt> and <tt>BundleContext.getProperty()</tt>. It is also possible to specify a different location for the system properties file by using the <tt>felix.system.properties</tt> system property when executing Felix. For example:</p>
659
Richard S. Hall2cd5bed2007-07-16 20:32:41 +0000660<div class="preformatted"><div class="preformattedContent">
661<pre>java -Dfelix.system.properties=file:/home/rickhall/system.properties -jar bin/felix.jar
662</pre>
663</div></div>
Karl Paulsf7d389c2008-11-06 16:22:54 +0000664
665<p>Nearly all Felix configuration occurs using properties in the <tt>conf/config.properties</tt> file. It is possible to change the location of the configuration properties file by specifying a new location value using the <tt>felix.config.properties</tt>
Richard S. Hall2cd5bed2007-07-16 20:32:41 +0000666system property. It is necessary to use a system property here since
667Felix needs this value to start execution. As an example, the following
668command could be used to specify a custom location for the
669configuration properties file:</p>
Karl Paulsf7d389c2008-11-06 16:22:54 +0000670
Richard S. Hall2cd5bed2007-07-16 20:32:41 +0000671<div class="preformatted"><div class="preformattedContent">
672<pre>java -Dfelix.config.properties=file:/home/rickhall/config.properties -jar bin/felix.jar
673</pre>
674</div></div>
Karl Paulsf7d389c2008-11-06 16:22:54 +0000675
Richard S. Hall2cd5bed2007-07-16 20:32:41 +0000676<p>In this example the configuration properties will be read from the
677specified URL. All remaining configuration properties should be defined
678in the <tt>config.properties</tt> file itself. All configuration properties are accessible at run time via <tt>BundleContext.getProperty()</tt>.</p>
679
Karl Paulsf7d389c2008-11-06 16:22:54 +0000680<p>Some configuration properties are handled by Felix' launcher, while
681others are handled by the Felix framework itself. Regardless, both
682launcher and framework configuration properties are placed in the <tt>conf/config.properties</tt> files.</p>
Richard S. Hall2cd5bed2007-07-16 20:32:41 +0000683
Karl Paulsf7d389c2008-11-06 16:22:54 +0000684<p>The following are launcher configuration properties:</p>
685
Richard S. Hall2cd5bed2007-07-16 20:32:41 +0000686<ul>
Richard S. Hall2cd5bed2007-07-16 20:32:41 +0000687 <li><tt>felix.auto.install.&lt;n&gt;</tt> - Space-delimited list of bundle URLs to automatically install when Felix is started, where <tt>&lt;n&gt;</tt> is the start level into which the bundle will be installed (e.g., <tt>felix.auto.install.2</tt>).</li>
Karl Paulsf7d389c2008-11-06 16:22:54 +0000688 <li><tt>felix.auto.start.&lt;n&gt;</tt> - Space-delimited list of bundle URLs to automatically install and start when Felix is started, where <tt>&lt;n&gt;</tt> is the start level into which the bundle will be installed (e.g., <tt>felix.auto.start.2</tt>).</li>
689</ul>
690
691
692<p>The following are framework configuration properties (properties starting with "<tt>felix</tt>" are specific to Felix, while those starting with "<tt>org.osgi</tt>" are standard OSGi properties):</p>
693
694<ul>
695 <li><tt>org.osgi.framework.storage</tt> - Sets the directory to use as the bundle cache; by default bundle cache directory is <tt>felix-cache</tt>
696in the current working directory. The value should be a valid directory
697name. The directory name can be either absolute or relative. Relative
698directory names are relative to the current working directory. The
699specified directory will be created if it does not exist.</li>
700 <li><tt>org.osgi.framework.storage.clean</tt> - Determines whether the bundle cache is flushed. The value can either be "<tt>none</tt>" or "<tt>onFirstInit</tt>", where "<tt>none</tt>" does not flush the bundle cache and "<tt>onFirstInit</tt>" flushes the bundle cache when the framework instance is first initialized. The default value is "<tt>none</tt>".</li>
701 <li><tt>felix.cache.rootdir</tt> - Sets the root directory to use to calculate the bundle cache directory for relative directory names. If <tt>org.osgi.framework.storage</tt>
702is set to a relative name, by default it is relative to the current
703working directory. If this property is set, then it will be calculated
704as being relative to the specified root directory.</li>
Richard S. Hall2cd5bed2007-07-16 20:32:41 +0000705 <li><tt>felix.cache.bufsize</tt>
Karl Paulsf7d389c2008-11-06 16:22:54 +0000706- Sets the buffer size to be used by the cache; the default value is
7074096. The integer value of this string provides control over the size
708of the internal buffer of the disk cache for performance reasons.</li>
709 <li><tt>org.osgi.framework.system.packages</tt>
710- Specifies a comma-delimited list of packages that should be exported
711via the System Bundle from the parent class loader. The framework will
712set this to a reasonable default. If the value is specified, it
713replaces any default value.</li>
714 <li><tt>org.osgi.framework.system.packages.extra</tt>
715- Specifies a comma-delimited list of packages that should be exported
716via the System Bundle from the parent class loader in addition to the
717packages in <tt>org.osgi.framework.system.packages</tt>. The default value is empty. If a value is specified, it is appended to the list of default or specified packages in <tt>org.osgi.framework.system.packages</tt>.</li>
718 <li><tt>org.osgi.framework.bootdelegation</tt>
719- Specifies a comma-delimited list of packages that should be made
720implicitly available to all bundles from the parent class loader. It is
721recommended not to use this property since it breaks modularity. The
722default value is empty.</li>
723 <li><tt>felix.systembundle.activators</tt> - A <tt>List</tt> of <tt>BundleActivator</tt>
724instances that are started/stopped when the System Bundle is
725started/stopped. The specified instances will receive the System
726Bundle's <tt>BundleContext</tt> when invoked.</li>
727 <li><tt>felix.log.logger</tt> - An instance of <tt>Logger</tt> that the framework uses as its default logger.</li>
728 <li><tt>felix.log.level</tt>
729- An integer value indicating the degree of logging reported by the
730framework; the higher the value the more logging is reported. If zero
731('0') is specified, then logging is turned off completely. The log
732levels match those specified in the OSGi Log Service (i.e., 1 = error,
7332 = warning, 3 = information, and 4 = debug). The default value is 1.</li>
734 <li><tt>org.osgi.framework.startlevel</tt> - The initial start level of the framework once it starts execution; the default value is 1.</li>
735 <li><tt>felix.startlevel.bundle</tt> - The default start level for newly installed bundles; the default value is 1.</li>
736 <li><tt>felix.service.urlhandlers</tt> - Flag to indicate whether to activate the URL Handlers service for the framework instance; the default value is "<tt>true</tt>". Activating the URL Handlers service will result in the <tt>URL.setURLStreamHandlerFactory()</tt> and <tt>URLConnection.setContentHandlerFactory()</tt> being called.</li>
737 <li><tt>felix.fragment.validation</tt> - Determines if installing unsupported fragment bundles throws an exception or logs a warning. Possible values are "<tt>exception</tt>" or "<tt>warning</tt>". The default value is "<tt>exception</tt>".</li>
Richard S. Hall2cd5bed2007-07-16 20:32:41 +0000738</ul>
739
740
741<p>The Felix installation contains a default <tt>conf/config.properties</tt> file for automatically starting the shell-related bundles.</p>
742
Karl Paulsf7d389c2008-11-06 16:22:54 +0000743<p><a name="ApacheFelixUsageDocumentation-migrating"></a></p>
744
745<h3><a name="ApacheFelixUsageDocumentation-MigratingfromEarlierVersions"></a>Migrating from Earlier Versions</h3>
746
747<p>The release of Felix <tt>1.4.0</tt> introduced some configuration property changes. This section describes the differences from older versions of Felix.</p>
748
749<ul>
750 <li><b>Removed</b>
751 <ul>
752 <li><tt>felix.embedded.execution</tt> - No longer needed, since the framework now never calls <tt>System.exit()</tt>; the creator of the framework is now always responsible for exiting the VM.</li>
753 <li><tt>felix.strict.osgi</tt> - No longer needed, since all non-specification features have been removed.</li>
754 <li><tt>felix.cache.dir</tt> - No longer needed, since Felix no longer uses bundle cache profiles for saving sets of bundles.</li>
755 <li><tt>felix.cache.profile</tt> - No longer needed, since Felix no longer uses bundle cache profiles for saving sets of bundles.</li>
756 </ul>
757 </li>
758 <li><b>Renamed</b>
759 <ul>
760 <li><tt>felix.cache.profiledir</tt> - The equivalent of this property is now named <tt>org.osgi.framework.storage</tt>.</li>
761 <li><tt>felix.startlevel.framework</tt> - The equivalent of this property is now named <tt>org.osgi.framework.startlevel</tt>.</li>
762 </ul>
763 </li>
764 <li><b>Introduced</b>
765 <ul>
766 <li><tt>org.osgi.framework.system.packages.extra</tt> - New property, as described above, added to align with standard framework API.</li>
767 <li><tt>org.osgi.framework.storage.clean</tt> - New property, as described above, added to align with standard framework API.</li>
768 <li><tt>felix.cache.rootdir</tt> - Introduced as a result of removing bundle profiles to help resolve relative bundle cache directories.</li>
769 <li><tt>felix.fragment.validation</tt> - Introduced to control fragment validation, since the default behavior introduced in <tt>1.2.0</tt> of throwing an exception for fragments using unsupported features was causing issues for some users.</li>
770 </ul>
771 </li>
772</ul>
773
774
775<p>For the most part, these changes are minor and previous behavior
776achieved from older configuration properties is either easily attained
777with the new properties or no longer necessary.</p>
778
Richard S. Hall2cd5bed2007-07-16 20:32:41 +0000779<p><a name="ApacheFelixUsageDocumentation-propertysubstitution"></a></p>
780
781<h3><a name="ApacheFelixUsageDocumentation-SystemPropertySubstituion"></a>System Property Substituion</h3>
782<p>It is possible to use system properties to specify the values of properties in the <tt>conf/config.properties</tt> file. This is achieved through system property substitution, which is instigated by using <tt>${&lt;property&gt;</tt>} syntax, where <tt>&lt;property&gt;</tt>
783is the name of a system property to substitute. When such a property
784value is retrieved by a bundle, the system property value will be
Karl Paulsf7d389c2008-11-06 16:22:54 +0000785substituted into the bundle property value as appropriate. It is
786possible to have nested system property substitution, in which case the
787inner-most property is substituted first, then the next inner most,
788until reaching the outer most.</p>
Richard S. Hall2cd5bed2007-07-16 20:32:41 +0000789
790<p><a name="ApacheFelixUsageDocumentation-defaultshell"></a></p>
791
792<h3><a name="ApacheFelixUsageDocumentation-ChangingtheCommandShellUserInterface"></a>Changing the Command Shell User Interface</h3>
Karl Paulsf7d389c2008-11-06 16:22:54 +0000793
Richard S. Hall2cd5bed2007-07-16 20:32:41 +0000794<p>Felix' shell service supports multiple user interface
795implementations; the default shell user interface is text-based, but a
796simple graphical shell is also available. To change the default shell
797user interface, you must download the Shell GUI and Shell GUI Plugin
798bundles. Then you must modify the <tt>felix.auto.start</tt> property in the <tt>conf/config.properties</tt> file of your Felix installation. For the text-based user interface, the property value should look like this:</p>
Karl Paulsf7d389c2008-11-06 16:22:54 +0000799
Richard S. Hall2cd5bed2007-07-16 20:32:41 +0000800<div class="preformatted"><div class="preformattedContent">
801<pre>felix.auto.start.1=file:bundle/shell.jar file:bundle/shelltui.jar \
802 file:bundle/bundlerepository.jar
803</pre>
804</div></div>
Karl Paulsf7d389c2008-11-06 16:22:54 +0000805
Richard S. Hall2cd5bed2007-07-16 20:32:41 +0000806<p>This property value instructs Felix to automatically start the shell
807service, the shell textual user interface, and the bundle repository. (<em>Note:
808The "\" character at the end of the above line indicates that the
809property value continues on the next line; it is also possible to
810specify the property value on one line.</em>) For the GUI-based shell user interface, the property value should look something like this:</p>
Karl Paulsf7d389c2008-11-06 16:22:54 +0000811
Richard S. Hall2cd5bed2007-07-16 20:32:41 +0000812<div class="preformatted"><div class="preformattedContent">
813<pre>felix.auto.start.1=file:bundle/shell.jar file:bundle/bundlerepository.jar \
814 file:bundle/shellgui.jar file:bundle/shellplugin.jar
815</pre>
816</div></div>
Karl Paulsf7d389c2008-11-06 16:22:54 +0000817
Richard S. Hall2cd5bed2007-07-16 20:32:41 +0000818<p>This property value instructs Felix to automatically start the shell
819service, the bundle repository, the shell GUI, and the shell GUI
820plugins.</p>
821
822<p><a name="ApacheFelixUsageDocumentation-configuringbundles"></a></p>
823
824<h2><a name="ApacheFelixUsageDocumentation-ConfiguringBundles"></a>Configuring Bundles</h2>
Karl Paulsf7d389c2008-11-06 16:22:54 +0000825
Richard S. Hall2cd5bed2007-07-16 20:32:41 +0000826<p>Some bundles use properties to configure certain aspects of their behavior. As an example, the default URL for the <tt>cd</tt> command of the shell service can be specified using the property <tt>felix.shell.baseurl</tt>.
827It is a good idea, when implementing bundles, to parameterize them with
828properties where appropriate. To learn about the configuration options
829for specific bundles, refer to the documentation that accompanies them.</p>
830
831<p>Bundle properties are also defined in the <tt>conf/config.properties</tt> property file. Any property placed in this file will be accessible via <tt>BundleContext.getProperty()</tt>
832at run time. The property file uses the standard Java property file
833syntax (i.e., attribute-value pairs). For information on changing the
834default location of this file, refer to the section on <a href="#ApacheFelixUsageDocumentation-configuringfelix" title="configuring-felix on Apache Felix Usage Documentation">configuring Felix</a>.</p>
835
836<p><a name="ApacheFelixUsageDocumentation-feedback"></a></p>
837
838<h2><a name="ApacheFelixUsageDocumentation-Feedback"></a>Feedback</h2>
839
Karl Paulsf7d389c2008-11-06 16:22:54 +0000840<p>Subscribe to the Felix users mailing list by sending a message to <span class="nobr"><a href="mailto:users-subscribe@felix.apache.org" title="Send mail to users-subscribe@felix.apache.org" rel="nofollow">users-subscribe@felix.apache.org<sup><img class="rendericon" src="apache-felix-usage-documentation_files/mail_small.gif" alt="" align="absmiddle" border="0" height="12" width="13"></sup></a></span>; after subscribing, email questions or feedback to <span class="nobr"><a href="mailto:users@felix.apache.org" title="Send mail to users@felix.apache.org" rel="nofollow">users@felix.apache.org<sup><img class="rendericon" src="apache-felix-usage-documentation-Dateien/mail_small.gif" alt="" align="absmiddle" border="0" height="12" width="13"></sup></a></span>.</p>
Richard S. Hall2cd5bed2007-07-16 20:32:41 +0000841 </div>
Karl Paulsf7d389c2008-11-06 16:22:54 +0000842 </body></html>