You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@karaf.apache.org by "Stephane Chomat (JIRA)" <ji...@apache.org> on 2010/12/20 11:49:00 UTC

[jira] Created: (KARAF-334) At startup, Karafi does not support urls like mvn:, obr:.

At startup, Karafi 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
             Fix For: 2.1.3


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.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (KARAF-334) At startup, Karaf does not support urls like mvn:, obr:.

Posted by "Stephane Chomat (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/KARAF-334?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12974570#action_12974570 ] 

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

The org.apache.felix.configadmin bundle must be installed and started before pax-logging-api and pax-logging-service because theses bundles haves some packages dependencies resolved by org.apache.felix.configadmin.

You can change the start level to 6 in statup.properties:
org/apache/felix/org.apache.felix.configadmin/${felix.configadmin.version}/org.apache.felix.configadmin-${felix.configadmin.version}.jar=6


> 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
>             Fix For: 2.1.3, 2.2.0
>
>         Attachments: 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.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (KARAF-334) At startup, Karaf does not support urls like mvn:, obr:.

Posted by "Guillaume Nodet (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/KARAF-334?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Guillaume Nodet updated KARAF-334:
----------------------------------

    Fix Version/s:     (was: 2.1.3)

I've reverted this change for now.  We need to investigate a bit more.
We have the same problems with features where if you install a url handler in a dependant feature, we can't use it to install bundles.
Though i'd rather fix it in features than messing up with the boot mechanism.

> 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
>             Fix For: 2.2.0
>
>         Attachments: 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.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (KARAF-334) At startup, Karaf does not support urls like mvn:, obr:.

Posted by "Guillaume Nodet (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/KARAF-334?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12974614#action_12974614 ] 

Guillaume Nodet commented on KARAF-334:
---------------------------------------

Why do you want to use the etc/startup.properties to provision your bundles ?
Maybe using the boot features would work better ?

> 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
>             Fix For: 2.1.3, 2.2.0
>
>         Attachments: 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.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (KARAF-334) At startup, Karaf does not support urls like mvn:, obr:.

Posted by "Stephane Chomat (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/KARAF-334?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12984773#action_12984773 ] 

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

I think yes. I not quite understand the mechanism lock. We can process auto-start/auto-install properties after the lock is set.
What is the relationship between the start level and lock.

Instead of changing the start level at each level, we can set the start level to defaultStartLevel or the maxSL beaucause we know the last level giving by the auto-start/auto-install properties.
And may-be, we can remove the code which wait all the bundles of a level were started.


> 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
>             Fix For: 2.2.0
>
>         Attachments: 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.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (KARAF-334) At startup, Karaf does not support urls like mvn:, obr:.

Posted by "Stephane Chomat (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/KARAF-334?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12990020#comment-12990020 ] 

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

Another thing, I think you must apply this patch if you have you apply the patch of the solution C. 

"With this version, we start bundle of level n before install bundles of level n+1. the pax logging bunble must be installed after the config manager. We move the config manager at level 6."

https://github.com/chomats/karaf/commit/ae27a306dcd6164da75cf63a7810434a419fe295

> 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

        

[jira] Commented: (KARAF-334) At startup, Karaf does not support urls like mvn:, obr:.

Posted by "Guillaume Nodet (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/KARAF-334?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12989863#comment-12989863 ] 

Guillaume Nodet commented on KARAF-334:
---------------------------------------

I think this has a very bad effect on the wiring during the initial startup phase, as this would not allow bundles to be wired to packages exported by bundles with a higher start level.
I've applied your patches, but i end up with lots of messages displayed in the console though they should be output to the log service instead.
I think if we're gonna implement such a solution, we'd need something smarter than just installing / starting for each level, maybe have a way to define intermediate phases.

Though i'm still trying to figure why you can't leverage the boot features mechanism to do that.

> 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
>             Fix For: 2.2.0
>
>         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

        

[jira] Commented: (KARAF-334) At startup, Karaf does not support urls like mvn:, obr:.

Posted by "Guillaume Nodet (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/KARAF-334?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12990023#comment-12990023 ] 

Guillaume Nodet commented on KARAF-334:
---------------------------------------

Yes, so after a deeper look at your proposed solution D, i think we're close to a good solution.  I just came up with a different way to express a pause / phased in the startup process.
Though I think we'd have to increment the level and start the bundles manually, as the start level does its job asynchrnously, so we need to know when it has actually finished its job.

> 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

        

[jira] [Updated] (KARAF-334) At startup, Karaf does not support urls like mvn:, obr:.

Posted by "Christian Schneider (Updated) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/KARAF-334?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Christian Schneider updated KARAF-334:
--------------------------------------

    Fix Version/s:     (was: 3.0.0)
    
> 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: karaf-core
>    Affects Versions: 2.1.2
>            Reporter: Stephane Chomat
>            Assignee: Guillaume Nodet
>             Fix For: 3.1.0
>
>         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.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Commented: (KARAF-334) At startup, Karaf does not support urls like mvn:, obr:.

Posted by "Stephane Chomat (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/KARAF-334?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12984250#action_12984250 ] 

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

I propose another solution see : https://github.com/chomats/karaf/commits/karaf-2.1.x
It resolve all the problems.

> 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
>             Fix For: 2.2.0
>
>         Attachments: 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.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (KARAF-334) At startup, Karaf does not support urls like mvn:, obr:.

Posted by "Guillaume Nodet (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/KARAF-334?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12990045#comment-12990045 ] 

Guillaume Nodet commented on KARAF-334:
---------------------------------------

No, I'm thinking about blueprint bundles for examples which are started asynchronously in a separate thread after the bundle has moved into an ACTIVE state.  This means that if the url handler comes from a blueprint bundle, your problem won't be solved.

> 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

        

[jira] Resolved: (KARAF-334) At startup, Karaf does not support urls like mvn:, obr:.

Posted by "Guillaume Nodet (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/KARAF-334?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Guillaume Nodet resolved KARAF-334.
-----------------------------------

    Resolution: Fixed

> 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
>             Fix For: 2.1.3, 2.2.0
>
>         Attachments: 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.
-
You can reply to this email to add a comment to the issue online.


[jira] [Updated] (KARAF-334) At startup, Karaf does not support urls like mvn:, obr:.

Posted by "Jean-Baptiste Onofré (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/KARAF-334?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jean-Baptiste Onofré updated KARAF-334:
---------------------------------------

    Fix Version/s: 3.1.0
                   3.0.0

> 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
>             Fix For: 3.0.0, 3.1.0
>
>         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

       

[jira] Commented: (KARAF-334) At startup, Karaf does not support urls like mvn:, obr:.

Posted by "Guillaume Nodet (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/KARAF-334?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12990929#comment-12990929 ] 

Guillaume Nodet commented on KARAF-334:
---------------------------------------

One possible thing would be have a more structured description of the startup bundles:
  http://svn.apache.org/repos/asf//sling/trunk/launchpad/builder/src/main/bundles/list.xml
Or something similar to features.

Maybe 3.0 would be a good time to refactor that.

> 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

        

[jira] Commented: (KARAF-334) At startup, Karaf does not support urls like mvn:, obr:.

Posted by "Stephane Chomat (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/KARAF-334?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12973251#action_12973251 ] 

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

I see an another problem.
I test with startlevel one and two. But if i test with five and 10, the test doesn't work.

I propose this correction.
diff -r 715709e78bab src/main/java/org/apache/karaf/main/Main.java
--- a/src/main/java/org/apache/karaf/main/Main.java	Mon Dec 20 17:22:04 2010 +0100
+++ b/src/main/java/org/apache/karaf/main/Main.java	Mon Dec 20 17:34:52 2010 +0100
@@ -556,6 +556,7 @@
 									+ b.getSymbolicName() + ": " + ex);
 						}
 					}
+					sl.setStartLevel(startLevel);
 				}
             }
         }
Thanks.


I propose this test but you must extecute this test in two separated jvm. If I run the second test alone without correction, it doesn't work. But i I exexute the two test I see a trace "Error installing bundle  mvn:org.osgi/org.osgi.compendium/4.2.0|unused: java.net.MalformedURLException: Unknown protocol: mvn" but the test passes.



/*
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance
 * with the License.  You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing,
 * software distributed under the License is distributed on an
 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 * KIND, either express or implied.  See the License for the
 * specific language governing permissions and limitations
 * under the License.
 */
package org.apache.karaf.main;

import java.io.File;
import java.util.Properties;

import junit.framework.Assert;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.osgi.framework.Bundle;
import org.osgi.framework.launch.Framework;

/**
 * Before running this test, you must delete all directory like target/test-karaf-home-*
 * @author Stephane Chomat
 *
 */
public class MainStartTest {
	Properties backup = null;
	
	@Before
	public void before() {
		backup = System.getProperties();
	}
	
	@After
	public void after() {
		System.setProperties(backup);
	}
	
	/** 
	 * Start two bundles at level one and two.
	 * At level one start mvn handler service and at level 2 use mvn handler service.
	 * @throws Exception cannot start karaf.
	 */
	@Test
    public void testAutoStart() throws Exception {
		File basedir = new File(getClass().getClassLoader().getResource("foo").getPath()).getParentFile();
        File home = new File(basedir, "test-karaf-home");
        File data = new File(home, "data");

        Utils.deleteDirectory(data);

		String[] args = new String[0];
		String fileMVNbundle = new File(home, "bundles/pax-url-mvn.jar").toURI().toURL().toExternalForm();
		String mvnUrl = "mvn:org.osgi/org.osgi.compendium/4.2.0";
		System.setProperty("karaf.home", home.toString());
		System.setProperty("karaf.data", data.toString());
		System.setProperty("karaf.auto.start.1", "\""+fileMVNbundle+"|unused\"");
		System.setProperty("karaf.auto.start.2", "\""+mvnUrl+"|unused\"");
		System.setProperty("karaf.maven.convert", "false");

		Main main = new Main(args);
		main.launch();
		Thread.sleep(1000);
		Framework framework = main.getFramework();
		Bundle[] bundles = framework.getBundleContext().getBundles();
		Assert.assertEquals(3, bundles.length);
		Assert.assertEquals(fileMVNbundle, bundles[1].getLocation());
		Assert.assertEquals(mvnUrl, bundles[2].getLocation());
		Assert.assertEquals(Bundle.ACTIVE, bundles[1].getState());
		Assert.assertEquals(Bundle.ACTIVE, bundles[2].getState());
		main.destroy(false);
	}
	
	/** 
	 * Start two bundles at level 5 and 10.
	 * At level 5 start mvn handler service and at level 10 use mvn handler service.
	 * @throws Exception cannot start karaf.
	 */
	@Test
    public void testAutoStart2() throws Exception {
		File basedir = new File(getClass().getClassLoader().getResource("foo").getPath()).getParentFile();
        File home = new File(basedir, "test-karaf-home");
        File data = new File(home, "data-2");

        Utils.deleteDirectory(data);

		String[] args = new String[0];
		String fileMVNbundle = new File(home, "bundles/pax-url-mvn.jar").toURI().toURL().toExternalForm();
		String mvnUrl = "mvn:org.osgi/org.osgi.compendium/4.2.0";
		System.setProperty("karaf.home", home.toString());
		System.setProperty("karaf.data", data.toString());
		System.setProperty("karaf.auto.start.5", "\""+fileMVNbundle+"|unused\"");
		System.setProperty("karaf.auto.start.10", "\""+mvnUrl+"|unused\"");
		System.setProperty("karaf.maven.convert", "false");

		Main main = new Main(args);
		main.launch();
		Thread.sleep(1000);
		Framework framework = main.getFramework();
		Bundle[] bundles = framework.getBundleContext().getBundles();
		Assert.assertEquals(3, bundles.length);
		Assert.assertEquals(fileMVNbundle, bundles[1].getLocation());
		Assert.assertEquals(mvnUrl, bundles[2].getLocation());
		Assert.assertEquals(Bundle.ACTIVE, bundles[1].getState());
		Assert.assertEquals(Bundle.ACTIVE, bundles[2].getState());
		main.destroy(false);
	}
}

> 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
>             Fix For: 2.1.3, 2.2.0
>
>         Attachments: 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.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (KARAF-334) At startup, Karaf does not support urls like mvn:, obr:.

Posted by "Guillaume Nodet (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/KARAF-334?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12984735#action_12984735 ] 

Guillaume Nodet commented on KARAF-334:
---------------------------------------

Doesn't this solution break the locking mechanism in place ?
If we are to start bundles manually, I'm not sure we need to take care of the start level service.  Maybe we can just set the start level to 100 at the beginning and install / start the bundle from the Main instead of waiting for bundles to be started by the start level service.


> 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
>             Fix For: 2.2.0
>
>         Attachments: 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.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (KARAF-334) At startup, Karaf does not support urls like mvn:, obr:.

Posted by "Guillaume Nodet (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/KARAF-334?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Guillaume Nodet updated KARAF-334:
----------------------------------

    Summary: At startup, Karaf does not support urls like mvn:, obr:.  (was: At startup, Karafi does not support urls like mvn:, obr:.)

> 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
>             Fix For: 2.1.3
>
>         Attachments: 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.
-
You can reply to this email to add a comment to the issue online.


[jira] Assigned: (KARAF-334) At startup, Karaf does not support urls like mvn:, obr:.

Posted by "Guillaume Nodet (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/KARAF-334?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Guillaume Nodet reassigned KARAF-334:
-------------------------------------

    Assignee: Guillaume Nodet

> 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
>             Fix For: 2.1.3, 2.2.0
>
>         Attachments: 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.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (KARAF-334) At startup, Karaf does not support urls like mvn:, obr:.

Posted by "Stephane Chomat (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/KARAF-334?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12990025#comment-12990025 ] 

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

I think, if we set the start level to level 'l' before we start bundles of start level lower to l, bundles will start synchronously. If we start bundles before we set the start level, bundles will start asynchronously.

> 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

        

[jira] Commented: (KARAF-334) At startup, Karaf does not support urls like mvn:, obr:.

Posted by "Stephane Chomat (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/KARAF-334?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12974572#action_12974572 ] 

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

StartLevel:

At startup the startlevel is equal to 1. And only bundles which startlevel is one are started, the others are started in lock method when this code set the startLebel at defaultStartLevel (default value is 100). And if you want use scheme like mvn: or wrap: or dir: in karaf.auto.start you must start this handlers service at level 1. 

You cannot use this scheme in karaf.auto.install.x because this properties is installed before the properties karaf.auto.start.x


To resolve the first problem (start handler bundles which provides new scheme, at level greater than 1), I try to add this line at the end of the loop :
 + sl.setStartLevel(startLevel); 
But there is a conflict with lock code. I work if you set karaf.lock to false.


> 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
>             Fix For: 2.1.3, 2.2.0
>
>         Attachments: 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.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (KARAF-334) At startup, Karaf does not support urls like mvn:, obr:.

Posted by "Stephane Chomat (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/KARAF-334?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12973221#action_12973221 ] 

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

I forget to use start parameter in autoInstall method. 
When start is false, the installed bundles should not be started.

Ps: the test-karaf-home.zip has a simple junit test.

> 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
>             Fix For: 2.1.3, 2.2.0
>
>         Attachments: 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.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (KARAF-334) At startup, Karafi does not support urls like mvn:, obr:.

Posted by "Stephane Chomat (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/KARAF-334?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Stephane Chomat updated KARAF-334:
----------------------------------

    Attachment: test-karaf-home.zip

Add junit test to test this new feature.

> At startup, Karafi 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
>             Fix For: 2.1.3
>
>         Attachments: 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.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (KARAF-334) At startup, Karaf does not support urls like mvn:, obr:.

Posted by "Stephane Chomat (JIRA)" <ji...@apache.org>.
    [ 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

        

[jira] Commented: (KARAF-334) At startup, Karaf does not support urls like mvn:, obr:.

Posted by "Stephane Chomat (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/KARAF-334?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12988030#action_12988030 ] 

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

With your comments, I propose a final version. This version works fine with the mechanism lock.
For 2.2.x : https://github.com/chomats/karaf/commit/84c16ba7ad19c77ffc9e7d8445633992a92ac044
For 2.1.x: https://github.com/chomats/karaf/commit/bd11100b74c1f230140864d58d6c99766baf64a5
You decide if you want to add this feature to Karaf.


> 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
>             Fix For: 2.2.0
>
>         Attachments: 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.
-
You can reply to this email to add a comment to the issue online.


[jira] Reopened: (KARAF-334) At startup, Karaf does not support urls like mvn:, obr:.

Posted by "Guillaume Nodet (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/KARAF-334?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Guillaume Nodet reopened KARAF-334:
-----------------------------------


> 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
>             Fix For: 2.1.3, 2.2.0
>
>         Attachments: 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.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (KARAF-334) At startup, Karaf does not support urls like mvn:, obr:.

Posted by "Guillaume Nodet (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/KARAF-334?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Guillaume Nodet updated KARAF-334:
----------------------------------

    Fix Version/s:     (was: 2.2.0)

I'd like to push that one out of 2.2.0 as this is a tricky area and i don't want to rush on a solution that seems to still bring lots of problems.

> 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

        

[jira] Commented: (KARAF-334) At startup, Karaf does not support urls like mvn:, obr:.

Posted by "Stephane Chomat (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/KARAF-334?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12990075#comment-12990075 ] 

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

Of course, blueprint component, ipojo component or other system are started asynchronously. But in my last commentary, I talked about bundle activator.

A solution to resolve this problem, is to wait (with a timeout) the url handler is available like listen org.osgi.service.url.URLStreamHandlerService [(&(objectClass = org.osgi.service.url.URLStreamHandlerService)(url.handler.protocol=mvn))]. 
We can define a property
karaf.start.urlhandler.<level>=mvn ==> which means wait the urlhandler service is activated. (set the start level to level and wait the url handler is available).

Second thing. Currently when the framework cannot install/start a bundle, it continue to run. Another interpretation is when the framework cannot install/start a bundle, it will be stopped.





> 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

        

[jira] Commented: (KARAF-334) At startup, Karaf does not support urls like mvn:, obr:.

Posted by "Guillaume Nodet (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/KARAF-334?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12990021#comment-12990021 ] 

Guillaume Nodet commented on KARAF-334:
---------------------------------------

I do get the problem, but I think we can't go step by step, as we loose the fact that the wiring is done globally.
Maybe something like:

first.jar=5
second.jar=10
#phase=15
third.jar=20

The {{#phase}} would identify a pause in the installation/starting process so that at start level 15, only bundles with a level <= 15 would be installed and started.

Though the real problem is that the phases would badly interfere with the locking mechanism, so that it needs to be rewritten to not use the start level, but do its work directly as you described.

On a last note, remember that some url handlers may be started asynchronously if they are created via blueprint bundles, so I'm not even sure if all the problems would be really solved.


> 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

        

[jira] Updated: (KARAF-334) At startup, Karaf does not support urls like mvn:, obr:.

Posted by "Guillaume Nodet (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/KARAF-334?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Guillaume Nodet updated KARAF-334:
----------------------------------

    Fix Version/s: 2.2.0

> 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
>             Fix For: 2.1.3, 2.2.0
>
>         Attachments: 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.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (KARAF-334) At startup, Karaf does not support urls like mvn:, obr:.

Posted by "Stephane Chomat (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/KARAF-334?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Stephane Chomat updated KARAF-334:
----------------------------------

    Attachment: patch-KARAF-334-karaf-2.1.x
                patch-KARAF-334

patch for trunk and branch karaf-2.1.x

> 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
>             Fix For: 2.2.0
>
>         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

        

[jira] Issue Comment Edited: (KARAF-334) At startup, Karaf does not support urls like mvn:, obr:.

Posted by "Stephane Chomat (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/KARAF-334?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12984250#action_12984250 ] 

Stephane Chomat edited comment on KARAF-334 at 1/21/11 8:09 AM:
----------------------------------------------------------------

I propose another solution see : 
https://github.com/chomats/karaf/commits/karaf-2.1.x
and 
https://github.com/chomats/karaf/commits/trunk

It resolve all the problems.

      was (Author: chomats):
    I propose another solution see : https://github.com/chomats/karaf/commits/karaf-2.1.x
It resolve all the problems.
  
> 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
>             Fix For: 2.2.0
>
>         Attachments: 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.
-
You can reply to this email to add a comment to the issue online.