Skip to content

Commit

Permalink
smsc wildfly compatibility changes
Browse files Browse the repository at this point in the history
  • Loading branch information
anatolysatanovskiy-mobius committed Nov 3, 2017
1 parent 52f9bac commit 96f2574
Show file tree
Hide file tree
Showing 8 changed files with 98 additions and 55 deletions.
20 changes: 15 additions & 5 deletions core/bootstrap-wildfly/src/main/assemble/descriptor.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,20 @@
</fileSets>

<dependencySets>
<dependencySet>
<outputDirectory>/</outputDirectory>
<useTransitiveDependencies>false</useTransitiveDependencies>
</dependencySet>
</dependencySets>
<dependencySet>
<outputDirectory>/</outputDirectory>
<unpack>false</unpack>
<scope>runtime</scope>
<includes>
<include>org.restcomm.smpp:ch-smpp</include>
<include>org.restcomm.smpp:ch-commons-util</include>
<include>org.restcomm.smpp:ch-commons-charset</include>
<include>org.restcomm.smpp:bootstrap-wildfly</include>
<include>joda-time:joda-time</include>
<include>io.netty:netty</include>
<include>org.restcomm.smpp:smpp-extensions</include>
</includes>
</dependencySet>
</dependencySets>

</assembly>
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import org.jboss.msc.service.ServiceController;
import org.jboss.msc.service.ServiceName;
import org.restcomm.smpp.service.SmppService;
import org.restcomm.smpp.service.SmppServiceInterface;

import javax.management.MBeanServer;
import java.util.List;
Expand Down Expand Up @@ -51,7 +52,7 @@ public void performBoottime(OperationContext context, ModelNode operation, Model
service.setModel(fullModel);

ServiceName name = SmppService.getServiceName();
ServiceController<SmppService> controller = context.getServiceTarget()
ServiceController<SmppServiceInterface> controller = context.getServiceTarget()
.addService(name, service)
.addDependency(PathManagerService.SERVICE_NAME, PathManager.class, service.getPathManagerInjector())
.addDependency(MBeanServerService.SERVICE_NAME, MBeanServer.class, service.getMbeanServer())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
import javax.management.MBeanServer;
import javax.management.ObjectName;

public class SmppService implements Service<SmppService> {
public class SmppService implements SmppServiceInterface,Service<SmppServiceInterface> {

public static final SmppService INSTANCE = new SmppService();

Expand All @@ -40,7 +40,7 @@ public InjectedValue<MBeanServer> getMbeanServer() {
private static final String DATA_DIR = "jboss.server.data.dir";

private ModelNode fullModel;

private Scheduler schedulerMBean = null;
private SmppManagement smppManagementMBean = null;
private SmppShellExecutor smppShellExecutor = null;
Expand Down Expand Up @@ -101,66 +101,80 @@ public void start(StartContext context) throws StartException {
log.info("Starting SmppExtension Service");

String dataDir = pathManagerInjector.getValue().getPathEntry(DATA_DIR).resolvePath();

// ss7Clock
DefaultClock ss7Clock = null;
try {
ss7Clock = new DefaultClock();
} catch (Exception e) {
log.warn("SS7Clock MBean creating is failed: " + e);
}

// schedulerMBean
schedulerMBean = null;
try {
schedulerMBean = new Scheduler();
schedulerMBean.setClock(ss7Clock);
} catch (Exception e) {
log.warn("SS7Scheduler MBean creating is failed: " + e);
}


// smppManagementMBean
smppManagementMBean = SmppManagement.getInstance("SmppManagement");
smppManagementMBean.setMbeanServer(getMbeanServer().getValue());
smppManagementMBean.setPersistDir(dataDir);
smppManagementMBean.start();
registerMBean(smppManagementMBean, "org.restcomm.smpp:name=SmppManagement");

smppShellExecutor = null;
try {
smppShellExecutor = new SmppShellExecutor();
smppShellExecutor.setSmppManagement(smppManagementMBean);
} catch (Exception e) {
log.warn("SccpExecutor MBean creating is failed: " + e);
}

System.out.println("SMPP shellExecutorExists():" + shellExecutorExists());

if(shellExecutorExists()) {
// ss7Clock
DefaultClock ss7Clock = null;
try {
ss7Clock = new DefaultClock();
} catch (Exception e) {
log.warn("SS7Clock MBean creating is failed: " + e);
}

shellExecutorMBean = null;
try {
FastList<ShellExecutor> shellExecutors = new FastList<ShellExecutor>();
shellExecutors.add(smppShellExecutor);
// schedulerMBean
schedulerMBean = null;
try {
schedulerMBean = new Scheduler();
schedulerMBean.setClock(ss7Clock);
} catch (Exception e) {
log.warn("SS7Scheduler MBean creating is failed: " + e);
}

String address = getPropertyString("ShellExecutor", "address", "127.0.0.1");
int port = getPropertyInt("ShellExecutor", "port", 3435);
String securityDomain = getPropertyString("ShellExecutor", "securityDomain", "jmx-console");
shellExecutorMBean = null;
try {
FastList<ShellExecutor> shellExecutors = new FastList<ShellExecutor>();
shellExecutors.add(smppShellExecutor);

String address = getPropertyString("ShellExecutor", "address", "127.0.0.1");
int port = getPropertyInt("ShellExecutor", "port", 3436);
String securityDomain = getPropertyString("ShellExecutor", "securityDomain", "jmx-console");

shellExecutorMBean = new ShellServerWildFly(schedulerMBean, shellExecutors);
shellExecutorMBean.setAddress(address);
shellExecutorMBean.setPort(port);
shellExecutorMBean.setSecurityDomain(securityDomain);
} catch (Exception e) {
throw new StartException("ShellExecutor MBean creating is failed: " + e.getMessage(), e);
}

shellExecutorMBean = new ShellServerWildFly(schedulerMBean, shellExecutors);
shellExecutorMBean.setAddress(address);
shellExecutorMBean.setPort(port);
shellExecutorMBean.setSecurityDomain(securityDomain);
} catch (Exception e) {
throw new StartException("ShellExecutor MBean creating is failed: " + e.getMessage(), e);
// starting
try {
schedulerMBean.start();
shellExecutorMBean.start();
} catch (Exception e) {
throw new StartException("MBeans starting is failed: " + e.getMessage(), e);
}
}

// starting

try {
schedulerMBean.start();
smppShellExecutor.start();
shellExecutorMBean.start();
} catch (Exception e) {
throw new StartException("MBeans starting is failed: " + e.getMessage(), e);
}
}

private boolean shellExecutorExists() {
ModelNode shellExecutorNode = peek(fullModel, "mbean", "ShellExecutor");
return shellExecutorNode != null;
}

@Override
public void stop(StopContext context) {
log.info("Stopping SmppExtension Service");
Expand All @@ -184,11 +198,20 @@ private void registerMBean(Object mBean, String name) throws StartException {
}
}

private void unregisterMBean(String name) {
@SuppressWarnings("unused")
private void unregisterMBean(String name) {
try {
getMbeanServer().getValue().unregisterMBean(new ObjectName(name));
} catch (Throwable e) {
log.error("failed to unregister mbean", e);
}
}

public SmppShellExecutor getSmppShellExecutor() {
return smppShellExecutor;
}

public SmppManagement getSmppManagementMBean() {
return smppManagementMBean;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package org.restcomm.smpp.service;

import org.restcomm.smpp.SmppManagement;
import org.restcomm.smpp.oam.SmppShellExecutor;

public interface SmppServiceInterface
{
public SmppShellExecutor getSmppShellExecutor();
public SmppManagement getSmppManagementMBean();
}
9 changes: 2 additions & 7 deletions core/bootstrap-wildfly/src/main/module/module.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,6 @@
<resource-root path="ch-commons-util-${ch-commons-util.version}.jar"/>
<resource-root path="ch-smpp-${ch.smpp.version}.jar"/>

<resource-root path="scheduler-${jss7.restcomm.version}.jar"/>
<resource-root path="shell-server-api-${jss7.restcomm.version}.jar"/>
<resource-root path="shell-server-impl-${jss7.restcomm.version}.jar"/>
<resource-root path="shell-transport-${jss7.restcomm.version}.jar"/>

<resource-root path="javolution-${javolution.version}.jar"/>
<resource-root path="netty-${netty.version}.jar"/>
<resource-root path="joda-time-${joda-time.version}.jar"/>
</resources>
Expand All @@ -36,5 +30,6 @@
<module name="org.jboss.msc"/>
<module name="org.jboss.logging"/>
<module name="org.slf4j"/>
<module name="org.mobicents.ss7.commons"/>
</dependencies>
</module>
</module>
Binary file not shown.
8 changes: 6 additions & 2 deletions release/release-build-wildfly.xml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@

<!-- adding of ss7 subsystem into standalone.xml -->
<xmltask source="${jboss.standalone.path}/configuration/standalone.xml" dest="${jboss.standalone.path}/configuration/standalone.xml">
<remove path="/:server/:profile/*[local-name()='subsystem'][*[local-name()='mbean'][@reflection]]"/>
<remove path="/:server/:profile/*[local-name()='subsystem'][*[local-name()='mbean'][namespace-uri()='urn:org.restcomm:smpp-extensions:1.0'][@reflection]]"/>
<insert path="/:server/:profile/*[local-name()='subsystem'][last()]" position="after" file="template/wildfly-smpp-subsystem.txt"></insert>
</xmltask>

Expand Down Expand Up @@ -78,6 +78,10 @@
</fileset>
</copy>

<!-- Copy SS7 commons modules -->
<ant antfile="${jboss.home}/../extra/restcomm-ss7/ss7-wildfly/build.xml" target="deploy-commons">
<property name="basedir" value="${jboss.home}/../extra/restcomm-ss7/ss7-wildfly" />
</ant>
</target>

<target name="undeploy">
Expand All @@ -91,7 +95,7 @@
</xmltask>

<xmltask source="${jboss.standalone.path}/configuration/standalone.xml" dest="${jboss.standalone.path}/configuration/standalone.xml">
<remove path="/:server/:profile/*[local-name()='subsystem'][*[local-name()='mbean'][@name='SS7Clock']]"/>
<remove path="/:server/:profile/*[local-name()='subsystem'][*[local-name()='mbean'][namespace-uri()='urn:org.restcomm:smpp-extensions:1.0']]"/>
</xmltask>

<delete dir="${restcomm-smpp.path}" />
Expand Down
2 changes: 1 addition & 1 deletion release/wildfly-smpp-subsystem.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<mbean name="SmppShellExecutor" type="SmppShellExecutor"/>
<mbean name="ShellExecutor" type="ShellExecutor">
<property name="address" type="String" value="127.0.0.1"/>
<property name="port" type="int" value="3435"/>
<property name="port" type="int" value="3436"/>
<property name="securityDomain" type="String" value="jmx-console"/>
</mbean>
</subsystem>

0 comments on commit 96f2574

Please sign in to comment.