1 /*
2 * Copyright (C) The Spice Group. All rights reserved.
3 *
4 * This software is published under the terms of the Spice
5 * Software License version 1.1, a copy of which has been included
6 * with this distribution in the LICENSE.txt file.
7 */
8 package org.jcomponent.netserve.sockets.impl;
9
10 import java.net.ServerSocket;
11 import org.jcomponent.netserve.connection.ConnectionHandler;
12
13 /***
14 * A utility class that contains acceptor configuration.
15 *
16 * @author <a href="mailto:peter at realityforge.org">Peter Donald</a>
17 * @version $Revision: 1.3 $ $Date: 2003/10/24 07:59:43 $
18 */
19 class AcceptorConfig
20 {
21 /***
22 * The name of the connection.
23 */
24 private final String m_name;
25
26 /***
27 * The ServerSocket that we are accepting connections from.
28 */
29 private final ServerSocket m_serverSocket;
30
31 /***
32 * The ConnectionHandlerManager that we create ConnectionHandlers from.
33 */
34 private final ConnectionHandler m_handler;
35
36 /***
37 * Create the acceptor.
38 *
39 * @param name the name that connection was registered using
40 * @param serverSocket the ServerSocket that used to accept connections
41 * @param handler the handler for new connections
42 */
43 AcceptorConfig( final String name,
44 final ServerSocket serverSocket,
45 final ConnectionHandler handler )
46 {
47 if( null == name )
48 {
49 throw new NullPointerException( "name" );
50 }
51 if( null == serverSocket )
52 {
53 throw new NullPointerException( "serverSocket" );
54 }
55 if( null == handler )
56 {
57 throw new NullPointerException( "handler" );
58 }
59 m_name = name;
60 m_serverSocket = serverSocket;
61 m_handler = handler;
62 }
63
64 /***
65 * Return the name acceptor registered under.
66 *
67 * @return the name acceptor registered under.
68 */
69 String getName()
70 {
71 return m_name;
72 }
73
74 /***
75 * Return the socket that connections accepted from.
76 *
77 * @return the socket that connections accepted from.
78 */
79 ServerSocket getServerSocket()
80 {
81 return m_serverSocket;
82 }
83
84 /***
85 * Return the handler the connections are handled by.
86 *
87 * @return the handler the connections are handled by.
88 */
89 ConnectionHandler getHandler()
90 {
91 return m_handler;
92 }
93 }
This page was automatically generated by Maven