[Carbon-dev] svn commit r18974 - in trunk/carbon: org.wso2.carbon.bridge org.wso2.carbon.bridge/src/main/java/org/wso2/carbon/bridge org.wso2.carbon.component/src/main/java/org/wso2/carbon/component org.wso2.carbon.core/src/main/java/org/wso2/carbon/core/internal org.wso2.carbon.core/src/main/java/org/wso2/carbon/core/util org.wso2.carbon.utils/src/main/java/org/wso2/carbon/utils org.wso2.carbon.utils/src/main/java/org/wso2/carbon/utils/codegen org.wso2.carbon.utils/src/main/java/org/wso2/carbon/utils/security

sameera at wso2.com sameera at wso2.com
Tue Jul 8 05:47:18 PDT 2008


Author: sameera
Date: Tue Jul  8 05:47:18 2008
New Revision: 18974
URL: http://wso2.org/svn/browse/wso2?view=rev&revision=18974

Log:
Replaced system.outs with logs



Modified:
   trunk/carbon/org.wso2.carbon.bridge/pom.xml
   trunk/carbon/org.wso2.carbon.bridge/src/main/java/org/wso2/carbon/bridge/AutoActivator.java
   trunk/carbon/org.wso2.carbon.component/src/main/java/org/wso2/carbon/component/ComponentDeployer.java
   trunk/carbon/org.wso2.carbon.core/src/main/java/org/wso2/carbon/core/internal/Activator.java
   trunk/carbon/org.wso2.carbon.core/src/main/java/org/wso2/carbon/core/util/HibernateConfig.java
   trunk/carbon/org.wso2.carbon.utils/src/main/java/org/wso2/carbon/utils/ArchiveManipulator.java
   trunk/carbon/org.wso2.carbon.utils/src/main/java/org/wso2/carbon/utils/Monitor.java
   trunk/carbon/org.wso2.carbon.utils/src/main/java/org/wso2/carbon/utils/codegen/CodegenHelper.java
   trunk/carbon/org.wso2.carbon.utils/src/main/java/org/wso2/carbon/utils/security/KeyImporter.java

Modified: trunk/carbon/org.wso2.carbon.bridge/pom.xml
URL: http://wso2.org/svn/browse/wso2/trunk/carbon/org.wso2.carbon.bridge/pom.xml?rev=18974&r1=18973&r2=18974&view=diff
==============================================================================
--- trunk/carbon/org.wso2.carbon.bridge/pom.xml	(original)
+++ trunk/carbon/org.wso2.carbon.bridge/pom.xml	Tue Jul  8 05:47:18 2008
@@ -20,6 +20,16 @@
             <artifactId>servlet-api</artifactId>
         </dependency>
 
+        <dependency>
+            <groupId>org.eclipse.equinox</groupId>
+            <artifactId>org.apache.log4j</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>org.eclipse.equinox</groupId>
+            <artifactId>org.apache.commons.logging</artifactId>
+        </dependency>
+
         <!-- Start of OSGi dependencies with Felix -->
         <dependency>
             <groupId>org.apache.felix</groupId>

Modified: trunk/carbon/org.wso2.carbon.bridge/src/main/java/org/wso2/carbon/bridge/AutoActivator.java
URL: http://wso2.org/svn/browse/wso2/trunk/carbon/org.wso2.carbon.bridge/src/main/java/org/wso2/carbon/bridge/AutoActivator.java?rev=18974&r1=18973&r2=18974&view=diff
==============================================================================
--- trunk/carbon/org.wso2.carbon.bridge/src/main/java/org/wso2/carbon/bridge/AutoActivator.java	(original)
+++ trunk/carbon/org.wso2.carbon.bridge/src/main/java/org/wso2/carbon/bridge/AutoActivator.java	Tue Jul  8 05:47:18 2008
@@ -19,6 +19,8 @@
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.Bundle;
 import org.osgi.service.startlevel.StartLevel;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
 
 import java.util.Map;
 import java.util.Iterator;
@@ -28,6 +30,8 @@
 * 
 */
 public class AutoActivator implements BundleActivator {
+
+    private static Log log = LogFactory.getLog(AutoActivator.class);
     /**
      * The property name prefix for the launcher's auto-install property.
      */
@@ -103,7 +107,7 @@
                     startLevel = Integer.parseInt(key.substring(key.lastIndexOf('.') + 1));
                 }
                 catch (NumberFormatException ex) {
-                    System.err.println("Invalid property: " + key);
+                    log.error("Invalid property: " + key);
                 }
             }
 
@@ -116,7 +120,7 @@
                     sl.setBundleStartLevel(b, startLevel);
                 }
                 catch (Exception ex) {
-                    System.err.println("Auto-properties install: " + ex);
+                    log.error("Auto-properties install: " + ex);
                 }
             }
         }
@@ -137,7 +141,7 @@
                         }
                     }
                     catch (Exception ex) {
-                        System.err.println("Auto-properties start: " + ex);
+                        log.error("Auto-properties start: " + ex);
                     }
                 }
             }

Modified: trunk/carbon/org.wso2.carbon.component/src/main/java/org/wso2/carbon/component/ComponentDeployer.java
URL: http://wso2.org/svn/browse/wso2/trunk/carbon/org.wso2.carbon.component/src/main/java/org/wso2/carbon/component/ComponentDeployer.java?rev=18974&r1=18973&r2=18974&view=diff
==============================================================================
--- trunk/carbon/org.wso2.carbon.component/src/main/java/org/wso2/carbon/component/ComponentDeployer.java	(original)
+++ trunk/carbon/org.wso2.carbon.component/src/main/java/org/wso2/carbon/component/ComponentDeployer.java	Tue Jul  8 05:47:18 2008
@@ -82,7 +82,11 @@
 
 
         ByteArrayOutputStream bos = new ByteArrayOutputStream();
-        System.out.println("intermediate : " + componentEle);
+
+        if(log.isDebugEnabled()){
+            log.debug("intermediate : " + componentEle);
+        }
+        
         try {
             componentEle.serializeAndConsume(bos);
         } catch (XMLStreamException e) {

Modified: trunk/carbon/org.wso2.carbon.core/src/main/java/org/wso2/carbon/core/internal/Activator.java
URL: http://wso2.org/svn/browse/wso2/trunk/carbon/org.wso2.carbon.core/src/main/java/org/wso2/carbon/core/internal/Activator.java?rev=18974&r1=18973&r2=18974&view=diff
==============================================================================
--- trunk/carbon/org.wso2.carbon.core/src/main/java/org/wso2/carbon/core/internal/Activator.java	(original)
+++ trunk/carbon/org.wso2.carbon.core/src/main/java/org/wso2/carbon/core/internal/Activator.java	Tue Jul  8 05:47:18 2008
@@ -17,6 +17,8 @@
 
 import org.apache.axis2.context.ConfigurationContext;
 import org.apache.axiom.om.impl.builder.StAXOMBuilder;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
 import org.osgi.framework.BundleActivator;
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.ServiceReference;
@@ -34,20 +36,17 @@
  */
 public class Activator implements BundleActivator {
 
-    public void start(BundleContext context) throws Exception {
+    private static Log log = LogFactory.getLog(Activator.class);
 
-        String st = "<foo>Working Carbon Core - Activator</foo>";
-        try {
-            StAXOMBuilder builder = new StAXOMBuilder(new ByteArrayInputStream(st.getBytes()));
-            System.out.println(builder.getDocumentElement());
-        } catch (XMLStreamException e) {
-            e.printStackTrace();
-        }
+
+    public void start(BundleContext context) throws Exception {
 
         ServiceReference reference = context.getServiceReference(HttpService.class.getName());
         if (reference == null) {
-            throw new Exception("Before activating this bundle, an instance of " +
-                                HttpService.class.getName() + " should be in existance");
+            String msg = "Before activating this bundle, an instance of " +
+                                HttpService.class.getName() + " should be in existance";
+            log.error(msg);
+            throw new Exception(msg);
         }
         HttpService httpService = (HttpService) context.getService(reference);
         HttpContext defaultHttpContext = httpService.createDefaultHttpContext();
@@ -70,18 +69,22 @@
         FileDownloadServlet fileDownloadServlet = new FileDownloadServlet(context);
         httpService.registerServlet("/filedownload", fileDownloadServlet, null, defaultHttpContext);
 
+        if (log.isDebugEnabled()) {
+            log.debug("Carbon Core is activated");
+        }
     }
 
     public void stop(BundleContext context) throws Exception {
         ServiceReference reference = context.getServiceReference(HttpService.class.getName());
         if (reference == null) {
-            throw new Exception("Before stopping this bundle, an instance of " +
-                                HttpService.class.getName() + " should be in existance");
+            String msg = "Before stopping this bundle, an instance of " +
+                                HttpService.class.getName() + " should be in existance";
+            log.error(msg);
+            throw new Exception(msg);
         }
         HttpService httpService = (HttpService) context.getService(reference);
         httpService.unregister("/startup_servlet");
         httpService.unregister("/services");
         httpService.unregister("/filedownload");
-
     }
 }

Modified: trunk/carbon/org.wso2.carbon.core/src/main/java/org/wso2/carbon/core/util/HibernateConfig.java
URL: http://wso2.org/svn/browse/wso2/trunk/carbon/org.wso2.carbon.core/src/main/java/org/wso2/carbon/core/util/HibernateConfig.java?rev=18974&r1=18973&r2=18974&view=diff
==============================================================================
--- trunk/carbon/org.wso2.carbon.core/src/main/java/org/wso2/carbon/core/util/HibernateConfig.java	(original)
+++ trunk/carbon/org.wso2.carbon.core/src/main/java/org/wso2/carbon/core/util/HibernateConfig.java	Tue Jul  8 05:47:18 2008
@@ -20,6 +20,8 @@
 import org.hibernate.Session;
 import org.hibernate.SessionFactory;
 import org.hibernate.cfg.Configuration;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
 
 /**
  * A utility for managing Hibernate Configuration related stuff.
@@ -28,6 +30,9 @@
  * modules/services deployed should also maintain there own single instance
  */
 public class HibernateConfig {
+
+    private static Log log = LogFactory.getLog(HibernateConfig.class);
+
     private final SessionFactory SESSION_FACTORY;
 
     /**
@@ -68,7 +73,7 @@
             commonInit(cfg, sqlDialect, dbDriver, dbConnIdentifier, username, password);
             SESSION_FACTORY = cfg.buildSessionFactory();
         } catch (Throwable ex) {
-            System.err.println("Initial SessionFactory creation failed." + ex);
+            log.error("Initial SessionFactory creation failed." + ex);
             throw new ExceptionInInitializerError(ex);
         }
     }
@@ -111,7 +116,7 @@
             commonInit(cfg, sqlDialect, dbDriver, dbConnIdentifier, username, password);
             SESSION_FACTORY = cfg.buildSessionFactory();
         } catch (Throwable ex) {
-            System.err.println("Initial SessionFactory creation failed." + ex);
+            log.error("Initial SessionFactory creation failed." + ex);
             throw new ExceptionInInitializerError(ex);
         }
     }
@@ -130,7 +135,7 @@
                     new Configuration().
                             configure("wso2wsas.hibernate.cfg.xml").buildSessionFactory();
         } catch (Throwable ex) {
-            System.err.println("Initial SessionFactory creation failed." + ex);
+            log.error("Initial SessionFactory creation failed." + ex);
             throw new ExceptionInInitializerError(ex);
         }
     }

Modified: trunk/carbon/org.wso2.carbon.utils/src/main/java/org/wso2/carbon/utils/ArchiveManipulator.java
URL: http://wso2.org/svn/browse/wso2/trunk/carbon/org.wso2.carbon.utils/src/main/java/org/wso2/carbon/utils/ArchiveManipulator.java?rev=18974&r1=18973&r2=18974&view=diff
==============================================================================
--- trunk/carbon/org.wso2.carbon.utils/src/main/java/org/wso2/carbon/utils/ArchiveManipulator.java	(original)
+++ trunk/carbon/org.wso2.carbon.utils/src/main/java/org/wso2/carbon/utils/ArchiveManipulator.java	Tue Jul  8 05:47:18 2008
@@ -15,6 +15,9 @@
  */
 package org.wso2.carbon.utils;
 
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
 import java.io.File;
 import java.io.FileInputStream;
 import java.io.FileOutputStream;
@@ -32,6 +35,8 @@
  */
 public class ArchiveManipulator {
 
+    private static Log log = LogFactory.getLog(ArchiveManipulator.class);
+
     protected String archiveSourceDir;
 
     /**
@@ -100,7 +105,7 @@
                     in.close();
                 }
             } catch (IOException e) {
-                System.err.println("Could not close InputStream " + e);
+                log.error("Could not close InputStream " + e);
             }
         }
     }
@@ -152,7 +157,7 @@
             }
         } catch (IOException e) {
             String msg = "Cannot unzip archive. It is probably corrupt";
-            System.err.println(msg);
+            log.error(msg);
             e.printStackTrace();
             throw e;
         } finally {

Modified: trunk/carbon/org.wso2.carbon.utils/src/main/java/org/wso2/carbon/utils/Monitor.java
URL: http://wso2.org/svn/browse/wso2/trunk/carbon/org.wso2.carbon.utils/src/main/java/org/wso2/carbon/utils/Monitor.java?rev=18974&r1=18973&r2=18974&view=diff
==============================================================================
--- trunk/carbon/org.wso2.carbon.utils/src/main/java/org/wso2/carbon/utils/Monitor.java	(original)
+++ trunk/carbon/org.wso2.carbon.utils/src/main/java/org/wso2/carbon/utils/Monitor.java	Tue Jul  8 05:47:18 2008
@@ -17,6 +17,8 @@
 package org.wso2.carbon.utils;
 
 import org.wso2.carbon.utils.i18n.Messages;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
 
 import java.io.InputStreamReader;
 import java.io.LineNumberReader;
@@ -28,6 +30,9 @@
  * Monitor thread.
  */
 public class Monitor extends Thread {
+
+    private static Log log = LogFactory.getLog(Monitor.class);
+
     private ServerSocket serverSocket;
     private String key;
 
@@ -50,7 +55,7 @@
             }
         }
         catch (Exception e) {
-            System.err.println(e.toString());
+            log.error(e.toString());
         }
         if (serverSocket == null) {
             throw new RuntimeException(Messages.getMessage("InvalidAdminPort", Integer.toString(port)));
@@ -106,7 +111,7 @@
                     socket.getOutputStream().flush();
                 }
             } catch (Exception e) {
-                System.err.println(e.toString());
+                log.error(e.toString());
             } finally {
                 if (socket != null) {
                     try {

Modified: trunk/carbon/org.wso2.carbon.utils/src/main/java/org/wso2/carbon/utils/codegen/CodegenHelper.java
URL: http://wso2.org/svn/browse/wso2/trunk/carbon/org.wso2.carbon.utils/src/main/java/org/wso2/carbon/utils/codegen/CodegenHelper.java?rev=18974&r1=18973&r2=18974&view=diff
==============================================================================
--- trunk/carbon/org.wso2.carbon.utils/src/main/java/org/wso2/carbon/utils/codegen/CodegenHelper.java	(original)
+++ trunk/carbon/org.wso2.carbon.utils/src/main/java/org/wso2/carbon/utils/codegen/CodegenHelper.java	Tue Jul  8 05:47:18 2008
@@ -18,6 +18,8 @@
 import org.apache.axiom.om.OMElement;
 import org.apache.axiom.om.impl.builder.StAXOMBuilder;
 import org.apache.axis2.wsdl.WSDL2Java;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
 
 import javax.xml.namespace.QName;
 import java.io.File;
@@ -29,6 +31,8 @@
 
 public class CodegenHelper {
 
+    private static Log log = LogFactory.getLog(CodegenHelper.class);    
+
     private static final String SET = "set";
 
     private OMElement loadCodegenXML(String codegenXML) throws Exception {
@@ -82,7 +86,10 @@
                     (String[]) setList.toArray(new String[setList.size()]);
 
             generateCode(wsdl2JavaArgs);
-            System.out.println(setArrayList.get(i) + " processed successfully.");
+
+            if(log.isDebugEnabled()){
+                log.debug(setArrayList.get(i) + " processed successfully.");
+            }
         }
     }
 

Modified: trunk/carbon/org.wso2.carbon.utils/src/main/java/org/wso2/carbon/utils/security/KeyImporter.java
URL: http://wso2.org/svn/browse/wso2/trunk/carbon/org.wso2.carbon.utils/src/main/java/org/wso2/carbon/utils/security/KeyImporter.java?rev=18974&r1=18973&r2=18974&view=diff
==============================================================================
--- trunk/carbon/org.wso2.carbon.utils/src/main/java/org/wso2/carbon/utils/security/KeyImporter.java	(original)
+++ trunk/carbon/org.wso2.carbon.utils/src/main/java/org/wso2/carbon/utils/security/KeyImporter.java	Tue Jul  8 05:47:18 2008
@@ -15,6 +15,9 @@
  */
 package org.wso2.carbon.utils.security;
 
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
 import java.security.KeyStore;
 import java.security.cert.Certificate;
 import java.io.FileInputStream;
@@ -25,13 +28,20 @@
  * A utility that allows importing a certificate from one keystore to another
  */
 public class KeyImporter {
+
+    private static Log log = LogFactory.getLog(KeyImporter.class);
+
     /**
      * sourcekeystore sourceStorepass keyalias targetstore targetStorePass
      *
      * @param args
      */
     public static void main(String[] args) throws Exception {
-        System.out.println("Importing certificate ...");
+
+        if(log.isDebugEnabled()){
+            log.debug("Importing certificate ...");
+        }
+
         if (args.length != 5) {
             throw new Exception("Incorrect number of parameters");
         }
@@ -65,10 +75,12 @@
             fis.close();
             fileOutputStream.flush();
             fileOutputStream.close();
-            System.out.println("Importing certificate ... DONE !");
+            
+            if(log.isDebugEnabled()){
+                log.debug("Importing certificate ... DONE !");
+            }
         } catch (Exception e) {
-            e.printStackTrace();
-            System.err.println("Importing of key failed");
+            log.error("Importing of key failed");
             throw e;
         }
     }



More information about the Carbon-dev mailing list