janus.web.service
Class Service

java.lang.Object
  extended by janus.web.config.PropertyConfig
      extended by janus.web.service.Service
All Implemented Interfaces:
ExceptionListener
Direct Known Subclasses:
SapJanusService, SapTraceService, ServerLoopService

public abstract class Service
extends PropertyConfig
implements ExceptionListener

Basisklasse für ServerDienste.


Field Summary
protected  boolean active
          Sind wir aktiv?
protected  boolean debug
          Debugging
protected  PrintWriter debugStream
          PrintWriter für die Debug-Ausgaben
static boolean DEFAULT_ACTIVE
          Default rür active
static boolean DEFAULT_DEBUG
          Default rür debug
static String DEFAULT_PACKAGE
          Default Package janus.web.service
protected  Logger errorlog
          Error-Logging
protected  Logger log
          Logging
protected  String status
          Status
protected  String toStringParameters
          Parameter für toString()
static String TRACE
          Logger für Traces
 
Fields inherited from class janus.web.config.PropertyConfig
prefix, props
 
Constructor Summary
Service()
           
 
Method Summary
static Service create(String name, Properties props)
          Factory - Erzeugt ein passendes Objekt und initialisiert es.
 PrintWriter getDebugStream()
          Ermittle den Debugging-Stream
 String getName()
          Gebe den Namen zuück.
 String getStatus()
          Aktueller Status
 String getTraceName()
          Ermittle den Namen des Trace-Loggers
 void handleException(Throwable t)
          Exception Handler
protected  void init(Properties props, Class clazz)
          Initialisierung aus den Properties.
 boolean isActive()
          Sind wir aktiv?
 boolean isDebug()
          Ermittle das Debugging-Flag
protected  void setField(Field f, Object val)
          Helper um ein Feld zu setzen.
protected  void setToStringParameters(String param)
          Setze die Paramter für toString()
 void setTraceName(String traceName)
          Setze den Namen des Trace-Loggers
abstract  void start()
          Starte den Service
abstract  void stop()
          Stoppe den Service
 String toString()
          String-Ausgabe
 
Methods inherited from class janus.web.config.PropertyConfig
convertProperties, getBooleanProperty, getBooleanProperty, getBooleanPropertyArray, getBooleanPropertyArray, getIntProperty, getIntProperty, getIntPropertyArray, getIntPropertyArray, getLogger, getPrefix, getProperties, getProperty, getProperty, getPropertyArray, getPropertyArray, init, readFile, setPrefix
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

active

protected boolean active
Sind wir aktiv?


debug

protected boolean debug
Debugging


debugStream

protected PrintWriter debugStream
PrintWriter für die Debug-Ausgaben


DEFAULT_ACTIVE

public static final boolean DEFAULT_ACTIVE
Default rür active

See Also:
Constant Field Values

DEFAULT_DEBUG

public static final boolean DEFAULT_DEBUG
Default rür debug

See Also:
Constant Field Values

DEFAULT_PACKAGE

public static final String DEFAULT_PACKAGE
Default Package janus.web.service

See Also:
Constant Field Values

errorlog

protected Logger errorlog
Error-Logging


log

protected Logger log
Logging


status

protected String status
Status


toStringParameters

protected String toStringParameters
Parameter für toString()


TRACE

public static final String TRACE
Logger für Traces

See Also:
Constant Field Values
Constructor Detail

Service

public Service()
Method Detail

create

public static Service create(String name,
                             Properties props)
                      throws Throwable
Factory - Erzeugt ein passendes Objekt und initialisiert es. Es wird aber noch nicht gestartet.

Parameters:
name - Name des Service
props - Properties für die Konfiguration
Throws:
Throwable - - Erzeugung nicht möglich

getDebugStream

public PrintWriter getDebugStream()
Ermittle den Debugging-Stream


getName

public String getName()
Gebe den Namen zuück.


getStatus

public String getStatus()
Aktueller Status


getTraceName

public String getTraceName()
Ermittle den Namen des Trace-Loggers

Returns:
Eintrag in Log4j-Konfiguration

handleException

public void handleException(Throwable t)
Exception Handler

Specified by:
handleException in interface ExceptionListener
Parameters:
t - Exception, die in Error-Log soll

init

protected void init(Properties props,
                    Class clazz)
             throws IllegalAccessException
Initialisierung aus den Properties. Da standardmäßig nur die Felder der abgeleiteten Klasse gesetzt werden, setzen wir hier auch die Felder dieser Basisklasse.

Overrides:
init in class PropertyConfig
Parameters:
props - Konfigurationsdaten
clazz - die eigene Klasse
Throws:
IllegalAccessException

isActive

public boolean isActive()
Sind wir aktiv?


isDebug

public boolean isDebug()
Ermittle das Debugging-Flag


setField

protected void setField(Field f,
                        Object val)
                 throws IllegalAccessException
Helper um ein Feld zu setzen. Dies ist notwendig, da wir nicht im Package der Basisklasse liegen.

Overrides:
setField in class PropertyConfig
Throws:
IllegalAccessException
See Also:
PropertyConfig.setField(java.lang.reflect.Field, java.lang.Object)

setToStringParameters

protected void setToStringParameters(String param)
Setze die Paramter für toString()


setTraceName

public void setTraceName(String traceName)
Setze den Namen des Trace-Loggers

Parameters:
traceName - Eintrag in Log4j-Konfiguration

start

public abstract void start()
                    throws Throwable
Starte den Service

Throws:
Throwable

stop

public abstract void stop()
                   throws Throwable
Stoppe den Service

Throws:
Throwable

toString

public String toString()
String-Ausgabe

Overrides:
toString in class Object


Copyright © 2008 MvC Systemsoftware.