Revision: 16008
Author: oleg.kulikoff
Date: Tue Dec 21 22:46:26 2010
Log: Issue #1922
http://code.google.com/p/mobicents/source/detail?r=16008
Added:
/trunk/protocols/ss7/service
/trunk/protocols/ss7/service/pom.xml
/trunk/protocols/ss7/service/src
/trunk/protocols/ss7/service/src/main
/trunk/protocols/ss7/service/src/main/assembly
/trunk/protocols/ss7/service/src/main/assembly/common.xml
/trunk/protocols/ss7/service/src/main/assembly/pojo.xml
/trunk/protocols/ss7/service/src/main/config
/trunk/protocols/ss7/service/src/main/config/jboss-beans.xml
/trunk/protocols/ss7/service/src/main/config/jboss-structure.xml
/trunk/protocols/ss7/service/src/main/config/sccp-routing.txt
/trunk/protocols/ss7/service/src/main/java
/trunk/protocols/ss7/service/src/main/java/org
/trunk/protocols/ss7/service/src/main/java/org/mobicents
/trunk/protocols/ss7/service/src/main/java/org/mobicents/ss7
/trunk/protocols/ss7/service/src/main/java/org/mobicents/ss7/SS7Service.java
/trunk/protocols/ss7/service/src/main/java/org/mobicents/ss7/SS7ServiceMBean.java
/trunk/protocols/ss7/service/src/main/java/org/mobicents/ss7/ShellExecutor.java
=======================================
--- /dev/null
+++ /trunk/protocols/ss7/service/pom.xml Tue Dec 21 22:46:26 2010
@@ -0,0 +1,158 @@
+
+<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>
+ <artifactId>ss7-parent</artifactId>
+ <groupId>org.mobicents.protocols.ss7</groupId>
+ <version>1.0.0-SNAPSHOT</version>
+ </parent>
+ <artifactId>mobicents-ss7</artifactId>
+ <groupId>org.mobicents.protocols.ss7</groupId>
+ <version>1.0.0-SNAPSHOT</version>
+ <name>Mobicents SS7</name>
+ <properties>
+ <maven.test.skip>false</maven.test.skip>
+ </properties>
+ <developers>
+ <developer>
+ <id>oleg.kulikoff</id>
+ <name>Oleg Kulikoff</name>
+ <email>[email protected]</email>
+ <organization>JBoss/Red Hat</organization>
+ <organizationUrl>http://www.redhat.com/</organizationUrl>
+ <roles>
+ <role>Active Developer</role>
+ </roles>
+ <timezone>+3</timezone>
+ </developer>
+ <developer>
+ <id>amit.bhayani</id>
+ <name>Amit Bhayani</name>
+ <email>[email protected]</email>
+ <organization>JBoss/Red Hat</organization>
+ <organizationUrl>http://www.redhat.com/</organizationUrl>
+ <roles>
+ <role>Active Developer</role>
+ </roles>
+ <timezone>+5.5</timezone>
+ </developer>
+ <developer>
+ <id>baranowb</id>
+ <name>Bartosz Baranowski</name>
+ <email>[email protected]</email>
+ <organization>JBoss/Red Hat</organization>
+ <organizationUrl>http://www.redhat.com/</organizationUrl>
+ <roles>
+ <role>Active Developer</role>
+ </roles>
+ <timezone>+1</timezone>
+ </developer>
+ </developers>
+ <licenses>
+ <license>
+ <name>GNU GENERAL PUBLIC LICENSE</name>
+ <url>http://www.gnu.org/licenses/gpl.html</url>
+ <distribution>repo</distribution>
+ </license>
+ </licenses>
+ <dependencies>
+ <dependency>
+ <!-- This comes in container. -->
+ <groupId>org.jboss.jbossas</groupId>
+ <artifactId>jboss-as-system-jmx</artifactId>
+ <version>${jboss.version}</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.mobicents.protocols.ss7.sccp</groupId>
+ <artifactId>sccp-api</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.mobicents.protocols.ss7.sccp</groupId>
+ <artifactId>sccp-impl</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <artifactId>mtp</artifactId>
+ <groupId>org.mobicents.protocols.ss7.mtp</groupId>
+ </dependency>
+ <dependency>
+ <groupId>log4j</groupId>
+ <artifactId>log4j</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>concurrent</groupId>
+ <artifactId>concurrent</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>javolution</groupId>
+ <artifactId>javolution</artifactId>
+ </dependency>
+ <dependency>
+ <artifactId>shell</artifactId>
+ <groupId>org.mobicents.protocols.ss7.management</groupId>
+ <version>1.0.0-SNAPSHOT</version>
+ </dependency>
+ </dependencies>
+ <build>
+ <finalName>${pom.artifactId}-${pom.version}</finalName>
+ <plugins>
+ <plugin>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <groupId>org.apache.maven.plugins</groupId>
+ <configuration>
+ <source>1.5</source>
+ <target>1.5</target>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <configuration>
+ <archive>
+ <addMavenDescriptor>false</addMavenDescriptor>
+ </archive>
+ </configuration>
+ </plugin>
+ <plugin>
+ <artifactId>maven-assembly-plugin</artifactId>
+ <configuration>
+ <descriptors>
+ <descriptor>
+
src/main/assembly/pojo.xml
+ </descriptor>
+ </descriptors>
+ <!-- this is doubled in sccp-beans -->
+ <finalName>mobicents-ss7</finalName>
+ </configuration>
+ <executions>
+ <execution>
+ <phase>package</phase>
+ <goals>
+ <goal>directory-inline</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ <scm>
+ <connection>
+
scm:svn:https://mobicents.googlecode.com/svn/trunk/protocols/ss7/sccp
+ </connection>
+ <developerConnection>
+
scm:svn:https://mobicents.googlecode.com/svn/trunk/protocols/ss7/sccp
+ </developerConnection>
+ <url>
+
http://mobicents.googlecode.com/svn/trunk/protocols/ss7/sccp
+ </url>
+ </scm>
+</project>
=======================================
--- /dev/null
+++ /trunk/protocols/ss7/service/src/main/assembly/common.xml Tue Dec 21
22:46:26 2010
@@ -0,0 +1,20 @@
+<component>
+ <dependencySets>
+ <dependencySet>
+ <outputDirectory>/lib</outputDirectory>
+ <unpack>false</unpack>
+ <scope>runtime</scope>
+ <excludes>
+
<exclude>org.jboss.jbossas:jboss-as-system-jmx</exclude>
+ </excludes>
+ </dependencySet>
+ <dependencySet>
+ <outputDirectory>/lib</outputDirectory>
+ <unpack>false</unpack>
+ <scope>compile</scope>
+ <excludes>
+
<exclude>org.jboss.jbossas:jboss-as-system-jmx</exclude>
+ </excludes>
+ </dependencySet>
+ </dependencySets>
+</component>
=======================================
--- /dev/null
+++ /trunk/protocols/ss7/service/src/main/assembly/pojo.xml Tue Dec 21
22:46:26 2010
@@ -0,0 +1,49 @@
+<assembly>
+ <id>service</id>
+ <formats>
+ <format>zip</format>
+ </formats>
+ <includeBaseDirectory>false</includeBaseDirectory>
+ <files>
+ <file>
+ <source>src/main/config/jboss-beans.xml</source>
+ <destName>META-INF/jboss-beans.xml</destName>
+ <filtered>true</filtered>
+ </file>
+ <file>
+ <source>src/main/config/jboss-structure.xml</source>
+ <destName>META-INF/jboss-structure.xml</destName>
+ </file>
+ <file>
+ <source>src/main/config/sccp-routing.txt</source>
+ <destName>sccp-routing.txt</destName>
+ </file>
+ </files>
+ <dependencySets>
+ <dependencySet>
+ <outputDirectory>/lib</outputDirectory>
+ <unpack>false</unpack>
+ <scope>compile</scope>
+ <includes>
+
<include>org.mobicents.protocols.ss7.sccp:sccp-api</include>
+
<include>org.mobicents.protocols.ss7.sccp:sccp-impl</include>
+
<include>org.mobicents.protocols.ss7.m3ua:m3ua-api</include>
+
<include>org.mobicents.protocols.ss7.m3ua:m3ua-impl</include>
+
<include>org.mobicents.protocols.ss7.mtp:mtp</include>
+
<include>org.mobicents.protocols.stream:stream</include>
+
<include>org.mobicents.protocols.ss7:mobicents-ss7</include>
+ <include>javolution:javolution</include>
+
<include>org.mobicents.protocols.ss7.management:shell</include>
+ </includes>
+ </dependencySet>
+
+ </dependencySets>
+ <!-- DO NO USE componentDescriptors - seems like there is a bug which
gets all deps, regardles of include/exclude -->
+ <!--
+ <componentDescriptors>
+ <componentDescriptor>
+ src/main/assembly/common.xml
+ </componentDescriptor>
+ </componentDescriptors>
+ -->
+</assembly>
=======================================
--- /dev/null
+++ /trunk/protocols/ss7/service/src/main/config/jboss-beans.xml Tue Dec 21
22:46:26 2010
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<deployment xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="urn:jboss:bean-deployer:2.0 bean-deployer_2_0.xsd"
+ xmlns="urn:jboss:bean-deployer:2.0">
+
+
+ <!-- Dialogic hardware interface -->
+ <bean name="Dialogic"
class="org.mobicents.protocols.ss7.mtp.oam.DialogicLinksetFactory"/>
+
+ <bean name="LinksetManager"
class="org.mobicents.protocols.ss7.mtp.oam.LinksetManager">
+ <incallback method="addFactory" />
+ <uncallback method="removeFactory" />
+ </bean>
+
+ <!-- Mobicents SS7 service -->
+ <bean name="SS7Service" class="org.mobicents.ss7.SS7Service">
+
<annotation>@org.jboss.aop.microcontainer.aspects.jmx.JMX(name="org.mobicents.ss7:service=SS7Service",exposedInterface=org.mobicents.ss7.SS7ServiceMBean.class,registerDirectly=true)</annotation>
+ <property name="linksetManager"><inject
bean="LinksetManager"/></property>
+ <property name="jndiName">java:/mobicents/ss7/sccp</property>
+ <property
name="configPath">${catalina.home}/deploy/${pom.artifactId}-service/sccp-routing.txt</property>
+ </bean>
+
+</deployment>
=======================================
--- /dev/null
+++ /trunk/protocols/ss7/service/src/main/config/jboss-structure.xml Tue
Dec 21 22:46:26 2010
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<structure>
+ <context>
+ <path name=""/>
+ <metaDataPath>
+ <path name="META-INF"/>
+ </metaDataPath>
+ <classpath>
+ <path name="" />
+ <path name="lib" suffixes=".jar" />
+ </classpath>
+ </context>
+</structure>
=======================================
--- /dev/null
+++ /trunk/protocols/ss7/service/src/main/config/sccp-routing.txt Tue Dec
21 22:46:26 2010
@@ -0,0 +1,1 @@
+0; #ISDN_MOBILE#NATIONAL#9023629581# ;
#ISDN_MOBILE#INTERNATIONAL#79023629581# ;linkset#14083#14155#0
=======================================
--- /dev/null
+++
/trunk/protocols/ss7/service/src/main/java/org/mobicents/ss7/SS7Service.java
Tue Dec 21 22:46:26 2010
@@ -0,0 +1,124 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright XXXX, Red Hat Middleware LLC, 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 A
+ * 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;
+
+import javax.naming.Context;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+import org.apache.log4j.Logger;
+import org.jboss.system.ServiceMBeanSupport;
+import org.mobicents.protocols.ss7.mtp.oam.LinksetManager;
+import org.mobicents.protocols.ss7.sccp.impl.SccpStackImpl;
+
+/**
+ *
+ * @author kulikov
+ */
+public class SS7Service extends ServiceMBeanSupport implements
SS7ServiceMBean {
+
+ private ShellExecutor shell = new ShellExecutor();
+
+ private LinksetManager linksetManager;
+ private SccpStackImpl sccpStack;
+
+ private String path;
+ private String jndiName;
+
+ private Logger logger = Logger.getLogger(SS7Service.class);
+
+ @Override
+ public void startService() throws Exception {
+ //starting sccp router
+ logger.info("Starting SCCP stack...");
+
+ sccpStack = new SccpStackImpl();
+ sccpStack.setConfigPath(path);
+
+// sccpStack.setLinksets(linksets);
+ sccpStack.start();
+ rebind(sccpStack);
+
+ logger.info("SCCP stack Started. SccpProvider bound to " +
this.jndiName);
+
+ logger.info("Starting SS7 management shell environment");
+ shell.start();
+
+ logger.info("Started SS7 service");
+ }
+
+ public void setJndiName(String jndiName) {
+ this.jndiName = jndiName;
+ }
+
+ public String getJndiName() {
+ return jndiName;
+ }
+
+ public void setConfigPath(String path) {
+ this.path = path;
+ }
+
+ @Override
+ public void stopService() {
+ try {
+ unbind(jndiName);
+ } catch (Exception e) {
+ }
+ logger.info("Stopped SS7 service");
+ }
+
+ public void setLinksetManager(LinksetManager manager) {
+ this.linksetManager = manager;
+ }
+
+ public LinksetManager getLinksetManager() {
+ return linksetManager;
+ }
+
+ /**
+ * Binds trunk object to the JNDI under the jndiName.
+ */
+ private void rebind(SccpStackImpl stack) throws NamingException {
+ Context ctx = new InitialContext();
+ String tokens[] = jndiName.split("/");
+
+ for (int i = 0; i < tokens.length - 1; i++) {
+ if (tokens[i].trim().length() > 0) {
+ try {
+ ctx = (Context) ctx.lookup(tokens[i]);
+ } catch (NamingException e) {
+ ctx = ctx.createSubcontext(tokens[i]);
+ }
+ }
+ }
+
+ ctx.bind(tokens[tokens.length - 1], stack.getSccpProvider());
+ }
+
+ /**
+ * Unbounds object under specified name.
+ *
+ * @param jndiName
+ * the JNDI name of the object to be unbound.
+ */
+ private void unbind(String jndiName) throws NamingException {
+ InitialContext initialContext = new InitialContext();
+ initialContext.unbind(jndiName);
+ }
+
+}
=======================================
--- /dev/null
+++
/trunk/protocols/ss7/service/src/main/java/org/mobicents/ss7/SS7ServiceMBean.java
Tue Dec 21 22:46:26 2010
@@ -0,0 +1,31 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright XXXX, Red Hat Middleware LLC, 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 A
+ * 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;
+
+/**
+ *
+ * @author kulikov
+ */
+public interface SS7ServiceMBean {
+ public static final String ONAME =
"org.mobicents.ss7:service=SS7Service";
+
+ public void start() throws Exception;
+ public void stop();
+
+}
=======================================
--- /dev/null
+++
/trunk/protocols/ss7/service/src/main/java/org/mobicents/ss7/ShellExecutor.java
Tue Dec 21 22:46:26 2010
@@ -0,0 +1,47 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright XXXX, Red Hat Middleware LLC, 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 A
+ * 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;
+
+import org.mobicents.protocols.ss7.management.shell.server.ShellServer;
+
+/**
+ *
+ * @author kulikov
+ */
+public class ShellExecutor implements Runnable {
+ private ShellServer server = new ShellServer();
+
+ private volatile boolean started = false;
+
+ public void start() {
+ this.started = true;
+ new Thread(this).start();
+ }
+
+ public void stop() {
+ this.started = false;
+ }
+
+ public void run() {
+ while (started) {
+ server.perform();
+ }
+ }
+
+}