You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@karaf.apache.org by jb...@apache.org on 2011/12/01 11:27:29 UTC

svn commit: r1209024 - in /karaf/trunk/wrapper/core: pom.xml src/main/java/org/apache/karaf/wrapper/internal/WrapperServiceImpl.java

Author: jbonofre
Date: Thu Dec  1 10:27:28 2011
New Revision: 1209024

URL: http://svn.apache.org/viewvc?rev=1209024&view=rev
Log:
[KARAF-963] Display output message for the wrapper service

Modified:
    karaf/trunk/wrapper/core/pom.xml
    karaf/trunk/wrapper/core/src/main/java/org/apache/karaf/wrapper/internal/WrapperServiceImpl.java

Modified: karaf/trunk/wrapper/core/pom.xml
URL: http://svn.apache.org/viewvc/karaf/trunk/wrapper/core/pom.xml?rev=1209024&r1=1209023&r2=1209024&view=diff
==============================================================================
--- karaf/trunk/wrapper/core/pom.xml (original)
+++ karaf/trunk/wrapper/core/pom.xml Thu Dec  1 10:27:28 2011
@@ -46,6 +46,10 @@
             <artifactId>org.apache.karaf.main</artifactId>
         </dependency>
         <dependency>
+            <groupId>org.apache.karaf.shell</groupId>
+            <artifactId>org.apache.karaf.shell.console</artifactId>
+        </dependency>
+        <dependency>
             <groupId>org.apache.karaf</groupId>
             <artifactId>org.apache.karaf.util</artifactId>
         </dependency>

Modified: karaf/trunk/wrapper/core/src/main/java/org/apache/karaf/wrapper/internal/WrapperServiceImpl.java
URL: http://svn.apache.org/viewvc/karaf/trunk/wrapper/core/src/main/java/org/apache/karaf/wrapper/internal/WrapperServiceImpl.java?rev=1209024&r1=1209023&r2=1209024&view=diff
==============================================================================
--- karaf/trunk/wrapper/core/src/main/java/org/apache/karaf/wrapper/internal/WrapperServiceImpl.java (original)
+++ karaf/trunk/wrapper/core/src/main/java/org/apache/karaf/wrapper/internal/WrapperServiceImpl.java Thu Dec  1 10:27:28 2011
@@ -17,6 +17,7 @@
 package org.apache.karaf.wrapper.internal;
 
 import org.apache.karaf.wrapper.WrapperService;
+import org.fusesource.jansi.Ansi;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -147,6 +148,8 @@ public class WrapperServiceImpl implemen
     private void mkdir(File file) {
         if (!file.exists()) {
             LOGGER.info("Creating missing directory: {}", file.getPath());
+            System.out.println(Ansi.ansi().a("Creating missing directory: ")
+                    .a(Ansi.Attribute.INTENSITY_BOLD).a(file.getPath()).a(Ansi.Attribute.RESET).toString());
             file.mkdirs();
         }
     }
@@ -154,6 +157,8 @@ public class WrapperServiceImpl implemen
     private void copyResourceTo(File outFile, String resource, boolean text) throws Exception {
         if (!outFile.exists()) {
             LOGGER.info("Creating file: {}", outFile.getPath());
+            System.out.println(Ansi.ansi().a("Creating file: ")
+                    .a(Ansi.Attribute.INTENSITY_BOLD).a(outFile.getPath()).a(Ansi.Attribute.RESET).toString());
             InputStream is = WrapperServiceImpl.class.getResourceAsStream(resource);
             if (is == null) {
                 throw new IllegalArgumentException("Resource " + resource + " doesn't exist");
@@ -189,12 +194,17 @@ public class WrapperServiceImpl implemen
             }
         } else {
             LOGGER.warn("File already exists. Move it out of the way if you wish to recreate it: {}", outFile.getPath());
+            System.out.println(Ansi.ansi()
+                    .fg(Ansi.Color.RED).a("File already exists").a(Ansi.Attribute.RESET)
+                    .a(". Move it out of the way if you wish to recreate it: ").a(outFile.getPath()).toString());
         }
     }
 
     private void copyFilteredResourceTo(File outFile, String resource, HashMap<String, String> props) throws Exception {
         if (!outFile.exists()) {
             LOGGER.info("Creating file: {}", outFile.getPath());
+            System.out.println(Ansi.ansi().a("Creating file: ")
+                    .a(Ansi.Attribute.INTENSITY_BOLD).a(outFile.getPath()).a(Ansi.Attribute.RESET).toString());
             InputStream is = WrapperServiceImpl.class.getResourceAsStream(resource);
             if (is == null) {
                 throw new IllegalArgumentException("Resource " + resource + " doesn't exist");
@@ -217,6 +227,9 @@ public class WrapperServiceImpl implemen
             }
         } else {
             LOGGER.warn("File already exists. Move it out of the way if you wish to recreate it: {}", outFile.getPath());
+            System.out.println(Ansi.ansi()
+                    .fg(Ansi.Color.RED).a("File already exists").a(Ansi.Attribute.RESET)
+                    .a(". Move it out of the way if you wish to recreate it: ").a(outFile.getPath()).toString());
         }
     }
 
@@ -268,6 +281,8 @@ public class WrapperServiceImpl implemen
     private void createJar(File outFile, String resource) throws Exception {
         if (!outFile.exists()) {
             LOGGER.info("Creating file: {}", outFile.getPath());
+            System.out.println(Ansi.ansi().a("Creating file: ")
+                    .a(Ansi.Attribute.INTENSITY_BOLD).a(outFile.getPath()).a(Ansi.Attribute.RESET).toString());
             InputStream is = getClass().getClassLoader().getResourceAsStream(resource);
             if (is == null) {
                 throw new IllegalStateException("Resource " + resource + " not found!");