karaf-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Stephane Chomat (JIRA)" <j...@apache.org>
Subject [jira] Commented: (KARAF-334) At startup, Karaf does not support urls like mvn:, obr:.
Date Thu, 03 Feb 2011 08:45:28 GMT

    [ https://issues.apache.org/jira/browse/KARAF-334?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12990015#comment-12990015
] 

Stephane Chomat commented on KARAF-334:
---------------------------------------

The problem is : some bundles must be started before some other bundles would be installed,
especially to use new url schemes. A new url scheme must be activated before you can use it
in install process.

Prec algo:
Set level at 1. (it's the default initial level, I think)
Install bundles for each level
Start bundles for each level

doLock in another thread
1. setLevel at lockLevel (default value : )
2. setLevel at defaultLevel (default value is 100).


Solutions:

A.
Set level at 1. (it's the default initial level, I think)
For each level install and start bundle.

doLock in another thread
1. setLevel at lockLevel (default value : )
2. setLevel at defaultLevel (default value is 100).

==> Problem : only scheme started in level 1 as activated for next level (2....100). The
others bundles installed in level (2....100) are started when you set level at defaultLevel
(default value is 100).

B.
Set level at 1. (it's the default initial level, I think)
For each level: set level at this level, install and start bundle.

doLock in another thread
1. setLevel at lockLevel (default value : )
2. setLevel at defaultLevel (default value is 100).
==> Problem with the lock process. And bundle cannot have package dependencies resolved
by a bundle installed in higher level.

C. (patched solutions (approximate))
Set level at 1. (it's the default initial level, I think)

doLock in another thread
1. setLevel at lockLevel (default value : )
2. setLevel at defaultLevel (default value is 100).
3. the first time : for each level: install and start bundle.
4. setLevel at defaultLevel (default value is 100).
==> Problem : bundle cannot have package dependencies resolved by a bundle installed in
higher level.

D. 
Set level at 1. (it's the default initial level, I think)

doLock in another thread
1. setLevel at lockLevel (default value : )
the first time: (2 to 4) 
2. l= 1; startingBundles={}
3. the first time : for each level x: install bundle. If the level must be started (this information
can be provided by a property karf.stat.level.x=true) : set level at x and start bundle for
this intermediate levels from l to x; l <- x;
4. start bunble from l to the end level.

5. setLevel at defaultLevel (default value is 100).
==> Problem : bundle cannot have package dependencies resolved by a bundle installed in
higher level between

If you cannot set a karf.start.level.x, there is the prec solutions (install all bundles and
next start all bundles and next set the default level.

My english is not always good, excuse me.


> At startup, Karaf does not support urls like mvn:, obr:.
> --------------------------------------------------------
>
>                 Key: KARAF-334
>                 URL: https://issues.apache.org/jira/browse/KARAF-334
>             Project: Karaf
>          Issue Type: Improvement
>          Components: runtime
>    Affects Versions: 2.1.2
>            Reporter: Stephane Chomat
>            Assignee: Guillaume Nodet
>         Attachments: patch-KARAF-334, patch-KARAF-334-karaf-2.1.x, test-karaf-home.zip
>
>   Original Estimate: 24h
>  Remaining Estimate: 24h
>
> At startup, Karafi does not support urls like mvn:, obr:.
> Imagine that at level 5 you install the bundle pax-url-mvn with karaf.auto.start.5 =
"file: pax-url-mvn.jar | pax-url-mvn" 
> and then at level 10 you install mvn:. ... With karaf.auto.start.10 = "mvn :....| ...."
> At the level 6 the url handler 'mvn' is available and you can use it.
> This feature does not work with Karaf
> I propose this path :
> diff -r f0bb11c3d77c src/main/java/org/apache/karaf/main/Main.java
> --- a/src/main/java/org/apache/karaf/main/Main.java	Mon Dec 20 11:05:11 2010 +0100
> +++ b/src/main/java/org/apache/karaf/main/Main.java	Mon Dec 20 11:46:29 2010 +0100
> @@ -485,28 +485,20 @@
>          // the start level to which the bundles are assigned is specified by
>          // appending a ".n" to the auto-install property name, where "n" is
>          // the desired start level for the list of bundles.
> -        autoInstall(PROPERTY_AUTO_INSTALL, context, sl, convertToMavenUrls);
> +        autoInstall(PROPERTY_AUTO_INSTALL, context, sl, convertToMavenUrls, false);
>  
>          // The auto-start property specifies a space-delimited list of
>          // bundle URLs to be automatically installed and started into each
>          // new profile; the start level to which the bundles are assigned
>          // is specified by appending a ".n" to the auto-start property name,
>          // where "n" is the desired start level for the list of bundles.
> -        // The following code starts bundles in two passes, first it installs
> -        // them, then it starts them.
> -            List<Bundle> bundlesToStart = autoInstall(PROPERTY_AUTO_START, context,
sl, convertToMavenUrls);
> -        // Now loop through and start the installed bundles.
> -        for (Bundle b : bundlesToStart) {
> -            try {
> -                b.start();
> -            }
> -            catch (Exception ex) {
> -                System.err.println("Auto-properties start: " + ex);
> -            }
> -        }
> +        // The following code starts bundles in one passes, it installs
> +        // and it starts them by level.
> +        autoInstall(PROPERTY_AUTO_START, context, sl, convertToMavenUrls, true);
> +        
>      }
>  
> -    private List<Bundle> autoInstall(String propertyPrefix, BundleContext context,
StartLevel sl, boolean convertToMavenUrls) {
> +    private List<Bundle> autoInstall(String propertyPrefix, BundleContext context,
StartLevel sl, boolean convertToMavenUrls, boolean start) {
>          Map<Integer, String> autoStart = new TreeMap<Integer, String>();
>          List<Bundle> bundles = new ArrayList<Bundle>();
>          for (Iterator i = configProps.keySet().iterator(); i.hasNext();) {
> @@ -531,6 +523,7 @@
>          }
>          for (Integer startLevel : autoStart.keySet()) {
>              StringTokenizer st = new StringTokenizer(autoStart.get(startLevel), "\"
", true);
> +            List<Bundle> bundlesLevel = new ArrayList<Bundle>();
>              if (st.countTokens() > 0) {
>                  String location = null;
>                  do {
> @@ -541,6 +534,7 @@
>                              Bundle b = context.installBundle(parts[0], new URL(parts[1]).openStream());
>                              sl.setBundleStartLevel(b, startLevel);
>                              bundles.add(b);
> +                            bundlesLevel.add(b);
>                          }
>                          catch (Exception ex) {
>                              System.err.println("Auto-properties install:" + ex);
> @@ -549,6 +543,15 @@
>                  }
>                  while (location != null);
>              }
> +         // Now loop through and start the installed bundles.
> +            for (Bundle b : bundlesLevel) {
> +                try {
> +                    b.start();
> +                }
> +                catch (Exception ex) {
> +                    System.err.println("Auto-properties start: " + ex);
> +                }
> +            }
>          }
>          return bundles;
>      }

-- 
This message is automatically generated by JIRA.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Mime
View raw message