[teiid-commits] teiid SVN: r877 - in trunk: common-core/src/main/java/com/metamatrix/core/util and 13 other directories.

teiid-commits at lists.jboss.org teiid-commits at lists.jboss.org
Thu May 7 13:11:02 EDT 2009


Author: shawkins
Date: 2009-05-07 13:11:01 -0400 (Thu, 07 May 2009)
New Revision: 877

Added:
   trunk/common-core/src/main/java/com/metamatrix/core/log/JavaLogWriter.java
Removed:
   trunk/common-core/src/main/java/com/metamatrix/core/log/NullLogWriter.java
   trunk/common-core/src/main/java/com/metamatrix/core/util/Stopwatch.java
   trunk/connector-sdk/src/main/java/com/metamatrix/common/classloader/NestedException.java
Modified:
   trunk/common-core/src/main/java/com/metamatrix/core/log/LogMessage.java
   trunk/common-core/src/main/java/com/metamatrix/core/util/ZipFileUtil.java
   trunk/common-core/src/test/java/com/metamatrix/core/id/TestUUIDFactoryWithoutCreation.java
   trunk/common-internal/src/main/java/com/metamatrix/common/log/LogManager.java
   trunk/common-internal/src/main/java/com/metamatrix/common/object/MultiplicityPool.java
   trunk/connector-sdk/src/main/java/com/metamatrix/common/classloader/ClassLoaderUtil.java
   trunk/embedded/src/main/java/com/metamatrix/dqp/embedded/configuration/VDBConfigurationReader.java
   trunk/embedded/src/main/java/com/metamatrix/jdbc/LogConfigurationProvider.java
   trunk/embedded/src/main/java/com/metamatrix/jdbc/LogListernerProvider.java
   trunk/engine/src/main/java/com/metamatrix/dqp/spi/basic/FileCommandLogger.java
   trunk/server/src/main/java/com/metamatrix/common/extensionmodule/spi/jdbc/JDBCExtensionModuleUtil.java
   trunk/server/src/main/java/com/metamatrix/platform/security/audit/destination/SingleFileAuditDestination.java
   trunk/server/src/main/java/com/metamatrix/platform/vm/api/controller/ProcessManagement.java
   trunk/server/src/main/java/com/metamatrix/platform/vm/controller/ProcessController.java
   trunk/server/src/main/java/com/metamatrix/server/ServiceManager.java
   trunk/server/src/main/java/com/metamatrix/server/admin/apiimpl/RuntimeMetadataHelper.java
Log:
TEIID-565 changing default logging to java logging

Copied: trunk/common-core/src/main/java/com/metamatrix/core/log/JavaLogWriter.java (from rev 867, trunk/common-core/src/main/java/com/metamatrix/core/log/NullLogWriter.java)
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/core/log/JavaLogWriter.java	                        (rev 0)
+++ trunk/common-core/src/main/java/com/metamatrix/core/log/JavaLogWriter.java	2009-05-07 17:11:01 UTC (rev 877)
@@ -0,0 +1,61 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership.  Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ * 
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ * 
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ * 
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+
+package com.metamatrix.core.log;
+
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+/** 
+ * Write to Java logging
+ */
+public class JavaLogWriter implements LogListener {
+
+    public void logMessage(LogMessage msg) {
+    	Logger logger = Logger.getLogger("org.teiid." + msg.getContext()); //$NON-NLS-1$
+    	Level level = convertLevel(msg.getLevel());
+    	if (logger.isLoggable(level)) {
+            logger.log(level, msg.getText(), msg.getException());
+    	}
+    }
+    
+    public Level convertLevel(int level) {
+    	switch (level) {
+    	case MessageLevel.CRITICAL:
+    	case MessageLevel.ERROR:
+    		return Level.SEVERE;
+    	case MessageLevel.WARNING:
+    		return Level.WARNING;
+    	case MessageLevel.INFO:
+    		return Level.FINE;
+    	case MessageLevel.DETAIL:
+    		return Level.FINER;
+    	case MessageLevel.TRACE:
+    		return Level.FINEST;
+    	}
+    	return Level.ALL;
+    }
+
+    public void shutdown() {
+    }
+
+}


Property changes on: trunk/common-core/src/main/java/com/metamatrix/core/log/JavaLogWriter.java
___________________________________________________________________
Name: svn:mergeinfo
   + 

Modified: trunk/common-core/src/main/java/com/metamatrix/core/log/LogMessage.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/core/log/LogMessage.java	2009-05-07 17:05:29 UTC (rev 876)
+++ trunk/common-core/src/main/java/com/metamatrix/core/log/LogMessage.java	2009-05-07 17:11:01 UTC (rev 877)
@@ -115,9 +115,8 @@
 
         if (text == null) {
         	return "NULL"; //$NON-NLS-1$
-        } else {
-        	return text.toString();
-        }			
+        } 
+        return text.toString();
 	}
     
     /** 

Deleted: trunk/common-core/src/main/java/com/metamatrix/core/log/NullLogWriter.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/core/log/NullLogWriter.java	2009-05-07 17:05:29 UTC (rev 876)
+++ trunk/common-core/src/main/java/com/metamatrix/core/log/NullLogWriter.java	2009-05-07 17:11:01 UTC (rev 877)
@@ -1,39 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership.  Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package com.metamatrix.core.log;
-
-
-
-/** 
- * NullLogWriter to write no where..
- */
-public class NullLogWriter implements LogListener {
-
-    public void logMessage(LogMessage msg) {
-        // I was designed to be slacker.. cool.
-    }
-
-    public void shutdown() {
-    }
-
-}

Deleted: trunk/common-core/src/main/java/com/metamatrix/core/util/Stopwatch.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/core/util/Stopwatch.java	2009-05-07 17:05:29 UTC (rev 876)
+++ trunk/common-core/src/main/java/com/metamatrix/core/util/Stopwatch.java	2009-05-07 17:11:01 UTC (rev 877)
@@ -1,289 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership.  Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package com.metamatrix.core.util;
-
-import java.io.Serializable;
-
-import com.metamatrix.core.CorePlugin;
-import com.metamatrix.core.log.Logger;
-import com.metamatrix.core.log.MessageLevel;
-
-public class Stopwatch implements Serializable {
-    private long start = 0;
-    private long stop = 0;
-    private Statistics stats = new Statistics();
-    private boolean active = true;
-
-    private static final String SECONDS      = CorePlugin.Util.getString("Stopwatch.seconds"); //$NON-NLS-1$
-    private static final String MILLISECONDS = CorePlugin.Util.getString("Stopwatch.milliseconds"); //$NON-NLS-1$
-    private static final int VALUE_LENGTH = 10;
-
-    /**
-     * Return whether the stopwatch is active.  When the stopwatch is active,
-     * it is recording the time durations (via <code>start</code> and <code>stop</code>)
-     * and will print duration statistics (via <code>printDuration</code>).
-     * When the stopwatch is inactive, invoking these methods does nothing
-     * but return immediately.
-     * @return true if the stopwatch is active, or false if it is inactive.
-     */
-    public boolean isActive() {
-        return active;
-    }
-
-    /**
-     * Set the stopwatch as inactive.
-     * @see isActive
-     */
-    public void setInactive() {
-        active = false;
-    }
-    /**
-     * Set the stopwatch as active.
-     * @see isActive
-     */
-    public void setActive() {
-        active = true;
-    }
-
-    /**
-     * If the stopwatch is active, record the starting time for a time segment.
-     * If the stopwatch is inactive, the method returns immediately.
-     * @see isActive
-     */
-    public void start() {
-        if ( active ) {
-            start = System.currentTimeMillis();
-        }
-    }
-    
-    /**
-     * If the stopwatch is active, record the starting time for a time segment.
-     * If the stopwatch is inactive, the method returns immediately.
-     * @see isActive
-     */
-    public void start(boolean reset) {
-        if( reset )
-            reset();
-        start();
-    }
-    
-    /**
-     * If the stopwatch is active, record the ending time for a time segment.
-     * If the stopwatch is inactive, the method returns immediately.
-     * @see isActive
-     */
-    public void stop() {
-        if ( active ) {
-            stop = System.currentTimeMillis();
-            stats.add( stop - start );
-        }
-    }
-    /**
-     * Reset the statistics for this stopwatch, regardless of the active state.
-     */
-    public void reset() {
-        start    = 0;
-        stop     = 0;
-        stats.reset();
-    }
-    /**
-     * Return the total duration recorded, in milliseconds.
-     * @return the total number of milliseconds that have been recorded
-     */
-    public long getTotalDuration() {
-        return stats.getTotal();
-    }
-    /**
-     * Return the average duration recorded as a date.
-     * @return the number of milliseconds that have been recorded averaged
-     * over the number of segments
-     */
-    public float getAverageDuration() {
-        return stats.getAverage();
-    }
-    /**
-     * Return the number of segments that have been recorded.
-     * @return the number of segments
-     */
-    public int getSegmentCount() {
-        return stats.getCount();
-    }
-
-    public String toString() {
-        String units = MILLISECONDS;
-        StringBuffer valueString = null;
-        long value = getTotalDuration();
-        if ( value >= 1000 ) {
-            float fvalue = value / 1000.0f;
-            units = SECONDS;
-            valueString = new StringBuffer(Float.toString(fvalue));
-        } else {
-            valueString = new StringBuffer(Long.toString(value));
-        }
-        valueString.append(units);
-        return valueString.toString();
-    }
-
-    public String getTimeValueAsString( long value ) {
-        String units = MILLISECONDS;
-        StringBuffer valueString = null;
-        if ( value >= 1000 ) {
-            float fvalue = value / 1000.0f;
-            units = SECONDS;
-            valueString = new StringBuffer(Float.toString(fvalue));
-        } else {
-            valueString = new StringBuffer(Long.toString(value));
-        }
-        while ( valueString.length() < VALUE_LENGTH ) valueString.insert(0,' ');
-        return "" + valueString + units; //$NON-NLS-1$
-    }
-    public String getTimeValueAsString( float value ) {
-        String units = MILLISECONDS;
-        if ( value >= 1000.0f ) {
-            value = value / 1000.0f;
-            units = SECONDS;
-        }
-        StringBuffer valueString = new StringBuffer(Float.toString(value));
-        while ( valueString.length() < VALUE_LENGTH ) valueString.insert(0,' ');
-        return "" + valueString + units; //$NON-NLS-1$
-    }
-    public String getValueAsString( int value ) {
-        StringBuffer valueString = new StringBuffer(Integer.toString(value));
-        while ( valueString.length() < VALUE_LENGTH ) valueString.insert(0,' ');
-        return "" + valueString; //$NON-NLS-1$
-    }
-
-    /**
-     * Print the current statistics
-     * @param stream the stream to which the statistics should be printed
-     */
-    public void printStatistics(java.io.PrintStream stream) {
-        if ( active ) {
-            stream.println(CorePlugin.Util.getString("Stopwatch.Stopwatch_Statistics")); //$NON-NLS-1$
-            stream.println(CorePlugin.Util.getString("Stopwatch.Statistics_Total",this.getTimeValueAsString( stats.getTotal() ) ) ); //$NON-NLS-1$
-            stream.println(CorePlugin.Util.getString("Stopwatch.Statistics_Previous",this.getTimeValueAsString( stats.getLast() ) ) ); //$NON-NLS-1$
-            if ( stats.getCount() > 1 ) {
-                stream.println(CorePlugin.Util.getString("Stopwatch.Statistics_Count",this.getValueAsString( stats.getCount() ) ) ); //$NON-NLS-1$
-                stream.println(CorePlugin.Util.getString("Stopwatch.Statistics_Average",this.getTimeValueAsString( stats.getAverage() ) ) ); //$NON-NLS-1$
-                stream.println(CorePlugin.Util.getString("Stopwatch.Statistics_Minimum",this.getTimeValueAsString( stats.getMinimum() ) ) ); //$NON-NLS-1$
-                stream.println(CorePlugin.Util.getString("Stopwatch.Statistics_Maximum",this.getTimeValueAsString( stats.getMaximum() ) ) ); //$NON-NLS-1$
-            }
-        }
-    }
-
-    /**
-     * Print the current statistics to System.out
-     */
-    public void printStatistics() {
-        printStatistics(System.out);
-    }
-
-
-    public class Statistics implements Serializable {
-        private long minimum = 0;
-        private long maximum = 0;
-        private long last = 0;
-        private long total = 0;
-        private int count = 0;
-        private boolean minimumInitialized = false;
-
-        public long getMinimum() { return minimum; }
-        public long getMaximum() { return maximum; }
-        public long getLast() { return last; }
-        public float getAverage() { return ( (float)total / (float)count ); }
-        public long getTotal() { return total; }
-        public int getCount() { return count; }
-        public void add( long duration ) {
-            ++count;
-            total += duration;
-            last = duration;
-            if ( duration > maximum ) {
-                maximum = duration;
-            }
-            else if ( !minimumInitialized || duration < minimum ) {
-                minimum = duration;
-                minimumInitialized = true;
-            }
-        }
-        public void reset() {
-            minimum = 0;
-            maximum = 0;
-            last = 0;
-            total = 0;
-            count = 0;
-            minimumInitialized = false;
-        }
-    }
-    
-    /**
-     * Logs a message containing a time increment in milliseconds and a messages describing the operation or context that
-     * the time relates to.
-     * @param message
-     * @param time
-     * @since 4.3
-     */
-    public static void logTimedMessage(String message, long time, Logger log) {
-    	log.log(MessageLevel.INFO, getTimeString(time) + message); 
-    }
-    
-    /**
-     * This convience method stops the current stopwatch, logs a message containing the resulting time increment/duration
-     * and restarts the stopwatch. 
-     * @param message
-     * @since 4.3
-     */
-    public void stopLogIncrementAndRestart(String message, Logger log) {
-        stop();
-        logTimedMessage(message, getTotalDuration(), log);
-        // Restart by reset = true
-        start(true);
-    }
-    
-    /**
-     * This convience method stops the current stopwatch, prints a message to System.out containing the resulting time increment/duration
-     * and restarts the stopwatch.
-     * @param message
-     * @since 4.3
-     */
-    public void stopPrintIncrementAndRestart(String message) {
-        stop();
-        System.out.println(message + getTotalDuration());
-        // Restart by reset = true
-        start(true);
-    }
-    
-    private static String getTimeString(long time) {
-        String timeString = StringUtil.Constants.EMPTY_STRING + time; 
-        int nSpaces = 8 - timeString.length();
-        StringBuffer buff = new StringBuffer();
-        
-        buff.append("Time = ["); //$NON-NLS-1$
-        for(int i=0; i<nSpaces; i++ ) {
-            buff.append(StringUtil.Constants.SPACE);
-        }
-        buff.append(timeString + "] ms : "); //$NON-NLS-1$
-        
-        return buff.toString();
-    }
-}
-

Modified: trunk/common-core/src/main/java/com/metamatrix/core/util/ZipFileUtil.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/core/util/ZipFileUtil.java	2009-05-07 17:05:29 UTC (rev 876)
+++ trunk/common-core/src/main/java/com/metamatrix/core/util/ZipFileUtil.java	2009-05-07 17:11:01 UTC (rev 877)
@@ -39,6 +39,8 @@
 import java.util.List;
 import java.util.jar.JarFile;
 import java.util.jar.Manifest;
+import java.util.logging.Level;
+import java.util.logging.Logger;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 import java.util.zip.ZipEntry;
@@ -313,8 +315,8 @@
         } finally {
             cleanup(out);
             cleanup(fos);
-            if (tmpFile != null && tmpFile.exists()) {
-                System.out.println(tmpFile.delete());
+            if (tmpFile != null && tmpFile.exists() && !tmpFile.delete()) {
+            	Logger.getLogger("org.teiid.common-core").log(Level.INFO, "Could not delete temp file " + tmpFile.getAbsolutePath()); //$NON-NLS-1$ //$NON-NLS-2$
             }
         }
     }

Modified: trunk/common-core/src/test/java/com/metamatrix/core/id/TestUUIDFactoryWithoutCreation.java
===================================================================
--- trunk/common-core/src/test/java/com/metamatrix/core/id/TestUUIDFactoryWithoutCreation.java	2009-05-07 17:05:29 UTC (rev 876)
+++ trunk/common-core/src/test/java/com/metamatrix/core/id/TestUUIDFactoryWithoutCreation.java	2009-05-07 17:11:01 UTC (rev 877)
@@ -24,8 +24,6 @@
 
 import junit.framework.TestCase;
 
-import com.metamatrix.core.util.Stopwatch;
-
 /**
  * TestUUIDFactoryWithoutCreation
  */
@@ -61,9 +59,7 @@
     // =========================================================================
 
     public void testFactoryCreationTimeWithMultipleParses() {
-        final Stopwatch sw = new Stopwatch();
-        sw.start();
-
+    	long start = System.currentTimeMillis();
         // Create the factory ...
         final UUIDFactory myFactory = new UUIDFactory();
 
@@ -73,11 +69,7 @@
         helpTestStringToObject(myFactory,STRINGIFIED_ID_3);
         helpTestStringToObject(myFactory,STRINGIFIED_ID_4);
 
-        sw.stop();
-        if ( sw.getTotalDuration() > 500 ) {
-            fail("Startup and one stringToObject took longer " + sw + //$NON-NLS-1$
-                              " (test fails if above 500ms)"); //$NON-NLS-1$
-        }
+        assertTrue(System.currentTimeMillis() - start < 500 );
     }
 
 }

Modified: trunk/common-internal/src/main/java/com/metamatrix/common/log/LogManager.java
===================================================================
--- trunk/common-internal/src/main/java/com/metamatrix/common/log/LogManager.java	2009-05-07 17:05:29 UTC (rev 876)
+++ trunk/common-internal/src/main/java/com/metamatrix/common/log/LogManager.java	2009-05-07 17:11:01 UTC (rev 877)
@@ -35,7 +35,7 @@
 import com.metamatrix.core.log.LogListener;
 import com.metamatrix.core.log.LogMessage;
 import com.metamatrix.core.log.MessageLevel;
-import com.metamatrix.core.log.NullLogWriter;
+import com.metamatrix.core.log.JavaLogWriter;
 
 
 /**
@@ -90,10 +90,10 @@
 public final class LogManager {
 
     @Inject
-    static LogConfiguration configuration = new BasicLogConfiguration(); // either injected or manually set using the set methods
+    static LogConfiguration configuration = new BasicLogConfiguration(MessageLevel.WARNING); // either injected or manually set using the set methods
     
     @Inject
-    static LogListener logListener = new NullLogWriter(); // either injected or manually set using the set methods
+    static LogListener logListener = new JavaLogWriter(); // either injected or manually set using the set methods
 
 
     /**
@@ -341,7 +341,7 @@
     		logListener = listener;
     	}
     	else {
-    		logListener = new NullLogWriter();
+    		logListener = new JavaLogWriter();
     	}
     }
     	

Modified: trunk/common-internal/src/main/java/com/metamatrix/common/object/MultiplicityPool.java
===================================================================
--- trunk/common-internal/src/main/java/com/metamatrix/common/object/MultiplicityPool.java	2009-05-07 17:05:29 UTC (rev 876)
+++ trunk/common-internal/src/main/java/com/metamatrix/common/object/MultiplicityPool.java	2009-05-07 17:11:01 UTC (rev 877)
@@ -61,11 +61,6 @@
         if ( result == null ) {
             result = Multiplicity.getInstance(multiplicityValue,isOrdered,isUnique);
             INSTANCES.put(key,result);
-//            System.out.println("Adding Multiplicity: \"" + result + "\"");
-//            LogManager.logInfo("MultiplicityPool","Adding Multiplicity: \"" + result + "\"");
-//        } else {
-//            System.out.println("Found Multiplicity: \"" + result + "\"");
-//            LogManager.logInfo("MultiplicityPool","Found Multiplicity : \"" + result + "\"");
         }
         return result;
     }

Modified: trunk/connector-sdk/src/main/java/com/metamatrix/common/classloader/ClassLoaderUtil.java
===================================================================
--- trunk/connector-sdk/src/main/java/com/metamatrix/common/classloader/ClassLoaderUtil.java	2009-05-07 17:05:29 UTC (rev 876)
+++ trunk/connector-sdk/src/main/java/com/metamatrix/common/classloader/ClassLoaderUtil.java	2009-05-07 17:11:01 UTC (rev 877)
@@ -105,11 +105,11 @@
             }
             return result;
         } catch (ClassNotFoundException e) {
-            throw new NestedException(e);
+            throw new RuntimeException(e);
         } catch (InstantiationException e) {
-            throw new NestedException(e);
+            throw new RuntimeException(e);
         } catch (IllegalAccessException e) {
-            throw new NestedException(e);
+            throw new RuntimeException(e);
         }
     }
 
@@ -131,7 +131,7 @@
             try {
                 urls.add( new File(path).toURL() );
             } catch (MalformedURLException e) {
-                throw new NestedException(e);
+                throw new RuntimeException(e);
             }
         }
         return (URL[]) urls.toArray( new URL[] {} );
@@ -159,7 +159,7 @@
                 }
             }
         } catch (IOException e) {
-            throw new NestedException(e);
+            throw new RuntimeException(e);
         }
     }
     
@@ -182,13 +182,13 @@
                 stream.println(location + "\t" + clazz.getName()); //$NON-NLS-1$
             }
         } catch (SecurityException e) {
-            throw new NestedException(e);
+            throw new RuntimeException(e);
         } catch (IllegalArgumentException e) {
-            throw new NestedException(e);
+            throw new RuntimeException(e);
         } catch (NoSuchFieldException e) {
-            throw new NestedException(e);
+            throw new RuntimeException(e);
         } catch (IllegalAccessException e) {
-            throw new NestedException(e);
+            throw new RuntimeException(e);
         }
     }
     

Deleted: trunk/connector-sdk/src/main/java/com/metamatrix/common/classloader/NestedException.java
===================================================================
--- trunk/connector-sdk/src/main/java/com/metamatrix/common/classloader/NestedException.java	2009-05-07 17:05:29 UTC (rev 876)
+++ trunk/connector-sdk/src/main/java/com/metamatrix/common/classloader/NestedException.java	2009-05-07 17:11:01 UTC (rev 877)
@@ -1,81 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership.  Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package com.metamatrix.common.classloader;
-
-import java.io.PrintStream;
-import java.io.PrintWriter;
-
-/**
- * Wraps exceptions in a RuntimeException.
- * This class is here so the class loading driver package will not have any dependencies on other MetaMatrix packages.
- */
-public class NestedException extends RuntimeException {
-    private static final String CAUSED_BY = "Caused by: "; //$NON-NLS-1$
-    private Exception cause;
-    
-    public NestedException(Exception exception) {
-        this.cause = exception;
-    }
-
-    /* 
-     * @see java.lang.Throwable#getMessage()
-     */
-    public String getMessage() {
-        return super.getMessage() + " - " + cause.getMessage(); //$NON-NLS-1$
-    }
-
-    private void printCausedBy(PrintStream s) {
-        s.print(CAUSED_BY);
-    }
-    
-    private void printCausedBy(PrintWriter s) {
-        s.print(CAUSED_BY);
-    }
-    
-    /* 
-     * @see java.lang.Throwable#printStackTrace()
-     */
-    public void printStackTrace() {
-        super.printStackTrace();
-        printCausedBy(System.out);
-        cause.printStackTrace();
-    }
-
-    /* 
-     * @see java.lang.Throwable#printStackTrace(java.io.PrintStream)
-     */
-    public void printStackTrace(PrintStream s) {
-        super.printStackTrace(s);
-        printCausedBy(s);
-        cause.printStackTrace(s);
-    }
-
-    /* 
-     * @see java.lang.Throwable#printStackTrace(java.io.PrintWriter)
-     */
-    public void printStackTrace(PrintWriter s) {
-        super.printStackTrace(s);
-        printCausedBy(s);
-        cause.printStackTrace(s);
-    }
-}

Modified: trunk/embedded/src/main/java/com/metamatrix/dqp/embedded/configuration/VDBConfigurationReader.java
===================================================================
--- trunk/embedded/src/main/java/com/metamatrix/dqp/embedded/configuration/VDBConfigurationReader.java	2009-05-07 17:05:29 UTC (rev 876)
+++ trunk/embedded/src/main/java/com/metamatrix/dqp/embedded/configuration/VDBConfigurationReader.java	2009-05-07 17:11:01 UTC (rev 877)
@@ -151,8 +151,7 @@
                 }
                 return vdb;
             } catch (Exception e) {
-                DQPEmbeddedPlugin.logWarning(e, "VDBReader.Archive_not_Found", new Object[] {vdbURL}); //$NON-NLS-1$
-                throw new MetaMatrixComponentException(e);
+                throw new MetaMatrixComponentException(e, DQPEmbeddedPlugin.Util.getString("VDBReader.Archive_not_Found", vdbURL)); //$NON-NLS-1$
             }
         }
         throw new MetaMatrixComponentException(DQPEmbeddedPlugin.Util.getString("VDBReader.Invalid_location", vdbURL)); //$NON-NLS-1$        

Modified: trunk/embedded/src/main/java/com/metamatrix/jdbc/LogConfigurationProvider.java
===================================================================
--- trunk/embedded/src/main/java/com/metamatrix/jdbc/LogConfigurationProvider.java	2009-05-07 17:05:29 UTC (rev 876)
+++ trunk/embedded/src/main/java/com/metamatrix/jdbc/LogConfigurationProvider.java	2009-05-07 17:11:01 UTC (rev 877)
@@ -28,6 +28,7 @@
 import com.metamatrix.common.log.LogConfiguration;
 import com.metamatrix.common.log.config.BasicLogConfiguration;
 import com.metamatrix.core.MetaMatrixRuntimeException;
+import com.metamatrix.core.log.MessageLevel;
 import com.metamatrix.dqp.embedded.DQPEmbeddedPlugin;
 import com.metamatrix.dqp.embedded.DQPEmbeddedProperties;
 
@@ -40,7 +41,7 @@
 	@Override
 	public LogConfiguration get() {
         String logLevel = configSource.getProperties().getProperty(DQPEmbeddedProperties.DQP_LOGLEVEL);
-        int level = 0;
+        int level = MessageLevel.WARNING;
         if(logLevel != null && logLevel.trim().length() > 0) {
             try {
                 level = Integer.parseInt(logLevel);                        

Modified: trunk/embedded/src/main/java/com/metamatrix/jdbc/LogListernerProvider.java
===================================================================
--- trunk/embedded/src/main/java/com/metamatrix/jdbc/LogListernerProvider.java	2009-05-07 17:05:29 UTC (rev 876)
+++ trunk/embedded/src/main/java/com/metamatrix/jdbc/LogListernerProvider.java	2009-05-07 17:11:01 UTC (rev 877)
@@ -33,16 +33,13 @@
 import com.metamatrix.common.protocol.URLHelper;
 import com.metamatrix.core.MetaMatrixRuntimeException;
 import com.metamatrix.core.log.FileLimitSizeLogWriter;
+import com.metamatrix.core.log.JavaLogWriter;
 import com.metamatrix.core.log.LogListener;
-import com.metamatrix.core.log.NullLogWriter;
-import com.metamatrix.core.log.SystemLogWriter;
 import com.metamatrix.dqp.embedded.DQPEmbeddedProperties;
 import com.metamatrix.internal.core.log.PlatformLog;
 
 @Singleton
 class LogListernerProvider implements Provider<LogListener> {
-	private static final String STDOUT = "STDOUT"; //$NON-NLS-1$
-	
 	@Inject
 	DQPConfigSource configSource;
 	
@@ -57,30 +54,21 @@
         	String dqpURLString = dqpURL.toString(); 
         	dqpURL = URLHelper.buildURL(dqpURLString);
         	if (logFile != null) {
-	            if (logFile.equalsIgnoreCase(STDOUT)) {
-                    PlatformLog log = new PlatformLog();
-                    log.addListener(new SystemLogWriter());
-                    return log;
-	            }
-	            else {
-	                String modifiedLogFileName = logFile;                    
-	                int dotIndex = logFile.lastIndexOf('.');
-	                if (dotIndex != -1) {
-	                    modifiedLogFileName = logFile.substring(0,dotIndex)+"_"+instanceId+"."+logFile.substring(dotIndex+1); //$NON-NLS-1$ //$NON-NLS-2$
-	                }
-	                else {
-	                    modifiedLogFileName = logFile+"_"+instanceId; //$NON-NLS-1$
-	                }
-	                URL logURL = URLHelper.buildURL(dqpURL, modifiedLogFileName);
-                    File file = new File(logURL.getPath());
-                    PlatformLog log = new PlatformLog();
-                    log.addListener(new FileLimitSizeLogWriter(file, false));
-                    return log;
-	            }
+                String modifiedLogFileName = logFile;                    
+                int dotIndex = logFile.lastIndexOf('.');
+                if (dotIndex != -1) {
+                    modifiedLogFileName = logFile.substring(0,dotIndex)+"_"+instanceId+"."+logFile.substring(dotIndex+1); //$NON-NLS-1$ //$NON-NLS-2$
+                }
+                else {
+                    modifiedLogFileName = logFile+"_"+instanceId; //$NON-NLS-1$
+                }
+                URL logURL = URLHelper.buildURL(dqpURL, modifiedLogFileName);
+                File file = new File(logURL.getPath());
+                PlatformLog log = new PlatformLog();
+                log.addListener(new FileLimitSizeLogWriter(file, false));
+                return log;
         	}
-        	else {
-        		return new NullLogWriter();
-        	}
+    		return new JavaLogWriter();
         } catch (MalformedURLException e) {
         	throw new MetaMatrixRuntimeException(e);
         }

Modified: trunk/engine/src/main/java/com/metamatrix/dqp/spi/basic/FileCommandLogger.java
===================================================================
--- trunk/engine/src/main/java/com/metamatrix/dqp/spi/basic/FileCommandLogger.java	2009-05-07 17:05:29 UTC (rev 876)
+++ trunk/engine/src/main/java/com/metamatrix/dqp/spi/basic/FileCommandLogger.java	2009-05-07 17:11:01 UTC (rev 877)
@@ -71,15 +71,14 @@
     public void initialize(Properties props) {
         this.filename = props.getProperty(LOG_FILE_NAME_PROPERTY);
         if (this.filename == null) {
-            System.out.println("FileCommandLogger could not find log filename property"); //$NON-NLS-1$
-        } else {
-            boolean append = true;
-            try {
-                this.logWriter = new BufferedWriter( new FileWriter(this.filename, append));
-            } catch (IOException e) {
-                System.out.println("FileCommandLogger could not write to log file " + this.filename + ": " + e.getMessage()); //$NON-NLS-1$ //$NON-NLS-2$
-            }
+            throw new RuntimeException("FileCommandLogger could not find log filename property"); //$NON-NLS-1$
         }
+        boolean append = true;
+        try {
+            this.logWriter = new BufferedWriter( new FileWriter(this.filename, append));
+        } catch (IOException e) {
+            throw new RuntimeException("FileCommandLogger could not write to log file " + this.filename, e); //$NON-NLS-1$
+        }
     }
     
     /** 
@@ -101,7 +100,7 @@
             this.logWriter.newLine();
             this.logWriter.flush();
         } catch (IOException e) {
-            System.out.println("FileCommandLogger could not write to log file " + this.filename + ": " + e.getMessage()); //$NON-NLS-1$ //$NON-NLS-2$
+            throw new RuntimeException("FileCommandLogger could not write to log file " + this.filename, e); //$NON-NLS-1$
         } 
     }
     

Modified: trunk/server/src/main/java/com/metamatrix/common/extensionmodule/spi/jdbc/JDBCExtensionModuleUtil.java
===================================================================
--- trunk/server/src/main/java/com/metamatrix/common/extensionmodule/spi/jdbc/JDBCExtensionModuleUtil.java	2009-05-07 17:05:29 UTC (rev 876)
+++ trunk/server/src/main/java/com/metamatrix/common/extensionmodule/spi/jdbc/JDBCExtensionModuleUtil.java	2009-05-07 17:11:01 UTC (rev 877)
@@ -93,7 +93,6 @@
             byte[] data = JDBCExtensionModuleReader.getSource(sourceName, connection);
 
             if (data == null) {
-                System.out.println(CommonPlugin.Util.getString(ErrorMessageKeys.EXTENSION_0068, sourceName));
                 throw new ExtensionModuleNotFoundException(ErrorMessageKeys.EXTENSION_0069, CommonPlugin.Util.getString(ErrorMessageKeys.EXTENSION_0069, sourceName));
 
             }

Modified: trunk/server/src/main/java/com/metamatrix/platform/security/audit/destination/SingleFileAuditDestination.java
===================================================================
--- trunk/server/src/main/java/com/metamatrix/platform/security/audit/destination/SingleFileAuditDestination.java	2009-05-07 17:05:29 UTC (rev 876)
+++ trunk/server/src/main/java/com/metamatrix/platform/security/audit/destination/SingleFileAuditDestination.java	2009-05-07 17:11:01 UTC (rev 877)
@@ -154,7 +154,6 @@
     	    fileWriter.flush();
     	} catch(IOException e) {
             LogManager.logError(LogSecurityConstants.CTX_AUDIT, e, PlatformPlugin.Util.getString(ErrorMessageKeys.SEC_AUDIT_0024, e.getMessage()));
-    	    System.out.println(this.getFormat().formatMessage(message));
     	}
 	}
 

Modified: trunk/server/src/main/java/com/metamatrix/platform/vm/api/controller/ProcessManagement.java
===================================================================
--- trunk/server/src/main/java/com/metamatrix/platform/vm/api/controller/ProcessManagement.java	2009-05-07 17:05:29 UTC (rev 876)
+++ trunk/server/src/main/java/com/metamatrix/platform/vm/api/controller/ProcessManagement.java	2009-05-07 17:11:01 UTC (rev 877)
@@ -107,7 +107,7 @@
     /**
      * dumps stack trace to log file.
      */
-    void dumpThreads();
+    String dumpThreads();
 
     /**
      * Export the server logs to a byte[].  The bytes contain the contents of a .zip file containing the logs. 

Modified: trunk/server/src/main/java/com/metamatrix/platform/vm/controller/ProcessController.java
===================================================================
--- trunk/server/src/main/java/com/metamatrix/platform/vm/controller/ProcessController.java	2009-05-07 17:05:29 UTC (rev 876)
+++ trunk/server/src/main/java/com/metamatrix/platform/vm/controller/ProcessController.java	2009-05-07 17:11:01 UTC (rev 877)
@@ -544,25 +544,27 @@
      * Prints thread information to a log file.
      * Does not include the stacktrace - that is not available in 1.4.
      */
-    public void dumpThreads() {
+    public String dumpThreads() {
 
         ThreadGroup root, tg;
         root = Thread.currentThread().getThreadGroup();
         while ((tg = root.getParent()) != null) {
             root = tg;
         }
-        listThreads(root, 0);
+        StringBuffer sb = new StringBuffer();
+        listThreads(root, 0, sb);
+        return sb.toString();
     }
 
     /**
      * Print information about the specified thread group.
      */
-    private void listThreads(ThreadGroup tg, int indent) {
+    private void listThreads(ThreadGroup tg, int indent, StringBuffer sb) {
 
         for (int i = 0; i < indent; i++) {
-            System.out.print("    "); //$NON-NLS-1$
+            sb.append("    "); //$NON-NLS-1$
         }
-        System.out.println(tg);
+        sb.append(tg).append("\n"); //$NON-NLS-1$
         indent++;
 
         //Recursively print information threads in this group
@@ -572,9 +574,9 @@
         for (int i = 0; i < cnt; i++) {
             if (threads[i] != null) {
                 for (int j = 0; j < indent; j++) {
-                    System.out.print("    "); //$NON-NLS-1$
+                	sb.append("    "); //$NON-NLS-1$
                 }
-                System.out.println(threads[i]);
+                sb.append(threads[i]).append("\n"); //$NON-NLS-1$
             }
         }
 
@@ -583,7 +585,7 @@
         ThreadGroup[] groups = new ThreadGroup[cnt];
         tg.enumerate(groups);
         for (int i = 0; i < cnt; i++) {
-            listThreads(groups[i], indent);
+            listThreads(groups[i], indent, sb);
         }
     }
 

Modified: trunk/server/src/main/java/com/metamatrix/server/ServiceManager.java
===================================================================
--- trunk/server/src/main/java/com/metamatrix/server/ServiceManager.java	2009-05-07 17:05:29 UTC (rev 876)
+++ trunk/server/src/main/java/com/metamatrix/server/ServiceManager.java	2009-05-07 17:11:01 UTC (rev 877)
@@ -709,7 +709,7 @@
         if (vm != null) {
             try {
                 System.out.println(PlatformPlugin.Util.getString(LogMessageKeys.SERVICE_0023));
-                vm.dumpThreads();
+                System.out.println(vm.dumpThreads());
                 System.out.println(PlatformPlugin.Util.getString(LogMessageKeys.SERVICE_0024, processName));
             } catch (Exception e) {
                 System.out.println(PlatformPlugin.Util.getString(ErrorMessageKeys.SERVICE_0031, processName));

Modified: trunk/server/src/main/java/com/metamatrix/server/admin/apiimpl/RuntimeMetadataHelper.java
===================================================================
--- trunk/server/src/main/java/com/metamatrix/server/admin/apiimpl/RuntimeMetadataHelper.java	2009-05-07 17:05:29 UTC (rev 876)
+++ trunk/server/src/main/java/com/metamatrix/server/admin/apiimpl/RuntimeMetadataHelper.java	2009-05-07 17:11:01 UTC (rev 877)
@@ -24,7 +24,6 @@
 
 import java.io.ByteArrayOutputStream;
 import java.io.IOException;
-import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Collections;
 import java.util.HashMap;
@@ -420,27 +419,6 @@
         }
         return permissionNode;
     }
-
-
-    public static void printTree(Map tree) {
-        List keys = new ArrayList(tree.keySet());
-        Collections.sort(keys);
-        Iterator itr = keys.iterator();
-        int i = 0;
-        while (itr.hasNext()) {
-            PermissionDataNodeImpl parent = (PermissionDataNodeImpl) itr.next();
-            System.out.println("\n (" + (++i) + ")  Parent: <" + parent + ">"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-            Iterator children = ((List) tree.get(parent)).iterator();
-            if (!children.hasNext()) {
-                System.out.println("        No Children - LEAF"); //$NON-NLS-1$
-                continue;
-            }
-            while (children.hasNext()) {
-                PermissionDataNodeImpl child = (PermissionDataNodeImpl) children.next();
-                System.out.println("        Child: " + child); //$NON-NLS-1$
-            }
-        }
-    }
     
     public static VirtualDatabaseID getVDBID(String vdbName, String vdbVersion) 
     throws MetaMatrixComponentException {




More information about the teiid-commits mailing list