jason.core.service
Class LogService

java.lang.Object
  |
  +--jason.core.AbstractService
        |
        +--jason.core.ThreadableService
              |
              +--jason.core.service.InnerService
                    |
                    +--jason.core.service.LogService
All Implemented Interfaces:
java.io.Serializable, Service, ServiceDataListener

public class LogService
extends jason.core.service.InnerService

Created Thu May 9 18:16:13 2002

This is a log service that get all message from other service and store it in a message file

See Also:
Serialized Form

Field Summary
protected  java.util.Vector messages
           
static ServiceType TYPE
           
 
Fields inherited from class jason.core.ThreadableService
activeThread
 
Fields inherited from class jason.core.AbstractService
INITIALIZED, name, NOSTATE, serviceContext, STARTED, STOPPED
 
Fields inherited from interface jason.core.Service
ERROR_MESSAGE, INFORMATION_MESSAGE, VERBOSE_MESSAGE, WARNING_MESSAGE
 
Constructor Summary
LogService()
           
 
Method Summary
protected  void cleanMessages()
           
 java.io.File getLogLocation()
           
 boolean isOverride()
          This service type is 'overridable'
 ServiceResponse manageRequest(ServiceRequest request)
          Manage a message request
 void notifyInitReady()
          Initialize the log service by using the Log tag attribute from the jason.xml file
protected  void notifyStopReady()
          This method is called at the end of the stop method
protected  void run()
          User should override this method for running a task.
 void setLog(java.io.File logLocation)
          Define the path for storing log message by default this is the "log" path
 void stop()
          stop the service
protected  void writeException(java.lang.Exception exc, java.io.RandomAccessFile raf)
          Write an exception to the raf
protected  void writeMessage(java.lang.String message, java.io.RandomAccessFile raf)
          Write a service message on the raf
protected  void writeMessages()
          Store the file message en flush it
 
Methods inherited from class jason.core.ThreadableService
actionForStart, enableServiceForThread, getThreadLoopDelay, isThreadLoopMode, isThreadStarted, isWaiting, notifyThreadRunning, runThread, setPriority, setThreadLoopDelay, setThreadLoopMode, threadNotify, threadWait
 
Methods inherited from class jason.core.AbstractService
checkForContext, fireCriticalErrorDetected, getBooleanProperty, getInfo, getIntProperty, getName, getPropertiesName, getProperty, getServiceContext, getServiceState, getState, getStringProperty, getType, getVersion, hasServiceContext, init, isAutoStop, isEnabled, isInitialized, isPersistent, isPrivate, isProcessable, isStarted, isStopped, isTest, isThreadable, isVerbose, manageRequestForType, notifyData, notifyStartReady, postStop, restart, sendCustomMessage, sendErrorMessage, sendInformationMessage, sendInnerError, sendWarningMessage, setAutoStop, setEnabled, setName, setPersistent, setPrivate, setProperty, setServiceContext, setTest, setType, setVerbose, setVersion, start
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TYPE

public static ServiceType TYPE

messages

protected java.util.Vector messages
Constructor Detail

LogService

public LogService()
Method Detail

setLog

public void setLog(java.io.File logLocation)
Define the path for storing log message by default this is the "log" path


notifyInitReady

public void notifyInitReady()
Initialize the log service by using the Log tag attribute from the jason.xml file

Overrides:
notifyInitReady in class AbstractService

getLogLocation

public java.io.File getLogLocation()

run

protected void run()
Description copied from class: AbstractService
User should override this method for running a task. This is the core of the service running state. Note that you shouldn't use a main loop like for standard thread. You just have to notify that this service use a main loop for the setThreadLoopMode method

Overrides:
run in class AbstractService

notifyStopReady

protected void notifyStopReady()
Description copied from class: AbstractService
This method is called at the end of the stop method

Overrides:
notifyStopReady in class AbstractService

stop

public void stop()
Description copied from interface: Service
stop the service

Specified by:
stop in interface Service
Overrides:
stop in class AbstractService

cleanMessages

protected void cleanMessages()

writeMessages

protected void writeMessages()
Store the file message en flush it


writeException

protected void writeException(java.lang.Exception exc,
                              java.io.RandomAccessFile raf)
                       throws java.io.IOException
Write an exception to the raf

java.io.IOException

writeMessage

protected void writeMessage(java.lang.String message,
                            java.io.RandomAccessFile raf)
                     throws java.io.IOException
Write a service message on the raf

java.io.IOException

manageRequest

public ServiceResponse manageRequest(ServiceRequest request)
                              throws ServiceException
Manage a message request

Specified by:
manageRequest in interface Service
Overrides:
manageRequest in class AbstractService
Returns:
the request's response
ServiceException

isOverride

public boolean isOverride()
This service type is 'overridable'

Specified by:
isOverride in interface Service
Overrides:
isOverride in class AbstractService
Returns:
true if the service can be replaced by another service with the same type