org.productivity.java.syslog4j.server.impl
Class AbstractSyslogServer

java.lang.Object
  extended by org.productivity.java.syslog4j.server.impl.AbstractSyslogServer
All Implemented Interfaces:
java.lang.Runnable, SyslogServerIF
Direct Known Subclasses:
TCPNetSyslogServer, UDPNetSyslogServer

public abstract class AbstractSyslogServer
extends java.lang.Object
implements SyslogServerIF

AbstractSyslogServer provides a base abstract implementation of the SyslogServerIF.

Syslog4j is licensed under the Lesser GNU Public License v2.1. A copy of the LGPL license is available in the META-INF folder in all distributions of Syslog4j and in the base directory of the "doc" ZIP.

Version:
$Id: AbstractSyslogServer.java,v 1.12 2011/01/11 05:11:13 cvs Exp $
Author:
<syslog4j@productivity.org>

Nested Class Summary
static class AbstractSyslogServer.Sessions
           
 
Field Summary
protected  boolean shutdown
           
protected  java.lang.String syslogProtocol
           
protected  AbstractSyslogServerConfig syslogServerConfig
           
protected  java.lang.Thread thread
           
 
Constructor Summary
AbstractSyslogServer()
           
 
Method Summary
protected static SyslogServerEventIF createEvent(SyslogServerConfigIF serverConfig, byte[] lineBytes, int lineBytesLength, java.net.InetAddress inetAddr)
           
protected static SyslogServerEventIF createEvent(SyslogServerConfigIF serverConfig, java.lang.String line, java.net.InetAddress inetAddr)
           
 SyslogServerConfigIF getConfig()
           
 java.lang.String getProtocol()
           
 java.lang.Thread getThread()
           
static void handleDestroy(SyslogServerIF syslogServer)
           
static void handleEvent(AbstractSyslogServer.Sessions sessions, SyslogServerIF syslogServer, java.net.DatagramPacket packet, SyslogServerEventIF event)
           
protected static void handleEvent(AbstractSyslogServer.Sessions sessions, SyslogServerIF syslogServer, java.net.Socket socket, java.net.SocketAddress socketAddress, SyslogServerEventIF event)
           
static void handleEvent(AbstractSyslogServer.Sessions sessions, SyslogServerIF syslogServer, java.net.Socket socket, SyslogServerEventIF event)
           
static void handleException(java.lang.Object session, SyslogServerIF syslogServer, java.net.SocketAddress socketAddress, java.lang.Exception exception)
           
static void handleInitialize(SyslogServerIF syslogServer)
           
static void handleSessionClosed(AbstractSyslogServer.Sessions sessions, SyslogServerIF syslogServer, java.net.Socket socket, boolean timeout)
           
static void handleSessionOpen(AbstractSyslogServer.Sessions sessions, SyslogServerIF syslogServer, java.net.Socket socket)
           
protected abstract  void initialize()
           
 void initialize(java.lang.String protocol, SyslogServerConfigIF config)
           
protected static boolean isStructuredMessage(SyslogCharSetIF syslogCharSet, byte[] receiveData)
           
protected static boolean isStructuredMessage(SyslogCharSetIF syslogCharSet, java.lang.String receiveData)
           
 void setThread(java.lang.Thread thread)
           
 void shutdown()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.productivity.java.syslog4j.server.SyslogServerIF
run
 

Field Detail

syslogProtocol

protected java.lang.String syslogProtocol

syslogServerConfig

protected AbstractSyslogServerConfig syslogServerConfig

thread

protected java.lang.Thread thread

shutdown

protected boolean shutdown
Constructor Detail

AbstractSyslogServer

public AbstractSyslogServer()
Method Detail

initialize

public void initialize(java.lang.String protocol,
                       SyslogServerConfigIF config)
                throws SyslogRuntimeException
Specified by:
initialize in interface SyslogServerIF
Throws:
SyslogRuntimeException

getProtocol

public java.lang.String getProtocol()
Specified by:
getProtocol in interface SyslogServerIF

getConfig

public SyslogServerConfigIF getConfig()
Specified by:
getConfig in interface SyslogServerIF

initialize

protected abstract void initialize()
                            throws SyslogRuntimeException
Throws:
SyslogRuntimeException

shutdown

public void shutdown()
              throws SyslogRuntimeException
Specified by:
shutdown in interface SyslogServerIF
Throws:
SyslogRuntimeException

getThread

public java.lang.Thread getThread()
Specified by:
getThread in interface SyslogServerIF

setThread

public void setThread(java.lang.Thread thread)
Specified by:
setThread in interface SyslogServerIF

isStructuredMessage

protected static boolean isStructuredMessage(SyslogCharSetIF syslogCharSet,
                                             byte[] receiveData)

isStructuredMessage

protected static boolean isStructuredMessage(SyslogCharSetIF syslogCharSet,
                                             java.lang.String receiveData)

createEvent

protected static SyslogServerEventIF createEvent(SyslogServerConfigIF serverConfig,
                                                 byte[] lineBytes,
                                                 int lineBytesLength,
                                                 java.net.InetAddress inetAddr)

createEvent

protected static SyslogServerEventIF createEvent(SyslogServerConfigIF serverConfig,
                                                 java.lang.String line,
                                                 java.net.InetAddress inetAddr)

handleInitialize

public static void handleInitialize(SyslogServerIF syslogServer)

handleDestroy

public static void handleDestroy(SyslogServerIF syslogServer)

handleSessionOpen

public static void handleSessionOpen(AbstractSyslogServer.Sessions sessions,
                                     SyslogServerIF syslogServer,
                                     java.net.Socket socket)

handleSessionClosed

public static void handleSessionClosed(AbstractSyslogServer.Sessions sessions,
                                       SyslogServerIF syslogServer,
                                       java.net.Socket socket,
                                       boolean timeout)

handleEvent

public static void handleEvent(AbstractSyslogServer.Sessions sessions,
                               SyslogServerIF syslogServer,
                               java.net.DatagramPacket packet,
                               SyslogServerEventIF event)

handleEvent

public static void handleEvent(AbstractSyslogServer.Sessions sessions,
                               SyslogServerIF syslogServer,
                               java.net.Socket socket,
                               SyslogServerEventIF event)

handleEvent

protected static void handleEvent(AbstractSyslogServer.Sessions sessions,
                                  SyslogServerIF syslogServer,
                                  java.net.Socket socket,
                                  java.net.SocketAddress socketAddress,
                                  SyslogServerEventIF event)

handleException

public static void handleException(java.lang.Object session,
                                   SyslogServerIF syslogServer,
                                   java.net.SocketAddress socketAddress,
                                   java.lang.Exception exception)