Mercurial > hg > RemoteEditor > REPSessionManager
view rep/channel/ServerChannelSimulator.java @ 194:be219ba8b39c
*** empty log message ***
author | kono |
---|---|
date | Fri, 29 Aug 2008 20:25:46 +0900 |
parents | 5653cf8e3c8b |
children | 4c0a94836357 |
line wrap: on
line source
package rep.channel; import java.io.IOException; import java.net.ServerSocket; import java.net.SocketAddress; import java.nio.channels.ClosedChannelException; import java.nio.channels.SelectableChannel; import java.nio.channels.SelectionKey; import java.nio.channels.Selector; import java.nio.channels.SocketChannel; import java.nio.channels.spi.SelectorProvider; /* シミュレーションの際にコンストラクトされる REPServerSocketChannel の実装 */ public class ServerChannelSimulator<P>extends REPServerSocketChannel<P> { protected NetworkSimulator<P> ns; //public REPServerSocket<REPSocketChannel<P>> socket; protected SocketAddress IP; /** Constructors. * @throws IOException */ public ServerChannelSimulator() throws IOException { //socket = REPServerSocket.<REPSocketChannel<P>>create(); ns = NetworkSimulator.<P>singleton(); } public void bind(SocketAddress ip){ IP = ip; } public REPSocketChannel<P> accept1() /*throws IOException*/ { return ns.accept(IP); } public ServerSocket socket() { try { return new REPServerSocket(this); } catch (IOException e) { e.printStackTrace(); return null; } } public SelectionKey register(REPSelector<P> sel, int ops, Object att) throws ClosedChannelException { REPSelector<P> selector = sel; ns.listen(IP, (SelectorSimulator) selector); return selector.register(this, ops, att); } public boolean isAcceptable() { return ns.canAccept(IP); } @Override public Object blockingLock() { // TODO Auto-generated method stub return null; } public SelectableChannel configureBlocking(boolean block) throws IOException { // TODO Auto-generated method stub return null; } @Override public boolean isBlocking() { // TODO Auto-generated method stub return false; } @Override public boolean isRegistered() { // TODO Auto-generated method stub return false; } @Override public SelectionKey keyFor(Selector sel) { // TODO Auto-generated method stub return null; } @Override public SelectorProvider provider() { // TODO Auto-generated method stub return null; } @Override public SelectionKey register(Selector sel, int ops, Object att) throws ClosedChannelException { // TODO Auto-generated method stub return null; } @Override public int validOps() { // TODO Auto-generated method stub return 0; } @Override protected void implCloseChannel() throws IOException { // TODO Auto-generated method stub } }