com.poscoict.glueframework.scheduling.server
Class GlueServerHandler

java.lang.Object
  extended by org.apache.mina.common.IoHandlerAdapter
      extended by com.poscoict.glueframework.scheduling.server.GlueServerHandler
All Implemented Interfaces:
org.apache.mina.common.IoHandler

public class GlueServerHandler
extends org.apache.mina.common.IoHandlerAdapter

GlueSchedulerHttpServer°¡ ¹ÞÀº Request Á¤º¸¸¦ ±â¹ÝÀ¸·Î JobÀ» ó¸®ÇÏ´Â Çڵ鷯 Ŭ·¡½º.


Field Summary
static int DEFAULT_IDLE_TIME
          µðÆúÆ® ¼¼¼Ç Idle ½Ã°£ (´ÜÀ§, ÃÊ)
protected static String PARAM_HEADER
          Job Parameter Header
 
Constructor Summary
GlueServerHandler()
           
GlueServerHandler(GlueJobEventReceiver jobEvent)
           
 
Method Summary
protected  GlueJobDefinition createJobDefinition(GlueHttpRequestMessage message)
          GlueHttpRequestMessage·ÎºÎÅÍ Job DefinitionÀ» »ý¼ºÇÑ´Ù. - JobName, RequestId, ClientIp - Job Parameters Á¤º¸ ¼³Á¤
 void exceptionCaught(org.apache.mina.common.IoSession session, Throwable cause)
           
protected  String executeJob(GlueJobDefinition jobdef)
          ÇØ´ç Scheduled JobÀ» ±âµ¿ÇÑ´Ù.
protected  void loggingRequestMessage(org.apache.mina.common.IoSession session, Object message)
          IoSession Á¤º¸¿Í GlueHttpRequestMessage Á¤º¸¸¦ ·Î±ëÇÑ´Ù.
 void messageReceived(org.apache.mina.common.IoSession session, Object message)
          GlueGlueSchedulerHttpServer°¡ ¸Þ½ÃÁö(HttpRequest)¸¦ ¹ÞÀ» ¶§ È£ÃâµÇ´Â callback ¸Þ¼Òµå.
 void sessionIdle(org.apache.mina.common.IoSession session, org.apache.mina.common.IdleStatus status)
           
 void sessionOpened(org.apache.mina.common.IoSession session)
          ¼¼¼Ç ¿ÀÇ ½Ã callback ¸Þ¼Òµå.
 void setJobEvent(GlueJobEventReceiver jobEvent)
           
 
Methods inherited from class org.apache.mina.common.IoHandlerAdapter
messageSent, sessionClosed, sessionCreated
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_IDLE_TIME

public static final int DEFAULT_IDLE_TIME
µðÆúÆ® ¼¼¼Ç Idle ½Ã°£ (´ÜÀ§, ÃÊ)

See Also:
Constant Field Values

PARAM_HEADER

protected static final String PARAM_HEADER
Job Parameter Header

See Also:
Constant Field Values
Constructor Detail

GlueServerHandler

public GlueServerHandler()

GlueServerHandler

public GlueServerHandler(GlueJobEventReceiver jobEvent)
Method Detail

sessionOpened

public void sessionOpened(org.apache.mina.common.IoSession session)
¼¼¼Ç ¿ÀÇ ½Ã callback ¸Þ¼Òµå. ¼¼¼Ç IDEL ½Ã°£À» ¼³Á¤ÇÑ´Ù. (µðÆúÆ® 1ºÐ)

Specified by:
sessionOpened in interface org.apache.mina.common.IoHandler
Overrides:
sessionOpened in class org.apache.mina.common.IoHandlerAdapter
Parameters:
session - IoSession

loggingRequestMessage

protected void loggingRequestMessage(org.apache.mina.common.IoSession session,
                                     Object message)
IoSession Á¤º¸¿Í GlueHttpRequestMessage Á¤º¸¸¦ ·Î±ëÇÑ´Ù. (µð¹ö±× ·¹º§ÀÎ °æ¿ì¸¸)

Parameters:
session - IoSession
message - GlueHttpRequestMessage

executeJob

protected String executeJob(GlueJobDefinition jobdef)
ÇØ´ç Scheduled JobÀ» ±âµ¿ÇÑ´Ù.

Parameters:
jobdef - Job Definition Á¤º¸
Returns:
¼º°ø ½Ã "success"

createJobDefinition

protected GlueJobDefinition createJobDefinition(GlueHttpRequestMessage message)
GlueHttpRequestMessage·ÎºÎÅÍ Job DefinitionÀ» »ý¼ºÇÑ´Ù. - JobName, RequestId, ClientIp - Job Parameters Á¤º¸ ¼³Á¤

Parameters:
message - GlueHttpRequestMessage
Returns:
»ý¼ºµÈ JobDefinition

messageReceived

public void messageReceived(org.apache.mina.common.IoSession session,
                            Object message)
GlueGlueSchedulerHttpServer°¡ ¸Þ½ÃÁö(HttpRequest)¸¦ ¹ÞÀ» ¶§ È£ÃâµÇ´Â callback ¸Þ¼Òµå. ¸Þ½ÃÁö·ÎºÎÅÍ JobDefinitionÀ» »ý¼ºÇÑ ÈÄ JobEventReicever¸¦ ÀÌ¿ëÇÏ¿© ÇØ´ç Scheduled JobÀ» ±âµ¿ÇÑ´Ù. Job ½ÇÇà µî·ÏÀÌ Á¤»óÀûÀ¸·Î ÀÌ·ç¾îÁö¸é Response¿¡ "success"°¡ ¼³Á¤µÇ°í StatusCode´Â GlueHttpResponseMessage.STATUS_JOB_SUCCESS °ª(700)ÀÌ ¼³Á¤µÈ´Ù. ¹Ý´ë·Î µî·Ï¿¡ ½ÇÆÐÇϸé "failure"°¡ ¼³Á¤µÇ°í StatusCode´Â GlueHttpResponseMessage.STATUS_JOB_ERROR °ª(800)ÀÌ ¼³Á¤µÈ´Ù. TODO: job state È®ÀÎ ÈÄ ÇØ´ç ¸®ÅÏ ÄÚµå ÀÀ´äÇÏ´Â ·ÎÁ÷ Ãß°¡ - catch GlueAlreadyCompletedJobException, GlueAlreadyRunningJobException

Specified by:
messageReceived in interface org.apache.mina.common.IoHandler
Overrides:
messageReceived in class org.apache.mina.common.IoHandlerAdapter
Parameters:
session - IoSession
message - GlueHttpRequestMessage

setJobEvent

public void setJobEvent(GlueJobEventReceiver jobEvent)

sessionIdle

public void sessionIdle(org.apache.mina.common.IoSession session,
                        org.apache.mina.common.IdleStatus status)
Specified by:
sessionIdle in interface org.apache.mina.common.IoHandler
Overrides:
sessionIdle in class org.apache.mina.common.IoHandlerAdapter

exceptionCaught

public void exceptionCaught(org.apache.mina.common.IoSession session,
                            Throwable cause)
Specified by:
exceptionCaught in interface org.apache.mina.common.IoHandler
Overrides:
exceptionCaught in class org.apache.mina.common.IoHandlerAdapter


Copyright © 2013–2014 POSCO ICT SWÁ¦Ç°±â¼úÆÀ. All rights reserved.