01: /*
02: * Copyright (C) The Spice Group. All rights reserved.
03: *
04: * This software is published under the terms of the Spice
05: * Software License version 1.1, a copy of which has been included
06: * with this distribution in the LICENSE.txt file.
07: */
08: package org.codehaus.spice.netserve.connection.impl;
09:
10: import java.net.ServerSocket;
11: import org.codehaus.spice.netserve.connection.RequestHandler;
12:
13: /**
14: * A utility class that contains acceptor configuration.
15: *
16: * @author Peter Donald
17: * @version $Revision: 1.2 $ $Date: 2004/03/21 23:42:58 $
18: */
19: class AcceptorConfig {
20: /**
21: * The name of the connection.
22: */
23: private final String m_name;
24:
25: /**
26: * The ServerSocket that we are accepting connections from.
27: */
28: private final ServerSocket m_serverSocket;
29:
30: /**
31: * The ConnectionHandlerManager that we create ConnectionHandlers from.
32: */
33: private final RequestHandler m_handler;
34:
35: /**
36: * Create the acceptor.
37: *
38: * @param name the name that connection was registered using
39: * @param serverSocket the ServerSocket that used to accept connections
40: * @param handler the handler for new connections
41: */
42: AcceptorConfig(final String name, final ServerSocket serverSocket,
43: final RequestHandler handler) {
44: if (null == name) {
45: throw new NullPointerException("name");
46: }
47: if (null == serverSocket) {
48: throw new NullPointerException("serverSocket");
49: }
50: if (null == handler) {
51: throw new NullPointerException("handler");
52: }
53: m_name = name;
54: m_serverSocket = serverSocket;
55: m_handler = handler;
56: }
57:
58: /**
59: * Return the name acceptor registered under.
60: *
61: * @return the name acceptor registered under.
62: */
63: String getName() {
64: return m_name;
65: }
66:
67: /**
68: * Return the socket that connections accepted from.
69: *
70: * @return the socket that connections accepted from.
71: */
72: ServerSocket getServerSocket() {
73: return m_serverSocket;
74: }
75:
76: /**
77: * Return the handler the connections are handled by.
78: *
79: * @return the handler the connections are handled by.
80: */
81: RequestHandler getHandler() {
82: return m_handler;
83: }
84: }
|