Author: fmeschbe
Date: Thu May 22 04:21:03 2008
New Revision: 659078

URL: http://svn.apache.org/viewvc?rev=659078&view=rev
Log:
Code formatting and import list cleanup

Modified:
    
incubator/sling/trunk/commons/log/src/main/java/org/apache/sling/commons/log/Activator.java
    
incubator/sling/trunk/commons/log/src/main/java/org/apache/sling/commons/log/LogManager.java
    
incubator/sling/trunk/commons/log/src/main/java/org/apache/sling/commons/log/LogReaderServiceFactory.java
    
incubator/sling/trunk/commons/log/src/main/java/org/apache/sling/commons/log/LogServiceFactory.java
    
incubator/sling/trunk/commons/log/src/main/java/org/apache/sling/commons/log/slf4j/SlingLogFileWriter.java
    
incubator/sling/trunk/commons/log/src/main/java/org/apache/sling/commons/log/slf4j/SlingLogWriter.java
    
incubator/sling/trunk/commons/log/src/main/java/org/apache/sling/commons/log/slf4j/SlingLoggerFactory.java
    
incubator/sling/trunk/commons/log/src/test/java/org/apache/sling/commons/log/slf4j/SlingLogFileWriterTest.java
    
incubator/sling/trunk/commons/log/src/test/java/org/apache/sling/commons/log/slf4j/SlingLoggerTest.java

Modified: 
incubator/sling/trunk/commons/log/src/main/java/org/apache/sling/commons/log/Activator.java
URL: 
http://svn.apache.org/viewvc/incubator/sling/trunk/commons/log/src/main/java/org/apache/sling/commons/log/Activator.java?rev=659078&r1=659077&r2=659078&view=diff
==============================================================================
--- 
incubator/sling/trunk/commons/log/src/main/java/org/apache/sling/commons/log/Activator.java
 (original)
+++ 
incubator/sling/trunk/commons/log/src/main/java/org/apache/sling/commons/log/Activator.java
 Thu May 22 04:21:03 2008
@@ -28,8 +28,8 @@
 /**
  * The <code>Activator</code> class is the <code>BundleActivator</code> for
  * the log service bundle. This activator sets up logging in NLog4J and
- * registers the <code>LogService</code> and <code>LogReaderService</code>. 
When
- * the bundle is stopped, the NLog4J subsystem is simply shutdown.
+ * registers the <code>LogService</code> and <code>LogReaderService</code>.
+ * When the bundle is stopped, the NLog4J subsystem is simply shutdown.
  */
 public class Activator implements BundleActivator {
 
@@ -67,7 +67,7 @@
             logSupport.shutdown();
             logSupport = null;
         }
-        
+
         if (logManager != null) {
             logManager.shutdown();
             logManager = null;

Modified: 
incubator/sling/trunk/commons/log/src/main/java/org/apache/sling/commons/log/LogManager.java
URL: 
http://svn.apache.org/viewvc/incubator/sling/trunk/commons/log/src/main/java/org/apache/sling/commons/log/LogManager.java?rev=659078&r1=659077&r2=659078&view=diff
==============================================================================
--- 
incubator/sling/trunk/commons/log/src/main/java/org/apache/sling/commons/log/LogManager.java
 (original)
+++ 
incubator/sling/trunk/commons/log/src/main/java/org/apache/sling/commons/log/LogManager.java
 Thu May 22 04:21:03 2008
@@ -37,17 +37,17 @@
 import org.slf4j.LoggerFactory;
 
 /**
- * The <code>LogManager</code> manages the loggers used by the LogService
- * and the rest of the system.
+ * The <code>LogManager</code> manages the loggers used by the LogService and
+ * the rest of the system.
  */
 public class LogManager implements ManagedService {
 
     /**
      * Initial configuration property specifying whether logging should be
-     * initialized here or not (value is 
"org.apache.sling.commons.log.intialize").
-     * If this property is missing or set to <code>true</code>, this class
-     * will reset and configure logging. Otherwise, logging is neither reset 
nor
-     * configured by this class.
+     * initialized here or not (value is
+     * "org.apache.sling.commons.log.intialize"). If this property is missing 
or
+     * set to <code>true</code>, this class will reset and configure logging.
+     * Otherwise, logging is neither reset nor configured by this class.
      */
     public static final String LOG_INITIALIZE = 
"org.apache.sling.commons.log.intialize";
 
@@ -121,7 +121,7 @@
 
     /*
      * (non-Javadoc)
-     *
+     * 
      * @see org.osgi.service.cm.ManagedService#updated(java.util.Dictionary)
      */
     @SuppressWarnings("unchecked")
@@ -210,7 +210,7 @@
      * initial configuration. <p/> Sets up the initial logging properties for
      * the logging support until the real logging configuration file can be 
read
      * from the ContentBus.
-     *
+     * 
      * @param properties The <code>Properties</code> containing the initial
      *            configuration.
      * @throws NullPointerException if <code>properties</code> is

Modified: 
incubator/sling/trunk/commons/log/src/main/java/org/apache/sling/commons/log/LogReaderServiceFactory.java
URL: 
http://svn.apache.org/viewvc/incubator/sling/trunk/commons/log/src/main/java/org/apache/sling/commons/log/LogReaderServiceFactory.java?rev=659078&r1=659077&r2=659078&view=diff
==============================================================================
--- 
incubator/sling/trunk/commons/log/src/main/java/org/apache/sling/commons/log/LogReaderServiceFactory.java
 (original)
+++ 
incubator/sling/trunk/commons/log/src/main/java/org/apache/sling/commons/log/LogReaderServiceFactory.java
 Thu May 22 04:21:03 2008
@@ -68,7 +68,8 @@
         // -----------------------------------
 
         public void addLogListener(LogListener listener) {
-            
LogReaderServiceFactory.this.logSupport.addLogListener(this.bundle, listener);
+            LogReaderServiceFactory.this.logSupport.addLogListener(this.bundle,
+                listener);
         }
 
         public void removeLogListener(LogListener listener) {

Modified: 
incubator/sling/trunk/commons/log/src/main/java/org/apache/sling/commons/log/LogServiceFactory.java
URL: 
http://svn.apache.org/viewvc/incubator/sling/trunk/commons/log/src/main/java/org/apache/sling/commons/log/LogServiceFactory.java?rev=659078&r1=659077&r2=659078&view=diff
==============================================================================
--- 
incubator/sling/trunk/commons/log/src/main/java/org/apache/sling/commons/log/LogServiceFactory.java
 (original)
+++ 
incubator/sling/trunk/commons/log/src/main/java/org/apache/sling/commons/log/LogServiceFactory.java
 Thu May 22 04:21:03 2008
@@ -35,7 +35,7 @@
     /**
      * Initializes the logging system with settings from some startup 
properties
      * before the real configuration is read after ContentBus bootstrap.
-     *
+     * 
      * @param properties The startup properties to initialize the logging 
system
      *            with.
      */
@@ -63,7 +63,7 @@
          * Initializes the logging system with settings from some startup
          * properties before the real configuration is read after ContentBus
          * bootstrap.
-         *
+         * 
          * @param properties The startup properties to initialize the logging
          *            system with.
          */

Modified: 
incubator/sling/trunk/commons/log/src/main/java/org/apache/sling/commons/log/slf4j/SlingLogFileWriter.java
URL: 
http://svn.apache.org/viewvc/incubator/sling/trunk/commons/log/src/main/java/org/apache/sling/commons/log/slf4j/SlingLogFileWriter.java?rev=659078&r1=659077&r2=659078&view=diff
==============================================================================
--- 
incubator/sling/trunk/commons/log/src/main/java/org/apache/sling/commons/log/slf4j/SlingLogFileWriter.java
 (original)
+++ 
incubator/sling/trunk/commons/log/src/main/java/org/apache/sling/commons/log/slf4j/SlingLogFileWriter.java
 Thu May 22 04:21:03 2008
@@ -27,7 +27,9 @@
 public class SlingLogFileWriter extends SlingLogWriter {
 
     private static final long FACTOR_KB = 1024;
+
     private static final long FACTOR_MB = 1024 * FACTOR_KB;
+
     private static final long FACTOR_GB = 1024 * FACTOR_MB;
 
     private final File file;
@@ -38,11 +40,13 @@
 
     private final int maxNum;
 
-    public SlingLogFileWriter(String logFileName, int fileNum, String 
fileSize) throws IOException {
+    public SlingLogFileWriter(String logFileName, int fileNum, String fileSize)
+            throws IOException {
         this(logFileName, fileNum, convertMaxSizeSpec(fileSize));
     }
 
-    public SlingLogFileWriter(String logFileName, int fileNum, long fileSize) 
throws IOException {
+    public SlingLogFileWriter(String logFileName, int fileNum, long fileSize)
+            throws IOException {
 
         // make sure the file is absolute and derive the path from there
         File file = new File(logFileName);

Modified: 
incubator/sling/trunk/commons/log/src/main/java/org/apache/sling/commons/log/slf4j/SlingLogWriter.java
URL: 
http://svn.apache.org/viewvc/incubator/sling/trunk/commons/log/src/main/java/org/apache/sling/commons/log/slf4j/SlingLogWriter.java?rev=659078&r1=659077&r2=659078&view=diff
==============================================================================
--- 
incubator/sling/trunk/commons/log/src/main/java/org/apache/sling/commons/log/slf4j/SlingLogWriter.java
 (original)
+++ 
incubator/sling/trunk/commons/log/src/main/java/org/apache/sling/commons/log/slf4j/SlingLogWriter.java
 Thu May 22 04:21:03 2008
@@ -58,7 +58,7 @@
         synchronized (lock) {
             if (delegatee != null) {
                 flush();
-                
+
                 delegatee.close();
                 delegatee = null;
             }

Modified: 
incubator/sling/trunk/commons/log/src/main/java/org/apache/sling/commons/log/slf4j/SlingLoggerFactory.java
URL: 
http://svn.apache.org/viewvc/incubator/sling/trunk/commons/log/src/main/java/org/apache/sling/commons/log/slf4j/SlingLoggerFactory.java?rev=659078&r1=659077&r2=659078&view=diff
==============================================================================
--- 
incubator/sling/trunk/commons/log/src/main/java/org/apache/sling/commons/log/slf4j/SlingLoggerFactory.java
 (original)
+++ 
incubator/sling/trunk/commons/log/src/main/java/org/apache/sling/commons/log/slf4j/SlingLoggerFactory.java
 Thu May 22 04:21:03 2008
@@ -63,9 +63,9 @@
     }
 
     /**
-     * Logs a message an optional stack trace to error output. This method
-     * is used by the logging system in case of errors writing to the
-     * correct logging output.
+     * Logs a message an optional stack trace to error output. This method is
+     * used by the logging system in case of errors writing to the correct
+     * logging output.
      */
     public static void internalFailure(String message, Throwable t) {
         System.err.println(message);
@@ -84,7 +84,7 @@
      * Returns a logger for the given name. If such a logger already exists the
      * same logger is returned. Otherwise a new instance is created and
      * configured with the current logging level, output and message format.
-     *
+     * 
      * @param name The name of the logger to return
      */
     public Logger getLogger(String name) {
@@ -103,7 +103,7 @@
     /**
      * Configures this factory and all existing loggers with the new log level,
      * output and message format.
-     *
+     * 
      * @param logLevel The log level to be set. If this is not a valid
      *            [EMAIL PROTECTED] SlingLoggerLevel} value, the default 
<code>INFO</code>
      *            is assumed.

Modified: 
incubator/sling/trunk/commons/log/src/test/java/org/apache/sling/commons/log/slf4j/SlingLogFileWriterTest.java
URL: 
http://svn.apache.org/viewvc/incubator/sling/trunk/commons/log/src/test/java/org/apache/sling/commons/log/slf4j/SlingLogFileWriterTest.java?rev=659078&r1=659077&r2=659078&view=diff
==============================================================================
--- 
incubator/sling/trunk/commons/log/src/test/java/org/apache/sling/commons/log/slf4j/SlingLogFileWriterTest.java
 (original)
+++ 
incubator/sling/trunk/commons/log/src/test/java/org/apache/sling/commons/log/slf4j/SlingLogFileWriterTest.java
 Thu May 22 04:21:03 2008
@@ -21,44 +21,43 @@
 import java.io.File;
 import java.io.IOException;
 
-import org.apache.sling.commons.log.slf4j.SlingLogFileWriter;
-
 import junit.framework.TestCase;
 
 public class SlingLogFileWriterTest extends TestCase {
     private static int counter;
-    
+
     @Override
     protected void setUp() throws Exception {
         super.setUp();
     }
-    
+
     protected String getBase() {
-        final File baseFile = new File("target/" + getClass().getSimpleName() 
+ "/"
-                + (counter++) + "-" + System.currentTimeMillis() + "/" + 
getClass().getSimpleName());
+        final File baseFile = new File("target/" + getClass().getSimpleName()
+            + "/" + (counter++) + "-" + System.currentTimeMillis() + "/"
+            + getClass().getSimpleName());
         baseFile.getParentFile().mkdirs();
         return baseFile.getAbsolutePath();
     }
-    
+
     @Override
     protected void tearDown() throws Exception {
         super.tearDown();
     }
-    
+
     public void testNoRotateSize() throws IOException {
         final String base = getBase();
         SlingLogFileWriter slfw = new SlingLogFileWriter(base, -1, 10);
-        
+
         // only base file should exist with size 0 (for now)
         File test = new File(base);
         assertTrue(test.exists());
         assertEquals(0, test.length());
-        
+
         File test0 = new File(base + ".0");
         assertFalse(test0.exists());
         File testn1 = new File(base + ".-1");
         assertFalse(testn1.exists());
-        
+
         // write some bytes and ensure size
         slfw.write("012345");
         slfw.writeln();
@@ -66,7 +65,7 @@
         assertTrue(test.length() > 0);
         assertFalse(test0.exists());
         assertFalse(testn1.exists());
-        
+
         // write some more, ensuring rotation does happen
         slfw.write("012345");
         slfw.writeln();
@@ -79,19 +78,19 @@
     public void testRotate0Size() throws IOException {
         final String base = getBase();
         SlingLogFileWriter slfw = new SlingLogFileWriter(base, 0, 10);
-        
+
         // only base file should exist with size 0 (for now)
         File test = new File(base);
         assertTrue(test.exists());
         assertEquals(0, test.length());
-        
+
         File test0 = new File(base + ".0");
         assertFalse(test0.exists());
         File test1 = new File(base + ".1");
         assertFalse(test1.exists());
         File testn1 = new File(base + ".-1");
         assertFalse(testn1.exists());
-        
+
         // write some bytes and ensure size
         slfw.write("012345");
         slfw.writeln();
@@ -99,7 +98,7 @@
         assertTrue(test.length() > 0);
         assertFalse(test0.exists());
         assertFalse(testn1.exists());
-        
+
         // write some more, ensuring rotation does happen
         slfw.write("012345");
         slfw.writeln();
@@ -109,23 +108,23 @@
         assertFalse(test1.exists());
         assertFalse(testn1.exists());
     }
-    
+
     public void testRotate1Size() throws IOException {
         final String base = getBase();
         SlingLogFileWriter slfw = new SlingLogFileWriter(base, 1, 10);
-        
+
         // only base file should exist with size 0 (for now)
         File test = new File(base);
         assertTrue(test.exists());
         assertTrue(test.length() == 0);
-        
+
         File test0 = new File(base + ".0");
         assertFalse(test0.exists());
         File test1 = new File(base + ".1");
         assertFalse(test1.exists());
         File testn1 = new File(base + ".-1");
         assertFalse(testn1.exists());
-        
+
         // write some bytes and ensure size
         slfw.write("012345");
         slfw.writeln();
@@ -133,7 +132,7 @@
         assertTrue(test.length() > 0);
         assertFalse(test0.exists());
         assertFalse(testn1.exists());
-        
+
         // write some more, ensuring rotation does happen
         slfw.write("012345");
         slfw.writeln();
@@ -142,7 +141,7 @@
         assertTrue(test0.exists());
         assertFalse(test1.exists());
         assertFalse(testn1.exists());
-        
+
         // write bytes to rotate in onw fell swoop
         slfw.write("0123456789 - more");
         slfw.writeln();
@@ -152,26 +151,34 @@
         assertTrue(test1.exists());
         assertFalse(testn1.exists());
     }
-    
+
     public void testMaxSizeConversion() {
         assertEquals(1, SlingLogFileWriter.convertMaxSizeSpec("1"));
-        
+
         // kilo
-        assertEquals(1*1024, SlingLogFileWriter.convertMaxSizeSpec("1K"));
-        assertEquals(1*1024, SlingLogFileWriter.convertMaxSizeSpec("1k"));
-        assertEquals(1*1024, SlingLogFileWriter.convertMaxSizeSpec("1KB"));
-        assertEquals(1*1024, SlingLogFileWriter.convertMaxSizeSpec("1kb"));
-        
+        assertEquals(1 * 1024, SlingLogFileWriter.convertMaxSizeSpec("1K"));
+        assertEquals(1 * 1024, SlingLogFileWriter.convertMaxSizeSpec("1k"));
+        assertEquals(1 * 1024, SlingLogFileWriter.convertMaxSizeSpec("1KB"));
+        assertEquals(1 * 1024, SlingLogFileWriter.convertMaxSizeSpec("1kb"));
+
         // mega
-        assertEquals(1*1024*1024, SlingLogFileWriter.convertMaxSizeSpec("1M"));
-        assertEquals(1*1024*1024, SlingLogFileWriter.convertMaxSizeSpec("1m"));
-        assertEquals(1*1024*1024, 
SlingLogFileWriter.convertMaxSizeSpec("1MB"));
-        assertEquals(1*1024*1024, 
SlingLogFileWriter.convertMaxSizeSpec("1mb"));
-        
+        assertEquals(1 * 1024 * 1024,
+            SlingLogFileWriter.convertMaxSizeSpec("1M"));
+        assertEquals(1 * 1024 * 1024,
+            SlingLogFileWriter.convertMaxSizeSpec("1m"));
+        assertEquals(1 * 1024 * 1024,
+            SlingLogFileWriter.convertMaxSizeSpec("1MB"));
+        assertEquals(1 * 1024 * 1024,
+            SlingLogFileWriter.convertMaxSizeSpec("1mb"));
+
         // giga
-        assertEquals(1*1024*1024*1024, 
SlingLogFileWriter.convertMaxSizeSpec("1G"));
-        assertEquals(1*1024*1024*1024, 
SlingLogFileWriter.convertMaxSizeSpec("1g"));
-        assertEquals(1*1024*1024*1024, 
SlingLogFileWriter.convertMaxSizeSpec("1GB"));
-        assertEquals(1*1024*1024*1024, 
SlingLogFileWriter.convertMaxSizeSpec("1gb"));
+        assertEquals(1 * 1024 * 1024 * 1024,
+            SlingLogFileWriter.convertMaxSizeSpec("1G"));
+        assertEquals(1 * 1024 * 1024 * 1024,
+            SlingLogFileWriter.convertMaxSizeSpec("1g"));
+        assertEquals(1 * 1024 * 1024 * 1024,
+            SlingLogFileWriter.convertMaxSizeSpec("1GB"));
+        assertEquals(1 * 1024 * 1024 * 1024,
+            SlingLogFileWriter.convertMaxSizeSpec("1gb"));
     }
 }

Modified: 
incubator/sling/trunk/commons/log/src/test/java/org/apache/sling/commons/log/slf4j/SlingLoggerTest.java
URL: 
http://svn.apache.org/viewvc/incubator/sling/trunk/commons/log/src/test/java/org/apache/sling/commons/log/slf4j/SlingLoggerTest.java?rev=659078&r1=659077&r2=659078&view=diff
==============================================================================
--- 
incubator/sling/trunk/commons/log/src/test/java/org/apache/sling/commons/log/slf4j/SlingLoggerTest.java
 (original)
+++ 
incubator/sling/trunk/commons/log/src/test/java/org/apache/sling/commons/log/slf4j/SlingLoggerTest.java
 Thu May 22 04:21:03 2008
@@ -22,10 +22,6 @@
 import java.io.StringWriter;
 import java.text.MessageFormat;
 
-import org.apache.sling.commons.log.slf4j.SlingLogWriter;
-import org.apache.sling.commons.log.slf4j.SlingLogger;
-import org.apache.sling.commons.log.slf4j.SlingLoggerLevel;
-
 import junit.framework.TestCase;
 
 public class SlingLoggerTest extends TestCase {


Reply via email to