001: /*
002: * <copyright>
003: *
004: * Copyright 1997-2004 BBNT Solutions, LLC
005: * under sponsorship of the Defense Advanced Research Projects
006: * Agency (DARPA).
007: *
008: * You can redistribute this software and/or modify it under the
009: * terms of the Cougaar Open Source License as published on the
010: * Cougaar Open Source Website (www.cougaar.org).
011: *
012: * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
013: * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
014: * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
015: * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
016: * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
017: * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
018: * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
019: * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
020: * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
021: * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
022: * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
023: *
024: * </copyright>
025: */
026:
027: package org.cougaar.mts.base;
028:
029: import java.net.InetAddress;
030: import java.net.ServerSocket;
031: import java.net.Socket;
032: import java.net.SocketAddress;
033: import java.net.SocketException;
034: import java.nio.channels.ServerSocketChannel;
035:
036: /**
037: * This class is a delegating {@link ServerSocket} that simply passes
038: * all methods to another socket. It's handy as a base class for
039: * whatever wrapper class, if any, the {@link SocketFactory} is using.
040: */
041: public abstract class ServerSocketWrapper extends ServerSocket {
042: private ServerSocket delegate;
043:
044: public ServerSocketWrapper() throws java.io.IOException {
045: }
046:
047: public void setDelegate(ServerSocket delegate) {
048: this .delegate = delegate;
049: }
050:
051: protected ServerSocket getDelegate() {
052: return delegate;
053: }
054:
055: public InetAddress getInetAddress() {
056: return delegate.getInetAddress();
057: }
058:
059: public int getLocalPort() {
060: return delegate.getLocalPort();
061: }
062:
063: public int getSoTimeout() throws java.io.IOException {
064: return delegate.getSoTimeout();
065: }
066:
067: public void setInetAddress(int to) throws java.net.SocketException {
068: delegate.setSoTimeout(to);
069: }
070:
071: public Socket accept() throws java.io.IOException {
072: return delegate.accept();
073: }
074:
075: public void close() throws java.io.IOException {
076: delegate.close();
077: }
078:
079: public String toString() {
080: return delegate.toString();
081: }
082:
083: public void bind(SocketAddress endpoint) throws java.io.IOException {
084: delegate.bind(endpoint);
085: }
086:
087: public void bind(SocketAddress endpoint, int backlog)
088: throws java.io.IOException {
089: delegate.bind(endpoint, backlog);
090: }
091:
092: public ServerSocketChannel getChannel() {
093: return delegate.getChannel();
094: }
095:
096: public SocketAddress getLocalSocketAddress() {
097: return delegate.getLocalSocketAddress();
098: }
099:
100: public int getReceiveBufferSize() throws SocketException {
101: return delegate.getReceiveBufferSize();
102: }
103:
104: public boolean getReuseAddress() throws SocketException {
105: return delegate.getReuseAddress();
106: }
107:
108: public boolean isBound() {
109: return delegate.isBound();
110: }
111:
112: public boolean isClosed() {
113: return delegate.isClosed();
114: }
115:
116: public void setReceiveBufferSize(int size) throws SocketException {
117: delegate.setReceiveBufferSize(size);
118: }
119:
120: public void setReuseAddress(boolean on) throws SocketException {
121: delegate.setReuseAddress(on);
122: }
123:
124: }
|