felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rickh...@apache.org
Subject svn commit: r820346 - /felix/trunk/log/src/main/java/org/apache/felix/log/
Date Wed, 30 Sep 2009 17:03:45 GMT
Author: rickhall
Date: Wed Sep 30 17:03:45 2009
New Revision: 820346

URL: http://svn.apache.org/viewvc?rev=820346&view=rev
Log:
Reformat code to recommended style.

Modified:
    felix/trunk/log/src/main/java/org/apache/felix/log/Activator.java
    felix/trunk/log/src/main/java/org/apache/felix/log/Log.java
    felix/trunk/log/src/main/java/org/apache/felix/log/LogEntryImpl.java
    felix/trunk/log/src/main/java/org/apache/felix/log/LogException.java
    felix/trunk/log/src/main/java/org/apache/felix/log/LogListenerThread.java
    felix/trunk/log/src/main/java/org/apache/felix/log/LogNode.java
    felix/trunk/log/src/main/java/org/apache/felix/log/LogNodeEnumeration.java
    felix/trunk/log/src/main/java/org/apache/felix/log/LogReaderServiceFactory.java
    felix/trunk/log/src/main/java/org/apache/felix/log/LogReaderServiceImpl.java
    felix/trunk/log/src/main/java/org/apache/felix/log/LogServiceFactory.java
    felix/trunk/log/src/main/java/org/apache/felix/log/LogServiceImpl.java

Modified: felix/trunk/log/src/main/java/org/apache/felix/log/Activator.java
URL: http://svn.apache.org/viewvc/felix/trunk/log/src/main/java/org/apache/felix/log/Activator.java?rev=820346&r1=820345&r2=820346&view=diff
==============================================================================
--- felix/trunk/log/src/main/java/org/apache/felix/log/Activator.java (original)
+++ felix/trunk/log/src/main/java/org/apache/felix/log/Activator.java Wed Sep 30 17:03:45
2009
@@ -1,4 +1,4 @@
-/* 
+/*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
  * distributed with this work for additional information
@@ -45,19 +45,16 @@
  *       the historic log information. The default value is false.</dd>
  * </dl>
  */
-public final class Activator implements BundleActivator {
+public final class Activator implements BundleActivator
+{
     /** The name of the property that defines the maximum size of the log. */
     private static final String MAX_SIZE_PROPERTY = "org.apache.felix.log.maxSize";
-
     /** The default value for the maximum size property. */
     private static final int DEFAULT_MAX_SIZE = 100;
-
     /** The name of the property that defines whether debug messages are stored. */
     private static final String STORE_DEBUG_PROPERTY = "org.apache.felix.log.storeDebug";
-
     /** The default value for the store debug property. */
     private static final boolean DEFAULT_STORE_DEBUG = false;
-
     /** The log. */
     private Log m_log;
 
@@ -66,14 +63,19 @@
      * @param context the bundle context (used to look up a property)
      * @return the maximum size for the log
      */
-    private static int getMaxSize(final BundleContext context) {
+    private static int getMaxSize(final BundleContext context)
+    {
         int maxSize = DEFAULT_MAX_SIZE;
 
         String maxSizePropValue = context.getProperty(MAX_SIZE_PROPERTY);
-        if (maxSizePropValue != null) {
-            try {
+        if (maxSizePropValue != null)
+        {
+            try
+            {
                 maxSize = Integer.parseInt(maxSizePropValue);
-            } catch (NumberFormatException e) {
+            }
+            catch (NumberFormatException e)
+            {
                 // the property value is invalid - ignore
             }
         }
@@ -86,11 +88,13 @@
      * @param context the bundle context (used to look up a property)
      * @return whether or not to store debug messages
      */
-    private static boolean getStoreDebug(final BundleContext context) {
+    private static boolean getStoreDebug(final BundleContext context)
+    {
         boolean storeDebug = DEFAULT_STORE_DEBUG;
 
         String storeDebugPropValue = context.getProperty(STORE_DEBUG_PROPERTY);
-        if (storeDebugPropValue != null) {
+        if (storeDebugPropValue != null)
+        {
             storeDebug = Boolean.valueOf(storeDebugPropValue).booleanValue();
         }
 
@@ -103,7 +107,8 @@
      * @param context the bundle context
      * @throws Exception if an error occurs
      */
-    public void start(final BundleContext context) throws Exception {
+    public void start(final BundleContext context) throws Exception
+    {
         // create the log instance
         m_log = new Log(getMaxSize(context), getStoreDebug(context));
 
@@ -114,10 +119,10 @@
 
         // register the services with the framework
         context.registerService(LogService.class.getName(),
-                new LogServiceFactory(m_log), null);
+            new LogServiceFactory(m_log), null);
 
         context.registerService(LogReaderService.class.getName(),
-                new LogReaderServiceFactory(m_log), null);
+            new LogReaderServiceFactory(m_log), null);
     }
 
     /**
@@ -125,8 +130,9 @@
      * @param context the bundle context
      * @throws Exception if an error occurs
      */
-    public void stop(final BundleContext context) throws Exception {
+    public void stop(final BundleContext context) throws Exception
+    {
         // close the log
         m_log.close();
     }
-}
+}
\ No newline at end of file

Modified: felix/trunk/log/src/main/java/org/apache/felix/log/Log.java
URL: http://svn.apache.org/viewvc/felix/trunk/log/src/main/java/org/apache/felix/log/Log.java?rev=820346&r1=820345&r2=820346&view=diff
==============================================================================
--- felix/trunk/log/src/main/java/org/apache/felix/log/Log.java (original)
+++ felix/trunk/log/src/main/java/org/apache/felix/log/Log.java Wed Sep 30 17:03:45 2009
@@ -1,4 +1,4 @@
-/* 
+/*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
  * distributed with this work for additional information
@@ -37,22 +37,18 @@
  * @see org.osgi.service.log.LogService
  * @see org.osgi.service.log.LogReaderService
  */
-final class Log implements BundleListener, FrameworkListener, ServiceListener {
+final class Log implements BundleListener, FrameworkListener, ServiceListener
+{
     /** The first log entry. */
     private LogNode m_head;
-
     /** The last log entry. */
     private LogNode m_tail;
-
     /** The log size. */
     private int m_size;
-
     /** The log listener thread. */
     private LogListenerThread listenerThread;
-
     /** The maximum size for the log. */
     private final int m_maxSize;
-
     /** Whether or not to store debug messages. */
     private final boolean m_storeDebug;
 
@@ -61,7 +57,8 @@
      * @param maxSize the maximum size for the log
      * @param storeDebug whether or not to store debug messages
      */
-    Log(final int maxSize, final boolean storeDebug) {
+    Log(final int maxSize, final boolean storeDebug)
+    {
         this.m_maxSize = maxSize;
         this.m_storeDebug = storeDebug;
     }
@@ -69,8 +66,10 @@
     /**
      * Close the log.
      */
-    void close() {
-        if (listenerThread != null) {
+    void close()
+    {
+        if (listenerThread != null)
+        {
             listenerThread.shutdown();
             listenerThread = null;
         }
@@ -84,16 +83,20 @@
      * Adds the entry to the log.
      * @param entry the entry to add to the log
      */
-    synchronized void addEntry(final LogEntry entry) {
-        if (m_maxSize != 0) {
+    synchronized void addEntry(final LogEntry entry)
+    {
+        if (m_maxSize != 0)
+        {
             // add the entry to the historic log
-            if (m_storeDebug || entry.getLevel() != LogService.LOG_DEBUG) {
+            if (m_storeDebug || entry.getLevel() != LogService.LOG_DEBUG)
+            {
                 // create a new node for the entry
                 LogNode node = new LogNode(entry);
 
                 // add to the front of the linked list
                 node.setNextNode(m_head);
-                if (m_head != null) {
+                if (m_head != null)
+                {
                     m_head.setPreviousNode(node);
                 }
 
@@ -104,14 +107,17 @@
                 ++m_size;
 
                 // if no tail node - add the node to the tail
-                if (m_tail == null) {
+                if (m_tail == null)
+                {
                     m_tail = node;
                 }
             }
 
             // ensure the historic log doesn't grow beyond a certain size
-            if (m_maxSize != -1) {
-                if (m_size > m_maxSize) {
+            if (m_maxSize != -1)
+            {
+                if (m_size > m_maxSize)
+                {
                     LogNode last = m_tail.getPreviousNode();
                     last.setNextNode(null);
                     m_tail = last;
@@ -121,7 +127,8 @@
         }
 
         // notify any listeners
-        if (listenerThread != null) {
+        if (listenerThread != null)
+        {
             listenerThread.addEntry(entry);
         }
     }
@@ -130,8 +137,10 @@
      * Add a listener to the log.
      * @param listener the log listener to subscribe
      */
-    synchronized void addListener(final LogListener listener) {
-        if (listenerThread == null) {
+    synchronized void addListener(final LogListener listener)
+    {
+        if (listenerThread == null)
+        {
             // create a new listener thread if necessary:
             // the listener thread only runs if there are any registered listeners
             listenerThread = new LogListenerThread();
@@ -144,12 +153,15 @@
      * Remove a listener from the log.
      * @param listener the log listener to unsubscribe
      */
-    synchronized void removeListener(final LogListener listener) {
-        if (listenerThread != null) {
+    synchronized void removeListener(final LogListener listener)
+    {
+        if (listenerThread != null)
+        {
             listenerThread.removeListener(listener);
 
             // shutdown the thread if there are no listeners
-            if (listenerThread.getListenerCount() == 0) {
+            if (listenerThread.getListenerCount() == 0)
+            {
                 listenerThread.shutdown();
                 listenerThread = null;
             }
@@ -160,12 +172,14 @@
      * Returns an enumeration of all the entries in the log most recent first.
      * @return an enumeration of all the entries in the log most recent first
      */
-    synchronized Enumeration getEntries() {
+    synchronized Enumeration getEntries()
+    {
         return new LogNodeEnumeration(m_head, m_tail);
     }
 
     /** The messages returned for the framework events. */
-    private static final String[] FRAMEWORK_EVENT_MESSAGES = {
+    private static final String[] FRAMEWORK_EVENT_MESSAGES =
+    {
         "FrameworkEvent STARTED",
         "FrameworkEvent ERROR",
         "FrameworkEvent PACKAGES REFRESHED",
@@ -178,27 +192,31 @@
      * Called when a framework event occurs.
      * @param event the event that occured
      */
-    public void frameworkEvent(final FrameworkEvent event) {
+    public void frameworkEvent(final FrameworkEvent event)
+    {
         int eventType = event.getType();
         String message = null;
 
-        for (int i = 0; message == null && i < FRAMEWORK_EVENT_MESSAGES.length;
++i) {
-            if (eventType >> i == 1) {
+        for (int i = 0; message == null && i < FRAMEWORK_EVENT_MESSAGES.length;
++i)
+        {
+            if (eventType >> i == 1)
+            {
                 message = FRAMEWORK_EVENT_MESSAGES[i];
             }
         }
 
         LogEntry entry = new LogEntryImpl(event.getBundle(),
-                null,
-                (eventType == FrameworkEvent.ERROR) ? LogService.LOG_ERROR : LogService.LOG_INFO,
-                message,
-                event.getThrowable());
+            null,
+            (eventType == FrameworkEvent.ERROR) ? LogService.LOG_ERROR : LogService.LOG_INFO,
+            message,
+            event.getThrowable());
 
         addEntry(entry);
     }
 
     /** The messages returned for the bundle events. */
-    private static final String[] BUNDLE_EVENT_MESSAGES = {
+    private static final String[] BUNDLE_EVENT_MESSAGES =
+    {
         "BundleEvent INSTALLED",
         "BundleEvent STARTED",
         "BundleEvent STOPPED",
@@ -212,29 +230,34 @@
      * Called when a bundle event occurs.
      * @param event the event that occured
      */
-    public void bundleChanged(final BundleEvent event) {
+    public void bundleChanged(final BundleEvent event)
+    {
         int eventType = event.getType();
         String message = null;
 
-        for (int i = 0; message == null && i < BUNDLE_EVENT_MESSAGES.length; ++i)
{
-            if (eventType >> i == 1) {
+        for (int i = 0; message == null && i < BUNDLE_EVENT_MESSAGES.length; ++i)
+        {
+            if (eventType >> i == 1)
+            {
                 message = BUNDLE_EVENT_MESSAGES[i];
             }
         }
 
-        if (message != null) {
+        if (message != null)
+        {
             LogEntry entry = new LogEntryImpl(event.getBundle(),
-                    null,
-                    LogService.LOG_INFO,
-                    message,
-                    null);
+                null,
+                LogService.LOG_INFO,
+                message,
+                null);
 
             addEntry(entry);
         }
     }
 
     /** The messages returned for the service events. */
-    private static final String[] SERVICE_EVENT_MESSAGES = {
+    private static final String[] SERVICE_EVENT_MESSAGES =
+    {
         "ServiceEvent REGISTERED",
         "ServiceEvent MODIFIED",
         "ServiceEvent UNREGISTERING"
@@ -244,22 +267,25 @@
      * Called when a service event occurs.
      * @param event the event that occured
      */
-    public void serviceChanged(final ServiceEvent event) {
+    public void serviceChanged(final ServiceEvent event)
+    {
         int eventType = event.getType();
         String message = null;
 
-        for (int i = 0; message == null && i < SERVICE_EVENT_MESSAGES.length;
++i) {
-            if (eventType >> i == 1) {
+        for (int i = 0; message == null && i < SERVICE_EVENT_MESSAGES.length;
++i)
+        {
+            if (eventType >> i == 1)
+            {
                 message = SERVICE_EVENT_MESSAGES[i];
             }
         }
 
         LogEntry entry = new LogEntryImpl(event.getServiceReference().getBundle(),
-                event.getServiceReference(),
-                (eventType == ServiceEvent.MODIFIED) ? LogService.LOG_DEBUG : LogService.LOG_INFO,
-                message,
-                null);
+            event.getServiceReference(),
+            (eventType == ServiceEvent.MODIFIED) ? LogService.LOG_DEBUG : LogService.LOG_INFO,
+            message,
+            null);
 
         addEntry(entry);
     }
-}
+}
\ No newline at end of file

Modified: felix/trunk/log/src/main/java/org/apache/felix/log/LogEntryImpl.java
URL: http://svn.apache.org/viewvc/felix/trunk/log/src/main/java/org/apache/felix/log/LogEntryImpl.java?rev=820346&r1=820345&r2=820346&view=diff
==============================================================================
--- felix/trunk/log/src/main/java/org/apache/felix/log/LogEntryImpl.java (original)
+++ felix/trunk/log/src/main/java/org/apache/felix/log/LogEntryImpl.java Wed Sep 30 17:03:45
2009
@@ -1,4 +1,4 @@
-/* 
+/*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
  * distributed with this work for additional information
@@ -35,23 +35,18 @@
  * @see org.osgi.service.log.LogReaderService#getLog()
  * @see org.osgi.service.log.LogListener
  */
-final class LogEntryImpl implements LogEntry {
-
+final class LogEntryImpl implements LogEntry
+{
     /** The bundle that created the LogEntry object. */
     private final Bundle m_bundle;
-
     /** The exception associated with this LogEntry object. */
     private final Throwable m_exception;
-
     /** The severity level of this LogEntry object. */
     private final int m_level;
-
     /** The message associated with this LogEntry object. */
     private final String m_message;
-
     /** The service reference associated with this LogEntry object. */
     private final ServiceReference m_serviceReference;
-
     /** The system time in milliseconds when this LogEntry object was created. */
     private final long m_time;
 
@@ -64,10 +59,11 @@
      * @param exception the exception to associate with this LogEntry object
      */
     LogEntryImpl(final Bundle bundle,
-            final ServiceReference sr,
-            final int level,
-            final String message,
-            final Throwable exception) {
+        final ServiceReference sr,
+        final int level,
+        final String message,
+        final Throwable exception)
+    {
         this.m_bundle = bundle;
         this.m_exception = LogException.getException(exception);
         this.m_level = level;
@@ -81,7 +77,8 @@
      * @return the bundle that created this LogEntry object;<code>null</code>
if no
      * bundle is associated with this LogEntry object
      */
-    public Bundle getBundle() {
+    public Bundle getBundle()
+    {
         return m_bundle;
     }
 
@@ -92,7 +89,8 @@
      * this LogEntry object; <code>null</code> if no {@link ServiceReference}
object
      * was provided
      */
-    public ServiceReference getServiceReference() {
+    public ServiceReference getServiceReference()
+    {
         return m_serviceReference;
     }
 
@@ -107,7 +105,8 @@
      * @see org.osgi.service.LogService#LOG_INFO
      * @see org.osgi.service.LogService#LOG_DEBUG
      */
-    public int getLevel() {
+    public int getLevel()
+    {
         return m_level;
     }
 
@@ -115,7 +114,8 @@
      * Returns the human readable message associated with this LogEntry object.
      * @return a string containing the message associated with this LogEntry object
      */
-    public String getMessage() {
+    public String getMessage()
+    {
         return m_message;
     }
 
@@ -132,7 +132,8 @@
      * @return throwable object of the exception associated with this LogEntry;
      * <code>null</code> if no exception is associated with this LogEntry object
      */
-    public Throwable getException() {
+    public Throwable getException()
+    {
         return m_exception;
     }
 
@@ -142,7 +143,8 @@
      * @return the system time in milliseconds when this LogEntry object was created
      * @see System#currentTimeMillis()
      */
-    public long getTime() {
+    public long getTime()
+    {
         return m_time;
     }
-}
+}
\ No newline at end of file

Modified: felix/trunk/log/src/main/java/org/apache/felix/log/LogException.java
URL: http://svn.apache.org/viewvc/felix/trunk/log/src/main/java/org/apache/felix/log/LogException.java?rev=820346&r1=820345&r2=820346&view=diff
==============================================================================
--- felix/trunk/log/src/main/java/org/apache/felix/log/LogException.java (original)
+++ felix/trunk/log/src/main/java/org/apache/felix/log/LogException.java Wed Sep 30 17:03:45
2009
@@ -1,4 +1,4 @@
-/* 
+/*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
  * distributed with this work for additional information
@@ -26,13 +26,12 @@
  * class name) and the stack trace of both the exception thrown and any
  * embedded exceptions.
  */
-final class LogException extends Exception {
+final class LogException extends Exception
+{
     /** The class name of the original exception. */
     private final String m_className;
-
     /** The message from the original exception. */
     private final String m_message;
-
     /** The localized message from the original exception. */
     private final String m_localizedMessage;
 
@@ -40,14 +39,16 @@
      * Create a new instance.
      * @param exception the original exception.
      */
-    private LogException(final Throwable exception) {
+    private LogException(final Throwable exception)
+    {
         m_className = exception.getClass().getName();
         m_message = exception.getMessage();
         m_localizedMessage = exception.getLocalizedMessage();
         setStackTrace(exception.getStackTrace());
 
         Throwable cause = exception.getCause();
-        if (cause != null) {
+        if (cause != null)
+        {
             cause = getException(cause);
             initCause(cause);
         }
@@ -59,7 +60,8 @@
      * message of the original exception.
      * @return the message associated with the exception
      */
-    public String getMessage() {
+    public String getMessage()
+    {
         return m_className + ": " + m_message;
     }
 
@@ -69,7 +71,8 @@
      * followed by the localized message of the original exception.
      * @return the localized message associated with the exception
      */
-    public String getLocalizedMessage() {
+    public String getLocalizedMessage()
+    {
         return m_className + ": " + m_localizedMessage;
     }
 
@@ -81,19 +84,23 @@
      * @param exception the exception that was originally thrown.
      * @return the exception to store in the {@link LogEntry}
      */
-    static Throwable getException(final Throwable exception) {
+    static Throwable getException(final Throwable exception)
+    {
         Throwable result = null;
 
-        if (exception != null) {
+        if (exception != null)
+        {
             String className = exception.getClass().getName();
-            if (exception.getCause() == null
-                    && className.startsWith(JAVA_PACKAGE_PREFIX)) {
+            if (exception.getCause() == null && className.startsWith(JAVA_PACKAGE_PREFIX))
+            {
                 result = exception;
-            } else {
+            }
+            else
+            {
                 result = new LogException(exception);
             }
         }
 
         return result;
     }
-}
+}
\ No newline at end of file

Modified: felix/trunk/log/src/main/java/org/apache/felix/log/LogListenerThread.java
URL: http://svn.apache.org/viewvc/felix/trunk/log/src/main/java/org/apache/felix/log/LogListenerThread.java?rev=820346&r1=820345&r2=820346&view=diff
==============================================================================
--- felix/trunk/log/src/main/java/org/apache/felix/log/LogListenerThread.java (original)
+++ felix/trunk/log/src/main/java/org/apache/felix/log/LogListenerThread.java Wed Sep 30 17:03:45
2009
@@ -1,4 +1,4 @@
-/* 
+/*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
  * distributed with this work for additional information
@@ -32,14 +32,12 @@
  * {@link org.osgi.service.log.LogReaderService#addLogListener(LogListener)}
  * method.
  */
-final class LogListenerThread extends Thread {
-
+final class LogListenerThread extends Thread
+{
     /** Whether the thread is stopping or not. */
     private boolean m_stopping = false;
-
     /** The stack of entries waiting to be delivered to the log listeners. **/
     private final Stack m_entriesToDeliver = new Stack();
-
     /** The list of listeners. */
     private final List m_listeners = new Vector();
 
@@ -47,8 +45,10 @@
      * Add an entry to the list of messages to deliver.
      * @param entry the log entry to deliver
      */
-    void addEntry(final LogEntry entry) {
-        synchronized (m_entriesToDeliver) {
+    void addEntry(final LogEntry entry)
+    {
+        synchronized (m_entriesToDeliver)
+        {
             m_entriesToDeliver.add(entry);
             m_entriesToDeliver.notifyAll();
         }
@@ -58,8 +58,10 @@
      * Add a listener to the list of listeners that are subscribed.
      * @param listener the listener to add to the list of subscribed listeners
      */
-    void addListener(final LogListener listener) {
-        synchronized (m_listeners) {
+    void addListener(final LogListener listener)
+    {
+        synchronized (m_listeners)
+        {
             m_listeners.add(listener);
         }
     }
@@ -68,8 +70,10 @@
      * Remove a listener from the list of listeners that are subscribed.
      * @param listener the listener to remove from the list of subscribed listeners
      */
-    void removeListener(final LogListener listener) {
-        synchronized (m_listeners) {
+    void removeListener(final LogListener listener)
+    {
+        synchronized (m_listeners)
+        {
             m_listeners.remove(listener);
         }
     }
@@ -78,17 +82,20 @@
      * Returns the number of listeners that are currently registered.
      * @return the number of listeners that are currently registered
      */
-    int getListenerCount() {
+    int getListenerCount()
+    {
         return m_listeners.size();
     }
 
     /**
      * Stop the thread.  This will happen asynchronously.
      */
-    void shutdown() {
+    void shutdown()
+    {
         m_stopping = true;
 
-        synchronized (m_entriesToDeliver) {
+        synchronized (m_entriesToDeliver)
+        {
             m_entriesToDeliver.notifyAll();
         }
     }
@@ -97,39 +104,53 @@
      * The main method of the thread: waits for new messages to be receieved
      * and then delivers them to any registered log listeners.
      */
-    public void run() {
+    public void run()
+    {
         boolean stop = false;
 
-        for (; !stop;) {
-            synchronized (m_entriesToDeliver) {
-                if (!m_entriesToDeliver.isEmpty()) {
+        for (; !stop;)
+        {
+            synchronized (m_entriesToDeliver)
+            {
+                if (!m_entriesToDeliver.isEmpty())
+                {
                     LogEntry entry = (LogEntry) m_entriesToDeliver.pop();
 
-                    synchronized (m_listeners) {
+                    synchronized (m_listeners)
+                    {
                         Iterator listenerIt = m_listeners.iterator();
-                        while (listenerIt.hasNext()) {
-                            try {
+                        while (listenerIt.hasNext())
+                        {
+                            try
+                            {
                                 LogListener listener = (LogListener) listenerIt.next();
                                 listener.logged(entry);
-                            } catch (Throwable t) {
+                            }
+                            catch (Throwable t)
+                            {
                                 // catch and discard any exceptions thrown by the listener
                             }
                         }
                     }
                 }
 
-                if (m_entriesToDeliver.isEmpty()) {
-                    try {
+                if (m_entriesToDeliver.isEmpty())
+                {
+                    try
+                    {
                         m_entriesToDeliver.wait();
-                    } catch (InterruptedException e) {
+                    }
+                    catch (InterruptedException e)
+                    {
                         // do nothing
                     }
                 }
             }
 
-            if (m_stopping) {
+            if (m_stopping)
+            {
                 stop = true;
             }
         }
     }
-}
+}
\ No newline at end of file

Modified: felix/trunk/log/src/main/java/org/apache/felix/log/LogNode.java
URL: http://svn.apache.org/viewvc/felix/trunk/log/src/main/java/org/apache/felix/log/LogNode.java?rev=820346&r1=820345&r2=820346&view=diff
==============================================================================
--- felix/trunk/log/src/main/java/org/apache/felix/log/LogNode.java (original)
+++ felix/trunk/log/src/main/java/org/apache/felix/log/LogNode.java Wed Sep 30 17:03:45 2009
@@ -1,4 +1,4 @@
-/* 
+/*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
  * distributed with this work for additional information
@@ -23,13 +23,12 @@
 /**
  * The class used as a doubly linked list node in the log.
  */
-final class LogNode {
+final class LogNode
+{
     /** The previous node. */
     private LogNode m_previous;
-
     /** The next node. */
     private LogNode m_next;
-
     /** The log entry. */
     private final LogEntry m_entry;
 
@@ -37,7 +36,8 @@
      * Create a new instance.
      * @param entry the log entry.
      */
-    LogNode(final LogEntry entry) {
+    LogNode(final LogEntry entry)
+    {
         m_entry = entry;
     }
 
@@ -45,7 +45,8 @@
      * Returns the associated entry.
      * @return the associated entry
      */
-    LogEntry getEntry() {
+    LogEntry getEntry()
+    {
         return m_entry;
     }
 
@@ -53,7 +54,8 @@
      * Get the next node.
      * @return the next node
      */
-    LogNode getNextNode() {
+    LogNode getNextNode()
+    {
         return m_next;
     }
 
@@ -61,7 +63,8 @@
      * Set the next node.
      * @param next the next node
      */
-    void setNextNode(final LogNode next) {
+    void setNextNode(final LogNode next)
+    {
         m_next = next;
     }
 
@@ -69,7 +72,8 @@
      * Get the previous node.
      * @return the previous node
      */
-    LogNode getPreviousNode() {
+    LogNode getPreviousNode()
+    {
         return m_previous;
     }
 
@@ -77,7 +81,8 @@
      * Set the previous node.
      * @param previous the previous node
      */
-    void setPreviousNode(final LogNode previous) {
+    void setPreviousNode(final LogNode previous)
+    {
         m_previous = previous;
     }
-}
+}
\ No newline at end of file

Modified: felix/trunk/log/src/main/java/org/apache/felix/log/LogNodeEnumeration.java
URL: http://svn.apache.org/viewvc/felix/trunk/log/src/main/java/org/apache/felix/log/LogNodeEnumeration.java?rev=820346&r1=820345&r2=820346&view=diff
==============================================================================
--- felix/trunk/log/src/main/java/org/apache/felix/log/LogNodeEnumeration.java (original)
+++ felix/trunk/log/src/main/java/org/apache/felix/log/LogNodeEnumeration.java Wed Sep 30
17:03:45 2009
@@ -1,4 +1,4 @@
-/* 
+/*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
  * distributed with this work for additional information
@@ -26,10 +26,10 @@
  * Implementation of the {@link Enumeration} interface for a linked list of
  * {@link LogNode} entries.
  */
-final class LogNodeEnumeration implements Enumeration {
+final class LogNodeEnumeration implements Enumeration
+{
     /** The next node. */
     private LogNode m_next;
-
     /** The last node. */
     private final LogNode m_last;
 
@@ -38,7 +38,8 @@
      * @param start the first node to return
      * @param end the last node to return
      */
-    LogNodeEnumeration(final LogNode start, final LogNode end) {
+    LogNodeEnumeration(final LogNode start, final LogNode end)
+    {
         m_next = start;
         m_last = end;
     }
@@ -47,7 +48,8 @@
      * Determines whether there are any more elements to return.
      * @return <code>true</code> if there are more elements; <code>false</code>
otherwise
      */
-    public boolean hasMoreElements() {
+    public boolean hasMoreElements()
+    {
         return m_next != null;
     }
 
@@ -55,17 +57,21 @@
      * Returns the current element and moves onto the next element.
      * @return the current element
      */
-    public Object nextElement() {
+    public Object nextElement()
+    {
         LogEntry result = null;
 
-        if (m_next == m_last) {
+        if (m_next == m_last)
+        {
             result = m_next.getEntry();
             m_next = null;
-        } else if (m_next != null) {
+        }
+        else if (m_next != null)
+        {
             result = m_next.getEntry();
             m_next = m_next.getNextNode();
         }
 
         return result;
     }
-}
+}
\ No newline at end of file

Modified: felix/trunk/log/src/main/java/org/apache/felix/log/LogReaderServiceFactory.java
URL: http://svn.apache.org/viewvc/felix/trunk/log/src/main/java/org/apache/felix/log/LogReaderServiceFactory.java?rev=820346&r1=820345&r2=820346&view=diff
==============================================================================
--- felix/trunk/log/src/main/java/org/apache/felix/log/LogReaderServiceFactory.java (original)
+++ felix/trunk/log/src/main/java/org/apache/felix/log/LogReaderServiceFactory.java Wed Sep
30 17:03:45 2009
@@ -1,4 +1,4 @@
-/* 
+/*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
  * distributed with this work for additional information
@@ -26,7 +26,8 @@
  * {@link ServiceFactory} implementation for {@link LogReaderService}.  Associates
  * an individual {@link LogReaderService} with a {@link Bundle}.
  */
-final class LogReaderServiceFactory implements ServiceFactory {
+final class LogReaderServiceFactory implements ServiceFactory
+{
     /** The log to associate the service implementations with. */
     private final Log m_log;
 
@@ -34,7 +35,8 @@
      * Create a new instance.
      * @param log the log to associate the service implementations with.,
      */
-    LogReaderServiceFactory(final Log log) {
+    LogReaderServiceFactory(final Log log)
+    {
         m_log = log;
     }
 
@@ -45,7 +47,8 @@
      * @return the log reader service implementation for the specified bundle
      */
     public Object getService(final Bundle bundle,
-            final ServiceRegistration registration) {
+        final ServiceRegistration registration)
+    {
         return new LogReaderServiceImpl(m_log);
     }
 
@@ -57,8 +60,9 @@
      * @param service the service to release
      */
     public void ungetService(final Bundle bundle,
-            final ServiceRegistration registration,
-            final Object service) {
+        final ServiceRegistration registration,
+        final Object service)
+    {
         ((LogReaderServiceImpl) service).removeAllLogListeners();
     }
-}
+}
\ No newline at end of file

Modified: felix/trunk/log/src/main/java/org/apache/felix/log/LogReaderServiceImpl.java
URL: http://svn.apache.org/viewvc/felix/trunk/log/src/main/java/org/apache/felix/log/LogReaderServiceImpl.java?rev=820346&r1=820345&r2=820346&view=diff
==============================================================================
--- felix/trunk/log/src/main/java/org/apache/felix/log/LogReaderServiceImpl.java (original)
+++ felix/trunk/log/src/main/java/org/apache/felix/log/LogReaderServiceImpl.java Wed Sep 30
17:03:45 2009
@@ -1,4 +1,4 @@
-/* 
+/*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
  * distributed with this work for additional information
@@ -36,11 +36,10 @@
  * notifications about {@link org.osgi.service.log.LogEntry} objects when they are created
  * through the {@link org.osgi.service.log.LogService}.
  */
-final class LogReaderServiceImpl implements LogReaderService {
-
+final class LogReaderServiceImpl implements LogReaderService
+{
     /** The log implementation. */
     private final Log m_log;
-
     /** The listeners associated with this service. */
     private final List m_listeners = new Vector();
 
@@ -48,7 +47,8 @@
      * Create a new instance.
      * @param log the log implementation
      */
-    LogReaderServiceImpl(final Log log) {
+    LogReaderServiceImpl(final Log log)
+    {
         this.m_log = log;
     }
 
@@ -66,7 +66,8 @@
      * object for the message each time a message is logged.
      * @param listener the listener object to subscribe
      */
-    public synchronized void addLogListener(final LogListener listener) {
+    public synchronized void addLogListener(final LogListener listener)
+    {
         m_listeners.add(listener);
         m_log.addListener(listener);
     }
@@ -75,7 +76,8 @@
      * This method is used to unsubscribe from the Log Reader Service.
      * @param listener the listener object to unsubscribe
      */
-    public synchronized void removeLogListener(final LogListener listener) {
+    public synchronized void removeLogListener(final LogListener listener)
+    {
         m_listeners.remove(listener);
         m_log.removeListener(listener);
     }
@@ -85,18 +87,21 @@
      * entry first.
      * @return an enumeration of the {@link LogEntry} objects that have been stored
      */
-    public Enumeration getLog() {
+    public Enumeration getLog()
+    {
         return m_log.getEntries();
     }
 
     /**
      * Remove all log listeners registered through this service.
      */
-    synchronized void removeAllLogListeners() {
+    synchronized void removeAllLogListeners()
+    {
         Iterator listenerIt = m_listeners.iterator();
-        while (listenerIt.hasNext()) {
+        while (listenerIt.hasNext())
+        {
             LogListener listener = (LogListener) listenerIt.next();
             m_log.removeListener(listener);
         }
     }
-}
+}
\ No newline at end of file

Modified: felix/trunk/log/src/main/java/org/apache/felix/log/LogServiceFactory.java
URL: http://svn.apache.org/viewvc/felix/trunk/log/src/main/java/org/apache/felix/log/LogServiceFactory.java?rev=820346&r1=820345&r2=820346&view=diff
==============================================================================
--- felix/trunk/log/src/main/java/org/apache/felix/log/LogServiceFactory.java (original)
+++ felix/trunk/log/src/main/java/org/apache/felix/log/LogServiceFactory.java Wed Sep 30 17:03:45
2009
@@ -1,4 +1,4 @@
-/* 
+/*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
  * distributed with this work for additional information
@@ -26,7 +26,8 @@
  * {@link ServiceFactory} implementation for {@link LogService}.  Associates
  * an individual {@link LogService} with a {@link Bundle}.
  */
-final class LogServiceFactory implements ServiceFactory {
+final class LogServiceFactory implements ServiceFactory
+{
     /** The log to associate the service implementations with. */
     private final Log m_log;
 
@@ -34,7 +35,8 @@
      * Create a new instance.
      * @param log the log to associate the service implementations with.,
      */
-    LogServiceFactory(final Log log) {
+    LogServiceFactory(final Log log)
+    {
         m_log = log;
     }
 
@@ -45,7 +47,8 @@
      * @return the log service implementation for the specified bundle
      */
     public Object getService(final Bundle bundle,
-            final ServiceRegistration registration) {
+        final ServiceRegistration registration)
+    {
         return new LogServiceImpl(m_log, bundle);
     }
 
@@ -57,8 +60,9 @@
      * @param service the service to release
      */
     public void ungetService(final Bundle bundle,
-            final ServiceRegistration registration,
-            final Object service) {
+        final ServiceRegistration registration,
+        final Object service)
+    {
         // do nothing
     }
-}
+}
\ No newline at end of file

Modified: felix/trunk/log/src/main/java/org/apache/felix/log/LogServiceImpl.java
URL: http://svn.apache.org/viewvc/felix/trunk/log/src/main/java/org/apache/felix/log/LogServiceImpl.java?rev=820346&r1=820345&r2=820346&view=diff
==============================================================================
--- felix/trunk/log/src/main/java/org/apache/felix/log/LogServiceImpl.java (original)
+++ felix/trunk/log/src/main/java/org/apache/felix/log/LogServiceImpl.java Wed Sep 30 17:03:45
2009
@@ -1,4 +1,4 @@
-/* 
+/*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
  * distributed with this work for additional information
@@ -25,11 +25,10 @@
 /**
  * Implementation of the OSGi {@link LogService}.
  */
-final class LogServiceImpl implements LogService {
-
+final class LogServiceImpl implements LogService
+{
     /** The log implementation. */
     private final Log m_log;
-
     /** The bundle associated with this implementation. */
     private final Bundle m_bundle;
 
@@ -38,7 +37,8 @@
      * @param log the log implementation
      * @param bundle the bundle associated with this implementation
      */
-    LogServiceImpl(final Log log, final Bundle bundle) {
+    LogServiceImpl(final Log log, final Bundle bundle)
+    {
         this.m_log = log;
         this.m_bundle = bundle;
     }
@@ -48,7 +48,8 @@
      * @param level the level to log the message at
      * @param message the message to log
      */
-    public void log(final int level, final String message) {
+    public void log(final int level, final String message)
+    {
         log(null, level, message, null);
     }
 
@@ -60,8 +61,9 @@
      * @param exception the exception to log
      */
     public void log(final int level,
-            final String message,
-            final Throwable exception) {
+        final String message,
+        final Throwable exception)
+    {
         log(null, level, message, exception);
     }
 
@@ -73,8 +75,9 @@
      * @param message the message to log
      */
     public void log(final ServiceReference sr,
-            final int level,
-            final String message) {
+        final int level,
+        final String message)
+    {
         log(sr, level, message, null);
     }
 
@@ -87,13 +90,14 @@
      * @param exception the exception to log
      */
     public void log(final ServiceReference sr,
-            final int level,
-            final String message,
-            final Throwable exception) {
+        final int level,
+        final String message,
+        final Throwable exception)
+    {
         m_log.addEntry(new LogEntryImpl((sr != null) ? sr.getBundle() : m_bundle,
-                sr,
-                level,
-                message,
-                exception));
+            sr,
+            level,
+            message,
+            exception));
     }
-}
+}
\ No newline at end of file



Mime
View raw message