org.tubo.resource.consumer.serversocketlinereader
Class ServerSocketLineReaderConsumer

java.lang.Object
  extended by org.tubo.resource.baseimpl.BaseResourceImpl
      extended by org.tubo.resource.consumer.BaseConsumerImpl
          extended by org.tubo.resource.consumer.serversocket.ServerSocketConsumer
              extended by org.tubo.resource.consumer.serversocketlinereader.ServerSocketLineReaderConsumer
All Implemented Interfaces:
Consumer, Resource

public class ServerSocketLineReaderConsumer
extends ServerSocketConsumer

This class is a Consumer Component based on ServerSocket. When the connection is established on ServerSocketConsumerWorker this class call process(Socket) on ServerSocketConsumer which is overwited by this class. When a process(Socket) is call, streams are opened and delegate procesing to process(InputStream,OutputStream). In this method tree event are throw:

  • The method process(Socket) is override by this class,

    Created: Oct 19, 2006, 6:12:44 PM
    Last Modification Date: $Date: 2006-11-08 11:06:59 -0300 (Wed, 08 Nov 2006) $

    Version:
    $Revision: 55 $
    Author:
    maldito_orco (maldito_orco@users.sourceforge.net)

    Field Summary
    static java.lang.String GOODBYE_EVENT
               
    static java.lang.String RCS_ID
               
    static java.lang.String READ_LINE_EVENT
               
    static java.lang.String SERVERSOCKET_LINE_READER_INPUT_PROPERTY
               
    static java.lang.String SERVERSOCKET_LINE_READER_OUTPUT_PROPERTY
               
     
    Fields inherited from class org.tubo.resource.consumer.serversocket.ServerSocketConsumer
    NEW_CONNECTION_EVENT
     
    Constructor Summary
    ServerSocketLineReaderConsumer()
               
     
    Method Summary
    protected  Item createItem()
              Override this method to create only one item.
    protected  void postOriginFlowEvent(FlowContext flowContext)
              Hook from consumer life cycle called after listener execution.
    protected  void preOriginFlowEvent(FlowContext flowContext)
              Hook from consumer life cycle called before listener execution.
     void process(java.io.InputStream is, java.io.OutputStream os)
               Streams Procesing.
     void process(java.net.Socket socket)
               Override normal ServerSocketConsumer behavior.
     
    Methods inherited from class org.tubo.resource.consumer.BaseConsumerImpl
    createEvent, createFlowContext, dispatchOriginFlowEvent, doConsumerLifeCycle, initializeEvent, initializeItem, setListener
     
    Methods inherited from class org.tubo.resource.baseimpl.BaseResourceImpl
    getId, getProperties, getProperty, getResourceManager, setId, setProperties, setProperty, setResourceManager
     
    Methods inherited from class java.lang.Object
    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
     
    Methods inherited from interface org.tubo.resource.consumer.Consumer
    getId
     

    Field Detail

    RCS_ID

    public static final java.lang.String RCS_ID
    See Also:
    Constant Field Values

    SERVERSOCKET_LINE_READER_INPUT_PROPERTY

    public static final java.lang.String SERVERSOCKET_LINE_READER_INPUT_PROPERTY
    See Also:
    Constant Field Values

    SERVERSOCKET_LINE_READER_OUTPUT_PROPERTY

    public static final java.lang.String SERVERSOCKET_LINE_READER_OUTPUT_PROPERTY
    See Also:
    Constant Field Values

    READ_LINE_EVENT

    public static final java.lang.String READ_LINE_EVENT
    See Also:
    Constant Field Values

    GOODBYE_EVENT

    public static final java.lang.String GOODBYE_EVENT
    See Also:
    Constant Field Values
    Constructor Detail

    ServerSocketLineReaderConsumer

    public ServerSocketLineReaderConsumer()
    Method Detail

    process

    public void process(java.net.Socket socket)
                 throws TuboConsumerException

    Override normal ServerSocketConsumer behavior. On this implementation obtains in and out streams. Delegate the stream procesing on other method.

    Overrides:
    process in class ServerSocketConsumer
    Parameters:
    socket - A new socket open from client
    Throws:
    TuboConsumerException - When geting InputStream or OutputStream from socket

    process

    public void process(java.io.InputStream is,
                        java.io.OutputStream os)
                 throws TuboConsumerException

    Streams Procesing.

    Parameters:
    is - Socket input
    os - Socket output
    Throws:
    TuboConsumerException

    createItem

    protected Item createItem()
    Override this method to create only one item. To create the item the super method is used.

    Overrides:
    createItem in class BaseConsumerImpl
    Returns:
    The item TODO: move this behavior to BaseConsumerImpl...

    preOriginFlowEvent

    protected void preOriginFlowEvent(FlowContext flowContext)
    Hook from consumer life cycle called before listener execution. This method have the responsability of set input line like a item property.

    Overrides:
    preOriginFlowEvent in class BaseConsumerImpl
    Parameters:
    flowContext - The flowContext

    postOriginFlowEvent

    protected void postOriginFlowEvent(FlowContext flowContext)
    Hook from consumer life cycle called after listener execution.

    Overrides:
    postOriginFlowEvent in class BaseConsumerImpl
    Parameters:
    flowContext - The item


    Copyright © 2004-2007 Tubo. All Rights Reserved.