Revision: 16028
Author: [email protected]
Date: Thu Dec 23 05:28:38 2010
Log: rebamed provider and key
http://code.google.com/p/mobicents/source/detail?r=16028
Added:
/trunk/protocols/ss7/management/shell/src/main/java/org/mobicents/ss7/management/transceiver/ChannelProvider.java
/trunk/protocols/ss7/management/shell/src/main/java/org/mobicents/ss7/management/transceiver/ChannelSelectionKey.java
Deleted:
/trunk/protocols/ss7/management/shell/src/main/java/org/mobicents/ss7/management/transceiver/ShellProvider.java
/trunk/protocols/ss7/management/shell/src/main/java/org/mobicents/ss7/management/transceiver/ShellSelectionKey.java
Modified:
/trunk/protocols/ss7/management/shell/src/main/java/org/mobicents/ss7/management/transceiver/ChannelSelector.java
/trunk/protocols/ss7/management/shell/src/main/java/org/mobicents/ss7/management/transceiver/ShellChannel.java
/trunk/protocols/ss7/management/shell/src/main/java/org/mobicents/ss7/management/transceiver/ShellSelectableChannel.java
/trunk/protocols/ss7/management/shell/src/main/java/org/mobicents/ss7/management/transceiver/ShellServerChannel.java
=======================================
--- /dev/null
+++
/trunk/protocols/ss7/management/shell/src/main/java/org/mobicents/ss7/management/transceiver/ChannelProvider.java
Thu Dec 23 05:28:38 2010
@@ -0,0 +1,28 @@
+package org.mobicents.ss7.management.transceiver;
+
+import java.io.IOException;
+
+public class ChannelProvider {
+
+ private MessageFactory messageFactory = new MessageFactory();
+
+ public static ChannelProvider open() {
+ return new ChannelProvider();
+ }
+
+ public ShellChannel openChannel() throws IOException {
+ return ShellChannel.open(this);
+ }
+
+ public ShellServerChannel openServerChannel() throws IOException {
+ return ShellServerChannel.open(this);
+ }
+
+ public ChannelSelector openSelector() throws IOException {
+ return ChannelSelector.open();
+ }
+
+ public MessageFactory getMessageFactory(){
+ return messageFactory;
+ }
+}
=======================================
--- /dev/null
+++
/trunk/protocols/ss7/management/shell/src/main/java/org/mobicents/ss7/management/transceiver/ChannelSelectionKey.java
Thu Dec 23 05:28:38 2010
@@ -0,0 +1,34 @@
+package org.mobicents.ss7.management.transceiver;
+
+import java.nio.channels.SelectionKey;
+
+public class ChannelSelectionKey {
+ private ShellSelectableChannel shellSelectableChannel = null;
+ private SelectionKey key = null;
+
+ protected ChannelSelectionKey(ShellSelectableChannel
shellSelectableChannel,
+ SelectionKey k) {
+ this.shellSelectableChannel = shellSelectableChannel;
+ this.key = k;
+ }
+
+ public ShellSelectableChannel channel() {
+ return shellSelectableChannel;
+ }
+
+ public boolean isAcceptable() {
+ return key.isAcceptable();
+ }
+
+ public boolean isReadable() {
+ return ((ShellChannel) shellSelectableChannel).isReadable();
+ }
+
+ public boolean isWritable() {
+ return ((ShellChannel) shellSelectableChannel).isWritable();
+ }
+
+ public void cancel() {
+ key.cancel();
+ }
+}
=======================================
---
/trunk/protocols/ss7/management/shell/src/main/java/org/mobicents/ss7/management/transceiver/ShellProvider.java
Thu Dec 23 05:19:44 2010
+++ /dev/null
@@ -1,28 +0,0 @@
-package org.mobicents.ss7.management.transceiver;
-
-import java.io.IOException;
-
-public class ShellProvider {
-
- private MessageFactory messageFactory = new MessageFactory();
-
- public static ShellProvider open() {
- return new ShellProvider();
- }
-
- public ShellChannel openChannel() throws IOException {
- return ShellChannel.open(this);
- }
-
- public ShellServerChannel openServerChannel() throws IOException {
- return ShellServerChannel.open(this);
- }
-
- public ChannelSelector openSelector() throws IOException {
- return ChannelSelector.open();
- }
-
- public MessageFactory getMessageFactory(){
- return messageFactory;
- }
-}
=======================================
---
/trunk/protocols/ss7/management/shell/src/main/java/org/mobicents/ss7/management/transceiver/ShellSelectionKey.java
Thu Dec 23 00:13:37 2010
+++ /dev/null
@@ -1,34 +0,0 @@
-package org.mobicents.ss7.management.transceiver;
-
-import java.nio.channels.SelectionKey;
-
-public class ShellSelectionKey {
- private ShellSelectableChannel shellSelectableChannel = null;
- private SelectionKey key = null;
-
- protected ShellSelectionKey(ShellSelectableChannel
shellSelectableChannel,
- SelectionKey k) {
- this.shellSelectableChannel = shellSelectableChannel;
- this.key = k;
- }
-
- public ShellSelectableChannel channel() {
- return shellSelectableChannel;
- }
-
- public boolean isAcceptable() {
- return key.isAcceptable();
- }
-
- public boolean isReadable() {
- return ((ShellChannel) shellSelectableChannel).isReadable();
- }
-
- public boolean isWritable() {
- return ((ShellChannel) shellSelectableChannel).isWritable();
- }
-
- public void cancel() {
- key.cancel();
- }
-}
=======================================
---
/trunk/protocols/ss7/management/shell/src/main/java/org/mobicents/ss7/management/transceiver/ChannelSelector.java
Thu Dec 23 05:19:44 2010
+++
/trunk/protocols/ss7/management/shell/src/main/java/org/mobicents/ss7/management/transceiver/ChannelSelector.java
Thu Dec 23 05:28:38 2010
@@ -12,7 +12,7 @@
protected Selector selector;
- private FastList<ShellSelectionKey> list = new
FastList<ShellSelectionKey>();
+ private FastList<ChannelSelectionKey> list = new
FastList<ChannelSelectionKey>();
protected ChannelSelector(Selector selector) {
this.selector = selector;
@@ -22,22 +22,22 @@
return new
ChannelSelector(SelectorProvider.provider().openSelector());
}
- public FastList<ShellSelectionKey> selectNow() throws IOException {
+ public FastList<ChannelSelectionKey> selectNow() throws IOException {
list.clear();
selector.selectNow();
Set<SelectionKey> selection = selector.selectedKeys();
for (SelectionKey key : selection) {
if (key.isAcceptable()) {
- ShellSelectionKey k = (ShellSelectionKey)
key.attachment();
+ ChannelSelectionKey k = (ChannelSelectionKey)
key.attachment();
list.add(k);
} else if (key.isReadable()) {
- ShellSelectionKey k = (ShellSelectionKey)
key.attachment();
+ ChannelSelectionKey k = (ChannelSelectionKey)
key.attachment();
((ShellChannel) k.channel()).doRead();
if (k.isReadable()) {
list.add(k);
}
} else {
- ShellSelectionKey k = (ShellSelectionKey)
key.attachment();
+ ChannelSelectionKey k = (ChannelSelectionKey)
key.attachment();
((ShellChannel) k.channel()).doWrite();
if (k.isWritable()) {
list.add(k);
=======================================
---
/trunk/protocols/ss7/management/shell/src/main/java/org/mobicents/ss7/management/transceiver/ShellChannel.java
Thu Dec 23 02:39:53 2010
+++
/trunk/protocols/ss7/management/shell/src/main/java/org/mobicents/ss7/management/transceiver/ShellChannel.java
Thu Dec 23 05:28:38 2010
@@ -20,9 +20,9 @@
private ByteBuffer txBuffer = ByteBuffer.allocateDirect(8192);
// provider instance
- private ShellProvider provider;
-
- protected ShellChannel(ShellProvider provider,
+ private ChannelProvider provider;
+
+ protected ShellChannel(ChannelProvider provider,
AbstractSelectableChannel channel) throws IOException {
this.channel = channel;
this.channel.configureBlocking(false);
@@ -39,7 +39,7 @@
rxBuffer.flip();
}
- public static ShellChannel open(ShellProvider provider) throws
IOException {
+ public static ShellChannel open(ChannelProvider provider) throws
IOException {
return new ShellChannel(provider, SocketChannel.open());
}
=======================================
---
/trunk/protocols/ss7/management/shell/src/main/java/org/mobicents/ss7/management/transceiver/ShellSelectableChannel.java
Thu Dec 23 05:19:44 2010
+++
/trunk/protocols/ss7/management/shell/src/main/java/org/mobicents/ss7/management/transceiver/ShellSelectableChannel.java
Thu Dec 23 05:28:38 2010
@@ -9,9 +9,9 @@
//underlying network channel
protected SelectableChannel channel;
- public ShellSelectionKey register(ChannelSelector selector, int ops)
throws ClosedChannelException {
+ public ChannelSelectionKey register(ChannelSelector selector, int ops)
throws ClosedChannelException {
SelectionKey k = channel.register(selector.selector, ops);
- ShellSelectionKey key = new ShellSelectionKey(this, k);
+ ChannelSelectionKey key = new ChannelSelectionKey(this, k);
k.attach(key);
return key;
}
=======================================
---
/trunk/protocols/ss7/management/shell/src/main/java/org/mobicents/ss7/management/transceiver/ShellServerChannel.java
Thu Dec 23 00:13:37 2010
+++
/trunk/protocols/ss7/management/shell/src/main/java/org/mobicents/ss7/management/transceiver/ShellServerChannel.java
Thu Dec 23 05:28:38 2010
@@ -8,34 +8,34 @@
import org.apache.log4j.Logger;
public class ShellServerChannel extends ShellSelectableChannel {
- private static final Logger logger = Logger
- .getLogger(ShellServerChannel.class);
-
- private ShellProvider shellProvider = null;
-
- protected ShellServerChannel(ShellProvider shellProvider,
- AbstractSelectableChannel channel) throws IOException {
- this.channel = channel;
- this.channel.configureBlocking(false);
- this.shellProvider = shellProvider;
- }
-
- public static ShellServerChannel open(ShellProvider shellProvider)
- throws IOException {
- return new ShellServerChannel(shellProvider,
ServerSocketChannel.open());
- }
-
- public ShellChannel accept() throws IOException {
- return new ShellChannel(shellProvider, ((ServerSocketChannel)
channel)
- .accept());
- }
-
- public void bind(SocketAddress address) throws IOException {
- ((ServerSocketChannel) channel).socket().bind(address);
- }
-
- public void close() throws IOException {
- ((ServerSocketChannel) channel).close();
- ((ServerSocketChannel) channel).socket().close();
- }
-}
+ private static final Logger logger = Logger
+ .getLogger(ShellServerChannel.class);
+
+ private ChannelProvider chanProvider = null;
+
+ protected ShellServerChannel(ChannelProvider chanProvider,
+ AbstractSelectableChannel channel) throws IOException {
+ this.channel = channel;
+ this.channel.configureBlocking(false);
+ this.chanProvider = chanProvider;
+ }
+
+ public static ShellServerChannel open(ChannelProvider chanProvider)
+ throws IOException {
+ return new ShellServerChannel(chanProvider,
ServerSocketChannel.open());
+ }
+
+ public ShellChannel accept() throws IOException {
+ return new ShellChannel(chanProvider, ((ServerSocketChannel)
channel)
+ .accept());
+ }
+
+ public void bind(SocketAddress address) throws IOException {
+ ((ServerSocketChannel) channel).socket().bind(address);
+ }
+
+ public void close() throws IOException {
+ ((ServerSocketChannel) channel).close();
+ ((ServerSocketChannel) channel).socket().close();
+ }
+}