org.apache.felix.ipojo.junit4osgi.plugin.log
Class LogServiceImpl

java.lang.Object
  extended by org.apache.felix.ipojo.junit4osgi.plugin.log.LogServiceImpl
All Implemented Interfaces:
BundleActivator, LogService

public class LogServiceImpl
extends Object
implements LogService, BundleActivator

An implementation of the log service to collect logged messages. This service implementation is also BundleActivator and is activated when the embedded OSGi platform starts.

Author:
Felix Project Team

Field Summary
 
Fields inherited from interface org.osgi.service.log.LogService
LOG_DEBUG, LOG_ERROR, LOG_INFO, LOG_WARNING
 
Constructor Summary
LogServiceImpl()
          Creates the log service object.
 
Method Summary
 void enableOutputStream()
          Enables the log messages collection.
 String getLoggedMessages()
          Get collected log messages.
 void log(int arg0, String arg1)
          Logs a message.
 void log(int arg0, String arg1, Throwable arg2)
          Logs a message with an attached exception.
 void log(ServiceReference arg0, int arg1, String arg2)
          Logs a message raised by the given service reference.
 void log(ServiceReference arg0, int arg1, String arg2, Throwable arg3)
          Logs a message raised by the given service reference associated with an exception.
 void reset()
          Re-initializes the collected message list.
 void start(BundleContext bc)
          Stars the log service implementation: Registers the service.
 void stop(BundleContext arg0)
          Stops the log service implementation.
 void write(String log)
          Writes the given message in the adequate output stream.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LogServiceImpl

public LogServiceImpl()
Creates the log service object.

Method Detail

enableOutputStream

public void enableOutputStream()
Enables the log messages collection.


getLoggedMessages

public String getLoggedMessages()
Get collected log messages.

Returns:
the String containing the logged messages.

reset

public void reset()
Re-initializes the collected message list.


log

public void log(int arg0,
                String arg1)
Logs a message.

Specified by:
log in interface LogService
Parameters:
arg0 - the log level
arg1 - the message
See Also:
LogService.log(int, java.lang.String)

log

public void log(int arg0,
                String arg1,
                Throwable arg2)
Logs a message with an attached exception.

Specified by:
log in interface LogService
Parameters:
arg0 - the log level
arg1 - the message
arg2 - the associated exception
See Also:
LogService.log(int, java.lang.String, java.lang.Throwable)

log

public void log(ServiceReference arg0,
                int arg1,
                String arg2)
Logs a message raised by the given service reference.

Specified by:
log in interface LogService
Parameters:
arg0 - the service reference
arg1 - the log level
arg2 - the message
See Also:
LogService.log(org.osgi.framework.ServiceReference, int, java.lang.String)

log

public void log(ServiceReference arg0,
                int arg1,
                String arg2,
                Throwable arg3)
Logs a message raised by the given service reference associated with an exception.

Specified by:
log in interface LogService
Parameters:
arg0 - the service reference
arg1 - the log level
arg2 - the message
arg3 - the exception
See Also:
LogService.log(org.osgi.framework.ServiceReference, int, java.lang.String)

write

public void write(String log)
Writes the given message in the adequate output stream.

Parameters:
log - the message

start

public void start(BundleContext bc)
           throws Exception
Stars the log service implementation: Registers the service.

Specified by:
start in interface BundleActivator
Parameters:
bc - the bundle context.
Throws:
Exception - should not happen.
See Also:
BundleActivator.start(org.osgi.framework.BundleContext)

stop

public void stop(BundleContext arg0)
          throws Exception
Stops the log service implementation. Does nothing.

Specified by:
stop in interface BundleActivator
Parameters:
arg0 - the bundle context
Throws:
Exception - should not happen.
See Also:
BundleActivator.stop(org.osgi.framework.BundleContext)


Copyright © 2013 The Apache Software Foundation. All Rights Reserved.