net.officefloor.plugin.socket.server.impl
Class AbstractServerSocketManagedObjectSource<CH extends ConnectionHandler>

java.lang.Object
  extended by net.officefloor.frame.spi.managedobject.source.impl.AbstractAsyncManagedObjectSource<D,F>
      extended by net.officefloor.frame.spi.managedobject.source.impl.AbstractManagedObjectSource<None,Indexed>
          extended by net.officefloor.plugin.socket.server.impl.AbstractServerSocketManagedObjectSource<CH>
All Implemented Interfaces:
ManagedObjectSource<None,Indexed>
Direct Known Subclasses:
HttpServerSocketManagedObjectSource, HttpsServerSocketManagedObjectSource, SecureTcpServerSocketManagedObjectSource, TcpServerSocketManagedObjectSource

public abstract class AbstractServerSocketManagedObjectSource<CH extends ConnectionHandler>
extends AbstractManagedObjectSource<None,Indexed>

Abstract ManagedObjectSource for a ServerSocketChannel.

Author:
Daniel Sagenschneider

Nested Class Summary
 
Nested classes/interfaces inherited from class net.officefloor.frame.spi.managedobject.source.impl.AbstractAsyncManagedObjectSource
AbstractAsyncManagedObjectSource.Labeller, AbstractAsyncManagedObjectSource.MetaDataContext<D extends Enum<D>,F extends Enum<F>>, AbstractAsyncManagedObjectSource.SpecificationContext
 
Field Summary
static String PROPERTY_BUFFER_SIZE
          Buffer size property name.
static String PROPERTY_MAXIMUM_CONNECTIONS_PER_LISTENER
          Maximum connections property name.
static String PROPERTY_PORT
          Port property name.
 
Constructor Summary
AbstractServerSocketManagedObjectSource()
          Default constructor necessary as per ManagedObjectSource.
 
Method Summary
protected abstract  CommunicationProtocol<CH> createCommunicationProtocol()
          Creates the CommunicationProtocol.
protected  CommunicationProtocol<CH> createWrappingCommunicationProtocol(CommunicationProtocol<CH> communicationProtocol)
           Creates a wrapping CommunicationProtocol around the input CommunicationProtocol.
protected  ManagedObject getManagedObject()
           
protected  void loadMetaData(AbstractAsyncManagedObjectSource.MetaDataContext<None,Indexed> context)
           
protected  void loadSpecification(AbstractAsyncManagedObjectSource.SpecificationContext context)
           
 void start(ManagedObjectExecuteContext<Indexed> context)
           
 void stop()
           
 
Methods inherited from class net.officefloor.frame.spi.managedobject.source.impl.AbstractManagedObjectSource
sourceManagedObject
 
Methods inherited from class net.officefloor.frame.spi.managedobject.source.impl.AbstractAsyncManagedObjectSource
getMetaData, getSpecification, init
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PROPERTY_PORT

public static final String PROPERTY_PORT
Port property name.

See Also:
Constant Field Values

PROPERTY_BUFFER_SIZE

public static final String PROPERTY_BUFFER_SIZE
Buffer size property name.

See Also:
Constant Field Values

PROPERTY_MAXIMUM_CONNECTIONS_PER_LISTENER

public static final String PROPERTY_MAXIMUM_CONNECTIONS_PER_LISTENER
Maximum connections property name.

See Also:
Constant Field Values
Constructor Detail

AbstractServerSocketManagedObjectSource

public AbstractServerSocketManagedObjectSource()
Default constructor necessary as per ManagedObjectSource.

Method Detail

createCommunicationProtocol

protected abstract CommunicationProtocol<CH> createCommunicationProtocol()
Creates the CommunicationProtocol.

Returns:
CommunicationProtocol.

createWrappingCommunicationProtocol

protected CommunicationProtocol<CH> createWrappingCommunicationProtocol(CommunicationProtocol<CH> communicationProtocol)

Creates a wrapping CommunicationProtocol around the input CommunicationProtocol.

An example would be to add SSL CommunicationProtocol.

This default implementation returns the input CommunicationProtocol as is.

Parameters:
communicationProtocol - CommunicationProtocol to possibly wrap.
Returns:
This default implementation returns the input CommunicationProtocol (no wrapping).

loadSpecification

protected void loadSpecification(AbstractAsyncManagedObjectSource.SpecificationContext context)
Specified by:
loadSpecification in class AbstractAsyncManagedObjectSource<None,Indexed>

loadMetaData

protected void loadMetaData(AbstractAsyncManagedObjectSource.MetaDataContext<None,Indexed> context)
                     throws Exception
Specified by:
loadMetaData in class AbstractAsyncManagedObjectSource<None,Indexed>
Throws:
Exception

start

public void start(ManagedObjectExecuteContext<Indexed> context)
           throws Exception
Specified by:
start in interface ManagedObjectSource<None,Indexed>
Overrides:
start in class AbstractAsyncManagedObjectSource<None,Indexed>
Throws:
Exception

getManagedObject

protected ManagedObject getManagedObject()
                                  throws Throwable
Specified by:
getManagedObject in class AbstractManagedObjectSource<None,Indexed>
Throws:
Throwable

stop

public void stop()
Specified by:
stop in interface ManagedObjectSource<None,Indexed>
Overrides:
stop in class AbstractAsyncManagedObjectSource<None,Indexed>


Copyright © 2005-2011. All Rights Reserved.