kfmes.natelib
Class AbstractProcessor

java.lang.Object
  extended by java.lang.Thread
      extended by kfmes.natelib.AbstractProcessor
All Implemented Interfaces:
java.lang.Runnable
Direct Known Subclasses:
NotificationProcessor, SwitchBoardSession

public abstract class AbstractProcessor
extends java.lang.Thread

SS, NS 중 공통으로 가지고 있는 부분을 포함한 추상 클래스이다.

Version:
$Id: AbstractProcessor.java,v 1.14 2007/11/19 17:37:25 kfmes Exp $
Author:
kfmes(KIM Ga-Hyeon, jateon@kfmes.com, http://jateon.kfmes.com )

Nested Class Summary
 
Nested classes/interfaces inherited from class java.lang.Thread
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler
 
Field Summary
protected  java.io.InputStream in
           
protected  java.lang.String line
           
 NateonMessenger nate
           
protected  java.io.OutputStream out
           
protected  java.lang.String server
           
protected  java.net.Socket socket
           
protected  int TrID
           
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
AbstractProcessor()
           
 
Method Summary
protected  void closeConnection()
           
protected  void flushInputStream(java.lang.String line)
           
 boolean isConnected()
           
static void main(java.lang.String[] args)
           
protected  void makeConnection(java.lang.String IPaddr, int port)
           
protected  java.lang.String read(int size)
          NS서버로부터 오는메세지를 size byte만큼 읽는다.
protected  java.lang.String readLine()
          NS서버로부터 오는메세지 한줄을 읽는다.
protected  java.lang.String recv()
           
protected  void send(Message msg)
          Message 전송
protected  void send(java.lang.String msg)
          raw수준의 메세지를 전송한다.
 void send(java.lang.String header, java.lang.String body)
           
protected  void sendMessage(java.lang.String msgtype, java.lang.String msg)
          소켓으로 메세지를 전송한다
protected  void sendMessageNoCrLf(java.lang.String msgtype, java.lang.String msg)
          소켓으로 메세지를 전송한다.
protected  void setTrID(int t)
           
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, run, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

nate

public NateonMessenger nate

server

protected java.lang.String server

socket

protected java.net.Socket socket

in

protected java.io.InputStream in

out

protected java.io.OutputStream out

line

protected java.lang.String line

TrID

protected int TrID
Constructor Detail

AbstractProcessor

public AbstractProcessor()
Method Detail

makeConnection

protected void makeConnection(java.lang.String IPaddr,
                              int port)
                       throws java.io.IOException
Throws:
java.io.IOException

isConnected

public boolean isConnected()

closeConnection

protected void closeConnection()

setTrID

protected void setTrID(int t)

send

protected void send(java.lang.String msg)
             throws java.io.IOException
raw수준의 메세지를 전송한다.

Parameters:
msg -
Throws:
java.io.IOException

send

public void send(java.lang.String header,
                 java.lang.String body)
          throws java.io.IOException
Throws:
java.io.IOException

send

protected void send(Message msg)
             throws java.io.IOException
Message 전송

Parameters:
msg -
Throws:
java.io.IOException

sendMessage

protected void sendMessage(java.lang.String msgtype,
                           java.lang.String msg)
                    throws java.io.IOException
소켓으로 메세지를 전송한다

Parameters:
msgtype -
msg -
Throws:
java.io.IOException

sendMessageNoCrLf

protected void sendMessageNoCrLf(java.lang.String msgtype,
                                 java.lang.String msg)
                          throws java.io.IOException
소켓으로 메세지를 전송한다. sendMessage()와 다른점은 메세지 끝에 \r\n이 따라 붙지 않는다는 점이다.

Parameters:
msgtype -
msg -
Throws:
java.io.IOException

readLine

protected java.lang.String readLine()
                             throws java.io.IOException
NS서버로부터 오는메세지 한줄을 읽는다. synchronized 되어있기때문에 사용시 주의를 요한다

Returns:
Throws:
java.io.IOException

read

protected java.lang.String read(int size)
                         throws java.io.IOException
NS서버로부터 오는메세지를 size byte만큼 읽는다. 사용할때 size크기를 신중히 넣어야되고, 이것또한 synchronized 되어있기때문에 사용시 주의를 요한다

Parameters:
size -
Returns:
Throws:
java.io.IOException

flushInputStream

protected void flushInputStream(java.lang.String line)
                         throws java.io.IOException
Throws:
java.io.IOException

recv

protected java.lang.String recv()
                         throws java.io.IOException
Throws:
java.io.IOException

main

public static void main(java.lang.String[] args)
Parameters:
args -