01: /*
02: * Copyright (c) 2002 by Matt Welsh and The Regents of the University of
03: * California. All rights reserved.
04: *
05: * Permission to use, copy, modify, and distribute this software and its
06: * documentation for any purpose, without fee, and without written agreement is
07: * hereby granted, provided that the above copyright notice and the following
08: * two paragraphs appear in all copies of this software.
09: *
10: * IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR
11: * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
12: * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
13: * CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
14: *
15: * THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
16: * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
17: * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
18: * ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO
19: * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
20: *
21: * Author: Matt Welsh <mdw@cs.berkeley.edu>
22: *
23: */
24:
25: package seda.sandStorm.lib.aSocket.nbio;
26:
27: import java.io.*;
28: import seda.nbio.*;
29: import seda.sandStorm.api.*;
30: import seda.sandStorm.lib.aSocket.*;
31: import java.net.*;
32:
33: /**
34: * The NBIO implementation of aSocketImplFactory.
35: *
36: * @author Matt Welsh
37: */
38: public class NBIOFactory extends aSocketImplFactory {
39: private static final boolean DEBUG = false;
40:
41: protected SelectSourceIF newSelectSource() {
42: return new SelectSource();
43: }
44:
45: protected seda.sandStorm.lib.aSocket.SelectQueueElement newSelectQueueElement(
46: Object item) {
47: return new seda.sandStorm.lib.aSocket.nbio.SelectQueueElement(
48: (SelectItem) item);
49: }
50:
51: protected seda.sandStorm.lib.aSocket.SockState newSockState(
52: ATcpConnection conn, Socket nbsock, int writeClogThreshold)
53: throws IOException {
54: return new seda.sandStorm.lib.aSocket.nbio.SockState(conn,
55: nbsock, writeClogThreshold);
56: }
57:
58: protected seda.sandStorm.lib.aSocket.ConnectSockState newConnectSockState(
59: ATcpConnectRequest req, SelectSourceIF selsource)
60: throws IOException {
61: return new seda.sandStorm.lib.aSocket.nbio.ConnectSockState(
62: req, selsource);
63: }
64:
65: protected seda.sandStorm.lib.aSocket.ListenSockState newListenSockState(
66: ATcpListenRequest req, SelectSourceIF selsource)
67: throws IOException {
68: return new seda.sandStorm.lib.aSocket.nbio.ListenSockState(req,
69: selsource);
70: }
71:
72: protected seda.sandStorm.lib.aSocket.DatagramSockState newDatagramSockState(
73: AUdpSocket sock, InetAddress addr, int port)
74: throws IOException {
75: return new seda.sandStorm.lib.aSocket.nbio.DatagramSockState(
76: sock, addr, port);
77: }
78:
79: }
|