2 new revisions:
Revision: 3cbb9284efea
Author: [email protected] <[email protected]>
Date: Thu Jul 5 06:40:31 2012
Log: Issue 95:Generic server side for CLI
http://code.google.com/p/jss7/source/detail?r=3cbb9284efea
Revision: 098433943dc4
Author: [email protected] <[email protected]>
Date: Thu Jul 5 06:41:24 2012
Log: Merge branch 'master' of
https://[email protected]/p/jss7/
http://code.google.com/p/jss7/source/detail?r=098433943dc4
==============================================================================
Revision: 3cbb9284efea
Author: [email protected] <[email protected]>
Date: Thu Jul 5 06:40:31 2012
Log: Issue 95:Generic server side for CLI
http://code.google.com/p/jss7/source/detail?r=3cbb9284efea
Added:
/management/shell/src/main/java/org/mobicents/ss7/management/console/ShellServer.java
Deleted:
/service/src/main/java/org/mobicents/ss7/ShellExecutor.java
Modified:
/hardware/linkset/src/main/java/org/mobicents/ss7/linkset/oam/LinksetExecutor.java
/m3ua/impl/src/main/java/org/mobicents/protocols/ss7/m3ua/impl/oam/M3UAShellExecutor.java
/m3ua/impl/src/main/java/org/mobicents/protocols/ss7/m3ua/impl/oam/SCTPShellExecutor.java
/management/shell/pom.xml
/management/shell/src/main/java/org/mobicents/ss7/management/console/ShellExecutor.java
/pom.xml
/sccp/sccp-impl/pom.xml
/sccp/sccp-impl/src/main/java/org/mobicents/protocols/ss7/sccp/impl/oam/SccpExecutor.java
/service/src/main/config/jboss-beans.xml
/sgw/boot/src/main/config/sgw-beans.xml
/sgw/gateway/pom.xml
/sgw/gateway/src/main/java/org/mobicents/ss7/sgw/SignalingGateway.java
=======================================
--- /dev/null
+++
/management/shell/src/main/java/org/mobicents/ss7/management/console/ShellServer.java
Thu Jul 5 06:40:31 2012
@@ -0,0 +1,226 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2011, Red Hat, Inc. and/or its affiliates, and individual
+ * contributors as indicated by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a full listing
+ * of individual contributors.
+ *
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU General Public License, v. 2.0.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License,
+ * v. 2.0 along with this distribution; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ */
+package org.mobicents.ss7.management.console;
+
+import java.io.IOException;
+import java.net.InetSocketAddress;
+import java.nio.channels.SelectionKey;
+import java.util.List;
+
+import javolution.util.FastList;
+import javolution.util.FastSet;
+
+import org.apache.log4j.Logger;
+import org.mobicents.protocols.ss7.scheduler.Scheduler;
+import org.mobicents.protocols.ss7.scheduler.Task;
+import org.mobicents.ss7.management.transceiver.ChannelProvider;
+import org.mobicents.ss7.management.transceiver.ChannelSelectionKey;
+import org.mobicents.ss7.management.transceiver.ChannelSelector;
+import org.mobicents.ss7.management.transceiver.Message;
+import org.mobicents.ss7.management.transceiver.MessageFactory;
+import org.mobicents.ss7.management.transceiver.ShellChannel;
+import org.mobicents.ss7.management.transceiver.ShellServerChannel;
+
+/**
+ * @author abhayani
+ *
+ */
+public class ShellServer extends Task {
+ Logger logger = Logger.getLogger(ShellServer.class);
+
+ private ChannelProvider provider;
+ private ShellServerChannel serverChannel;
+ private ShellChannel channel;
+ private ChannelSelector selector;
+ private ChannelSelectionKey skey;
+
+ private MessageFactory messageFactory = null;
+
+ private String rxMessage = "";
+ private String txMessage = "";
+
+ private volatile boolean started = false;
+
+ private String address;
+
+ private int port;
+
+ private final FastList<ShellExecutor> shellExecutors = new
FastList<ShellExecutor>();
+
+ public ShellServer(Scheduler scheduler, List<ShellExecutor>
shellExecutors) throws IOException {
+ super(scheduler);
+ this.shellExecutors.addAll(shellExecutors);
+ }
+
+ public String getAddress() {
+ return address;
+ }
+
+ public void setAddress(String address) {
+ this.address = address;
+ }
+
+ public int getPort() {
+ return port;
+ }
+
+ public void setPort(int port) {
+ this.port = port;
+ }
+
+ public void start() throws IOException {
+ logger.info("Starting SS7 management shell environment");
+ provider = ChannelProvider.provider();
+ serverChannel = provider.openServerChannel();
+ InetSocketAddress inetSocketAddress = new InetSocketAddress(address,
port);
+ serverChannel.bind(inetSocketAddress);
+
+ selector = provider.openSelector();
+ skey = serverChannel.register(selector, SelectionKey.OP_ACCEPT);
+
+ messageFactory = ChannelProvider.provider().getMessageFactory();
+
+ this.logger.info(String.format("ShellExecutor listening at %s",
inetSocketAddress));
+
+ this.started = true;
+ this.activate(false);
+ scheduler.submit(this, scheduler.MANAGEMENT_QUEUE);
+ }
+
+ public void stop() {
+ this.started = false;
+
+ try {
+ skey.cancel();
+ if (channel != null) {
+ channel.close();
+ }
+ serverChannel.close();
+ selector.close();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+
+ this.logger.info("Stopped ShellExecutor service");
+ }
+
+ public int getQueueNumber() {
+ return scheduler.MANAGEMENT_QUEUE;
+ }
+
+ public long perform() {
+ if (!this.started)
+ return 0;
+
+ try {
+ FastSet<ChannelSelectionKey> keys =
selector.selectNow();
+
+ for (FastSet.Record record = keys.head(), end = keys.tail(); (record =
record.getNext()) != end;) {
+ ChannelSelectionKey key = (ChannelSelectionKey)
keys.valueOf(record);
+
+ if (key.isAcceptable()) {
+ accept();
+ } else if (key.isReadable()) {
+ ShellChannel chan = (ShellChannel)
key.channel();
+ Message msg = (Message) chan.receive();
+
+ if (msg != null) {
+ rxMessage = msg.toString();
+ logger.info("received command :
" + rxMessage);
+ if
(rxMessage.compareTo("disconnect") == 0) {
+ this.txMessage = "Bye";
+
chan.send(messageFactory.createMessage(txMessage));
+
+ } else {
+ String[] options =
rxMessage.split(" ");
+ ShellExecutor
shellExecutor = null;
+ for (FastList.Node<ShellExecutor> n = this.shellExecutors.head(),
end1 = this.shellExecutors.tail(); (n = n.getNext()) != end1;) {
+ ShellExecutor
value = n.getValue();
+ if
(value.handles(options[0])) {
+
shellExecutor = value;
+ break;
+ }
+ }
+
+ if (shellExecutor ==
null) {
+ logger.warn(String.format("Received command=\"%s\" for which no
ShellExecutor is configured ", rxMessage));
+
chan.send(messageFactory.createMessage("Invalid command"));
+ } else {
+ this.txMessage
= shellExecutor.execute(options);
+
chan.send(messageFactory.createMessage(this.txMessage));
+ }
+
+ } // if
(rxMessage.compareTo("disconnect")
+ } // if (msg != null)
+
+ // TODO Handle message
+
+ rxMessage = "";
+
+ } else if (key.isWritable() && txMessage.length()
> 0) {
+
+ if (this.txMessage.compareTo("Bye") ==
0) {
+ this.closeChannel();
+ }
+ this.txMessage = "";
+ }
+ }
+ } catch (IOException e) {
+ logger.error("IO Exception while operating on ChannelSelectionKey.
Client CLI connection will be closed now", e);
+ try {
+ this.closeChannel();
+ } catch (IOException e1) {
+ logger.error("IO Exception while closing
Channel", e);
+ }
+ } catch (Exception e) {
+ logger.error("Exception while operating on ChannelSelectionKey. Client
CLI connection will be closed now", e);
+ try {
+ this.closeChannel();
+ } catch (IOException e1) {
+ logger.error("IO Exception while closing
Channel", e);
+ }
+ }
+
+ if (this.started)
+ scheduler.submit(this, scheduler.MANAGEMENT_QUEUE);
+
+ return 0;
+ }
+
+ private void accept() throws IOException {
+ channel = serverChannel.accept();
+ skey.cancel();
+ skey = channel.register(selector, SelectionKey.OP_READ |
SelectionKey.OP_WRITE);
+ }
+
+ private void closeChannel() throws IOException {
+ if (channel != null) {
+ try {
+ this.channel.close();
+ } catch (IOException e) {
+ logger.error("Error closing channel", e);
+ }
+ }
+ skey.cancel();
+ skey = serverChannel.register(selector, SelectionKey.OP_ACCEPT);
+ }
+}
=======================================
--- /service/src/main/java/org/mobicents/ss7/ShellExecutor.java Mon Jun 25
05:20:20 2012
+++ /dev/null
@@ -1,286 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2011, Red Hat, Inc. and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.mobicents.ss7;
-
-import java.io.IOException;
-import java.net.InetSocketAddress;
-import java.nio.channels.SelectionKey;
-
-import javolution.util.FastSet;
-
-import org.apache.log4j.Logger;
-import org.mobicents.protocols.ss7.scheduler.Scheduler;
-import org.mobicents.protocols.ss7.scheduler.Task;
-import org.mobicents.protocols.ss7.m3ua.impl.oam.M3UAShellExecutor;
-import org.mobicents.protocols.ss7.sccp.impl.oam.SccpExecutor;
-import org.mobicents.ss7.linkset.oam.LinksetExecutor;
-import org.mobicents.ss7.management.console.Subject;
-import org.mobicents.ss7.management.transceiver.ChannelProvider;
-import org.mobicents.ss7.management.transceiver.ChannelSelectionKey;
-import org.mobicents.ss7.management.transceiver.ChannelSelector;
-import org.mobicents.ss7.management.transceiver.Message;
-import org.mobicents.ss7.management.transceiver.MessageFactory;
-import org.mobicents.ss7.management.transceiver.ShellChannel;
-import org.mobicents.ss7.management.transceiver.ShellServerChannel;
-
-/**
- * @author amit bhayani
- * @author kulikov
- */
-public class ShellExecutor extends Task {
-
- Logger logger = Logger.getLogger(ShellExecutor.class);
-
- private ChannelProvider provider;
- private ShellServerChannel serverChannel;
- private ShellChannel channel;
- private ChannelSelector selector;
- private ChannelSelectionKey skey;
-
- private MessageFactory messageFactory = null;
-
- private String rxMessage = "";
- private String txMessage = "";
-
- private volatile boolean started = false;
-
- private String address;
-
- private int port;
-
- private volatile LinksetExecutor linksetExecutor = null;
-
- private volatile M3UAShellExecutor m3UAShellExecutor = null;
-
- private volatile SccpExecutor sccpExecutor = null;
-
- public ShellExecutor(Scheduler scheduler) throws IOException {
- super(scheduler);
- }
-
- public SccpExecutor getSccpExecutor() {
- return sccpExecutor;
- }
-
- public void setSccpExecutor(SccpExecutor sccpExecutor) {
- this.sccpExecutor = sccpExecutor;
- }
-
- public String getAddress() {
- return address;
- }
-
- public void setAddress(String address) {
- this.address = address;
- }
-
- public int getPort() {
- return port;
- }
-
- public void setPort(int port) {
- this.port = port;
- }
-
- public void start() throws IOException {
- logger.info("Starting SS7 management shell environment");
- provider = ChannelProvider.provider();
- serverChannel = provider.openServerChannel();
- InetSocketAddress inetSocketAddress = new InetSocketAddress(address,
port);
- serverChannel.bind(inetSocketAddress);
-
- selector = provider.openSelector();
- skey = serverChannel.register(selector, SelectionKey.OP_ACCEPT);
-
- messageFactory = ChannelProvider.provider().getMessageFactory();
-
- this.logger.info(String.format("ShellExecutor listening at %s",
inetSocketAddress));
-
- this.started = true;
- this.activate(false);
- scheduler.submit(this,scheduler.MANAGEMENT_QUEUE);
- }
-
- public void stop() {
- this.started = false;
-
- try {
- skey.cancel();
- if (channel != null) {
- channel.close();
- }
- serverChannel.close();
- selector.close();
- } catch (IOException e) {
- e.printStackTrace();
- }
-
- this.logger.info("Stopped ShellExecutor service");
- }
-
- public LinksetExecutor getLinksetExecutor() {
- return linksetExecutor;
- }
-
- public void setLinksetExecutor(LinksetExecutor linksetExecutor) {
- this.linksetExecutor = linksetExecutor;
- }
-
- public M3UAShellExecutor getM3UAShellExecutor() {
- return m3UAShellExecutor;
- }
-
- public void setM3UAShellExecutor(M3UAShellExecutor shellExecutor) {
- m3UAShellExecutor = shellExecutor;
- }
-
- public int getQueueNumber()
- {
- return scheduler.MANAGEMENT_QUEUE;
- }
-
- public long perform() {
- if(!this.started)
- return 0;
-
- try {
- FastSet<ChannelSelectionKey> keys =
selector.selectNow();
-
- for (FastSet.Record record = keys.head(), end = keys.tail(); (record =
record.getNext()) != end;) {
- ChannelSelectionKey key = (ChannelSelectionKey)
keys.valueOf(record);
-
- if (key.isAcceptable()) {
- accept();
- } else if (key.isReadable()) {
- ShellChannel chan = (ShellChannel)
key.channel();
- Message msg = (Message) chan.receive();
-
- if (msg != null) {
- rxMessage = msg.toString();
- System.out.println("received "
+ rxMessage);
- if
(rxMessage.compareTo("disconnect") == 0) {
- this.txMessage = "Bye";
-
chan.send(messageFactory.createMessage(txMessage));
-
- } else {
- String[] options =
rxMessage.split(" ");
- Subject subject =
Subject.getSubject(options[0]);
- if (subject == null) {
-
chan.send(messageFactory.createMessage("Invalid Subject"));
- } else {
- // Nullify
examined options
- //options[0] =
null;
-
- switch
(subject) {
- case LINKSET:
-
if(this.linksetExecutor == null){
-
this.txMessage = "Error! LinksetExecutor is null";
- } else{
-
this.txMessage = this.linksetExecutor.execute(options);
- }
- break;
- case SCTP:
- case M3UA:
-
if(this.m3UAShellExecutor == null){
-
this.txMessage = "Error! M3UAShellExecutor is null";
- } else {
-
this.txMessage = this.m3UAShellExecutor.execute(options);
- }
- break;
- case SCCP:
-
if(this.sccpExecutor == null){
-
this.txMessage = "Error! SccpExecutor is null";
- } else {
-
this.txMessage = this.sccpExecutor.execute(options);
- }
- break;
- default:
- this.txMessage =
"Invalid Subject";
- break;
- }
-
chan.send(messageFactory.createMessage(this.txMessage));
- }
- } // if
(rxMessage.compareTo("disconnect")
- } // if (msg != null)
-
- // TODO Handle message
-
- rxMessage = "";
-
- } else if (key.isWritable() && txMessage.length()
> 0) {
-
- if (this.txMessage.compareTo("Bye") ==
0) {
- this.closeChannel();
- }
-
- // else {
- //
- // ShellChannel chan = (ShellChannel)
key.channel();
- // System.out.println("Sending " +
txMessage);
- //
chan.send(messageFactory.createMessage(txMessage));
- // }
-
- this.txMessage = "";
- }
- }
- } catch (IOException e) {
- logger.error("IO Exception while operating on ChannelSelectionKey.
Client CLI connection will be closed now", e);
- try {
- this.closeChannel();
- } catch (IOException e1) {
- logger.error("IO Exception while closing
Channel", e);
- }
- } catch (Exception e){
- logger.error("Exception while operating on ChannelSelectionKey. Client
CLI connection will be closed now", e);
- try {
- this.closeChannel();
- } catch (IOException e1) {
- logger.error("IO Exception while closing
Channel", e);
- }
- }
-
- if(this.started)
- scheduler.submit(this,scheduler.MANAGEMENT_QUEUE);
-
- return 0;
- }
-
- private void accept() throws IOException {
- channel = serverChannel.accept();
- skey.cancel();
- skey = channel.register(selector, SelectionKey.OP_READ |
SelectionKey.OP_WRITE);
- }
-
- private void closeChannel() throws IOException {
- if (channel != null) {
- try {
- this.channel.close();
- } catch (IOException e) {
- logger.error("Error closing channel", e);
- }
- }
- skey.cancel();
- skey = serverChannel.register(selector, SelectionKey.OP_ACCEPT);
- }
-
-}
=======================================
---
/hardware/linkset/src/main/java/org/mobicents/ss7/linkset/oam/LinksetExecutor.java
Wed Jul 4 07:10:07 2012
+++
/hardware/linkset/src/main/java/org/mobicents/ss7/linkset/oam/LinksetExecutor.java
Thu Jul 5 06:40:31 2012
@@ -120,5 +120,13 @@
}
return LinkOAMMessages.INVALID_COMMAND;
}
+
+ /* (non-Javadoc)
+ * @see
org.mobicents.ss7.management.console.ShellExecutor#handles(java.lang.String)
+ */
+ @Override
+ public boolean handles(String command) {
+ return (command.startsWith("linkset"));
+ }
}
=======================================
---
/m3ua/impl/src/main/java/org/mobicents/protocols/ss7/m3ua/impl/oam/M3UAShellExecutor.java
Wed May 9 11:27:48 2012
+++
/m3ua/impl/src/main/java/org/mobicents/protocols/ss7/m3ua/impl/oam/M3UAShellExecutor.java
Thu Jul 5 06:40:31 2012
@@ -28,7 +28,6 @@
import javolution.util.FastMap;
import org.apache.log4j.Logger;
-import org.mobicents.protocols.api.Management;
import org.mobicents.protocols.ss7.m3ua.ExchangeType;
import org.mobicents.protocols.ss7.m3ua.Functionality;
import org.mobicents.protocols.ss7.m3ua.IPSPType;
@@ -55,8 +54,6 @@
protected ParameterFactory parameterFactory = new
ParameterFactoryImpl();
- private SCTPShellExecutor sctpShellExecutor = new SCTPShellExecutor();
-
public M3UAShellExecutor() {
}
@@ -68,14 +65,6 @@
public void setM3uaManagement(M3UAManagement m3uaManagement) {
this.m3uaManagement = m3uaManagement;
}
-
- public Management getSctpManagement() {
- return this.sctpShellExecutor.getSctpManagement();
- }
-
- public void setSctpManagement(Management sctpManagement) {
- this.sctpShellExecutor.setSctpManagement(sctpManagement);
- }
/**
* m3ua as create <as-name> <AS | SGW | IPSP> mode <SE | DE> ipspType <
@@ -440,10 +429,20 @@
public String execute(String[] args) {
if (args[0].equals("m3ua")) {
return this.executeM3UA(args);
- } else if (args[0].equals("sctp")) {
- return this.sctpShellExecutor.execute(args);
}
return M3UAOAMMessages.INVALID_COMMAND;
}
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.mobicents.ss7.management.console.ShellExecutor#handles(java.lang.
+ * String)
+ */
+ @Override
+ public boolean handles(String command) {
+ return (command.startsWith("m3ua"));
+ }
}
=======================================
---
/m3ua/impl/src/main/java/org/mobicents/protocols/ss7/m3ua/impl/oam/SCTPShellExecutor.java
Thu Mar 8 05:37:26 2012
+++
/m3ua/impl/src/main/java/org/mobicents/protocols/ss7/m3ua/impl/oam/SCTPShellExecutor.java
Thu Jul 5 06:40:31 2012
@@ -35,19 +35,18 @@
StringBuffer sb = new StringBuffer();
for (Server server : servers) {
sb.append(M3UAOAMMessages.NEW_LINE);
-
sb.append("SERVER ").append(server.getIpChannelType().getType()).append("
name=").append(server.getName())
- .append(" started=").append(server.isStarted()).append("
hostIp=").append(server.getHostAddress())
- .append("
hostPort=").append(server.getHostport());
-
+
sb.append("SERVER ").append(server.getIpChannelType().getType()).append("
name=").append(server.getName()).append(" started=")
+ .append(server.isStarted()).append("
hostIp=").append(server.getHostAddress()).append("
hostPort=").append(server.getHostport());
+
String[] secondaryHostAdd =
server.getExtraHostAddresses();
-
- if(secondaryHostAdd != null && secondaryHostAdd.length
> 0){
+
+ if (secondaryHostAdd != null && secondaryHostAdd.length
> 0) {
sb.append(" secondaryHost=");
- for(int i=0;i<secondaryHostAdd.length;i++){
+ for (int i = 0; i < secondaryHostAdd.length;
i++) {
sb.append(secondaryHostAdd[i]).append("
");
}
}
-
+
List<String> associations = server.getAssociations();
sb.append(M3UAOAMMessages.NEW_LINE);
sb.append("Associations:");
@@ -70,26 +69,25 @@
for (String s : associations.keySet()) {
Association asso = associations.get(s);
sb.append(M3UAOAMMessages.NEW_LINE);
-
sb.append("ASSOCIATION ").append(asso.getIpChannelType().getType()).append("
name=").append(asso.getName())
- .append(" started=").append(asso.isStarted()).append("
peerIp=").append(asso.getPeerAddress())
- .append("
peerPort=").append(asso.getPeerPort());
+
sb.append("ASSOCIATION ").append(asso.getIpChannelType().getType()).append("
name=").append(asso.getName()).append(" started=")
+ .append(asso.isStarted()).append("
peerIp=").append(asso.getPeerAddress()).append("
peerPort=").append(asso.getPeerPort());
if (asso.getAssociationType() ==
AssociationType.CLIENT) {
sb.append(" hostIp=").append(asso.getHostAddress()).append("
hostPort").append(asso.getHostPort());
} else {
sb.append("
server=").append(asso.getServerName());
}
-
+
sb.append(" type=").append(asso.getAssociationType());
-
+
String[] secondaryHostAdd =
asso.getExtraHostAddresses();
-
- if(secondaryHostAdd != null && secondaryHostAdd.length
> 0){
+
+ if (secondaryHostAdd != null && secondaryHostAdd.length
> 0) {
sb.append(" secondaryHost=");
- for(int i=0;i<secondaryHostAdd.length;i++){
+ for (int i = 0; i < secondaryHostAdd.length;
i++) {
sb.append(secondaryHostAdd[i]).append("
");
}
}
-
+
sb.append(M3UAOAMMessages.NEW_LINE);
}
@@ -152,8 +150,7 @@
ipChnnelType =
IpChannelType.SCTP;
}
- this.sctpManagement.addServer(serverName, primaryAddress, hostPort,
ipChnnelType,
- secondaryAddresses);
+ this.sctpManagement.addServer(serverName, primaryAddress, hostPort,
ipChnnelType, secondaryAddresses);
return
String.format(SCTPOAMMessages.ADD_SERVER_SUCCESS, serverName);
@@ -251,8 +248,7 @@
ipChnnelType =
IpChannelType.SCTP;
}
- this.sctpManagement.addAssociation(primaryAddress, hostPort, peerIp,
peerPort, assocName,
- ipChnnelType,
secondaryAddresses);
+ this.sctpManagement.addAssociation(primaryAddress, hostPort, peerIp,
peerPort, assocName, ipChnnelType, secondaryAddresses);
return String.format(SCTPOAMMessages.ADD_CLIENT_ASSOCIATION_SUCCESS,
assocName);
} else if (type.equals("SERVER")) {
@@ -304,5 +300,17 @@
return e.getMessage();
}
}
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.mobicents.ss7.management.console.ShellExecutor#handles(java.lang.
+ * String)
+ */
+ @Override
+ public boolean handles(String command) {
+ return command.startsWith("sctp");
+ }
}
=======================================
--- /management/shell/pom.xml Tue Jul 3 02:19:47 2012
+++ /management/shell/pom.xml Thu Jul 5 06:40:31 2012
@@ -36,6 +36,10 @@
<artifactId>jreadline</artifactId>
<version>0.17</version>
</dependency>
+ <dependency>
+ <artifactId>scheduler</artifactId>
+ <groupId>org.mobicents.protocols.ss7.scheduler</groupId>
+ </dependency>
</dependencies>
<build>
=======================================
---
/management/shell/src/main/java/org/mobicents/ss7/management/console/ShellExecutor.java
Tue Jul 3 02:19:47 2012
+++
/management/shell/src/main/java/org/mobicents/ss7/management/console/ShellExecutor.java
Thu Jul 5 06:40:31 2012
@@ -31,6 +31,8 @@
*/
public interface ShellExecutor {
+ public boolean handles(String command);
+
public String execute(String[] options);
}
=======================================
--- /pom.xml Thu Jun 14 12:07:28 2012
+++ /pom.xml Thu Jul 5 06:40:31 2012
@@ -114,7 +114,7 @@
<dependency>
<artifactId>linkset</artifactId>
<groupId>
- org.mobicents.protocols.ss7.management
+ org.mobicents.protocols.ss7.hardware
</groupId>
<version>${pom.version}</version>
</dependency>
=======================================
--- /sccp/sccp-impl/pom.xml Wed Jun 6 06:59:00 2012
+++ /sccp/sccp-impl/pom.xml Thu Jul 5 06:40:31 2012
@@ -1,4 +1,5 @@
-<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
+<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
@@ -13,13 +14,10 @@
<dependencies>
-
+ <!-- shell -->
<dependency>
- <!-- This comes in container. -->
- <groupId>org.jboss.jbossas</groupId>
- <artifactId>jboss-as-system-jmx</artifactId>
- <version>${jboss.version}</version>
- <scope>compile</scope>
+
<groupId>org.mobicents.protocols.ss7.management</groupId>
+ <artifactId>shell</artifactId>
</dependency>
<dependency>
@@ -37,10 +35,6 @@
<scope>provided</scope>
</dependency>
<dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- </dependency>
- <dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
</dependency>
=======================================
---
/sccp/sccp-impl/src/main/java/org/mobicents/protocols/ss7/sccp/impl/oam/SccpExecutor.java
Tue Apr 3 01:53:33 2012
+++
/sccp/sccp-impl/src/main/java/org/mobicents/protocols/ss7/sccp/impl/oam/SccpExecutor.java
Thu Jul 5 06:40:31 2012
@@ -43,13 +43,14 @@
import org.mobicents.protocols.ss7.sccp.impl.router.RuleType;
import org.mobicents.protocols.ss7.sccp.parameter.GlobalTitle;
import org.mobicents.protocols.ss7.sccp.parameter.SccpAddress;
+import org.mobicents.ss7.management.console.ShellExecutor;
/**
*
* @author amit bhayani
*
*/
-public class SccpExecutor {
+public class SccpExecutor implements ShellExecutor {
private static final Logger logger =
Logger.getLogger(SccpExecutor.class);
@@ -66,7 +67,6 @@
this.sccpResource = sccpStack.getSccpResource();
this.sccpStack = sccpStack;
}
-
public String execute(String[] options) {
if (this.router == null || this.sccpResource == null) {
@@ -213,14 +213,14 @@
}
return rss.toString();
}
-
- if(this.sccpResource.getRemoteSsns().size() == 0){
+
+ if (this.sccpResource.getRemoteSsns().size() == 0) {
return SccpOAMMessage.RSS_DOESNT_EXIST;
}
StringBuffer sb = new StringBuffer();
- for (FastMap.Entry<Integer, RemoteSubSystem> e =
this.sccpResource.getRemoteSsns().head(), end = this.sccpResource
- .getRemoteSsns().tail(); (e =
e.getNext()) != end;) {
+ for (FastMap.Entry<Integer, RemoteSubSystem> e =
this.sccpResource.getRemoteSsns().head(), end =
this.sccpResource.getRemoteSsns().tail(); (e = e
+ .getNext()) != end;) {
int key = e.getKey();
RemoteSubSystem rss = e.getValue();
sb.append("key=");
@@ -252,7 +252,9 @@
return SccpOAMMessage.INVALID_COMMAND;
}
- int remoteSpcId = Integer.parseInt(options[3]); //FIXME: Amit is this
ok? - to use ID?
+ int remoteSpcId = Integer.parseInt(options[3]); //
FIXME: Amit is
+
// this ok? - to use
+
// ID?
if (this.sccpResource.getRemoteSpc(remoteSpcId) !=
null) {
return SccpOAMMessage.RSPC_ALREADY_EXIST;
}
@@ -309,13 +311,13 @@
return rspc.toString();
}
- if(this.sccpResource.getRemoteSpcs().size() == 0){
+ if (this.sccpResource.getRemoteSpcs().size() == 0) {
return SccpOAMMessage.RSPC_DOESNT_EXIST;
}
-
+
StringBuffer sb = new StringBuffer();
- for (FastMap.Entry<Integer, RemoteSignalingPointCode> e =
this.sccpResource.getRemoteSpcs().head(), end = this.sccpResource
- .getRemoteSpcs().tail(); (e =
e.getNext()) != end;) {
+ for (FastMap.Entry<Integer, RemoteSignalingPointCode> e =
this.sccpResource.getRemoteSpcs().head(), end =
this.sccpResource.getRemoteSpcs().tail(); (e = e
+ .getNext()) != end;) {
int key = e.getKey();
RemoteSignalingPointCode rsp = e.getValue();
sb.append("key=");
@@ -391,14 +393,14 @@
}
return pa.toString();
}
-
- if(this.router.getPrimaryAddresses().size() == 0){
+
+ if (this.router.getPrimaryAddresses().size() == 0) {
return SccpOAMMessage.ADDRESS_DOESNT_EXIST;
}
StringBuffer sb = new StringBuffer();
- for (FastMap.Entry<Integer, SccpAddress> e =
this.router.getPrimaryAddresses().head(), end = this.router
- .getPrimaryAddresses().tail(); (e =
e.getNext()) != end;) {
+ for (FastMap.Entry<Integer, SccpAddress> e =
this.router.getPrimaryAddresses().head(), end =
this.router.getPrimaryAddresses().tail(); (e = e
+ .getNext()) != end;) {
int key = e.getKey();
SccpAddress address = e.getValue();
sb.append("key=");
@@ -472,14 +474,14 @@
}
return pa.toString();
}
-
- if(this.router.getBackupAddresses().size() == 0){
+
+ if (this.router.getBackupAddresses().size() == 0) {
return SccpOAMMessage.ADDRESS_DOESNT_EXIST;
}
StringBuffer sb = new StringBuffer();
- for (FastMap.Entry<Integer, SccpAddress> e =
this.router.getBackupAddresses().head(), end = this.router
- .getBackupAddresses().tail(); (e =
e.getNext()) != end;) {
+ for (FastMap.Entry<Integer, SccpAddress> e =
this.router.getBackupAddresses().head(), end =
this.router.getBackupAddresses().tail(); (e = e
+ .getNext()) != end;) {
int key = e.getKey();
SccpAddress address = e.getValue();
sb.append("key=");
@@ -585,7 +587,7 @@
} else {
return SccpOAMMessage.INVALID_COMMAND;
}
-
+
int pAddressId = Integer.parseInt(options[13]);
SccpAddress pAddress =
this.router.getPrimaryAddress(pAddressId);
@@ -756,14 +758,13 @@
}
return rule.toString();
}
-
- if(this.router.getRules().size() == 0){
+
+ if (this.router.getRules().size() == 0) {
return SccpOAMMessage.RULE_DOESNT_EXIST;
}
StringBuffer sb = new StringBuffer();
- for (FastMap.Entry<Integer, Rule> e = this.router.getRules().head(), end
= this.router.getRules().tail(); (e = e
- .getNext()) != end;) {
+ for (FastMap.Entry<Integer, Rule> e = this.router.getRules().head(), end
= this.router.getRules().tail(); (e = e.getNext()) != end;) {
int key = e.getKey();
Rule rule = e.getValue();
sb.append("key=");
@@ -1080,7 +1081,7 @@
if (options.length < 10) {
return SccpOAMMessage.INVALID_COMMAND;
}
-
+
int sapId = Integer.parseInt(options[3]);
Mtp3ServiceAccessPoint sap =
this.router.getMtp3ServiceAccessPoint(sapId);
if (sap == null) {
@@ -1220,7 +1221,7 @@
return conSpc.toString();
}
- if(this.sccpResource.getConcernedSpcs().size() == 0){
+ if (this.sccpResource.getConcernedSpcs().size() == 0) {
return SccpOAMMessage.CS_DOESNT_EXIST;
}
@@ -1341,5 +1342,16 @@
return sb.toString();
}
}
-}
-
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.mobicents.ss7.management.console.ShellExecutor#handles(java.lang.
+ * String)
+ */
+ @Override
+ public boolean handles(String command) {
+ return command.startsWith("sccp");
+ }
+}
=======================================
--- /service/src/main/config/jboss-beans.xml Mon Jun 18 08:24:16 2012
+++ /service/src/main/config/jboss-beans.xml Thu Jul 5 06:40:31 2012
@@ -11,6 +11,13 @@
<property name="singleThread">true</property>
<property name="connectDelay">30000</property>
</bean>
+
+ <bean name="SCTPShellExecutor"
+
class="org.mobicents.protocols.ss7.m3ua.impl.oam.SCTPShellExecutor">
+ <property name="sctpManagement">
+ <inject bean="SCTPManagement" />
+ </property>
+ </bean>
<!-- ====================================================================
-->
<!-- M3UA -->
@@ -32,9 +39,6 @@
<property name="m3uaManagement">
<inject bean="Mtp3UserPart" />
</property>
- <property name="sctpManagement">
- <inject bean="SCTPManagement" />
- </property>
</bean>
<!-- ====================================================================
-->
@@ -50,7 +54,7 @@
<inject bean="SS7Clock" />
</property>
</bean>
-
+
<!-- ====================================================================
-->
<!-- Dialogic Mtp3UserPart -->
<!-- ====================================================================
-->
@@ -90,75 +94,84 @@
<!-- Shell Service -->
<!-- ====================================================================
-->
<!-- Define Shell Executor -->
- <bean name="ShellExecutor" class="org.mobicents.ss7.ShellExecutor">
+ <bean name="ShellExecutor"
class="org.mobicents.ss7.management.console.ShellServer">
<constructor>
<parameter>
<inject bean="SS7Scheduler" />
+ </parameter>
+ <parameter>
+ <list class="javolution.util.FastList"
elementClass="org.mobicents.ss7.management.console.ShellExecutor">
+ <inject bean="SccpExecutor" />
+ <inject bean="M3UAShellExecutor" />
+ <inject bean="SCTPShellExecutor" />
+ </list>
</parameter>
</constructor>
-
+
<property name="address">${jboss.bind.address}</property>
<property name="port">3435</property>
-
- <property name="sccpExecutor">
- <inject bean="SccpExecutor" />
- </property>
- <property name="m3UAShellExecutor">
- <inject bean="M3UAShellExecutor" />
- </property>
</bean>
<!-- ====================================================================
-->
<!-- TCAP Service -->
- <!-- ====================================================================
-->
+ <!-- ====================================================================
-->
<bean name="TcapStack"
class="org.mobicents.protocols.ss7.tcap.TCAPStackImpl">
<constructor>
- <parameter><inject bean="SccpStack" property="sccpProvider"
/></parameter>
+ <parameter>
+ <inject bean="SccpStack" property="sccpProvider"
/>
+ </parameter>
<parameter>8</parameter>
</constructor>
<property name="dialogIdleTimeout">60000</property>
<property name="invokeTimeout">30000</property>
<property name="maxDialogs">25000</property>
</bean>
-
+
<!-- ====================================================================
-->
<!-- MAP Service -->
- <!-- ====================================================================
-->
+ <!-- ====================================================================
-->
<bean name="MapStack"
class="org.mobicents.protocols.ss7.map.MAPStackImpl">
<constructor>
- <parameter><inject bean="TcapStack" property="provider"
/></parameter>
+ <parameter>
+ <inject bean="TcapStack" property="provider" />
+ </parameter>
</constructor>
- </bean>
-
+ </bean>
+
<!-- ====================================================================
-->
<!-- ISUP Service -->
<!-- ====================================================================
-->
- <bean name="CircuitManager"
class="org.mobicents.protocols.ss7.isup.impl.CircuitManagerImpl">
+ <bean name="CircuitManager"
+
class="org.mobicents.protocols.ss7.isup.impl.CircuitManagerImpl">
</bean>
-
+
<bean name="IsupStack"
class="org.mobicents.protocols.ss7.isup.impl.ISUPStackImpl">
<constructor>
- <parameter><inject bean="SS7Scheduler" /></parameter>
- <parameter>22234</parameter>
- <parameter>2</parameter>
+ <parameter>
+ <inject bean="SS7Scheduler" />
+ </parameter>
+ <parameter>22234</parameter>
+ <parameter>2</parameter>
</constructor>
- <property name="mtp3UserPart"><inject bean="Mtp3UserPart"
/></property>
- <property name="circuitManager"><inject bean="CircuitManager"
/></property>
- </bean>
+ <property name="mtp3UserPart">
+ <inject bean="Mtp3UserPart" />
+ </property>
+ <property name="circuitManager">
+ <inject bean="CircuitManager" />
+ </property>
+ </bean>
<!-- ====================================================================
-->
<!-- Mobicents SS7 Service -->
<!-- ====================================================================
-->
<bean name="MAPSS7Service" class="org.mobicents.ss7.SS7Service">
-
<annotation>@org.jboss.aop.microcontainer.aspects.jmx.JMX(name="org.mobicents.ss7:service=MAPSS7Service",exposedInterface=org.mobicents.ss7.SS7ServiceMBean.class,registerDirectly=true)
- </annotation>
+
<annotation>@org.jboss.aop.microcontainer.aspects.jmx.JMX(name="org.mobicents.ss7:service=MAPSS7Service",exposedInterface=org.mobicents.ss7.SS7ServiceMBean.class,registerDirectly=true)</annotation>
<property name="jndiName">java:/mobicents/ss7/map</property>
<property name="stack">
<inject bean="MapStack" property="MAPProvider" />
</property>
</bean>
<bean name="ISUPSS7Service" class="org.mobicents.ss7.SS7Service">
-
<annotation>@org.jboss.aop.microcontainer.aspects.jmx.JMX(name="org.mobicents.ss7:service=ISUPSS7Service",exposedInterface=org.mobicents.ss7.SS7ServiceMBean.class,registerDirectly=true)
- </annotation>
+
<annotation>@org.jboss.aop.microcontainer.aspects.jmx.JMX(name="org.mobicents.ss7:service=ISUPSS7Service",exposedInterface=org.mobicents.ss7.SS7ServiceMBean.class,registerDirectly=true)</annotation>
<property name="jndiName">java:/mobicents/ss7/isup</property>
<property name="stack">
<inject bean="IsupStack" property="isupProvider" />
=======================================
--- /sgw/boot/src/main/config/sgw-beans.xml Mon Jun 18 08:24:16 2012
+++ /sgw/boot/src/main/config/sgw-beans.xml Thu Jul 5 06:40:31 2012
@@ -15,6 +15,13 @@
<property name="connectDelay">30000</property>
</bean>
+ <bean name="SCTPShellExecutor"
+
class="org.mobicents.protocols.ss7.m3ua.impl.oam.SCTPShellExecutor">
+ <property name="sctpManagement">
+ <inject bean="SCTPManagement" />
+ </property>
+ </bean>
+
<bean name="Mtp3UserPart"
class="org.mobicents.protocols.ss7.m3ua.impl.M3UAManagement">
<constructor>
<parameter>Mtp3UserPart</parameter>
@@ -30,9 +37,6 @@
<property name="m3uaManagement">
<inject bean="Mtp3UserPart" />
</property>
- <property name="sctpManagement">
- <inject bean="SCTPManagement" />
- </property>
</bean>
<bean name="Clock"
class="org.mobicents.protocols.ss7.scheduler.DefaultClock">
@@ -74,22 +78,22 @@
<uncallback method="removeFactory" />
</bean>
- <bean name="ShellExecutor" class="org.mobicents.ss7.ShellExecutor">
+ <bean name="ShellExecutor"
class="org.mobicents.ss7.management.console.ShellServer">
<constructor>
<parameter>
<inject bean="Scheduler" />
+ </parameter>
+ <parameter>
+ <list class="javolution.util.FastList"
elementClass="org.mobicents.ss7.management.console.ShellExecutor">
+ <inject bean="M3UAShellExecutor" />
+ <inject bean="SCTPShellExecutor" />
+ <inject bean="LinksetExecutor" />
+ </list>
</parameter>
</constructor>
-
<property name="address">${sgw.bind.address}</property>
- <property name="port">3436</property>
- <property name="linksetExecutor">
- <inject bean="LinksetExecutor" />
- </property>
- <property name="m3UAShellExecutor">
- <inject bean="M3UAShellExecutor" />
- </property>
+ <property name="port">3435</property>
</bean>
<bean name="NodalInterworkingFunction"
class="org.mobicents.ss7.sgw.NodalInterworkingFunction">
@@ -114,10 +118,6 @@
<inject bean="Scheduler" />
</property>
- <property name="shellExecutor">
- <inject bean="ShellExecutor" />
- </property>
-
<property name="nodalInterworkingFunction">
<inject bean="NodalInterworkingFunction" />
</property>
=======================================
--- /sgw/gateway/pom.xml Wed Jul 4 07:10:07 2012
+++ /sgw/gateway/pom.xml Thu Jul 5 06:40:31 2012
@@ -64,13 +64,6 @@
<groupId>org.mobicents.protocols.ss7.hardware</groupId>
</dependency>
- <!-- Service used for Shell Executor -->
- <dependency>
- <artifactId>mobicents-ss7</artifactId>
- <groupId>org.mobicents.protocols.ss7</groupId>
- <version>${pom.version}</version>
- </dependency>
-
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
=======================================
--- /sgw/gateway/src/main/java/org/mobicents/ss7/sgw/SignalingGateway.java
Mon Jun 18 08:24:16 2012
+++ /sgw/gateway/src/main/java/org/mobicents/ss7/sgw/SignalingGateway.java
Thu Jul 5 06:40:31 2012
@@ -22,12 +22,8 @@
package org.mobicents.ss7.sgw;
-import java.io.IOException;
-
import org.apache.log4j.Logger;
-import org.mobicents.ss7.ShellExecutor;
import org.mobicents.protocols.ss7.scheduler.Scheduler;
-import org.mobicents.protocols.ss7.scheduler.Task;
public class SignalingGateway {
@@ -35,7 +31,6 @@
private static final Logger logger =
Logger.getLogger(SignalingGateway.class);
- private ShellExecutor shellExecutor = null;
private NodalInterworkingFunction nodalInterworkingFunction = null;
private boolean isActive = false;
@@ -52,14 +47,6 @@
this.scheduler = scheduler;
}
- public ShellExecutor getShellExecutor() {
- return shellExecutor;
- }
-
- public void setShellExecutor(ShellExecutor shellExecutor) {
- this.shellExecutor = shellExecutor;
- }
-
public NodalInterworkingFunction getNodalInterworkingFunction() {
return nodalInterworkingFunction;
}
==============================================================================
Revision: 098433943dc4
Author: [email protected] <[email protected]>
Date: Thu Jul 5 06:41:24 2012
Log: Merge branch 'master' of
https://[email protected]/p/jss7/
http://code.google.com/p/jss7/source/detail?r=098433943dc4
Modified:
/pom.xml
=======================================
--- /pom.xml Thu Jul 5 06:40:31 2012
+++ /pom.xml Thu Jul 5 06:41:24 2012
@@ -126,6 +126,12 @@
<version>${pom.version}</version>
</dependency>
+ <dependency>
+ <artifactId>linkset</artifactId>
+
<groupId>org.mobicents.protocols.ss7.hardware</groupId>
+ <version>${pom.version}</version>
+ </dependency>
+
<!-- Hardware Dialogic Java -->
<dependency>
<artifactId>mobicents-dialogic</artifactId>