/protocols/ss7/hardware/dahdi/java/src/main/java/org/mobicents/ss7/hardware/dahdi/SelectorKeyImpl.java
Java | 86 lines | 40 code | 17 blank | 29 comment | 0 complexity | 54b98de7dfb86b653cfd2d66cb1c023d MD5 | raw file
1/* 2 * JBoss, Home of Professional Open Source 3 * Copyright 2011, Red Hat, Inc. and individual contributors 4 * by the @authors tag. See the copyright.txt in the distribution for a 5 * full listing of individual contributors. 6 * 7 * This is free software; you can redistribute it and/or modify it 8 * under the terms of the GNU Lesser General Public License as 9 * published by the Free Software Foundation; either version 2.1 of 10 * the License, or (at your option) any later version. 11 * 12 * This software is distributed in the hope that it will be useful, 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 * Lesser General Public License for more details. 16 * 17 * You should have received a copy of the GNU Lesser General Public 18 * License along with this software; if not, write to the Free 19 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 20 * 02110-1301 USA, or see the FSF site: http://www.fsf.org. 21 */ 22 23/* 24 * To change this template, choose Tools | Templates 25 * and open the template in the editor. 26 */ 27 28package org.mobicents.ss7.hardware.dahdi; 29 30import org.mobicents.protocols.stream.api.SelectorKey; 31import org.mobicents.protocols.stream.api.Stream; 32import org.mobicents.protocols.stream.api.StreamSelector; 33 34/** 35 * 36 * @author kulikov 37 */ 38public class SelectorKeyImpl implements SelectorKey { 39 40 private boolean isValid; 41 private boolean isReadable; 42 private boolean isWritable; 43 44 private Channel channel; 45 private Selector selector; 46 47 private Object attachment; 48 49 protected SelectorKeyImpl(Channel channel, Selector selector) { 50 this.channel = channel; 51 this.selector = selector; 52 } 53 54 public boolean isValid() { 55 throw new UnsupportedOperationException("Not supported yet."); 56 } 57 58 public boolean isReadable() { 59 return isReadable; 60 } 61 62 public boolean isWriteable() { 63 return isWritable; 64 } 65 66 public Stream getStream() { 67 return channel; 68 } 69 70 public StreamSelector getStreamSelector() { 71 return selector; 72 } 73 74 public void cancel() { 75 selector.unregister(channel); 76 } 77 78 public void attach(Object obj) { 79 this.attachment = obj; 80 } 81 82 public Object attachment() { 83 return this.attachment; 84 } 85 86}