package org.playorm.nio.impl.cm.readreg; import java.io.IOException; import org.playorm.nio.api.channels.DatagramChannel; import org.playorm.nio.api.channels.TCPChannel; import org.playorm.nio.api.channels.TCPServerChannel; import org.playorm.nio.api.channels.UDPChannel; import org.playorm.nio.api.deprecated.ChannelService; import org.playorm.nio.api.deprecated.Settings; /** * @author Dean Hiller */ class RegChannelService implements ChannelService { private ChannelService mgr; public RegChannelService(Object id, ChannelService manager) { this.mgr = manager; } public TCPServerChannel createTCPServerChannel(String id, Settings h) throws IOException { TCPServerChannel channel = mgr.createTCPServerChannel(id, h); return new RegTCPServerChannel(channel); } public TCPChannel createTCPChannel(String id, Settings h) throws IOException { TCPChannel realChannel = mgr.createTCPChannel(id, h); return new RegTCPChannel(realChannel); } public UDPChannel createUDPChannel(String id, Settings h) throws IOException { UDPChannel realChannel = mgr.createUDPChannel(id, h); UDPChannel channel = new RegUDPChannel(realChannel); return channel; } public DatagramChannel createDatagramChannel(String id, int bufferSize) throws IOException { return mgr.createDatagramChannel(id, bufferSize); } public void start() throws IOException { mgr.start(); } public void stop() throws IOException, InterruptedException { mgr.stop(); } }