karaf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbono...@apache.org
Subject svn commit: r1054625 - in /karaf/trunk: features/command/src/main/java/org/apache/karaf/features/command/ features/core/src/main/java/org/apache/karaf/features/ features/core/src/main/java/org/apache/karaf/features/internal/ manual/src/main/webapp/user...
Date Mon, 03 Jan 2011 14:18:49 GMT
Author: jbonofre
Date: Mon Jan  3 14:18:48 2011
New Revision: 1054625

URL: http://svn.apache.org/viewvc?rev=1054625&view=rev
Log:
[KARAF-346] Make features:install more verbose using the -v or --verbose option.

Modified:
    karaf/trunk/features/command/src/main/java/org/apache/karaf/features/command/InstallFeatureCommand.java
    karaf/trunk/features/core/src/main/java/org/apache/karaf/features/FeaturesService.java
    karaf/trunk/features/core/src/main/java/org/apache/karaf/features/internal/FeaturesServiceImpl.java
    karaf/trunk/manual/src/main/webapp/users-guide/deployer.conf
    karaf/trunk/manual/src/main/webapp/users-guide/installing-features.conf
    karaf/trunk/manual/src/main/webapp/users-guide/provisioning.conf

Modified: karaf/trunk/features/command/src/main/java/org/apache/karaf/features/command/InstallFeatureCommand.java
URL: http://svn.apache.org/viewvc/karaf/trunk/features/command/src/main/java/org/apache/karaf/features/command/InstallFeatureCommand.java?rev=1054625&r1=1054624&r2=1054625&view=diff
==============================================================================
--- karaf/trunk/features/command/src/main/java/org/apache/karaf/features/command/InstallFeatureCommand.java
(original)
+++ karaf/trunk/features/command/src/main/java/org/apache/karaf/features/command/InstallFeatureCommand.java
Mon Jan  3 14:18:48 2011
@@ -36,6 +36,8 @@ public class InstallFeatureCommand exten
     boolean noClean;
     @Option(name = "-r", aliases = "--no-auto-refresh", description = "Do not automatically
refresh bundles", required = false, multiValued = false)
     boolean noRefresh;
+    @Option(name = "-v", aliases = "--verbose", description = "Explain what is being done",
required = false, multiValued = false)
+    boolean verbose;
 
     protected void doExecute(FeaturesService admin) throws Exception {
     	if (version == null || version.length() == 0) {
@@ -48,6 +50,9 @@ public class InstallFeatureCommand exten
         if (noClean) {
             options.add(FeaturesService.Option.NoCleanIfFailure);
         }
+        if (verbose) {
+            options.add(FeaturesService.Option.Verbose);
+        }
         admin.installFeature(name, version, options);
     }
 }

Modified: karaf/trunk/features/core/src/main/java/org/apache/karaf/features/FeaturesService.java
URL: http://svn.apache.org/viewvc/karaf/trunk/features/core/src/main/java/org/apache/karaf/features/FeaturesService.java?rev=1054625&r1=1054624&r2=1054625&view=diff
==============================================================================
--- karaf/trunk/features/core/src/main/java/org/apache/karaf/features/FeaturesService.java
(original)
+++ karaf/trunk/features/core/src/main/java/org/apache/karaf/features/FeaturesService.java
Mon Jan  3 14:18:48 2011
@@ -29,7 +29,8 @@ public interface FeaturesService {
         NoCleanIfFailure,
         PrintBundlesToRefresh,
         NoAutoRefreshBundles,
-        ContinueBatchOnFailure
+        ContinueBatchOnFailure,
+        Verbose
     }
 
     void addRepository(URI url) throws Exception;

Modified: karaf/trunk/features/core/src/main/java/org/apache/karaf/features/internal/FeaturesServiceImpl.java
URL: http://svn.apache.org/viewvc/karaf/trunk/features/core/src/main/java/org/apache/karaf/features/internal/FeaturesServiceImpl.java?rev=1054625&r1=1054624&r2=1054625&view=diff
==============================================================================
--- karaf/trunk/features/core/src/main/java/org/apache/karaf/features/internal/FeaturesServiceImpl.java
(original)
+++ karaf/trunk/features/core/src/main/java/org/apache/karaf/features/internal/FeaturesServiceImpl.java
Mon Jan  3 14:18:48 2011
@@ -224,12 +224,13 @@ public class FeaturesServiceImpl impleme
     public void installFeatures(Set<Feature> features, EnumSet<Option> options)
throws Exception {
         InstallationState state = new InstallationState();
         InstallationState failure = new InstallationState();
+        boolean verbose = options.contains(FeaturesService.Option.Verbose);
         try {
             // Install everything
             for (Feature f : features) {
                 InstallationState s = new InstallationState();
             	try {
-                    doInstallFeature(s, f);
+                    doInstallFeature(s, f, verbose);
                     state.bundleInfos.putAll(s.bundleInfos);
                     state.bundles.addAll(s.bundles);
                     state.features.putAll(s.features);
@@ -354,9 +355,11 @@ public class FeaturesServiceImpl impleme
         final Map<Feature, Set<Long>> features = new HashMap<Feature, Set<Long>>();
     }
 
-    protected void doInstallFeature(InstallationState state, Feature feature) throws Exception
{
+    protected void doInstallFeature(InstallationState state, Feature feature, boolean verbose)
throws Exception {
         LOGGER.info("Installing feature " + feature.getName() + " " + feature.getVersion());
-        System.out.println("Installing feature " + feature.getName() + " " + feature.getVersion());
+        if (verbose) {
+            System.out.println("Installing feature " + feature.getName() + " " + feature.getVersion());
+        }
         for (Feature dependency : feature.getDependencies()) {
             VersionRange range = FeatureImpl.DEFAULT_VERSION.equals(dependency.getVersion())
                         ? VersionRange.ANY_VERSION : new VersionRange(dependency.getVersion(),
true, true);
@@ -388,7 +391,7 @@ public class FeaturesServiceImpl impleme
                 throw new Exception("No feature named '" + dependency.getName()
                         + "' with version '" + dependency.getVersion() + "' available");
             }
-            doInstallFeature(state, fi);
+            doInstallFeature(state, fi, verbose);
         }
         for (String config : feature.getConfigurations().keySet()) {
             Dictionary<String,String> props = new Hashtable<String, String>(feature.getConfigurations().get(config));
@@ -405,11 +408,11 @@ public class FeaturesServiceImpl impleme
             }
         }
         for (ConfigFileInfo configFile : feature.getConfigurationFiles()) {
-        	installConfigurationFile(configFile.getLocation(), configFile.getFinalname());
+        	installConfigurationFile(configFile.getLocation(), configFile.getFinalname(), verbose);
         }
         Set<Long> bundles = new TreeSet<Long>();
         for (BundleInfo bInfo : resolve(feature)) {
-            Bundle b = installBundleIfNeeded(state, bInfo);
+            Bundle b = installBundleIfNeeded(state, bInfo, verbose);
             bundles.add(b.getBundleId());
             state.bundleInfos.put(b.getBundleId(), bInfo);
         }
@@ -572,7 +575,7 @@ public class FeaturesServiceImpl impleme
         return result;
     }
 
-    protected Bundle installBundleIfNeeded(InstallationState state, BundleInfo bundleInfo)
throws IOException, BundleException {
+    protected Bundle installBundleIfNeeded(InstallationState state, BundleInfo bundleInfo,
boolean verbose) throws IOException, BundleException {
         InputStream is;
         String bundleLocation = bundleInfo.getLocation();
         LOGGER.debug("Checking " + bundleLocation);
@@ -598,7 +601,9 @@ public class FeaturesServiceImpl impleme
                     Version bv = vStr == null ? Version.emptyVersion : Version.parseVersion(vStr);
                     if (v.equals(bv)) {
                         LOGGER.info("Found installed bundle: " + b);
-                        System.out.println("Found installed bundle: " + b);
+                        if (verbose) {
+                            System.out.println("Found installed bundle: " + b);
+                        }
                         state.bundles.add(b);
                         return b;
                     }
@@ -610,8 +615,10 @@ public class FeaturesServiceImpl impleme
                 is.close();
                 is = new BufferedInputStream(new URL(bundleLocation).openStream());
             }
-            System.out.println("Installing bundle " + bundleLocation);
             LOGGER.info("Installing bundle " + bundleLocation);
+            if (verbose) {
+                System.out.println("Installing bundle " + bundleLocation);
+            }
             Bundle b = getBundleContext().installBundle(bundleLocation, is);
             
             // Define the startLevel for the bundle when defined
@@ -628,9 +635,11 @@ public class FeaturesServiceImpl impleme
         }
     }
     
-    public void installConfigurationFile(String fileLocation, String finalname) throws IOException
{
+    public void installConfigurationFile(String fileLocation, String finalname, boolean verbose)
throws IOException {
     	LOGGER.info("Checking configuration file " + fileLocation);
-        System.out.println("Checking configuration file " + fileLocation);
+        if (verbose) {
+            System.out.println("Checking configuration file " + fileLocation);
+        }
     	
     	String basePath = System.getProperty("karaf.base");
     	

Modified: karaf/trunk/manual/src/main/webapp/users-guide/deployer.conf
URL: http://svn.apache.org/viewvc/karaf/trunk/manual/src/main/webapp/users-guide/deployer.conf?rev=1054625&r1=1054624&r2=1054625&view=diff
==============================================================================
--- karaf/trunk/manual/src/main/webapp/users-guide/deployer.conf (original)
+++ karaf/trunk/manual/src/main/webapp/users-guide/deployer.conf Mon Jan  3 14:18:48 2011
@@ -58,6 +58,35 @@ To be able to hot deploy web application
 karaf@root> features:install war
 {code}
 
+NB: you can use the -v or --verbose option to see exactly what is performed by the feature
deployer.
+
+{code}
+karaf@root> features:install -v war
+Installing feature war 2.1.99-SNAPSHOT
+Installing feature http 2.1.99-SNAPSHOT
+Installing feature jetty 7.1.6.v20100715
+Installing bundle mvn:org.apache.geronimo.specs/geronimo-servlet_2.5_spec/1.1.2
+Found installed bundle: org.apache.servicemix.bundles.asm [10]
+Installing bundle mvn:org.eclipse.jetty/jetty-util/7.1.6.v20100715
+Installing bundle mvn:org.eclipse.jetty/jetty-io/7.1.6.v20100715
+Installing bundle mvn:org.eclipse.jetty/jetty-http/7.1.6.v20100715
+Installing bundle mvn:org.eclipse.jetty/jetty-continuation/7.1.6.v20100715
+Installing bundle mvn:org.eclipse.jetty/jetty-server/7.1.6.v20100715
+Installing bundle mvn:org.eclipse.jetty/jetty-security/7.1.6.v20100715
+Installing bundle mvn:org.eclipse.jetty/jetty-servlet/7.1.6.v20100715
+Installing bundle mvn:org.eclipse.jetty/jetty-xml/7.1.6.v20100715
+Checking configuration file mvn:org.apache.karaf/apache-karaf/2.1.99-SNAPSHOT/xml/jettyconfig
+Installing bundle mvn:org.ops4j.pax.web/pax-web-api/0.8.2-SNAPSHOT
+Installing bundle mvn:org.ops4j.pax.web/pax-web-spi/0.8.2-SNAPSHOT
+Installing bundle mvn:org.ops4j.pax.web/pax-web-runtime/0.8.2-SNAPSHOT
+Installing bundle mvn:org.ops4j.pax.web/pax-web-jetty/0.8.2-SNAPSHOT
+Installing bundle mvn:org.ops4j.pax.web/pax-web-jsp/0.8.2-SNAPSHOT
+Installing bundle mvn:org.ops4j.pax.web/pax-web-extender-war/0.8.2-SNAPSHOT
+Installing bundle mvn:org.ops4j.pax.web/pax-web-extender-whiteboard/0.8.2-SNAPSHOT
+Installing bundle mvn:org.ops4j.pax.web/pax-web-deployer/0.8.2-SNAPSHOT
+Installing bundle mvn:org.ops4j.pax.url/pax-url-war/1.2.4
+{code}
+
 You should now be able to see the war deployer:
 
 {code}

Modified: karaf/trunk/manual/src/main/webapp/users-guide/installing-features.conf
URL: http://svn.apache.org/viewvc/karaf/trunk/manual/src/main/webapp/users-guide/installing-features.conf?rev=1054625&r1=1054624&r2=1054625&view=diff
==============================================================================
--- karaf/trunk/manual/src/main/webapp/users-guide/installing-features.conf (original)
+++ karaf/trunk/manual/src/main/webapp/users-guide/installing-features.conf Mon Jan  3 14:18:48
2011
@@ -49,6 +49,33 @@ karaf@root> features:list 
 {noformat}
 karaf@root> features:install war 
 {noformat}
+NB: you can use the -v or --verbose to see exactly what Karaf does
+{noformat}
+karaf@root> features:install -v war
+Installing feature war 2.1.99-SNAPSHOT
+Installing feature http 2.1.99-SNAPSHOT
+Installing feature jetty 7.1.6.v20100715
+Installing bundle mvn:org.apache.geronimo.specs/geronimo-servlet_2.5_spec/1.1.2
+Found installed bundle: org.apache.servicemix.bundles.asm [10]
+Installing bundle mvn:org.eclipse.jetty/jetty-util/7.1.6.v20100715
+Installing bundle mvn:org.eclipse.jetty/jetty-io/7.1.6.v20100715
+Installing bundle mvn:org.eclipse.jetty/jetty-http/7.1.6.v20100715
+Installing bundle mvn:org.eclipse.jetty/jetty-continuation/7.1.6.v20100715
+Installing bundle mvn:org.eclipse.jetty/jetty-server/7.1.6.v20100715
+Installing bundle mvn:org.eclipse.jetty/jetty-security/7.1.6.v20100715
+Installing bundle mvn:org.eclipse.jetty/jetty-servlet/7.1.6.v20100715
+Installing bundle mvn:org.eclipse.jetty/jetty-xml/7.1.6.v20100715
+Checking configuration file mvn:org.apache.karaf/apache-karaf/2.1.99-SNAPSHOT/xml/jettyconfig
+Installing bundle mvn:org.ops4j.pax.web/pax-web-api/0.8.2-SNAPSHOT
+Installing bundle mvn:org.ops4j.pax.web/pax-web-spi/0.8.2-SNAPSHOT
+Installing bundle mvn:org.ops4j.pax.web/pax-web-runtime/0.8.2-SNAPSHOT
+Installing bundle mvn:org.ops4j.pax.web/pax-web-jetty/0.8.2-SNAPSHOT
+Installing bundle mvn:org.ops4j.pax.web/pax-web-jsp/0.8.2-SNAPSHOT
+Installing bundle mvn:org.ops4j.pax.web/pax-web-extender-war/0.8.2-SNAPSHOT
+Installing bundle mvn:org.ops4j.pax.web/pax-web-extender-whiteboard/0.8.2-SNAPSHOT
+Installing bundle mvn:org.ops4j.pax.web/pax-web-deployer/0.8.2-SNAPSHOT
+Installing bundle mvn:org.ops4j.pax.url/pax-url-war/1.2.4
+{noformat}
 # Verify the features were installed
 {noformat}
 servicemix> features/list

Modified: karaf/trunk/manual/src/main/webapp/users-guide/provisioning.conf
URL: http://svn.apache.org/viewvc/karaf/trunk/manual/src/main/webapp/users-guide/provisioning.conf?rev=1054625&r1=1054624&r2=1054625&view=diff
==============================================================================
--- karaf/trunk/manual/src/main/webapp/users-guide/provisioning.conf (original)
+++ karaf/trunk/manual/src/main/webapp/users-guide/provisioning.conf Mon Jan  3 14:18:48 2011
@@ -36,13 +36,13 @@ element features {
 Here is an example of such a repository:
 {code:lang=xml}
 <features>
-    <feature name="spring" version="2.5.6.SEC01">
+    <feature name="spring" version="3.0.4.RELEASE">
         <bundle>mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.aopalliance/1.0_1</bundle>
-        <bundle>mvn:org.springframework/spring-core/2.5.6.SEC01</bundle>
-        <bundle>mvn:org.springframework/spring-beans/2.5.6.SEC01</bundle>
-        <bundle>mvn:org.springframework/spring-aop/2.5.6.SEC01</bundle>     
  
-        <bundle>mvn:org.springframework/spring-context/2.5.6.SEC01</bundle>
-        <bundle>mvn:org.springframework/spring-context-support/2.5.6.SEC01</bundle>
+        <bundle>mvn:org.springframework/spring-core/3.0.4.RELEASE</bundle>
+        <bundle>mvn:org.springframework/spring-beans/3.0.4.RELEASE</bundle>
+        <bundle>mvn:org.springframework/spring-aop/3.0.4.RELEASE</bundle>
+        <bundle>mvn:org.springframework/spring-context/3.0.4.RELEASE</bundle>
+        <bundle>mvn:org.springframework/spring-context-support/3.0.4.RELEASE</bundle>
     </feature>
 </features>
 {code}
@@ -53,9 +53,9 @@ References to features define in other r
 
 {code:xml}
 <features>
-  <repository>mvn:org.apache.servicemix.nmr/apache-servicemix-nmr/1.2.0/xml/features</repository>
-  <repository>mvn:org.apache.camel.karaf/apache-camel/2.2.0/xml/features</repository>
-  <repository>mvn:org.apache.felix.karaf/apache-felix-karaf/1.4.0/xml/features</repository>
+  <repository>mvn:org.apache.servicemix.nmr/apache-servicemix-nmr/1.3.0/xml/features</repository>
+  <repository>mvn:org.apache.camel.karaf/apache-camel/2.5.0/xml/features</repository>
+  <repository>mvn:org.apache.karaf/apache-karaf/2.1.2/xml/features</repository>
   ...
 {code}
 



Mime
View raw message