001 /**
002 * Copyright (C) 2012 FuseSource, Inc.
003 * http://fusesource.com
004 *
005 * Licensed under the Apache License, Version 2.0 (the "License");
006 * you may not use this file except in compliance with the License.
007 * You may obtain a copy of the License at
008 *
009 * http://www.apache.org/licenses/LICENSE-2.0
010 *
011 * Unless required by applicable law or agreed to in writing, software
012 * distributed under the License is distributed on an "AS IS" BASIS,
013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014 * See the License for the specific language governing permissions and
015 * limitations under the License.
016 */
017 package org.fusesource.hawtdispatch.transport;
018
019 import org.fusesource.hawtdispatch.DispatchQueue;
020 import org.fusesource.hawtdispatch.Task;
021
022 import java.net.SocketAddress;
023 import java.nio.channels.ReadableByteChannel;
024 import java.nio.channels.WritableByteChannel;
025 import java.util.concurrent.Executor;
026
027 /**
028 */
029 public class TransportFilter implements Transport {
030
031 final Transport next;
032
033 public TransportFilter(Transport next) {
034 this.next = next;
035 }
036
037 public void flush() {
038 next.flush();
039 }
040
041 public boolean full() {
042 return next.full();
043 }
044
045 public Executor getBlockingExecutor() {
046 return next.getBlockingExecutor();
047 }
048
049 public DispatchQueue getDispatchQueue() {
050 return next.getDispatchQueue();
051 }
052
053 public SocketAddress getLocalAddress() {
054 return next.getLocalAddress();
055 }
056
057 public ProtocolCodec getProtocolCodec() {
058 return next.getProtocolCodec();
059 }
060
061 public ReadableByteChannel getReadChannel() {
062 return next.getReadChannel();
063 }
064
065 public SocketAddress getRemoteAddress() {
066 return next.getRemoteAddress();
067 }
068
069 public TransportListener getTransportListener() {
070 return next.getTransportListener();
071 }
072
073 public WritableByteChannel getWriteChannel() {
074 return next.getWriteChannel();
075 }
076
077 public boolean isClosed() {
078 return next.isClosed();
079 }
080
081 public boolean isConnected() {
082 return next.isConnected();
083 }
084
085 public boolean offer(Object command) {
086 return next.offer(command);
087 }
088
089 public void resumeRead() {
090 next.resumeRead();
091 }
092
093 public void setBlockingExecutor(Executor blockingExecutor) {
094 next.setBlockingExecutor(blockingExecutor);
095 }
096
097 public void setDispatchQueue(DispatchQueue queue) {
098 next.setDispatchQueue(queue);
099 }
100
101 public void setProtocolCodec(ProtocolCodec protocolCodec) throws Exception {
102 next.setProtocolCodec(protocolCodec);
103 }
104
105 public void setTransportListener(TransportListener transportListener) {
106 next.setTransportListener(transportListener);
107 }
108
109 public void start(Runnable onComplete) {
110 next.start(onComplete);
111 }
112
113 public void start(Task onComplete) {
114 next.start(onComplete);
115 }
116
117 public void stop(Runnable onComplete) {
118 next.stop(onComplete);
119 }
120
121 public void stop(Task onComplete) {
122 next.stop(onComplete);
123 }
124
125 public void suspendRead() {
126 next.suspendRead();
127 }
128
129 public void drainInbound() {
130 next.drainInbound();
131 }
132 }